fidl_fuchsia_hardware_audio/
fidl_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 fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_hardware_audio__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct CodecConnectorConnectRequest {
16    pub codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for CodecConnectorConnectRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct CompositeConnectorConnectRequest {
26    pub composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for CompositeConnectorConnectRequest
31{
32}
33
34#[derive(Debug, PartialEq)]
35pub struct CompositeCreateRingBufferRequest {
36    pub processing_element_id: u64,
37    pub format: Format,
38    pub ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
42    for CompositeCreateRingBufferRequest
43{
44}
45
46#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct DaiConnectorConnectRequest {
48    pub dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
52    for DaiConnectorConnectRequest
53{
54}
55
56#[derive(Debug, PartialEq)]
57pub struct DaiCreateRingBufferRequest {
58    pub dai_format: DaiFormat,
59    pub ring_buffer_format: Format,
60    pub ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
64    for DaiCreateRingBufferRequest
65{
66}
67
68#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
69pub struct RingBufferGetVmoResponse {
70    pub num_frames: u32,
71    pub ring_buffer: fidl::Vmo,
72}
73
74impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RingBufferGetVmoResponse {}
75
76#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
77pub struct StreamConfigConnectorConnectRequest {
78    pub protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
79}
80
81impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
82    for StreamConfigConnectorConnectRequest
83{
84}
85
86#[derive(Debug, PartialEq)]
87pub struct StreamConfigCreateRingBufferRequest {
88    pub format: Format,
89    pub ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
90}
91
92impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
93    for StreamConfigCreateRingBufferRequest
94{
95}
96
97#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
98pub struct CodecMarker;
99
100impl fidl::endpoints::ProtocolMarker for CodecMarker {
101    type Proxy = CodecProxy;
102    type RequestStream = CodecRequestStream;
103    #[cfg(target_os = "fuchsia")]
104    type SynchronousProxy = CodecSynchronousProxy;
105
106    const DEBUG_NAME: &'static str = "(anonymous) Codec";
107}
108pub type CodecGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
109pub type CodecSetDaiFormatResult = Result<CodecFormatInfo, i32>;
110
111pub trait CodecProxyInterface: Send + Sync {
112    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
113        + Send;
114    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
115    fn r#signal_processing_connect(
116        &self,
117        protocol: fidl::endpoints::ServerEnd<
118            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
119        >,
120    ) -> Result<(), fidl::Error>;
121    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
122    fn r#reset(&self) -> Self::ResetResponseFut;
123    type GetPropertiesResponseFut: std::future::Future<Output = Result<CodecProperties, fidl::Error>>
124        + Send;
125    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
126    type StopResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
127    fn r#stop(&self) -> Self::StopResponseFut;
128    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
129    fn r#start(&self) -> Self::StartResponseFut;
130    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CodecGetDaiFormatsResult, fidl::Error>>
131        + Send;
132    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
133    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CodecSetDaiFormatResult, fidl::Error>>
134        + Send;
135    fn r#set_dai_format(&self, format: &DaiFormat) -> Self::SetDaiFormatResponseFut;
136    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
137        + Send;
138    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
139}
140#[derive(Debug)]
141#[cfg(target_os = "fuchsia")]
142pub struct CodecSynchronousProxy {
143    client: fidl::client::sync::Client,
144}
145
146#[cfg(target_os = "fuchsia")]
147impl fidl::endpoints::SynchronousProxy for CodecSynchronousProxy {
148    type Proxy = CodecProxy;
149    type Protocol = CodecMarker;
150
151    fn from_channel(inner: fidl::Channel) -> Self {
152        Self::new(inner)
153    }
154
155    fn into_channel(self) -> fidl::Channel {
156        self.client.into_channel()
157    }
158
159    fn as_channel(&self) -> &fidl::Channel {
160        self.client.as_channel()
161    }
162}
163
164#[cfg(target_os = "fuchsia")]
165impl CodecSynchronousProxy {
166    pub fn new(channel: fidl::Channel) -> Self {
167        let protocol_name = <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
168        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
169    }
170
171    pub fn into_channel(self) -> fidl::Channel {
172        self.client.into_channel()
173    }
174
175    /// Waits until an event arrives and returns it. It is safe for other
176    /// threads to make concurrent requests while waiting for an event.
177    pub fn wait_for_event(
178        &self,
179        deadline: zx::MonotonicInstant,
180    ) -> Result<CodecEvent, fidl::Error> {
181        CodecEvent::decode(self.client.wait_for_event(deadline)?)
182    }
183
184    /// Retrieves top level health state.
185    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
186    pub fn r#get_health_state(
187        &self,
188        ___deadline: zx::MonotonicInstant,
189    ) -> Result<HealthState, fidl::Error> {
190        let _response =
191            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
192                (),
193                0x4e146d6bca733a84,
194                fidl::encoding::DynamicFlags::empty(),
195                ___deadline,
196            )?;
197        Ok(_response.state)
198    }
199
200    /// Connect to a `SignalProcessing` protocol.
201    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
202    /// the maximum number of connections have already been created, for instance one, then the
203    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
204    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
205    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
206    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
207    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
208    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
209    /// is intended to be composed, and hence the more verbose name allows differentiation and
210    /// improved clarity.
211    pub fn r#signal_processing_connect(
212        &self,
213        mut protocol: fidl::endpoints::ServerEnd<
214            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
215        >,
216    ) -> Result<(), fidl::Error> {
217        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
218            (protocol,),
219            0xa81907ce6066295,
220            fidl::encoding::DynamicFlags::empty(),
221        )
222    }
223
224    /// Resets the codec.
225    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
226    /// codec it will close the codec protocol channel, in this case the client may obtain a new
227    /// codec protocol channel and retry.
228    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
229        let _response =
230            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
231                (),
232                0x50757ae579a7bd6b,
233                fidl::encoding::DynamicFlags::empty(),
234                ___deadline,
235            )?;
236        Ok(_response)
237    }
238
239    /// Retrieves top level static properties.
240    pub fn r#get_properties(
241        &self,
242        ___deadline: zx::MonotonicInstant,
243    ) -> Result<CodecProperties, fidl::Error> {
244        let _response =
245            self.client.send_query::<fidl::encoding::EmptyPayload, CodecGetPropertiesResponse>(
246                (),
247                0x7a0d138a6a1d9d90,
248                fidl::encoding::DynamicFlags::empty(),
249                ___deadline,
250            )?;
251        Ok(_response.properties)
252    }
253
254    /// Stops the codec operation.
255    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
256    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
257    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
258    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
259    /// in the CLOCK_MONOTONIC timeline.
260    /// If the driver cannot successfully configure the codec to stop, it will close the codec
261    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
262    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
263        let _response = self.client.send_query::<fidl::encoding::EmptyPayload, CodecStopResponse>(
264            (),
265            0x5c2e380df1332dbd,
266            fidl::encoding::DynamicFlags::empty(),
267            ___deadline,
268        )?;
269        Ok(_response.stop_time)
270    }
271
272    /// Start/Re-start the codec operation.
273    /// `Start` returns when configuring the codec to start is completed. This method does not wait
274    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
275    /// into account), nor is any such delay reflected in the returned `start_time`.
276    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
277    /// in the CLOCK_MONOTONIC timeline.
278    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
279    /// in which case the client may obtain a new codec protocol channel and retry.
280    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
281        let _response =
282            self.client.send_query::<fidl::encoding::EmptyPayload, CodecStartResponse>(
283                (),
284                0x329cdacb286ab00,
285                fidl::encoding::DynamicFlags::empty(),
286                ___deadline,
287            )?;
288        Ok(_response.start_time)
289    }
290
291    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
292    /// may reply with an error status and the controller may retry at a later time.
293    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
294    /// combinations of the parameters in DaiSupportedFormats may be supported.
295    pub fn r#get_dai_formats(
296        &self,
297        ___deadline: zx::MonotonicInstant,
298    ) -> Result<CodecGetDaiFormatsResult, fidl::Error> {
299        let _response = self.client.send_query::<
300            fidl::encoding::EmptyPayload,
301            fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>,
302        >(
303            (),
304            0xf8bbc46b4ba6a52,
305            fidl::encoding::DynamicFlags::empty(),
306            ___deadline,
307        )?;
308        Ok(_response.map(|x| x.formats))
309    }
310
311    /// Sets the DAI format to be used in the interface between the controller and codec.
312    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
313    pub fn r#set_dai_format(
314        &self,
315        mut format: &DaiFormat,
316        ___deadline: zx::MonotonicInstant,
317    ) -> Result<CodecSetDaiFormatResult, fidl::Error> {
318        let _response = self.client.send_query::<
319            CodecSetDaiFormatRequest,
320            fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>,
321        >(
322            (format,),
323            0x2f829df9e5a7a1ea,
324            fidl::encoding::DynamicFlags::empty(),
325            ___deadline,
326        )?;
327        Ok(_response.map(|x| x.state))
328    }
329
330    /// Get the plug detect state via a hanging get. The driver will reply to the first
331    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
332    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
333    pub fn r#watch_plug_state(
334        &self,
335        ___deadline: zx::MonotonicInstant,
336    ) -> Result<PlugState, fidl::Error> {
337        let _response =
338            self.client.send_query::<fidl::encoding::EmptyPayload, CodecWatchPlugStateResponse>(
339                (),
340                0x182b87f935ca7326,
341                fidl::encoding::DynamicFlags::empty(),
342                ___deadline,
343            )?;
344        Ok(_response.plug_state)
345    }
346}
347
348#[cfg(target_os = "fuchsia")]
349impl From<CodecSynchronousProxy> for zx::Handle {
350    fn from(value: CodecSynchronousProxy) -> Self {
351        value.into_channel().into()
352    }
353}
354
355#[cfg(target_os = "fuchsia")]
356impl From<fidl::Channel> for CodecSynchronousProxy {
357    fn from(value: fidl::Channel) -> Self {
358        Self::new(value)
359    }
360}
361
362#[cfg(target_os = "fuchsia")]
363impl fidl::endpoints::FromClient for CodecSynchronousProxy {
364    type Protocol = CodecMarker;
365
366    fn from_client(value: fidl::endpoints::ClientEnd<CodecMarker>) -> Self {
367        Self::new(value.into_channel())
368    }
369}
370
371#[derive(Debug, Clone)]
372pub struct CodecProxy {
373    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
374}
375
376impl fidl::endpoints::Proxy for CodecProxy {
377    type Protocol = CodecMarker;
378
379    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
380        Self::new(inner)
381    }
382
383    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
384        self.client.into_channel().map_err(|client| Self { client })
385    }
386
387    fn as_channel(&self) -> &::fidl::AsyncChannel {
388        self.client.as_channel()
389    }
390}
391
392impl CodecProxy {
393    /// Create a new Proxy for fuchsia.hardware.audio/Codec.
394    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
395        let protocol_name = <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
396        Self { client: fidl::client::Client::new(channel, protocol_name) }
397    }
398
399    /// Get a Stream of events from the remote end of the protocol.
400    ///
401    /// # Panics
402    ///
403    /// Panics if the event stream was already taken.
404    pub fn take_event_stream(&self) -> CodecEventStream {
405        CodecEventStream { event_receiver: self.client.take_event_receiver() }
406    }
407
408    /// Retrieves top level health state.
409    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
410    pub fn r#get_health_state(
411        &self,
412    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
413    {
414        CodecProxyInterface::r#get_health_state(self)
415    }
416
417    /// Connect to a `SignalProcessing` protocol.
418    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
419    /// the maximum number of connections have already been created, for instance one, then the
420    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
421    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
422    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
423    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
424    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
425    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
426    /// is intended to be composed, and hence the more verbose name allows differentiation and
427    /// improved clarity.
428    pub fn r#signal_processing_connect(
429        &self,
430        mut protocol: fidl::endpoints::ServerEnd<
431            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
432        >,
433    ) -> Result<(), fidl::Error> {
434        CodecProxyInterface::r#signal_processing_connect(self, protocol)
435    }
436
437    /// Resets the codec.
438    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
439    /// codec it will close the codec protocol channel, in this case the client may obtain a new
440    /// codec protocol channel and retry.
441    pub fn r#reset(
442        &self,
443    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
444        CodecProxyInterface::r#reset(self)
445    }
446
447    /// Retrieves top level static properties.
448    pub fn r#get_properties(
449        &self,
450    ) -> fidl::client::QueryResponseFut<
451        CodecProperties,
452        fidl::encoding::DefaultFuchsiaResourceDialect,
453    > {
454        CodecProxyInterface::r#get_properties(self)
455    }
456
457    /// Stops the codec operation.
458    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
459    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
460    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
461    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
462    /// in the CLOCK_MONOTONIC timeline.
463    /// If the driver cannot successfully configure the codec to stop, it will close the codec
464    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
465    pub fn r#stop(
466        &self,
467    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
468        CodecProxyInterface::r#stop(self)
469    }
470
471    /// Start/Re-start the codec operation.
472    /// `Start` returns when configuring the codec to start is completed. This method does not wait
473    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
474    /// into account), nor is any such delay reflected in the returned `start_time`.
475    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
476    /// in the CLOCK_MONOTONIC timeline.
477    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
478    /// in which case the client may obtain a new codec protocol channel and retry.
479    pub fn r#start(
480        &self,
481    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
482        CodecProxyInterface::r#start(self)
483    }
484
485    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
486    /// may reply with an error status and the controller may retry at a later time.
487    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
488    /// combinations of the parameters in DaiSupportedFormats may be supported.
489    pub fn r#get_dai_formats(
490        &self,
491    ) -> fidl::client::QueryResponseFut<
492        CodecGetDaiFormatsResult,
493        fidl::encoding::DefaultFuchsiaResourceDialect,
494    > {
495        CodecProxyInterface::r#get_dai_formats(self)
496    }
497
498    /// Sets the DAI format to be used in the interface between the controller and codec.
499    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
500    pub fn r#set_dai_format(
501        &self,
502        mut format: &DaiFormat,
503    ) -> fidl::client::QueryResponseFut<
504        CodecSetDaiFormatResult,
505        fidl::encoding::DefaultFuchsiaResourceDialect,
506    > {
507        CodecProxyInterface::r#set_dai_format(self, format)
508    }
509
510    /// Get the plug detect state via a hanging get. The driver will reply to the first
511    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
512    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
513    pub fn r#watch_plug_state(
514        &self,
515    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
516    {
517        CodecProxyInterface::r#watch_plug_state(self)
518    }
519}
520
521impl CodecProxyInterface for CodecProxy {
522    type GetHealthStateResponseFut =
523        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
524    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
525        fn _decode(
526            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
527        ) -> Result<HealthState, fidl::Error> {
528            let _response = fidl::client::decode_transaction_body::<
529                HealthGetHealthStateResponse,
530                fidl::encoding::DefaultFuchsiaResourceDialect,
531                0x4e146d6bca733a84,
532            >(_buf?)?;
533            Ok(_response.state)
534        }
535        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
536            (),
537            0x4e146d6bca733a84,
538            fidl::encoding::DynamicFlags::empty(),
539            _decode,
540        )
541    }
542
543    fn r#signal_processing_connect(
544        &self,
545        mut protocol: fidl::endpoints::ServerEnd<
546            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
547        >,
548    ) -> Result<(), fidl::Error> {
549        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
550            (protocol,),
551            0xa81907ce6066295,
552            fidl::encoding::DynamicFlags::empty(),
553        )
554    }
555
556    type ResetResponseFut =
557        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
558    fn r#reset(&self) -> Self::ResetResponseFut {
559        fn _decode(
560            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
561        ) -> Result<(), fidl::Error> {
562            let _response = fidl::client::decode_transaction_body::<
563                fidl::encoding::EmptyPayload,
564                fidl::encoding::DefaultFuchsiaResourceDialect,
565                0x50757ae579a7bd6b,
566            >(_buf?)?;
567            Ok(_response)
568        }
569        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
570            (),
571            0x50757ae579a7bd6b,
572            fidl::encoding::DynamicFlags::empty(),
573            _decode,
574        )
575    }
576
577    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
578        CodecProperties,
579        fidl::encoding::DefaultFuchsiaResourceDialect,
580    >;
581    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
582        fn _decode(
583            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
584        ) -> Result<CodecProperties, fidl::Error> {
585            let _response = fidl::client::decode_transaction_body::<
586                CodecGetPropertiesResponse,
587                fidl::encoding::DefaultFuchsiaResourceDialect,
588                0x7a0d138a6a1d9d90,
589            >(_buf?)?;
590            Ok(_response.properties)
591        }
592        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecProperties>(
593            (),
594            0x7a0d138a6a1d9d90,
595            fidl::encoding::DynamicFlags::empty(),
596            _decode,
597        )
598    }
599
600    type StopResponseFut =
601        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
602    fn r#stop(&self) -> Self::StopResponseFut {
603        fn _decode(
604            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
605        ) -> Result<i64, fidl::Error> {
606            let _response = fidl::client::decode_transaction_body::<
607                CodecStopResponse,
608                fidl::encoding::DefaultFuchsiaResourceDialect,
609                0x5c2e380df1332dbd,
610            >(_buf?)?;
611            Ok(_response.stop_time)
612        }
613        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
614            (),
615            0x5c2e380df1332dbd,
616            fidl::encoding::DynamicFlags::empty(),
617            _decode,
618        )
619    }
620
621    type StartResponseFut =
622        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
623    fn r#start(&self) -> Self::StartResponseFut {
624        fn _decode(
625            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
626        ) -> Result<i64, fidl::Error> {
627            let _response = fidl::client::decode_transaction_body::<
628                CodecStartResponse,
629                fidl::encoding::DefaultFuchsiaResourceDialect,
630                0x329cdacb286ab00,
631            >(_buf?)?;
632            Ok(_response.start_time)
633        }
634        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
635            (),
636            0x329cdacb286ab00,
637            fidl::encoding::DynamicFlags::empty(),
638            _decode,
639        )
640    }
641
642    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
643        CodecGetDaiFormatsResult,
644        fidl::encoding::DefaultFuchsiaResourceDialect,
645    >;
646    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
647        fn _decode(
648            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
649        ) -> Result<CodecGetDaiFormatsResult, fidl::Error> {
650            let _response = fidl::client::decode_transaction_body::<
651                fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>,
652                fidl::encoding::DefaultFuchsiaResourceDialect,
653                0xf8bbc46b4ba6a52,
654            >(_buf?)?;
655            Ok(_response.map(|x| x.formats))
656        }
657        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecGetDaiFormatsResult>(
658            (),
659            0xf8bbc46b4ba6a52,
660            fidl::encoding::DynamicFlags::empty(),
661            _decode,
662        )
663    }
664
665    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
666        CodecSetDaiFormatResult,
667        fidl::encoding::DefaultFuchsiaResourceDialect,
668    >;
669    fn r#set_dai_format(&self, mut format: &DaiFormat) -> Self::SetDaiFormatResponseFut {
670        fn _decode(
671            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
672        ) -> Result<CodecSetDaiFormatResult, fidl::Error> {
673            let _response = fidl::client::decode_transaction_body::<
674                fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>,
675                fidl::encoding::DefaultFuchsiaResourceDialect,
676                0x2f829df9e5a7a1ea,
677            >(_buf?)?;
678            Ok(_response.map(|x| x.state))
679        }
680        self.client.send_query_and_decode::<CodecSetDaiFormatRequest, CodecSetDaiFormatResult>(
681            (format,),
682            0x2f829df9e5a7a1ea,
683            fidl::encoding::DynamicFlags::empty(),
684            _decode,
685        )
686    }
687
688    type WatchPlugStateResponseFut =
689        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
690    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
691        fn _decode(
692            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
693        ) -> Result<PlugState, fidl::Error> {
694            let _response = fidl::client::decode_transaction_body::<
695                CodecWatchPlugStateResponse,
696                fidl::encoding::DefaultFuchsiaResourceDialect,
697                0x182b87f935ca7326,
698            >(_buf?)?;
699            Ok(_response.plug_state)
700        }
701        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
702            (),
703            0x182b87f935ca7326,
704            fidl::encoding::DynamicFlags::empty(),
705            _decode,
706        )
707    }
708}
709
710pub struct CodecEventStream {
711    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
712}
713
714impl std::marker::Unpin for CodecEventStream {}
715
716impl futures::stream::FusedStream for CodecEventStream {
717    fn is_terminated(&self) -> bool {
718        self.event_receiver.is_terminated()
719    }
720}
721
722impl futures::Stream for CodecEventStream {
723    type Item = Result<CodecEvent, fidl::Error>;
724
725    fn poll_next(
726        mut self: std::pin::Pin<&mut Self>,
727        cx: &mut std::task::Context<'_>,
728    ) -> std::task::Poll<Option<Self::Item>> {
729        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
730            &mut self.event_receiver,
731            cx
732        )?) {
733            Some(buf) => std::task::Poll::Ready(Some(CodecEvent::decode(buf))),
734            None => std::task::Poll::Ready(None),
735        }
736    }
737}
738
739#[derive(Debug)]
740pub enum CodecEvent {}
741
742impl CodecEvent {
743    /// Decodes a message buffer as a [`CodecEvent`].
744    fn decode(
745        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
746    ) -> Result<CodecEvent, fidl::Error> {
747        let (bytes, _handles) = buf.split_mut();
748        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
749        debug_assert_eq!(tx_header.tx_id, 0);
750        match tx_header.ordinal {
751            _ => Err(fidl::Error::UnknownOrdinal {
752                ordinal: tx_header.ordinal,
753                protocol_name: <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
754            }),
755        }
756    }
757}
758
759/// A Stream of incoming requests for fuchsia.hardware.audio/Codec.
760pub struct CodecRequestStream {
761    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
762    is_terminated: bool,
763}
764
765impl std::marker::Unpin for CodecRequestStream {}
766
767impl futures::stream::FusedStream for CodecRequestStream {
768    fn is_terminated(&self) -> bool {
769        self.is_terminated
770    }
771}
772
773impl fidl::endpoints::RequestStream for CodecRequestStream {
774    type Protocol = CodecMarker;
775    type ControlHandle = CodecControlHandle;
776
777    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
778        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
779    }
780
781    fn control_handle(&self) -> Self::ControlHandle {
782        CodecControlHandle { inner: self.inner.clone() }
783    }
784
785    fn into_inner(
786        self,
787    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
788    {
789        (self.inner, self.is_terminated)
790    }
791
792    fn from_inner(
793        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
794        is_terminated: bool,
795    ) -> Self {
796        Self { inner, is_terminated }
797    }
798}
799
800impl futures::Stream for CodecRequestStream {
801    type Item = Result<CodecRequest, fidl::Error>;
802
803    fn poll_next(
804        mut self: std::pin::Pin<&mut Self>,
805        cx: &mut std::task::Context<'_>,
806    ) -> std::task::Poll<Option<Self::Item>> {
807        let this = &mut *self;
808        if this.inner.check_shutdown(cx) {
809            this.is_terminated = true;
810            return std::task::Poll::Ready(None);
811        }
812        if this.is_terminated {
813            panic!("polled CodecRequestStream after completion");
814        }
815        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
816            |bytes, handles| {
817                match this.inner.channel().read_etc(cx, bytes, handles) {
818                    std::task::Poll::Ready(Ok(())) => {}
819                    std::task::Poll::Pending => return std::task::Poll::Pending,
820                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
821                        this.is_terminated = true;
822                        return std::task::Poll::Ready(None);
823                    }
824                    std::task::Poll::Ready(Err(e)) => {
825                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
826                            e.into(),
827                        ))));
828                    }
829                }
830
831                // A message has been received from the channel
832                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
833
834                std::task::Poll::Ready(Some(match header.ordinal {
835                    0x4e146d6bca733a84 => {
836                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
837                        let mut req = fidl::new_empty!(
838                            fidl::encoding::EmptyPayload,
839                            fidl::encoding::DefaultFuchsiaResourceDialect
840                        );
841                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
842                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
843                        Ok(CodecRequest::GetHealthState {
844                            responder: CodecGetHealthStateResponder {
845                                control_handle: std::mem::ManuallyDrop::new(control_handle),
846                                tx_id: header.tx_id,
847                            },
848                        })
849                    }
850                    0xa81907ce6066295 => {
851                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
852                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
853                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
854                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
855                        Ok(CodecRequest::SignalProcessingConnect {
856                            protocol: req.protocol,
857
858                            control_handle,
859                        })
860                    }
861                    0x50757ae579a7bd6b => {
862                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
863                        let mut req = fidl::new_empty!(
864                            fidl::encoding::EmptyPayload,
865                            fidl::encoding::DefaultFuchsiaResourceDialect
866                        );
867                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
868                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
869                        Ok(CodecRequest::Reset {
870                            responder: CodecResetResponder {
871                                control_handle: std::mem::ManuallyDrop::new(control_handle),
872                                tx_id: header.tx_id,
873                            },
874                        })
875                    }
876                    0x7a0d138a6a1d9d90 => {
877                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
878                        let mut req = fidl::new_empty!(
879                            fidl::encoding::EmptyPayload,
880                            fidl::encoding::DefaultFuchsiaResourceDialect
881                        );
882                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
883                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
884                        Ok(CodecRequest::GetProperties {
885                            responder: CodecGetPropertiesResponder {
886                                control_handle: std::mem::ManuallyDrop::new(control_handle),
887                                tx_id: header.tx_id,
888                            },
889                        })
890                    }
891                    0x5c2e380df1332dbd => {
892                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
893                        let mut req = fidl::new_empty!(
894                            fidl::encoding::EmptyPayload,
895                            fidl::encoding::DefaultFuchsiaResourceDialect
896                        );
897                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
898                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
899                        Ok(CodecRequest::Stop {
900                            responder: CodecStopResponder {
901                                control_handle: std::mem::ManuallyDrop::new(control_handle),
902                                tx_id: header.tx_id,
903                            },
904                        })
905                    }
906                    0x329cdacb286ab00 => {
907                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
908                        let mut req = fidl::new_empty!(
909                            fidl::encoding::EmptyPayload,
910                            fidl::encoding::DefaultFuchsiaResourceDialect
911                        );
912                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
913                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
914                        Ok(CodecRequest::Start {
915                            responder: CodecStartResponder {
916                                control_handle: std::mem::ManuallyDrop::new(control_handle),
917                                tx_id: header.tx_id,
918                            },
919                        })
920                    }
921                    0xf8bbc46b4ba6a52 => {
922                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
923                        let mut req = fidl::new_empty!(
924                            fidl::encoding::EmptyPayload,
925                            fidl::encoding::DefaultFuchsiaResourceDialect
926                        );
927                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
928                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
929                        Ok(CodecRequest::GetDaiFormats {
930                            responder: CodecGetDaiFormatsResponder {
931                                control_handle: std::mem::ManuallyDrop::new(control_handle),
932                                tx_id: header.tx_id,
933                            },
934                        })
935                    }
936                    0x2f829df9e5a7a1ea => {
937                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
938                        let mut req = fidl::new_empty!(
939                            CodecSetDaiFormatRequest,
940                            fidl::encoding::DefaultFuchsiaResourceDialect
941                        );
942                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
943                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
944                        Ok(CodecRequest::SetDaiFormat {
945                            format: req.format,
946
947                            responder: CodecSetDaiFormatResponder {
948                                control_handle: std::mem::ManuallyDrop::new(control_handle),
949                                tx_id: header.tx_id,
950                            },
951                        })
952                    }
953                    0x182b87f935ca7326 => {
954                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
955                        let mut req = fidl::new_empty!(
956                            fidl::encoding::EmptyPayload,
957                            fidl::encoding::DefaultFuchsiaResourceDialect
958                        );
959                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
960                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
961                        Ok(CodecRequest::WatchPlugState {
962                            responder: CodecWatchPlugStateResponder {
963                                control_handle: std::mem::ManuallyDrop::new(control_handle),
964                                tx_id: header.tx_id,
965                            },
966                        })
967                    }
968                    _ => Err(fidl::Error::UnknownOrdinal {
969                        ordinal: header.ordinal,
970                        protocol_name: <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
971                    }),
972                }))
973            },
974        )
975    }
976}
977
978/// For an overview see
979/// [[Audio Codec Interface]](https://fuchsia.dev/fuchsia-src/development/audio/drivers/codec).
980/// # Deprecation
981///
982/// Not supported anymore, instead use an
983/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
984/// with one DAI and no Ring Buffer, see
985/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
986#[derive(Debug)]
987pub enum CodecRequest {
988    /// Retrieves top level health state.
989    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
990    GetHealthState { responder: CodecGetHealthStateResponder },
991    /// Connect to a `SignalProcessing` protocol.
992    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
993    /// the maximum number of connections have already been created, for instance one, then the
994    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
995    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
996    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
997    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
998    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
999    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
1000    /// is intended to be composed, and hence the more verbose name allows differentiation and
1001    /// improved clarity.
1002    SignalProcessingConnect {
1003        protocol: fidl::endpoints::ServerEnd<
1004            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1005        >,
1006        control_handle: CodecControlHandle,
1007    },
1008    /// Resets the codec.
1009    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
1010    /// codec it will close the codec protocol channel, in this case the client may obtain a new
1011    /// codec protocol channel and retry.
1012    Reset { responder: CodecResetResponder },
1013    /// Retrieves top level static properties.
1014    GetProperties { responder: CodecGetPropertiesResponder },
1015    /// Stops the codec operation.
1016    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
1017    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
1018    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
1019    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
1020    /// in the CLOCK_MONOTONIC timeline.
1021    /// If the driver cannot successfully configure the codec to stop, it will close the codec
1022    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
1023    Stop { responder: CodecStopResponder },
1024    /// Start/Re-start the codec operation.
1025    /// `Start` returns when configuring the codec to start is completed. This method does not wait
1026    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
1027    /// into account), nor is any such delay reflected in the returned `start_time`.
1028    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
1029    /// in the CLOCK_MONOTONIC timeline.
1030    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
1031    /// in which case the client may obtain a new codec protocol channel and retry.
1032    Start { responder: CodecStartResponder },
1033    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
1034    /// may reply with an error status and the controller may retry at a later time.
1035    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
1036    /// combinations of the parameters in DaiSupportedFormats may be supported.
1037    GetDaiFormats { responder: CodecGetDaiFormatsResponder },
1038    /// Sets the DAI format to be used in the interface between the controller and codec.
1039    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
1040    SetDaiFormat { format: DaiFormat, responder: CodecSetDaiFormatResponder },
1041    /// Get the plug detect state via a hanging get. The driver will reply to the first
1042    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
1043    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
1044    WatchPlugState { responder: CodecWatchPlugStateResponder },
1045}
1046
1047impl CodecRequest {
1048    #[allow(irrefutable_let_patterns)]
1049    pub fn into_get_health_state(self) -> Option<(CodecGetHealthStateResponder)> {
1050        if let CodecRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
1051    }
1052
1053    #[allow(irrefutable_let_patterns)]
1054    pub fn into_signal_processing_connect(
1055        self,
1056    ) -> Option<(
1057        fidl::endpoints::ServerEnd<
1058            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1059        >,
1060        CodecControlHandle,
1061    )> {
1062        if let CodecRequest::SignalProcessingConnect { protocol, control_handle } = self {
1063            Some((protocol, control_handle))
1064        } else {
1065            None
1066        }
1067    }
1068
1069    #[allow(irrefutable_let_patterns)]
1070    pub fn into_reset(self) -> Option<(CodecResetResponder)> {
1071        if let CodecRequest::Reset { responder } = self { Some((responder)) } else { None }
1072    }
1073
1074    #[allow(irrefutable_let_patterns)]
1075    pub fn into_get_properties(self) -> Option<(CodecGetPropertiesResponder)> {
1076        if let CodecRequest::GetProperties { responder } = self { Some((responder)) } else { None }
1077    }
1078
1079    #[allow(irrefutable_let_patterns)]
1080    pub fn into_stop(self) -> Option<(CodecStopResponder)> {
1081        if let CodecRequest::Stop { responder } = self { Some((responder)) } else { None }
1082    }
1083
1084    #[allow(irrefutable_let_patterns)]
1085    pub fn into_start(self) -> Option<(CodecStartResponder)> {
1086        if let CodecRequest::Start { responder } = self { Some((responder)) } else { None }
1087    }
1088
1089    #[allow(irrefutable_let_patterns)]
1090    pub fn into_get_dai_formats(self) -> Option<(CodecGetDaiFormatsResponder)> {
1091        if let CodecRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
1092    }
1093
1094    #[allow(irrefutable_let_patterns)]
1095    pub fn into_set_dai_format(self) -> Option<(DaiFormat, CodecSetDaiFormatResponder)> {
1096        if let CodecRequest::SetDaiFormat { format, responder } = self {
1097            Some((format, responder))
1098        } else {
1099            None
1100        }
1101    }
1102
1103    #[allow(irrefutable_let_patterns)]
1104    pub fn into_watch_plug_state(self) -> Option<(CodecWatchPlugStateResponder)> {
1105        if let CodecRequest::WatchPlugState { responder } = self { Some((responder)) } else { None }
1106    }
1107
1108    /// Name of the method defined in FIDL
1109    pub fn method_name(&self) -> &'static str {
1110        match *self {
1111            CodecRequest::GetHealthState { .. } => "get_health_state",
1112            CodecRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
1113            CodecRequest::Reset { .. } => "reset",
1114            CodecRequest::GetProperties { .. } => "get_properties",
1115            CodecRequest::Stop { .. } => "stop",
1116            CodecRequest::Start { .. } => "start",
1117            CodecRequest::GetDaiFormats { .. } => "get_dai_formats",
1118            CodecRequest::SetDaiFormat { .. } => "set_dai_format",
1119            CodecRequest::WatchPlugState { .. } => "watch_plug_state",
1120        }
1121    }
1122}
1123
1124#[derive(Debug, Clone)]
1125pub struct CodecControlHandle {
1126    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1127}
1128
1129impl fidl::endpoints::ControlHandle for CodecControlHandle {
1130    fn shutdown(&self) {
1131        self.inner.shutdown()
1132    }
1133    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1134        self.inner.shutdown_with_epitaph(status)
1135    }
1136
1137    fn is_closed(&self) -> bool {
1138        self.inner.channel().is_closed()
1139    }
1140    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1141        self.inner.channel().on_closed()
1142    }
1143
1144    #[cfg(target_os = "fuchsia")]
1145    fn signal_peer(
1146        &self,
1147        clear_mask: zx::Signals,
1148        set_mask: zx::Signals,
1149    ) -> Result<(), zx_status::Status> {
1150        use fidl::Peered;
1151        self.inner.channel().signal_peer(clear_mask, set_mask)
1152    }
1153}
1154
1155impl CodecControlHandle {}
1156
1157#[must_use = "FIDL methods require a response to be sent"]
1158#[derive(Debug)]
1159pub struct CodecGetHealthStateResponder {
1160    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1161    tx_id: u32,
1162}
1163
1164/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1165/// if the responder is dropped without sending a response, so that the client
1166/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1167impl std::ops::Drop for CodecGetHealthStateResponder {
1168    fn drop(&mut self) {
1169        self.control_handle.shutdown();
1170        // Safety: drops once, never accessed again
1171        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1172    }
1173}
1174
1175impl fidl::endpoints::Responder for CodecGetHealthStateResponder {
1176    type ControlHandle = CodecControlHandle;
1177
1178    fn control_handle(&self) -> &CodecControlHandle {
1179        &self.control_handle
1180    }
1181
1182    fn drop_without_shutdown(mut self) {
1183        // Safety: drops once, never accessed again due to mem::forget
1184        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1185        // Prevent Drop from running (which would shut down the channel)
1186        std::mem::forget(self);
1187    }
1188}
1189
1190impl CodecGetHealthStateResponder {
1191    /// Sends a response to the FIDL transaction.
1192    ///
1193    /// Sets the channel to shutdown if an error occurs.
1194    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1195        let _result = self.send_raw(state);
1196        if _result.is_err() {
1197            self.control_handle.shutdown();
1198        }
1199        self.drop_without_shutdown();
1200        _result
1201    }
1202
1203    /// Similar to "send" but does not shutdown the channel if an error occurs.
1204    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1205        let _result = self.send_raw(state);
1206        self.drop_without_shutdown();
1207        _result
1208    }
1209
1210    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
1211        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
1212            (state,),
1213            self.tx_id,
1214            0x4e146d6bca733a84,
1215            fidl::encoding::DynamicFlags::empty(),
1216        )
1217    }
1218}
1219
1220#[must_use = "FIDL methods require a response to be sent"]
1221#[derive(Debug)]
1222pub struct CodecResetResponder {
1223    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1224    tx_id: u32,
1225}
1226
1227/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1228/// if the responder is dropped without sending a response, so that the client
1229/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1230impl std::ops::Drop for CodecResetResponder {
1231    fn drop(&mut self) {
1232        self.control_handle.shutdown();
1233        // Safety: drops once, never accessed again
1234        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1235    }
1236}
1237
1238impl fidl::endpoints::Responder for CodecResetResponder {
1239    type ControlHandle = CodecControlHandle;
1240
1241    fn control_handle(&self) -> &CodecControlHandle {
1242        &self.control_handle
1243    }
1244
1245    fn drop_without_shutdown(mut self) {
1246        // Safety: drops once, never accessed again due to mem::forget
1247        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1248        // Prevent Drop from running (which would shut down the channel)
1249        std::mem::forget(self);
1250    }
1251}
1252
1253impl CodecResetResponder {
1254    /// Sends a response to the FIDL transaction.
1255    ///
1256    /// Sets the channel to shutdown if an error occurs.
1257    pub fn send(self) -> Result<(), fidl::Error> {
1258        let _result = self.send_raw();
1259        if _result.is_err() {
1260            self.control_handle.shutdown();
1261        }
1262        self.drop_without_shutdown();
1263        _result
1264    }
1265
1266    /// Similar to "send" but does not shutdown the channel if an error occurs.
1267    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1268        let _result = self.send_raw();
1269        self.drop_without_shutdown();
1270        _result
1271    }
1272
1273    fn send_raw(&self) -> Result<(), fidl::Error> {
1274        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1275            (),
1276            self.tx_id,
1277            0x50757ae579a7bd6b,
1278            fidl::encoding::DynamicFlags::empty(),
1279        )
1280    }
1281}
1282
1283#[must_use = "FIDL methods require a response to be sent"]
1284#[derive(Debug)]
1285pub struct CodecGetPropertiesResponder {
1286    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1287    tx_id: u32,
1288}
1289
1290/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1291/// if the responder is dropped without sending a response, so that the client
1292/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1293impl std::ops::Drop for CodecGetPropertiesResponder {
1294    fn drop(&mut self) {
1295        self.control_handle.shutdown();
1296        // Safety: drops once, never accessed again
1297        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1298    }
1299}
1300
1301impl fidl::endpoints::Responder for CodecGetPropertiesResponder {
1302    type ControlHandle = CodecControlHandle;
1303
1304    fn control_handle(&self) -> &CodecControlHandle {
1305        &self.control_handle
1306    }
1307
1308    fn drop_without_shutdown(mut self) {
1309        // Safety: drops once, never accessed again due to mem::forget
1310        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1311        // Prevent Drop from running (which would shut down the channel)
1312        std::mem::forget(self);
1313    }
1314}
1315
1316impl CodecGetPropertiesResponder {
1317    /// Sends a response to the FIDL transaction.
1318    ///
1319    /// Sets the channel to shutdown if an error occurs.
1320    pub fn send(self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1321        let _result = self.send_raw(properties);
1322        if _result.is_err() {
1323            self.control_handle.shutdown();
1324        }
1325        self.drop_without_shutdown();
1326        _result
1327    }
1328
1329    /// Similar to "send" but does not shutdown the channel if an error occurs.
1330    pub fn send_no_shutdown_on_err(
1331        self,
1332        mut properties: &CodecProperties,
1333    ) -> Result<(), fidl::Error> {
1334        let _result = self.send_raw(properties);
1335        self.drop_without_shutdown();
1336        _result
1337    }
1338
1339    fn send_raw(&self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1340        self.control_handle.inner.send::<CodecGetPropertiesResponse>(
1341            (properties,),
1342            self.tx_id,
1343            0x7a0d138a6a1d9d90,
1344            fidl::encoding::DynamicFlags::empty(),
1345        )
1346    }
1347}
1348
1349#[must_use = "FIDL methods require a response to be sent"]
1350#[derive(Debug)]
1351pub struct CodecStopResponder {
1352    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1353    tx_id: u32,
1354}
1355
1356/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1357/// if the responder is dropped without sending a response, so that the client
1358/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1359impl std::ops::Drop for CodecStopResponder {
1360    fn drop(&mut self) {
1361        self.control_handle.shutdown();
1362        // Safety: drops once, never accessed again
1363        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1364    }
1365}
1366
1367impl fidl::endpoints::Responder for CodecStopResponder {
1368    type ControlHandle = CodecControlHandle;
1369
1370    fn control_handle(&self) -> &CodecControlHandle {
1371        &self.control_handle
1372    }
1373
1374    fn drop_without_shutdown(mut self) {
1375        // Safety: drops once, never accessed again due to mem::forget
1376        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1377        // Prevent Drop from running (which would shut down the channel)
1378        std::mem::forget(self);
1379    }
1380}
1381
1382impl CodecStopResponder {
1383    /// Sends a response to the FIDL transaction.
1384    ///
1385    /// Sets the channel to shutdown if an error occurs.
1386    pub fn send(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1387        let _result = self.send_raw(stop_time);
1388        if _result.is_err() {
1389            self.control_handle.shutdown();
1390        }
1391        self.drop_without_shutdown();
1392        _result
1393    }
1394
1395    /// Similar to "send" but does not shutdown the channel if an error occurs.
1396    pub fn send_no_shutdown_on_err(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1397        let _result = self.send_raw(stop_time);
1398        self.drop_without_shutdown();
1399        _result
1400    }
1401
1402    fn send_raw(&self, mut stop_time: i64) -> Result<(), fidl::Error> {
1403        self.control_handle.inner.send::<CodecStopResponse>(
1404            (stop_time,),
1405            self.tx_id,
1406            0x5c2e380df1332dbd,
1407            fidl::encoding::DynamicFlags::empty(),
1408        )
1409    }
1410}
1411
1412#[must_use = "FIDL methods require a response to be sent"]
1413#[derive(Debug)]
1414pub struct CodecStartResponder {
1415    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1416    tx_id: u32,
1417}
1418
1419/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1420/// if the responder is dropped without sending a response, so that the client
1421/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1422impl std::ops::Drop for CodecStartResponder {
1423    fn drop(&mut self) {
1424        self.control_handle.shutdown();
1425        // Safety: drops once, never accessed again
1426        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1427    }
1428}
1429
1430impl fidl::endpoints::Responder for CodecStartResponder {
1431    type ControlHandle = CodecControlHandle;
1432
1433    fn control_handle(&self) -> &CodecControlHandle {
1434        &self.control_handle
1435    }
1436
1437    fn drop_without_shutdown(mut self) {
1438        // Safety: drops once, never accessed again due to mem::forget
1439        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1440        // Prevent Drop from running (which would shut down the channel)
1441        std::mem::forget(self);
1442    }
1443}
1444
1445impl CodecStartResponder {
1446    /// Sends a response to the FIDL transaction.
1447    ///
1448    /// Sets the channel to shutdown if an error occurs.
1449    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
1450        let _result = self.send_raw(start_time);
1451        if _result.is_err() {
1452            self.control_handle.shutdown();
1453        }
1454        self.drop_without_shutdown();
1455        _result
1456    }
1457
1458    /// Similar to "send" but does not shutdown the channel if an error occurs.
1459    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
1460        let _result = self.send_raw(start_time);
1461        self.drop_without_shutdown();
1462        _result
1463    }
1464
1465    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
1466        self.control_handle.inner.send::<CodecStartResponse>(
1467            (start_time,),
1468            self.tx_id,
1469            0x329cdacb286ab00,
1470            fidl::encoding::DynamicFlags::empty(),
1471        )
1472    }
1473}
1474
1475#[must_use = "FIDL methods require a response to be sent"]
1476#[derive(Debug)]
1477pub struct CodecGetDaiFormatsResponder {
1478    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1479    tx_id: u32,
1480}
1481
1482/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1483/// if the responder is dropped without sending a response, so that the client
1484/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1485impl std::ops::Drop for CodecGetDaiFormatsResponder {
1486    fn drop(&mut self) {
1487        self.control_handle.shutdown();
1488        // Safety: drops once, never accessed again
1489        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1490    }
1491}
1492
1493impl fidl::endpoints::Responder for CodecGetDaiFormatsResponder {
1494    type ControlHandle = CodecControlHandle;
1495
1496    fn control_handle(&self) -> &CodecControlHandle {
1497        &self.control_handle
1498    }
1499
1500    fn drop_without_shutdown(mut self) {
1501        // Safety: drops once, never accessed again due to mem::forget
1502        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1503        // Prevent Drop from running (which would shut down the channel)
1504        std::mem::forget(self);
1505    }
1506}
1507
1508impl CodecGetDaiFormatsResponder {
1509    /// Sends a response to the FIDL transaction.
1510    ///
1511    /// Sets the channel to shutdown if an error occurs.
1512    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1513        let _result = self.send_raw(result);
1514        if _result.is_err() {
1515            self.control_handle.shutdown();
1516        }
1517        self.drop_without_shutdown();
1518        _result
1519    }
1520
1521    /// Similar to "send" but does not shutdown the channel if an error occurs.
1522    pub fn send_no_shutdown_on_err(
1523        self,
1524        mut result: Result<&[DaiSupportedFormats], i32>,
1525    ) -> Result<(), fidl::Error> {
1526        let _result = self.send_raw(result);
1527        self.drop_without_shutdown();
1528        _result
1529    }
1530
1531    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1532        self.control_handle
1533            .inner
1534            .send::<fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>>(
1535                result.map(|formats| (formats,)),
1536                self.tx_id,
1537                0xf8bbc46b4ba6a52,
1538                fidl::encoding::DynamicFlags::empty(),
1539            )
1540    }
1541}
1542
1543#[must_use = "FIDL methods require a response to be sent"]
1544#[derive(Debug)]
1545pub struct CodecSetDaiFormatResponder {
1546    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1547    tx_id: u32,
1548}
1549
1550/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1551/// if the responder is dropped without sending a response, so that the client
1552/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1553impl std::ops::Drop for CodecSetDaiFormatResponder {
1554    fn drop(&mut self) {
1555        self.control_handle.shutdown();
1556        // Safety: drops once, never accessed again
1557        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1558    }
1559}
1560
1561impl fidl::endpoints::Responder for CodecSetDaiFormatResponder {
1562    type ControlHandle = CodecControlHandle;
1563
1564    fn control_handle(&self) -> &CodecControlHandle {
1565        &self.control_handle
1566    }
1567
1568    fn drop_without_shutdown(mut self) {
1569        // Safety: drops once, never accessed again due to mem::forget
1570        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1571        // Prevent Drop from running (which would shut down the channel)
1572        std::mem::forget(self);
1573    }
1574}
1575
1576impl CodecSetDaiFormatResponder {
1577    /// Sends a response to the FIDL transaction.
1578    ///
1579    /// Sets the channel to shutdown if an error occurs.
1580    pub fn send(self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1581        let _result = self.send_raw(result);
1582        if _result.is_err() {
1583            self.control_handle.shutdown();
1584        }
1585        self.drop_without_shutdown();
1586        _result
1587    }
1588
1589    /// Similar to "send" but does not shutdown the channel if an error occurs.
1590    pub fn send_no_shutdown_on_err(
1591        self,
1592        mut result: Result<&CodecFormatInfo, i32>,
1593    ) -> Result<(), fidl::Error> {
1594        let _result = self.send_raw(result);
1595        self.drop_without_shutdown();
1596        _result
1597    }
1598
1599    fn send_raw(&self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1600        self.control_handle
1601            .inner
1602            .send::<fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>>(
1603                result.map(|state| (state,)),
1604                self.tx_id,
1605                0x2f829df9e5a7a1ea,
1606                fidl::encoding::DynamicFlags::empty(),
1607            )
1608    }
1609}
1610
1611#[must_use = "FIDL methods require a response to be sent"]
1612#[derive(Debug)]
1613pub struct CodecWatchPlugStateResponder {
1614    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1615    tx_id: u32,
1616}
1617
1618/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1619/// if the responder is dropped without sending a response, so that the client
1620/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1621impl std::ops::Drop for CodecWatchPlugStateResponder {
1622    fn drop(&mut self) {
1623        self.control_handle.shutdown();
1624        // Safety: drops once, never accessed again
1625        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1626    }
1627}
1628
1629impl fidl::endpoints::Responder for CodecWatchPlugStateResponder {
1630    type ControlHandle = CodecControlHandle;
1631
1632    fn control_handle(&self) -> &CodecControlHandle {
1633        &self.control_handle
1634    }
1635
1636    fn drop_without_shutdown(mut self) {
1637        // Safety: drops once, never accessed again due to mem::forget
1638        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1639        // Prevent Drop from running (which would shut down the channel)
1640        std::mem::forget(self);
1641    }
1642}
1643
1644impl CodecWatchPlugStateResponder {
1645    /// Sends a response to the FIDL transaction.
1646    ///
1647    /// Sets the channel to shutdown if an error occurs.
1648    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1649        let _result = self.send_raw(plug_state);
1650        if _result.is_err() {
1651            self.control_handle.shutdown();
1652        }
1653        self.drop_without_shutdown();
1654        _result
1655    }
1656
1657    /// Similar to "send" but does not shutdown the channel if an error occurs.
1658    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1659        let _result = self.send_raw(plug_state);
1660        self.drop_without_shutdown();
1661        _result
1662    }
1663
1664    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1665        self.control_handle.inner.send::<CodecWatchPlugStateResponse>(
1666            (plug_state,),
1667            self.tx_id,
1668            0x182b87f935ca7326,
1669            fidl::encoding::DynamicFlags::empty(),
1670        )
1671    }
1672}
1673
1674#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1675pub struct CodecConnectorMarker;
1676
1677impl fidl::endpoints::ProtocolMarker for CodecConnectorMarker {
1678    type Proxy = CodecConnectorProxy;
1679    type RequestStream = CodecConnectorRequestStream;
1680    #[cfg(target_os = "fuchsia")]
1681    type SynchronousProxy = CodecConnectorSynchronousProxy;
1682
1683    const DEBUG_NAME: &'static str = "(anonymous) CodecConnector";
1684}
1685
1686pub trait CodecConnectorProxyInterface: Send + Sync {
1687    fn r#connect(
1688        &self,
1689        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1690    ) -> Result<(), fidl::Error>;
1691}
1692#[derive(Debug)]
1693#[cfg(target_os = "fuchsia")]
1694pub struct CodecConnectorSynchronousProxy {
1695    client: fidl::client::sync::Client,
1696}
1697
1698#[cfg(target_os = "fuchsia")]
1699impl fidl::endpoints::SynchronousProxy for CodecConnectorSynchronousProxy {
1700    type Proxy = CodecConnectorProxy;
1701    type Protocol = CodecConnectorMarker;
1702
1703    fn from_channel(inner: fidl::Channel) -> Self {
1704        Self::new(inner)
1705    }
1706
1707    fn into_channel(self) -> fidl::Channel {
1708        self.client.into_channel()
1709    }
1710
1711    fn as_channel(&self) -> &fidl::Channel {
1712        self.client.as_channel()
1713    }
1714}
1715
1716#[cfg(target_os = "fuchsia")]
1717impl CodecConnectorSynchronousProxy {
1718    pub fn new(channel: fidl::Channel) -> Self {
1719        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1720        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1721    }
1722
1723    pub fn into_channel(self) -> fidl::Channel {
1724        self.client.into_channel()
1725    }
1726
1727    /// Waits until an event arrives and returns it. It is safe for other
1728    /// threads to make concurrent requests while waiting for an event.
1729    pub fn wait_for_event(
1730        &self,
1731        deadline: zx::MonotonicInstant,
1732    ) -> Result<CodecConnectorEvent, fidl::Error> {
1733        CodecConnectorEvent::decode(self.client.wait_for_event(deadline)?)
1734    }
1735
1736    /// Connect to a Codec protocol server.
1737    /// This indirection into the Codec protocol allows us to support independent codec client
1738    /// connections.
1739    pub fn r#connect(
1740        &self,
1741        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1742    ) -> Result<(), fidl::Error> {
1743        self.client.send::<CodecConnectorConnectRequest>(
1744            (codec_protocol,),
1745            0x1413f551544026c9,
1746            fidl::encoding::DynamicFlags::empty(),
1747        )
1748    }
1749}
1750
1751#[cfg(target_os = "fuchsia")]
1752impl From<CodecConnectorSynchronousProxy> for zx::Handle {
1753    fn from(value: CodecConnectorSynchronousProxy) -> Self {
1754        value.into_channel().into()
1755    }
1756}
1757
1758#[cfg(target_os = "fuchsia")]
1759impl From<fidl::Channel> for CodecConnectorSynchronousProxy {
1760    fn from(value: fidl::Channel) -> Self {
1761        Self::new(value)
1762    }
1763}
1764
1765#[cfg(target_os = "fuchsia")]
1766impl fidl::endpoints::FromClient for CodecConnectorSynchronousProxy {
1767    type Protocol = CodecConnectorMarker;
1768
1769    fn from_client(value: fidl::endpoints::ClientEnd<CodecConnectorMarker>) -> Self {
1770        Self::new(value.into_channel())
1771    }
1772}
1773
1774#[derive(Debug, Clone)]
1775pub struct CodecConnectorProxy {
1776    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1777}
1778
1779impl fidl::endpoints::Proxy for CodecConnectorProxy {
1780    type Protocol = CodecConnectorMarker;
1781
1782    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1783        Self::new(inner)
1784    }
1785
1786    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1787        self.client.into_channel().map_err(|client| Self { client })
1788    }
1789
1790    fn as_channel(&self) -> &::fidl::AsyncChannel {
1791        self.client.as_channel()
1792    }
1793}
1794
1795impl CodecConnectorProxy {
1796    /// Create a new Proxy for fuchsia.hardware.audio/CodecConnector.
1797    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1798        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1799        Self { client: fidl::client::Client::new(channel, protocol_name) }
1800    }
1801
1802    /// Get a Stream of events from the remote end of the protocol.
1803    ///
1804    /// # Panics
1805    ///
1806    /// Panics if the event stream was already taken.
1807    pub fn take_event_stream(&self) -> CodecConnectorEventStream {
1808        CodecConnectorEventStream { event_receiver: self.client.take_event_receiver() }
1809    }
1810
1811    /// Connect to a Codec protocol server.
1812    /// This indirection into the Codec protocol allows us to support independent codec client
1813    /// connections.
1814    pub fn r#connect(
1815        &self,
1816        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1817    ) -> Result<(), fidl::Error> {
1818        CodecConnectorProxyInterface::r#connect(self, codec_protocol)
1819    }
1820}
1821
1822impl CodecConnectorProxyInterface for CodecConnectorProxy {
1823    fn r#connect(
1824        &self,
1825        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1826    ) -> Result<(), fidl::Error> {
1827        self.client.send::<CodecConnectorConnectRequest>(
1828            (codec_protocol,),
1829            0x1413f551544026c9,
1830            fidl::encoding::DynamicFlags::empty(),
1831        )
1832    }
1833}
1834
1835pub struct CodecConnectorEventStream {
1836    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1837}
1838
1839impl std::marker::Unpin for CodecConnectorEventStream {}
1840
1841impl futures::stream::FusedStream for CodecConnectorEventStream {
1842    fn is_terminated(&self) -> bool {
1843        self.event_receiver.is_terminated()
1844    }
1845}
1846
1847impl futures::Stream for CodecConnectorEventStream {
1848    type Item = Result<CodecConnectorEvent, fidl::Error>;
1849
1850    fn poll_next(
1851        mut self: std::pin::Pin<&mut Self>,
1852        cx: &mut std::task::Context<'_>,
1853    ) -> std::task::Poll<Option<Self::Item>> {
1854        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1855            &mut self.event_receiver,
1856            cx
1857        )?) {
1858            Some(buf) => std::task::Poll::Ready(Some(CodecConnectorEvent::decode(buf))),
1859            None => std::task::Poll::Ready(None),
1860        }
1861    }
1862}
1863
1864#[derive(Debug)]
1865pub enum CodecConnectorEvent {}
1866
1867impl CodecConnectorEvent {
1868    /// Decodes a message buffer as a [`CodecConnectorEvent`].
1869    fn decode(
1870        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1871    ) -> Result<CodecConnectorEvent, fidl::Error> {
1872        let (bytes, _handles) = buf.split_mut();
1873        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1874        debug_assert_eq!(tx_header.tx_id, 0);
1875        match tx_header.ordinal {
1876            _ => Err(fidl::Error::UnknownOrdinal {
1877                ordinal: tx_header.ordinal,
1878                protocol_name:
1879                    <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1880            }),
1881        }
1882    }
1883}
1884
1885/// A Stream of incoming requests for fuchsia.hardware.audio/CodecConnector.
1886pub struct CodecConnectorRequestStream {
1887    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1888    is_terminated: bool,
1889}
1890
1891impl std::marker::Unpin for CodecConnectorRequestStream {}
1892
1893impl futures::stream::FusedStream for CodecConnectorRequestStream {
1894    fn is_terminated(&self) -> bool {
1895        self.is_terminated
1896    }
1897}
1898
1899impl fidl::endpoints::RequestStream for CodecConnectorRequestStream {
1900    type Protocol = CodecConnectorMarker;
1901    type ControlHandle = CodecConnectorControlHandle;
1902
1903    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1904        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1905    }
1906
1907    fn control_handle(&self) -> Self::ControlHandle {
1908        CodecConnectorControlHandle { inner: self.inner.clone() }
1909    }
1910
1911    fn into_inner(
1912        self,
1913    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1914    {
1915        (self.inner, self.is_terminated)
1916    }
1917
1918    fn from_inner(
1919        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1920        is_terminated: bool,
1921    ) -> Self {
1922        Self { inner, is_terminated }
1923    }
1924}
1925
1926impl futures::Stream for CodecConnectorRequestStream {
1927    type Item = Result<CodecConnectorRequest, fidl::Error>;
1928
1929    fn poll_next(
1930        mut self: std::pin::Pin<&mut Self>,
1931        cx: &mut std::task::Context<'_>,
1932    ) -> std::task::Poll<Option<Self::Item>> {
1933        let this = &mut *self;
1934        if this.inner.check_shutdown(cx) {
1935            this.is_terminated = true;
1936            return std::task::Poll::Ready(None);
1937        }
1938        if this.is_terminated {
1939            panic!("polled CodecConnectorRequestStream after completion");
1940        }
1941        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1942            |bytes, handles| {
1943                match this.inner.channel().read_etc(cx, bytes, handles) {
1944                    std::task::Poll::Ready(Ok(())) => {}
1945                    std::task::Poll::Pending => return std::task::Poll::Pending,
1946                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1947                        this.is_terminated = true;
1948                        return std::task::Poll::Ready(None);
1949                    }
1950                    std::task::Poll::Ready(Err(e)) => {
1951                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1952                            e.into(),
1953                        ))));
1954                    }
1955                }
1956
1957                // A message has been received from the channel
1958                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1959
1960                std::task::Poll::Ready(Some(match header.ordinal {
1961                    0x1413f551544026c9 => {
1962                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1963                        let mut req = fidl::new_empty!(
1964                            CodecConnectorConnectRequest,
1965                            fidl::encoding::DefaultFuchsiaResourceDialect
1966                        );
1967                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1968                        let control_handle =
1969                            CodecConnectorControlHandle { inner: this.inner.clone() };
1970                        Ok(CodecConnectorRequest::Connect {
1971                            codec_protocol: req.codec_protocol,
1972
1973                            control_handle,
1974                        })
1975                    }
1976                    _ => Err(fidl::Error::UnknownOrdinal {
1977                        ordinal: header.ordinal,
1978                        protocol_name:
1979                            <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1980                    }),
1981                }))
1982            },
1983        )
1984    }
1985}
1986
1987/// For an overview of the Codec protocols see
1988/// [Codec Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_codec.md)
1989/// # Deprecation
1990///
1991/// Not supported anymore, instead use an
1992/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
1993/// with one DAI and no Ring Buffer, see
1994/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
1995#[derive(Debug)]
1996pub enum CodecConnectorRequest {
1997    /// Connect to a Codec protocol server.
1998    /// This indirection into the Codec protocol allows us to support independent codec client
1999    /// connections.
2000    Connect {
2001        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2002        control_handle: CodecConnectorControlHandle,
2003    },
2004}
2005
2006impl CodecConnectorRequest {
2007    #[allow(irrefutable_let_patterns)]
2008    pub fn into_connect(
2009        self,
2010    ) -> Option<(fidl::endpoints::ServerEnd<CodecMarker>, CodecConnectorControlHandle)> {
2011        if let CodecConnectorRequest::Connect { codec_protocol, control_handle } = self {
2012            Some((codec_protocol, control_handle))
2013        } else {
2014            None
2015        }
2016    }
2017
2018    /// Name of the method defined in FIDL
2019    pub fn method_name(&self) -> &'static str {
2020        match *self {
2021            CodecConnectorRequest::Connect { .. } => "connect",
2022        }
2023    }
2024}
2025
2026#[derive(Debug, Clone)]
2027pub struct CodecConnectorControlHandle {
2028    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2029}
2030
2031impl fidl::endpoints::ControlHandle for CodecConnectorControlHandle {
2032    fn shutdown(&self) {
2033        self.inner.shutdown()
2034    }
2035    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2036        self.inner.shutdown_with_epitaph(status)
2037    }
2038
2039    fn is_closed(&self) -> bool {
2040        self.inner.channel().is_closed()
2041    }
2042    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2043        self.inner.channel().on_closed()
2044    }
2045
2046    #[cfg(target_os = "fuchsia")]
2047    fn signal_peer(
2048        &self,
2049        clear_mask: zx::Signals,
2050        set_mask: zx::Signals,
2051    ) -> Result<(), zx_status::Status> {
2052        use fidl::Peered;
2053        self.inner.channel().signal_peer(clear_mask, set_mask)
2054    }
2055}
2056
2057impl CodecConnectorControlHandle {}
2058
2059#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2060pub struct CompositeMarker;
2061
2062impl fidl::endpoints::ProtocolMarker for CompositeMarker {
2063    type Proxy = CompositeProxy;
2064    type RequestStream = CompositeRequestStream;
2065    #[cfg(target_os = "fuchsia")]
2066    type SynchronousProxy = CompositeSynchronousProxy;
2067
2068    const DEBUG_NAME: &'static str = "(anonymous) Composite";
2069}
2070pub type CompositeResetResult = Result<(), DriverError>;
2071pub type CompositeGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, DriverError>;
2072pub type CompositeCreateRingBufferResult = Result<(), DriverError>;
2073pub type CompositeGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, DriverError>;
2074pub type CompositeSetDaiFormatResult = Result<(), DriverError>;
2075
2076pub trait CompositeProxyInterface: Send + Sync {
2077    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
2078        + Send;
2079    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
2080    fn r#signal_processing_connect(
2081        &self,
2082        protocol: fidl::endpoints::ServerEnd<
2083            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2084        >,
2085    ) -> Result<(), fidl::Error>;
2086    type ResetResponseFut: std::future::Future<Output = Result<CompositeResetResult, fidl::Error>>
2087        + Send;
2088    fn r#reset(&self) -> Self::ResetResponseFut;
2089    type GetPropertiesResponseFut: std::future::Future<Output = Result<CompositeProperties, fidl::Error>>
2090        + Send;
2091    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
2092    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<CompositeGetRingBufferFormatsResult, fidl::Error>>
2093        + Send;
2094    fn r#get_ring_buffer_formats(
2095        &self,
2096        processing_element_id: u64,
2097    ) -> Self::GetRingBufferFormatsResponseFut;
2098    type CreateRingBufferResponseFut: std::future::Future<Output = Result<CompositeCreateRingBufferResult, fidl::Error>>
2099        + Send;
2100    fn r#create_ring_buffer(
2101        &self,
2102        processing_element_id: u64,
2103        format: &Format,
2104        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2105    ) -> Self::CreateRingBufferResponseFut;
2106    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CompositeGetDaiFormatsResult, fidl::Error>>
2107        + Send;
2108    fn r#get_dai_formats(&self, processing_element_id: u64) -> Self::GetDaiFormatsResponseFut;
2109    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CompositeSetDaiFormatResult, fidl::Error>>
2110        + Send;
2111    fn r#set_dai_format(
2112        &self,
2113        processing_element_id: u64,
2114        format: &DaiFormat,
2115    ) -> Self::SetDaiFormatResponseFut;
2116}
2117#[derive(Debug)]
2118#[cfg(target_os = "fuchsia")]
2119pub struct CompositeSynchronousProxy {
2120    client: fidl::client::sync::Client,
2121}
2122
2123#[cfg(target_os = "fuchsia")]
2124impl fidl::endpoints::SynchronousProxy for CompositeSynchronousProxy {
2125    type Proxy = CompositeProxy;
2126    type Protocol = CompositeMarker;
2127
2128    fn from_channel(inner: fidl::Channel) -> Self {
2129        Self::new(inner)
2130    }
2131
2132    fn into_channel(self) -> fidl::Channel {
2133        self.client.into_channel()
2134    }
2135
2136    fn as_channel(&self) -> &fidl::Channel {
2137        self.client.as_channel()
2138    }
2139}
2140
2141#[cfg(target_os = "fuchsia")]
2142impl CompositeSynchronousProxy {
2143    pub fn new(channel: fidl::Channel) -> Self {
2144        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2145        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2146    }
2147
2148    pub fn into_channel(self) -> fidl::Channel {
2149        self.client.into_channel()
2150    }
2151
2152    /// Waits until an event arrives and returns it. It is safe for other
2153    /// threads to make concurrent requests while waiting for an event.
2154    pub fn wait_for_event(
2155        &self,
2156        deadline: zx::MonotonicInstant,
2157    ) -> Result<CompositeEvent, fidl::Error> {
2158        CompositeEvent::decode(self.client.wait_for_event(deadline)?)
2159    }
2160
2161    /// Retrieves top level health state.
2162    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2163    pub fn r#get_health_state(
2164        &self,
2165        ___deadline: zx::MonotonicInstant,
2166    ) -> Result<HealthState, fidl::Error> {
2167        let _response =
2168            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
2169                (),
2170                0x4e146d6bca733a84,
2171                fidl::encoding::DynamicFlags::empty(),
2172                ___deadline,
2173            )?;
2174        Ok(_response.state)
2175    }
2176
2177    /// Connect to a `SignalProcessing` protocol.
2178    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2179    /// the maximum number of connections have already been created, for instance one, then the
2180    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2181    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2182    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2183    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2184    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2185    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2186    /// is intended to be composed, and hence the more verbose name allows differentiation and
2187    /// improved clarity.
2188    pub fn r#signal_processing_connect(
2189        &self,
2190        mut protocol: fidl::endpoints::ServerEnd<
2191            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2192        >,
2193    ) -> Result<(), fidl::Error> {
2194        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2195            (protocol,),
2196            0xa81907ce6066295,
2197            fidl::encoding::DynamicFlags::empty(),
2198        )
2199    }
2200
2201    /// Resets the hardware including all DAI interconnects and signal processing.
2202    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2203    ///
2204    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2205    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2206    /// any processing elements, and reconstruct any ring buffers.
2207    ///
2208    /// If the driver can't successfully reset the hardware, it will return an error and then close
2209    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2210    pub fn r#reset(
2211        &self,
2212        ___deadline: zx::MonotonicInstant,
2213    ) -> Result<CompositeResetResult, fidl::Error> {
2214        let _response = self.client.send_query::<
2215            fidl::encoding::EmptyPayload,
2216            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2217        >(
2218            (),
2219            0xac355fb98341996,
2220            fidl::encoding::DynamicFlags::empty(),
2221            ___deadline,
2222        )?;
2223        Ok(_response.map(|x| x))
2224    }
2225
2226    /// Retrieves top level static properties.
2227    pub fn r#get_properties(
2228        &self,
2229        ___deadline: zx::MonotonicInstant,
2230    ) -> Result<CompositeProperties, fidl::Error> {
2231        let _response = self
2232            .client
2233            .send_query::<fidl::encoding::EmptyPayload, CompositeGetPropertiesResponse>(
2234                (),
2235                0x31846fa0a459942b,
2236                fidl::encoding::DynamicFlags::empty(),
2237                ___deadline,
2238            )?;
2239        Ok(_response.properties)
2240    }
2241
2242    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2243    /// in the topology supported by this driver as returned by `GetElements` from
2244    /// fuchsia.hardware.audio.signalprocessing.
2245    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2246    /// client may retry at a later time.
2247    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2248    /// by `GetElements`.
2249    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2250    /// `RING_BUFFER`.
2251    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
2252    /// the parameters in `SupportedFormats` may be supported.
2253    pub fn r#get_ring_buffer_formats(
2254        &self,
2255        mut processing_element_id: u64,
2256        ___deadline: zx::MonotonicInstant,
2257    ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2258        let _response = self.client.send_query::<
2259            CompositeGetRingBufferFormatsRequest,
2260            fidl::encoding::ResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2261        >(
2262            (processing_element_id,),
2263            0x1d89b701b6816ac4,
2264            fidl::encoding::DynamicFlags::empty(),
2265            ___deadline,
2266        )?;
2267        Ok(_response.map(|x| x.ring_buffer_formats))
2268    }
2269
2270    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2271    /// processing element specified by `processing_element_id`. The format is based on information
2272    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2273    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2274    /// audio buffer provided by the driver.
2275    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2276    /// by `GetElements`.
2277    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2278    /// `RING_BUFFER`.
2279    pub fn r#create_ring_buffer(
2280        &self,
2281        mut processing_element_id: u64,
2282        mut format: &Format,
2283        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2284        ___deadline: zx::MonotonicInstant,
2285    ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2286        let _response = self.client.send_query::<
2287            CompositeCreateRingBufferRequest,
2288            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2289        >(
2290            (processing_element_id, format, ring_buffer,),
2291            0x28c5685f85262033,
2292            fidl::encoding::DynamicFlags::empty(),
2293            ___deadline,
2294        )?;
2295        Ok(_response.map(|x| x))
2296    }
2297
2298    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2299    /// in the topology supported by this driver as returned by `GetElements` from
2300    /// fuchsia.hardware.audio.signalprocessing.
2301    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2302    /// may retry at a later time.
2303    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2304    /// by `GetElements`.
2305    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2306    /// `DAI_INTERCONNECT`.
2307    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2308    /// the parameters in SupportedFormats may be supported.
2309    pub fn r#get_dai_formats(
2310        &self,
2311        mut processing_element_id: u64,
2312        ___deadline: zx::MonotonicInstant,
2313    ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2314        let _response = self.client.send_query::<
2315            CompositeGetDaiFormatsRequest,
2316            fidl::encoding::ResultType<CompositeGetDaiFormatsResponse, DriverError>,
2317        >(
2318            (processing_element_id,),
2319            0x3cbeaed59c8f69b,
2320            fidl::encoding::DynamicFlags::empty(),
2321            ___deadline,
2322        )?;
2323        Ok(_response.map(|x| x.dai_formats))
2324    }
2325
2326    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2327    /// processing element specified by `processing_element_id`. The format is based on information
2328    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2329    /// requirement.
2330    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2331    /// by `GetElements`.
2332    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2333    /// `DAI_INTERCONNECT`.
2334    pub fn r#set_dai_format(
2335        &self,
2336        mut processing_element_id: u64,
2337        mut format: &DaiFormat,
2338        ___deadline: zx::MonotonicInstant,
2339    ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2340        let _response = self.client.send_query::<
2341            CompositeSetDaiFormatRequest,
2342            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2343        >(
2344            (processing_element_id, format,),
2345            0x155acf5cc0dc8a84,
2346            fidl::encoding::DynamicFlags::empty(),
2347            ___deadline,
2348        )?;
2349        Ok(_response.map(|x| x))
2350    }
2351}
2352
2353#[cfg(target_os = "fuchsia")]
2354impl From<CompositeSynchronousProxy> for zx::Handle {
2355    fn from(value: CompositeSynchronousProxy) -> Self {
2356        value.into_channel().into()
2357    }
2358}
2359
2360#[cfg(target_os = "fuchsia")]
2361impl From<fidl::Channel> for CompositeSynchronousProxy {
2362    fn from(value: fidl::Channel) -> Self {
2363        Self::new(value)
2364    }
2365}
2366
2367#[cfg(target_os = "fuchsia")]
2368impl fidl::endpoints::FromClient for CompositeSynchronousProxy {
2369    type Protocol = CompositeMarker;
2370
2371    fn from_client(value: fidl::endpoints::ClientEnd<CompositeMarker>) -> Self {
2372        Self::new(value.into_channel())
2373    }
2374}
2375
2376#[derive(Debug, Clone)]
2377pub struct CompositeProxy {
2378    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2379}
2380
2381impl fidl::endpoints::Proxy for CompositeProxy {
2382    type Protocol = CompositeMarker;
2383
2384    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2385        Self::new(inner)
2386    }
2387
2388    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2389        self.client.into_channel().map_err(|client| Self { client })
2390    }
2391
2392    fn as_channel(&self) -> &::fidl::AsyncChannel {
2393        self.client.as_channel()
2394    }
2395}
2396
2397impl CompositeProxy {
2398    /// Create a new Proxy for fuchsia.hardware.audio/Composite.
2399    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2400        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2401        Self { client: fidl::client::Client::new(channel, protocol_name) }
2402    }
2403
2404    /// Get a Stream of events from the remote end of the protocol.
2405    ///
2406    /// # Panics
2407    ///
2408    /// Panics if the event stream was already taken.
2409    pub fn take_event_stream(&self) -> CompositeEventStream {
2410        CompositeEventStream { event_receiver: self.client.take_event_receiver() }
2411    }
2412
2413    /// Retrieves top level health state.
2414    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2415    pub fn r#get_health_state(
2416        &self,
2417    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
2418    {
2419        CompositeProxyInterface::r#get_health_state(self)
2420    }
2421
2422    /// Connect to a `SignalProcessing` protocol.
2423    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2424    /// the maximum number of connections have already been created, for instance one, then the
2425    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2426    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2427    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2428    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2429    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2430    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2431    /// is intended to be composed, and hence the more verbose name allows differentiation and
2432    /// improved clarity.
2433    pub fn r#signal_processing_connect(
2434        &self,
2435        mut protocol: fidl::endpoints::ServerEnd<
2436            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2437        >,
2438    ) -> Result<(), fidl::Error> {
2439        CompositeProxyInterface::r#signal_processing_connect(self, protocol)
2440    }
2441
2442    /// Resets the hardware including all DAI interconnects and signal processing.
2443    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2444    ///
2445    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2446    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2447    /// any processing elements, and reconstruct any ring buffers.
2448    ///
2449    /// If the driver can't successfully reset the hardware, it will return an error and then close
2450    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2451    pub fn r#reset(
2452        &self,
2453    ) -> fidl::client::QueryResponseFut<
2454        CompositeResetResult,
2455        fidl::encoding::DefaultFuchsiaResourceDialect,
2456    > {
2457        CompositeProxyInterface::r#reset(self)
2458    }
2459
2460    /// Retrieves top level static properties.
2461    pub fn r#get_properties(
2462        &self,
2463    ) -> fidl::client::QueryResponseFut<
2464        CompositeProperties,
2465        fidl::encoding::DefaultFuchsiaResourceDialect,
2466    > {
2467        CompositeProxyInterface::r#get_properties(self)
2468    }
2469
2470    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2471    /// in the topology supported by this driver as returned by `GetElements` from
2472    /// fuchsia.hardware.audio.signalprocessing.
2473    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2474    /// client may retry at a later time.
2475    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2476    /// by `GetElements`.
2477    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2478    /// `RING_BUFFER`.
2479    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
2480    /// the parameters in `SupportedFormats` may be supported.
2481    pub fn r#get_ring_buffer_formats(
2482        &self,
2483        mut processing_element_id: u64,
2484    ) -> fidl::client::QueryResponseFut<
2485        CompositeGetRingBufferFormatsResult,
2486        fidl::encoding::DefaultFuchsiaResourceDialect,
2487    > {
2488        CompositeProxyInterface::r#get_ring_buffer_formats(self, processing_element_id)
2489    }
2490
2491    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2492    /// processing element specified by `processing_element_id`. The format is based on information
2493    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2494    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2495    /// audio buffer provided by the driver.
2496    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2497    /// by `GetElements`.
2498    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2499    /// `RING_BUFFER`.
2500    pub fn r#create_ring_buffer(
2501        &self,
2502        mut processing_element_id: u64,
2503        mut format: &Format,
2504        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2505    ) -> fidl::client::QueryResponseFut<
2506        CompositeCreateRingBufferResult,
2507        fidl::encoding::DefaultFuchsiaResourceDialect,
2508    > {
2509        CompositeProxyInterface::r#create_ring_buffer(
2510            self,
2511            processing_element_id,
2512            format,
2513            ring_buffer,
2514        )
2515    }
2516
2517    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2518    /// in the topology supported by this driver as returned by `GetElements` from
2519    /// fuchsia.hardware.audio.signalprocessing.
2520    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2521    /// may retry at a later time.
2522    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2523    /// by `GetElements`.
2524    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2525    /// `DAI_INTERCONNECT`.
2526    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2527    /// the parameters in SupportedFormats may be supported.
2528    pub fn r#get_dai_formats(
2529        &self,
2530        mut processing_element_id: u64,
2531    ) -> fidl::client::QueryResponseFut<
2532        CompositeGetDaiFormatsResult,
2533        fidl::encoding::DefaultFuchsiaResourceDialect,
2534    > {
2535        CompositeProxyInterface::r#get_dai_formats(self, processing_element_id)
2536    }
2537
2538    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2539    /// processing element specified by `processing_element_id`. The format is based on information
2540    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2541    /// requirement.
2542    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2543    /// by `GetElements`.
2544    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2545    /// `DAI_INTERCONNECT`.
2546    pub fn r#set_dai_format(
2547        &self,
2548        mut processing_element_id: u64,
2549        mut format: &DaiFormat,
2550    ) -> fidl::client::QueryResponseFut<
2551        CompositeSetDaiFormatResult,
2552        fidl::encoding::DefaultFuchsiaResourceDialect,
2553    > {
2554        CompositeProxyInterface::r#set_dai_format(self, processing_element_id, format)
2555    }
2556}
2557
2558impl CompositeProxyInterface for CompositeProxy {
2559    type GetHealthStateResponseFut =
2560        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
2561    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
2562        fn _decode(
2563            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2564        ) -> Result<HealthState, fidl::Error> {
2565            let _response = fidl::client::decode_transaction_body::<
2566                HealthGetHealthStateResponse,
2567                fidl::encoding::DefaultFuchsiaResourceDialect,
2568                0x4e146d6bca733a84,
2569            >(_buf?)?;
2570            Ok(_response.state)
2571        }
2572        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
2573            (),
2574            0x4e146d6bca733a84,
2575            fidl::encoding::DynamicFlags::empty(),
2576            _decode,
2577        )
2578    }
2579
2580    fn r#signal_processing_connect(
2581        &self,
2582        mut protocol: fidl::endpoints::ServerEnd<
2583            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2584        >,
2585    ) -> Result<(), fidl::Error> {
2586        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2587            (protocol,),
2588            0xa81907ce6066295,
2589            fidl::encoding::DynamicFlags::empty(),
2590        )
2591    }
2592
2593    type ResetResponseFut = fidl::client::QueryResponseFut<
2594        CompositeResetResult,
2595        fidl::encoding::DefaultFuchsiaResourceDialect,
2596    >;
2597    fn r#reset(&self) -> Self::ResetResponseFut {
2598        fn _decode(
2599            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2600        ) -> Result<CompositeResetResult, fidl::Error> {
2601            let _response = fidl::client::decode_transaction_body::<
2602                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2603                fidl::encoding::DefaultFuchsiaResourceDialect,
2604                0xac355fb98341996,
2605            >(_buf?)?;
2606            Ok(_response.map(|x| x))
2607        }
2608        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeResetResult>(
2609            (),
2610            0xac355fb98341996,
2611            fidl::encoding::DynamicFlags::empty(),
2612            _decode,
2613        )
2614    }
2615
2616    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2617        CompositeProperties,
2618        fidl::encoding::DefaultFuchsiaResourceDialect,
2619    >;
2620    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2621        fn _decode(
2622            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2623        ) -> Result<CompositeProperties, fidl::Error> {
2624            let _response = fidl::client::decode_transaction_body::<
2625                CompositeGetPropertiesResponse,
2626                fidl::encoding::DefaultFuchsiaResourceDialect,
2627                0x31846fa0a459942b,
2628            >(_buf?)?;
2629            Ok(_response.properties)
2630        }
2631        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeProperties>(
2632            (),
2633            0x31846fa0a459942b,
2634            fidl::encoding::DynamicFlags::empty(),
2635            _decode,
2636        )
2637    }
2638
2639    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
2640        CompositeGetRingBufferFormatsResult,
2641        fidl::encoding::DefaultFuchsiaResourceDialect,
2642    >;
2643    fn r#get_ring_buffer_formats(
2644        &self,
2645        mut processing_element_id: u64,
2646    ) -> Self::GetRingBufferFormatsResponseFut {
2647        fn _decode(
2648            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2649        ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2650            let _response = fidl::client::decode_transaction_body::<
2651                fidl::encoding::ResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2652                fidl::encoding::DefaultFuchsiaResourceDialect,
2653                0x1d89b701b6816ac4,
2654            >(_buf?)?;
2655            Ok(_response.map(|x| x.ring_buffer_formats))
2656        }
2657        self.client.send_query_and_decode::<
2658            CompositeGetRingBufferFormatsRequest,
2659            CompositeGetRingBufferFormatsResult,
2660        >(
2661            (processing_element_id,),
2662            0x1d89b701b6816ac4,
2663            fidl::encoding::DynamicFlags::empty(),
2664            _decode,
2665        )
2666    }
2667
2668    type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
2669        CompositeCreateRingBufferResult,
2670        fidl::encoding::DefaultFuchsiaResourceDialect,
2671    >;
2672    fn r#create_ring_buffer(
2673        &self,
2674        mut processing_element_id: u64,
2675        mut format: &Format,
2676        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2677    ) -> Self::CreateRingBufferResponseFut {
2678        fn _decode(
2679            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2680        ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2681            let _response = fidl::client::decode_transaction_body::<
2682                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2683                fidl::encoding::DefaultFuchsiaResourceDialect,
2684                0x28c5685f85262033,
2685            >(_buf?)?;
2686            Ok(_response.map(|x| x))
2687        }
2688        self.client.send_query_and_decode::<
2689            CompositeCreateRingBufferRequest,
2690            CompositeCreateRingBufferResult,
2691        >(
2692            (processing_element_id, format, ring_buffer,),
2693            0x28c5685f85262033,
2694            fidl::encoding::DynamicFlags::empty(),
2695            _decode,
2696        )
2697    }
2698
2699    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
2700        CompositeGetDaiFormatsResult,
2701        fidl::encoding::DefaultFuchsiaResourceDialect,
2702    >;
2703    fn r#get_dai_formats(&self, mut processing_element_id: u64) -> Self::GetDaiFormatsResponseFut {
2704        fn _decode(
2705            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2706        ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2707            let _response = fidl::client::decode_transaction_body::<
2708                fidl::encoding::ResultType<CompositeGetDaiFormatsResponse, DriverError>,
2709                fidl::encoding::DefaultFuchsiaResourceDialect,
2710                0x3cbeaed59c8f69b,
2711            >(_buf?)?;
2712            Ok(_response.map(|x| x.dai_formats))
2713        }
2714        self.client
2715            .send_query_and_decode::<CompositeGetDaiFormatsRequest, CompositeGetDaiFormatsResult>(
2716                (processing_element_id,),
2717                0x3cbeaed59c8f69b,
2718                fidl::encoding::DynamicFlags::empty(),
2719                _decode,
2720            )
2721    }
2722
2723    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
2724        CompositeSetDaiFormatResult,
2725        fidl::encoding::DefaultFuchsiaResourceDialect,
2726    >;
2727    fn r#set_dai_format(
2728        &self,
2729        mut processing_element_id: u64,
2730        mut format: &DaiFormat,
2731    ) -> Self::SetDaiFormatResponseFut {
2732        fn _decode(
2733            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2734        ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2735            let _response = fidl::client::decode_transaction_body::<
2736                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2737                fidl::encoding::DefaultFuchsiaResourceDialect,
2738                0x155acf5cc0dc8a84,
2739            >(_buf?)?;
2740            Ok(_response.map(|x| x))
2741        }
2742        self.client
2743            .send_query_and_decode::<CompositeSetDaiFormatRequest, CompositeSetDaiFormatResult>(
2744                (processing_element_id, format),
2745                0x155acf5cc0dc8a84,
2746                fidl::encoding::DynamicFlags::empty(),
2747                _decode,
2748            )
2749    }
2750}
2751
2752pub struct CompositeEventStream {
2753    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2754}
2755
2756impl std::marker::Unpin for CompositeEventStream {}
2757
2758impl futures::stream::FusedStream for CompositeEventStream {
2759    fn is_terminated(&self) -> bool {
2760        self.event_receiver.is_terminated()
2761    }
2762}
2763
2764impl futures::Stream for CompositeEventStream {
2765    type Item = Result<CompositeEvent, fidl::Error>;
2766
2767    fn poll_next(
2768        mut self: std::pin::Pin<&mut Self>,
2769        cx: &mut std::task::Context<'_>,
2770    ) -> std::task::Poll<Option<Self::Item>> {
2771        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2772            &mut self.event_receiver,
2773            cx
2774        )?) {
2775            Some(buf) => std::task::Poll::Ready(Some(CompositeEvent::decode(buf))),
2776            None => std::task::Poll::Ready(None),
2777        }
2778    }
2779}
2780
2781#[derive(Debug)]
2782pub enum CompositeEvent {}
2783
2784impl CompositeEvent {
2785    /// Decodes a message buffer as a [`CompositeEvent`].
2786    fn decode(
2787        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2788    ) -> Result<CompositeEvent, fidl::Error> {
2789        let (bytes, _handles) = buf.split_mut();
2790        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2791        debug_assert_eq!(tx_header.tx_id, 0);
2792        match tx_header.ordinal {
2793            _ => Err(fidl::Error::UnknownOrdinal {
2794                ordinal: tx_header.ordinal,
2795                protocol_name: <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2796            }),
2797        }
2798    }
2799}
2800
2801/// A Stream of incoming requests for fuchsia.hardware.audio/Composite.
2802pub struct CompositeRequestStream {
2803    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2804    is_terminated: bool,
2805}
2806
2807impl std::marker::Unpin for CompositeRequestStream {}
2808
2809impl futures::stream::FusedStream for CompositeRequestStream {
2810    fn is_terminated(&self) -> bool {
2811        self.is_terminated
2812    }
2813}
2814
2815impl fidl::endpoints::RequestStream for CompositeRequestStream {
2816    type Protocol = CompositeMarker;
2817    type ControlHandle = CompositeControlHandle;
2818
2819    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2820        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2821    }
2822
2823    fn control_handle(&self) -> Self::ControlHandle {
2824        CompositeControlHandle { inner: self.inner.clone() }
2825    }
2826
2827    fn into_inner(
2828        self,
2829    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2830    {
2831        (self.inner, self.is_terminated)
2832    }
2833
2834    fn from_inner(
2835        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2836        is_terminated: bool,
2837    ) -> Self {
2838        Self { inner, is_terminated }
2839    }
2840}
2841
2842impl futures::Stream for CompositeRequestStream {
2843    type Item = Result<CompositeRequest, fidl::Error>;
2844
2845    fn poll_next(
2846        mut self: std::pin::Pin<&mut Self>,
2847        cx: &mut std::task::Context<'_>,
2848    ) -> std::task::Poll<Option<Self::Item>> {
2849        let this = &mut *self;
2850        if this.inner.check_shutdown(cx) {
2851            this.is_terminated = true;
2852            return std::task::Poll::Ready(None);
2853        }
2854        if this.is_terminated {
2855            panic!("polled CompositeRequestStream after completion");
2856        }
2857        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2858            |bytes, handles| {
2859                match this.inner.channel().read_etc(cx, bytes, handles) {
2860                    std::task::Poll::Ready(Ok(())) => {}
2861                    std::task::Poll::Pending => return std::task::Poll::Pending,
2862                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2863                        this.is_terminated = true;
2864                        return std::task::Poll::Ready(None);
2865                    }
2866                    std::task::Poll::Ready(Err(e)) => {
2867                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2868                            e.into(),
2869                        ))));
2870                    }
2871                }
2872
2873                // A message has been received from the channel
2874                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2875
2876                std::task::Poll::Ready(Some(match header.ordinal {
2877                    0x4e146d6bca733a84 => {
2878                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2879                        let mut req = fidl::new_empty!(
2880                            fidl::encoding::EmptyPayload,
2881                            fidl::encoding::DefaultFuchsiaResourceDialect
2882                        );
2883                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2884                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2885                        Ok(CompositeRequest::GetHealthState {
2886                            responder: CompositeGetHealthStateResponder {
2887                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2888                                tx_id: header.tx_id,
2889                            },
2890                        })
2891                    }
2892                    0xa81907ce6066295 => {
2893                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2894                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2895                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2896                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2897                        Ok(CompositeRequest::SignalProcessingConnect {
2898                            protocol: req.protocol,
2899
2900                            control_handle,
2901                        })
2902                    }
2903                    0xac355fb98341996 => {
2904                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2905                        let mut req = fidl::new_empty!(
2906                            fidl::encoding::EmptyPayload,
2907                            fidl::encoding::DefaultFuchsiaResourceDialect
2908                        );
2909                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2910                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2911                        Ok(CompositeRequest::Reset {
2912                            responder: CompositeResetResponder {
2913                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2914                                tx_id: header.tx_id,
2915                            },
2916                        })
2917                    }
2918                    0x31846fa0a459942b => {
2919                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2920                        let mut req = fidl::new_empty!(
2921                            fidl::encoding::EmptyPayload,
2922                            fidl::encoding::DefaultFuchsiaResourceDialect
2923                        );
2924                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2925                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2926                        Ok(CompositeRequest::GetProperties {
2927                            responder: CompositeGetPropertiesResponder {
2928                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2929                                tx_id: header.tx_id,
2930                            },
2931                        })
2932                    }
2933                    0x1d89b701b6816ac4 => {
2934                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2935                        let mut req = fidl::new_empty!(
2936                            CompositeGetRingBufferFormatsRequest,
2937                            fidl::encoding::DefaultFuchsiaResourceDialect
2938                        );
2939                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetRingBufferFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2940                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2941                        Ok(CompositeRequest::GetRingBufferFormats {
2942                            processing_element_id: req.processing_element_id,
2943
2944                            responder: CompositeGetRingBufferFormatsResponder {
2945                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2946                                tx_id: header.tx_id,
2947                            },
2948                        })
2949                    }
2950                    0x28c5685f85262033 => {
2951                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2952                        let mut req = fidl::new_empty!(
2953                            CompositeCreateRingBufferRequest,
2954                            fidl::encoding::DefaultFuchsiaResourceDialect
2955                        );
2956                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
2957                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2958                        Ok(CompositeRequest::CreateRingBuffer {
2959                            processing_element_id: req.processing_element_id,
2960                            format: req.format,
2961                            ring_buffer: req.ring_buffer,
2962
2963                            responder: CompositeCreateRingBufferResponder {
2964                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2965                                tx_id: header.tx_id,
2966                            },
2967                        })
2968                    }
2969                    0x3cbeaed59c8f69b => {
2970                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2971                        let mut req = fidl::new_empty!(
2972                            CompositeGetDaiFormatsRequest,
2973                            fidl::encoding::DefaultFuchsiaResourceDialect
2974                        );
2975                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetDaiFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2976                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2977                        Ok(CompositeRequest::GetDaiFormats {
2978                            processing_element_id: req.processing_element_id,
2979
2980                            responder: CompositeGetDaiFormatsResponder {
2981                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2982                                tx_id: header.tx_id,
2983                            },
2984                        })
2985                    }
2986                    0x155acf5cc0dc8a84 => {
2987                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2988                        let mut req = fidl::new_empty!(
2989                            CompositeSetDaiFormatRequest,
2990                            fidl::encoding::DefaultFuchsiaResourceDialect
2991                        );
2992                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
2993                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2994                        Ok(CompositeRequest::SetDaiFormat {
2995                            processing_element_id: req.processing_element_id,
2996                            format: req.format,
2997
2998                            responder: CompositeSetDaiFormatResponder {
2999                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3000                                tx_id: header.tx_id,
3001                            },
3002                        })
3003                    }
3004                    _ => Err(fidl::Error::UnknownOrdinal {
3005                        ordinal: header.ordinal,
3006                        protocol_name:
3007                            <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3008                    }),
3009                }))
3010            },
3011        )
3012    }
3013}
3014
3015/// The `Composite` interface is a FIDL protocol exposed by audio drivers. The `Composite` interface
3016/// is generic and allows the configuration of various audio hardware types including those supported
3017/// by the `StreamConfig`, `Dai` and `Codec` FIDL interfaces. The `Composite` interface is more
3018/// generic and provides more flexible routing within audio subsystems. Also see
3019/// [Audio Driver Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md)
3020/// The hardware abstracted by the Composite protocol will be turned off (placed in its lowest
3021/// supported power state) until a call to any APIs that requires the hardware to be turned on
3022/// (placed in a higher power state).
3023#[derive(Debug)]
3024pub enum CompositeRequest {
3025    /// Retrieves top level health state.
3026    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
3027    GetHealthState { responder: CompositeGetHealthStateResponder },
3028    /// Connect to a `SignalProcessing` protocol.
3029    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
3030    /// the maximum number of connections have already been created, for instance one, then the
3031    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
3032    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
3033    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
3034    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
3035    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
3036    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
3037    /// is intended to be composed, and hence the more verbose name allows differentiation and
3038    /// improved clarity.
3039    SignalProcessingConnect {
3040        protocol: fidl::endpoints::ServerEnd<
3041            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3042        >,
3043        control_handle: CompositeControlHandle,
3044    },
3045    /// Resets the hardware including all DAI interconnects and signal processing.
3046    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
3047    ///
3048    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
3049    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
3050    /// any processing elements, and reconstruct any ring buffers.
3051    ///
3052    /// If the driver can't successfully reset the hardware, it will return an error and then close
3053    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
3054    Reset { responder: CompositeResetResponder },
3055    /// Retrieves top level static properties.
3056    GetProperties { responder: CompositeGetPropertiesResponder },
3057    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
3058    /// in the topology supported by this driver as returned by `GetElements` from
3059    /// fuchsia.hardware.audio.signalprocessing.
3060    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
3061    /// client may retry at a later time.
3062    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3063    /// by `GetElements`.
3064    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3065    /// `RING_BUFFER`.
3066    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
3067    /// the parameters in `SupportedFormats` may be supported.
3068    GetRingBufferFormats {
3069        processing_element_id: u64,
3070        responder: CompositeGetRingBufferFormatsResponder,
3071    },
3072    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
3073    /// processing element specified by `processing_element_id`. The format is based on information
3074    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
3075    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
3076    /// audio buffer provided by the driver.
3077    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3078    /// by `GetElements`.
3079    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3080    /// `RING_BUFFER`.
3081    CreateRingBuffer {
3082        processing_element_id: u64,
3083        format: Format,
3084        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3085        responder: CompositeCreateRingBufferResponder,
3086    },
3087    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
3088    /// in the topology supported by this driver as returned by `GetElements` from
3089    /// fuchsia.hardware.audio.signalprocessing.
3090    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
3091    /// may retry at a later time.
3092    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3093    /// by `GetElements`.
3094    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3095    /// `DAI_INTERCONNECT`.
3096    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
3097    /// the parameters in SupportedFormats may be supported.
3098    GetDaiFormats { processing_element_id: u64, responder: CompositeGetDaiFormatsResponder },
3099    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
3100    /// processing element specified by `processing_element_id`. The format is based on information
3101    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
3102    /// requirement.
3103    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3104    /// by `GetElements`.
3105    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3106    /// `DAI_INTERCONNECT`.
3107    SetDaiFormat {
3108        processing_element_id: u64,
3109        format: DaiFormat,
3110        responder: CompositeSetDaiFormatResponder,
3111    },
3112}
3113
3114impl CompositeRequest {
3115    #[allow(irrefutable_let_patterns)]
3116    pub fn into_get_health_state(self) -> Option<(CompositeGetHealthStateResponder)> {
3117        if let CompositeRequest::GetHealthState { responder } = self {
3118            Some((responder))
3119        } else {
3120            None
3121        }
3122    }
3123
3124    #[allow(irrefutable_let_patterns)]
3125    pub fn into_signal_processing_connect(
3126        self,
3127    ) -> Option<(
3128        fidl::endpoints::ServerEnd<
3129            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3130        >,
3131        CompositeControlHandle,
3132    )> {
3133        if let CompositeRequest::SignalProcessingConnect { protocol, control_handle } = self {
3134            Some((protocol, control_handle))
3135        } else {
3136            None
3137        }
3138    }
3139
3140    #[allow(irrefutable_let_patterns)]
3141    pub fn into_reset(self) -> Option<(CompositeResetResponder)> {
3142        if let CompositeRequest::Reset { responder } = self { Some((responder)) } else { None }
3143    }
3144
3145    #[allow(irrefutable_let_patterns)]
3146    pub fn into_get_properties(self) -> Option<(CompositeGetPropertiesResponder)> {
3147        if let CompositeRequest::GetProperties { responder } = self {
3148            Some((responder))
3149        } else {
3150            None
3151        }
3152    }
3153
3154    #[allow(irrefutable_let_patterns)]
3155    pub fn into_get_ring_buffer_formats(
3156        self,
3157    ) -> Option<(u64, CompositeGetRingBufferFormatsResponder)> {
3158        if let CompositeRequest::GetRingBufferFormats { processing_element_id, responder } = self {
3159            Some((processing_element_id, responder))
3160        } else {
3161            None
3162        }
3163    }
3164
3165    #[allow(irrefutable_let_patterns)]
3166    pub fn into_create_ring_buffer(
3167        self,
3168    ) -> Option<(
3169        u64,
3170        Format,
3171        fidl::endpoints::ServerEnd<RingBufferMarker>,
3172        CompositeCreateRingBufferResponder,
3173    )> {
3174        if let CompositeRequest::CreateRingBuffer {
3175            processing_element_id,
3176            format,
3177            ring_buffer,
3178            responder,
3179        } = self
3180        {
3181            Some((processing_element_id, format, ring_buffer, responder))
3182        } else {
3183            None
3184        }
3185    }
3186
3187    #[allow(irrefutable_let_patterns)]
3188    pub fn into_get_dai_formats(self) -> Option<(u64, CompositeGetDaiFormatsResponder)> {
3189        if let CompositeRequest::GetDaiFormats { processing_element_id, responder } = self {
3190            Some((processing_element_id, responder))
3191        } else {
3192            None
3193        }
3194    }
3195
3196    #[allow(irrefutable_let_patterns)]
3197    pub fn into_set_dai_format(self) -> Option<(u64, DaiFormat, CompositeSetDaiFormatResponder)> {
3198        if let CompositeRequest::SetDaiFormat { processing_element_id, format, responder } = self {
3199            Some((processing_element_id, format, responder))
3200        } else {
3201            None
3202        }
3203    }
3204
3205    /// Name of the method defined in FIDL
3206    pub fn method_name(&self) -> &'static str {
3207        match *self {
3208            CompositeRequest::GetHealthState { .. } => "get_health_state",
3209            CompositeRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
3210            CompositeRequest::Reset { .. } => "reset",
3211            CompositeRequest::GetProperties { .. } => "get_properties",
3212            CompositeRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
3213            CompositeRequest::CreateRingBuffer { .. } => "create_ring_buffer",
3214            CompositeRequest::GetDaiFormats { .. } => "get_dai_formats",
3215            CompositeRequest::SetDaiFormat { .. } => "set_dai_format",
3216        }
3217    }
3218}
3219
3220#[derive(Debug, Clone)]
3221pub struct CompositeControlHandle {
3222    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3223}
3224
3225impl fidl::endpoints::ControlHandle for CompositeControlHandle {
3226    fn shutdown(&self) {
3227        self.inner.shutdown()
3228    }
3229    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3230        self.inner.shutdown_with_epitaph(status)
3231    }
3232
3233    fn is_closed(&self) -> bool {
3234        self.inner.channel().is_closed()
3235    }
3236    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3237        self.inner.channel().on_closed()
3238    }
3239
3240    #[cfg(target_os = "fuchsia")]
3241    fn signal_peer(
3242        &self,
3243        clear_mask: zx::Signals,
3244        set_mask: zx::Signals,
3245    ) -> Result<(), zx_status::Status> {
3246        use fidl::Peered;
3247        self.inner.channel().signal_peer(clear_mask, set_mask)
3248    }
3249}
3250
3251impl CompositeControlHandle {}
3252
3253#[must_use = "FIDL methods require a response to be sent"]
3254#[derive(Debug)]
3255pub struct CompositeGetHealthStateResponder {
3256    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3257    tx_id: u32,
3258}
3259
3260/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3261/// if the responder is dropped without sending a response, so that the client
3262/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3263impl std::ops::Drop for CompositeGetHealthStateResponder {
3264    fn drop(&mut self) {
3265        self.control_handle.shutdown();
3266        // Safety: drops once, never accessed again
3267        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3268    }
3269}
3270
3271impl fidl::endpoints::Responder for CompositeGetHealthStateResponder {
3272    type ControlHandle = CompositeControlHandle;
3273
3274    fn control_handle(&self) -> &CompositeControlHandle {
3275        &self.control_handle
3276    }
3277
3278    fn drop_without_shutdown(mut self) {
3279        // Safety: drops once, never accessed again due to mem::forget
3280        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3281        // Prevent Drop from running (which would shut down the channel)
3282        std::mem::forget(self);
3283    }
3284}
3285
3286impl CompositeGetHealthStateResponder {
3287    /// Sends a response to the FIDL transaction.
3288    ///
3289    /// Sets the channel to shutdown if an error occurs.
3290    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3291        let _result = self.send_raw(state);
3292        if _result.is_err() {
3293            self.control_handle.shutdown();
3294        }
3295        self.drop_without_shutdown();
3296        _result
3297    }
3298
3299    /// Similar to "send" but does not shutdown the channel if an error occurs.
3300    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3301        let _result = self.send_raw(state);
3302        self.drop_without_shutdown();
3303        _result
3304    }
3305
3306    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
3307        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
3308            (state,),
3309            self.tx_id,
3310            0x4e146d6bca733a84,
3311            fidl::encoding::DynamicFlags::empty(),
3312        )
3313    }
3314}
3315
3316#[must_use = "FIDL methods require a response to be sent"]
3317#[derive(Debug)]
3318pub struct CompositeResetResponder {
3319    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3320    tx_id: u32,
3321}
3322
3323/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3324/// if the responder is dropped without sending a response, so that the client
3325/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3326impl std::ops::Drop for CompositeResetResponder {
3327    fn drop(&mut self) {
3328        self.control_handle.shutdown();
3329        // Safety: drops once, never accessed again
3330        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3331    }
3332}
3333
3334impl fidl::endpoints::Responder for CompositeResetResponder {
3335    type ControlHandle = CompositeControlHandle;
3336
3337    fn control_handle(&self) -> &CompositeControlHandle {
3338        &self.control_handle
3339    }
3340
3341    fn drop_without_shutdown(mut self) {
3342        // Safety: drops once, never accessed again due to mem::forget
3343        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3344        // Prevent Drop from running (which would shut down the channel)
3345        std::mem::forget(self);
3346    }
3347}
3348
3349impl CompositeResetResponder {
3350    /// Sends a response to the FIDL transaction.
3351    ///
3352    /// Sets the channel to shutdown if an error occurs.
3353    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3354        let _result = self.send_raw(result);
3355        if _result.is_err() {
3356            self.control_handle.shutdown();
3357        }
3358        self.drop_without_shutdown();
3359        _result
3360    }
3361
3362    /// Similar to "send" but does not shutdown the channel if an error occurs.
3363    pub fn send_no_shutdown_on_err(
3364        self,
3365        mut result: Result<(), DriverError>,
3366    ) -> Result<(), fidl::Error> {
3367        let _result = self.send_raw(result);
3368        self.drop_without_shutdown();
3369        _result
3370    }
3371
3372    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3373        self.control_handle.inner.send::<fidl::encoding::ResultType<
3374            fidl::encoding::EmptyStruct,
3375            DriverError,
3376        >>(
3377            result,
3378            self.tx_id,
3379            0xac355fb98341996,
3380            fidl::encoding::DynamicFlags::empty(),
3381        )
3382    }
3383}
3384
3385#[must_use = "FIDL methods require a response to be sent"]
3386#[derive(Debug)]
3387pub struct CompositeGetPropertiesResponder {
3388    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3389    tx_id: u32,
3390}
3391
3392/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3393/// if the responder is dropped without sending a response, so that the client
3394/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3395impl std::ops::Drop for CompositeGetPropertiesResponder {
3396    fn drop(&mut self) {
3397        self.control_handle.shutdown();
3398        // Safety: drops once, never accessed again
3399        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3400    }
3401}
3402
3403impl fidl::endpoints::Responder for CompositeGetPropertiesResponder {
3404    type ControlHandle = CompositeControlHandle;
3405
3406    fn control_handle(&self) -> &CompositeControlHandle {
3407        &self.control_handle
3408    }
3409
3410    fn drop_without_shutdown(mut self) {
3411        // Safety: drops once, never accessed again due to mem::forget
3412        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3413        // Prevent Drop from running (which would shut down the channel)
3414        std::mem::forget(self);
3415    }
3416}
3417
3418impl CompositeGetPropertiesResponder {
3419    /// Sends a response to the FIDL transaction.
3420    ///
3421    /// Sets the channel to shutdown if an error occurs.
3422    pub fn send(self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3423        let _result = self.send_raw(properties);
3424        if _result.is_err() {
3425            self.control_handle.shutdown();
3426        }
3427        self.drop_without_shutdown();
3428        _result
3429    }
3430
3431    /// Similar to "send" but does not shutdown the channel if an error occurs.
3432    pub fn send_no_shutdown_on_err(
3433        self,
3434        mut properties: &CompositeProperties,
3435    ) -> Result<(), fidl::Error> {
3436        let _result = self.send_raw(properties);
3437        self.drop_without_shutdown();
3438        _result
3439    }
3440
3441    fn send_raw(&self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3442        self.control_handle.inner.send::<CompositeGetPropertiesResponse>(
3443            (properties,),
3444            self.tx_id,
3445            0x31846fa0a459942b,
3446            fidl::encoding::DynamicFlags::empty(),
3447        )
3448    }
3449}
3450
3451#[must_use = "FIDL methods require a response to be sent"]
3452#[derive(Debug)]
3453pub struct CompositeGetRingBufferFormatsResponder {
3454    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3455    tx_id: u32,
3456}
3457
3458/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3459/// if the responder is dropped without sending a response, so that the client
3460/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3461impl std::ops::Drop for CompositeGetRingBufferFormatsResponder {
3462    fn drop(&mut self) {
3463        self.control_handle.shutdown();
3464        // Safety: drops once, never accessed again
3465        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3466    }
3467}
3468
3469impl fidl::endpoints::Responder for CompositeGetRingBufferFormatsResponder {
3470    type ControlHandle = CompositeControlHandle;
3471
3472    fn control_handle(&self) -> &CompositeControlHandle {
3473        &self.control_handle
3474    }
3475
3476    fn drop_without_shutdown(mut self) {
3477        // Safety: drops once, never accessed again due to mem::forget
3478        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3479        // Prevent Drop from running (which would shut down the channel)
3480        std::mem::forget(self);
3481    }
3482}
3483
3484impl CompositeGetRingBufferFormatsResponder {
3485    /// Sends a response to the FIDL transaction.
3486    ///
3487    /// Sets the channel to shutdown if an error occurs.
3488    pub fn send(
3489        self,
3490        mut result: Result<&[SupportedFormats], DriverError>,
3491    ) -> Result<(), fidl::Error> {
3492        let _result = self.send_raw(result);
3493        if _result.is_err() {
3494            self.control_handle.shutdown();
3495        }
3496        self.drop_without_shutdown();
3497        _result
3498    }
3499
3500    /// Similar to "send" but does not shutdown the channel if an error occurs.
3501    pub fn send_no_shutdown_on_err(
3502        self,
3503        mut result: Result<&[SupportedFormats], DriverError>,
3504    ) -> Result<(), fidl::Error> {
3505        let _result = self.send_raw(result);
3506        self.drop_without_shutdown();
3507        _result
3508    }
3509
3510    fn send_raw(
3511        &self,
3512        mut result: Result<&[SupportedFormats], DriverError>,
3513    ) -> Result<(), fidl::Error> {
3514        self.control_handle.inner.send::<fidl::encoding::ResultType<
3515            CompositeGetRingBufferFormatsResponse,
3516            DriverError,
3517        >>(
3518            result.map(|ring_buffer_formats| (ring_buffer_formats,)),
3519            self.tx_id,
3520            0x1d89b701b6816ac4,
3521            fidl::encoding::DynamicFlags::empty(),
3522        )
3523    }
3524}
3525
3526#[must_use = "FIDL methods require a response to be sent"]
3527#[derive(Debug)]
3528pub struct CompositeCreateRingBufferResponder {
3529    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3530    tx_id: u32,
3531}
3532
3533/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3534/// if the responder is dropped without sending a response, so that the client
3535/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3536impl std::ops::Drop for CompositeCreateRingBufferResponder {
3537    fn drop(&mut self) {
3538        self.control_handle.shutdown();
3539        // Safety: drops once, never accessed again
3540        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3541    }
3542}
3543
3544impl fidl::endpoints::Responder for CompositeCreateRingBufferResponder {
3545    type ControlHandle = CompositeControlHandle;
3546
3547    fn control_handle(&self) -> &CompositeControlHandle {
3548        &self.control_handle
3549    }
3550
3551    fn drop_without_shutdown(mut self) {
3552        // Safety: drops once, never accessed again due to mem::forget
3553        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3554        // Prevent Drop from running (which would shut down the channel)
3555        std::mem::forget(self);
3556    }
3557}
3558
3559impl CompositeCreateRingBufferResponder {
3560    /// Sends a response to the FIDL transaction.
3561    ///
3562    /// Sets the channel to shutdown if an error occurs.
3563    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3564        let _result = self.send_raw(result);
3565        if _result.is_err() {
3566            self.control_handle.shutdown();
3567        }
3568        self.drop_without_shutdown();
3569        _result
3570    }
3571
3572    /// Similar to "send" but does not shutdown the channel if an error occurs.
3573    pub fn send_no_shutdown_on_err(
3574        self,
3575        mut result: Result<(), DriverError>,
3576    ) -> Result<(), fidl::Error> {
3577        let _result = self.send_raw(result);
3578        self.drop_without_shutdown();
3579        _result
3580    }
3581
3582    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3583        self.control_handle.inner.send::<fidl::encoding::ResultType<
3584            fidl::encoding::EmptyStruct,
3585            DriverError,
3586        >>(
3587            result,
3588            self.tx_id,
3589            0x28c5685f85262033,
3590            fidl::encoding::DynamicFlags::empty(),
3591        )
3592    }
3593}
3594
3595#[must_use = "FIDL methods require a response to be sent"]
3596#[derive(Debug)]
3597pub struct CompositeGetDaiFormatsResponder {
3598    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3599    tx_id: u32,
3600}
3601
3602/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3603/// if the responder is dropped without sending a response, so that the client
3604/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3605impl std::ops::Drop for CompositeGetDaiFormatsResponder {
3606    fn drop(&mut self) {
3607        self.control_handle.shutdown();
3608        // Safety: drops once, never accessed again
3609        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3610    }
3611}
3612
3613impl fidl::endpoints::Responder for CompositeGetDaiFormatsResponder {
3614    type ControlHandle = CompositeControlHandle;
3615
3616    fn control_handle(&self) -> &CompositeControlHandle {
3617        &self.control_handle
3618    }
3619
3620    fn drop_without_shutdown(mut self) {
3621        // Safety: drops once, never accessed again due to mem::forget
3622        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3623        // Prevent Drop from running (which would shut down the channel)
3624        std::mem::forget(self);
3625    }
3626}
3627
3628impl CompositeGetDaiFormatsResponder {
3629    /// Sends a response to the FIDL transaction.
3630    ///
3631    /// Sets the channel to shutdown if an error occurs.
3632    pub fn send(
3633        self,
3634        mut result: Result<&[DaiSupportedFormats], DriverError>,
3635    ) -> Result<(), fidl::Error> {
3636        let _result = self.send_raw(result);
3637        if _result.is_err() {
3638            self.control_handle.shutdown();
3639        }
3640        self.drop_without_shutdown();
3641        _result
3642    }
3643
3644    /// Similar to "send" but does not shutdown the channel if an error occurs.
3645    pub fn send_no_shutdown_on_err(
3646        self,
3647        mut result: Result<&[DaiSupportedFormats], DriverError>,
3648    ) -> Result<(), fidl::Error> {
3649        let _result = self.send_raw(result);
3650        self.drop_without_shutdown();
3651        _result
3652    }
3653
3654    fn send_raw(
3655        &self,
3656        mut result: Result<&[DaiSupportedFormats], DriverError>,
3657    ) -> Result<(), fidl::Error> {
3658        self.control_handle.inner.send::<fidl::encoding::ResultType<
3659            CompositeGetDaiFormatsResponse,
3660            DriverError,
3661        >>(
3662            result.map(|dai_formats| (dai_formats,)),
3663            self.tx_id,
3664            0x3cbeaed59c8f69b,
3665            fidl::encoding::DynamicFlags::empty(),
3666        )
3667    }
3668}
3669
3670#[must_use = "FIDL methods require a response to be sent"]
3671#[derive(Debug)]
3672pub struct CompositeSetDaiFormatResponder {
3673    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3674    tx_id: u32,
3675}
3676
3677/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3678/// if the responder is dropped without sending a response, so that the client
3679/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3680impl std::ops::Drop for CompositeSetDaiFormatResponder {
3681    fn drop(&mut self) {
3682        self.control_handle.shutdown();
3683        // Safety: drops once, never accessed again
3684        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3685    }
3686}
3687
3688impl fidl::endpoints::Responder for CompositeSetDaiFormatResponder {
3689    type ControlHandle = CompositeControlHandle;
3690
3691    fn control_handle(&self) -> &CompositeControlHandle {
3692        &self.control_handle
3693    }
3694
3695    fn drop_without_shutdown(mut self) {
3696        // Safety: drops once, never accessed again due to mem::forget
3697        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3698        // Prevent Drop from running (which would shut down the channel)
3699        std::mem::forget(self);
3700    }
3701}
3702
3703impl CompositeSetDaiFormatResponder {
3704    /// Sends a response to the FIDL transaction.
3705    ///
3706    /// Sets the channel to shutdown if an error occurs.
3707    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3708        let _result = self.send_raw(result);
3709        if _result.is_err() {
3710            self.control_handle.shutdown();
3711        }
3712        self.drop_without_shutdown();
3713        _result
3714    }
3715
3716    /// Similar to "send" but does not shutdown the channel if an error occurs.
3717    pub fn send_no_shutdown_on_err(
3718        self,
3719        mut result: Result<(), DriverError>,
3720    ) -> Result<(), fidl::Error> {
3721        let _result = self.send_raw(result);
3722        self.drop_without_shutdown();
3723        _result
3724    }
3725
3726    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3727        self.control_handle.inner.send::<fidl::encoding::ResultType<
3728            fidl::encoding::EmptyStruct,
3729            DriverError,
3730        >>(
3731            result,
3732            self.tx_id,
3733            0x155acf5cc0dc8a84,
3734            fidl::encoding::DynamicFlags::empty(),
3735        )
3736    }
3737}
3738
3739#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3740pub struct CompositeConnectorMarker;
3741
3742impl fidl::endpoints::ProtocolMarker for CompositeConnectorMarker {
3743    type Proxy = CompositeConnectorProxy;
3744    type RequestStream = CompositeConnectorRequestStream;
3745    #[cfg(target_os = "fuchsia")]
3746    type SynchronousProxy = CompositeConnectorSynchronousProxy;
3747
3748    const DEBUG_NAME: &'static str = "(anonymous) CompositeConnector";
3749}
3750
3751pub trait CompositeConnectorProxyInterface: Send + Sync {
3752    fn r#connect(
3753        &self,
3754        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
3755    ) -> Result<(), fidl::Error>;
3756}
3757#[derive(Debug)]
3758#[cfg(target_os = "fuchsia")]
3759pub struct CompositeConnectorSynchronousProxy {
3760    client: fidl::client::sync::Client,
3761}
3762
3763#[cfg(target_os = "fuchsia")]
3764impl fidl::endpoints::SynchronousProxy for CompositeConnectorSynchronousProxy {
3765    type Proxy = CompositeConnectorProxy;
3766    type Protocol = CompositeConnectorMarker;
3767
3768    fn from_channel(inner: fidl::Channel) -> Self {
3769        Self::new(inner)
3770    }
3771
3772    fn into_channel(self) -> fidl::Channel {
3773        self.client.into_channel()
3774    }
3775
3776    fn as_channel(&self) -> &fidl::Channel {
3777        self.client.as_channel()
3778    }
3779}
3780
3781#[cfg(target_os = "fuchsia")]
3782impl CompositeConnectorSynchronousProxy {
3783    pub fn new(channel: fidl::Channel) -> Self {
3784        let protocol_name =
3785            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3786        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3787    }
3788
3789    pub fn into_channel(self) -> fidl::Channel {
3790        self.client.into_channel()
3791    }
3792
3793    /// Waits until an event arrives and returns it. It is safe for other
3794    /// threads to make concurrent requests while waiting for an event.
3795    pub fn wait_for_event(
3796        &self,
3797        deadline: zx::MonotonicInstant,
3798    ) -> Result<CompositeConnectorEvent, fidl::Error> {
3799        CompositeConnectorEvent::decode(self.client.wait_for_event(deadline)?)
3800    }
3801
3802    /// Connect to a `Device` protocol.
3803    /// This method allows a component to serve FIDL outside the devhost's control.
3804    pub fn r#connect(
3805        &self,
3806        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
3807    ) -> Result<(), fidl::Error> {
3808        self.client.send::<CompositeConnectorConnectRequest>(
3809            (composite_protocol,),
3810            0x7ee557529079e466,
3811            fidl::encoding::DynamicFlags::empty(),
3812        )
3813    }
3814}
3815
3816#[cfg(target_os = "fuchsia")]
3817impl From<CompositeConnectorSynchronousProxy> for zx::Handle {
3818    fn from(value: CompositeConnectorSynchronousProxy) -> Self {
3819        value.into_channel().into()
3820    }
3821}
3822
3823#[cfg(target_os = "fuchsia")]
3824impl From<fidl::Channel> for CompositeConnectorSynchronousProxy {
3825    fn from(value: fidl::Channel) -> Self {
3826        Self::new(value)
3827    }
3828}
3829
3830#[cfg(target_os = "fuchsia")]
3831impl fidl::endpoints::FromClient for CompositeConnectorSynchronousProxy {
3832    type Protocol = CompositeConnectorMarker;
3833
3834    fn from_client(value: fidl::endpoints::ClientEnd<CompositeConnectorMarker>) -> Self {
3835        Self::new(value.into_channel())
3836    }
3837}
3838
3839#[derive(Debug, Clone)]
3840pub struct CompositeConnectorProxy {
3841    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3842}
3843
3844impl fidl::endpoints::Proxy for CompositeConnectorProxy {
3845    type Protocol = CompositeConnectorMarker;
3846
3847    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3848        Self::new(inner)
3849    }
3850
3851    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3852        self.client.into_channel().map_err(|client| Self { client })
3853    }
3854
3855    fn as_channel(&self) -> &::fidl::AsyncChannel {
3856        self.client.as_channel()
3857    }
3858}
3859
3860impl CompositeConnectorProxy {
3861    /// Create a new Proxy for fuchsia.hardware.audio/CompositeConnector.
3862    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3863        let protocol_name =
3864            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3865        Self { client: fidl::client::Client::new(channel, protocol_name) }
3866    }
3867
3868    /// Get a Stream of events from the remote end of the protocol.
3869    ///
3870    /// # Panics
3871    ///
3872    /// Panics if the event stream was already taken.
3873    pub fn take_event_stream(&self) -> CompositeConnectorEventStream {
3874        CompositeConnectorEventStream { event_receiver: self.client.take_event_receiver() }
3875    }
3876
3877    /// Connect to a `Device` protocol.
3878    /// This method allows a component to serve FIDL outside the devhost's control.
3879    pub fn r#connect(
3880        &self,
3881        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
3882    ) -> Result<(), fidl::Error> {
3883        CompositeConnectorProxyInterface::r#connect(self, composite_protocol)
3884    }
3885}
3886
3887impl CompositeConnectorProxyInterface for CompositeConnectorProxy {
3888    fn r#connect(
3889        &self,
3890        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
3891    ) -> Result<(), fidl::Error> {
3892        self.client.send::<CompositeConnectorConnectRequest>(
3893            (composite_protocol,),
3894            0x7ee557529079e466,
3895            fidl::encoding::DynamicFlags::empty(),
3896        )
3897    }
3898}
3899
3900pub struct CompositeConnectorEventStream {
3901    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3902}
3903
3904impl std::marker::Unpin for CompositeConnectorEventStream {}
3905
3906impl futures::stream::FusedStream for CompositeConnectorEventStream {
3907    fn is_terminated(&self) -> bool {
3908        self.event_receiver.is_terminated()
3909    }
3910}
3911
3912impl futures::Stream for CompositeConnectorEventStream {
3913    type Item = Result<CompositeConnectorEvent, fidl::Error>;
3914
3915    fn poll_next(
3916        mut self: std::pin::Pin<&mut Self>,
3917        cx: &mut std::task::Context<'_>,
3918    ) -> std::task::Poll<Option<Self::Item>> {
3919        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3920            &mut self.event_receiver,
3921            cx
3922        )?) {
3923            Some(buf) => std::task::Poll::Ready(Some(CompositeConnectorEvent::decode(buf))),
3924            None => std::task::Poll::Ready(None),
3925        }
3926    }
3927}
3928
3929#[derive(Debug)]
3930pub enum CompositeConnectorEvent {}
3931
3932impl CompositeConnectorEvent {
3933    /// Decodes a message buffer as a [`CompositeConnectorEvent`].
3934    fn decode(
3935        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3936    ) -> Result<CompositeConnectorEvent, fidl::Error> {
3937        let (bytes, _handles) = buf.split_mut();
3938        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3939        debug_assert_eq!(tx_header.tx_id, 0);
3940        match tx_header.ordinal {
3941            _ => Err(fidl::Error::UnknownOrdinal {
3942                ordinal: tx_header.ordinal,
3943                protocol_name:
3944                    <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3945            }),
3946        }
3947    }
3948}
3949
3950/// A Stream of incoming requests for fuchsia.hardware.audio/CompositeConnector.
3951pub struct CompositeConnectorRequestStream {
3952    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3953    is_terminated: bool,
3954}
3955
3956impl std::marker::Unpin for CompositeConnectorRequestStream {}
3957
3958impl futures::stream::FusedStream for CompositeConnectorRequestStream {
3959    fn is_terminated(&self) -> bool {
3960        self.is_terminated
3961    }
3962}
3963
3964impl fidl::endpoints::RequestStream for CompositeConnectorRequestStream {
3965    type Protocol = CompositeConnectorMarker;
3966    type ControlHandle = CompositeConnectorControlHandle;
3967
3968    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3969        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3970    }
3971
3972    fn control_handle(&self) -> Self::ControlHandle {
3973        CompositeConnectorControlHandle { inner: self.inner.clone() }
3974    }
3975
3976    fn into_inner(
3977        self,
3978    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3979    {
3980        (self.inner, self.is_terminated)
3981    }
3982
3983    fn from_inner(
3984        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3985        is_terminated: bool,
3986    ) -> Self {
3987        Self { inner, is_terminated }
3988    }
3989}
3990
3991impl futures::Stream for CompositeConnectorRequestStream {
3992    type Item = Result<CompositeConnectorRequest, fidl::Error>;
3993
3994    fn poll_next(
3995        mut self: std::pin::Pin<&mut Self>,
3996        cx: &mut std::task::Context<'_>,
3997    ) -> std::task::Poll<Option<Self::Item>> {
3998        let this = &mut *self;
3999        if this.inner.check_shutdown(cx) {
4000            this.is_terminated = true;
4001            return std::task::Poll::Ready(None);
4002        }
4003        if this.is_terminated {
4004            panic!("polled CompositeConnectorRequestStream after completion");
4005        }
4006        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4007            |bytes, handles| {
4008                match this.inner.channel().read_etc(cx, bytes, handles) {
4009                    std::task::Poll::Ready(Ok(())) => {}
4010                    std::task::Poll::Pending => return std::task::Poll::Pending,
4011                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4012                        this.is_terminated = true;
4013                        return std::task::Poll::Ready(None);
4014                    }
4015                    std::task::Poll::Ready(Err(e)) => {
4016                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4017                            e.into(),
4018                        ))));
4019                    }
4020                }
4021
4022                // A message has been received from the channel
4023                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4024
4025                std::task::Poll::Ready(Some(match header.ordinal {
4026                0x7ee557529079e466 => {
4027                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4028                    let mut req = fidl::new_empty!(CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4029                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4030                    let control_handle = CompositeConnectorControlHandle {
4031                        inner: this.inner.clone(),
4032                    };
4033                    Ok(CompositeConnectorRequest::Connect {composite_protocol: req.composite_protocol,
4034
4035                        control_handle,
4036                    })
4037                }
4038                _ => Err(fidl::Error::UnknownOrdinal {
4039                    ordinal: header.ordinal,
4040                    protocol_name: <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4041                }),
4042            }))
4043            },
4044        )
4045    }
4046}
4047
4048/// For an overview see
4049/// [Audio Composite Devices](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md).
4050#[derive(Debug)]
4051pub enum CompositeConnectorRequest {
4052    /// Connect to a `Device` protocol.
4053    /// This method allows a component to serve FIDL outside the devhost's control.
4054    Connect {
4055        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4056        control_handle: CompositeConnectorControlHandle,
4057    },
4058}
4059
4060impl CompositeConnectorRequest {
4061    #[allow(irrefutable_let_patterns)]
4062    pub fn into_connect(
4063        self,
4064    ) -> Option<(fidl::endpoints::ServerEnd<CompositeMarker>, CompositeConnectorControlHandle)>
4065    {
4066        if let CompositeConnectorRequest::Connect { composite_protocol, control_handle } = self {
4067            Some((composite_protocol, control_handle))
4068        } else {
4069            None
4070        }
4071    }
4072
4073    /// Name of the method defined in FIDL
4074    pub fn method_name(&self) -> &'static str {
4075        match *self {
4076            CompositeConnectorRequest::Connect { .. } => "connect",
4077        }
4078    }
4079}
4080
4081#[derive(Debug, Clone)]
4082pub struct CompositeConnectorControlHandle {
4083    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4084}
4085
4086impl fidl::endpoints::ControlHandle for CompositeConnectorControlHandle {
4087    fn shutdown(&self) {
4088        self.inner.shutdown()
4089    }
4090    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4091        self.inner.shutdown_with_epitaph(status)
4092    }
4093
4094    fn is_closed(&self) -> bool {
4095        self.inner.channel().is_closed()
4096    }
4097    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4098        self.inner.channel().on_closed()
4099    }
4100
4101    #[cfg(target_os = "fuchsia")]
4102    fn signal_peer(
4103        &self,
4104        clear_mask: zx::Signals,
4105        set_mask: zx::Signals,
4106    ) -> Result<(), zx_status::Status> {
4107        use fidl::Peered;
4108        self.inner.channel().signal_peer(clear_mask, set_mask)
4109    }
4110}
4111
4112impl CompositeConnectorControlHandle {}
4113
4114#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4115pub struct DaiMarker;
4116
4117impl fidl::endpoints::ProtocolMarker for DaiMarker {
4118    type Proxy = DaiProxy;
4119    type RequestStream = DaiRequestStream;
4120    #[cfg(target_os = "fuchsia")]
4121    type SynchronousProxy = DaiSynchronousProxy;
4122
4123    const DEBUG_NAME: &'static str = "(anonymous) Dai";
4124}
4125pub type DaiGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
4126pub type DaiGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, i32>;
4127
4128pub trait DaiProxyInterface: Send + Sync {
4129    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
4130        + Send;
4131    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
4132    fn r#signal_processing_connect(
4133        &self,
4134        protocol: fidl::endpoints::ServerEnd<
4135            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4136        >,
4137    ) -> Result<(), fidl::Error>;
4138    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4139    fn r#reset(&self) -> Self::ResetResponseFut;
4140    type GetPropertiesResponseFut: std::future::Future<Output = Result<DaiProperties, fidl::Error>>
4141        + Send;
4142    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
4143    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<DaiGetDaiFormatsResult, fidl::Error>>
4144        + Send;
4145    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
4146    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<DaiGetRingBufferFormatsResult, fidl::Error>>
4147        + Send;
4148    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut;
4149    fn r#create_ring_buffer(
4150        &self,
4151        dai_format: &DaiFormat,
4152        ring_buffer_format: &Format,
4153        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4154    ) -> Result<(), fidl::Error>;
4155}
4156#[derive(Debug)]
4157#[cfg(target_os = "fuchsia")]
4158pub struct DaiSynchronousProxy {
4159    client: fidl::client::sync::Client,
4160}
4161
4162#[cfg(target_os = "fuchsia")]
4163impl fidl::endpoints::SynchronousProxy for DaiSynchronousProxy {
4164    type Proxy = DaiProxy;
4165    type Protocol = DaiMarker;
4166
4167    fn from_channel(inner: fidl::Channel) -> Self {
4168        Self::new(inner)
4169    }
4170
4171    fn into_channel(self) -> fidl::Channel {
4172        self.client.into_channel()
4173    }
4174
4175    fn as_channel(&self) -> &fidl::Channel {
4176        self.client.as_channel()
4177    }
4178}
4179
4180#[cfg(target_os = "fuchsia")]
4181impl DaiSynchronousProxy {
4182    pub fn new(channel: fidl::Channel) -> Self {
4183        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4184        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4185    }
4186
4187    pub fn into_channel(self) -> fidl::Channel {
4188        self.client.into_channel()
4189    }
4190
4191    /// Waits until an event arrives and returns it. It is safe for other
4192    /// threads to make concurrent requests while waiting for an event.
4193    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<DaiEvent, fidl::Error> {
4194        DaiEvent::decode(self.client.wait_for_event(deadline)?)
4195    }
4196
4197    /// Retrieves top level health state.
4198    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4199    pub fn r#get_health_state(
4200        &self,
4201        ___deadline: zx::MonotonicInstant,
4202    ) -> Result<HealthState, fidl::Error> {
4203        let _response =
4204            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
4205                (),
4206                0x4e146d6bca733a84,
4207                fidl::encoding::DynamicFlags::empty(),
4208                ___deadline,
4209            )?;
4210        Ok(_response.state)
4211    }
4212
4213    /// Connect to a `SignalProcessing` protocol.
4214    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4215    /// the maximum number of connections have already been created, for instance one, then the
4216    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4217    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4218    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4219    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4220    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4221    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4222    /// is intended to be composed, and hence the more verbose name allows differentiation and
4223    /// improved clarity.
4224    pub fn r#signal_processing_connect(
4225        &self,
4226        mut protocol: fidl::endpoints::ServerEnd<
4227            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4228        >,
4229    ) -> Result<(), fidl::Error> {
4230        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4231            (protocol,),
4232            0xa81907ce6066295,
4233            fidl::encoding::DynamicFlags::empty(),
4234        )
4235    }
4236
4237    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4238    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4239    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4240    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4241    /// protocol channel and retry.
4242    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
4243        let _response =
4244            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
4245                (),
4246                0x69e5fa9fa2f78c14,
4247                fidl::encoding::DynamicFlags::empty(),
4248                ___deadline,
4249            )?;
4250        Ok(_response)
4251    }
4252
4253    /// Retrieves top level static properties.
4254    pub fn r#get_properties(
4255        &self,
4256        ___deadline: zx::MonotonicInstant,
4257    ) -> Result<DaiProperties, fidl::Error> {
4258        let _response =
4259            self.client.send_query::<fidl::encoding::EmptyPayload, DaiGetPropertiesResponse>(
4260                (),
4261                0x2c25a1a66149510b,
4262                fidl::encoding::DynamicFlags::empty(),
4263                ___deadline,
4264            )?;
4265        Ok(_response.properties)
4266    }
4267
4268    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4269    /// may reply with an error status and the client may retry at a later time.
4270    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4271    /// the parameters in SupportedFormats may be supported.
4272    pub fn r#get_dai_formats(
4273        &self,
4274        ___deadline: zx::MonotonicInstant,
4275    ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4276        let _response = self.client.send_query::<
4277            fidl::encoding::EmptyPayload,
4278            fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
4279        >(
4280            (),
4281            0x1eb37b0cddf79d69,
4282            fidl::encoding::DynamicFlags::empty(),
4283            ___deadline,
4284        )?;
4285        Ok(_response.map(|x| x.dai_formats))
4286    }
4287
4288    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4289    /// may reply with an error status and the client may retry at a later time.
4290    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4291    /// the parameters in `SupportedFormats` may be supported.
4292    pub fn r#get_ring_buffer_formats(
4293        &self,
4294        ___deadline: zx::MonotonicInstant,
4295    ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
4296        let _response = self.client.send_query::<
4297            fidl::encoding::EmptyPayload,
4298            fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
4299        >(
4300            (),
4301            0x760371081d8c92e4,
4302            fidl::encoding::DynamicFlags::empty(),
4303            ___deadline,
4304        )?;
4305        Ok(_response.map(|x| x.ring_buffer_formats))
4306    }
4307
4308    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4309    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4310    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4311    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4312    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4313    /// gracefully quiesce any on-going streaming operations in the process.
4314    pub fn r#create_ring_buffer(
4315        &self,
4316        mut dai_format: &DaiFormat,
4317        mut ring_buffer_format: &Format,
4318        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4319    ) -> Result<(), fidl::Error> {
4320        self.client.send::<DaiCreateRingBufferRequest>(
4321            (dai_format, ring_buffer_format, ring_buffer),
4322            0x5af9760589a75257,
4323            fidl::encoding::DynamicFlags::empty(),
4324        )
4325    }
4326}
4327
4328#[cfg(target_os = "fuchsia")]
4329impl From<DaiSynchronousProxy> for zx::Handle {
4330    fn from(value: DaiSynchronousProxy) -> Self {
4331        value.into_channel().into()
4332    }
4333}
4334
4335#[cfg(target_os = "fuchsia")]
4336impl From<fidl::Channel> for DaiSynchronousProxy {
4337    fn from(value: fidl::Channel) -> Self {
4338        Self::new(value)
4339    }
4340}
4341
4342#[cfg(target_os = "fuchsia")]
4343impl fidl::endpoints::FromClient for DaiSynchronousProxy {
4344    type Protocol = DaiMarker;
4345
4346    fn from_client(value: fidl::endpoints::ClientEnd<DaiMarker>) -> Self {
4347        Self::new(value.into_channel())
4348    }
4349}
4350
4351#[derive(Debug, Clone)]
4352pub struct DaiProxy {
4353    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4354}
4355
4356impl fidl::endpoints::Proxy for DaiProxy {
4357    type Protocol = DaiMarker;
4358
4359    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4360        Self::new(inner)
4361    }
4362
4363    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4364        self.client.into_channel().map_err(|client| Self { client })
4365    }
4366
4367    fn as_channel(&self) -> &::fidl::AsyncChannel {
4368        self.client.as_channel()
4369    }
4370}
4371
4372impl DaiProxy {
4373    /// Create a new Proxy for fuchsia.hardware.audio/Dai.
4374    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4375        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4376        Self { client: fidl::client::Client::new(channel, protocol_name) }
4377    }
4378
4379    /// Get a Stream of events from the remote end of the protocol.
4380    ///
4381    /// # Panics
4382    ///
4383    /// Panics if the event stream was already taken.
4384    pub fn take_event_stream(&self) -> DaiEventStream {
4385        DaiEventStream { event_receiver: self.client.take_event_receiver() }
4386    }
4387
4388    /// Retrieves top level health state.
4389    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4390    pub fn r#get_health_state(
4391        &self,
4392    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
4393    {
4394        DaiProxyInterface::r#get_health_state(self)
4395    }
4396
4397    /// Connect to a `SignalProcessing` protocol.
4398    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4399    /// the maximum number of connections have already been created, for instance one, then the
4400    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4401    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4402    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4403    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4404    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4405    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4406    /// is intended to be composed, and hence the more verbose name allows differentiation and
4407    /// improved clarity.
4408    pub fn r#signal_processing_connect(
4409        &self,
4410        mut protocol: fidl::endpoints::ServerEnd<
4411            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4412        >,
4413    ) -> Result<(), fidl::Error> {
4414        DaiProxyInterface::r#signal_processing_connect(self, protocol)
4415    }
4416
4417    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4418    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4419    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4420    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4421    /// protocol channel and retry.
4422    pub fn r#reset(
4423        &self,
4424    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4425        DaiProxyInterface::r#reset(self)
4426    }
4427
4428    /// Retrieves top level static properties.
4429    pub fn r#get_properties(
4430        &self,
4431    ) -> fidl::client::QueryResponseFut<DaiProperties, fidl::encoding::DefaultFuchsiaResourceDialect>
4432    {
4433        DaiProxyInterface::r#get_properties(self)
4434    }
4435
4436    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4437    /// may reply with an error status and the client may retry at a later time.
4438    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4439    /// the parameters in SupportedFormats may be supported.
4440    pub fn r#get_dai_formats(
4441        &self,
4442    ) -> fidl::client::QueryResponseFut<
4443        DaiGetDaiFormatsResult,
4444        fidl::encoding::DefaultFuchsiaResourceDialect,
4445    > {
4446        DaiProxyInterface::r#get_dai_formats(self)
4447    }
4448
4449    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4450    /// may reply with an error status and the client may retry at a later time.
4451    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4452    /// the parameters in `SupportedFormats` may be supported.
4453    pub fn r#get_ring_buffer_formats(
4454        &self,
4455    ) -> fidl::client::QueryResponseFut<
4456        DaiGetRingBufferFormatsResult,
4457        fidl::encoding::DefaultFuchsiaResourceDialect,
4458    > {
4459        DaiProxyInterface::r#get_ring_buffer_formats(self)
4460    }
4461
4462    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4463    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4464    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4465    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4466    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4467    /// gracefully quiesce any on-going streaming operations in the process.
4468    pub fn r#create_ring_buffer(
4469        &self,
4470        mut dai_format: &DaiFormat,
4471        mut ring_buffer_format: &Format,
4472        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4473    ) -> Result<(), fidl::Error> {
4474        DaiProxyInterface::r#create_ring_buffer(self, dai_format, ring_buffer_format, ring_buffer)
4475    }
4476}
4477
4478impl DaiProxyInterface for DaiProxy {
4479    type GetHealthStateResponseFut =
4480        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
4481    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
4482        fn _decode(
4483            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4484        ) -> Result<HealthState, fidl::Error> {
4485            let _response = fidl::client::decode_transaction_body::<
4486                HealthGetHealthStateResponse,
4487                fidl::encoding::DefaultFuchsiaResourceDialect,
4488                0x4e146d6bca733a84,
4489            >(_buf?)?;
4490            Ok(_response.state)
4491        }
4492        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
4493            (),
4494            0x4e146d6bca733a84,
4495            fidl::encoding::DynamicFlags::empty(),
4496            _decode,
4497        )
4498    }
4499
4500    fn r#signal_processing_connect(
4501        &self,
4502        mut protocol: fidl::endpoints::ServerEnd<
4503            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4504        >,
4505    ) -> Result<(), fidl::Error> {
4506        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4507            (protocol,),
4508            0xa81907ce6066295,
4509            fidl::encoding::DynamicFlags::empty(),
4510        )
4511    }
4512
4513    type ResetResponseFut =
4514        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4515    fn r#reset(&self) -> Self::ResetResponseFut {
4516        fn _decode(
4517            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4518        ) -> Result<(), fidl::Error> {
4519            let _response = fidl::client::decode_transaction_body::<
4520                fidl::encoding::EmptyPayload,
4521                fidl::encoding::DefaultFuchsiaResourceDialect,
4522                0x69e5fa9fa2f78c14,
4523            >(_buf?)?;
4524            Ok(_response)
4525        }
4526        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4527            (),
4528            0x69e5fa9fa2f78c14,
4529            fidl::encoding::DynamicFlags::empty(),
4530            _decode,
4531        )
4532    }
4533
4534    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
4535        DaiProperties,
4536        fidl::encoding::DefaultFuchsiaResourceDialect,
4537    >;
4538    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
4539        fn _decode(
4540            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4541        ) -> Result<DaiProperties, fidl::Error> {
4542            let _response = fidl::client::decode_transaction_body::<
4543                DaiGetPropertiesResponse,
4544                fidl::encoding::DefaultFuchsiaResourceDialect,
4545                0x2c25a1a66149510b,
4546            >(_buf?)?;
4547            Ok(_response.properties)
4548        }
4549        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiProperties>(
4550            (),
4551            0x2c25a1a66149510b,
4552            fidl::encoding::DynamicFlags::empty(),
4553            _decode,
4554        )
4555    }
4556
4557    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
4558        DaiGetDaiFormatsResult,
4559        fidl::encoding::DefaultFuchsiaResourceDialect,
4560    >;
4561    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
4562        fn _decode(
4563            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4564        ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4565            let _response = fidl::client::decode_transaction_body::<
4566                fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
4567                fidl::encoding::DefaultFuchsiaResourceDialect,
4568                0x1eb37b0cddf79d69,
4569            >(_buf?)?;
4570            Ok(_response.map(|x| x.dai_formats))
4571        }
4572        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetDaiFormatsResult>(
4573            (),
4574            0x1eb37b0cddf79d69,
4575            fidl::encoding::DynamicFlags::empty(),
4576            _decode,
4577        )
4578    }
4579
4580    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
4581        DaiGetRingBufferFormatsResult,
4582        fidl::encoding::DefaultFuchsiaResourceDialect,
4583    >;
4584    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut {
4585        fn _decode(
4586            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4587        ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
4588            let _response = fidl::client::decode_transaction_body::<
4589                fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
4590                fidl::encoding::DefaultFuchsiaResourceDialect,
4591                0x760371081d8c92e4,
4592            >(_buf?)?;
4593            Ok(_response.map(|x| x.ring_buffer_formats))
4594        }
4595        self.client
4596            .send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetRingBufferFormatsResult>(
4597                (),
4598                0x760371081d8c92e4,
4599                fidl::encoding::DynamicFlags::empty(),
4600                _decode,
4601            )
4602    }
4603
4604    fn r#create_ring_buffer(
4605        &self,
4606        mut dai_format: &DaiFormat,
4607        mut ring_buffer_format: &Format,
4608        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4609    ) -> Result<(), fidl::Error> {
4610        self.client.send::<DaiCreateRingBufferRequest>(
4611            (dai_format, ring_buffer_format, ring_buffer),
4612            0x5af9760589a75257,
4613            fidl::encoding::DynamicFlags::empty(),
4614        )
4615    }
4616}
4617
4618pub struct DaiEventStream {
4619    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4620}
4621
4622impl std::marker::Unpin for DaiEventStream {}
4623
4624impl futures::stream::FusedStream for DaiEventStream {
4625    fn is_terminated(&self) -> bool {
4626        self.event_receiver.is_terminated()
4627    }
4628}
4629
4630impl futures::Stream for DaiEventStream {
4631    type Item = Result<DaiEvent, fidl::Error>;
4632
4633    fn poll_next(
4634        mut self: std::pin::Pin<&mut Self>,
4635        cx: &mut std::task::Context<'_>,
4636    ) -> std::task::Poll<Option<Self::Item>> {
4637        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4638            &mut self.event_receiver,
4639            cx
4640        )?) {
4641            Some(buf) => std::task::Poll::Ready(Some(DaiEvent::decode(buf))),
4642            None => std::task::Poll::Ready(None),
4643        }
4644    }
4645}
4646
4647#[derive(Debug)]
4648pub enum DaiEvent {}
4649
4650impl DaiEvent {
4651    /// Decodes a message buffer as a [`DaiEvent`].
4652    fn decode(
4653        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4654    ) -> Result<DaiEvent, fidl::Error> {
4655        let (bytes, _handles) = buf.split_mut();
4656        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4657        debug_assert_eq!(tx_header.tx_id, 0);
4658        match tx_header.ordinal {
4659            _ => Err(fidl::Error::UnknownOrdinal {
4660                ordinal: tx_header.ordinal,
4661                protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4662            }),
4663        }
4664    }
4665}
4666
4667/// A Stream of incoming requests for fuchsia.hardware.audio/Dai.
4668pub struct DaiRequestStream {
4669    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4670    is_terminated: bool,
4671}
4672
4673impl std::marker::Unpin for DaiRequestStream {}
4674
4675impl futures::stream::FusedStream for DaiRequestStream {
4676    fn is_terminated(&self) -> bool {
4677        self.is_terminated
4678    }
4679}
4680
4681impl fidl::endpoints::RequestStream for DaiRequestStream {
4682    type Protocol = DaiMarker;
4683    type ControlHandle = DaiControlHandle;
4684
4685    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4686        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4687    }
4688
4689    fn control_handle(&self) -> Self::ControlHandle {
4690        DaiControlHandle { inner: self.inner.clone() }
4691    }
4692
4693    fn into_inner(
4694        self,
4695    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4696    {
4697        (self.inner, self.is_terminated)
4698    }
4699
4700    fn from_inner(
4701        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4702        is_terminated: bool,
4703    ) -> Self {
4704        Self { inner, is_terminated }
4705    }
4706}
4707
4708impl futures::Stream for DaiRequestStream {
4709    type Item = Result<DaiRequest, fidl::Error>;
4710
4711    fn poll_next(
4712        mut self: std::pin::Pin<&mut Self>,
4713        cx: &mut std::task::Context<'_>,
4714    ) -> std::task::Poll<Option<Self::Item>> {
4715        let this = &mut *self;
4716        if this.inner.check_shutdown(cx) {
4717            this.is_terminated = true;
4718            return std::task::Poll::Ready(None);
4719        }
4720        if this.is_terminated {
4721            panic!("polled DaiRequestStream after completion");
4722        }
4723        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4724            |bytes, handles| {
4725                match this.inner.channel().read_etc(cx, bytes, handles) {
4726                    std::task::Poll::Ready(Ok(())) => {}
4727                    std::task::Poll::Pending => return std::task::Poll::Pending,
4728                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4729                        this.is_terminated = true;
4730                        return std::task::Poll::Ready(None);
4731                    }
4732                    std::task::Poll::Ready(Err(e)) => {
4733                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4734                            e.into(),
4735                        ))));
4736                    }
4737                }
4738
4739                // A message has been received from the channel
4740                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4741
4742                std::task::Poll::Ready(Some(match header.ordinal {
4743                    0x4e146d6bca733a84 => {
4744                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4745                        let mut req = fidl::new_empty!(
4746                            fidl::encoding::EmptyPayload,
4747                            fidl::encoding::DefaultFuchsiaResourceDialect
4748                        );
4749                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4750                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4751                        Ok(DaiRequest::GetHealthState {
4752                            responder: DaiGetHealthStateResponder {
4753                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4754                                tx_id: header.tx_id,
4755                            },
4756                        })
4757                    }
4758                    0xa81907ce6066295 => {
4759                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4760                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4761                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4762                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4763                        Ok(DaiRequest::SignalProcessingConnect {
4764                            protocol: req.protocol,
4765
4766                            control_handle,
4767                        })
4768                    }
4769                    0x69e5fa9fa2f78c14 => {
4770                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4771                        let mut req = fidl::new_empty!(
4772                            fidl::encoding::EmptyPayload,
4773                            fidl::encoding::DefaultFuchsiaResourceDialect
4774                        );
4775                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4776                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4777                        Ok(DaiRequest::Reset {
4778                            responder: DaiResetResponder {
4779                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4780                                tx_id: header.tx_id,
4781                            },
4782                        })
4783                    }
4784                    0x2c25a1a66149510b => {
4785                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4786                        let mut req = fidl::new_empty!(
4787                            fidl::encoding::EmptyPayload,
4788                            fidl::encoding::DefaultFuchsiaResourceDialect
4789                        );
4790                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4791                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4792                        Ok(DaiRequest::GetProperties {
4793                            responder: DaiGetPropertiesResponder {
4794                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4795                                tx_id: header.tx_id,
4796                            },
4797                        })
4798                    }
4799                    0x1eb37b0cddf79d69 => {
4800                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4801                        let mut req = fidl::new_empty!(
4802                            fidl::encoding::EmptyPayload,
4803                            fidl::encoding::DefaultFuchsiaResourceDialect
4804                        );
4805                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4806                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4807                        Ok(DaiRequest::GetDaiFormats {
4808                            responder: DaiGetDaiFormatsResponder {
4809                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4810                                tx_id: header.tx_id,
4811                            },
4812                        })
4813                    }
4814                    0x760371081d8c92e4 => {
4815                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4816                        let mut req = fidl::new_empty!(
4817                            fidl::encoding::EmptyPayload,
4818                            fidl::encoding::DefaultFuchsiaResourceDialect
4819                        );
4820                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4821                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4822                        Ok(DaiRequest::GetRingBufferFormats {
4823                            responder: DaiGetRingBufferFormatsResponder {
4824                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4825                                tx_id: header.tx_id,
4826                            },
4827                        })
4828                    }
4829                    0x5af9760589a75257 => {
4830                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4831                        let mut req = fidl::new_empty!(
4832                            DaiCreateRingBufferRequest,
4833                            fidl::encoding::DefaultFuchsiaResourceDialect
4834                        );
4835                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
4836                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4837                        Ok(DaiRequest::CreateRingBuffer {
4838                            dai_format: req.dai_format,
4839                            ring_buffer_format: req.ring_buffer_format,
4840                            ring_buffer: req.ring_buffer,
4841
4842                            control_handle,
4843                        })
4844                    }
4845                    _ => Err(fidl::Error::UnknownOrdinal {
4846                        ordinal: header.ordinal,
4847                        protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4848                    }),
4849                }))
4850            },
4851        )
4852    }
4853}
4854
4855/// For an overview see
4856/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_dai).
4857/// # Deprecation
4858///
4859/// Not supported anymore, instead use an
4860/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
4861/// with one DAI and one Ring Buffer, see
4862/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
4863#[derive(Debug)]
4864pub enum DaiRequest {
4865    /// Retrieves top level health state.
4866    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4867    GetHealthState { responder: DaiGetHealthStateResponder },
4868    /// Connect to a `SignalProcessing` protocol.
4869    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4870    /// the maximum number of connections have already been created, for instance one, then the
4871    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4872    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4873    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4874    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4875    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4876    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4877    /// is intended to be composed, and hence the more verbose name allows differentiation and
4878    /// improved clarity.
4879    SignalProcessingConnect {
4880        protocol: fidl::endpoints::ServerEnd<
4881            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4882        >,
4883        control_handle: DaiControlHandle,
4884    },
4885    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4886    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4887    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4888    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4889    /// protocol channel and retry.
4890    Reset { responder: DaiResetResponder },
4891    /// Retrieves top level static properties.
4892    GetProperties { responder: DaiGetPropertiesResponder },
4893    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4894    /// may reply with an error status and the client may retry at a later time.
4895    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4896    /// the parameters in SupportedFormats may be supported.
4897    GetDaiFormats { responder: DaiGetDaiFormatsResponder },
4898    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4899    /// may reply with an error status and the client may retry at a later time.
4900    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4901    /// the parameters in `SupportedFormats` may be supported.
4902    GetRingBufferFormats { responder: DaiGetRingBufferFormatsResponder },
4903    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4904    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4905    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4906    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4907    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4908    /// gracefully quiesce any on-going streaming operations in the process.
4909    CreateRingBuffer {
4910        dai_format: DaiFormat,
4911        ring_buffer_format: Format,
4912        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4913        control_handle: DaiControlHandle,
4914    },
4915}
4916
4917impl DaiRequest {
4918    #[allow(irrefutable_let_patterns)]
4919    pub fn into_get_health_state(self) -> Option<(DaiGetHealthStateResponder)> {
4920        if let DaiRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
4921    }
4922
4923    #[allow(irrefutable_let_patterns)]
4924    pub fn into_signal_processing_connect(
4925        self,
4926    ) -> Option<(
4927        fidl::endpoints::ServerEnd<
4928            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4929        >,
4930        DaiControlHandle,
4931    )> {
4932        if let DaiRequest::SignalProcessingConnect { protocol, control_handle } = self {
4933            Some((protocol, control_handle))
4934        } else {
4935            None
4936        }
4937    }
4938
4939    #[allow(irrefutable_let_patterns)]
4940    pub fn into_reset(self) -> Option<(DaiResetResponder)> {
4941        if let DaiRequest::Reset { responder } = self { Some((responder)) } else { None }
4942    }
4943
4944    #[allow(irrefutable_let_patterns)]
4945    pub fn into_get_properties(self) -> Option<(DaiGetPropertiesResponder)> {
4946        if let DaiRequest::GetProperties { responder } = self { Some((responder)) } else { None }
4947    }
4948
4949    #[allow(irrefutable_let_patterns)]
4950    pub fn into_get_dai_formats(self) -> Option<(DaiGetDaiFormatsResponder)> {
4951        if let DaiRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
4952    }
4953
4954    #[allow(irrefutable_let_patterns)]
4955    pub fn into_get_ring_buffer_formats(self) -> Option<(DaiGetRingBufferFormatsResponder)> {
4956        if let DaiRequest::GetRingBufferFormats { responder } = self {
4957            Some((responder))
4958        } else {
4959            None
4960        }
4961    }
4962
4963    #[allow(irrefutable_let_patterns)]
4964    pub fn into_create_ring_buffer(
4965        self,
4966    ) -> Option<(DaiFormat, Format, fidl::endpoints::ServerEnd<RingBufferMarker>, DaiControlHandle)>
4967    {
4968        if let DaiRequest::CreateRingBuffer {
4969            dai_format,
4970            ring_buffer_format,
4971            ring_buffer,
4972            control_handle,
4973        } = self
4974        {
4975            Some((dai_format, ring_buffer_format, ring_buffer, control_handle))
4976        } else {
4977            None
4978        }
4979    }
4980
4981    /// Name of the method defined in FIDL
4982    pub fn method_name(&self) -> &'static str {
4983        match *self {
4984            DaiRequest::GetHealthState { .. } => "get_health_state",
4985            DaiRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
4986            DaiRequest::Reset { .. } => "reset",
4987            DaiRequest::GetProperties { .. } => "get_properties",
4988            DaiRequest::GetDaiFormats { .. } => "get_dai_formats",
4989            DaiRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
4990            DaiRequest::CreateRingBuffer { .. } => "create_ring_buffer",
4991        }
4992    }
4993}
4994
4995#[derive(Debug, Clone)]
4996pub struct DaiControlHandle {
4997    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4998}
4999
5000impl fidl::endpoints::ControlHandle for DaiControlHandle {
5001    fn shutdown(&self) {
5002        self.inner.shutdown()
5003    }
5004    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5005        self.inner.shutdown_with_epitaph(status)
5006    }
5007
5008    fn is_closed(&self) -> bool {
5009        self.inner.channel().is_closed()
5010    }
5011    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5012        self.inner.channel().on_closed()
5013    }
5014
5015    #[cfg(target_os = "fuchsia")]
5016    fn signal_peer(
5017        &self,
5018        clear_mask: zx::Signals,
5019        set_mask: zx::Signals,
5020    ) -> Result<(), zx_status::Status> {
5021        use fidl::Peered;
5022        self.inner.channel().signal_peer(clear_mask, set_mask)
5023    }
5024}
5025
5026impl DaiControlHandle {}
5027
5028#[must_use = "FIDL methods require a response to be sent"]
5029#[derive(Debug)]
5030pub struct DaiGetHealthStateResponder {
5031    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5032    tx_id: u32,
5033}
5034
5035/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5036/// if the responder is dropped without sending a response, so that the client
5037/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5038impl std::ops::Drop for DaiGetHealthStateResponder {
5039    fn drop(&mut self) {
5040        self.control_handle.shutdown();
5041        // Safety: drops once, never accessed again
5042        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5043    }
5044}
5045
5046impl fidl::endpoints::Responder for DaiGetHealthStateResponder {
5047    type ControlHandle = DaiControlHandle;
5048
5049    fn control_handle(&self) -> &DaiControlHandle {
5050        &self.control_handle
5051    }
5052
5053    fn drop_without_shutdown(mut self) {
5054        // Safety: drops once, never accessed again due to mem::forget
5055        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5056        // Prevent Drop from running (which would shut down the channel)
5057        std::mem::forget(self);
5058    }
5059}
5060
5061impl DaiGetHealthStateResponder {
5062    /// Sends a response to the FIDL transaction.
5063    ///
5064    /// Sets the channel to shutdown if an error occurs.
5065    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5066        let _result = self.send_raw(state);
5067        if _result.is_err() {
5068            self.control_handle.shutdown();
5069        }
5070        self.drop_without_shutdown();
5071        _result
5072    }
5073
5074    /// Similar to "send" but does not shutdown the channel if an error occurs.
5075    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5076        let _result = self.send_raw(state);
5077        self.drop_without_shutdown();
5078        _result
5079    }
5080
5081    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
5082        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
5083            (state,),
5084            self.tx_id,
5085            0x4e146d6bca733a84,
5086            fidl::encoding::DynamicFlags::empty(),
5087        )
5088    }
5089}
5090
5091#[must_use = "FIDL methods require a response to be sent"]
5092#[derive(Debug)]
5093pub struct DaiResetResponder {
5094    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5095    tx_id: u32,
5096}
5097
5098/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5099/// if the responder is dropped without sending a response, so that the client
5100/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5101impl std::ops::Drop for DaiResetResponder {
5102    fn drop(&mut self) {
5103        self.control_handle.shutdown();
5104        // Safety: drops once, never accessed again
5105        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5106    }
5107}
5108
5109impl fidl::endpoints::Responder for DaiResetResponder {
5110    type ControlHandle = DaiControlHandle;
5111
5112    fn control_handle(&self) -> &DaiControlHandle {
5113        &self.control_handle
5114    }
5115
5116    fn drop_without_shutdown(mut self) {
5117        // Safety: drops once, never accessed again due to mem::forget
5118        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5119        // Prevent Drop from running (which would shut down the channel)
5120        std::mem::forget(self);
5121    }
5122}
5123
5124impl DaiResetResponder {
5125    /// Sends a response to the FIDL transaction.
5126    ///
5127    /// Sets the channel to shutdown if an error occurs.
5128    pub fn send(self) -> Result<(), fidl::Error> {
5129        let _result = self.send_raw();
5130        if _result.is_err() {
5131            self.control_handle.shutdown();
5132        }
5133        self.drop_without_shutdown();
5134        _result
5135    }
5136
5137    /// Similar to "send" but does not shutdown the channel if an error occurs.
5138    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5139        let _result = self.send_raw();
5140        self.drop_without_shutdown();
5141        _result
5142    }
5143
5144    fn send_raw(&self) -> Result<(), fidl::Error> {
5145        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5146            (),
5147            self.tx_id,
5148            0x69e5fa9fa2f78c14,
5149            fidl::encoding::DynamicFlags::empty(),
5150        )
5151    }
5152}
5153
5154#[must_use = "FIDL methods require a response to be sent"]
5155#[derive(Debug)]
5156pub struct DaiGetPropertiesResponder {
5157    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5158    tx_id: u32,
5159}
5160
5161/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5162/// if the responder is dropped without sending a response, so that the client
5163/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5164impl std::ops::Drop for DaiGetPropertiesResponder {
5165    fn drop(&mut self) {
5166        self.control_handle.shutdown();
5167        // Safety: drops once, never accessed again
5168        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5169    }
5170}
5171
5172impl fidl::endpoints::Responder for DaiGetPropertiesResponder {
5173    type ControlHandle = DaiControlHandle;
5174
5175    fn control_handle(&self) -> &DaiControlHandle {
5176        &self.control_handle
5177    }
5178
5179    fn drop_without_shutdown(mut self) {
5180        // Safety: drops once, never accessed again due to mem::forget
5181        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5182        // Prevent Drop from running (which would shut down the channel)
5183        std::mem::forget(self);
5184    }
5185}
5186
5187impl DaiGetPropertiesResponder {
5188    /// Sends a response to the FIDL transaction.
5189    ///
5190    /// Sets the channel to shutdown if an error occurs.
5191    pub fn send(self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5192        let _result = self.send_raw(properties);
5193        if _result.is_err() {
5194            self.control_handle.shutdown();
5195        }
5196        self.drop_without_shutdown();
5197        _result
5198    }
5199
5200    /// Similar to "send" but does not shutdown the channel if an error occurs.
5201    pub fn send_no_shutdown_on_err(
5202        self,
5203        mut properties: &DaiProperties,
5204    ) -> Result<(), fidl::Error> {
5205        let _result = self.send_raw(properties);
5206        self.drop_without_shutdown();
5207        _result
5208    }
5209
5210    fn send_raw(&self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5211        self.control_handle.inner.send::<DaiGetPropertiesResponse>(
5212            (properties,),
5213            self.tx_id,
5214            0x2c25a1a66149510b,
5215            fidl::encoding::DynamicFlags::empty(),
5216        )
5217    }
5218}
5219
5220#[must_use = "FIDL methods require a response to be sent"]
5221#[derive(Debug)]
5222pub struct DaiGetDaiFormatsResponder {
5223    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5224    tx_id: u32,
5225}
5226
5227/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5228/// if the responder is dropped without sending a response, so that the client
5229/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5230impl std::ops::Drop for DaiGetDaiFormatsResponder {
5231    fn drop(&mut self) {
5232        self.control_handle.shutdown();
5233        // Safety: drops once, never accessed again
5234        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5235    }
5236}
5237
5238impl fidl::endpoints::Responder for DaiGetDaiFormatsResponder {
5239    type ControlHandle = DaiControlHandle;
5240
5241    fn control_handle(&self) -> &DaiControlHandle {
5242        &self.control_handle
5243    }
5244
5245    fn drop_without_shutdown(mut self) {
5246        // Safety: drops once, never accessed again due to mem::forget
5247        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5248        // Prevent Drop from running (which would shut down the channel)
5249        std::mem::forget(self);
5250    }
5251}
5252
5253impl DaiGetDaiFormatsResponder {
5254    /// Sends a response to the FIDL transaction.
5255    ///
5256    /// Sets the channel to shutdown if an error occurs.
5257    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5258        let _result = self.send_raw(result);
5259        if _result.is_err() {
5260            self.control_handle.shutdown();
5261        }
5262        self.drop_without_shutdown();
5263        _result
5264    }
5265
5266    /// Similar to "send" but does not shutdown the channel if an error occurs.
5267    pub fn send_no_shutdown_on_err(
5268        self,
5269        mut result: Result<&[DaiSupportedFormats], i32>,
5270    ) -> Result<(), fidl::Error> {
5271        let _result = self.send_raw(result);
5272        self.drop_without_shutdown();
5273        _result
5274    }
5275
5276    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5277        self.control_handle.inner.send::<fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>>(
5278            result.map(|dai_formats| (dai_formats,)),
5279            self.tx_id,
5280            0x1eb37b0cddf79d69,
5281            fidl::encoding::DynamicFlags::empty(),
5282        )
5283    }
5284}
5285
5286#[must_use = "FIDL methods require a response to be sent"]
5287#[derive(Debug)]
5288pub struct DaiGetRingBufferFormatsResponder {
5289    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5290    tx_id: u32,
5291}
5292
5293/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5294/// if the responder is dropped without sending a response, so that the client
5295/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5296impl std::ops::Drop for DaiGetRingBufferFormatsResponder {
5297    fn drop(&mut self) {
5298        self.control_handle.shutdown();
5299        // Safety: drops once, never accessed again
5300        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5301    }
5302}
5303
5304impl fidl::endpoints::Responder for DaiGetRingBufferFormatsResponder {
5305    type ControlHandle = DaiControlHandle;
5306
5307    fn control_handle(&self) -> &DaiControlHandle {
5308        &self.control_handle
5309    }
5310
5311    fn drop_without_shutdown(mut self) {
5312        // Safety: drops once, never accessed again due to mem::forget
5313        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5314        // Prevent Drop from running (which would shut down the channel)
5315        std::mem::forget(self);
5316    }
5317}
5318
5319impl DaiGetRingBufferFormatsResponder {
5320    /// Sends a response to the FIDL transaction.
5321    ///
5322    /// Sets the channel to shutdown if an error occurs.
5323    pub fn send(self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5324        let _result = self.send_raw(result);
5325        if _result.is_err() {
5326            self.control_handle.shutdown();
5327        }
5328        self.drop_without_shutdown();
5329        _result
5330    }
5331
5332    /// Similar to "send" but does not shutdown the channel if an error occurs.
5333    pub fn send_no_shutdown_on_err(
5334        self,
5335        mut result: Result<&[SupportedFormats], i32>,
5336    ) -> Result<(), fidl::Error> {
5337        let _result = self.send_raw(result);
5338        self.drop_without_shutdown();
5339        _result
5340    }
5341
5342    fn send_raw(&self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5343        self.control_handle
5344            .inner
5345            .send::<fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>>(
5346                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
5347                self.tx_id,
5348                0x760371081d8c92e4,
5349                fidl::encoding::DynamicFlags::empty(),
5350            )
5351    }
5352}
5353
5354#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5355pub struct DaiConnectorMarker;
5356
5357impl fidl::endpoints::ProtocolMarker for DaiConnectorMarker {
5358    type Proxy = DaiConnectorProxy;
5359    type RequestStream = DaiConnectorRequestStream;
5360    #[cfg(target_os = "fuchsia")]
5361    type SynchronousProxy = DaiConnectorSynchronousProxy;
5362
5363    const DEBUG_NAME: &'static str = "(anonymous) DaiConnector";
5364}
5365
5366pub trait DaiConnectorProxyInterface: Send + Sync {
5367    fn r#connect(
5368        &self,
5369        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5370    ) -> Result<(), fidl::Error>;
5371}
5372#[derive(Debug)]
5373#[cfg(target_os = "fuchsia")]
5374pub struct DaiConnectorSynchronousProxy {
5375    client: fidl::client::sync::Client,
5376}
5377
5378#[cfg(target_os = "fuchsia")]
5379impl fidl::endpoints::SynchronousProxy for DaiConnectorSynchronousProxy {
5380    type Proxy = DaiConnectorProxy;
5381    type Protocol = DaiConnectorMarker;
5382
5383    fn from_channel(inner: fidl::Channel) -> Self {
5384        Self::new(inner)
5385    }
5386
5387    fn into_channel(self) -> fidl::Channel {
5388        self.client.into_channel()
5389    }
5390
5391    fn as_channel(&self) -> &fidl::Channel {
5392        self.client.as_channel()
5393    }
5394}
5395
5396#[cfg(target_os = "fuchsia")]
5397impl DaiConnectorSynchronousProxy {
5398    pub fn new(channel: fidl::Channel) -> Self {
5399        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5400        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5401    }
5402
5403    pub fn into_channel(self) -> fidl::Channel {
5404        self.client.into_channel()
5405    }
5406
5407    /// Waits until an event arrives and returns it. It is safe for other
5408    /// threads to make concurrent requests while waiting for an event.
5409    pub fn wait_for_event(
5410        &self,
5411        deadline: zx::MonotonicInstant,
5412    ) -> Result<DaiConnectorEvent, fidl::Error> {
5413        DaiConnectorEvent::decode(self.client.wait_for_event(deadline)?)
5414    }
5415
5416    /// This connects to a DAI protocol server.
5417    pub fn r#connect(
5418        &self,
5419        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5420    ) -> Result<(), fidl::Error> {
5421        self.client.send::<DaiConnectorConnectRequest>(
5422            (dai_protocol,),
5423            0x4e4db05c2eca1450,
5424            fidl::encoding::DynamicFlags::empty(),
5425        )
5426    }
5427}
5428
5429#[cfg(target_os = "fuchsia")]
5430impl From<DaiConnectorSynchronousProxy> for zx::Handle {
5431    fn from(value: DaiConnectorSynchronousProxy) -> Self {
5432        value.into_channel().into()
5433    }
5434}
5435
5436#[cfg(target_os = "fuchsia")]
5437impl From<fidl::Channel> for DaiConnectorSynchronousProxy {
5438    fn from(value: fidl::Channel) -> Self {
5439        Self::new(value)
5440    }
5441}
5442
5443#[cfg(target_os = "fuchsia")]
5444impl fidl::endpoints::FromClient for DaiConnectorSynchronousProxy {
5445    type Protocol = DaiConnectorMarker;
5446
5447    fn from_client(value: fidl::endpoints::ClientEnd<DaiConnectorMarker>) -> Self {
5448        Self::new(value.into_channel())
5449    }
5450}
5451
5452#[derive(Debug, Clone)]
5453pub struct DaiConnectorProxy {
5454    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5455}
5456
5457impl fidl::endpoints::Proxy for DaiConnectorProxy {
5458    type Protocol = DaiConnectorMarker;
5459
5460    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5461        Self::new(inner)
5462    }
5463
5464    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5465        self.client.into_channel().map_err(|client| Self { client })
5466    }
5467
5468    fn as_channel(&self) -> &::fidl::AsyncChannel {
5469        self.client.as_channel()
5470    }
5471}
5472
5473impl DaiConnectorProxy {
5474    /// Create a new Proxy for fuchsia.hardware.audio/DaiConnector.
5475    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5476        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5477        Self { client: fidl::client::Client::new(channel, protocol_name) }
5478    }
5479
5480    /// Get a Stream of events from the remote end of the protocol.
5481    ///
5482    /// # Panics
5483    ///
5484    /// Panics if the event stream was already taken.
5485    pub fn take_event_stream(&self) -> DaiConnectorEventStream {
5486        DaiConnectorEventStream { event_receiver: self.client.take_event_receiver() }
5487    }
5488
5489    /// This connects to a DAI protocol server.
5490    pub fn r#connect(
5491        &self,
5492        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5493    ) -> Result<(), fidl::Error> {
5494        DaiConnectorProxyInterface::r#connect(self, dai_protocol)
5495    }
5496}
5497
5498impl DaiConnectorProxyInterface for DaiConnectorProxy {
5499    fn r#connect(
5500        &self,
5501        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5502    ) -> Result<(), fidl::Error> {
5503        self.client.send::<DaiConnectorConnectRequest>(
5504            (dai_protocol,),
5505            0x4e4db05c2eca1450,
5506            fidl::encoding::DynamicFlags::empty(),
5507        )
5508    }
5509}
5510
5511pub struct DaiConnectorEventStream {
5512    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5513}
5514
5515impl std::marker::Unpin for DaiConnectorEventStream {}
5516
5517impl futures::stream::FusedStream for DaiConnectorEventStream {
5518    fn is_terminated(&self) -> bool {
5519        self.event_receiver.is_terminated()
5520    }
5521}
5522
5523impl futures::Stream for DaiConnectorEventStream {
5524    type Item = Result<DaiConnectorEvent, fidl::Error>;
5525
5526    fn poll_next(
5527        mut self: std::pin::Pin<&mut Self>,
5528        cx: &mut std::task::Context<'_>,
5529    ) -> std::task::Poll<Option<Self::Item>> {
5530        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5531            &mut self.event_receiver,
5532            cx
5533        )?) {
5534            Some(buf) => std::task::Poll::Ready(Some(DaiConnectorEvent::decode(buf))),
5535            None => std::task::Poll::Ready(None),
5536        }
5537    }
5538}
5539
5540#[derive(Debug)]
5541pub enum DaiConnectorEvent {}
5542
5543impl DaiConnectorEvent {
5544    /// Decodes a message buffer as a [`DaiConnectorEvent`].
5545    fn decode(
5546        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5547    ) -> Result<DaiConnectorEvent, fidl::Error> {
5548        let (bytes, _handles) = buf.split_mut();
5549        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5550        debug_assert_eq!(tx_header.tx_id, 0);
5551        match tx_header.ordinal {
5552            _ => Err(fidl::Error::UnknownOrdinal {
5553                ordinal: tx_header.ordinal,
5554                protocol_name: <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5555            }),
5556        }
5557    }
5558}
5559
5560/// A Stream of incoming requests for fuchsia.hardware.audio/DaiConnector.
5561pub struct DaiConnectorRequestStream {
5562    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5563    is_terminated: bool,
5564}
5565
5566impl std::marker::Unpin for DaiConnectorRequestStream {}
5567
5568impl futures::stream::FusedStream for DaiConnectorRequestStream {
5569    fn is_terminated(&self) -> bool {
5570        self.is_terminated
5571    }
5572}
5573
5574impl fidl::endpoints::RequestStream for DaiConnectorRequestStream {
5575    type Protocol = DaiConnectorMarker;
5576    type ControlHandle = DaiConnectorControlHandle;
5577
5578    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5579        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5580    }
5581
5582    fn control_handle(&self) -> Self::ControlHandle {
5583        DaiConnectorControlHandle { inner: self.inner.clone() }
5584    }
5585
5586    fn into_inner(
5587        self,
5588    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5589    {
5590        (self.inner, self.is_terminated)
5591    }
5592
5593    fn from_inner(
5594        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5595        is_terminated: bool,
5596    ) -> Self {
5597        Self { inner, is_terminated }
5598    }
5599}
5600
5601impl futures::Stream for DaiConnectorRequestStream {
5602    type Item = Result<DaiConnectorRequest, fidl::Error>;
5603
5604    fn poll_next(
5605        mut self: std::pin::Pin<&mut Self>,
5606        cx: &mut std::task::Context<'_>,
5607    ) -> std::task::Poll<Option<Self::Item>> {
5608        let this = &mut *self;
5609        if this.inner.check_shutdown(cx) {
5610            this.is_terminated = true;
5611            return std::task::Poll::Ready(None);
5612        }
5613        if this.is_terminated {
5614            panic!("polled DaiConnectorRequestStream after completion");
5615        }
5616        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5617            |bytes, handles| {
5618                match this.inner.channel().read_etc(cx, bytes, handles) {
5619                    std::task::Poll::Ready(Ok(())) => {}
5620                    std::task::Poll::Pending => return std::task::Poll::Pending,
5621                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5622                        this.is_terminated = true;
5623                        return std::task::Poll::Ready(None);
5624                    }
5625                    std::task::Poll::Ready(Err(e)) => {
5626                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5627                            e.into(),
5628                        ))));
5629                    }
5630                }
5631
5632                // A message has been received from the channel
5633                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5634
5635                std::task::Poll::Ready(Some(match header.ordinal {
5636                    0x4e4db05c2eca1450 => {
5637                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5638                        let mut req = fidl::new_empty!(
5639                            DaiConnectorConnectRequest,
5640                            fidl::encoding::DefaultFuchsiaResourceDialect
5641                        );
5642                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5643                        let control_handle =
5644                            DaiConnectorControlHandle { inner: this.inner.clone() };
5645                        Ok(DaiConnectorRequest::Connect {
5646                            dai_protocol: req.dai_protocol,
5647
5648                            control_handle,
5649                        })
5650                    }
5651                    _ => Err(fidl::Error::UnknownOrdinal {
5652                        ordinal: header.ordinal,
5653                        protocol_name:
5654                            <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5655                    }),
5656                }))
5657            },
5658        )
5659    }
5660}
5661
5662/// For an overview of the DAI protocols see
5663/// [Digital Audio Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_dai.md)
5664/// # Deprecation
5665///
5666/// Not supported anymore, instead use an
5667/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5668/// with one DAI and one Ring Buffer, see
5669/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5670#[derive(Debug)]
5671pub enum DaiConnectorRequest {
5672    /// This connects to a DAI protocol server.
5673    Connect {
5674        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5675        control_handle: DaiConnectorControlHandle,
5676    },
5677}
5678
5679impl DaiConnectorRequest {
5680    #[allow(irrefutable_let_patterns)]
5681    pub fn into_connect(
5682        self,
5683    ) -> Option<(fidl::endpoints::ServerEnd<DaiMarker>, DaiConnectorControlHandle)> {
5684        if let DaiConnectorRequest::Connect { dai_protocol, control_handle } = self {
5685            Some((dai_protocol, control_handle))
5686        } else {
5687            None
5688        }
5689    }
5690
5691    /// Name of the method defined in FIDL
5692    pub fn method_name(&self) -> &'static str {
5693        match *self {
5694            DaiConnectorRequest::Connect { .. } => "connect",
5695        }
5696    }
5697}
5698
5699#[derive(Debug, Clone)]
5700pub struct DaiConnectorControlHandle {
5701    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5702}
5703
5704impl fidl::endpoints::ControlHandle for DaiConnectorControlHandle {
5705    fn shutdown(&self) {
5706        self.inner.shutdown()
5707    }
5708    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5709        self.inner.shutdown_with_epitaph(status)
5710    }
5711
5712    fn is_closed(&self) -> bool {
5713        self.inner.channel().is_closed()
5714    }
5715    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5716        self.inner.channel().on_closed()
5717    }
5718
5719    #[cfg(target_os = "fuchsia")]
5720    fn signal_peer(
5721        &self,
5722        clear_mask: zx::Signals,
5723        set_mask: zx::Signals,
5724    ) -> Result<(), zx_status::Status> {
5725        use fidl::Peered;
5726        self.inner.channel().signal_peer(clear_mask, set_mask)
5727    }
5728}
5729
5730impl DaiConnectorControlHandle {}
5731
5732#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5733pub struct HealthMarker;
5734
5735impl fidl::endpoints::ProtocolMarker for HealthMarker {
5736    type Proxy = HealthProxy;
5737    type RequestStream = HealthRequestStream;
5738    #[cfg(target_os = "fuchsia")]
5739    type SynchronousProxy = HealthSynchronousProxy;
5740
5741    const DEBUG_NAME: &'static str = "(anonymous) Health";
5742}
5743
5744pub trait HealthProxyInterface: Send + Sync {
5745    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
5746        + Send;
5747    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
5748}
5749#[derive(Debug)]
5750#[cfg(target_os = "fuchsia")]
5751pub struct HealthSynchronousProxy {
5752    client: fidl::client::sync::Client,
5753}
5754
5755#[cfg(target_os = "fuchsia")]
5756impl fidl::endpoints::SynchronousProxy for HealthSynchronousProxy {
5757    type Proxy = HealthProxy;
5758    type Protocol = HealthMarker;
5759
5760    fn from_channel(inner: fidl::Channel) -> Self {
5761        Self::new(inner)
5762    }
5763
5764    fn into_channel(self) -> fidl::Channel {
5765        self.client.into_channel()
5766    }
5767
5768    fn as_channel(&self) -> &fidl::Channel {
5769        self.client.as_channel()
5770    }
5771}
5772
5773#[cfg(target_os = "fuchsia")]
5774impl HealthSynchronousProxy {
5775    pub fn new(channel: fidl::Channel) -> Self {
5776        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5777        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5778    }
5779
5780    pub fn into_channel(self) -> fidl::Channel {
5781        self.client.into_channel()
5782    }
5783
5784    /// Waits until an event arrives and returns it. It is safe for other
5785    /// threads to make concurrent requests while waiting for an event.
5786    pub fn wait_for_event(
5787        &self,
5788        deadline: zx::MonotonicInstant,
5789    ) -> Result<HealthEvent, fidl::Error> {
5790        HealthEvent::decode(self.client.wait_for_event(deadline)?)
5791    }
5792
5793    /// Retrieves top level health state.
5794    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5795    pub fn r#get_health_state(
5796        &self,
5797        ___deadline: zx::MonotonicInstant,
5798    ) -> Result<HealthState, fidl::Error> {
5799        let _response =
5800            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
5801                (),
5802                0x4e146d6bca733a84,
5803                fidl::encoding::DynamicFlags::empty(),
5804                ___deadline,
5805            )?;
5806        Ok(_response.state)
5807    }
5808}
5809
5810#[cfg(target_os = "fuchsia")]
5811impl From<HealthSynchronousProxy> for zx::Handle {
5812    fn from(value: HealthSynchronousProxy) -> Self {
5813        value.into_channel().into()
5814    }
5815}
5816
5817#[cfg(target_os = "fuchsia")]
5818impl From<fidl::Channel> for HealthSynchronousProxy {
5819    fn from(value: fidl::Channel) -> Self {
5820        Self::new(value)
5821    }
5822}
5823
5824#[cfg(target_os = "fuchsia")]
5825impl fidl::endpoints::FromClient for HealthSynchronousProxy {
5826    type Protocol = HealthMarker;
5827
5828    fn from_client(value: fidl::endpoints::ClientEnd<HealthMarker>) -> Self {
5829        Self::new(value.into_channel())
5830    }
5831}
5832
5833#[derive(Debug, Clone)]
5834pub struct HealthProxy {
5835    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5836}
5837
5838impl fidl::endpoints::Proxy for HealthProxy {
5839    type Protocol = HealthMarker;
5840
5841    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5842        Self::new(inner)
5843    }
5844
5845    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5846        self.client.into_channel().map_err(|client| Self { client })
5847    }
5848
5849    fn as_channel(&self) -> &::fidl::AsyncChannel {
5850        self.client.as_channel()
5851    }
5852}
5853
5854impl HealthProxy {
5855    /// Create a new Proxy for fuchsia.hardware.audio/Health.
5856    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5857        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5858        Self { client: fidl::client::Client::new(channel, protocol_name) }
5859    }
5860
5861    /// Get a Stream of events from the remote end of the protocol.
5862    ///
5863    /// # Panics
5864    ///
5865    /// Panics if the event stream was already taken.
5866    pub fn take_event_stream(&self) -> HealthEventStream {
5867        HealthEventStream { event_receiver: self.client.take_event_receiver() }
5868    }
5869
5870    /// Retrieves top level health state.
5871    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5872    pub fn r#get_health_state(
5873        &self,
5874    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
5875    {
5876        HealthProxyInterface::r#get_health_state(self)
5877    }
5878}
5879
5880impl HealthProxyInterface for HealthProxy {
5881    type GetHealthStateResponseFut =
5882        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
5883    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
5884        fn _decode(
5885            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5886        ) -> Result<HealthState, fidl::Error> {
5887            let _response = fidl::client::decode_transaction_body::<
5888                HealthGetHealthStateResponse,
5889                fidl::encoding::DefaultFuchsiaResourceDialect,
5890                0x4e146d6bca733a84,
5891            >(_buf?)?;
5892            Ok(_response.state)
5893        }
5894        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
5895            (),
5896            0x4e146d6bca733a84,
5897            fidl::encoding::DynamicFlags::empty(),
5898            _decode,
5899        )
5900    }
5901}
5902
5903pub struct HealthEventStream {
5904    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5905}
5906
5907impl std::marker::Unpin for HealthEventStream {}
5908
5909impl futures::stream::FusedStream for HealthEventStream {
5910    fn is_terminated(&self) -> bool {
5911        self.event_receiver.is_terminated()
5912    }
5913}
5914
5915impl futures::Stream for HealthEventStream {
5916    type Item = Result<HealthEvent, fidl::Error>;
5917
5918    fn poll_next(
5919        mut self: std::pin::Pin<&mut Self>,
5920        cx: &mut std::task::Context<'_>,
5921    ) -> std::task::Poll<Option<Self::Item>> {
5922        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5923            &mut self.event_receiver,
5924            cx
5925        )?) {
5926            Some(buf) => std::task::Poll::Ready(Some(HealthEvent::decode(buf))),
5927            None => std::task::Poll::Ready(None),
5928        }
5929    }
5930}
5931
5932#[derive(Debug)]
5933pub enum HealthEvent {}
5934
5935impl HealthEvent {
5936    /// Decodes a message buffer as a [`HealthEvent`].
5937    fn decode(
5938        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5939    ) -> Result<HealthEvent, fidl::Error> {
5940        let (bytes, _handles) = buf.split_mut();
5941        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5942        debug_assert_eq!(tx_header.tx_id, 0);
5943        match tx_header.ordinal {
5944            _ => Err(fidl::Error::UnknownOrdinal {
5945                ordinal: tx_header.ordinal,
5946                protocol_name: <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5947            }),
5948        }
5949    }
5950}
5951
5952/// A Stream of incoming requests for fuchsia.hardware.audio/Health.
5953pub struct HealthRequestStream {
5954    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5955    is_terminated: bool,
5956}
5957
5958impl std::marker::Unpin for HealthRequestStream {}
5959
5960impl futures::stream::FusedStream for HealthRequestStream {
5961    fn is_terminated(&self) -> bool {
5962        self.is_terminated
5963    }
5964}
5965
5966impl fidl::endpoints::RequestStream for HealthRequestStream {
5967    type Protocol = HealthMarker;
5968    type ControlHandle = HealthControlHandle;
5969
5970    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5971        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5972    }
5973
5974    fn control_handle(&self) -> Self::ControlHandle {
5975        HealthControlHandle { inner: self.inner.clone() }
5976    }
5977
5978    fn into_inner(
5979        self,
5980    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5981    {
5982        (self.inner, self.is_terminated)
5983    }
5984
5985    fn from_inner(
5986        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5987        is_terminated: bool,
5988    ) -> Self {
5989        Self { inner, is_terminated }
5990    }
5991}
5992
5993impl futures::Stream for HealthRequestStream {
5994    type Item = Result<HealthRequest, fidl::Error>;
5995
5996    fn poll_next(
5997        mut self: std::pin::Pin<&mut Self>,
5998        cx: &mut std::task::Context<'_>,
5999    ) -> std::task::Poll<Option<Self::Item>> {
6000        let this = &mut *self;
6001        if this.inner.check_shutdown(cx) {
6002            this.is_terminated = true;
6003            return std::task::Poll::Ready(None);
6004        }
6005        if this.is_terminated {
6006            panic!("polled HealthRequestStream after completion");
6007        }
6008        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6009            |bytes, handles| {
6010                match this.inner.channel().read_etc(cx, bytes, handles) {
6011                    std::task::Poll::Ready(Ok(())) => {}
6012                    std::task::Poll::Pending => return std::task::Poll::Pending,
6013                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6014                        this.is_terminated = true;
6015                        return std::task::Poll::Ready(None);
6016                    }
6017                    std::task::Poll::Ready(Err(e)) => {
6018                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6019                            e.into(),
6020                        ))));
6021                    }
6022                }
6023
6024                // A message has been received from the channel
6025                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6026
6027                std::task::Poll::Ready(Some(match header.ordinal {
6028                    0x4e146d6bca733a84 => {
6029                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6030                        let mut req = fidl::new_empty!(
6031                            fidl::encoding::EmptyPayload,
6032                            fidl::encoding::DefaultFuchsiaResourceDialect
6033                        );
6034                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6035                        let control_handle = HealthControlHandle { inner: this.inner.clone() };
6036                        Ok(HealthRequest::GetHealthState {
6037                            responder: HealthGetHealthStateResponder {
6038                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6039                                tx_id: header.tx_id,
6040                            },
6041                        })
6042                    }
6043                    _ => Err(fidl::Error::UnknownOrdinal {
6044                        ordinal: header.ordinal,
6045                        protocol_name:
6046                            <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6047                    }),
6048                }))
6049            },
6050        )
6051    }
6052}
6053
6054#[derive(Debug)]
6055pub enum HealthRequest {
6056    /// Retrieves top level health state.
6057    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6058    GetHealthState { responder: HealthGetHealthStateResponder },
6059}
6060
6061impl HealthRequest {
6062    #[allow(irrefutable_let_patterns)]
6063    pub fn into_get_health_state(self) -> Option<(HealthGetHealthStateResponder)> {
6064        if let HealthRequest::GetHealthState { responder } = self {
6065            Some((responder))
6066        } else {
6067            None
6068        }
6069    }
6070
6071    /// Name of the method defined in FIDL
6072    pub fn method_name(&self) -> &'static str {
6073        match *self {
6074            HealthRequest::GetHealthState { .. } => "get_health_state",
6075        }
6076    }
6077}
6078
6079#[derive(Debug, Clone)]
6080pub struct HealthControlHandle {
6081    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6082}
6083
6084impl fidl::endpoints::ControlHandle for HealthControlHandle {
6085    fn shutdown(&self) {
6086        self.inner.shutdown()
6087    }
6088    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6089        self.inner.shutdown_with_epitaph(status)
6090    }
6091
6092    fn is_closed(&self) -> bool {
6093        self.inner.channel().is_closed()
6094    }
6095    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6096        self.inner.channel().on_closed()
6097    }
6098
6099    #[cfg(target_os = "fuchsia")]
6100    fn signal_peer(
6101        &self,
6102        clear_mask: zx::Signals,
6103        set_mask: zx::Signals,
6104    ) -> Result<(), zx_status::Status> {
6105        use fidl::Peered;
6106        self.inner.channel().signal_peer(clear_mask, set_mask)
6107    }
6108}
6109
6110impl HealthControlHandle {}
6111
6112#[must_use = "FIDL methods require a response to be sent"]
6113#[derive(Debug)]
6114pub struct HealthGetHealthStateResponder {
6115    control_handle: std::mem::ManuallyDrop<HealthControlHandle>,
6116    tx_id: u32,
6117}
6118
6119/// Set the the channel to be shutdown (see [`HealthControlHandle::shutdown`])
6120/// if the responder is dropped without sending a response, so that the client
6121/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6122impl std::ops::Drop for HealthGetHealthStateResponder {
6123    fn drop(&mut self) {
6124        self.control_handle.shutdown();
6125        // Safety: drops once, never accessed again
6126        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6127    }
6128}
6129
6130impl fidl::endpoints::Responder for HealthGetHealthStateResponder {
6131    type ControlHandle = HealthControlHandle;
6132
6133    fn control_handle(&self) -> &HealthControlHandle {
6134        &self.control_handle
6135    }
6136
6137    fn drop_without_shutdown(mut self) {
6138        // Safety: drops once, never accessed again due to mem::forget
6139        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6140        // Prevent Drop from running (which would shut down the channel)
6141        std::mem::forget(self);
6142    }
6143}
6144
6145impl HealthGetHealthStateResponder {
6146    /// Sends a response to the FIDL transaction.
6147    ///
6148    /// Sets the channel to shutdown if an error occurs.
6149    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6150        let _result = self.send_raw(state);
6151        if _result.is_err() {
6152            self.control_handle.shutdown();
6153        }
6154        self.drop_without_shutdown();
6155        _result
6156    }
6157
6158    /// Similar to "send" but does not shutdown the channel if an error occurs.
6159    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6160        let _result = self.send_raw(state);
6161        self.drop_without_shutdown();
6162        _result
6163    }
6164
6165    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
6166        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
6167            (state,),
6168            self.tx_id,
6169            0x4e146d6bca733a84,
6170            fidl::encoding::DynamicFlags::empty(),
6171        )
6172    }
6173}
6174
6175#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6176pub struct RingBufferMarker;
6177
6178impl fidl::endpoints::ProtocolMarker for RingBufferMarker {
6179    type Proxy = RingBufferProxy;
6180    type RequestStream = RingBufferRequestStream;
6181    #[cfg(target_os = "fuchsia")]
6182    type SynchronousProxy = RingBufferSynchronousProxy;
6183
6184    const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
6185}
6186pub type RingBufferGetVmoResult = Result<(u32, fidl::Vmo), GetVmoError>;
6187pub type RingBufferSetActiveChannelsResult = Result<i64, i32>;
6188
6189pub trait RingBufferProxyInterface: Send + Sync {
6190    type GetPropertiesResponseFut: std::future::Future<Output = Result<RingBufferProperties, fidl::Error>>
6191        + Send;
6192    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
6193    type WatchClockRecoveryPositionInfoResponseFut: std::future::Future<Output = Result<RingBufferPositionInfo, fidl::Error>>
6194        + Send;
6195    fn r#watch_clock_recovery_position_info(
6196        &self,
6197    ) -> Self::WatchClockRecoveryPositionInfoResponseFut;
6198    type GetVmoResponseFut: std::future::Future<Output = Result<RingBufferGetVmoResult, fidl::Error>>
6199        + Send;
6200    fn r#get_vmo(
6201        &self,
6202        min_frames: u32,
6203        clock_recovery_notifications_per_ring: u32,
6204    ) -> Self::GetVmoResponseFut;
6205    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
6206    fn r#start(&self) -> Self::StartResponseFut;
6207    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6208    fn r#stop(&self) -> Self::StopResponseFut;
6209    type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
6210        + Send;
6211    fn r#set_active_channels(
6212        &self,
6213        active_channels_bitmask: u64,
6214    ) -> Self::SetActiveChannelsResponseFut;
6215    type WatchDelayInfoResponseFut: std::future::Future<Output = Result<DelayInfo, fidl::Error>>
6216        + Send;
6217    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
6218}
6219#[derive(Debug)]
6220#[cfg(target_os = "fuchsia")]
6221pub struct RingBufferSynchronousProxy {
6222    client: fidl::client::sync::Client,
6223}
6224
6225#[cfg(target_os = "fuchsia")]
6226impl fidl::endpoints::SynchronousProxy for RingBufferSynchronousProxy {
6227    type Proxy = RingBufferProxy;
6228    type Protocol = RingBufferMarker;
6229
6230    fn from_channel(inner: fidl::Channel) -> Self {
6231        Self::new(inner)
6232    }
6233
6234    fn into_channel(self) -> fidl::Channel {
6235        self.client.into_channel()
6236    }
6237
6238    fn as_channel(&self) -> &fidl::Channel {
6239        self.client.as_channel()
6240    }
6241}
6242
6243#[cfg(target_os = "fuchsia")]
6244impl RingBufferSynchronousProxy {
6245    pub fn new(channel: fidl::Channel) -> Self {
6246        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6247        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6248    }
6249
6250    pub fn into_channel(self) -> fidl::Channel {
6251        self.client.into_channel()
6252    }
6253
6254    /// Waits until an event arrives and returns it. It is safe for other
6255    /// threads to make concurrent requests while waiting for an event.
6256    pub fn wait_for_event(
6257        &self,
6258        deadline: zx::MonotonicInstant,
6259    ) -> Result<RingBufferEvent, fidl::Error> {
6260        RingBufferEvent::decode(self.client.wait_for_event(deadline)?)
6261    }
6262
6263    /// Accessor for top level static properties.
6264    pub fn r#get_properties(
6265        &self,
6266        ___deadline: zx::MonotonicInstant,
6267    ) -> Result<RingBufferProperties, fidl::Error> {
6268        let _response = self
6269            .client
6270            .send_query::<fidl::encoding::EmptyPayload, RingBufferGetPropertiesResponse>(
6271                (),
6272                0x12947f061a8fe1,
6273                fidl::encoding::DynamicFlags::empty(),
6274                ___deadline,
6275            )?;
6276        Ok(_response.properties)
6277    }
6278
6279    /// Gets the ring buffer current position via a hanging get.
6280    ///
6281    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
6282    /// `clock_recovery_notifications_per_ring` was specified.
6283    ///
6284    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
6285    /// not respond to subsequent client calls until the position information has changed from what
6286    /// was most recently provided to that client.
6287    ///
6288    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
6289    /// to the `Start` command.
6290    ///
6291    /// At the `start_time` returned by `Start`, position is always 0. From there, it
6292    /// progresses at the rate specified by the rate, sample format (and clock domain,
6293    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
6294    ///
6295    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
6296    /// estimated position to be used for clock recovery at most at
6297    /// `clock_recovery_notifications_per_ring` frequency.
6298    ///
6299    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
6300    /// increasing.
6301    ///
6302    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
6303    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
6304    pub fn r#watch_clock_recovery_position_info(
6305        &self,
6306        ___deadline: zx::MonotonicInstant,
6307    ) -> Result<RingBufferPositionInfo, fidl::Error> {
6308        let _response = self.client.send_query::<
6309            fidl::encoding::EmptyPayload,
6310            RingBufferWatchClockRecoveryPositionInfoResponse,
6311        >(
6312            (),
6313            0x694d5b898a4167e5,
6314            fidl::encoding::DynamicFlags::empty(),
6315            ___deadline,
6316        )?;
6317        Ok(_response.position_info)
6318    }
6319
6320    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
6321    ///
6322    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
6323    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
6324    ///
6325    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
6326    /// that ring buffer contents can be transfered in and out, or else the call must be failed
6327    /// with GetVmoError.INVALID_ARGS.
6328    ///
6329    /// The driver may increase the ring buffer size beyond `min_frames` plus
6330    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
6331    /// alignment.
6332    ///
6333    /// Clients can treat the entire returned ring buffer as safe to access, except for the
6334    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
6335    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
6336    ///
6337    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6338    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
6339    /// handle must also include ZX_RIGHT_WRITE.
6340    ///
6341    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
6342    /// `WatchClockRecoveryPositionInfo` client requests at most at
6343    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
6344    /// for clock recovery.
6345    pub fn r#get_vmo(
6346        &self,
6347        mut min_frames: u32,
6348        mut clock_recovery_notifications_per_ring: u32,
6349        ___deadline: zx::MonotonicInstant,
6350    ) -> Result<RingBufferGetVmoResult, fidl::Error> {
6351        let _response = self.client.send_query::<
6352            RingBufferGetVmoRequest,
6353            fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
6354        >(
6355            (min_frames, clock_recovery_notifications_per_ring,),
6356            0x44c8f4f5680e853a,
6357            fidl::encoding::DynamicFlags::empty(),
6358            ___deadline,
6359        )?;
6360        Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
6361    }
6362
6363    /// Start the ring buffer.
6364    ///
6365    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
6366    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
6367    /// write from or to the ring buffer position 0, subject to the overall position and buffering
6368    /// behavior described in 'Ring buffer behavior' below.
6369    ///
6370    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6371    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
6372    /// a second time before the first call has completed, then the channel must be closed with an
6373    /// error `ZX_ERR_BAD_STATE` returned.
6374    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
6375    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
6376        let _response =
6377            self.client.send_query::<fidl::encoding::EmptyPayload, RingBufferStartResponse>(
6378                (),
6379                0x5dd780a769a8892d,
6380                fidl::encoding::DynamicFlags::empty(),
6381                ___deadline,
6382            )?;
6383        Ok(_response.start_time)
6384    }
6385
6386    /// Stop the ring buffer.
6387    ///
6388    /// Once this call's response is received, no further position notifications will be sent until
6389    /// `Start` is called again.
6390    ///
6391    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6392    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
6393        let _response =
6394            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
6395                (),
6396                0x49a73d9cf1d4e110,
6397                fidl::encoding::DynamicFlags::empty(),
6398                ___deadline,
6399            )?;
6400        Ok(_response)
6401    }
6402
6403    /// Sets which channels are active via a bitmask.
6404    ///
6405    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
6406    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
6407    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
6408    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
6409    /// turns on the hardware associated for all channels.
6410    ///
6411    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
6412    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
6413    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
6414    ///
6415    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
6416    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
6417    /// buffer's position advances (and position notifications sent as needed) regardless of the
6418    /// number of active channels, including if no channels are active. This means that the format
6419    /// in the ring buffer is not changed.
6420    ///
6421    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
6422    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
6423    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
6424    ///
6425    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
6426    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
6427    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
6428    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
6429    /// hardware configuration was completed. If the requested channel configuration is already
6430    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
6431    /// before the reply is sent. If called again with the same configuration, the reply must
6432    /// include the same `set_time` value as was previously returned.
6433    ///
6434    /// For input channels, it is not required that the driver zero-out inactive channels.
6435    ///
6436    /// If `SetActiveChannels` is called for a second time before the first call has completed,
6437    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6438    pub fn r#set_active_channels(
6439        &self,
6440        mut active_channels_bitmask: u64,
6441        ___deadline: zx::MonotonicInstant,
6442    ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
6443        let _response = self.client.send_query::<
6444            RingBufferSetActiveChannelsRequest,
6445            fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
6446        >(
6447            (active_channels_bitmask,),
6448            0x605464c1d384f309,
6449            fidl::encoding::DynamicFlags::empty(),
6450            ___deadline,
6451        )?;
6452        Ok(_response.map(|x| x.set_time))
6453    }
6454
6455    /// Get information about delays via a hanging get.
6456    ///
6457    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
6458    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
6459    /// changes from what was most recently reported.
6460    ///
6461    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
6462    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6463    pub fn r#watch_delay_info(
6464        &self,
6465        ___deadline: zx::MonotonicInstant,
6466    ) -> Result<DelayInfo, fidl::Error> {
6467        let _response = self.client.send_query::<
6468            fidl::encoding::EmptyPayload,
6469            fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
6470        >(
6471            (),
6472            0x6c1248db213fcf9f,
6473            fidl::encoding::DynamicFlags::FLEXIBLE,
6474            ___deadline,
6475        )?
6476        .into_result::<RingBufferMarker>("watch_delay_info")?;
6477        Ok(_response.delay_info)
6478    }
6479}
6480
6481#[cfg(target_os = "fuchsia")]
6482impl From<RingBufferSynchronousProxy> for zx::Handle {
6483    fn from(value: RingBufferSynchronousProxy) -> Self {
6484        value.into_channel().into()
6485    }
6486}
6487
6488#[cfg(target_os = "fuchsia")]
6489impl From<fidl::Channel> for RingBufferSynchronousProxy {
6490    fn from(value: fidl::Channel) -> Self {
6491        Self::new(value)
6492    }
6493}
6494
6495#[cfg(target_os = "fuchsia")]
6496impl fidl::endpoints::FromClient for RingBufferSynchronousProxy {
6497    type Protocol = RingBufferMarker;
6498
6499    fn from_client(value: fidl::endpoints::ClientEnd<RingBufferMarker>) -> Self {
6500        Self::new(value.into_channel())
6501    }
6502}
6503
6504#[derive(Debug, Clone)]
6505pub struct RingBufferProxy {
6506    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6507}
6508
6509impl fidl::endpoints::Proxy for RingBufferProxy {
6510    type Protocol = RingBufferMarker;
6511
6512    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6513        Self::new(inner)
6514    }
6515
6516    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6517        self.client.into_channel().map_err(|client| Self { client })
6518    }
6519
6520    fn as_channel(&self) -> &::fidl::AsyncChannel {
6521        self.client.as_channel()
6522    }
6523}
6524
6525impl RingBufferProxy {
6526    /// Create a new Proxy for fuchsia.hardware.audio/RingBuffer.
6527    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6528        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6529        Self { client: fidl::client::Client::new(channel, protocol_name) }
6530    }
6531
6532    /// Get a Stream of events from the remote end of the protocol.
6533    ///
6534    /// # Panics
6535    ///
6536    /// Panics if the event stream was already taken.
6537    pub fn take_event_stream(&self) -> RingBufferEventStream {
6538        RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
6539    }
6540
6541    /// Accessor for top level static properties.
6542    pub fn r#get_properties(
6543        &self,
6544    ) -> fidl::client::QueryResponseFut<
6545        RingBufferProperties,
6546        fidl::encoding::DefaultFuchsiaResourceDialect,
6547    > {
6548        RingBufferProxyInterface::r#get_properties(self)
6549    }
6550
6551    /// Gets the ring buffer current position via a hanging get.
6552    ///
6553    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
6554    /// `clock_recovery_notifications_per_ring` was specified.
6555    ///
6556    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
6557    /// not respond to subsequent client calls until the position information has changed from what
6558    /// was most recently provided to that client.
6559    ///
6560    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
6561    /// to the `Start` command.
6562    ///
6563    /// At the `start_time` returned by `Start`, position is always 0. From there, it
6564    /// progresses at the rate specified by the rate, sample format (and clock domain,
6565    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
6566    ///
6567    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
6568    /// estimated position to be used for clock recovery at most at
6569    /// `clock_recovery_notifications_per_ring` frequency.
6570    ///
6571    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
6572    /// increasing.
6573    ///
6574    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
6575    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
6576    pub fn r#watch_clock_recovery_position_info(
6577        &self,
6578    ) -> fidl::client::QueryResponseFut<
6579        RingBufferPositionInfo,
6580        fidl::encoding::DefaultFuchsiaResourceDialect,
6581    > {
6582        RingBufferProxyInterface::r#watch_clock_recovery_position_info(self)
6583    }
6584
6585    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
6586    ///
6587    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
6588    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
6589    ///
6590    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
6591    /// that ring buffer contents can be transfered in and out, or else the call must be failed
6592    /// with GetVmoError.INVALID_ARGS.
6593    ///
6594    /// The driver may increase the ring buffer size beyond `min_frames` plus
6595    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
6596    /// alignment.
6597    ///
6598    /// Clients can treat the entire returned ring buffer as safe to access, except for the
6599    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
6600    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
6601    ///
6602    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6603    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
6604    /// handle must also include ZX_RIGHT_WRITE.
6605    ///
6606    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
6607    /// `WatchClockRecoveryPositionInfo` client requests at most at
6608    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
6609    /// for clock recovery.
6610    pub fn r#get_vmo(
6611        &self,
6612        mut min_frames: u32,
6613        mut clock_recovery_notifications_per_ring: u32,
6614    ) -> fidl::client::QueryResponseFut<
6615        RingBufferGetVmoResult,
6616        fidl::encoding::DefaultFuchsiaResourceDialect,
6617    > {
6618        RingBufferProxyInterface::r#get_vmo(self, min_frames, clock_recovery_notifications_per_ring)
6619    }
6620
6621    /// Start the ring buffer.
6622    ///
6623    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
6624    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
6625    /// write from or to the ring buffer position 0, subject to the overall position and buffering
6626    /// behavior described in 'Ring buffer behavior' below.
6627    ///
6628    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6629    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
6630    /// a second time before the first call has completed, then the channel must be closed with an
6631    /// error `ZX_ERR_BAD_STATE` returned.
6632    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
6633    pub fn r#start(
6634        &self,
6635    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
6636        RingBufferProxyInterface::r#start(self)
6637    }
6638
6639    /// Stop the ring buffer.
6640    ///
6641    /// Once this call's response is received, no further position notifications will be sent until
6642    /// `Start` is called again.
6643    ///
6644    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6645    pub fn r#stop(
6646        &self,
6647    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6648        RingBufferProxyInterface::r#stop(self)
6649    }
6650
6651    /// Sets which channels are active via a bitmask.
6652    ///
6653    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
6654    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
6655    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
6656    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
6657    /// turns on the hardware associated for all channels.
6658    ///
6659    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
6660    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
6661    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
6662    ///
6663    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
6664    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
6665    /// buffer's position advances (and position notifications sent as needed) regardless of the
6666    /// number of active channels, including if no channels are active. This means that the format
6667    /// in the ring buffer is not changed.
6668    ///
6669    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
6670    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
6671    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
6672    ///
6673    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
6674    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
6675    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
6676    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
6677    /// hardware configuration was completed. If the requested channel configuration is already
6678    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
6679    /// before the reply is sent. If called again with the same configuration, the reply must
6680    /// include the same `set_time` value as was previously returned.
6681    ///
6682    /// For input channels, it is not required that the driver zero-out inactive channels.
6683    ///
6684    /// If `SetActiveChannels` is called for a second time before the first call has completed,
6685    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6686    pub fn r#set_active_channels(
6687        &self,
6688        mut active_channels_bitmask: u64,
6689    ) -> fidl::client::QueryResponseFut<
6690        RingBufferSetActiveChannelsResult,
6691        fidl::encoding::DefaultFuchsiaResourceDialect,
6692    > {
6693        RingBufferProxyInterface::r#set_active_channels(self, active_channels_bitmask)
6694    }
6695
6696    /// Get information about delays via a hanging get.
6697    ///
6698    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
6699    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
6700    /// changes from what was most recently reported.
6701    ///
6702    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
6703    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6704    pub fn r#watch_delay_info(
6705        &self,
6706    ) -> fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6707    {
6708        RingBufferProxyInterface::r#watch_delay_info(self)
6709    }
6710}
6711
6712impl RingBufferProxyInterface for RingBufferProxy {
6713    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
6714        RingBufferProperties,
6715        fidl::encoding::DefaultFuchsiaResourceDialect,
6716    >;
6717    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
6718        fn _decode(
6719            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6720        ) -> Result<RingBufferProperties, fidl::Error> {
6721            let _response = fidl::client::decode_transaction_body::<
6722                RingBufferGetPropertiesResponse,
6723                fidl::encoding::DefaultFuchsiaResourceDialect,
6724                0x12947f061a8fe1,
6725            >(_buf?)?;
6726            Ok(_response.properties)
6727        }
6728        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferProperties>(
6729            (),
6730            0x12947f061a8fe1,
6731            fidl::encoding::DynamicFlags::empty(),
6732            _decode,
6733        )
6734    }
6735
6736    type WatchClockRecoveryPositionInfoResponseFut = fidl::client::QueryResponseFut<
6737        RingBufferPositionInfo,
6738        fidl::encoding::DefaultFuchsiaResourceDialect,
6739    >;
6740    fn r#watch_clock_recovery_position_info(
6741        &self,
6742    ) -> Self::WatchClockRecoveryPositionInfoResponseFut {
6743        fn _decode(
6744            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6745        ) -> Result<RingBufferPositionInfo, fidl::Error> {
6746            let _response = fidl::client::decode_transaction_body::<
6747                RingBufferWatchClockRecoveryPositionInfoResponse,
6748                fidl::encoding::DefaultFuchsiaResourceDialect,
6749                0x694d5b898a4167e5,
6750            >(_buf?)?;
6751            Ok(_response.position_info)
6752        }
6753        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferPositionInfo>(
6754            (),
6755            0x694d5b898a4167e5,
6756            fidl::encoding::DynamicFlags::empty(),
6757            _decode,
6758        )
6759    }
6760
6761    type GetVmoResponseFut = fidl::client::QueryResponseFut<
6762        RingBufferGetVmoResult,
6763        fidl::encoding::DefaultFuchsiaResourceDialect,
6764    >;
6765    fn r#get_vmo(
6766        &self,
6767        mut min_frames: u32,
6768        mut clock_recovery_notifications_per_ring: u32,
6769    ) -> Self::GetVmoResponseFut {
6770        fn _decode(
6771            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6772        ) -> Result<RingBufferGetVmoResult, fidl::Error> {
6773            let _response = fidl::client::decode_transaction_body::<
6774                fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
6775                fidl::encoding::DefaultFuchsiaResourceDialect,
6776                0x44c8f4f5680e853a,
6777            >(_buf?)?;
6778            Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
6779        }
6780        self.client.send_query_and_decode::<RingBufferGetVmoRequest, RingBufferGetVmoResult>(
6781            (min_frames, clock_recovery_notifications_per_ring),
6782            0x44c8f4f5680e853a,
6783            fidl::encoding::DynamicFlags::empty(),
6784            _decode,
6785        )
6786    }
6787
6788    type StartResponseFut =
6789        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
6790    fn r#start(&self) -> Self::StartResponseFut {
6791        fn _decode(
6792            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6793        ) -> Result<i64, fidl::Error> {
6794            let _response = fidl::client::decode_transaction_body::<
6795                RingBufferStartResponse,
6796                fidl::encoding::DefaultFuchsiaResourceDialect,
6797                0x5dd780a769a8892d,
6798            >(_buf?)?;
6799            Ok(_response.start_time)
6800        }
6801        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
6802            (),
6803            0x5dd780a769a8892d,
6804            fidl::encoding::DynamicFlags::empty(),
6805            _decode,
6806        )
6807    }
6808
6809    type StopResponseFut =
6810        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6811    fn r#stop(&self) -> Self::StopResponseFut {
6812        fn _decode(
6813            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6814        ) -> Result<(), fidl::Error> {
6815            let _response = fidl::client::decode_transaction_body::<
6816                fidl::encoding::EmptyPayload,
6817                fidl::encoding::DefaultFuchsiaResourceDialect,
6818                0x49a73d9cf1d4e110,
6819            >(_buf?)?;
6820            Ok(_response)
6821        }
6822        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
6823            (),
6824            0x49a73d9cf1d4e110,
6825            fidl::encoding::DynamicFlags::empty(),
6826            _decode,
6827        )
6828    }
6829
6830    type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
6831        RingBufferSetActiveChannelsResult,
6832        fidl::encoding::DefaultFuchsiaResourceDialect,
6833    >;
6834    fn r#set_active_channels(
6835        &self,
6836        mut active_channels_bitmask: u64,
6837    ) -> Self::SetActiveChannelsResponseFut {
6838        fn _decode(
6839            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6840        ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
6841            let _response = fidl::client::decode_transaction_body::<
6842                fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
6843                fidl::encoding::DefaultFuchsiaResourceDialect,
6844                0x605464c1d384f309,
6845            >(_buf?)?;
6846            Ok(_response.map(|x| x.set_time))
6847        }
6848        self.client.send_query_and_decode::<
6849            RingBufferSetActiveChannelsRequest,
6850            RingBufferSetActiveChannelsResult,
6851        >(
6852            (active_channels_bitmask,),
6853            0x605464c1d384f309,
6854            fidl::encoding::DynamicFlags::empty(),
6855            _decode,
6856        )
6857    }
6858
6859    type WatchDelayInfoResponseFut =
6860        fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
6861    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
6862        fn _decode(
6863            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6864        ) -> Result<DelayInfo, fidl::Error> {
6865            let _response = fidl::client::decode_transaction_body::<
6866                fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
6867                fidl::encoding::DefaultFuchsiaResourceDialect,
6868                0x6c1248db213fcf9f,
6869            >(_buf?)?
6870            .into_result::<RingBufferMarker>("watch_delay_info")?;
6871            Ok(_response.delay_info)
6872        }
6873        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelayInfo>(
6874            (),
6875            0x6c1248db213fcf9f,
6876            fidl::encoding::DynamicFlags::FLEXIBLE,
6877            _decode,
6878        )
6879    }
6880}
6881
6882pub struct RingBufferEventStream {
6883    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6884}
6885
6886impl std::marker::Unpin for RingBufferEventStream {}
6887
6888impl futures::stream::FusedStream for RingBufferEventStream {
6889    fn is_terminated(&self) -> bool {
6890        self.event_receiver.is_terminated()
6891    }
6892}
6893
6894impl futures::Stream for RingBufferEventStream {
6895    type Item = Result<RingBufferEvent, fidl::Error>;
6896
6897    fn poll_next(
6898        mut self: std::pin::Pin<&mut Self>,
6899        cx: &mut std::task::Context<'_>,
6900    ) -> std::task::Poll<Option<Self::Item>> {
6901        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6902            &mut self.event_receiver,
6903            cx
6904        )?) {
6905            Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
6906            None => std::task::Poll::Ready(None),
6907        }
6908    }
6909}
6910
6911#[derive(Debug)]
6912pub enum RingBufferEvent {
6913    #[non_exhaustive]
6914    _UnknownEvent {
6915        /// Ordinal of the event that was sent.
6916        ordinal: u64,
6917    },
6918}
6919
6920impl RingBufferEvent {
6921    /// Decodes a message buffer as a [`RingBufferEvent`].
6922    fn decode(
6923        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6924    ) -> Result<RingBufferEvent, fidl::Error> {
6925        let (bytes, _handles) = buf.split_mut();
6926        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6927        debug_assert_eq!(tx_header.tx_id, 0);
6928        match tx_header.ordinal {
6929            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6930                Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6931            }
6932            _ => Err(fidl::Error::UnknownOrdinal {
6933                ordinal: tx_header.ordinal,
6934                protocol_name: <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6935            }),
6936        }
6937    }
6938}
6939
6940/// A Stream of incoming requests for fuchsia.hardware.audio/RingBuffer.
6941pub struct RingBufferRequestStream {
6942    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6943    is_terminated: bool,
6944}
6945
6946impl std::marker::Unpin for RingBufferRequestStream {}
6947
6948impl futures::stream::FusedStream for RingBufferRequestStream {
6949    fn is_terminated(&self) -> bool {
6950        self.is_terminated
6951    }
6952}
6953
6954impl fidl::endpoints::RequestStream for RingBufferRequestStream {
6955    type Protocol = RingBufferMarker;
6956    type ControlHandle = RingBufferControlHandle;
6957
6958    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6959        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6960    }
6961
6962    fn control_handle(&self) -> Self::ControlHandle {
6963        RingBufferControlHandle { inner: self.inner.clone() }
6964    }
6965
6966    fn into_inner(
6967        self,
6968    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6969    {
6970        (self.inner, self.is_terminated)
6971    }
6972
6973    fn from_inner(
6974        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6975        is_terminated: bool,
6976    ) -> Self {
6977        Self { inner, is_terminated }
6978    }
6979}
6980
6981impl futures::Stream for RingBufferRequestStream {
6982    type Item = Result<RingBufferRequest, fidl::Error>;
6983
6984    fn poll_next(
6985        mut self: std::pin::Pin<&mut Self>,
6986        cx: &mut std::task::Context<'_>,
6987    ) -> std::task::Poll<Option<Self::Item>> {
6988        let this = &mut *self;
6989        if this.inner.check_shutdown(cx) {
6990            this.is_terminated = true;
6991            return std::task::Poll::Ready(None);
6992        }
6993        if this.is_terminated {
6994            panic!("polled RingBufferRequestStream after completion");
6995        }
6996        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6997            |bytes, handles| {
6998                match this.inner.channel().read_etc(cx, bytes, handles) {
6999                    std::task::Poll::Ready(Ok(())) => {}
7000                    std::task::Poll::Pending => return std::task::Poll::Pending,
7001                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7002                        this.is_terminated = true;
7003                        return std::task::Poll::Ready(None);
7004                    }
7005                    std::task::Poll::Ready(Err(e)) => {
7006                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7007                            e.into(),
7008                        ))));
7009                    }
7010                }
7011
7012                // A message has been received from the channel
7013                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7014
7015                std::task::Poll::Ready(Some(match header.ordinal {
7016                    0x12947f061a8fe1 => {
7017                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7018                        let mut req = fidl::new_empty!(
7019                            fidl::encoding::EmptyPayload,
7020                            fidl::encoding::DefaultFuchsiaResourceDialect
7021                        );
7022                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7023                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7024                        Ok(RingBufferRequest::GetProperties {
7025                            responder: RingBufferGetPropertiesResponder {
7026                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7027                                tx_id: header.tx_id,
7028                            },
7029                        })
7030                    }
7031                    0x694d5b898a4167e5 => {
7032                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7033                        let mut req = fidl::new_empty!(
7034                            fidl::encoding::EmptyPayload,
7035                            fidl::encoding::DefaultFuchsiaResourceDialect
7036                        );
7037                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7038                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7039                        Ok(RingBufferRequest::WatchClockRecoveryPositionInfo {
7040                            responder: RingBufferWatchClockRecoveryPositionInfoResponder {
7041                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7042                                tx_id: header.tx_id,
7043                            },
7044                        })
7045                    }
7046                    0x44c8f4f5680e853a => {
7047                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7048                        let mut req = fidl::new_empty!(
7049                            RingBufferGetVmoRequest,
7050                            fidl::encoding::DefaultFuchsiaResourceDialect
7051                        );
7052                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
7053                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7054                        Ok(RingBufferRequest::GetVmo {
7055                            min_frames: req.min_frames,
7056                            clock_recovery_notifications_per_ring: req
7057                                .clock_recovery_notifications_per_ring,
7058
7059                            responder: RingBufferGetVmoResponder {
7060                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7061                                tx_id: header.tx_id,
7062                            },
7063                        })
7064                    }
7065                    0x5dd780a769a8892d => {
7066                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7067                        let mut req = fidl::new_empty!(
7068                            fidl::encoding::EmptyPayload,
7069                            fidl::encoding::DefaultFuchsiaResourceDialect
7070                        );
7071                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7072                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7073                        Ok(RingBufferRequest::Start {
7074                            responder: RingBufferStartResponder {
7075                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7076                                tx_id: header.tx_id,
7077                            },
7078                        })
7079                    }
7080                    0x49a73d9cf1d4e110 => {
7081                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7082                        let mut req = fidl::new_empty!(
7083                            fidl::encoding::EmptyPayload,
7084                            fidl::encoding::DefaultFuchsiaResourceDialect
7085                        );
7086                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7087                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7088                        Ok(RingBufferRequest::Stop {
7089                            responder: RingBufferStopResponder {
7090                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7091                                tx_id: header.tx_id,
7092                            },
7093                        })
7094                    }
7095                    0x605464c1d384f309 => {
7096                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7097                        let mut req = fidl::new_empty!(
7098                            RingBufferSetActiveChannelsRequest,
7099                            fidl::encoding::DefaultFuchsiaResourceDialect
7100                        );
7101                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
7102                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7103                        Ok(RingBufferRequest::SetActiveChannels {
7104                            active_channels_bitmask: req.active_channels_bitmask,
7105
7106                            responder: RingBufferSetActiveChannelsResponder {
7107                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7108                                tx_id: header.tx_id,
7109                            },
7110                        })
7111                    }
7112                    0x6c1248db213fcf9f => {
7113                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7114                        let mut req = fidl::new_empty!(
7115                            fidl::encoding::EmptyPayload,
7116                            fidl::encoding::DefaultFuchsiaResourceDialect
7117                        );
7118                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7119                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7120                        Ok(RingBufferRequest::WatchDelayInfo {
7121                            responder: RingBufferWatchDelayInfoResponder {
7122                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7123                                tx_id: header.tx_id,
7124                            },
7125                        })
7126                    }
7127                    _ if header.tx_id == 0
7128                        && header
7129                            .dynamic_flags()
7130                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7131                    {
7132                        Ok(RingBufferRequest::_UnknownMethod {
7133                            ordinal: header.ordinal,
7134                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
7135                            method_type: fidl::MethodType::OneWay,
7136                        })
7137                    }
7138                    _ if header
7139                        .dynamic_flags()
7140                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7141                    {
7142                        this.inner.send_framework_err(
7143                            fidl::encoding::FrameworkErr::UnknownMethod,
7144                            header.tx_id,
7145                            header.ordinal,
7146                            header.dynamic_flags(),
7147                            (bytes, handles),
7148                        )?;
7149                        Ok(RingBufferRequest::_UnknownMethod {
7150                            ordinal: header.ordinal,
7151                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
7152                            method_type: fidl::MethodType::TwoWay,
7153                        })
7154                    }
7155                    _ => Err(fidl::Error::UnknownOrdinal {
7156                        ordinal: header.ordinal,
7157                        protocol_name:
7158                            <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7159                    }),
7160                }))
7161            },
7162        )
7163    }
7164}
7165
7166/// Ring buffers are used to convey audio between parties (usually in different processes), allowing
7167/// concurrent, asynchronous data access without requiring locks. This pattern works because both
7168/// parties share an understanding of which buffer areas are safe to access, and how those areas
7169/// change over time.
7170///
7171/// For in-depth description of the responsibilities for both _producers_ and _consumers_,
7172/// before the ring buffer is started as well as while it is active, please see
7173/// [Ring Buffer Behavior](https://fuchsia.dev/fuchsia-src/development/audio/ring_buffer.md).
7174#[derive(Debug)]
7175pub enum RingBufferRequest {
7176    /// Accessor for top level static properties.
7177    GetProperties { responder: RingBufferGetPropertiesResponder },
7178    /// Gets the ring buffer current position via a hanging get.
7179    ///
7180    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
7181    /// `clock_recovery_notifications_per_ring` was specified.
7182    ///
7183    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
7184    /// not respond to subsequent client calls until the position information has changed from what
7185    /// was most recently provided to that client.
7186    ///
7187    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
7188    /// to the `Start` command.
7189    ///
7190    /// At the `start_time` returned by `Start`, position is always 0. From there, it
7191    /// progresses at the rate specified by the rate, sample format (and clock domain,
7192    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
7193    ///
7194    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
7195    /// estimated position to be used for clock recovery at most at
7196    /// `clock_recovery_notifications_per_ring` frequency.
7197    ///
7198    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
7199    /// increasing.
7200    ///
7201    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
7202    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
7203    WatchClockRecoveryPositionInfo { responder: RingBufferWatchClockRecoveryPositionInfoResponder },
7204    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
7205    ///
7206    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
7207    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
7208    ///
7209    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
7210    /// that ring buffer contents can be transfered in and out, or else the call must be failed
7211    /// with GetVmoError.INVALID_ARGS.
7212    ///
7213    /// The driver may increase the ring buffer size beyond `min_frames` plus
7214    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
7215    /// alignment.
7216    ///
7217    /// Clients can treat the entire returned ring buffer as safe to access, except for the
7218    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
7219    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
7220    ///
7221    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7222    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
7223    /// handle must also include ZX_RIGHT_WRITE.
7224    ///
7225    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
7226    /// `WatchClockRecoveryPositionInfo` client requests at most at
7227    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
7228    /// for clock recovery.
7229    GetVmo {
7230        min_frames: u32,
7231        clock_recovery_notifications_per_ring: u32,
7232        responder: RingBufferGetVmoResponder,
7233    },
7234    /// Start the ring buffer.
7235    ///
7236    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
7237    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
7238    /// write from or to the ring buffer position 0, subject to the overall position and buffering
7239    /// behavior described in 'Ring buffer behavior' below.
7240    ///
7241    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
7242    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
7243    /// a second time before the first call has completed, then the channel must be closed with an
7244    /// error `ZX_ERR_BAD_STATE` returned.
7245    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
7246    Start { responder: RingBufferStartResponder },
7247    /// Stop the ring buffer.
7248    ///
7249    /// Once this call's response is received, no further position notifications will be sent until
7250    /// `Start` is called again.
7251    ///
7252    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
7253    Stop { responder: RingBufferStopResponder },
7254    /// Sets which channels are active via a bitmask.
7255    ///
7256    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
7257    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
7258    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
7259    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
7260    /// turns on the hardware associated for all channels.
7261    ///
7262    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
7263    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
7264    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
7265    ///
7266    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
7267    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
7268    /// buffer's position advances (and position notifications sent as needed) regardless of the
7269    /// number of active channels, including if no channels are active. This means that the format
7270    /// in the ring buffer is not changed.
7271    ///
7272    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
7273    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
7274    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
7275    ///
7276    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
7277    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
7278    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
7279    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
7280    /// hardware configuration was completed. If the requested channel configuration is already
7281    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
7282    /// before the reply is sent. If called again with the same configuration, the reply must
7283    /// include the same `set_time` value as was previously returned.
7284    ///
7285    /// For input channels, it is not required that the driver zero-out inactive channels.
7286    ///
7287    /// If `SetActiveChannels` is called for a second time before the first call has completed,
7288    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
7289    SetActiveChannels {
7290        active_channels_bitmask: u64,
7291        responder: RingBufferSetActiveChannelsResponder,
7292    },
7293    /// Get information about delays via a hanging get.
7294    ///
7295    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
7296    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
7297    /// changes from what was most recently reported.
7298    ///
7299    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
7300    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
7301    WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
7302    /// An interaction was received which does not match any known method.
7303    #[non_exhaustive]
7304    _UnknownMethod {
7305        /// Ordinal of the method that was called.
7306        ordinal: u64,
7307        control_handle: RingBufferControlHandle,
7308        method_type: fidl::MethodType,
7309    },
7310}
7311
7312impl RingBufferRequest {
7313    #[allow(irrefutable_let_patterns)]
7314    pub fn into_get_properties(self) -> Option<(RingBufferGetPropertiesResponder)> {
7315        if let RingBufferRequest::GetProperties { responder } = self {
7316            Some((responder))
7317        } else {
7318            None
7319        }
7320    }
7321
7322    #[allow(irrefutable_let_patterns)]
7323    pub fn into_watch_clock_recovery_position_info(
7324        self,
7325    ) -> Option<(RingBufferWatchClockRecoveryPositionInfoResponder)> {
7326        if let RingBufferRequest::WatchClockRecoveryPositionInfo { responder } = self {
7327            Some((responder))
7328        } else {
7329            None
7330        }
7331    }
7332
7333    #[allow(irrefutable_let_patterns)]
7334    pub fn into_get_vmo(self) -> Option<(u32, u32, RingBufferGetVmoResponder)> {
7335        if let RingBufferRequest::GetVmo {
7336            min_frames,
7337            clock_recovery_notifications_per_ring,
7338            responder,
7339        } = self
7340        {
7341            Some((min_frames, clock_recovery_notifications_per_ring, responder))
7342        } else {
7343            None
7344        }
7345    }
7346
7347    #[allow(irrefutable_let_patterns)]
7348    pub fn into_start(self) -> Option<(RingBufferStartResponder)> {
7349        if let RingBufferRequest::Start { responder } = self { Some((responder)) } else { None }
7350    }
7351
7352    #[allow(irrefutable_let_patterns)]
7353    pub fn into_stop(self) -> Option<(RingBufferStopResponder)> {
7354        if let RingBufferRequest::Stop { responder } = self { Some((responder)) } else { None }
7355    }
7356
7357    #[allow(irrefutable_let_patterns)]
7358    pub fn into_set_active_channels(self) -> Option<(u64, RingBufferSetActiveChannelsResponder)> {
7359        if let RingBufferRequest::SetActiveChannels { active_channels_bitmask, responder } = self {
7360            Some((active_channels_bitmask, responder))
7361        } else {
7362            None
7363        }
7364    }
7365
7366    #[allow(irrefutable_let_patterns)]
7367    pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
7368        if let RingBufferRequest::WatchDelayInfo { responder } = self {
7369            Some((responder))
7370        } else {
7371            None
7372        }
7373    }
7374
7375    /// Name of the method defined in FIDL
7376    pub fn method_name(&self) -> &'static str {
7377        match *self {
7378            RingBufferRequest::GetProperties { .. } => "get_properties",
7379            RingBufferRequest::WatchClockRecoveryPositionInfo { .. } => {
7380                "watch_clock_recovery_position_info"
7381            }
7382            RingBufferRequest::GetVmo { .. } => "get_vmo",
7383            RingBufferRequest::Start { .. } => "start",
7384            RingBufferRequest::Stop { .. } => "stop",
7385            RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
7386            RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
7387            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
7388                "unknown one-way method"
7389            }
7390            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
7391                "unknown two-way method"
7392            }
7393        }
7394    }
7395}
7396
7397#[derive(Debug, Clone)]
7398pub struct RingBufferControlHandle {
7399    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7400}
7401
7402impl fidl::endpoints::ControlHandle for RingBufferControlHandle {
7403    fn shutdown(&self) {
7404        self.inner.shutdown()
7405    }
7406    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7407        self.inner.shutdown_with_epitaph(status)
7408    }
7409
7410    fn is_closed(&self) -> bool {
7411        self.inner.channel().is_closed()
7412    }
7413    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7414        self.inner.channel().on_closed()
7415    }
7416
7417    #[cfg(target_os = "fuchsia")]
7418    fn signal_peer(
7419        &self,
7420        clear_mask: zx::Signals,
7421        set_mask: zx::Signals,
7422    ) -> Result<(), zx_status::Status> {
7423        use fidl::Peered;
7424        self.inner.channel().signal_peer(clear_mask, set_mask)
7425    }
7426}
7427
7428impl RingBufferControlHandle {}
7429
7430#[must_use = "FIDL methods require a response to be sent"]
7431#[derive(Debug)]
7432pub struct RingBufferGetPropertiesResponder {
7433    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7434    tx_id: u32,
7435}
7436
7437/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7438/// if the responder is dropped without sending a response, so that the client
7439/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7440impl std::ops::Drop for RingBufferGetPropertiesResponder {
7441    fn drop(&mut self) {
7442        self.control_handle.shutdown();
7443        // Safety: drops once, never accessed again
7444        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7445    }
7446}
7447
7448impl fidl::endpoints::Responder for RingBufferGetPropertiesResponder {
7449    type ControlHandle = RingBufferControlHandle;
7450
7451    fn control_handle(&self) -> &RingBufferControlHandle {
7452        &self.control_handle
7453    }
7454
7455    fn drop_without_shutdown(mut self) {
7456        // Safety: drops once, never accessed again due to mem::forget
7457        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7458        // Prevent Drop from running (which would shut down the channel)
7459        std::mem::forget(self);
7460    }
7461}
7462
7463impl RingBufferGetPropertiesResponder {
7464    /// Sends a response to the FIDL transaction.
7465    ///
7466    /// Sets the channel to shutdown if an error occurs.
7467    pub fn send(self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
7468        let _result = self.send_raw(properties);
7469        if _result.is_err() {
7470            self.control_handle.shutdown();
7471        }
7472        self.drop_without_shutdown();
7473        _result
7474    }
7475
7476    /// Similar to "send" but does not shutdown the channel if an error occurs.
7477    pub fn send_no_shutdown_on_err(
7478        self,
7479        mut properties: &RingBufferProperties,
7480    ) -> Result<(), fidl::Error> {
7481        let _result = self.send_raw(properties);
7482        self.drop_without_shutdown();
7483        _result
7484    }
7485
7486    fn send_raw(&self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
7487        self.control_handle.inner.send::<RingBufferGetPropertiesResponse>(
7488            (properties,),
7489            self.tx_id,
7490            0x12947f061a8fe1,
7491            fidl::encoding::DynamicFlags::empty(),
7492        )
7493    }
7494}
7495
7496#[must_use = "FIDL methods require a response to be sent"]
7497#[derive(Debug)]
7498pub struct RingBufferWatchClockRecoveryPositionInfoResponder {
7499    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7500    tx_id: u32,
7501}
7502
7503/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7504/// if the responder is dropped without sending a response, so that the client
7505/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7506impl std::ops::Drop for RingBufferWatchClockRecoveryPositionInfoResponder {
7507    fn drop(&mut self) {
7508        self.control_handle.shutdown();
7509        // Safety: drops once, never accessed again
7510        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7511    }
7512}
7513
7514impl fidl::endpoints::Responder for RingBufferWatchClockRecoveryPositionInfoResponder {
7515    type ControlHandle = RingBufferControlHandle;
7516
7517    fn control_handle(&self) -> &RingBufferControlHandle {
7518        &self.control_handle
7519    }
7520
7521    fn drop_without_shutdown(mut self) {
7522        // Safety: drops once, never accessed again due to mem::forget
7523        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7524        // Prevent Drop from running (which would shut down the channel)
7525        std::mem::forget(self);
7526    }
7527}
7528
7529impl RingBufferWatchClockRecoveryPositionInfoResponder {
7530    /// Sends a response to the FIDL transaction.
7531    ///
7532    /// Sets the channel to shutdown if an error occurs.
7533    pub fn send(self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
7534        let _result = self.send_raw(position_info);
7535        if _result.is_err() {
7536            self.control_handle.shutdown();
7537        }
7538        self.drop_without_shutdown();
7539        _result
7540    }
7541
7542    /// Similar to "send" but does not shutdown the channel if an error occurs.
7543    pub fn send_no_shutdown_on_err(
7544        self,
7545        mut position_info: &RingBufferPositionInfo,
7546    ) -> Result<(), fidl::Error> {
7547        let _result = self.send_raw(position_info);
7548        self.drop_without_shutdown();
7549        _result
7550    }
7551
7552    fn send_raw(&self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
7553        self.control_handle.inner.send::<RingBufferWatchClockRecoveryPositionInfoResponse>(
7554            (position_info,),
7555            self.tx_id,
7556            0x694d5b898a4167e5,
7557            fidl::encoding::DynamicFlags::empty(),
7558        )
7559    }
7560}
7561
7562#[must_use = "FIDL methods require a response to be sent"]
7563#[derive(Debug)]
7564pub struct RingBufferGetVmoResponder {
7565    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7566    tx_id: u32,
7567}
7568
7569/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7570/// if the responder is dropped without sending a response, so that the client
7571/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7572impl std::ops::Drop for RingBufferGetVmoResponder {
7573    fn drop(&mut self) {
7574        self.control_handle.shutdown();
7575        // Safety: drops once, never accessed again
7576        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7577    }
7578}
7579
7580impl fidl::endpoints::Responder for RingBufferGetVmoResponder {
7581    type ControlHandle = RingBufferControlHandle;
7582
7583    fn control_handle(&self) -> &RingBufferControlHandle {
7584        &self.control_handle
7585    }
7586
7587    fn drop_without_shutdown(mut self) {
7588        // Safety: drops once, never accessed again due to mem::forget
7589        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7590        // Prevent Drop from running (which would shut down the channel)
7591        std::mem::forget(self);
7592    }
7593}
7594
7595impl RingBufferGetVmoResponder {
7596    /// Sends a response to the FIDL transaction.
7597    ///
7598    /// Sets the channel to shutdown if an error occurs.
7599    pub fn send(
7600        self,
7601        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7602    ) -> Result<(), fidl::Error> {
7603        let _result = self.send_raw(result);
7604        if _result.is_err() {
7605            self.control_handle.shutdown();
7606        }
7607        self.drop_without_shutdown();
7608        _result
7609    }
7610
7611    /// Similar to "send" but does not shutdown the channel if an error occurs.
7612    pub fn send_no_shutdown_on_err(
7613        self,
7614        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7615    ) -> Result<(), fidl::Error> {
7616        let _result = self.send_raw(result);
7617        self.drop_without_shutdown();
7618        _result
7619    }
7620
7621    fn send_raw(
7622        &self,
7623        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7624    ) -> Result<(), fidl::Error> {
7625        self.control_handle
7626            .inner
7627            .send::<fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>>(
7628                result,
7629                self.tx_id,
7630                0x44c8f4f5680e853a,
7631                fidl::encoding::DynamicFlags::empty(),
7632            )
7633    }
7634}
7635
7636#[must_use = "FIDL methods require a response to be sent"]
7637#[derive(Debug)]
7638pub struct RingBufferStartResponder {
7639    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7640    tx_id: u32,
7641}
7642
7643/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7644/// if the responder is dropped without sending a response, so that the client
7645/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7646impl std::ops::Drop for RingBufferStartResponder {
7647    fn drop(&mut self) {
7648        self.control_handle.shutdown();
7649        // Safety: drops once, never accessed again
7650        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7651    }
7652}
7653
7654impl fidl::endpoints::Responder for RingBufferStartResponder {
7655    type ControlHandle = RingBufferControlHandle;
7656
7657    fn control_handle(&self) -> &RingBufferControlHandle {
7658        &self.control_handle
7659    }
7660
7661    fn drop_without_shutdown(mut self) {
7662        // Safety: drops once, never accessed again due to mem::forget
7663        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7664        // Prevent Drop from running (which would shut down the channel)
7665        std::mem::forget(self);
7666    }
7667}
7668
7669impl RingBufferStartResponder {
7670    /// Sends a response to the FIDL transaction.
7671    ///
7672    /// Sets the channel to shutdown if an error occurs.
7673    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
7674        let _result = self.send_raw(start_time);
7675        if _result.is_err() {
7676            self.control_handle.shutdown();
7677        }
7678        self.drop_without_shutdown();
7679        _result
7680    }
7681
7682    /// Similar to "send" but does not shutdown the channel if an error occurs.
7683    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
7684        let _result = self.send_raw(start_time);
7685        self.drop_without_shutdown();
7686        _result
7687    }
7688
7689    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
7690        self.control_handle.inner.send::<RingBufferStartResponse>(
7691            (start_time,),
7692            self.tx_id,
7693            0x5dd780a769a8892d,
7694            fidl::encoding::DynamicFlags::empty(),
7695        )
7696    }
7697}
7698
7699#[must_use = "FIDL methods require a response to be sent"]
7700#[derive(Debug)]
7701pub struct RingBufferStopResponder {
7702    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7703    tx_id: u32,
7704}
7705
7706/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7707/// if the responder is dropped without sending a response, so that the client
7708/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7709impl std::ops::Drop for RingBufferStopResponder {
7710    fn drop(&mut self) {
7711        self.control_handle.shutdown();
7712        // Safety: drops once, never accessed again
7713        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7714    }
7715}
7716
7717impl fidl::endpoints::Responder for RingBufferStopResponder {
7718    type ControlHandle = RingBufferControlHandle;
7719
7720    fn control_handle(&self) -> &RingBufferControlHandle {
7721        &self.control_handle
7722    }
7723
7724    fn drop_without_shutdown(mut self) {
7725        // Safety: drops once, never accessed again due to mem::forget
7726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7727        // Prevent Drop from running (which would shut down the channel)
7728        std::mem::forget(self);
7729    }
7730}
7731
7732impl RingBufferStopResponder {
7733    /// Sends a response to the FIDL transaction.
7734    ///
7735    /// Sets the channel to shutdown if an error occurs.
7736    pub fn send(self) -> Result<(), fidl::Error> {
7737        let _result = self.send_raw();
7738        if _result.is_err() {
7739            self.control_handle.shutdown();
7740        }
7741        self.drop_without_shutdown();
7742        _result
7743    }
7744
7745    /// Similar to "send" but does not shutdown the channel if an error occurs.
7746    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7747        let _result = self.send_raw();
7748        self.drop_without_shutdown();
7749        _result
7750    }
7751
7752    fn send_raw(&self) -> Result<(), fidl::Error> {
7753        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7754            (),
7755            self.tx_id,
7756            0x49a73d9cf1d4e110,
7757            fidl::encoding::DynamicFlags::empty(),
7758        )
7759    }
7760}
7761
7762#[must_use = "FIDL methods require a response to be sent"]
7763#[derive(Debug)]
7764pub struct RingBufferSetActiveChannelsResponder {
7765    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7766    tx_id: u32,
7767}
7768
7769/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7770/// if the responder is dropped without sending a response, so that the client
7771/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7772impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
7773    fn drop(&mut self) {
7774        self.control_handle.shutdown();
7775        // Safety: drops once, never accessed again
7776        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7777    }
7778}
7779
7780impl fidl::endpoints::Responder for RingBufferSetActiveChannelsResponder {
7781    type ControlHandle = RingBufferControlHandle;
7782
7783    fn control_handle(&self) -> &RingBufferControlHandle {
7784        &self.control_handle
7785    }
7786
7787    fn drop_without_shutdown(mut self) {
7788        // Safety: drops once, never accessed again due to mem::forget
7789        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7790        // Prevent Drop from running (which would shut down the channel)
7791        std::mem::forget(self);
7792    }
7793}
7794
7795impl RingBufferSetActiveChannelsResponder {
7796    /// Sends a response to the FIDL transaction.
7797    ///
7798    /// Sets the channel to shutdown if an error occurs.
7799    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
7800        let _result = self.send_raw(result);
7801        if _result.is_err() {
7802            self.control_handle.shutdown();
7803        }
7804        self.drop_without_shutdown();
7805        _result
7806    }
7807
7808    /// Similar to "send" but does not shutdown the channel if an error occurs.
7809    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
7810        let _result = self.send_raw(result);
7811        self.drop_without_shutdown();
7812        _result
7813    }
7814
7815    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
7816        self.control_handle.inner.send::<fidl::encoding::ResultType<
7817            RingBufferSetActiveChannelsResponse,
7818            i32,
7819        >>(
7820            result.map(|set_time| (set_time,)),
7821            self.tx_id,
7822            0x605464c1d384f309,
7823            fidl::encoding::DynamicFlags::empty(),
7824        )
7825    }
7826}
7827
7828#[must_use = "FIDL methods require a response to be sent"]
7829#[derive(Debug)]
7830pub struct RingBufferWatchDelayInfoResponder {
7831    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7832    tx_id: u32,
7833}
7834
7835/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7836/// if the responder is dropped without sending a response, so that the client
7837/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7838impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
7839    fn drop(&mut self) {
7840        self.control_handle.shutdown();
7841        // Safety: drops once, never accessed again
7842        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7843    }
7844}
7845
7846impl fidl::endpoints::Responder for RingBufferWatchDelayInfoResponder {
7847    type ControlHandle = RingBufferControlHandle;
7848
7849    fn control_handle(&self) -> &RingBufferControlHandle {
7850        &self.control_handle
7851    }
7852
7853    fn drop_without_shutdown(mut self) {
7854        // Safety: drops once, never accessed again due to mem::forget
7855        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7856        // Prevent Drop from running (which would shut down the channel)
7857        std::mem::forget(self);
7858    }
7859}
7860
7861impl RingBufferWatchDelayInfoResponder {
7862    /// Sends a response to the FIDL transaction.
7863    ///
7864    /// Sets the channel to shutdown if an error occurs.
7865    pub fn send(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
7866        let _result = self.send_raw(delay_info);
7867        if _result.is_err() {
7868            self.control_handle.shutdown();
7869        }
7870        self.drop_without_shutdown();
7871        _result
7872    }
7873
7874    /// Similar to "send" but does not shutdown the channel if an error occurs.
7875    pub fn send_no_shutdown_on_err(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
7876        let _result = self.send_raw(delay_info);
7877        self.drop_without_shutdown();
7878        _result
7879    }
7880
7881    fn send_raw(&self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
7882        self.control_handle
7883            .inner
7884            .send::<fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>>(
7885                fidl::encoding::Flexible::new((delay_info,)),
7886                self.tx_id,
7887                0x6c1248db213fcf9f,
7888                fidl::encoding::DynamicFlags::FLEXIBLE,
7889            )
7890    }
7891}
7892
7893#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7894pub struct StreamConfigMarker;
7895
7896impl fidl::endpoints::ProtocolMarker for StreamConfigMarker {
7897    type Proxy = StreamConfigProxy;
7898    type RequestStream = StreamConfigRequestStream;
7899    #[cfg(target_os = "fuchsia")]
7900    type SynchronousProxy = StreamConfigSynchronousProxy;
7901
7902    const DEBUG_NAME: &'static str = "(anonymous) StreamConfig";
7903}
7904
7905pub trait StreamConfigProxyInterface: Send + Sync {
7906    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
7907        + Send;
7908    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
7909    fn r#signal_processing_connect(
7910        &self,
7911        protocol: fidl::endpoints::ServerEnd<
7912            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
7913        >,
7914    ) -> Result<(), fidl::Error>;
7915    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
7916        + Send;
7917    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
7918    type GetSupportedFormatsResponseFut: std::future::Future<Output = Result<Vec<SupportedFormats>, fidl::Error>>
7919        + Send;
7920    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut;
7921    fn r#create_ring_buffer(
7922        &self,
7923        format: &Format,
7924        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
7925    ) -> Result<(), fidl::Error>;
7926    type WatchGainStateResponseFut: std::future::Future<Output = Result<GainState, fidl::Error>>
7927        + Send;
7928    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut;
7929    fn r#set_gain(&self, target_state: &GainState) -> Result<(), fidl::Error>;
7930    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
7931        + Send;
7932    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
7933}
7934#[derive(Debug)]
7935#[cfg(target_os = "fuchsia")]
7936pub struct StreamConfigSynchronousProxy {
7937    client: fidl::client::sync::Client,
7938}
7939
7940#[cfg(target_os = "fuchsia")]
7941impl fidl::endpoints::SynchronousProxy for StreamConfigSynchronousProxy {
7942    type Proxy = StreamConfigProxy;
7943    type Protocol = StreamConfigMarker;
7944
7945    fn from_channel(inner: fidl::Channel) -> Self {
7946        Self::new(inner)
7947    }
7948
7949    fn into_channel(self) -> fidl::Channel {
7950        self.client.into_channel()
7951    }
7952
7953    fn as_channel(&self) -> &fidl::Channel {
7954        self.client.as_channel()
7955    }
7956}
7957
7958#[cfg(target_os = "fuchsia")]
7959impl StreamConfigSynchronousProxy {
7960    pub fn new(channel: fidl::Channel) -> Self {
7961        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7962        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7963    }
7964
7965    pub fn into_channel(self) -> fidl::Channel {
7966        self.client.into_channel()
7967    }
7968
7969    /// Waits until an event arrives and returns it. It is safe for other
7970    /// threads to make concurrent requests while waiting for an event.
7971    pub fn wait_for_event(
7972        &self,
7973        deadline: zx::MonotonicInstant,
7974    ) -> Result<StreamConfigEvent, fidl::Error> {
7975        StreamConfigEvent::decode(self.client.wait_for_event(deadline)?)
7976    }
7977
7978    /// Retrieves top level health state.
7979    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
7980    pub fn r#get_health_state(
7981        &self,
7982        ___deadline: zx::MonotonicInstant,
7983    ) -> Result<HealthState, fidl::Error> {
7984        let _response =
7985            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
7986                (),
7987                0x4e146d6bca733a84,
7988                fidl::encoding::DynamicFlags::empty(),
7989                ___deadline,
7990            )?;
7991        Ok(_response.state)
7992    }
7993
7994    /// Connect to a `SignalProcessing` protocol.
7995    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
7996    /// the maximum number of connections have already been created, for instance one, then the
7997    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
7998    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
7999    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
8000    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
8001    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
8002    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
8003    /// is intended to be composed, and hence the more verbose name allows differentiation and
8004    /// improved clarity.
8005    pub fn r#signal_processing_connect(
8006        &self,
8007        mut protocol: fidl::endpoints::ServerEnd<
8008            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8009        >,
8010    ) -> Result<(), fidl::Error> {
8011        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
8012            (protocol,),
8013            0xa81907ce6066295,
8014            fidl::encoding::DynamicFlags::empty(),
8015        )
8016    }
8017
8018    /// Retrieves top level static properties.
8019    pub fn r#get_properties(
8020        &self,
8021        ___deadline: zx::MonotonicInstant,
8022    ) -> Result<StreamProperties, fidl::Error> {
8023        let _response = self
8024            .client
8025            .send_query::<fidl::encoding::EmptyPayload, StreamConfigGetPropertiesResponse>(
8026                (),
8027                0x7d89c02f3e2d3c01,
8028                fidl::encoding::DynamicFlags::empty(),
8029                ___deadline,
8030            )?;
8031        Ok(_response.properties)
8032    }
8033
8034    /// Gets formats supported by a given driver. When not all combinations supported by the
8035    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8036    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8037    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8038    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8039    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8040    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8041    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8042    /// <<16bits,32bits>,<48KHz,96KHz>>.
8043    pub fn r#get_supported_formats(
8044        &self,
8045        ___deadline: zx::MonotonicInstant,
8046    ) -> Result<Vec<SupportedFormats>, fidl::Error> {
8047        let _response = self
8048            .client
8049            .send_query::<fidl::encoding::EmptyPayload, StreamConfigGetSupportedFormatsResponse>(
8050                (),
8051                0x448efa7850cafe7e,
8052                fidl::encoding::DynamicFlags::empty(),
8053                ___deadline,
8054            )?;
8055        Ok(_response.supported_formats)
8056    }
8057
8058    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8059    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8060    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8061    /// ring buffer channel had been established and was still active, the driver must close that
8062    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8063    /// operations in the process.
8064    pub fn r#create_ring_buffer(
8065        &self,
8066        mut format: &Format,
8067        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8068    ) -> Result<(), fidl::Error> {
8069        self.client.send::<StreamConfigCreateRingBufferRequest>(
8070            (format, ring_buffer),
8071            0x2afb19dd13faa1ba,
8072            fidl::encoding::DynamicFlags::empty(),
8073        )
8074    }
8075
8076    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8077    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8078    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8079    /// from what was most recently reported.
8080    /// If `WatchGainState` is called for a second time before the first call has completed, then
8081    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8082    pub fn r#watch_gain_state(
8083        &self,
8084        ___deadline: zx::MonotonicInstant,
8085    ) -> Result<GainState, fidl::Error> {
8086        let _response = self
8087            .client
8088            .send_query::<fidl::encoding::EmptyPayload, StreamConfigWatchGainStateResponse>(
8089                (),
8090                0x4772506136ab65c1,
8091                fidl::encoding::DynamicFlags::empty(),
8092                ___deadline,
8093            )?;
8094        Ok(_response.gain_state)
8095    }
8096
8097    /// Client update of the gain state.
8098    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8099        self.client.send::<StreamConfigSetGainRequest>(
8100            (target_state,),
8101            0x3943b41498c6a384,
8102            fidl::encoding::DynamicFlags::empty(),
8103        )
8104    }
8105
8106    /// Get the plug detect state via a hanging get. The driver will reply to the first
8107    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8108    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8109    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8110    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8111    pub fn r#watch_plug_state(
8112        &self,
8113        ___deadline: zx::MonotonicInstant,
8114    ) -> Result<PlugState, fidl::Error> {
8115        let _response = self
8116            .client
8117            .send_query::<fidl::encoding::EmptyPayload, StreamConfigWatchPlugStateResponse>(
8118                (),
8119                0x497345a6f048b2a6,
8120                fidl::encoding::DynamicFlags::empty(),
8121                ___deadline,
8122            )?;
8123        Ok(_response.plug_state)
8124    }
8125}
8126
8127#[cfg(target_os = "fuchsia")]
8128impl From<StreamConfigSynchronousProxy> for zx::Handle {
8129    fn from(value: StreamConfigSynchronousProxy) -> Self {
8130        value.into_channel().into()
8131    }
8132}
8133
8134#[cfg(target_os = "fuchsia")]
8135impl From<fidl::Channel> for StreamConfigSynchronousProxy {
8136    fn from(value: fidl::Channel) -> Self {
8137        Self::new(value)
8138    }
8139}
8140
8141#[cfg(target_os = "fuchsia")]
8142impl fidl::endpoints::FromClient for StreamConfigSynchronousProxy {
8143    type Protocol = StreamConfigMarker;
8144
8145    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigMarker>) -> Self {
8146        Self::new(value.into_channel())
8147    }
8148}
8149
8150#[derive(Debug, Clone)]
8151pub struct StreamConfigProxy {
8152    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8153}
8154
8155impl fidl::endpoints::Proxy for StreamConfigProxy {
8156    type Protocol = StreamConfigMarker;
8157
8158    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8159        Self::new(inner)
8160    }
8161
8162    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8163        self.client.into_channel().map_err(|client| Self { client })
8164    }
8165
8166    fn as_channel(&self) -> &::fidl::AsyncChannel {
8167        self.client.as_channel()
8168    }
8169}
8170
8171impl StreamConfigProxy {
8172    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfig.
8173    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8174        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8175        Self { client: fidl::client::Client::new(channel, protocol_name) }
8176    }
8177
8178    /// Get a Stream of events from the remote end of the protocol.
8179    ///
8180    /// # Panics
8181    ///
8182    /// Panics if the event stream was already taken.
8183    pub fn take_event_stream(&self) -> StreamConfigEventStream {
8184        StreamConfigEventStream { event_receiver: self.client.take_event_receiver() }
8185    }
8186
8187    /// Retrieves top level health state.
8188    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
8189    pub fn r#get_health_state(
8190        &self,
8191    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
8192    {
8193        StreamConfigProxyInterface::r#get_health_state(self)
8194    }
8195
8196    /// Connect to a `SignalProcessing` protocol.
8197    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
8198    /// the maximum number of connections have already been created, for instance one, then the
8199    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
8200    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
8201    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
8202    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
8203    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
8204    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
8205    /// is intended to be composed, and hence the more verbose name allows differentiation and
8206    /// improved clarity.
8207    pub fn r#signal_processing_connect(
8208        &self,
8209        mut protocol: fidl::endpoints::ServerEnd<
8210            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8211        >,
8212    ) -> Result<(), fidl::Error> {
8213        StreamConfigProxyInterface::r#signal_processing_connect(self, protocol)
8214    }
8215
8216    /// Retrieves top level static properties.
8217    pub fn r#get_properties(
8218        &self,
8219    ) -> fidl::client::QueryResponseFut<
8220        StreamProperties,
8221        fidl::encoding::DefaultFuchsiaResourceDialect,
8222    > {
8223        StreamConfigProxyInterface::r#get_properties(self)
8224    }
8225
8226    /// Gets formats supported by a given driver. When not all combinations supported by the
8227    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8228    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8229    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8230    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8231    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8232    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8233    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8234    /// <<16bits,32bits>,<48KHz,96KHz>>.
8235    pub fn r#get_supported_formats(
8236        &self,
8237    ) -> fidl::client::QueryResponseFut<
8238        Vec<SupportedFormats>,
8239        fidl::encoding::DefaultFuchsiaResourceDialect,
8240    > {
8241        StreamConfigProxyInterface::r#get_supported_formats(self)
8242    }
8243
8244    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8245    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8246    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8247    /// ring buffer channel had been established and was still active, the driver must close that
8248    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8249    /// operations in the process.
8250    pub fn r#create_ring_buffer(
8251        &self,
8252        mut format: &Format,
8253        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8254    ) -> Result<(), fidl::Error> {
8255        StreamConfigProxyInterface::r#create_ring_buffer(self, format, ring_buffer)
8256    }
8257
8258    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8259    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8260    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8261    /// from what was most recently reported.
8262    /// If `WatchGainState` is called for a second time before the first call has completed, then
8263    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8264    pub fn r#watch_gain_state(
8265        &self,
8266    ) -> fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>
8267    {
8268        StreamConfigProxyInterface::r#watch_gain_state(self)
8269    }
8270
8271    /// Client update of the gain state.
8272    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8273        StreamConfigProxyInterface::r#set_gain(self, target_state)
8274    }
8275
8276    /// Get the plug detect state via a hanging get. The driver will reply to the first
8277    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8278    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8279    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8280    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8281    pub fn r#watch_plug_state(
8282        &self,
8283    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
8284    {
8285        StreamConfigProxyInterface::r#watch_plug_state(self)
8286    }
8287}
8288
8289impl StreamConfigProxyInterface for StreamConfigProxy {
8290    type GetHealthStateResponseFut =
8291        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8292    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
8293        fn _decode(
8294            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8295        ) -> Result<HealthState, fidl::Error> {
8296            let _response = fidl::client::decode_transaction_body::<
8297                HealthGetHealthStateResponse,
8298                fidl::encoding::DefaultFuchsiaResourceDialect,
8299                0x4e146d6bca733a84,
8300            >(_buf?)?;
8301            Ok(_response.state)
8302        }
8303        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
8304            (),
8305            0x4e146d6bca733a84,
8306            fidl::encoding::DynamicFlags::empty(),
8307            _decode,
8308        )
8309    }
8310
8311    fn r#signal_processing_connect(
8312        &self,
8313        mut protocol: fidl::endpoints::ServerEnd<
8314            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8315        >,
8316    ) -> Result<(), fidl::Error> {
8317        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
8318            (protocol,),
8319            0xa81907ce6066295,
8320            fidl::encoding::DynamicFlags::empty(),
8321        )
8322    }
8323
8324    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
8325        StreamProperties,
8326        fidl::encoding::DefaultFuchsiaResourceDialect,
8327    >;
8328    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
8329        fn _decode(
8330            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8331        ) -> Result<StreamProperties, fidl::Error> {
8332            let _response = fidl::client::decode_transaction_body::<
8333                StreamConfigGetPropertiesResponse,
8334                fidl::encoding::DefaultFuchsiaResourceDialect,
8335                0x7d89c02f3e2d3c01,
8336            >(_buf?)?;
8337            Ok(_response.properties)
8338        }
8339        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
8340            (),
8341            0x7d89c02f3e2d3c01,
8342            fidl::encoding::DynamicFlags::empty(),
8343            _decode,
8344        )
8345    }
8346
8347    type GetSupportedFormatsResponseFut = fidl::client::QueryResponseFut<
8348        Vec<SupportedFormats>,
8349        fidl::encoding::DefaultFuchsiaResourceDialect,
8350    >;
8351    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut {
8352        fn _decode(
8353            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8354        ) -> Result<Vec<SupportedFormats>, fidl::Error> {
8355            let _response = fidl::client::decode_transaction_body::<
8356                StreamConfigGetSupportedFormatsResponse,
8357                fidl::encoding::DefaultFuchsiaResourceDialect,
8358                0x448efa7850cafe7e,
8359            >(_buf?)?;
8360            Ok(_response.supported_formats)
8361        }
8362        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<SupportedFormats>>(
8363            (),
8364            0x448efa7850cafe7e,
8365            fidl::encoding::DynamicFlags::empty(),
8366            _decode,
8367        )
8368    }
8369
8370    fn r#create_ring_buffer(
8371        &self,
8372        mut format: &Format,
8373        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8374    ) -> Result<(), fidl::Error> {
8375        self.client.send::<StreamConfigCreateRingBufferRequest>(
8376            (format, ring_buffer),
8377            0x2afb19dd13faa1ba,
8378            fidl::encoding::DynamicFlags::empty(),
8379        )
8380    }
8381
8382    type WatchGainStateResponseFut =
8383        fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8384    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut {
8385        fn _decode(
8386            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8387        ) -> Result<GainState, fidl::Error> {
8388            let _response = fidl::client::decode_transaction_body::<
8389                StreamConfigWatchGainStateResponse,
8390                fidl::encoding::DefaultFuchsiaResourceDialect,
8391                0x4772506136ab65c1,
8392            >(_buf?)?;
8393            Ok(_response.gain_state)
8394        }
8395        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GainState>(
8396            (),
8397            0x4772506136ab65c1,
8398            fidl::encoding::DynamicFlags::empty(),
8399            _decode,
8400        )
8401    }
8402
8403    fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8404        self.client.send::<StreamConfigSetGainRequest>(
8405            (target_state,),
8406            0x3943b41498c6a384,
8407            fidl::encoding::DynamicFlags::empty(),
8408        )
8409    }
8410
8411    type WatchPlugStateResponseFut =
8412        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8413    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
8414        fn _decode(
8415            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8416        ) -> Result<PlugState, fidl::Error> {
8417            let _response = fidl::client::decode_transaction_body::<
8418                StreamConfigWatchPlugStateResponse,
8419                fidl::encoding::DefaultFuchsiaResourceDialect,
8420                0x497345a6f048b2a6,
8421            >(_buf?)?;
8422            Ok(_response.plug_state)
8423        }
8424        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
8425            (),
8426            0x497345a6f048b2a6,
8427            fidl::encoding::DynamicFlags::empty(),
8428            _decode,
8429        )
8430    }
8431}
8432
8433pub struct StreamConfigEventStream {
8434    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8435}
8436
8437impl std::marker::Unpin for StreamConfigEventStream {}
8438
8439impl futures::stream::FusedStream for StreamConfigEventStream {
8440    fn is_terminated(&self) -> bool {
8441        self.event_receiver.is_terminated()
8442    }
8443}
8444
8445impl futures::Stream for StreamConfigEventStream {
8446    type Item = Result<StreamConfigEvent, fidl::Error>;
8447
8448    fn poll_next(
8449        mut self: std::pin::Pin<&mut Self>,
8450        cx: &mut std::task::Context<'_>,
8451    ) -> std::task::Poll<Option<Self::Item>> {
8452        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8453            &mut self.event_receiver,
8454            cx
8455        )?) {
8456            Some(buf) => std::task::Poll::Ready(Some(StreamConfigEvent::decode(buf))),
8457            None => std::task::Poll::Ready(None),
8458        }
8459    }
8460}
8461
8462#[derive(Debug)]
8463pub enum StreamConfigEvent {}
8464
8465impl StreamConfigEvent {
8466    /// Decodes a message buffer as a [`StreamConfigEvent`].
8467    fn decode(
8468        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8469    ) -> Result<StreamConfigEvent, fidl::Error> {
8470        let (bytes, _handles) = buf.split_mut();
8471        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8472        debug_assert_eq!(tx_header.tx_id, 0);
8473        match tx_header.ordinal {
8474            _ => Err(fidl::Error::UnknownOrdinal {
8475                ordinal: tx_header.ordinal,
8476                protocol_name: <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8477            }),
8478        }
8479    }
8480}
8481
8482/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfig.
8483pub struct StreamConfigRequestStream {
8484    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8485    is_terminated: bool,
8486}
8487
8488impl std::marker::Unpin for StreamConfigRequestStream {}
8489
8490impl futures::stream::FusedStream for StreamConfigRequestStream {
8491    fn is_terminated(&self) -> bool {
8492        self.is_terminated
8493    }
8494}
8495
8496impl fidl::endpoints::RequestStream for StreamConfigRequestStream {
8497    type Protocol = StreamConfigMarker;
8498    type ControlHandle = StreamConfigControlHandle;
8499
8500    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8501        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8502    }
8503
8504    fn control_handle(&self) -> Self::ControlHandle {
8505        StreamConfigControlHandle { inner: self.inner.clone() }
8506    }
8507
8508    fn into_inner(
8509        self,
8510    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8511    {
8512        (self.inner, self.is_terminated)
8513    }
8514
8515    fn from_inner(
8516        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8517        is_terminated: bool,
8518    ) -> Self {
8519        Self { inner, is_terminated }
8520    }
8521}
8522
8523impl futures::Stream for StreamConfigRequestStream {
8524    type Item = Result<StreamConfigRequest, fidl::Error>;
8525
8526    fn poll_next(
8527        mut self: std::pin::Pin<&mut Self>,
8528        cx: &mut std::task::Context<'_>,
8529    ) -> std::task::Poll<Option<Self::Item>> {
8530        let this = &mut *self;
8531        if this.inner.check_shutdown(cx) {
8532            this.is_terminated = true;
8533            return std::task::Poll::Ready(None);
8534        }
8535        if this.is_terminated {
8536            panic!("polled StreamConfigRequestStream after completion");
8537        }
8538        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8539            |bytes, handles| {
8540                match this.inner.channel().read_etc(cx, bytes, handles) {
8541                    std::task::Poll::Ready(Ok(())) => {}
8542                    std::task::Poll::Pending => return std::task::Poll::Pending,
8543                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8544                        this.is_terminated = true;
8545                        return std::task::Poll::Ready(None);
8546                    }
8547                    std::task::Poll::Ready(Err(e)) => {
8548                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8549                            e.into(),
8550                        ))));
8551                    }
8552                }
8553
8554                // A message has been received from the channel
8555                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8556
8557                std::task::Poll::Ready(Some(match header.ordinal {
8558                    0x4e146d6bca733a84 => {
8559                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8560                        let mut req = fidl::new_empty!(
8561                            fidl::encoding::EmptyPayload,
8562                            fidl::encoding::DefaultFuchsiaResourceDialect
8563                        );
8564                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8565                        let control_handle =
8566                            StreamConfigControlHandle { inner: this.inner.clone() };
8567                        Ok(StreamConfigRequest::GetHealthState {
8568                            responder: StreamConfigGetHealthStateResponder {
8569                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8570                                tx_id: header.tx_id,
8571                            },
8572                        })
8573                    }
8574                    0xa81907ce6066295 => {
8575                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8576                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8577                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
8578                        let control_handle =
8579                            StreamConfigControlHandle { inner: this.inner.clone() };
8580                        Ok(StreamConfigRequest::SignalProcessingConnect {
8581                            protocol: req.protocol,
8582
8583                            control_handle,
8584                        })
8585                    }
8586                    0x7d89c02f3e2d3c01 => {
8587                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8588                        let mut req = fidl::new_empty!(
8589                            fidl::encoding::EmptyPayload,
8590                            fidl::encoding::DefaultFuchsiaResourceDialect
8591                        );
8592                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8593                        let control_handle =
8594                            StreamConfigControlHandle { inner: this.inner.clone() };
8595                        Ok(StreamConfigRequest::GetProperties {
8596                            responder: StreamConfigGetPropertiesResponder {
8597                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8598                                tx_id: header.tx_id,
8599                            },
8600                        })
8601                    }
8602                    0x448efa7850cafe7e => {
8603                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8604                        let mut req = fidl::new_empty!(
8605                            fidl::encoding::EmptyPayload,
8606                            fidl::encoding::DefaultFuchsiaResourceDialect
8607                        );
8608                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8609                        let control_handle =
8610                            StreamConfigControlHandle { inner: this.inner.clone() };
8611                        Ok(StreamConfigRequest::GetSupportedFormats {
8612                            responder: StreamConfigGetSupportedFormatsResponder {
8613                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8614                                tx_id: header.tx_id,
8615                            },
8616                        })
8617                    }
8618                    0x2afb19dd13faa1ba => {
8619                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8620                        let mut req = fidl::new_empty!(
8621                            StreamConfigCreateRingBufferRequest,
8622                            fidl::encoding::DefaultFuchsiaResourceDialect
8623                        );
8624                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
8625                        let control_handle =
8626                            StreamConfigControlHandle { inner: this.inner.clone() };
8627                        Ok(StreamConfigRequest::CreateRingBuffer {
8628                            format: req.format,
8629                            ring_buffer: req.ring_buffer,
8630
8631                            control_handle,
8632                        })
8633                    }
8634                    0x4772506136ab65c1 => {
8635                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8636                        let mut req = fidl::new_empty!(
8637                            fidl::encoding::EmptyPayload,
8638                            fidl::encoding::DefaultFuchsiaResourceDialect
8639                        );
8640                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8641                        let control_handle =
8642                            StreamConfigControlHandle { inner: this.inner.clone() };
8643                        Ok(StreamConfigRequest::WatchGainState {
8644                            responder: StreamConfigWatchGainStateResponder {
8645                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8646                                tx_id: header.tx_id,
8647                            },
8648                        })
8649                    }
8650                    0x3943b41498c6a384 => {
8651                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8652                        let mut req = fidl::new_empty!(
8653                            StreamConfigSetGainRequest,
8654                            fidl::encoding::DefaultFuchsiaResourceDialect
8655                        );
8656                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
8657                        let control_handle =
8658                            StreamConfigControlHandle { inner: this.inner.clone() };
8659                        Ok(StreamConfigRequest::SetGain {
8660                            target_state: req.target_state,
8661
8662                            control_handle,
8663                        })
8664                    }
8665                    0x497345a6f048b2a6 => {
8666                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8667                        let mut req = fidl::new_empty!(
8668                            fidl::encoding::EmptyPayload,
8669                            fidl::encoding::DefaultFuchsiaResourceDialect
8670                        );
8671                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8672                        let control_handle =
8673                            StreamConfigControlHandle { inner: this.inner.clone() };
8674                        Ok(StreamConfigRequest::WatchPlugState {
8675                            responder: StreamConfigWatchPlugStateResponder {
8676                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8677                                tx_id: header.tx_id,
8678                            },
8679                        })
8680                    }
8681                    _ => Err(fidl::Error::UnknownOrdinal {
8682                        ordinal: header.ordinal,
8683                        protocol_name:
8684                            <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8685                    }),
8686                }))
8687            },
8688        )
8689    }
8690}
8691
8692/// For an overview see
8693/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming)
8694/// # Deprecation
8695///
8696/// Not supported anymore, instead use an
8697/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
8698/// with one Ring Buffer, see
8699/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
8700#[derive(Debug)]
8701pub enum StreamConfigRequest {
8702    /// Retrieves top level health state.
8703    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
8704    GetHealthState { responder: StreamConfigGetHealthStateResponder },
8705    /// Connect to a `SignalProcessing` protocol.
8706    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
8707    /// the maximum number of connections have already been created, for instance one, then the
8708    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
8709    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
8710    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
8711    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
8712    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
8713    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
8714    /// is intended to be composed, and hence the more verbose name allows differentiation and
8715    /// improved clarity.
8716    SignalProcessingConnect {
8717        protocol: fidl::endpoints::ServerEnd<
8718            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8719        >,
8720        control_handle: StreamConfigControlHandle,
8721    },
8722    /// Retrieves top level static properties.
8723    GetProperties { responder: StreamConfigGetPropertiesResponder },
8724    /// Gets formats supported by a given driver. When not all combinations supported by the
8725    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8726    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8727    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8728    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8729    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8730    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8731    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8732    /// <<16bits,32bits>,<48KHz,96KHz>>.
8733    GetSupportedFormats { responder: StreamConfigGetSupportedFormatsResponder },
8734    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8735    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8736    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8737    /// ring buffer channel had been established and was still active, the driver must close that
8738    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8739    /// operations in the process.
8740    CreateRingBuffer {
8741        format: Format,
8742        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8743        control_handle: StreamConfigControlHandle,
8744    },
8745    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8746    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8747    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8748    /// from what was most recently reported.
8749    /// If `WatchGainState` is called for a second time before the first call has completed, then
8750    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8751    WatchGainState { responder: StreamConfigWatchGainStateResponder },
8752    /// Client update of the gain state.
8753    SetGain { target_state: GainState, control_handle: StreamConfigControlHandle },
8754    /// Get the plug detect state via a hanging get. The driver will reply to the first
8755    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8756    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8757    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8758    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8759    WatchPlugState { responder: StreamConfigWatchPlugStateResponder },
8760}
8761
8762impl StreamConfigRequest {
8763    #[allow(irrefutable_let_patterns)]
8764    pub fn into_get_health_state(self) -> Option<(StreamConfigGetHealthStateResponder)> {
8765        if let StreamConfigRequest::GetHealthState { responder } = self {
8766            Some((responder))
8767        } else {
8768            None
8769        }
8770    }
8771
8772    #[allow(irrefutable_let_patterns)]
8773    pub fn into_signal_processing_connect(
8774        self,
8775    ) -> Option<(
8776        fidl::endpoints::ServerEnd<
8777            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8778        >,
8779        StreamConfigControlHandle,
8780    )> {
8781        if let StreamConfigRequest::SignalProcessingConnect { protocol, control_handle } = self {
8782            Some((protocol, control_handle))
8783        } else {
8784            None
8785        }
8786    }
8787
8788    #[allow(irrefutable_let_patterns)]
8789    pub fn into_get_properties(self) -> Option<(StreamConfigGetPropertiesResponder)> {
8790        if let StreamConfigRequest::GetProperties { responder } = self {
8791            Some((responder))
8792        } else {
8793            None
8794        }
8795    }
8796
8797    #[allow(irrefutable_let_patterns)]
8798    pub fn into_get_supported_formats(self) -> Option<(StreamConfigGetSupportedFormatsResponder)> {
8799        if let StreamConfigRequest::GetSupportedFormats { responder } = self {
8800            Some((responder))
8801        } else {
8802            None
8803        }
8804    }
8805
8806    #[allow(irrefutable_let_patterns)]
8807    pub fn into_create_ring_buffer(
8808        self,
8809    ) -> Option<(Format, fidl::endpoints::ServerEnd<RingBufferMarker>, StreamConfigControlHandle)>
8810    {
8811        if let StreamConfigRequest::CreateRingBuffer { format, ring_buffer, control_handle } = self
8812        {
8813            Some((format, ring_buffer, control_handle))
8814        } else {
8815            None
8816        }
8817    }
8818
8819    #[allow(irrefutable_let_patterns)]
8820    pub fn into_watch_gain_state(self) -> Option<(StreamConfigWatchGainStateResponder)> {
8821        if let StreamConfigRequest::WatchGainState { responder } = self {
8822            Some((responder))
8823        } else {
8824            None
8825        }
8826    }
8827
8828    #[allow(irrefutable_let_patterns)]
8829    pub fn into_set_gain(self) -> Option<(GainState, StreamConfigControlHandle)> {
8830        if let StreamConfigRequest::SetGain { target_state, control_handle } = self {
8831            Some((target_state, control_handle))
8832        } else {
8833            None
8834        }
8835    }
8836
8837    #[allow(irrefutable_let_patterns)]
8838    pub fn into_watch_plug_state(self) -> Option<(StreamConfigWatchPlugStateResponder)> {
8839        if let StreamConfigRequest::WatchPlugState { responder } = self {
8840            Some((responder))
8841        } else {
8842            None
8843        }
8844    }
8845
8846    /// Name of the method defined in FIDL
8847    pub fn method_name(&self) -> &'static str {
8848        match *self {
8849            StreamConfigRequest::GetHealthState { .. } => "get_health_state",
8850            StreamConfigRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
8851            StreamConfigRequest::GetProperties { .. } => "get_properties",
8852            StreamConfigRequest::GetSupportedFormats { .. } => "get_supported_formats",
8853            StreamConfigRequest::CreateRingBuffer { .. } => "create_ring_buffer",
8854            StreamConfigRequest::WatchGainState { .. } => "watch_gain_state",
8855            StreamConfigRequest::SetGain { .. } => "set_gain",
8856            StreamConfigRequest::WatchPlugState { .. } => "watch_plug_state",
8857        }
8858    }
8859}
8860
8861#[derive(Debug, Clone)]
8862pub struct StreamConfigControlHandle {
8863    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8864}
8865
8866impl fidl::endpoints::ControlHandle for StreamConfigControlHandle {
8867    fn shutdown(&self) {
8868        self.inner.shutdown()
8869    }
8870    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8871        self.inner.shutdown_with_epitaph(status)
8872    }
8873
8874    fn is_closed(&self) -> bool {
8875        self.inner.channel().is_closed()
8876    }
8877    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8878        self.inner.channel().on_closed()
8879    }
8880
8881    #[cfg(target_os = "fuchsia")]
8882    fn signal_peer(
8883        &self,
8884        clear_mask: zx::Signals,
8885        set_mask: zx::Signals,
8886    ) -> Result<(), zx_status::Status> {
8887        use fidl::Peered;
8888        self.inner.channel().signal_peer(clear_mask, set_mask)
8889    }
8890}
8891
8892impl StreamConfigControlHandle {}
8893
8894#[must_use = "FIDL methods require a response to be sent"]
8895#[derive(Debug)]
8896pub struct StreamConfigGetHealthStateResponder {
8897    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
8898    tx_id: u32,
8899}
8900
8901/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
8902/// if the responder is dropped without sending a response, so that the client
8903/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8904impl std::ops::Drop for StreamConfigGetHealthStateResponder {
8905    fn drop(&mut self) {
8906        self.control_handle.shutdown();
8907        // Safety: drops once, never accessed again
8908        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8909    }
8910}
8911
8912impl fidl::endpoints::Responder for StreamConfigGetHealthStateResponder {
8913    type ControlHandle = StreamConfigControlHandle;
8914
8915    fn control_handle(&self) -> &StreamConfigControlHandle {
8916        &self.control_handle
8917    }
8918
8919    fn drop_without_shutdown(mut self) {
8920        // Safety: drops once, never accessed again due to mem::forget
8921        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8922        // Prevent Drop from running (which would shut down the channel)
8923        std::mem::forget(self);
8924    }
8925}
8926
8927impl StreamConfigGetHealthStateResponder {
8928    /// Sends a response to the FIDL transaction.
8929    ///
8930    /// Sets the channel to shutdown if an error occurs.
8931    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
8932        let _result = self.send_raw(state);
8933        if _result.is_err() {
8934            self.control_handle.shutdown();
8935        }
8936        self.drop_without_shutdown();
8937        _result
8938    }
8939
8940    /// Similar to "send" but does not shutdown the channel if an error occurs.
8941    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
8942        let _result = self.send_raw(state);
8943        self.drop_without_shutdown();
8944        _result
8945    }
8946
8947    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
8948        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
8949            (state,),
8950            self.tx_id,
8951            0x4e146d6bca733a84,
8952            fidl::encoding::DynamicFlags::empty(),
8953        )
8954    }
8955}
8956
8957#[must_use = "FIDL methods require a response to be sent"]
8958#[derive(Debug)]
8959pub struct StreamConfigGetPropertiesResponder {
8960    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
8961    tx_id: u32,
8962}
8963
8964/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
8965/// if the responder is dropped without sending a response, so that the client
8966/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8967impl std::ops::Drop for StreamConfigGetPropertiesResponder {
8968    fn drop(&mut self) {
8969        self.control_handle.shutdown();
8970        // Safety: drops once, never accessed again
8971        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8972    }
8973}
8974
8975impl fidl::endpoints::Responder for StreamConfigGetPropertiesResponder {
8976    type ControlHandle = StreamConfigControlHandle;
8977
8978    fn control_handle(&self) -> &StreamConfigControlHandle {
8979        &self.control_handle
8980    }
8981
8982    fn drop_without_shutdown(mut self) {
8983        // Safety: drops once, never accessed again due to mem::forget
8984        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8985        // Prevent Drop from running (which would shut down the channel)
8986        std::mem::forget(self);
8987    }
8988}
8989
8990impl StreamConfigGetPropertiesResponder {
8991    /// Sends a response to the FIDL transaction.
8992    ///
8993    /// Sets the channel to shutdown if an error occurs.
8994    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
8995        let _result = self.send_raw(properties);
8996        if _result.is_err() {
8997            self.control_handle.shutdown();
8998        }
8999        self.drop_without_shutdown();
9000        _result
9001    }
9002
9003    /// Similar to "send" but does not shutdown the channel if an error occurs.
9004    pub fn send_no_shutdown_on_err(
9005        self,
9006        mut properties: &StreamProperties,
9007    ) -> Result<(), fidl::Error> {
9008        let _result = self.send_raw(properties);
9009        self.drop_without_shutdown();
9010        _result
9011    }
9012
9013    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
9014        self.control_handle.inner.send::<StreamConfigGetPropertiesResponse>(
9015            (properties,),
9016            self.tx_id,
9017            0x7d89c02f3e2d3c01,
9018            fidl::encoding::DynamicFlags::empty(),
9019        )
9020    }
9021}
9022
9023#[must_use = "FIDL methods require a response to be sent"]
9024#[derive(Debug)]
9025pub struct StreamConfigGetSupportedFormatsResponder {
9026    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9027    tx_id: u32,
9028}
9029
9030/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9031/// if the responder is dropped without sending a response, so that the client
9032/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9033impl std::ops::Drop for StreamConfigGetSupportedFormatsResponder {
9034    fn drop(&mut self) {
9035        self.control_handle.shutdown();
9036        // Safety: drops once, never accessed again
9037        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9038    }
9039}
9040
9041impl fidl::endpoints::Responder for StreamConfigGetSupportedFormatsResponder {
9042    type ControlHandle = StreamConfigControlHandle;
9043
9044    fn control_handle(&self) -> &StreamConfigControlHandle {
9045        &self.control_handle
9046    }
9047
9048    fn drop_without_shutdown(mut self) {
9049        // Safety: drops once, never accessed again due to mem::forget
9050        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9051        // Prevent Drop from running (which would shut down the channel)
9052        std::mem::forget(self);
9053    }
9054}
9055
9056impl StreamConfigGetSupportedFormatsResponder {
9057    /// Sends a response to the FIDL transaction.
9058    ///
9059    /// Sets the channel to shutdown if an error occurs.
9060    pub fn send(self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
9061        let _result = self.send_raw(supported_formats);
9062        if _result.is_err() {
9063            self.control_handle.shutdown();
9064        }
9065        self.drop_without_shutdown();
9066        _result
9067    }
9068
9069    /// Similar to "send" but does not shutdown the channel if an error occurs.
9070    pub fn send_no_shutdown_on_err(
9071        self,
9072        mut supported_formats: &[SupportedFormats],
9073    ) -> Result<(), fidl::Error> {
9074        let _result = self.send_raw(supported_formats);
9075        self.drop_without_shutdown();
9076        _result
9077    }
9078
9079    fn send_raw(&self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
9080        self.control_handle.inner.send::<StreamConfigGetSupportedFormatsResponse>(
9081            (supported_formats,),
9082            self.tx_id,
9083            0x448efa7850cafe7e,
9084            fidl::encoding::DynamicFlags::empty(),
9085        )
9086    }
9087}
9088
9089#[must_use = "FIDL methods require a response to be sent"]
9090#[derive(Debug)]
9091pub struct StreamConfigWatchGainStateResponder {
9092    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9093    tx_id: u32,
9094}
9095
9096/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9097/// if the responder is dropped without sending a response, so that the client
9098/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9099impl std::ops::Drop for StreamConfigWatchGainStateResponder {
9100    fn drop(&mut self) {
9101        self.control_handle.shutdown();
9102        // Safety: drops once, never accessed again
9103        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9104    }
9105}
9106
9107impl fidl::endpoints::Responder for StreamConfigWatchGainStateResponder {
9108    type ControlHandle = StreamConfigControlHandle;
9109
9110    fn control_handle(&self) -> &StreamConfigControlHandle {
9111        &self.control_handle
9112    }
9113
9114    fn drop_without_shutdown(mut self) {
9115        // Safety: drops once, never accessed again due to mem::forget
9116        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9117        // Prevent Drop from running (which would shut down the channel)
9118        std::mem::forget(self);
9119    }
9120}
9121
9122impl StreamConfigWatchGainStateResponder {
9123    /// Sends a response to the FIDL transaction.
9124    ///
9125    /// Sets the channel to shutdown if an error occurs.
9126    pub fn send(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9127        let _result = self.send_raw(gain_state);
9128        if _result.is_err() {
9129            self.control_handle.shutdown();
9130        }
9131        self.drop_without_shutdown();
9132        _result
9133    }
9134
9135    /// Similar to "send" but does not shutdown the channel if an error occurs.
9136    pub fn send_no_shutdown_on_err(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9137        let _result = self.send_raw(gain_state);
9138        self.drop_without_shutdown();
9139        _result
9140    }
9141
9142    fn send_raw(&self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9143        self.control_handle.inner.send::<StreamConfigWatchGainStateResponse>(
9144            (gain_state,),
9145            self.tx_id,
9146            0x4772506136ab65c1,
9147            fidl::encoding::DynamicFlags::empty(),
9148        )
9149    }
9150}
9151
9152#[must_use = "FIDL methods require a response to be sent"]
9153#[derive(Debug)]
9154pub struct StreamConfigWatchPlugStateResponder {
9155    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9156    tx_id: u32,
9157}
9158
9159/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9160/// if the responder is dropped without sending a response, so that the client
9161/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9162impl std::ops::Drop for StreamConfigWatchPlugStateResponder {
9163    fn drop(&mut self) {
9164        self.control_handle.shutdown();
9165        // Safety: drops once, never accessed again
9166        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9167    }
9168}
9169
9170impl fidl::endpoints::Responder for StreamConfigWatchPlugStateResponder {
9171    type ControlHandle = StreamConfigControlHandle;
9172
9173    fn control_handle(&self) -> &StreamConfigControlHandle {
9174        &self.control_handle
9175    }
9176
9177    fn drop_without_shutdown(mut self) {
9178        // Safety: drops once, never accessed again due to mem::forget
9179        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9180        // Prevent Drop from running (which would shut down the channel)
9181        std::mem::forget(self);
9182    }
9183}
9184
9185impl StreamConfigWatchPlugStateResponder {
9186    /// Sends a response to the FIDL transaction.
9187    ///
9188    /// Sets the channel to shutdown if an error occurs.
9189    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9190        let _result = self.send_raw(plug_state);
9191        if _result.is_err() {
9192            self.control_handle.shutdown();
9193        }
9194        self.drop_without_shutdown();
9195        _result
9196    }
9197
9198    /// Similar to "send" but does not shutdown the channel if an error occurs.
9199    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9200        let _result = self.send_raw(plug_state);
9201        self.drop_without_shutdown();
9202        _result
9203    }
9204
9205    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9206        self.control_handle.inner.send::<StreamConfigWatchPlugStateResponse>(
9207            (plug_state,),
9208            self.tx_id,
9209            0x497345a6f048b2a6,
9210            fidl::encoding::DynamicFlags::empty(),
9211        )
9212    }
9213}
9214
9215#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9216pub struct StreamConfigConnectorMarker;
9217
9218impl fidl::endpoints::ProtocolMarker for StreamConfigConnectorMarker {
9219    type Proxy = StreamConfigConnectorProxy;
9220    type RequestStream = StreamConfigConnectorRequestStream;
9221    #[cfg(target_os = "fuchsia")]
9222    type SynchronousProxy = StreamConfigConnectorSynchronousProxy;
9223
9224    const DEBUG_NAME: &'static str = "(anonymous) StreamConfigConnector";
9225}
9226
9227pub trait StreamConfigConnectorProxyInterface: Send + Sync {
9228    fn r#connect(
9229        &self,
9230        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9231    ) -> Result<(), fidl::Error>;
9232}
9233#[derive(Debug)]
9234#[cfg(target_os = "fuchsia")]
9235pub struct StreamConfigConnectorSynchronousProxy {
9236    client: fidl::client::sync::Client,
9237}
9238
9239#[cfg(target_os = "fuchsia")]
9240impl fidl::endpoints::SynchronousProxy for StreamConfigConnectorSynchronousProxy {
9241    type Proxy = StreamConfigConnectorProxy;
9242    type Protocol = StreamConfigConnectorMarker;
9243
9244    fn from_channel(inner: fidl::Channel) -> Self {
9245        Self::new(inner)
9246    }
9247
9248    fn into_channel(self) -> fidl::Channel {
9249        self.client.into_channel()
9250    }
9251
9252    fn as_channel(&self) -> &fidl::Channel {
9253        self.client.as_channel()
9254    }
9255}
9256
9257#[cfg(target_os = "fuchsia")]
9258impl StreamConfigConnectorSynchronousProxy {
9259    pub fn new(channel: fidl::Channel) -> Self {
9260        let protocol_name =
9261            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9262        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9263    }
9264
9265    pub fn into_channel(self) -> fidl::Channel {
9266        self.client.into_channel()
9267    }
9268
9269    /// Waits until an event arrives and returns it. It is safe for other
9270    /// threads to make concurrent requests while waiting for an event.
9271    pub fn wait_for_event(
9272        &self,
9273        deadline: zx::MonotonicInstant,
9274    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
9275        StreamConfigConnectorEvent::decode(self.client.wait_for_event(deadline)?)
9276    }
9277
9278    /// Connect to a `StreamConfig` protocol.
9279    /// This method allows a component to serve FIDL outside the devhost's control.
9280    pub fn r#connect(
9281        &self,
9282        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9283    ) -> Result<(), fidl::Error> {
9284        self.client.send::<StreamConfigConnectorConnectRequest>(
9285            (protocol,),
9286            0x22051ff3021eafec,
9287            fidl::encoding::DynamicFlags::empty(),
9288        )
9289    }
9290}
9291
9292#[cfg(target_os = "fuchsia")]
9293impl From<StreamConfigConnectorSynchronousProxy> for zx::Handle {
9294    fn from(value: StreamConfigConnectorSynchronousProxy) -> Self {
9295        value.into_channel().into()
9296    }
9297}
9298
9299#[cfg(target_os = "fuchsia")]
9300impl From<fidl::Channel> for StreamConfigConnectorSynchronousProxy {
9301    fn from(value: fidl::Channel) -> Self {
9302        Self::new(value)
9303    }
9304}
9305
9306#[cfg(target_os = "fuchsia")]
9307impl fidl::endpoints::FromClient for StreamConfigConnectorSynchronousProxy {
9308    type Protocol = StreamConfigConnectorMarker;
9309
9310    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigConnectorMarker>) -> Self {
9311        Self::new(value.into_channel())
9312    }
9313}
9314
9315#[derive(Debug, Clone)]
9316pub struct StreamConfigConnectorProxy {
9317    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9318}
9319
9320impl fidl::endpoints::Proxy for StreamConfigConnectorProxy {
9321    type Protocol = StreamConfigConnectorMarker;
9322
9323    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9324        Self::new(inner)
9325    }
9326
9327    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9328        self.client.into_channel().map_err(|client| Self { client })
9329    }
9330
9331    fn as_channel(&self) -> &::fidl::AsyncChannel {
9332        self.client.as_channel()
9333    }
9334}
9335
9336impl StreamConfigConnectorProxy {
9337    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfigConnector.
9338    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9339        let protocol_name =
9340            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9341        Self { client: fidl::client::Client::new(channel, protocol_name) }
9342    }
9343
9344    /// Get a Stream of events from the remote end of the protocol.
9345    ///
9346    /// # Panics
9347    ///
9348    /// Panics if the event stream was already taken.
9349    pub fn take_event_stream(&self) -> StreamConfigConnectorEventStream {
9350        StreamConfigConnectorEventStream { event_receiver: self.client.take_event_receiver() }
9351    }
9352
9353    /// Connect to a `StreamConfig` protocol.
9354    /// This method allows a component to serve FIDL outside the devhost's control.
9355    pub fn r#connect(
9356        &self,
9357        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9358    ) -> Result<(), fidl::Error> {
9359        StreamConfigConnectorProxyInterface::r#connect(self, protocol)
9360    }
9361}
9362
9363impl StreamConfigConnectorProxyInterface for StreamConfigConnectorProxy {
9364    fn r#connect(
9365        &self,
9366        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9367    ) -> Result<(), fidl::Error> {
9368        self.client.send::<StreamConfigConnectorConnectRequest>(
9369            (protocol,),
9370            0x22051ff3021eafec,
9371            fidl::encoding::DynamicFlags::empty(),
9372        )
9373    }
9374}
9375
9376pub struct StreamConfigConnectorEventStream {
9377    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9378}
9379
9380impl std::marker::Unpin for StreamConfigConnectorEventStream {}
9381
9382impl futures::stream::FusedStream for StreamConfigConnectorEventStream {
9383    fn is_terminated(&self) -> bool {
9384        self.event_receiver.is_terminated()
9385    }
9386}
9387
9388impl futures::Stream for StreamConfigConnectorEventStream {
9389    type Item = Result<StreamConfigConnectorEvent, fidl::Error>;
9390
9391    fn poll_next(
9392        mut self: std::pin::Pin<&mut Self>,
9393        cx: &mut std::task::Context<'_>,
9394    ) -> std::task::Poll<Option<Self::Item>> {
9395        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9396            &mut self.event_receiver,
9397            cx
9398        )?) {
9399            Some(buf) => std::task::Poll::Ready(Some(StreamConfigConnectorEvent::decode(buf))),
9400            None => std::task::Poll::Ready(None),
9401        }
9402    }
9403}
9404
9405#[derive(Debug)]
9406pub enum StreamConfigConnectorEvent {}
9407
9408impl StreamConfigConnectorEvent {
9409    /// Decodes a message buffer as a [`StreamConfigConnectorEvent`].
9410    fn decode(
9411        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9412    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
9413        let (bytes, _handles) = buf.split_mut();
9414        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9415        debug_assert_eq!(tx_header.tx_id, 0);
9416        match tx_header.ordinal {
9417            _ => Err(fidl::Error::UnknownOrdinal {
9418                ordinal: tx_header.ordinal,
9419                protocol_name:
9420                    <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9421            }),
9422        }
9423    }
9424}
9425
9426/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfigConnector.
9427pub struct StreamConfigConnectorRequestStream {
9428    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9429    is_terminated: bool,
9430}
9431
9432impl std::marker::Unpin for StreamConfigConnectorRequestStream {}
9433
9434impl futures::stream::FusedStream for StreamConfigConnectorRequestStream {
9435    fn is_terminated(&self) -> bool {
9436        self.is_terminated
9437    }
9438}
9439
9440impl fidl::endpoints::RequestStream for StreamConfigConnectorRequestStream {
9441    type Protocol = StreamConfigConnectorMarker;
9442    type ControlHandle = StreamConfigConnectorControlHandle;
9443
9444    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9445        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9446    }
9447
9448    fn control_handle(&self) -> Self::ControlHandle {
9449        StreamConfigConnectorControlHandle { inner: self.inner.clone() }
9450    }
9451
9452    fn into_inner(
9453        self,
9454    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9455    {
9456        (self.inner, self.is_terminated)
9457    }
9458
9459    fn from_inner(
9460        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9461        is_terminated: bool,
9462    ) -> Self {
9463        Self { inner, is_terminated }
9464    }
9465}
9466
9467impl futures::Stream for StreamConfigConnectorRequestStream {
9468    type Item = Result<StreamConfigConnectorRequest, fidl::Error>;
9469
9470    fn poll_next(
9471        mut self: std::pin::Pin<&mut Self>,
9472        cx: &mut std::task::Context<'_>,
9473    ) -> std::task::Poll<Option<Self::Item>> {
9474        let this = &mut *self;
9475        if this.inner.check_shutdown(cx) {
9476            this.is_terminated = true;
9477            return std::task::Poll::Ready(None);
9478        }
9479        if this.is_terminated {
9480            panic!("polled StreamConfigConnectorRequestStream after completion");
9481        }
9482        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9483            |bytes, handles| {
9484                match this.inner.channel().read_etc(cx, bytes, handles) {
9485                    std::task::Poll::Ready(Ok(())) => {}
9486                    std::task::Poll::Pending => return std::task::Poll::Pending,
9487                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9488                        this.is_terminated = true;
9489                        return std::task::Poll::Ready(None);
9490                    }
9491                    std::task::Poll::Ready(Err(e)) => {
9492                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9493                            e.into(),
9494                        ))));
9495                    }
9496                }
9497
9498                // A message has been received from the channel
9499                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9500
9501                std::task::Poll::Ready(Some(match header.ordinal {
9502                0x22051ff3021eafec => {
9503                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9504                    let mut req = fidl::new_empty!(StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9505                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
9506                    let control_handle = StreamConfigConnectorControlHandle {
9507                        inner: this.inner.clone(),
9508                    };
9509                    Ok(StreamConfigConnectorRequest::Connect {protocol: req.protocol,
9510
9511                        control_handle,
9512                    })
9513                }
9514                _ => Err(fidl::Error::UnknownOrdinal {
9515                    ordinal: header.ordinal,
9516                    protocol_name: <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9517                }),
9518            }))
9519            },
9520        )
9521    }
9522}
9523
9524/// For an overview see
9525/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming).
9526/// # Deprecation
9527///
9528/// Not supported anymore, instead use an
9529/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9530/// with one Ring Buffer, see
9531/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9532#[derive(Debug)]
9533pub enum StreamConfigConnectorRequest {
9534    /// Connect to a `StreamConfig` protocol.
9535    /// This method allows a component to serve FIDL outside the devhost's control.
9536    Connect {
9537        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9538        control_handle: StreamConfigConnectorControlHandle,
9539    },
9540}
9541
9542impl StreamConfigConnectorRequest {
9543    #[allow(irrefutable_let_patterns)]
9544    pub fn into_connect(
9545        self,
9546    ) -> Option<(fidl::endpoints::ServerEnd<StreamConfigMarker>, StreamConfigConnectorControlHandle)>
9547    {
9548        if let StreamConfigConnectorRequest::Connect { protocol, control_handle } = self {
9549            Some((protocol, control_handle))
9550        } else {
9551            None
9552        }
9553    }
9554
9555    /// Name of the method defined in FIDL
9556    pub fn method_name(&self) -> &'static str {
9557        match *self {
9558            StreamConfigConnectorRequest::Connect { .. } => "connect",
9559        }
9560    }
9561}
9562
9563#[derive(Debug, Clone)]
9564pub struct StreamConfigConnectorControlHandle {
9565    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9566}
9567
9568impl fidl::endpoints::ControlHandle for StreamConfigConnectorControlHandle {
9569    fn shutdown(&self) {
9570        self.inner.shutdown()
9571    }
9572    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9573        self.inner.shutdown_with_epitaph(status)
9574    }
9575
9576    fn is_closed(&self) -> bool {
9577        self.inner.channel().is_closed()
9578    }
9579    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9580        self.inner.channel().on_closed()
9581    }
9582
9583    #[cfg(target_os = "fuchsia")]
9584    fn signal_peer(
9585        &self,
9586        clear_mask: zx::Signals,
9587        set_mask: zx::Signals,
9588    ) -> Result<(), zx_status::Status> {
9589        use fidl::Peered;
9590        self.inner.channel().signal_peer(clear_mask, set_mask)
9591    }
9592}
9593
9594impl StreamConfigConnectorControlHandle {}
9595
9596#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9597pub struct CodecConnectorServiceMarker;
9598
9599#[cfg(target_os = "fuchsia")]
9600impl fidl::endpoints::ServiceMarker for CodecConnectorServiceMarker {
9601    type Proxy = CodecConnectorServiceProxy;
9602    type Request = CodecConnectorServiceRequest;
9603    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecConnectorService";
9604}
9605
9606/// A request for one of the member protocols of CodecConnectorService.
9607///
9608/// # Deprecation
9609///
9610/// Not supported anymore, instead use an
9611/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9612/// with one DAI and no Ring Buffer, see
9613/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9614#[cfg(target_os = "fuchsia")]
9615pub enum CodecConnectorServiceRequest {
9616    CodecConnector(CodecConnectorRequestStream),
9617}
9618
9619#[cfg(target_os = "fuchsia")]
9620impl fidl::endpoints::ServiceRequest for CodecConnectorServiceRequest {
9621    type Service = CodecConnectorServiceMarker;
9622
9623    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9624        match name {
9625            "codec_connector" => Self::CodecConnector(
9626                <CodecConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
9627                    _channel,
9628                ),
9629            ),
9630            _ => panic!("no such member protocol name for service CodecConnectorService"),
9631        }
9632    }
9633
9634    fn member_names() -> &'static [&'static str] {
9635        &["codec_connector"]
9636    }
9637}
9638/// # Deprecation
9639///
9640/// Not supported anymore, instead use an
9641/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9642/// with one DAI and no Ring Buffer, see
9643/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9644#[cfg(target_os = "fuchsia")]
9645pub struct CodecConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9646
9647#[cfg(target_os = "fuchsia")]
9648impl fidl::endpoints::ServiceProxy for CodecConnectorServiceProxy {
9649    type Service = CodecConnectorServiceMarker;
9650
9651    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9652        Self(opener)
9653    }
9654}
9655
9656#[cfg(target_os = "fuchsia")]
9657impl CodecConnectorServiceProxy {
9658    pub fn connect_to_codec_connector(&self) -> Result<CodecConnectorProxy, fidl::Error> {
9659        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecConnectorMarker>();
9660        self.connect_channel_to_codec_connector(server_end)?;
9661        Ok(proxy)
9662    }
9663
9664    /// Like `connect_to_codec_connector`, but returns a sync proxy.
9665    /// See [`Self::connect_to_codec_connector`] for more details.
9666    pub fn connect_to_codec_connector_sync(
9667        &self,
9668    ) -> Result<CodecConnectorSynchronousProxy, fidl::Error> {
9669        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecConnectorMarker>();
9670        self.connect_channel_to_codec_connector(server_end)?;
9671        Ok(proxy)
9672    }
9673
9674    /// Like `connect_to_codec_connector`, but accepts a server end.
9675    /// See [`Self::connect_to_codec_connector`] for more details.
9676    pub fn connect_channel_to_codec_connector(
9677        &self,
9678        server_end: fidl::endpoints::ServerEnd<CodecConnectorMarker>,
9679    ) -> Result<(), fidl::Error> {
9680        self.0.open_member("codec_connector", server_end.into_channel())
9681    }
9682
9683    pub fn instance_name(&self) -> &str {
9684        self.0.instance_name()
9685    }
9686}
9687
9688#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9689pub struct CodecServiceMarker;
9690
9691#[cfg(target_os = "fuchsia")]
9692impl fidl::endpoints::ServiceMarker for CodecServiceMarker {
9693    type Proxy = CodecServiceProxy;
9694    type Request = CodecServiceRequest;
9695    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecService";
9696}
9697
9698/// A request for one of the member protocols of CodecService.
9699///
9700/// # Deprecation
9701///
9702/// Not supported anymore, instead use an
9703/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9704/// with one DAI and no Ring Buffer, see
9705/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9706#[cfg(target_os = "fuchsia")]
9707pub enum CodecServiceRequest {
9708    Codec(CodecRequestStream),
9709}
9710
9711#[cfg(target_os = "fuchsia")]
9712impl fidl::endpoints::ServiceRequest for CodecServiceRequest {
9713    type Service = CodecServiceMarker;
9714
9715    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9716        match name {
9717            "codec" => Self::Codec(
9718                <CodecRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
9719            ),
9720            _ => panic!("no such member protocol name for service CodecService"),
9721        }
9722    }
9723
9724    fn member_names() -> &'static [&'static str] {
9725        &["codec"]
9726    }
9727}
9728/// # Deprecation
9729///
9730/// Not supported anymore, instead use an
9731/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9732/// with one DAI and no Ring Buffer, see
9733/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9734#[cfg(target_os = "fuchsia")]
9735pub struct CodecServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9736
9737#[cfg(target_os = "fuchsia")]
9738impl fidl::endpoints::ServiceProxy for CodecServiceProxy {
9739    type Service = CodecServiceMarker;
9740
9741    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9742        Self(opener)
9743    }
9744}
9745
9746#[cfg(target_os = "fuchsia")]
9747impl CodecServiceProxy {
9748    pub fn connect_to_codec(&self) -> Result<CodecProxy, fidl::Error> {
9749        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecMarker>();
9750        self.connect_channel_to_codec(server_end)?;
9751        Ok(proxy)
9752    }
9753
9754    /// Like `connect_to_codec`, but returns a sync proxy.
9755    /// See [`Self::connect_to_codec`] for more details.
9756    pub fn connect_to_codec_sync(&self) -> Result<CodecSynchronousProxy, fidl::Error> {
9757        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecMarker>();
9758        self.connect_channel_to_codec(server_end)?;
9759        Ok(proxy)
9760    }
9761
9762    /// Like `connect_to_codec`, but accepts a server end.
9763    /// See [`Self::connect_to_codec`] for more details.
9764    pub fn connect_channel_to_codec(
9765        &self,
9766        server_end: fidl::endpoints::ServerEnd<CodecMarker>,
9767    ) -> Result<(), fidl::Error> {
9768        self.0.open_member("codec", server_end.into_channel())
9769    }
9770
9771    pub fn instance_name(&self) -> &str {
9772        self.0.instance_name()
9773    }
9774}
9775
9776#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9777pub struct CompositeConnectorServiceMarker;
9778
9779#[cfg(target_os = "fuchsia")]
9780impl fidl::endpoints::ServiceMarker for CompositeConnectorServiceMarker {
9781    type Proxy = CompositeConnectorServiceProxy;
9782    type Request = CompositeConnectorServiceRequest;
9783    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CompositeConnectorService";
9784}
9785
9786/// A request for one of the member protocols of CompositeConnectorService.
9787///
9788#[cfg(target_os = "fuchsia")]
9789pub enum CompositeConnectorServiceRequest {
9790    CompositeConnector(CompositeConnectorRequestStream),
9791}
9792
9793#[cfg(target_os = "fuchsia")]
9794impl fidl::endpoints::ServiceRequest for CompositeConnectorServiceRequest {
9795    type Service = CompositeConnectorServiceMarker;
9796
9797    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9798        match name {
9799            "composite_connector" => Self::CompositeConnector(
9800                <CompositeConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
9801                    _channel,
9802                ),
9803            ),
9804            _ => panic!("no such member protocol name for service CompositeConnectorService"),
9805        }
9806    }
9807
9808    fn member_names() -> &'static [&'static str] {
9809        &["composite_connector"]
9810    }
9811}
9812#[cfg(target_os = "fuchsia")]
9813pub struct CompositeConnectorServiceProxy(
9814    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
9815);
9816
9817#[cfg(target_os = "fuchsia")]
9818impl fidl::endpoints::ServiceProxy for CompositeConnectorServiceProxy {
9819    type Service = CompositeConnectorServiceMarker;
9820
9821    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9822        Self(opener)
9823    }
9824}
9825
9826#[cfg(target_os = "fuchsia")]
9827impl CompositeConnectorServiceProxy {
9828    pub fn connect_to_composite_connector(&self) -> Result<CompositeConnectorProxy, fidl::Error> {
9829        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeConnectorMarker>();
9830        self.connect_channel_to_composite_connector(server_end)?;
9831        Ok(proxy)
9832    }
9833
9834    /// Like `connect_to_composite_connector`, but returns a sync proxy.
9835    /// See [`Self::connect_to_composite_connector`] for more details.
9836    pub fn connect_to_composite_connector_sync(
9837        &self,
9838    ) -> Result<CompositeConnectorSynchronousProxy, fidl::Error> {
9839        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeConnectorMarker>();
9840        self.connect_channel_to_composite_connector(server_end)?;
9841        Ok(proxy)
9842    }
9843
9844    /// Like `connect_to_composite_connector`, but accepts a server end.
9845    /// See [`Self::connect_to_composite_connector`] for more details.
9846    pub fn connect_channel_to_composite_connector(
9847        &self,
9848        server_end: fidl::endpoints::ServerEnd<CompositeConnectorMarker>,
9849    ) -> Result<(), fidl::Error> {
9850        self.0.open_member("composite_connector", server_end.into_channel())
9851    }
9852
9853    pub fn instance_name(&self) -> &str {
9854        self.0.instance_name()
9855    }
9856}
9857
9858#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9859pub struct DaiConnectorServiceMarker;
9860
9861#[cfg(target_os = "fuchsia")]
9862impl fidl::endpoints::ServiceMarker for DaiConnectorServiceMarker {
9863    type Proxy = DaiConnectorServiceProxy;
9864    type Request = DaiConnectorServiceRequest;
9865    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiConnectorService";
9866}
9867
9868/// A request for one of the member protocols of DaiConnectorService.
9869///
9870/// # Deprecation
9871///
9872/// Not supported anymore, instead use an
9873/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9874/// with one DAI and one Ring Buffer, see
9875/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9876#[cfg(target_os = "fuchsia")]
9877pub enum DaiConnectorServiceRequest {
9878    DaiConnector(DaiConnectorRequestStream),
9879}
9880
9881#[cfg(target_os = "fuchsia")]
9882impl fidl::endpoints::ServiceRequest for DaiConnectorServiceRequest {
9883    type Service = DaiConnectorServiceMarker;
9884
9885    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9886        match name {
9887            "dai_connector" => Self::DaiConnector(
9888                <DaiConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
9889                    _channel,
9890                ),
9891            ),
9892            _ => panic!("no such member protocol name for service DaiConnectorService"),
9893        }
9894    }
9895
9896    fn member_names() -> &'static [&'static str] {
9897        &["dai_connector"]
9898    }
9899}
9900/// # Deprecation
9901///
9902/// Not supported anymore, instead use an
9903/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9904/// with one DAI and one Ring Buffer, see
9905/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9906#[cfg(target_os = "fuchsia")]
9907pub struct DaiConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9908
9909#[cfg(target_os = "fuchsia")]
9910impl fidl::endpoints::ServiceProxy for DaiConnectorServiceProxy {
9911    type Service = DaiConnectorServiceMarker;
9912
9913    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9914        Self(opener)
9915    }
9916}
9917
9918#[cfg(target_os = "fuchsia")]
9919impl DaiConnectorServiceProxy {
9920    pub fn connect_to_dai_connector(&self) -> Result<DaiConnectorProxy, fidl::Error> {
9921        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiConnectorMarker>();
9922        self.connect_channel_to_dai_connector(server_end)?;
9923        Ok(proxy)
9924    }
9925
9926    /// Like `connect_to_dai_connector`, but returns a sync proxy.
9927    /// See [`Self::connect_to_dai_connector`] for more details.
9928    pub fn connect_to_dai_connector_sync(
9929        &self,
9930    ) -> Result<DaiConnectorSynchronousProxy, fidl::Error> {
9931        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiConnectorMarker>();
9932        self.connect_channel_to_dai_connector(server_end)?;
9933        Ok(proxy)
9934    }
9935
9936    /// Like `connect_to_dai_connector`, but accepts a server end.
9937    /// See [`Self::connect_to_dai_connector`] for more details.
9938    pub fn connect_channel_to_dai_connector(
9939        &self,
9940        server_end: fidl::endpoints::ServerEnd<DaiConnectorMarker>,
9941    ) -> Result<(), fidl::Error> {
9942        self.0.open_member("dai_connector", server_end.into_channel())
9943    }
9944
9945    pub fn instance_name(&self) -> &str {
9946        self.0.instance_name()
9947    }
9948}
9949
9950#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9951pub struct DaiServiceMarker;
9952
9953#[cfg(target_os = "fuchsia")]
9954impl fidl::endpoints::ServiceMarker for DaiServiceMarker {
9955    type Proxy = DaiServiceProxy;
9956    type Request = DaiServiceRequest;
9957    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiService";
9958}
9959
9960/// A request for one of the member protocols of DaiService.
9961///
9962/// # Deprecation
9963///
9964/// Not supported anymore, instead use an
9965/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9966/// with one DAI and one Ring Buffer, see
9967/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9968#[cfg(target_os = "fuchsia")]
9969pub enum DaiServiceRequest {
9970    Dai(DaiRequestStream),
9971}
9972
9973#[cfg(target_os = "fuchsia")]
9974impl fidl::endpoints::ServiceRequest for DaiServiceRequest {
9975    type Service = DaiServiceMarker;
9976
9977    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9978        match name {
9979            "dai" => Self::Dai(<DaiRequestStream as fidl::endpoints::RequestStream>::from_channel(
9980                _channel,
9981            )),
9982            _ => panic!("no such member protocol name for service DaiService"),
9983        }
9984    }
9985
9986    fn member_names() -> &'static [&'static str] {
9987        &["dai"]
9988    }
9989}
9990/// # Deprecation
9991///
9992/// Not supported anymore, instead use an
9993/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9994/// with one DAI and one Ring Buffer, see
9995/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9996#[cfg(target_os = "fuchsia")]
9997pub struct DaiServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9998
9999#[cfg(target_os = "fuchsia")]
10000impl fidl::endpoints::ServiceProxy for DaiServiceProxy {
10001    type Service = DaiServiceMarker;
10002
10003    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10004        Self(opener)
10005    }
10006}
10007
10008#[cfg(target_os = "fuchsia")]
10009impl DaiServiceProxy {
10010    pub fn connect_to_dai(&self) -> Result<DaiProxy, fidl::Error> {
10011        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiMarker>();
10012        self.connect_channel_to_dai(server_end)?;
10013        Ok(proxy)
10014    }
10015
10016    /// Like `connect_to_dai`, but returns a sync proxy.
10017    /// See [`Self::connect_to_dai`] for more details.
10018    pub fn connect_to_dai_sync(&self) -> Result<DaiSynchronousProxy, fidl::Error> {
10019        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiMarker>();
10020        self.connect_channel_to_dai(server_end)?;
10021        Ok(proxy)
10022    }
10023
10024    /// Like `connect_to_dai`, but accepts a server end.
10025    /// See [`Self::connect_to_dai`] for more details.
10026    pub fn connect_channel_to_dai(
10027        &self,
10028        server_end: fidl::endpoints::ServerEnd<DaiMarker>,
10029    ) -> Result<(), fidl::Error> {
10030        self.0.open_member("dai", server_end.into_channel())
10031    }
10032
10033    pub fn instance_name(&self) -> &str {
10034        self.0.instance_name()
10035    }
10036}
10037
10038#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10039pub struct DeviceServiceMarker;
10040
10041#[cfg(target_os = "fuchsia")]
10042impl fidl::endpoints::ServiceMarker for DeviceServiceMarker {
10043    type Proxy = DeviceServiceProxy;
10044    type Request = DeviceServiceRequest;
10045    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DeviceService";
10046}
10047
10048/// A request for one of the member protocols of DeviceService.
10049///
10050#[cfg(target_os = "fuchsia")]
10051pub enum DeviceServiceRequest {
10052    Device(CompositeRequestStream),
10053}
10054
10055#[cfg(target_os = "fuchsia")]
10056impl fidl::endpoints::ServiceRequest for DeviceServiceRequest {
10057    type Service = DeviceServiceMarker;
10058
10059    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10060        match name {
10061            "device" => Self::Device(
10062                <CompositeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10063            ),
10064            _ => panic!("no such member protocol name for service DeviceService"),
10065        }
10066    }
10067
10068    fn member_names() -> &'static [&'static str] {
10069        &["device"]
10070    }
10071}
10072#[cfg(target_os = "fuchsia")]
10073pub struct DeviceServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
10074
10075#[cfg(target_os = "fuchsia")]
10076impl fidl::endpoints::ServiceProxy for DeviceServiceProxy {
10077    type Service = DeviceServiceMarker;
10078
10079    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10080        Self(opener)
10081    }
10082}
10083
10084#[cfg(target_os = "fuchsia")]
10085impl DeviceServiceProxy {
10086    pub fn connect_to_device(&self) -> Result<CompositeProxy, fidl::Error> {
10087        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeMarker>();
10088        self.connect_channel_to_device(server_end)?;
10089        Ok(proxy)
10090    }
10091
10092    /// Like `connect_to_device`, but returns a sync proxy.
10093    /// See [`Self::connect_to_device`] for more details.
10094    pub fn connect_to_device_sync(&self) -> Result<CompositeSynchronousProxy, fidl::Error> {
10095        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeMarker>();
10096        self.connect_channel_to_device(server_end)?;
10097        Ok(proxy)
10098    }
10099
10100    /// Like `connect_to_device`, but accepts a server end.
10101    /// See [`Self::connect_to_device`] for more details.
10102    pub fn connect_channel_to_device(
10103        &self,
10104        server_end: fidl::endpoints::ServerEnd<CompositeMarker>,
10105    ) -> Result<(), fidl::Error> {
10106        self.0.open_member("device", server_end.into_channel())
10107    }
10108
10109    pub fn instance_name(&self) -> &str {
10110        self.0.instance_name()
10111    }
10112}
10113
10114#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10115pub struct StreamConfigConnectorInputServiceMarker;
10116
10117#[cfg(target_os = "fuchsia")]
10118impl fidl::endpoints::ServiceMarker for StreamConfigConnectorInputServiceMarker {
10119    type Proxy = StreamConfigConnectorInputServiceProxy;
10120    type Request = StreamConfigConnectorInputServiceRequest;
10121    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorInputService";
10122}
10123
10124/// A request for one of the member protocols of StreamConfigConnectorInputService.
10125///
10126#[cfg(target_os = "fuchsia")]
10127pub enum StreamConfigConnectorInputServiceRequest {
10128    StreamConfigConnector(StreamConfigConnectorRequestStream),
10129}
10130
10131#[cfg(target_os = "fuchsia")]
10132impl fidl::endpoints::ServiceRequest for StreamConfigConnectorInputServiceRequest {
10133    type Service = StreamConfigConnectorInputServiceMarker;
10134
10135    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10136        match name {
10137            "stream_config_connector" => Self::StreamConfigConnector(
10138                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10139            ),
10140            _ => panic!("no such member protocol name for service StreamConfigConnectorInputService"),
10141        }
10142    }
10143
10144    fn member_names() -> &'static [&'static str] {
10145        &["stream_config_connector"]
10146    }
10147}
10148#[cfg(target_os = "fuchsia")]
10149pub struct StreamConfigConnectorInputServiceProxy(
10150    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10151);
10152
10153#[cfg(target_os = "fuchsia")]
10154impl fidl::endpoints::ServiceProxy for StreamConfigConnectorInputServiceProxy {
10155    type Service = StreamConfigConnectorInputServiceMarker;
10156
10157    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10158        Self(opener)
10159    }
10160}
10161
10162#[cfg(target_os = "fuchsia")]
10163impl StreamConfigConnectorInputServiceProxy {
10164    pub fn connect_to_stream_config_connector(
10165        &self,
10166    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10167        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10168        self.connect_channel_to_stream_config_connector(server_end)?;
10169        Ok(proxy)
10170    }
10171
10172    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10173    /// See [`Self::connect_to_stream_config_connector`] for more details.
10174    pub fn connect_to_stream_config_connector_sync(
10175        &self,
10176    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10177        let (proxy, server_end) =
10178            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10179        self.connect_channel_to_stream_config_connector(server_end)?;
10180        Ok(proxy)
10181    }
10182
10183    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10184    /// See [`Self::connect_to_stream_config_connector`] for more details.
10185    pub fn connect_channel_to_stream_config_connector(
10186        &self,
10187        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10188    ) -> Result<(), fidl::Error> {
10189        self.0.open_member("stream_config_connector", server_end.into_channel())
10190    }
10191
10192    pub fn instance_name(&self) -> &str {
10193        self.0.instance_name()
10194    }
10195}
10196
10197#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10198pub struct StreamConfigConnectorOutputServiceMarker;
10199
10200#[cfg(target_os = "fuchsia")]
10201impl fidl::endpoints::ServiceMarker for StreamConfigConnectorOutputServiceMarker {
10202    type Proxy = StreamConfigConnectorOutputServiceProxy;
10203    type Request = StreamConfigConnectorOutputServiceRequest;
10204    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorOutputService";
10205}
10206
10207/// A request for one of the member protocols of StreamConfigConnectorOutputService.
10208///
10209#[cfg(target_os = "fuchsia")]
10210pub enum StreamConfigConnectorOutputServiceRequest {
10211    StreamConfigConnector(StreamConfigConnectorRequestStream),
10212}
10213
10214#[cfg(target_os = "fuchsia")]
10215impl fidl::endpoints::ServiceRequest for StreamConfigConnectorOutputServiceRequest {
10216    type Service = StreamConfigConnectorOutputServiceMarker;
10217
10218    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10219        match name {
10220            "stream_config_connector" => Self::StreamConfigConnector(
10221                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10222            ),
10223            _ => panic!("no such member protocol name for service StreamConfigConnectorOutputService"),
10224        }
10225    }
10226
10227    fn member_names() -> &'static [&'static str] {
10228        &["stream_config_connector"]
10229    }
10230}
10231#[cfg(target_os = "fuchsia")]
10232pub struct StreamConfigConnectorOutputServiceProxy(
10233    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10234);
10235
10236#[cfg(target_os = "fuchsia")]
10237impl fidl::endpoints::ServiceProxy for StreamConfigConnectorOutputServiceProxy {
10238    type Service = StreamConfigConnectorOutputServiceMarker;
10239
10240    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10241        Self(opener)
10242    }
10243}
10244
10245#[cfg(target_os = "fuchsia")]
10246impl StreamConfigConnectorOutputServiceProxy {
10247    pub fn connect_to_stream_config_connector(
10248        &self,
10249    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10250        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10251        self.connect_channel_to_stream_config_connector(server_end)?;
10252        Ok(proxy)
10253    }
10254
10255    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10256    /// See [`Self::connect_to_stream_config_connector`] for more details.
10257    pub fn connect_to_stream_config_connector_sync(
10258        &self,
10259    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10260        let (proxy, server_end) =
10261            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10262        self.connect_channel_to_stream_config_connector(server_end)?;
10263        Ok(proxy)
10264    }
10265
10266    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10267    /// See [`Self::connect_to_stream_config_connector`] for more details.
10268    pub fn connect_channel_to_stream_config_connector(
10269        &self,
10270        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10271    ) -> Result<(), fidl::Error> {
10272        self.0.open_member("stream_config_connector", server_end.into_channel())
10273    }
10274
10275    pub fn instance_name(&self) -> &str {
10276        self.0.instance_name()
10277    }
10278}
10279
10280#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10281pub struct StreamConfigConnectorServiceMarker;
10282
10283#[cfg(target_os = "fuchsia")]
10284impl fidl::endpoints::ServiceMarker for StreamConfigConnectorServiceMarker {
10285    type Proxy = StreamConfigConnectorServiceProxy;
10286    type Request = StreamConfigConnectorServiceRequest;
10287    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorService";
10288}
10289
10290/// A request for one of the member protocols of StreamConfigConnectorService.
10291///
10292/// # Deprecation
10293///
10294/// Not supported anymore, instead use an
10295/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10296/// with one Ring Buffer, see
10297/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10298#[cfg(target_os = "fuchsia")]
10299pub enum StreamConfigConnectorServiceRequest {
10300    StreamConfigConnector(StreamConfigConnectorRequestStream),
10301}
10302
10303#[cfg(target_os = "fuchsia")]
10304impl fidl::endpoints::ServiceRequest for StreamConfigConnectorServiceRequest {
10305    type Service = StreamConfigConnectorServiceMarker;
10306
10307    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10308        match name {
10309            "stream_config_connector" => Self::StreamConfigConnector(
10310                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10311            ),
10312            _ => panic!("no such member protocol name for service StreamConfigConnectorService"),
10313        }
10314    }
10315
10316    fn member_names() -> &'static [&'static str] {
10317        &["stream_config_connector"]
10318    }
10319}
10320/// # Deprecation
10321///
10322/// Not supported anymore, instead use an
10323/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10324/// with one Ring Buffer, see
10325/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10326#[cfg(target_os = "fuchsia")]
10327pub struct StreamConfigConnectorServiceProxy(
10328    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10329);
10330
10331#[cfg(target_os = "fuchsia")]
10332impl fidl::endpoints::ServiceProxy for StreamConfigConnectorServiceProxy {
10333    type Service = StreamConfigConnectorServiceMarker;
10334
10335    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10336        Self(opener)
10337    }
10338}
10339
10340#[cfg(target_os = "fuchsia")]
10341impl StreamConfigConnectorServiceProxy {
10342    pub fn connect_to_stream_config_connector(
10343        &self,
10344    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10345        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10346        self.connect_channel_to_stream_config_connector(server_end)?;
10347        Ok(proxy)
10348    }
10349
10350    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10351    /// See [`Self::connect_to_stream_config_connector`] for more details.
10352    pub fn connect_to_stream_config_connector_sync(
10353        &self,
10354    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10355        let (proxy, server_end) =
10356            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10357        self.connect_channel_to_stream_config_connector(server_end)?;
10358        Ok(proxy)
10359    }
10360
10361    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10362    /// See [`Self::connect_to_stream_config_connector`] for more details.
10363    pub fn connect_channel_to_stream_config_connector(
10364        &self,
10365        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10366    ) -> Result<(), fidl::Error> {
10367        self.0.open_member("stream_config_connector", server_end.into_channel())
10368    }
10369
10370    pub fn instance_name(&self) -> &str {
10371        self.0.instance_name()
10372    }
10373}
10374
10375#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10376pub struct StreamConfigServiceMarker;
10377
10378#[cfg(target_os = "fuchsia")]
10379impl fidl::endpoints::ServiceMarker for StreamConfigServiceMarker {
10380    type Proxy = StreamConfigServiceProxy;
10381    type Request = StreamConfigServiceRequest;
10382    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigService";
10383}
10384
10385/// A request for one of the member protocols of StreamConfigService.
10386///
10387/// # Deprecation
10388///
10389/// Not supported anymore, instead use an
10390/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10391/// with one Ring Buffer, see
10392/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10393#[cfg(target_os = "fuchsia")]
10394pub enum StreamConfigServiceRequest {
10395    StreamConfig(StreamConfigRequestStream),
10396}
10397
10398#[cfg(target_os = "fuchsia")]
10399impl fidl::endpoints::ServiceRequest for StreamConfigServiceRequest {
10400    type Service = StreamConfigServiceMarker;
10401
10402    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10403        match name {
10404            "stream_config" => Self::StreamConfig(
10405                <StreamConfigRequestStream as fidl::endpoints::RequestStream>::from_channel(
10406                    _channel,
10407                ),
10408            ),
10409            _ => panic!("no such member protocol name for service StreamConfigService"),
10410        }
10411    }
10412
10413    fn member_names() -> &'static [&'static str] {
10414        &["stream_config"]
10415    }
10416}
10417/// # Deprecation
10418///
10419/// Not supported anymore, instead use an
10420/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10421/// with one Ring Buffer, see
10422/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10423#[cfg(target_os = "fuchsia")]
10424pub struct StreamConfigServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
10425
10426#[cfg(target_os = "fuchsia")]
10427impl fidl::endpoints::ServiceProxy for StreamConfigServiceProxy {
10428    type Service = StreamConfigServiceMarker;
10429
10430    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10431        Self(opener)
10432    }
10433}
10434
10435#[cfg(target_os = "fuchsia")]
10436impl StreamConfigServiceProxy {
10437    pub fn connect_to_stream_config(&self) -> Result<StreamConfigProxy, fidl::Error> {
10438        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigMarker>();
10439        self.connect_channel_to_stream_config(server_end)?;
10440        Ok(proxy)
10441    }
10442
10443    /// Like `connect_to_stream_config`, but returns a sync proxy.
10444    /// See [`Self::connect_to_stream_config`] for more details.
10445    pub fn connect_to_stream_config_sync(
10446        &self,
10447    ) -> Result<StreamConfigSynchronousProxy, fidl::Error> {
10448        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<StreamConfigMarker>();
10449        self.connect_channel_to_stream_config(server_end)?;
10450        Ok(proxy)
10451    }
10452
10453    /// Like `connect_to_stream_config`, but accepts a server end.
10454    /// See [`Self::connect_to_stream_config`] for more details.
10455    pub fn connect_channel_to_stream_config(
10456        &self,
10457        server_end: fidl::endpoints::ServerEnd<StreamConfigMarker>,
10458    ) -> Result<(), fidl::Error> {
10459        self.0.open_member("stream_config", server_end.into_channel())
10460    }
10461
10462    pub fn instance_name(&self) -> &str {
10463        self.0.instance_name()
10464    }
10465}
10466
10467mod internal {
10468    use super::*;
10469
10470    impl fidl::encoding::ResourceTypeMarker for CodecConnectorConnectRequest {
10471        type Borrowed<'a> = &'a mut Self;
10472        fn take_or_borrow<'a>(
10473            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10474        ) -> Self::Borrowed<'a> {
10475            value
10476        }
10477    }
10478
10479    unsafe impl fidl::encoding::TypeMarker for CodecConnectorConnectRequest {
10480        type Owned = Self;
10481
10482        #[inline(always)]
10483        fn inline_align(_context: fidl::encoding::Context) -> usize {
10484            4
10485        }
10486
10487        #[inline(always)]
10488        fn inline_size(_context: fidl::encoding::Context) -> usize {
10489            4
10490        }
10491    }
10492
10493    unsafe impl
10494        fidl::encoding::Encode<
10495            CodecConnectorConnectRequest,
10496            fidl::encoding::DefaultFuchsiaResourceDialect,
10497        > for &mut CodecConnectorConnectRequest
10498    {
10499        #[inline]
10500        unsafe fn encode(
10501            self,
10502            encoder: &mut fidl::encoding::Encoder<
10503                '_,
10504                fidl::encoding::DefaultFuchsiaResourceDialect,
10505            >,
10506            offset: usize,
10507            _depth: fidl::encoding::Depth,
10508        ) -> fidl::Result<()> {
10509            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10510            // Delegate to tuple encoding.
10511            fidl::encoding::Encode::<CodecConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10512                (
10513                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.codec_protocol),
10514                ),
10515                encoder, offset, _depth
10516            )
10517        }
10518    }
10519    unsafe impl<
10520        T0: fidl::encoding::Encode<
10521                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10522                fidl::encoding::DefaultFuchsiaResourceDialect,
10523            >,
10524    >
10525        fidl::encoding::Encode<
10526            CodecConnectorConnectRequest,
10527            fidl::encoding::DefaultFuchsiaResourceDialect,
10528        > for (T0,)
10529    {
10530        #[inline]
10531        unsafe fn encode(
10532            self,
10533            encoder: &mut fidl::encoding::Encoder<
10534                '_,
10535                fidl::encoding::DefaultFuchsiaResourceDialect,
10536            >,
10537            offset: usize,
10538            depth: fidl::encoding::Depth,
10539        ) -> fidl::Result<()> {
10540            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10541            // Zero out padding regions. There's no need to apply masks
10542            // because the unmasked parts will be overwritten by fields.
10543            // Write the fields.
10544            self.0.encode(encoder, offset + 0, depth)?;
10545            Ok(())
10546        }
10547    }
10548
10549    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10550        for CodecConnectorConnectRequest
10551    {
10552        #[inline(always)]
10553        fn new_empty() -> Self {
10554            Self {
10555                codec_protocol: fidl::new_empty!(
10556                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10557                    fidl::encoding::DefaultFuchsiaResourceDialect
10558                ),
10559            }
10560        }
10561
10562        #[inline]
10563        unsafe fn decode(
10564            &mut self,
10565            decoder: &mut fidl::encoding::Decoder<
10566                '_,
10567                fidl::encoding::DefaultFuchsiaResourceDialect,
10568            >,
10569            offset: usize,
10570            _depth: fidl::encoding::Depth,
10571        ) -> fidl::Result<()> {
10572            decoder.debug_check_bounds::<Self>(offset);
10573            // Verify that padding bytes are zero.
10574            fidl::decode!(
10575                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10576                fidl::encoding::DefaultFuchsiaResourceDialect,
10577                &mut self.codec_protocol,
10578                decoder,
10579                offset + 0,
10580                _depth
10581            )?;
10582            Ok(())
10583        }
10584    }
10585
10586    impl fidl::encoding::ResourceTypeMarker for CompositeConnectorConnectRequest {
10587        type Borrowed<'a> = &'a mut Self;
10588        fn take_or_borrow<'a>(
10589            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10590        ) -> Self::Borrowed<'a> {
10591            value
10592        }
10593    }
10594
10595    unsafe impl fidl::encoding::TypeMarker for CompositeConnectorConnectRequest {
10596        type Owned = Self;
10597
10598        #[inline(always)]
10599        fn inline_align(_context: fidl::encoding::Context) -> usize {
10600            4
10601        }
10602
10603        #[inline(always)]
10604        fn inline_size(_context: fidl::encoding::Context) -> usize {
10605            4
10606        }
10607    }
10608
10609    unsafe impl
10610        fidl::encoding::Encode<
10611            CompositeConnectorConnectRequest,
10612            fidl::encoding::DefaultFuchsiaResourceDialect,
10613        > for &mut CompositeConnectorConnectRequest
10614    {
10615        #[inline]
10616        unsafe fn encode(
10617            self,
10618            encoder: &mut fidl::encoding::Encoder<
10619                '_,
10620                fidl::encoding::DefaultFuchsiaResourceDialect,
10621            >,
10622            offset: usize,
10623            _depth: fidl::encoding::Depth,
10624        ) -> fidl::Result<()> {
10625            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
10626            // Delegate to tuple encoding.
10627            fidl::encoding::Encode::<CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10628                (
10629                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.composite_protocol),
10630                ),
10631                encoder, offset, _depth
10632            )
10633        }
10634    }
10635    unsafe impl<
10636        T0: fidl::encoding::Encode<
10637                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10638                fidl::encoding::DefaultFuchsiaResourceDialect,
10639            >,
10640    >
10641        fidl::encoding::Encode<
10642            CompositeConnectorConnectRequest,
10643            fidl::encoding::DefaultFuchsiaResourceDialect,
10644        > for (T0,)
10645    {
10646        #[inline]
10647        unsafe fn encode(
10648            self,
10649            encoder: &mut fidl::encoding::Encoder<
10650                '_,
10651                fidl::encoding::DefaultFuchsiaResourceDialect,
10652            >,
10653            offset: usize,
10654            depth: fidl::encoding::Depth,
10655        ) -> fidl::Result<()> {
10656            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
10657            // Zero out padding regions. There's no need to apply masks
10658            // because the unmasked parts will be overwritten by fields.
10659            // Write the fields.
10660            self.0.encode(encoder, offset + 0, depth)?;
10661            Ok(())
10662        }
10663    }
10664
10665    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10666        for CompositeConnectorConnectRequest
10667    {
10668        #[inline(always)]
10669        fn new_empty() -> Self {
10670            Self {
10671                composite_protocol: fidl::new_empty!(
10672                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10673                    fidl::encoding::DefaultFuchsiaResourceDialect
10674                ),
10675            }
10676        }
10677
10678        #[inline]
10679        unsafe fn decode(
10680            &mut self,
10681            decoder: &mut fidl::encoding::Decoder<
10682                '_,
10683                fidl::encoding::DefaultFuchsiaResourceDialect,
10684            >,
10685            offset: usize,
10686            _depth: fidl::encoding::Depth,
10687        ) -> fidl::Result<()> {
10688            decoder.debug_check_bounds::<Self>(offset);
10689            // Verify that padding bytes are zero.
10690            fidl::decode!(
10691                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10692                fidl::encoding::DefaultFuchsiaResourceDialect,
10693                &mut self.composite_protocol,
10694                decoder,
10695                offset + 0,
10696                _depth
10697            )?;
10698            Ok(())
10699        }
10700    }
10701
10702    impl fidl::encoding::ResourceTypeMarker for CompositeCreateRingBufferRequest {
10703        type Borrowed<'a> = &'a mut Self;
10704        fn take_or_borrow<'a>(
10705            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10706        ) -> Self::Borrowed<'a> {
10707            value
10708        }
10709    }
10710
10711    unsafe impl fidl::encoding::TypeMarker for CompositeCreateRingBufferRequest {
10712        type Owned = Self;
10713
10714        #[inline(always)]
10715        fn inline_align(_context: fidl::encoding::Context) -> usize {
10716            8
10717        }
10718
10719        #[inline(always)]
10720        fn inline_size(_context: fidl::encoding::Context) -> usize {
10721            32
10722        }
10723    }
10724
10725    unsafe impl
10726        fidl::encoding::Encode<
10727            CompositeCreateRingBufferRequest,
10728            fidl::encoding::DefaultFuchsiaResourceDialect,
10729        > for &mut CompositeCreateRingBufferRequest
10730    {
10731        #[inline]
10732        unsafe fn encode(
10733            self,
10734            encoder: &mut fidl::encoding::Encoder<
10735                '_,
10736                fidl::encoding::DefaultFuchsiaResourceDialect,
10737            >,
10738            offset: usize,
10739            _depth: fidl::encoding::Depth,
10740        ) -> fidl::Result<()> {
10741            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
10742            // Delegate to tuple encoding.
10743            fidl::encoding::Encode::<CompositeCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10744                (
10745                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
10746                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
10747                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
10748                ),
10749                encoder, offset, _depth
10750            )
10751        }
10752    }
10753    unsafe impl<
10754        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
10755        T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
10756        T2: fidl::encoding::Encode<
10757                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
10758                fidl::encoding::DefaultFuchsiaResourceDialect,
10759            >,
10760    >
10761        fidl::encoding::Encode<
10762            CompositeCreateRingBufferRequest,
10763            fidl::encoding::DefaultFuchsiaResourceDialect,
10764        > for (T0, T1, T2)
10765    {
10766        #[inline]
10767        unsafe fn encode(
10768            self,
10769            encoder: &mut fidl::encoding::Encoder<
10770                '_,
10771                fidl::encoding::DefaultFuchsiaResourceDialect,
10772            >,
10773            offset: usize,
10774            depth: fidl::encoding::Depth,
10775        ) -> fidl::Result<()> {
10776            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
10777            // Zero out padding regions. There's no need to apply masks
10778            // because the unmasked parts will be overwritten by fields.
10779            unsafe {
10780                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
10781                (ptr as *mut u64).write_unaligned(0);
10782            }
10783            // Write the fields.
10784            self.0.encode(encoder, offset + 0, depth)?;
10785            self.1.encode(encoder, offset + 8, depth)?;
10786            self.2.encode(encoder, offset + 24, depth)?;
10787            Ok(())
10788        }
10789    }
10790
10791    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10792        for CompositeCreateRingBufferRequest
10793    {
10794        #[inline(always)]
10795        fn new_empty() -> Self {
10796            Self {
10797                processing_element_id: fidl::new_empty!(
10798                    u64,
10799                    fidl::encoding::DefaultFuchsiaResourceDialect
10800                ),
10801                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
10802                ring_buffer: fidl::new_empty!(
10803                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
10804                    fidl::encoding::DefaultFuchsiaResourceDialect
10805                ),
10806            }
10807        }
10808
10809        #[inline]
10810        unsafe fn decode(
10811            &mut self,
10812            decoder: &mut fidl::encoding::Decoder<
10813                '_,
10814                fidl::encoding::DefaultFuchsiaResourceDialect,
10815            >,
10816            offset: usize,
10817            _depth: fidl::encoding::Depth,
10818        ) -> fidl::Result<()> {
10819            decoder.debug_check_bounds::<Self>(offset);
10820            // Verify that padding bytes are zero.
10821            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
10822            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10823            let mask = 0xffffffff00000000u64;
10824            let maskedval = padval & mask;
10825            if maskedval != 0 {
10826                return Err(fidl::Error::NonZeroPadding {
10827                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
10828                });
10829            }
10830            fidl::decode!(
10831                u64,
10832                fidl::encoding::DefaultFuchsiaResourceDialect,
10833                &mut self.processing_element_id,
10834                decoder,
10835                offset + 0,
10836                _depth
10837            )?;
10838            fidl::decode!(
10839                Format,
10840                fidl::encoding::DefaultFuchsiaResourceDialect,
10841                &mut self.format,
10842                decoder,
10843                offset + 8,
10844                _depth
10845            )?;
10846            fidl::decode!(
10847                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
10848                fidl::encoding::DefaultFuchsiaResourceDialect,
10849                &mut self.ring_buffer,
10850                decoder,
10851                offset + 24,
10852                _depth
10853            )?;
10854            Ok(())
10855        }
10856    }
10857
10858    impl fidl::encoding::ResourceTypeMarker for DaiConnectorConnectRequest {
10859        type Borrowed<'a> = &'a mut Self;
10860        fn take_or_borrow<'a>(
10861            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10862        ) -> Self::Borrowed<'a> {
10863            value
10864        }
10865    }
10866
10867    unsafe impl fidl::encoding::TypeMarker for DaiConnectorConnectRequest {
10868        type Owned = Self;
10869
10870        #[inline(always)]
10871        fn inline_align(_context: fidl::encoding::Context) -> usize {
10872            4
10873        }
10874
10875        #[inline(always)]
10876        fn inline_size(_context: fidl::encoding::Context) -> usize {
10877            4
10878        }
10879    }
10880
10881    unsafe impl
10882        fidl::encoding::Encode<
10883            DaiConnectorConnectRequest,
10884            fidl::encoding::DefaultFuchsiaResourceDialect,
10885        > for &mut DaiConnectorConnectRequest
10886    {
10887        #[inline]
10888        unsafe fn encode(
10889            self,
10890            encoder: &mut fidl::encoding::Encoder<
10891                '_,
10892                fidl::encoding::DefaultFuchsiaResourceDialect,
10893            >,
10894            offset: usize,
10895            _depth: fidl::encoding::Depth,
10896        ) -> fidl::Result<()> {
10897            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
10898            // Delegate to tuple encoding.
10899            fidl::encoding::Encode::<DaiConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10900                (
10901                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dai_protocol),
10902                ),
10903                encoder, offset, _depth
10904            )
10905        }
10906    }
10907    unsafe impl<
10908        T0: fidl::encoding::Encode<
10909                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
10910                fidl::encoding::DefaultFuchsiaResourceDialect,
10911            >,
10912    >
10913        fidl::encoding::Encode<
10914            DaiConnectorConnectRequest,
10915            fidl::encoding::DefaultFuchsiaResourceDialect,
10916        > for (T0,)
10917    {
10918        #[inline]
10919        unsafe fn encode(
10920            self,
10921            encoder: &mut fidl::encoding::Encoder<
10922                '_,
10923                fidl::encoding::DefaultFuchsiaResourceDialect,
10924            >,
10925            offset: usize,
10926            depth: fidl::encoding::Depth,
10927        ) -> fidl::Result<()> {
10928            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
10929            // Zero out padding regions. There's no need to apply masks
10930            // because the unmasked parts will be overwritten by fields.
10931            // Write the fields.
10932            self.0.encode(encoder, offset + 0, depth)?;
10933            Ok(())
10934        }
10935    }
10936
10937    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10938        for DaiConnectorConnectRequest
10939    {
10940        #[inline(always)]
10941        fn new_empty() -> Self {
10942            Self {
10943                dai_protocol: fidl::new_empty!(
10944                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
10945                    fidl::encoding::DefaultFuchsiaResourceDialect
10946                ),
10947            }
10948        }
10949
10950        #[inline]
10951        unsafe fn decode(
10952            &mut self,
10953            decoder: &mut fidl::encoding::Decoder<
10954                '_,
10955                fidl::encoding::DefaultFuchsiaResourceDialect,
10956            >,
10957            offset: usize,
10958            _depth: fidl::encoding::Depth,
10959        ) -> fidl::Result<()> {
10960            decoder.debug_check_bounds::<Self>(offset);
10961            // Verify that padding bytes are zero.
10962            fidl::decode!(
10963                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
10964                fidl::encoding::DefaultFuchsiaResourceDialect,
10965                &mut self.dai_protocol,
10966                decoder,
10967                offset + 0,
10968                _depth
10969            )?;
10970            Ok(())
10971        }
10972    }
10973
10974    impl fidl::encoding::ResourceTypeMarker for DaiCreateRingBufferRequest {
10975        type Borrowed<'a> = &'a mut Self;
10976        fn take_or_borrow<'a>(
10977            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10978        ) -> Self::Borrowed<'a> {
10979            value
10980        }
10981    }
10982
10983    unsafe impl fidl::encoding::TypeMarker for DaiCreateRingBufferRequest {
10984        type Owned = Self;
10985
10986        #[inline(always)]
10987        fn inline_align(_context: fidl::encoding::Context) -> usize {
10988            8
10989        }
10990
10991        #[inline(always)]
10992        fn inline_size(_context: fidl::encoding::Context) -> usize {
10993            72
10994        }
10995    }
10996
10997    unsafe impl
10998        fidl::encoding::Encode<
10999            DaiCreateRingBufferRequest,
11000            fidl::encoding::DefaultFuchsiaResourceDialect,
11001        > for &mut DaiCreateRingBufferRequest
11002    {
11003        #[inline]
11004        unsafe fn encode(
11005            self,
11006            encoder: &mut fidl::encoding::Encoder<
11007                '_,
11008                fidl::encoding::DefaultFuchsiaResourceDialect,
11009            >,
11010            offset: usize,
11011            _depth: fidl::encoding::Depth,
11012        ) -> fidl::Result<()> {
11013            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11014            // Delegate to tuple encoding.
11015            fidl::encoding::Encode::<DaiCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11016                (
11017                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_format),
11018                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_format),
11019                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11020                ),
11021                encoder, offset, _depth
11022            )
11023        }
11024    }
11025    unsafe impl<
11026        T0: fidl::encoding::Encode<DaiFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
11027        T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
11028        T2: fidl::encoding::Encode<
11029                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11030                fidl::encoding::DefaultFuchsiaResourceDialect,
11031            >,
11032    >
11033        fidl::encoding::Encode<
11034            DaiCreateRingBufferRequest,
11035            fidl::encoding::DefaultFuchsiaResourceDialect,
11036        > for (T0, T1, T2)
11037    {
11038        #[inline]
11039        unsafe fn encode(
11040            self,
11041            encoder: &mut fidl::encoding::Encoder<
11042                '_,
11043                fidl::encoding::DefaultFuchsiaResourceDialect,
11044            >,
11045            offset: usize,
11046            depth: fidl::encoding::Depth,
11047        ) -> fidl::Result<()> {
11048            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11049            // Zero out padding regions. There's no need to apply masks
11050            // because the unmasked parts will be overwritten by fields.
11051            unsafe {
11052                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
11053                (ptr as *mut u64).write_unaligned(0);
11054            }
11055            // Write the fields.
11056            self.0.encode(encoder, offset + 0, depth)?;
11057            self.1.encode(encoder, offset + 48, depth)?;
11058            self.2.encode(encoder, offset + 64, depth)?;
11059            Ok(())
11060        }
11061    }
11062
11063    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11064        for DaiCreateRingBufferRequest
11065    {
11066        #[inline(always)]
11067        fn new_empty() -> Self {
11068            Self {
11069                dai_format: fidl::new_empty!(
11070                    DaiFormat,
11071                    fidl::encoding::DefaultFuchsiaResourceDialect
11072                ),
11073                ring_buffer_format: fidl::new_empty!(
11074                    Format,
11075                    fidl::encoding::DefaultFuchsiaResourceDialect
11076                ),
11077                ring_buffer: fidl::new_empty!(
11078                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11079                    fidl::encoding::DefaultFuchsiaResourceDialect
11080                ),
11081            }
11082        }
11083
11084        #[inline]
11085        unsafe fn decode(
11086            &mut self,
11087            decoder: &mut fidl::encoding::Decoder<
11088                '_,
11089                fidl::encoding::DefaultFuchsiaResourceDialect,
11090            >,
11091            offset: usize,
11092            _depth: fidl::encoding::Depth,
11093        ) -> fidl::Result<()> {
11094            decoder.debug_check_bounds::<Self>(offset);
11095            // Verify that padding bytes are zero.
11096            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
11097            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11098            let mask = 0xffffffff00000000u64;
11099            let maskedval = padval & mask;
11100            if maskedval != 0 {
11101                return Err(fidl::Error::NonZeroPadding {
11102                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
11103                });
11104            }
11105            fidl::decode!(
11106                DaiFormat,
11107                fidl::encoding::DefaultFuchsiaResourceDialect,
11108                &mut self.dai_format,
11109                decoder,
11110                offset + 0,
11111                _depth
11112            )?;
11113            fidl::decode!(
11114                Format,
11115                fidl::encoding::DefaultFuchsiaResourceDialect,
11116                &mut self.ring_buffer_format,
11117                decoder,
11118                offset + 48,
11119                _depth
11120            )?;
11121            fidl::decode!(
11122                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11123                fidl::encoding::DefaultFuchsiaResourceDialect,
11124                &mut self.ring_buffer,
11125                decoder,
11126                offset + 64,
11127                _depth
11128            )?;
11129            Ok(())
11130        }
11131    }
11132
11133    impl fidl::encoding::ResourceTypeMarker for RingBufferGetVmoResponse {
11134        type Borrowed<'a> = &'a mut Self;
11135        fn take_or_borrow<'a>(
11136            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11137        ) -> Self::Borrowed<'a> {
11138            value
11139        }
11140    }
11141
11142    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoResponse {
11143        type Owned = Self;
11144
11145        #[inline(always)]
11146        fn inline_align(_context: fidl::encoding::Context) -> usize {
11147            4
11148        }
11149
11150        #[inline(always)]
11151        fn inline_size(_context: fidl::encoding::Context) -> usize {
11152            8
11153        }
11154    }
11155
11156    unsafe impl
11157        fidl::encoding::Encode<
11158            RingBufferGetVmoResponse,
11159            fidl::encoding::DefaultFuchsiaResourceDialect,
11160        > for &mut RingBufferGetVmoResponse
11161    {
11162        #[inline]
11163        unsafe fn encode(
11164            self,
11165            encoder: &mut fidl::encoding::Encoder<
11166                '_,
11167                fidl::encoding::DefaultFuchsiaResourceDialect,
11168            >,
11169            offset: usize,
11170            _depth: fidl::encoding::Depth,
11171        ) -> fidl::Result<()> {
11172            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11173            // Delegate to tuple encoding.
11174            fidl::encoding::Encode::<
11175                RingBufferGetVmoResponse,
11176                fidl::encoding::DefaultFuchsiaResourceDialect,
11177            >::encode(
11178                (
11179                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_frames),
11180                    <fidl::encoding::HandleType<
11181                        fidl::Vmo,
11182                        { fidl::ObjectType::VMO.into_raw() },
11183                        2147483648,
11184                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11185                        &mut self.ring_buffer
11186                    ),
11187                ),
11188                encoder,
11189                offset,
11190                _depth,
11191            )
11192        }
11193    }
11194    unsafe impl<
11195        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11196        T1: fidl::encoding::Encode<
11197                fidl::encoding::HandleType<
11198                    fidl::Vmo,
11199                    { fidl::ObjectType::VMO.into_raw() },
11200                    2147483648,
11201                >,
11202                fidl::encoding::DefaultFuchsiaResourceDialect,
11203            >,
11204    >
11205        fidl::encoding::Encode<
11206            RingBufferGetVmoResponse,
11207            fidl::encoding::DefaultFuchsiaResourceDialect,
11208        > for (T0, T1)
11209    {
11210        #[inline]
11211        unsafe fn encode(
11212            self,
11213            encoder: &mut fidl::encoding::Encoder<
11214                '_,
11215                fidl::encoding::DefaultFuchsiaResourceDialect,
11216            >,
11217            offset: usize,
11218            depth: fidl::encoding::Depth,
11219        ) -> fidl::Result<()> {
11220            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11221            // Zero out padding regions. There's no need to apply masks
11222            // because the unmasked parts will be overwritten by fields.
11223            // Write the fields.
11224            self.0.encode(encoder, offset + 0, depth)?;
11225            self.1.encode(encoder, offset + 4, depth)?;
11226            Ok(())
11227        }
11228    }
11229
11230    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11231        for RingBufferGetVmoResponse
11232    {
11233        #[inline(always)]
11234        fn new_empty() -> Self {
11235            Self {
11236                num_frames: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11237                ring_buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11238            }
11239        }
11240
11241        #[inline]
11242        unsafe fn decode(
11243            &mut self,
11244            decoder: &mut fidl::encoding::Decoder<
11245                '_,
11246                fidl::encoding::DefaultFuchsiaResourceDialect,
11247            >,
11248            offset: usize,
11249            _depth: fidl::encoding::Depth,
11250        ) -> fidl::Result<()> {
11251            decoder.debug_check_bounds::<Self>(offset);
11252            // Verify that padding bytes are zero.
11253            fidl::decode!(
11254                u32,
11255                fidl::encoding::DefaultFuchsiaResourceDialect,
11256                &mut self.num_frames,
11257                decoder,
11258                offset + 0,
11259                _depth
11260            )?;
11261            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.ring_buffer, decoder, offset + 4, _depth)?;
11262            Ok(())
11263        }
11264    }
11265
11266    impl fidl::encoding::ResourceTypeMarker for StreamConfigConnectorConnectRequest {
11267        type Borrowed<'a> = &'a mut Self;
11268        fn take_or_borrow<'a>(
11269            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11270        ) -> Self::Borrowed<'a> {
11271            value
11272        }
11273    }
11274
11275    unsafe impl fidl::encoding::TypeMarker for StreamConfigConnectorConnectRequest {
11276        type Owned = Self;
11277
11278        #[inline(always)]
11279        fn inline_align(_context: fidl::encoding::Context) -> usize {
11280            4
11281        }
11282
11283        #[inline(always)]
11284        fn inline_size(_context: fidl::encoding::Context) -> usize {
11285            4
11286        }
11287    }
11288
11289    unsafe impl
11290        fidl::encoding::Encode<
11291            StreamConfigConnectorConnectRequest,
11292            fidl::encoding::DefaultFuchsiaResourceDialect,
11293        > for &mut StreamConfigConnectorConnectRequest
11294    {
11295        #[inline]
11296        unsafe fn encode(
11297            self,
11298            encoder: &mut fidl::encoding::Encoder<
11299                '_,
11300                fidl::encoding::DefaultFuchsiaResourceDialect,
11301            >,
11302            offset: usize,
11303            _depth: fidl::encoding::Depth,
11304        ) -> fidl::Result<()> {
11305            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11306            // Delegate to tuple encoding.
11307            fidl::encoding::Encode::<StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11308                (
11309                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
11310                ),
11311                encoder, offset, _depth
11312            )
11313        }
11314    }
11315    unsafe impl<
11316        T0: fidl::encoding::Encode<
11317                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11318                fidl::encoding::DefaultFuchsiaResourceDialect,
11319            >,
11320    >
11321        fidl::encoding::Encode<
11322            StreamConfigConnectorConnectRequest,
11323            fidl::encoding::DefaultFuchsiaResourceDialect,
11324        > for (T0,)
11325    {
11326        #[inline]
11327        unsafe fn encode(
11328            self,
11329            encoder: &mut fidl::encoding::Encoder<
11330                '_,
11331                fidl::encoding::DefaultFuchsiaResourceDialect,
11332            >,
11333            offset: usize,
11334            depth: fidl::encoding::Depth,
11335        ) -> fidl::Result<()> {
11336            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11337            // Zero out padding regions. There's no need to apply masks
11338            // because the unmasked parts will be overwritten by fields.
11339            // Write the fields.
11340            self.0.encode(encoder, offset + 0, depth)?;
11341            Ok(())
11342        }
11343    }
11344
11345    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11346        for StreamConfigConnectorConnectRequest
11347    {
11348        #[inline(always)]
11349        fn new_empty() -> Self {
11350            Self {
11351                protocol: fidl::new_empty!(
11352                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11353                    fidl::encoding::DefaultFuchsiaResourceDialect
11354                ),
11355            }
11356        }
11357
11358        #[inline]
11359        unsafe fn decode(
11360            &mut self,
11361            decoder: &mut fidl::encoding::Decoder<
11362                '_,
11363                fidl::encoding::DefaultFuchsiaResourceDialect,
11364            >,
11365            offset: usize,
11366            _depth: fidl::encoding::Depth,
11367        ) -> fidl::Result<()> {
11368            decoder.debug_check_bounds::<Self>(offset);
11369            // Verify that padding bytes are zero.
11370            fidl::decode!(
11371                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11372                fidl::encoding::DefaultFuchsiaResourceDialect,
11373                &mut self.protocol,
11374                decoder,
11375                offset + 0,
11376                _depth
11377            )?;
11378            Ok(())
11379        }
11380    }
11381
11382    impl fidl::encoding::ResourceTypeMarker for StreamConfigCreateRingBufferRequest {
11383        type Borrowed<'a> = &'a mut Self;
11384        fn take_or_borrow<'a>(
11385            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11386        ) -> Self::Borrowed<'a> {
11387            value
11388        }
11389    }
11390
11391    unsafe impl fidl::encoding::TypeMarker for StreamConfigCreateRingBufferRequest {
11392        type Owned = Self;
11393
11394        #[inline(always)]
11395        fn inline_align(_context: fidl::encoding::Context) -> usize {
11396            8
11397        }
11398
11399        #[inline(always)]
11400        fn inline_size(_context: fidl::encoding::Context) -> usize {
11401            24
11402        }
11403    }
11404
11405    unsafe impl
11406        fidl::encoding::Encode<
11407            StreamConfigCreateRingBufferRequest,
11408            fidl::encoding::DefaultFuchsiaResourceDialect,
11409        > for &mut StreamConfigCreateRingBufferRequest
11410    {
11411        #[inline]
11412        unsafe fn encode(
11413            self,
11414            encoder: &mut fidl::encoding::Encoder<
11415                '_,
11416                fidl::encoding::DefaultFuchsiaResourceDialect,
11417            >,
11418            offset: usize,
11419            _depth: fidl::encoding::Depth,
11420        ) -> fidl::Result<()> {
11421            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
11422            // Delegate to tuple encoding.
11423            fidl::encoding::Encode::<StreamConfigCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11424                (
11425                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
11426                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11427                ),
11428                encoder, offset, _depth
11429            )
11430        }
11431    }
11432    unsafe impl<
11433        T0: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
11434        T1: fidl::encoding::Encode<
11435                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11436                fidl::encoding::DefaultFuchsiaResourceDialect,
11437            >,
11438    >
11439        fidl::encoding::Encode<
11440            StreamConfigCreateRingBufferRequest,
11441            fidl::encoding::DefaultFuchsiaResourceDialect,
11442        > for (T0, T1)
11443    {
11444        #[inline]
11445        unsafe fn encode(
11446            self,
11447            encoder: &mut fidl::encoding::Encoder<
11448                '_,
11449                fidl::encoding::DefaultFuchsiaResourceDialect,
11450            >,
11451            offset: usize,
11452            depth: fidl::encoding::Depth,
11453        ) -> fidl::Result<()> {
11454            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
11455            // Zero out padding regions. There's no need to apply masks
11456            // because the unmasked parts will be overwritten by fields.
11457            unsafe {
11458                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11459                (ptr as *mut u64).write_unaligned(0);
11460            }
11461            // Write the fields.
11462            self.0.encode(encoder, offset + 0, depth)?;
11463            self.1.encode(encoder, offset + 16, depth)?;
11464            Ok(())
11465        }
11466    }
11467
11468    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11469        for StreamConfigCreateRingBufferRequest
11470    {
11471        #[inline(always)]
11472        fn new_empty() -> Self {
11473            Self {
11474                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
11475                ring_buffer: fidl::new_empty!(
11476                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11477                    fidl::encoding::DefaultFuchsiaResourceDialect
11478                ),
11479            }
11480        }
11481
11482        #[inline]
11483        unsafe fn decode(
11484            &mut self,
11485            decoder: &mut fidl::encoding::Decoder<
11486                '_,
11487                fidl::encoding::DefaultFuchsiaResourceDialect,
11488            >,
11489            offset: usize,
11490            _depth: fidl::encoding::Depth,
11491        ) -> fidl::Result<()> {
11492            decoder.debug_check_bounds::<Self>(offset);
11493            // Verify that padding bytes are zero.
11494            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11495            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11496            let mask = 0xffffffff00000000u64;
11497            let maskedval = padval & mask;
11498            if maskedval != 0 {
11499                return Err(fidl::Error::NonZeroPadding {
11500                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11501                });
11502            }
11503            fidl::decode!(
11504                Format,
11505                fidl::encoding::DefaultFuchsiaResourceDialect,
11506                &mut self.format,
11507                decoder,
11508                offset + 0,
11509                _depth
11510            )?;
11511            fidl::decode!(
11512                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11513                fidl::encoding::DefaultFuchsiaResourceDialect,
11514                &mut self.ring_buffer,
11515                decoder,
11516                offset + 16,
11517                _depth
11518            )?;
11519            Ok(())
11520        }
11521    }
11522}