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 {
1051            Some((responder))
1052        } else {
1053            None
1054        }
1055    }
1056
1057    #[allow(irrefutable_let_patterns)]
1058    pub fn into_signal_processing_connect(
1059        self,
1060    ) -> Option<(
1061        fidl::endpoints::ServerEnd<
1062            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1063        >,
1064        CodecControlHandle,
1065    )> {
1066        if let CodecRequest::SignalProcessingConnect { protocol, control_handle } = self {
1067            Some((protocol, control_handle))
1068        } else {
1069            None
1070        }
1071    }
1072
1073    #[allow(irrefutable_let_patterns)]
1074    pub fn into_reset(self) -> Option<(CodecResetResponder)> {
1075        if let CodecRequest::Reset { responder } = self {
1076            Some((responder))
1077        } else {
1078            None
1079        }
1080    }
1081
1082    #[allow(irrefutable_let_patterns)]
1083    pub fn into_get_properties(self) -> Option<(CodecGetPropertiesResponder)> {
1084        if let CodecRequest::GetProperties { responder } = self {
1085            Some((responder))
1086        } else {
1087            None
1088        }
1089    }
1090
1091    #[allow(irrefutable_let_patterns)]
1092    pub fn into_stop(self) -> Option<(CodecStopResponder)> {
1093        if let CodecRequest::Stop { responder } = self {
1094            Some((responder))
1095        } else {
1096            None
1097        }
1098    }
1099
1100    #[allow(irrefutable_let_patterns)]
1101    pub fn into_start(self) -> Option<(CodecStartResponder)> {
1102        if let CodecRequest::Start { responder } = self {
1103            Some((responder))
1104        } else {
1105            None
1106        }
1107    }
1108
1109    #[allow(irrefutable_let_patterns)]
1110    pub fn into_get_dai_formats(self) -> Option<(CodecGetDaiFormatsResponder)> {
1111        if let CodecRequest::GetDaiFormats { responder } = self {
1112            Some((responder))
1113        } else {
1114            None
1115        }
1116    }
1117
1118    #[allow(irrefutable_let_patterns)]
1119    pub fn into_set_dai_format(self) -> Option<(DaiFormat, CodecSetDaiFormatResponder)> {
1120        if let CodecRequest::SetDaiFormat { format, responder } = self {
1121            Some((format, responder))
1122        } else {
1123            None
1124        }
1125    }
1126
1127    #[allow(irrefutable_let_patterns)]
1128    pub fn into_watch_plug_state(self) -> Option<(CodecWatchPlugStateResponder)> {
1129        if let CodecRequest::WatchPlugState { responder } = self {
1130            Some((responder))
1131        } else {
1132            None
1133        }
1134    }
1135
1136    /// Name of the method defined in FIDL
1137    pub fn method_name(&self) -> &'static str {
1138        match *self {
1139            CodecRequest::GetHealthState { .. } => "get_health_state",
1140            CodecRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
1141            CodecRequest::Reset { .. } => "reset",
1142            CodecRequest::GetProperties { .. } => "get_properties",
1143            CodecRequest::Stop { .. } => "stop",
1144            CodecRequest::Start { .. } => "start",
1145            CodecRequest::GetDaiFormats { .. } => "get_dai_formats",
1146            CodecRequest::SetDaiFormat { .. } => "set_dai_format",
1147            CodecRequest::WatchPlugState { .. } => "watch_plug_state",
1148        }
1149    }
1150}
1151
1152#[derive(Debug, Clone)]
1153pub struct CodecControlHandle {
1154    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1155}
1156
1157impl fidl::endpoints::ControlHandle for CodecControlHandle {
1158    fn shutdown(&self) {
1159        self.inner.shutdown()
1160    }
1161    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1162        self.inner.shutdown_with_epitaph(status)
1163    }
1164
1165    fn is_closed(&self) -> bool {
1166        self.inner.channel().is_closed()
1167    }
1168    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1169        self.inner.channel().on_closed()
1170    }
1171
1172    #[cfg(target_os = "fuchsia")]
1173    fn signal_peer(
1174        &self,
1175        clear_mask: zx::Signals,
1176        set_mask: zx::Signals,
1177    ) -> Result<(), zx_status::Status> {
1178        use fidl::Peered;
1179        self.inner.channel().signal_peer(clear_mask, set_mask)
1180    }
1181}
1182
1183impl CodecControlHandle {}
1184
1185#[must_use = "FIDL methods require a response to be sent"]
1186#[derive(Debug)]
1187pub struct CodecGetHealthStateResponder {
1188    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1189    tx_id: u32,
1190}
1191
1192/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1193/// if the responder is dropped without sending a response, so that the client
1194/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1195impl std::ops::Drop for CodecGetHealthStateResponder {
1196    fn drop(&mut self) {
1197        self.control_handle.shutdown();
1198        // Safety: drops once, never accessed again
1199        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1200    }
1201}
1202
1203impl fidl::endpoints::Responder for CodecGetHealthStateResponder {
1204    type ControlHandle = CodecControlHandle;
1205
1206    fn control_handle(&self) -> &CodecControlHandle {
1207        &self.control_handle
1208    }
1209
1210    fn drop_without_shutdown(mut self) {
1211        // Safety: drops once, never accessed again due to mem::forget
1212        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1213        // Prevent Drop from running (which would shut down the channel)
1214        std::mem::forget(self);
1215    }
1216}
1217
1218impl CodecGetHealthStateResponder {
1219    /// Sends a response to the FIDL transaction.
1220    ///
1221    /// Sets the channel to shutdown if an error occurs.
1222    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1223        let _result = self.send_raw(state);
1224        if _result.is_err() {
1225            self.control_handle.shutdown();
1226        }
1227        self.drop_without_shutdown();
1228        _result
1229    }
1230
1231    /// Similar to "send" but does not shutdown the channel if an error occurs.
1232    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1233        let _result = self.send_raw(state);
1234        self.drop_without_shutdown();
1235        _result
1236    }
1237
1238    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
1239        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
1240            (state,),
1241            self.tx_id,
1242            0x4e146d6bca733a84,
1243            fidl::encoding::DynamicFlags::empty(),
1244        )
1245    }
1246}
1247
1248#[must_use = "FIDL methods require a response to be sent"]
1249#[derive(Debug)]
1250pub struct CodecResetResponder {
1251    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1252    tx_id: u32,
1253}
1254
1255/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1256/// if the responder is dropped without sending a response, so that the client
1257/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1258impl std::ops::Drop for CodecResetResponder {
1259    fn drop(&mut self) {
1260        self.control_handle.shutdown();
1261        // Safety: drops once, never accessed again
1262        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1263    }
1264}
1265
1266impl fidl::endpoints::Responder for CodecResetResponder {
1267    type ControlHandle = CodecControlHandle;
1268
1269    fn control_handle(&self) -> &CodecControlHandle {
1270        &self.control_handle
1271    }
1272
1273    fn drop_without_shutdown(mut self) {
1274        // Safety: drops once, never accessed again due to mem::forget
1275        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1276        // Prevent Drop from running (which would shut down the channel)
1277        std::mem::forget(self);
1278    }
1279}
1280
1281impl CodecResetResponder {
1282    /// Sends a response to the FIDL transaction.
1283    ///
1284    /// Sets the channel to shutdown if an error occurs.
1285    pub fn send(self) -> Result<(), fidl::Error> {
1286        let _result = self.send_raw();
1287        if _result.is_err() {
1288            self.control_handle.shutdown();
1289        }
1290        self.drop_without_shutdown();
1291        _result
1292    }
1293
1294    /// Similar to "send" but does not shutdown the channel if an error occurs.
1295    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1296        let _result = self.send_raw();
1297        self.drop_without_shutdown();
1298        _result
1299    }
1300
1301    fn send_raw(&self) -> Result<(), fidl::Error> {
1302        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1303            (),
1304            self.tx_id,
1305            0x50757ae579a7bd6b,
1306            fidl::encoding::DynamicFlags::empty(),
1307        )
1308    }
1309}
1310
1311#[must_use = "FIDL methods require a response to be sent"]
1312#[derive(Debug)]
1313pub struct CodecGetPropertiesResponder {
1314    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1315    tx_id: u32,
1316}
1317
1318/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1319/// if the responder is dropped without sending a response, so that the client
1320/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1321impl std::ops::Drop for CodecGetPropertiesResponder {
1322    fn drop(&mut self) {
1323        self.control_handle.shutdown();
1324        // Safety: drops once, never accessed again
1325        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1326    }
1327}
1328
1329impl fidl::endpoints::Responder for CodecGetPropertiesResponder {
1330    type ControlHandle = CodecControlHandle;
1331
1332    fn control_handle(&self) -> &CodecControlHandle {
1333        &self.control_handle
1334    }
1335
1336    fn drop_without_shutdown(mut self) {
1337        // Safety: drops once, never accessed again due to mem::forget
1338        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1339        // Prevent Drop from running (which would shut down the channel)
1340        std::mem::forget(self);
1341    }
1342}
1343
1344impl CodecGetPropertiesResponder {
1345    /// Sends a response to the FIDL transaction.
1346    ///
1347    /// Sets the channel to shutdown if an error occurs.
1348    pub fn send(self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1349        let _result = self.send_raw(properties);
1350        if _result.is_err() {
1351            self.control_handle.shutdown();
1352        }
1353        self.drop_without_shutdown();
1354        _result
1355    }
1356
1357    /// Similar to "send" but does not shutdown the channel if an error occurs.
1358    pub fn send_no_shutdown_on_err(
1359        self,
1360        mut properties: &CodecProperties,
1361    ) -> Result<(), fidl::Error> {
1362        let _result = self.send_raw(properties);
1363        self.drop_without_shutdown();
1364        _result
1365    }
1366
1367    fn send_raw(&self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1368        self.control_handle.inner.send::<CodecGetPropertiesResponse>(
1369            (properties,),
1370            self.tx_id,
1371            0x7a0d138a6a1d9d90,
1372            fidl::encoding::DynamicFlags::empty(),
1373        )
1374    }
1375}
1376
1377#[must_use = "FIDL methods require a response to be sent"]
1378#[derive(Debug)]
1379pub struct CodecStopResponder {
1380    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1381    tx_id: u32,
1382}
1383
1384/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1385/// if the responder is dropped without sending a response, so that the client
1386/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1387impl std::ops::Drop for CodecStopResponder {
1388    fn drop(&mut self) {
1389        self.control_handle.shutdown();
1390        // Safety: drops once, never accessed again
1391        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1392    }
1393}
1394
1395impl fidl::endpoints::Responder for CodecStopResponder {
1396    type ControlHandle = CodecControlHandle;
1397
1398    fn control_handle(&self) -> &CodecControlHandle {
1399        &self.control_handle
1400    }
1401
1402    fn drop_without_shutdown(mut self) {
1403        // Safety: drops once, never accessed again due to mem::forget
1404        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1405        // Prevent Drop from running (which would shut down the channel)
1406        std::mem::forget(self);
1407    }
1408}
1409
1410impl CodecStopResponder {
1411    /// Sends a response to the FIDL transaction.
1412    ///
1413    /// Sets the channel to shutdown if an error occurs.
1414    pub fn send(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1415        let _result = self.send_raw(stop_time);
1416        if _result.is_err() {
1417            self.control_handle.shutdown();
1418        }
1419        self.drop_without_shutdown();
1420        _result
1421    }
1422
1423    /// Similar to "send" but does not shutdown the channel if an error occurs.
1424    pub fn send_no_shutdown_on_err(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1425        let _result = self.send_raw(stop_time);
1426        self.drop_without_shutdown();
1427        _result
1428    }
1429
1430    fn send_raw(&self, mut stop_time: i64) -> Result<(), fidl::Error> {
1431        self.control_handle.inner.send::<CodecStopResponse>(
1432            (stop_time,),
1433            self.tx_id,
1434            0x5c2e380df1332dbd,
1435            fidl::encoding::DynamicFlags::empty(),
1436        )
1437    }
1438}
1439
1440#[must_use = "FIDL methods require a response to be sent"]
1441#[derive(Debug)]
1442pub struct CodecStartResponder {
1443    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1444    tx_id: u32,
1445}
1446
1447/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1448/// if the responder is dropped without sending a response, so that the client
1449/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1450impl std::ops::Drop for CodecStartResponder {
1451    fn drop(&mut self) {
1452        self.control_handle.shutdown();
1453        // Safety: drops once, never accessed again
1454        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1455    }
1456}
1457
1458impl fidl::endpoints::Responder for CodecStartResponder {
1459    type ControlHandle = CodecControlHandle;
1460
1461    fn control_handle(&self) -> &CodecControlHandle {
1462        &self.control_handle
1463    }
1464
1465    fn drop_without_shutdown(mut self) {
1466        // Safety: drops once, never accessed again due to mem::forget
1467        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1468        // Prevent Drop from running (which would shut down the channel)
1469        std::mem::forget(self);
1470    }
1471}
1472
1473impl CodecStartResponder {
1474    /// Sends a response to the FIDL transaction.
1475    ///
1476    /// Sets the channel to shutdown if an error occurs.
1477    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
1478        let _result = self.send_raw(start_time);
1479        if _result.is_err() {
1480            self.control_handle.shutdown();
1481        }
1482        self.drop_without_shutdown();
1483        _result
1484    }
1485
1486    /// Similar to "send" but does not shutdown the channel if an error occurs.
1487    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
1488        let _result = self.send_raw(start_time);
1489        self.drop_without_shutdown();
1490        _result
1491    }
1492
1493    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
1494        self.control_handle.inner.send::<CodecStartResponse>(
1495            (start_time,),
1496            self.tx_id,
1497            0x329cdacb286ab00,
1498            fidl::encoding::DynamicFlags::empty(),
1499        )
1500    }
1501}
1502
1503#[must_use = "FIDL methods require a response to be sent"]
1504#[derive(Debug)]
1505pub struct CodecGetDaiFormatsResponder {
1506    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1507    tx_id: u32,
1508}
1509
1510/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1511/// if the responder is dropped without sending a response, so that the client
1512/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1513impl std::ops::Drop for CodecGetDaiFormatsResponder {
1514    fn drop(&mut self) {
1515        self.control_handle.shutdown();
1516        // Safety: drops once, never accessed again
1517        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1518    }
1519}
1520
1521impl fidl::endpoints::Responder for CodecGetDaiFormatsResponder {
1522    type ControlHandle = CodecControlHandle;
1523
1524    fn control_handle(&self) -> &CodecControlHandle {
1525        &self.control_handle
1526    }
1527
1528    fn drop_without_shutdown(mut self) {
1529        // Safety: drops once, never accessed again due to mem::forget
1530        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1531        // Prevent Drop from running (which would shut down the channel)
1532        std::mem::forget(self);
1533    }
1534}
1535
1536impl CodecGetDaiFormatsResponder {
1537    /// Sends a response to the FIDL transaction.
1538    ///
1539    /// Sets the channel to shutdown if an error occurs.
1540    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1541        let _result = self.send_raw(result);
1542        if _result.is_err() {
1543            self.control_handle.shutdown();
1544        }
1545        self.drop_without_shutdown();
1546        _result
1547    }
1548
1549    /// Similar to "send" but does not shutdown the channel if an error occurs.
1550    pub fn send_no_shutdown_on_err(
1551        self,
1552        mut result: Result<&[DaiSupportedFormats], i32>,
1553    ) -> Result<(), fidl::Error> {
1554        let _result = self.send_raw(result);
1555        self.drop_without_shutdown();
1556        _result
1557    }
1558
1559    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1560        self.control_handle
1561            .inner
1562            .send::<fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>>(
1563                result.map(|formats| (formats,)),
1564                self.tx_id,
1565                0xf8bbc46b4ba6a52,
1566                fidl::encoding::DynamicFlags::empty(),
1567            )
1568    }
1569}
1570
1571#[must_use = "FIDL methods require a response to be sent"]
1572#[derive(Debug)]
1573pub struct CodecSetDaiFormatResponder {
1574    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1575    tx_id: u32,
1576}
1577
1578/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1579/// if the responder is dropped without sending a response, so that the client
1580/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1581impl std::ops::Drop for CodecSetDaiFormatResponder {
1582    fn drop(&mut self) {
1583        self.control_handle.shutdown();
1584        // Safety: drops once, never accessed again
1585        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1586    }
1587}
1588
1589impl fidl::endpoints::Responder for CodecSetDaiFormatResponder {
1590    type ControlHandle = CodecControlHandle;
1591
1592    fn control_handle(&self) -> &CodecControlHandle {
1593        &self.control_handle
1594    }
1595
1596    fn drop_without_shutdown(mut self) {
1597        // Safety: drops once, never accessed again due to mem::forget
1598        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1599        // Prevent Drop from running (which would shut down the channel)
1600        std::mem::forget(self);
1601    }
1602}
1603
1604impl CodecSetDaiFormatResponder {
1605    /// Sends a response to the FIDL transaction.
1606    ///
1607    /// Sets the channel to shutdown if an error occurs.
1608    pub fn send(self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1609        let _result = self.send_raw(result);
1610        if _result.is_err() {
1611            self.control_handle.shutdown();
1612        }
1613        self.drop_without_shutdown();
1614        _result
1615    }
1616
1617    /// Similar to "send" but does not shutdown the channel if an error occurs.
1618    pub fn send_no_shutdown_on_err(
1619        self,
1620        mut result: Result<&CodecFormatInfo, i32>,
1621    ) -> Result<(), fidl::Error> {
1622        let _result = self.send_raw(result);
1623        self.drop_without_shutdown();
1624        _result
1625    }
1626
1627    fn send_raw(&self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1628        self.control_handle
1629            .inner
1630            .send::<fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>>(
1631                result.map(|state| (state,)),
1632                self.tx_id,
1633                0x2f829df9e5a7a1ea,
1634                fidl::encoding::DynamicFlags::empty(),
1635            )
1636    }
1637}
1638
1639#[must_use = "FIDL methods require a response to be sent"]
1640#[derive(Debug)]
1641pub struct CodecWatchPlugStateResponder {
1642    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1643    tx_id: u32,
1644}
1645
1646/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1647/// if the responder is dropped without sending a response, so that the client
1648/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1649impl std::ops::Drop for CodecWatchPlugStateResponder {
1650    fn drop(&mut self) {
1651        self.control_handle.shutdown();
1652        // Safety: drops once, never accessed again
1653        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1654    }
1655}
1656
1657impl fidl::endpoints::Responder for CodecWatchPlugStateResponder {
1658    type ControlHandle = CodecControlHandle;
1659
1660    fn control_handle(&self) -> &CodecControlHandle {
1661        &self.control_handle
1662    }
1663
1664    fn drop_without_shutdown(mut self) {
1665        // Safety: drops once, never accessed again due to mem::forget
1666        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1667        // Prevent Drop from running (which would shut down the channel)
1668        std::mem::forget(self);
1669    }
1670}
1671
1672impl CodecWatchPlugStateResponder {
1673    /// Sends a response to the FIDL transaction.
1674    ///
1675    /// Sets the channel to shutdown if an error occurs.
1676    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1677        let _result = self.send_raw(plug_state);
1678        if _result.is_err() {
1679            self.control_handle.shutdown();
1680        }
1681        self.drop_without_shutdown();
1682        _result
1683    }
1684
1685    /// Similar to "send" but does not shutdown the channel if an error occurs.
1686    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1687        let _result = self.send_raw(plug_state);
1688        self.drop_without_shutdown();
1689        _result
1690    }
1691
1692    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1693        self.control_handle.inner.send::<CodecWatchPlugStateResponse>(
1694            (plug_state,),
1695            self.tx_id,
1696            0x182b87f935ca7326,
1697            fidl::encoding::DynamicFlags::empty(),
1698        )
1699    }
1700}
1701
1702#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1703pub struct CodecConnectorMarker;
1704
1705impl fidl::endpoints::ProtocolMarker for CodecConnectorMarker {
1706    type Proxy = CodecConnectorProxy;
1707    type RequestStream = CodecConnectorRequestStream;
1708    #[cfg(target_os = "fuchsia")]
1709    type SynchronousProxy = CodecConnectorSynchronousProxy;
1710
1711    const DEBUG_NAME: &'static str = "(anonymous) CodecConnector";
1712}
1713
1714pub trait CodecConnectorProxyInterface: Send + Sync {
1715    fn r#connect(
1716        &self,
1717        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1718    ) -> Result<(), fidl::Error>;
1719}
1720#[derive(Debug)]
1721#[cfg(target_os = "fuchsia")]
1722pub struct CodecConnectorSynchronousProxy {
1723    client: fidl::client::sync::Client,
1724}
1725
1726#[cfg(target_os = "fuchsia")]
1727impl fidl::endpoints::SynchronousProxy for CodecConnectorSynchronousProxy {
1728    type Proxy = CodecConnectorProxy;
1729    type Protocol = CodecConnectorMarker;
1730
1731    fn from_channel(inner: fidl::Channel) -> Self {
1732        Self::new(inner)
1733    }
1734
1735    fn into_channel(self) -> fidl::Channel {
1736        self.client.into_channel()
1737    }
1738
1739    fn as_channel(&self) -> &fidl::Channel {
1740        self.client.as_channel()
1741    }
1742}
1743
1744#[cfg(target_os = "fuchsia")]
1745impl CodecConnectorSynchronousProxy {
1746    pub fn new(channel: fidl::Channel) -> Self {
1747        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1748        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1749    }
1750
1751    pub fn into_channel(self) -> fidl::Channel {
1752        self.client.into_channel()
1753    }
1754
1755    /// Waits until an event arrives and returns it. It is safe for other
1756    /// threads to make concurrent requests while waiting for an event.
1757    pub fn wait_for_event(
1758        &self,
1759        deadline: zx::MonotonicInstant,
1760    ) -> Result<CodecConnectorEvent, fidl::Error> {
1761        CodecConnectorEvent::decode(self.client.wait_for_event(deadline)?)
1762    }
1763
1764    /// Connect to a Codec protocol server.
1765    /// This indirection into the Codec protocol allows us to support independent codec client
1766    /// connections.
1767    pub fn r#connect(
1768        &self,
1769        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1770    ) -> Result<(), fidl::Error> {
1771        self.client.send::<CodecConnectorConnectRequest>(
1772            (codec_protocol,),
1773            0x1413f551544026c9,
1774            fidl::encoding::DynamicFlags::empty(),
1775        )
1776    }
1777}
1778
1779#[cfg(target_os = "fuchsia")]
1780impl From<CodecConnectorSynchronousProxy> for zx::Handle {
1781    fn from(value: CodecConnectorSynchronousProxy) -> Self {
1782        value.into_channel().into()
1783    }
1784}
1785
1786#[cfg(target_os = "fuchsia")]
1787impl From<fidl::Channel> for CodecConnectorSynchronousProxy {
1788    fn from(value: fidl::Channel) -> Self {
1789        Self::new(value)
1790    }
1791}
1792
1793#[cfg(target_os = "fuchsia")]
1794impl fidl::endpoints::FromClient for CodecConnectorSynchronousProxy {
1795    type Protocol = CodecConnectorMarker;
1796
1797    fn from_client(value: fidl::endpoints::ClientEnd<CodecConnectorMarker>) -> Self {
1798        Self::new(value.into_channel())
1799    }
1800}
1801
1802#[derive(Debug, Clone)]
1803pub struct CodecConnectorProxy {
1804    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1805}
1806
1807impl fidl::endpoints::Proxy for CodecConnectorProxy {
1808    type Protocol = CodecConnectorMarker;
1809
1810    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1811        Self::new(inner)
1812    }
1813
1814    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1815        self.client.into_channel().map_err(|client| Self { client })
1816    }
1817
1818    fn as_channel(&self) -> &::fidl::AsyncChannel {
1819        self.client.as_channel()
1820    }
1821}
1822
1823impl CodecConnectorProxy {
1824    /// Create a new Proxy for fuchsia.hardware.audio/CodecConnector.
1825    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1826        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1827        Self { client: fidl::client::Client::new(channel, protocol_name) }
1828    }
1829
1830    /// Get a Stream of events from the remote end of the protocol.
1831    ///
1832    /// # Panics
1833    ///
1834    /// Panics if the event stream was already taken.
1835    pub fn take_event_stream(&self) -> CodecConnectorEventStream {
1836        CodecConnectorEventStream { event_receiver: self.client.take_event_receiver() }
1837    }
1838
1839    /// Connect to a Codec protocol server.
1840    /// This indirection into the Codec protocol allows us to support independent codec client
1841    /// connections.
1842    pub fn r#connect(
1843        &self,
1844        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1845    ) -> Result<(), fidl::Error> {
1846        CodecConnectorProxyInterface::r#connect(self, codec_protocol)
1847    }
1848}
1849
1850impl CodecConnectorProxyInterface for CodecConnectorProxy {
1851    fn r#connect(
1852        &self,
1853        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1854    ) -> Result<(), fidl::Error> {
1855        self.client.send::<CodecConnectorConnectRequest>(
1856            (codec_protocol,),
1857            0x1413f551544026c9,
1858            fidl::encoding::DynamicFlags::empty(),
1859        )
1860    }
1861}
1862
1863pub struct CodecConnectorEventStream {
1864    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1865}
1866
1867impl std::marker::Unpin for CodecConnectorEventStream {}
1868
1869impl futures::stream::FusedStream for CodecConnectorEventStream {
1870    fn is_terminated(&self) -> bool {
1871        self.event_receiver.is_terminated()
1872    }
1873}
1874
1875impl futures::Stream for CodecConnectorEventStream {
1876    type Item = Result<CodecConnectorEvent, fidl::Error>;
1877
1878    fn poll_next(
1879        mut self: std::pin::Pin<&mut Self>,
1880        cx: &mut std::task::Context<'_>,
1881    ) -> std::task::Poll<Option<Self::Item>> {
1882        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1883            &mut self.event_receiver,
1884            cx
1885        )?) {
1886            Some(buf) => std::task::Poll::Ready(Some(CodecConnectorEvent::decode(buf))),
1887            None => std::task::Poll::Ready(None),
1888        }
1889    }
1890}
1891
1892#[derive(Debug)]
1893pub enum CodecConnectorEvent {}
1894
1895impl CodecConnectorEvent {
1896    /// Decodes a message buffer as a [`CodecConnectorEvent`].
1897    fn decode(
1898        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1899    ) -> Result<CodecConnectorEvent, fidl::Error> {
1900        let (bytes, _handles) = buf.split_mut();
1901        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1902        debug_assert_eq!(tx_header.tx_id, 0);
1903        match tx_header.ordinal {
1904            _ => Err(fidl::Error::UnknownOrdinal {
1905                ordinal: tx_header.ordinal,
1906                protocol_name:
1907                    <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1908            }),
1909        }
1910    }
1911}
1912
1913/// A Stream of incoming requests for fuchsia.hardware.audio/CodecConnector.
1914pub struct CodecConnectorRequestStream {
1915    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1916    is_terminated: bool,
1917}
1918
1919impl std::marker::Unpin for CodecConnectorRequestStream {}
1920
1921impl futures::stream::FusedStream for CodecConnectorRequestStream {
1922    fn is_terminated(&self) -> bool {
1923        self.is_terminated
1924    }
1925}
1926
1927impl fidl::endpoints::RequestStream for CodecConnectorRequestStream {
1928    type Protocol = CodecConnectorMarker;
1929    type ControlHandle = CodecConnectorControlHandle;
1930
1931    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1932        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1933    }
1934
1935    fn control_handle(&self) -> Self::ControlHandle {
1936        CodecConnectorControlHandle { inner: self.inner.clone() }
1937    }
1938
1939    fn into_inner(
1940        self,
1941    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1942    {
1943        (self.inner, self.is_terminated)
1944    }
1945
1946    fn from_inner(
1947        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1948        is_terminated: bool,
1949    ) -> Self {
1950        Self { inner, is_terminated }
1951    }
1952}
1953
1954impl futures::Stream for CodecConnectorRequestStream {
1955    type Item = Result<CodecConnectorRequest, fidl::Error>;
1956
1957    fn poll_next(
1958        mut self: std::pin::Pin<&mut Self>,
1959        cx: &mut std::task::Context<'_>,
1960    ) -> std::task::Poll<Option<Self::Item>> {
1961        let this = &mut *self;
1962        if this.inner.check_shutdown(cx) {
1963            this.is_terminated = true;
1964            return std::task::Poll::Ready(None);
1965        }
1966        if this.is_terminated {
1967            panic!("polled CodecConnectorRequestStream after completion");
1968        }
1969        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1970            |bytes, handles| {
1971                match this.inner.channel().read_etc(cx, bytes, handles) {
1972                    std::task::Poll::Ready(Ok(())) => {}
1973                    std::task::Poll::Pending => return std::task::Poll::Pending,
1974                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1975                        this.is_terminated = true;
1976                        return std::task::Poll::Ready(None);
1977                    }
1978                    std::task::Poll::Ready(Err(e)) => {
1979                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1980                            e.into(),
1981                        ))))
1982                    }
1983                }
1984
1985                // A message has been received from the channel
1986                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1987
1988                std::task::Poll::Ready(Some(match header.ordinal {
1989                    0x1413f551544026c9 => {
1990                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1991                        let mut req = fidl::new_empty!(
1992                            CodecConnectorConnectRequest,
1993                            fidl::encoding::DefaultFuchsiaResourceDialect
1994                        );
1995                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1996                        let control_handle =
1997                            CodecConnectorControlHandle { inner: this.inner.clone() };
1998                        Ok(CodecConnectorRequest::Connect {
1999                            codec_protocol: req.codec_protocol,
2000
2001                            control_handle,
2002                        })
2003                    }
2004                    _ => Err(fidl::Error::UnknownOrdinal {
2005                        ordinal: header.ordinal,
2006                        protocol_name:
2007                            <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2008                    }),
2009                }))
2010            },
2011        )
2012    }
2013}
2014
2015/// For an overview of the Codec protocols see
2016/// [Codec Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_codec.md)
2017/// # Deprecation
2018///
2019/// Not supported anymore, instead use an
2020/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
2021/// with one DAI and no Ring Buffer, see
2022/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
2023#[derive(Debug)]
2024pub enum CodecConnectorRequest {
2025    /// Connect to a Codec protocol server.
2026    /// This indirection into the Codec protocol allows us to support independent codec client
2027    /// connections.
2028    Connect {
2029        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2030        control_handle: CodecConnectorControlHandle,
2031    },
2032}
2033
2034impl CodecConnectorRequest {
2035    #[allow(irrefutable_let_patterns)]
2036    pub fn into_connect(
2037        self,
2038    ) -> Option<(fidl::endpoints::ServerEnd<CodecMarker>, CodecConnectorControlHandle)> {
2039        if let CodecConnectorRequest::Connect { codec_protocol, control_handle } = self {
2040            Some((codec_protocol, control_handle))
2041        } else {
2042            None
2043        }
2044    }
2045
2046    /// Name of the method defined in FIDL
2047    pub fn method_name(&self) -> &'static str {
2048        match *self {
2049            CodecConnectorRequest::Connect { .. } => "connect",
2050        }
2051    }
2052}
2053
2054#[derive(Debug, Clone)]
2055pub struct CodecConnectorControlHandle {
2056    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2057}
2058
2059impl fidl::endpoints::ControlHandle for CodecConnectorControlHandle {
2060    fn shutdown(&self) {
2061        self.inner.shutdown()
2062    }
2063    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2064        self.inner.shutdown_with_epitaph(status)
2065    }
2066
2067    fn is_closed(&self) -> bool {
2068        self.inner.channel().is_closed()
2069    }
2070    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2071        self.inner.channel().on_closed()
2072    }
2073
2074    #[cfg(target_os = "fuchsia")]
2075    fn signal_peer(
2076        &self,
2077        clear_mask: zx::Signals,
2078        set_mask: zx::Signals,
2079    ) -> Result<(), zx_status::Status> {
2080        use fidl::Peered;
2081        self.inner.channel().signal_peer(clear_mask, set_mask)
2082    }
2083}
2084
2085impl CodecConnectorControlHandle {}
2086
2087#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2088pub struct CompositeMarker;
2089
2090impl fidl::endpoints::ProtocolMarker for CompositeMarker {
2091    type Proxy = CompositeProxy;
2092    type RequestStream = CompositeRequestStream;
2093    #[cfg(target_os = "fuchsia")]
2094    type SynchronousProxy = CompositeSynchronousProxy;
2095
2096    const DEBUG_NAME: &'static str = "(anonymous) Composite";
2097}
2098pub type CompositeResetResult = Result<(), DriverError>;
2099pub type CompositeGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, DriverError>;
2100pub type CompositeCreateRingBufferResult = Result<(), DriverError>;
2101pub type CompositeGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, DriverError>;
2102pub type CompositeSetDaiFormatResult = Result<(), DriverError>;
2103
2104pub trait CompositeProxyInterface: Send + Sync {
2105    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
2106        + Send;
2107    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
2108    fn r#signal_processing_connect(
2109        &self,
2110        protocol: fidl::endpoints::ServerEnd<
2111            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2112        >,
2113    ) -> Result<(), fidl::Error>;
2114    type ResetResponseFut: std::future::Future<Output = Result<CompositeResetResult, fidl::Error>>
2115        + Send;
2116    fn r#reset(&self) -> Self::ResetResponseFut;
2117    type GetPropertiesResponseFut: std::future::Future<Output = Result<CompositeProperties, fidl::Error>>
2118        + Send;
2119    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
2120    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<CompositeGetRingBufferFormatsResult, fidl::Error>>
2121        + Send;
2122    fn r#get_ring_buffer_formats(
2123        &self,
2124        processing_element_id: u64,
2125    ) -> Self::GetRingBufferFormatsResponseFut;
2126    type CreateRingBufferResponseFut: std::future::Future<Output = Result<CompositeCreateRingBufferResult, fidl::Error>>
2127        + Send;
2128    fn r#create_ring_buffer(
2129        &self,
2130        processing_element_id: u64,
2131        format: &Format,
2132        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2133    ) -> Self::CreateRingBufferResponseFut;
2134    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CompositeGetDaiFormatsResult, fidl::Error>>
2135        + Send;
2136    fn r#get_dai_formats(&self, processing_element_id: u64) -> Self::GetDaiFormatsResponseFut;
2137    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CompositeSetDaiFormatResult, fidl::Error>>
2138        + Send;
2139    fn r#set_dai_format(
2140        &self,
2141        processing_element_id: u64,
2142        format: &DaiFormat,
2143    ) -> Self::SetDaiFormatResponseFut;
2144}
2145#[derive(Debug)]
2146#[cfg(target_os = "fuchsia")]
2147pub struct CompositeSynchronousProxy {
2148    client: fidl::client::sync::Client,
2149}
2150
2151#[cfg(target_os = "fuchsia")]
2152impl fidl::endpoints::SynchronousProxy for CompositeSynchronousProxy {
2153    type Proxy = CompositeProxy;
2154    type Protocol = CompositeMarker;
2155
2156    fn from_channel(inner: fidl::Channel) -> Self {
2157        Self::new(inner)
2158    }
2159
2160    fn into_channel(self) -> fidl::Channel {
2161        self.client.into_channel()
2162    }
2163
2164    fn as_channel(&self) -> &fidl::Channel {
2165        self.client.as_channel()
2166    }
2167}
2168
2169#[cfg(target_os = "fuchsia")]
2170impl CompositeSynchronousProxy {
2171    pub fn new(channel: fidl::Channel) -> Self {
2172        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2173        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2174    }
2175
2176    pub fn into_channel(self) -> fidl::Channel {
2177        self.client.into_channel()
2178    }
2179
2180    /// Waits until an event arrives and returns it. It is safe for other
2181    /// threads to make concurrent requests while waiting for an event.
2182    pub fn wait_for_event(
2183        &self,
2184        deadline: zx::MonotonicInstant,
2185    ) -> Result<CompositeEvent, fidl::Error> {
2186        CompositeEvent::decode(self.client.wait_for_event(deadline)?)
2187    }
2188
2189    /// Retrieves top level health state.
2190    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2191    pub fn r#get_health_state(
2192        &self,
2193        ___deadline: zx::MonotonicInstant,
2194    ) -> Result<HealthState, fidl::Error> {
2195        let _response =
2196            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
2197                (),
2198                0x4e146d6bca733a84,
2199                fidl::encoding::DynamicFlags::empty(),
2200                ___deadline,
2201            )?;
2202        Ok(_response.state)
2203    }
2204
2205    /// Connect to a `SignalProcessing` protocol.
2206    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2207    /// the maximum number of connections have already been created, for instance one, then the
2208    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2209    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2210    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2211    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2212    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2213    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2214    /// is intended to be composed, and hence the more verbose name allows differentiation and
2215    /// improved clarity.
2216    pub fn r#signal_processing_connect(
2217        &self,
2218        mut protocol: fidl::endpoints::ServerEnd<
2219            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2220        >,
2221    ) -> Result<(), fidl::Error> {
2222        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2223            (protocol,),
2224            0xa81907ce6066295,
2225            fidl::encoding::DynamicFlags::empty(),
2226        )
2227    }
2228
2229    /// Resets the hardware including all DAI interconnects and signal processing.
2230    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2231    ///
2232    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2233    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2234    /// any processing elements, and reconstruct any ring buffers.
2235    ///
2236    /// If the driver can't successfully reset the hardware, it will return an error and then close
2237    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2238    pub fn r#reset(
2239        &self,
2240        ___deadline: zx::MonotonicInstant,
2241    ) -> Result<CompositeResetResult, fidl::Error> {
2242        let _response = self.client.send_query::<
2243            fidl::encoding::EmptyPayload,
2244            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2245        >(
2246            (),
2247            0xac355fb98341996,
2248            fidl::encoding::DynamicFlags::empty(),
2249            ___deadline,
2250        )?;
2251        Ok(_response.map(|x| x))
2252    }
2253
2254    /// Retrieves top level static properties.
2255    pub fn r#get_properties(
2256        &self,
2257        ___deadline: zx::MonotonicInstant,
2258    ) -> Result<CompositeProperties, fidl::Error> {
2259        let _response = self
2260            .client
2261            .send_query::<fidl::encoding::EmptyPayload, CompositeGetPropertiesResponse>(
2262                (),
2263                0x31846fa0a459942b,
2264                fidl::encoding::DynamicFlags::empty(),
2265                ___deadline,
2266            )?;
2267        Ok(_response.properties)
2268    }
2269
2270    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2271    /// in the topology supported by this driver as returned by `GetElements` from
2272    /// fuchsia.hardware.audio.signalprocessing.
2273    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2274    /// client may retry at a later time.
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    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
2280    /// the parameters in `SupportedFormats` may be supported.
2281    pub fn r#get_ring_buffer_formats(
2282        &self,
2283        mut processing_element_id: u64,
2284        ___deadline: zx::MonotonicInstant,
2285    ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2286        let _response = self.client.send_query::<
2287            CompositeGetRingBufferFormatsRequest,
2288            fidl::encoding::ResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2289        >(
2290            (processing_element_id,),
2291            0x1d89b701b6816ac4,
2292            fidl::encoding::DynamicFlags::empty(),
2293            ___deadline,
2294        )?;
2295        Ok(_response.map(|x| x.ring_buffer_formats))
2296    }
2297
2298    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2299    /// processing element specified by `processing_element_id`. The format is based on information
2300    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2301    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2302    /// audio buffer provided by the driver.
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    /// `RING_BUFFER`.
2307    pub fn r#create_ring_buffer(
2308        &self,
2309        mut processing_element_id: u64,
2310        mut format: &Format,
2311        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2312        ___deadline: zx::MonotonicInstant,
2313    ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2314        let _response = self.client.send_query::<
2315            CompositeCreateRingBufferRequest,
2316            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2317        >(
2318            (processing_element_id, format, ring_buffer,),
2319            0x28c5685f85262033,
2320            fidl::encoding::DynamicFlags::empty(),
2321            ___deadline,
2322        )?;
2323        Ok(_response.map(|x| x))
2324    }
2325
2326    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2327    /// in the topology supported by this driver as returned by `GetElements` from
2328    /// fuchsia.hardware.audio.signalprocessing.
2329    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2330    /// may retry at a later time.
2331    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2332    /// by `GetElements`.
2333    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2334    /// `DAI_INTERCONNECT`.
2335    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2336    /// the parameters in SupportedFormats may be supported.
2337    pub fn r#get_dai_formats(
2338        &self,
2339        mut processing_element_id: u64,
2340        ___deadline: zx::MonotonicInstant,
2341    ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2342        let _response = self.client.send_query::<
2343            CompositeGetDaiFormatsRequest,
2344            fidl::encoding::ResultType<CompositeGetDaiFormatsResponse, DriverError>,
2345        >(
2346            (processing_element_id,),
2347            0x3cbeaed59c8f69b,
2348            fidl::encoding::DynamicFlags::empty(),
2349            ___deadline,
2350        )?;
2351        Ok(_response.map(|x| x.dai_formats))
2352    }
2353
2354    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2355    /// processing element specified by `processing_element_id`. The format is based on information
2356    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2357    /// requirement.
2358    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2359    /// by `GetElements`.
2360    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2361    /// `DAI_INTERCONNECT`.
2362    pub fn r#set_dai_format(
2363        &self,
2364        mut processing_element_id: u64,
2365        mut format: &DaiFormat,
2366        ___deadline: zx::MonotonicInstant,
2367    ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2368        let _response = self.client.send_query::<
2369            CompositeSetDaiFormatRequest,
2370            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2371        >(
2372            (processing_element_id, format,),
2373            0x155acf5cc0dc8a84,
2374            fidl::encoding::DynamicFlags::empty(),
2375            ___deadline,
2376        )?;
2377        Ok(_response.map(|x| x))
2378    }
2379}
2380
2381#[cfg(target_os = "fuchsia")]
2382impl From<CompositeSynchronousProxy> for zx::Handle {
2383    fn from(value: CompositeSynchronousProxy) -> Self {
2384        value.into_channel().into()
2385    }
2386}
2387
2388#[cfg(target_os = "fuchsia")]
2389impl From<fidl::Channel> for CompositeSynchronousProxy {
2390    fn from(value: fidl::Channel) -> Self {
2391        Self::new(value)
2392    }
2393}
2394
2395#[cfg(target_os = "fuchsia")]
2396impl fidl::endpoints::FromClient for CompositeSynchronousProxy {
2397    type Protocol = CompositeMarker;
2398
2399    fn from_client(value: fidl::endpoints::ClientEnd<CompositeMarker>) -> Self {
2400        Self::new(value.into_channel())
2401    }
2402}
2403
2404#[derive(Debug, Clone)]
2405pub struct CompositeProxy {
2406    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2407}
2408
2409impl fidl::endpoints::Proxy for CompositeProxy {
2410    type Protocol = CompositeMarker;
2411
2412    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2413        Self::new(inner)
2414    }
2415
2416    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2417        self.client.into_channel().map_err(|client| Self { client })
2418    }
2419
2420    fn as_channel(&self) -> &::fidl::AsyncChannel {
2421        self.client.as_channel()
2422    }
2423}
2424
2425impl CompositeProxy {
2426    /// Create a new Proxy for fuchsia.hardware.audio/Composite.
2427    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2428        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2429        Self { client: fidl::client::Client::new(channel, protocol_name) }
2430    }
2431
2432    /// Get a Stream of events from the remote end of the protocol.
2433    ///
2434    /// # Panics
2435    ///
2436    /// Panics if the event stream was already taken.
2437    pub fn take_event_stream(&self) -> CompositeEventStream {
2438        CompositeEventStream { event_receiver: self.client.take_event_receiver() }
2439    }
2440
2441    /// Retrieves top level health state.
2442    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2443    pub fn r#get_health_state(
2444        &self,
2445    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
2446    {
2447        CompositeProxyInterface::r#get_health_state(self)
2448    }
2449
2450    /// Connect to a `SignalProcessing` protocol.
2451    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2452    /// the maximum number of connections have already been created, for instance one, then the
2453    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2454    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2455    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2456    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2457    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2458    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2459    /// is intended to be composed, and hence the more verbose name allows differentiation and
2460    /// improved clarity.
2461    pub fn r#signal_processing_connect(
2462        &self,
2463        mut protocol: fidl::endpoints::ServerEnd<
2464            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2465        >,
2466    ) -> Result<(), fidl::Error> {
2467        CompositeProxyInterface::r#signal_processing_connect(self, protocol)
2468    }
2469
2470    /// Resets the hardware including all DAI interconnects and signal processing.
2471    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2472    ///
2473    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2474    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2475    /// any processing elements, and reconstruct any ring buffers.
2476    ///
2477    /// If the driver can't successfully reset the hardware, it will return an error and then close
2478    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2479    pub fn r#reset(
2480        &self,
2481    ) -> fidl::client::QueryResponseFut<
2482        CompositeResetResult,
2483        fidl::encoding::DefaultFuchsiaResourceDialect,
2484    > {
2485        CompositeProxyInterface::r#reset(self)
2486    }
2487
2488    /// Retrieves top level static properties.
2489    pub fn r#get_properties(
2490        &self,
2491    ) -> fidl::client::QueryResponseFut<
2492        CompositeProperties,
2493        fidl::encoding::DefaultFuchsiaResourceDialect,
2494    > {
2495        CompositeProxyInterface::r#get_properties(self)
2496    }
2497
2498    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2499    /// in the topology supported by this driver as returned by `GetElements` from
2500    /// fuchsia.hardware.audio.signalprocessing.
2501    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2502    /// client may retry at a later time.
2503    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2504    /// by `GetElements`.
2505    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2506    /// `RING_BUFFER`.
2507    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
2508    /// the parameters in `SupportedFormats` may be supported.
2509    pub fn r#get_ring_buffer_formats(
2510        &self,
2511        mut processing_element_id: u64,
2512    ) -> fidl::client::QueryResponseFut<
2513        CompositeGetRingBufferFormatsResult,
2514        fidl::encoding::DefaultFuchsiaResourceDialect,
2515    > {
2516        CompositeProxyInterface::r#get_ring_buffer_formats(self, processing_element_id)
2517    }
2518
2519    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2520    /// processing element specified by `processing_element_id`. The format is based on information
2521    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2522    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2523    /// audio buffer provided by the driver.
2524    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2525    /// by `GetElements`.
2526    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2527    /// `RING_BUFFER`.
2528    pub fn r#create_ring_buffer(
2529        &self,
2530        mut processing_element_id: u64,
2531        mut format: &Format,
2532        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2533    ) -> fidl::client::QueryResponseFut<
2534        CompositeCreateRingBufferResult,
2535        fidl::encoding::DefaultFuchsiaResourceDialect,
2536    > {
2537        CompositeProxyInterface::r#create_ring_buffer(
2538            self,
2539            processing_element_id,
2540            format,
2541            ring_buffer,
2542        )
2543    }
2544
2545    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2546    /// in the topology supported by this driver as returned by `GetElements` from
2547    /// fuchsia.hardware.audio.signalprocessing.
2548    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2549    /// may retry at a later time.
2550    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2551    /// by `GetElements`.
2552    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2553    /// `DAI_INTERCONNECT`.
2554    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2555    /// the parameters in SupportedFormats may be supported.
2556    pub fn r#get_dai_formats(
2557        &self,
2558        mut processing_element_id: u64,
2559    ) -> fidl::client::QueryResponseFut<
2560        CompositeGetDaiFormatsResult,
2561        fidl::encoding::DefaultFuchsiaResourceDialect,
2562    > {
2563        CompositeProxyInterface::r#get_dai_formats(self, processing_element_id)
2564    }
2565
2566    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2567    /// processing element specified by `processing_element_id`. The format is based on information
2568    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2569    /// requirement.
2570    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2571    /// by `GetElements`.
2572    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2573    /// `DAI_INTERCONNECT`.
2574    pub fn r#set_dai_format(
2575        &self,
2576        mut processing_element_id: u64,
2577        mut format: &DaiFormat,
2578    ) -> fidl::client::QueryResponseFut<
2579        CompositeSetDaiFormatResult,
2580        fidl::encoding::DefaultFuchsiaResourceDialect,
2581    > {
2582        CompositeProxyInterface::r#set_dai_format(self, processing_element_id, format)
2583    }
2584}
2585
2586impl CompositeProxyInterface for CompositeProxy {
2587    type GetHealthStateResponseFut =
2588        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
2589    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
2590        fn _decode(
2591            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2592        ) -> Result<HealthState, fidl::Error> {
2593            let _response = fidl::client::decode_transaction_body::<
2594                HealthGetHealthStateResponse,
2595                fidl::encoding::DefaultFuchsiaResourceDialect,
2596                0x4e146d6bca733a84,
2597            >(_buf?)?;
2598            Ok(_response.state)
2599        }
2600        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
2601            (),
2602            0x4e146d6bca733a84,
2603            fidl::encoding::DynamicFlags::empty(),
2604            _decode,
2605        )
2606    }
2607
2608    fn r#signal_processing_connect(
2609        &self,
2610        mut protocol: fidl::endpoints::ServerEnd<
2611            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2612        >,
2613    ) -> Result<(), fidl::Error> {
2614        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2615            (protocol,),
2616            0xa81907ce6066295,
2617            fidl::encoding::DynamicFlags::empty(),
2618        )
2619    }
2620
2621    type ResetResponseFut = fidl::client::QueryResponseFut<
2622        CompositeResetResult,
2623        fidl::encoding::DefaultFuchsiaResourceDialect,
2624    >;
2625    fn r#reset(&self) -> Self::ResetResponseFut {
2626        fn _decode(
2627            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2628        ) -> Result<CompositeResetResult, fidl::Error> {
2629            let _response = fidl::client::decode_transaction_body::<
2630                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2631                fidl::encoding::DefaultFuchsiaResourceDialect,
2632                0xac355fb98341996,
2633            >(_buf?)?;
2634            Ok(_response.map(|x| x))
2635        }
2636        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeResetResult>(
2637            (),
2638            0xac355fb98341996,
2639            fidl::encoding::DynamicFlags::empty(),
2640            _decode,
2641        )
2642    }
2643
2644    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2645        CompositeProperties,
2646        fidl::encoding::DefaultFuchsiaResourceDialect,
2647    >;
2648    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2649        fn _decode(
2650            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2651        ) -> Result<CompositeProperties, fidl::Error> {
2652            let _response = fidl::client::decode_transaction_body::<
2653                CompositeGetPropertiesResponse,
2654                fidl::encoding::DefaultFuchsiaResourceDialect,
2655                0x31846fa0a459942b,
2656            >(_buf?)?;
2657            Ok(_response.properties)
2658        }
2659        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeProperties>(
2660            (),
2661            0x31846fa0a459942b,
2662            fidl::encoding::DynamicFlags::empty(),
2663            _decode,
2664        )
2665    }
2666
2667    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
2668        CompositeGetRingBufferFormatsResult,
2669        fidl::encoding::DefaultFuchsiaResourceDialect,
2670    >;
2671    fn r#get_ring_buffer_formats(
2672        &self,
2673        mut processing_element_id: u64,
2674    ) -> Self::GetRingBufferFormatsResponseFut {
2675        fn _decode(
2676            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2677        ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2678            let _response = fidl::client::decode_transaction_body::<
2679                fidl::encoding::ResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2680                fidl::encoding::DefaultFuchsiaResourceDialect,
2681                0x1d89b701b6816ac4,
2682            >(_buf?)?;
2683            Ok(_response.map(|x| x.ring_buffer_formats))
2684        }
2685        self.client.send_query_and_decode::<
2686            CompositeGetRingBufferFormatsRequest,
2687            CompositeGetRingBufferFormatsResult,
2688        >(
2689            (processing_element_id,),
2690            0x1d89b701b6816ac4,
2691            fidl::encoding::DynamicFlags::empty(),
2692            _decode,
2693        )
2694    }
2695
2696    type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
2697        CompositeCreateRingBufferResult,
2698        fidl::encoding::DefaultFuchsiaResourceDialect,
2699    >;
2700    fn r#create_ring_buffer(
2701        &self,
2702        mut processing_element_id: u64,
2703        mut format: &Format,
2704        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2705    ) -> Self::CreateRingBufferResponseFut {
2706        fn _decode(
2707            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2708        ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2709            let _response = fidl::client::decode_transaction_body::<
2710                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2711                fidl::encoding::DefaultFuchsiaResourceDialect,
2712                0x28c5685f85262033,
2713            >(_buf?)?;
2714            Ok(_response.map(|x| x))
2715        }
2716        self.client.send_query_and_decode::<
2717            CompositeCreateRingBufferRequest,
2718            CompositeCreateRingBufferResult,
2719        >(
2720            (processing_element_id, format, ring_buffer,),
2721            0x28c5685f85262033,
2722            fidl::encoding::DynamicFlags::empty(),
2723            _decode,
2724        )
2725    }
2726
2727    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
2728        CompositeGetDaiFormatsResult,
2729        fidl::encoding::DefaultFuchsiaResourceDialect,
2730    >;
2731    fn r#get_dai_formats(&self, mut processing_element_id: u64) -> Self::GetDaiFormatsResponseFut {
2732        fn _decode(
2733            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2734        ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2735            let _response = fidl::client::decode_transaction_body::<
2736                fidl::encoding::ResultType<CompositeGetDaiFormatsResponse, DriverError>,
2737                fidl::encoding::DefaultFuchsiaResourceDialect,
2738                0x3cbeaed59c8f69b,
2739            >(_buf?)?;
2740            Ok(_response.map(|x| x.dai_formats))
2741        }
2742        self.client
2743            .send_query_and_decode::<CompositeGetDaiFormatsRequest, CompositeGetDaiFormatsResult>(
2744                (processing_element_id,),
2745                0x3cbeaed59c8f69b,
2746                fidl::encoding::DynamicFlags::empty(),
2747                _decode,
2748            )
2749    }
2750
2751    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
2752        CompositeSetDaiFormatResult,
2753        fidl::encoding::DefaultFuchsiaResourceDialect,
2754    >;
2755    fn r#set_dai_format(
2756        &self,
2757        mut processing_element_id: u64,
2758        mut format: &DaiFormat,
2759    ) -> Self::SetDaiFormatResponseFut {
2760        fn _decode(
2761            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2762        ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2763            let _response = fidl::client::decode_transaction_body::<
2764                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2765                fidl::encoding::DefaultFuchsiaResourceDialect,
2766                0x155acf5cc0dc8a84,
2767            >(_buf?)?;
2768            Ok(_response.map(|x| x))
2769        }
2770        self.client
2771            .send_query_and_decode::<CompositeSetDaiFormatRequest, CompositeSetDaiFormatResult>(
2772                (processing_element_id, format),
2773                0x155acf5cc0dc8a84,
2774                fidl::encoding::DynamicFlags::empty(),
2775                _decode,
2776            )
2777    }
2778}
2779
2780pub struct CompositeEventStream {
2781    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2782}
2783
2784impl std::marker::Unpin for CompositeEventStream {}
2785
2786impl futures::stream::FusedStream for CompositeEventStream {
2787    fn is_terminated(&self) -> bool {
2788        self.event_receiver.is_terminated()
2789    }
2790}
2791
2792impl futures::Stream for CompositeEventStream {
2793    type Item = Result<CompositeEvent, fidl::Error>;
2794
2795    fn poll_next(
2796        mut self: std::pin::Pin<&mut Self>,
2797        cx: &mut std::task::Context<'_>,
2798    ) -> std::task::Poll<Option<Self::Item>> {
2799        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2800            &mut self.event_receiver,
2801            cx
2802        )?) {
2803            Some(buf) => std::task::Poll::Ready(Some(CompositeEvent::decode(buf))),
2804            None => std::task::Poll::Ready(None),
2805        }
2806    }
2807}
2808
2809#[derive(Debug)]
2810pub enum CompositeEvent {}
2811
2812impl CompositeEvent {
2813    /// Decodes a message buffer as a [`CompositeEvent`].
2814    fn decode(
2815        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2816    ) -> Result<CompositeEvent, fidl::Error> {
2817        let (bytes, _handles) = buf.split_mut();
2818        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2819        debug_assert_eq!(tx_header.tx_id, 0);
2820        match tx_header.ordinal {
2821            _ => Err(fidl::Error::UnknownOrdinal {
2822                ordinal: tx_header.ordinal,
2823                protocol_name: <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2824            }),
2825        }
2826    }
2827}
2828
2829/// A Stream of incoming requests for fuchsia.hardware.audio/Composite.
2830pub struct CompositeRequestStream {
2831    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2832    is_terminated: bool,
2833}
2834
2835impl std::marker::Unpin for CompositeRequestStream {}
2836
2837impl futures::stream::FusedStream for CompositeRequestStream {
2838    fn is_terminated(&self) -> bool {
2839        self.is_terminated
2840    }
2841}
2842
2843impl fidl::endpoints::RequestStream for CompositeRequestStream {
2844    type Protocol = CompositeMarker;
2845    type ControlHandle = CompositeControlHandle;
2846
2847    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2848        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2849    }
2850
2851    fn control_handle(&self) -> Self::ControlHandle {
2852        CompositeControlHandle { inner: self.inner.clone() }
2853    }
2854
2855    fn into_inner(
2856        self,
2857    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2858    {
2859        (self.inner, self.is_terminated)
2860    }
2861
2862    fn from_inner(
2863        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2864        is_terminated: bool,
2865    ) -> Self {
2866        Self { inner, is_terminated }
2867    }
2868}
2869
2870impl futures::Stream for CompositeRequestStream {
2871    type Item = Result<CompositeRequest, fidl::Error>;
2872
2873    fn poll_next(
2874        mut self: std::pin::Pin<&mut Self>,
2875        cx: &mut std::task::Context<'_>,
2876    ) -> std::task::Poll<Option<Self::Item>> {
2877        let this = &mut *self;
2878        if this.inner.check_shutdown(cx) {
2879            this.is_terminated = true;
2880            return std::task::Poll::Ready(None);
2881        }
2882        if this.is_terminated {
2883            panic!("polled CompositeRequestStream after completion");
2884        }
2885        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2886            |bytes, handles| {
2887                match this.inner.channel().read_etc(cx, bytes, handles) {
2888                    std::task::Poll::Ready(Ok(())) => {}
2889                    std::task::Poll::Pending => return std::task::Poll::Pending,
2890                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2891                        this.is_terminated = true;
2892                        return std::task::Poll::Ready(None);
2893                    }
2894                    std::task::Poll::Ready(Err(e)) => {
2895                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2896                            e.into(),
2897                        ))))
2898                    }
2899                }
2900
2901                // A message has been received from the channel
2902                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2903
2904                std::task::Poll::Ready(Some(match header.ordinal {
2905                    0x4e146d6bca733a84 => {
2906                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2907                        let mut req = fidl::new_empty!(
2908                            fidl::encoding::EmptyPayload,
2909                            fidl::encoding::DefaultFuchsiaResourceDialect
2910                        );
2911                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2912                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2913                        Ok(CompositeRequest::GetHealthState {
2914                            responder: CompositeGetHealthStateResponder {
2915                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2916                                tx_id: header.tx_id,
2917                            },
2918                        })
2919                    }
2920                    0xa81907ce6066295 => {
2921                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2922                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2923                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2924                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2925                        Ok(CompositeRequest::SignalProcessingConnect {
2926                            protocol: req.protocol,
2927
2928                            control_handle,
2929                        })
2930                    }
2931                    0xac355fb98341996 => {
2932                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2933                        let mut req = fidl::new_empty!(
2934                            fidl::encoding::EmptyPayload,
2935                            fidl::encoding::DefaultFuchsiaResourceDialect
2936                        );
2937                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2938                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2939                        Ok(CompositeRequest::Reset {
2940                            responder: CompositeResetResponder {
2941                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2942                                tx_id: header.tx_id,
2943                            },
2944                        })
2945                    }
2946                    0x31846fa0a459942b => {
2947                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2948                        let mut req = fidl::new_empty!(
2949                            fidl::encoding::EmptyPayload,
2950                            fidl::encoding::DefaultFuchsiaResourceDialect
2951                        );
2952                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2953                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2954                        Ok(CompositeRequest::GetProperties {
2955                            responder: CompositeGetPropertiesResponder {
2956                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2957                                tx_id: header.tx_id,
2958                            },
2959                        })
2960                    }
2961                    0x1d89b701b6816ac4 => {
2962                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2963                        let mut req = fidl::new_empty!(
2964                            CompositeGetRingBufferFormatsRequest,
2965                            fidl::encoding::DefaultFuchsiaResourceDialect
2966                        );
2967                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetRingBufferFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2968                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2969                        Ok(CompositeRequest::GetRingBufferFormats {
2970                            processing_element_id: req.processing_element_id,
2971
2972                            responder: CompositeGetRingBufferFormatsResponder {
2973                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2974                                tx_id: header.tx_id,
2975                            },
2976                        })
2977                    }
2978                    0x28c5685f85262033 => {
2979                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2980                        let mut req = fidl::new_empty!(
2981                            CompositeCreateRingBufferRequest,
2982                            fidl::encoding::DefaultFuchsiaResourceDialect
2983                        );
2984                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
2985                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2986                        Ok(CompositeRequest::CreateRingBuffer {
2987                            processing_element_id: req.processing_element_id,
2988                            format: req.format,
2989                            ring_buffer: req.ring_buffer,
2990
2991                            responder: CompositeCreateRingBufferResponder {
2992                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2993                                tx_id: header.tx_id,
2994                            },
2995                        })
2996                    }
2997                    0x3cbeaed59c8f69b => {
2998                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2999                        let mut req = fidl::new_empty!(
3000                            CompositeGetDaiFormatsRequest,
3001                            fidl::encoding::DefaultFuchsiaResourceDialect
3002                        );
3003                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetDaiFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3004                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3005                        Ok(CompositeRequest::GetDaiFormats {
3006                            processing_element_id: req.processing_element_id,
3007
3008                            responder: CompositeGetDaiFormatsResponder {
3009                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3010                                tx_id: header.tx_id,
3011                            },
3012                        })
3013                    }
3014                    0x155acf5cc0dc8a84 => {
3015                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3016                        let mut req = fidl::new_empty!(
3017                            CompositeSetDaiFormatRequest,
3018                            fidl::encoding::DefaultFuchsiaResourceDialect
3019                        );
3020                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
3021                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3022                        Ok(CompositeRequest::SetDaiFormat {
3023                            processing_element_id: req.processing_element_id,
3024                            format: req.format,
3025
3026                            responder: CompositeSetDaiFormatResponder {
3027                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3028                                tx_id: header.tx_id,
3029                            },
3030                        })
3031                    }
3032                    _ => Err(fidl::Error::UnknownOrdinal {
3033                        ordinal: header.ordinal,
3034                        protocol_name:
3035                            <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3036                    }),
3037                }))
3038            },
3039        )
3040    }
3041}
3042
3043/// The `Composite` interface is a FIDL protocol exposed by audio drivers. The `Composite` interface
3044/// is generic and allows the configuration of various audio hardware types including those supported
3045/// by the `StreamConfig`, `Dai` and `Codec` FIDL interfaces. The `Composite` interface is more
3046/// generic and provides more flexible routing within audio subsystems. Also see
3047/// [Audio Driver Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md)
3048/// The hardware abstracted by the Composite protocol will be turned off (placed in its lowest
3049/// supported power state) until a call to any APIs that requires the hardware to be turned on
3050/// (placed in a higher power state).
3051#[derive(Debug)]
3052pub enum CompositeRequest {
3053    /// Retrieves top level health state.
3054    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
3055    GetHealthState { responder: CompositeGetHealthStateResponder },
3056    /// Connect to a `SignalProcessing` protocol.
3057    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
3058    /// the maximum number of connections have already been created, for instance one, then the
3059    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
3060    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
3061    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
3062    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
3063    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
3064    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
3065    /// is intended to be composed, and hence the more verbose name allows differentiation and
3066    /// improved clarity.
3067    SignalProcessingConnect {
3068        protocol: fidl::endpoints::ServerEnd<
3069            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3070        >,
3071        control_handle: CompositeControlHandle,
3072    },
3073    /// Resets the hardware including all DAI interconnects and signal processing.
3074    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
3075    ///
3076    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
3077    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
3078    /// any processing elements, and reconstruct any ring buffers.
3079    ///
3080    /// If the driver can't successfully reset the hardware, it will return an error and then close
3081    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
3082    Reset { responder: CompositeResetResponder },
3083    /// Retrieves top level static properties.
3084    GetProperties { responder: CompositeGetPropertiesResponder },
3085    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
3086    /// in the topology supported by this driver as returned by `GetElements` from
3087    /// fuchsia.hardware.audio.signalprocessing.
3088    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
3089    /// client may retry at a later time.
3090    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3091    /// by `GetElements`.
3092    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3093    /// `RING_BUFFER`.
3094    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
3095    /// the parameters in `SupportedFormats` may be supported.
3096    GetRingBufferFormats {
3097        processing_element_id: u64,
3098        responder: CompositeGetRingBufferFormatsResponder,
3099    },
3100    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
3101    /// processing element specified by `processing_element_id`. The format is based on information
3102    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
3103    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
3104    /// audio buffer provided by the driver.
3105    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3106    /// by `GetElements`.
3107    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3108    /// `RING_BUFFER`.
3109    CreateRingBuffer {
3110        processing_element_id: u64,
3111        format: Format,
3112        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3113        responder: CompositeCreateRingBufferResponder,
3114    },
3115    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
3116    /// in the topology supported by this driver as returned by `GetElements` from
3117    /// fuchsia.hardware.audio.signalprocessing.
3118    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
3119    /// may retry at a later time.
3120    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3121    /// by `GetElements`.
3122    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3123    /// `DAI_INTERCONNECT`.
3124    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
3125    /// the parameters in SupportedFormats may be supported.
3126    GetDaiFormats { processing_element_id: u64, responder: CompositeGetDaiFormatsResponder },
3127    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
3128    /// processing element specified by `processing_element_id`. The format is based on information
3129    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
3130    /// requirement.
3131    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3132    /// by `GetElements`.
3133    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3134    /// `DAI_INTERCONNECT`.
3135    SetDaiFormat {
3136        processing_element_id: u64,
3137        format: DaiFormat,
3138        responder: CompositeSetDaiFormatResponder,
3139    },
3140}
3141
3142impl CompositeRequest {
3143    #[allow(irrefutable_let_patterns)]
3144    pub fn into_get_health_state(self) -> Option<(CompositeGetHealthStateResponder)> {
3145        if let CompositeRequest::GetHealthState { responder } = self {
3146            Some((responder))
3147        } else {
3148            None
3149        }
3150    }
3151
3152    #[allow(irrefutable_let_patterns)]
3153    pub fn into_signal_processing_connect(
3154        self,
3155    ) -> Option<(
3156        fidl::endpoints::ServerEnd<
3157            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3158        >,
3159        CompositeControlHandle,
3160    )> {
3161        if let CompositeRequest::SignalProcessingConnect { protocol, control_handle } = self {
3162            Some((protocol, control_handle))
3163        } else {
3164            None
3165        }
3166    }
3167
3168    #[allow(irrefutable_let_patterns)]
3169    pub fn into_reset(self) -> Option<(CompositeResetResponder)> {
3170        if let CompositeRequest::Reset { responder } = self {
3171            Some((responder))
3172        } else {
3173            None
3174        }
3175    }
3176
3177    #[allow(irrefutable_let_patterns)]
3178    pub fn into_get_properties(self) -> Option<(CompositeGetPropertiesResponder)> {
3179        if let CompositeRequest::GetProperties { responder } = self {
3180            Some((responder))
3181        } else {
3182            None
3183        }
3184    }
3185
3186    #[allow(irrefutable_let_patterns)]
3187    pub fn into_get_ring_buffer_formats(
3188        self,
3189    ) -> Option<(u64, CompositeGetRingBufferFormatsResponder)> {
3190        if let CompositeRequest::GetRingBufferFormats { processing_element_id, responder } = self {
3191            Some((processing_element_id, responder))
3192        } else {
3193            None
3194        }
3195    }
3196
3197    #[allow(irrefutable_let_patterns)]
3198    pub fn into_create_ring_buffer(
3199        self,
3200    ) -> Option<(
3201        u64,
3202        Format,
3203        fidl::endpoints::ServerEnd<RingBufferMarker>,
3204        CompositeCreateRingBufferResponder,
3205    )> {
3206        if let CompositeRequest::CreateRingBuffer {
3207            processing_element_id,
3208            format,
3209            ring_buffer,
3210            responder,
3211        } = self
3212        {
3213            Some((processing_element_id, format, ring_buffer, responder))
3214        } else {
3215            None
3216        }
3217    }
3218
3219    #[allow(irrefutable_let_patterns)]
3220    pub fn into_get_dai_formats(self) -> Option<(u64, CompositeGetDaiFormatsResponder)> {
3221        if let CompositeRequest::GetDaiFormats { processing_element_id, responder } = self {
3222            Some((processing_element_id, responder))
3223        } else {
3224            None
3225        }
3226    }
3227
3228    #[allow(irrefutable_let_patterns)]
3229    pub fn into_set_dai_format(self) -> Option<(u64, DaiFormat, CompositeSetDaiFormatResponder)> {
3230        if let CompositeRequest::SetDaiFormat { processing_element_id, format, responder } = self {
3231            Some((processing_element_id, format, responder))
3232        } else {
3233            None
3234        }
3235    }
3236
3237    /// Name of the method defined in FIDL
3238    pub fn method_name(&self) -> &'static str {
3239        match *self {
3240            CompositeRequest::GetHealthState { .. } => "get_health_state",
3241            CompositeRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
3242            CompositeRequest::Reset { .. } => "reset",
3243            CompositeRequest::GetProperties { .. } => "get_properties",
3244            CompositeRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
3245            CompositeRequest::CreateRingBuffer { .. } => "create_ring_buffer",
3246            CompositeRequest::GetDaiFormats { .. } => "get_dai_formats",
3247            CompositeRequest::SetDaiFormat { .. } => "set_dai_format",
3248        }
3249    }
3250}
3251
3252#[derive(Debug, Clone)]
3253pub struct CompositeControlHandle {
3254    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3255}
3256
3257impl fidl::endpoints::ControlHandle for CompositeControlHandle {
3258    fn shutdown(&self) {
3259        self.inner.shutdown()
3260    }
3261    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3262        self.inner.shutdown_with_epitaph(status)
3263    }
3264
3265    fn is_closed(&self) -> bool {
3266        self.inner.channel().is_closed()
3267    }
3268    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3269        self.inner.channel().on_closed()
3270    }
3271
3272    #[cfg(target_os = "fuchsia")]
3273    fn signal_peer(
3274        &self,
3275        clear_mask: zx::Signals,
3276        set_mask: zx::Signals,
3277    ) -> Result<(), zx_status::Status> {
3278        use fidl::Peered;
3279        self.inner.channel().signal_peer(clear_mask, set_mask)
3280    }
3281}
3282
3283impl CompositeControlHandle {}
3284
3285#[must_use = "FIDL methods require a response to be sent"]
3286#[derive(Debug)]
3287pub struct CompositeGetHealthStateResponder {
3288    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3289    tx_id: u32,
3290}
3291
3292/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3293/// if the responder is dropped without sending a response, so that the client
3294/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3295impl std::ops::Drop for CompositeGetHealthStateResponder {
3296    fn drop(&mut self) {
3297        self.control_handle.shutdown();
3298        // Safety: drops once, never accessed again
3299        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3300    }
3301}
3302
3303impl fidl::endpoints::Responder for CompositeGetHealthStateResponder {
3304    type ControlHandle = CompositeControlHandle;
3305
3306    fn control_handle(&self) -> &CompositeControlHandle {
3307        &self.control_handle
3308    }
3309
3310    fn drop_without_shutdown(mut self) {
3311        // Safety: drops once, never accessed again due to mem::forget
3312        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3313        // Prevent Drop from running (which would shut down the channel)
3314        std::mem::forget(self);
3315    }
3316}
3317
3318impl CompositeGetHealthStateResponder {
3319    /// Sends a response to the FIDL transaction.
3320    ///
3321    /// Sets the channel to shutdown if an error occurs.
3322    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3323        let _result = self.send_raw(state);
3324        if _result.is_err() {
3325            self.control_handle.shutdown();
3326        }
3327        self.drop_without_shutdown();
3328        _result
3329    }
3330
3331    /// Similar to "send" but does not shutdown the channel if an error occurs.
3332    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3333        let _result = self.send_raw(state);
3334        self.drop_without_shutdown();
3335        _result
3336    }
3337
3338    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
3339        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
3340            (state,),
3341            self.tx_id,
3342            0x4e146d6bca733a84,
3343            fidl::encoding::DynamicFlags::empty(),
3344        )
3345    }
3346}
3347
3348#[must_use = "FIDL methods require a response to be sent"]
3349#[derive(Debug)]
3350pub struct CompositeResetResponder {
3351    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3352    tx_id: u32,
3353}
3354
3355/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3356/// if the responder is dropped without sending a response, so that the client
3357/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3358impl std::ops::Drop for CompositeResetResponder {
3359    fn drop(&mut self) {
3360        self.control_handle.shutdown();
3361        // Safety: drops once, never accessed again
3362        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3363    }
3364}
3365
3366impl fidl::endpoints::Responder for CompositeResetResponder {
3367    type ControlHandle = CompositeControlHandle;
3368
3369    fn control_handle(&self) -> &CompositeControlHandle {
3370        &self.control_handle
3371    }
3372
3373    fn drop_without_shutdown(mut self) {
3374        // Safety: drops once, never accessed again due to mem::forget
3375        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3376        // Prevent Drop from running (which would shut down the channel)
3377        std::mem::forget(self);
3378    }
3379}
3380
3381impl CompositeResetResponder {
3382    /// Sends a response to the FIDL transaction.
3383    ///
3384    /// Sets the channel to shutdown if an error occurs.
3385    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3386        let _result = self.send_raw(result);
3387        if _result.is_err() {
3388            self.control_handle.shutdown();
3389        }
3390        self.drop_without_shutdown();
3391        _result
3392    }
3393
3394    /// Similar to "send" but does not shutdown the channel if an error occurs.
3395    pub fn send_no_shutdown_on_err(
3396        self,
3397        mut result: Result<(), DriverError>,
3398    ) -> Result<(), fidl::Error> {
3399        let _result = self.send_raw(result);
3400        self.drop_without_shutdown();
3401        _result
3402    }
3403
3404    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3405        self.control_handle.inner.send::<fidl::encoding::ResultType<
3406            fidl::encoding::EmptyStruct,
3407            DriverError,
3408        >>(
3409            result,
3410            self.tx_id,
3411            0xac355fb98341996,
3412            fidl::encoding::DynamicFlags::empty(),
3413        )
3414    }
3415}
3416
3417#[must_use = "FIDL methods require a response to be sent"]
3418#[derive(Debug)]
3419pub struct CompositeGetPropertiesResponder {
3420    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3421    tx_id: u32,
3422}
3423
3424/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3425/// if the responder is dropped without sending a response, so that the client
3426/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3427impl std::ops::Drop for CompositeGetPropertiesResponder {
3428    fn drop(&mut self) {
3429        self.control_handle.shutdown();
3430        // Safety: drops once, never accessed again
3431        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3432    }
3433}
3434
3435impl fidl::endpoints::Responder for CompositeGetPropertiesResponder {
3436    type ControlHandle = CompositeControlHandle;
3437
3438    fn control_handle(&self) -> &CompositeControlHandle {
3439        &self.control_handle
3440    }
3441
3442    fn drop_without_shutdown(mut self) {
3443        // Safety: drops once, never accessed again due to mem::forget
3444        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3445        // Prevent Drop from running (which would shut down the channel)
3446        std::mem::forget(self);
3447    }
3448}
3449
3450impl CompositeGetPropertiesResponder {
3451    /// Sends a response to the FIDL transaction.
3452    ///
3453    /// Sets the channel to shutdown if an error occurs.
3454    pub fn send(self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3455        let _result = self.send_raw(properties);
3456        if _result.is_err() {
3457            self.control_handle.shutdown();
3458        }
3459        self.drop_without_shutdown();
3460        _result
3461    }
3462
3463    /// Similar to "send" but does not shutdown the channel if an error occurs.
3464    pub fn send_no_shutdown_on_err(
3465        self,
3466        mut properties: &CompositeProperties,
3467    ) -> Result<(), fidl::Error> {
3468        let _result = self.send_raw(properties);
3469        self.drop_without_shutdown();
3470        _result
3471    }
3472
3473    fn send_raw(&self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3474        self.control_handle.inner.send::<CompositeGetPropertiesResponse>(
3475            (properties,),
3476            self.tx_id,
3477            0x31846fa0a459942b,
3478            fidl::encoding::DynamicFlags::empty(),
3479        )
3480    }
3481}
3482
3483#[must_use = "FIDL methods require a response to be sent"]
3484#[derive(Debug)]
3485pub struct CompositeGetRingBufferFormatsResponder {
3486    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3487    tx_id: u32,
3488}
3489
3490/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3491/// if the responder is dropped without sending a response, so that the client
3492/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3493impl std::ops::Drop for CompositeGetRingBufferFormatsResponder {
3494    fn drop(&mut self) {
3495        self.control_handle.shutdown();
3496        // Safety: drops once, never accessed again
3497        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3498    }
3499}
3500
3501impl fidl::endpoints::Responder for CompositeGetRingBufferFormatsResponder {
3502    type ControlHandle = CompositeControlHandle;
3503
3504    fn control_handle(&self) -> &CompositeControlHandle {
3505        &self.control_handle
3506    }
3507
3508    fn drop_without_shutdown(mut self) {
3509        // Safety: drops once, never accessed again due to mem::forget
3510        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3511        // Prevent Drop from running (which would shut down the channel)
3512        std::mem::forget(self);
3513    }
3514}
3515
3516impl CompositeGetRingBufferFormatsResponder {
3517    /// Sends a response to the FIDL transaction.
3518    ///
3519    /// Sets the channel to shutdown if an error occurs.
3520    pub fn send(
3521        self,
3522        mut result: Result<&[SupportedFormats], DriverError>,
3523    ) -> Result<(), fidl::Error> {
3524        let _result = self.send_raw(result);
3525        if _result.is_err() {
3526            self.control_handle.shutdown();
3527        }
3528        self.drop_without_shutdown();
3529        _result
3530    }
3531
3532    /// Similar to "send" but does not shutdown the channel if an error occurs.
3533    pub fn send_no_shutdown_on_err(
3534        self,
3535        mut result: Result<&[SupportedFormats], DriverError>,
3536    ) -> Result<(), fidl::Error> {
3537        let _result = self.send_raw(result);
3538        self.drop_without_shutdown();
3539        _result
3540    }
3541
3542    fn send_raw(
3543        &self,
3544        mut result: Result<&[SupportedFormats], DriverError>,
3545    ) -> Result<(), fidl::Error> {
3546        self.control_handle.inner.send::<fidl::encoding::ResultType<
3547            CompositeGetRingBufferFormatsResponse,
3548            DriverError,
3549        >>(
3550            result.map(|ring_buffer_formats| (ring_buffer_formats,)),
3551            self.tx_id,
3552            0x1d89b701b6816ac4,
3553            fidl::encoding::DynamicFlags::empty(),
3554        )
3555    }
3556}
3557
3558#[must_use = "FIDL methods require a response to be sent"]
3559#[derive(Debug)]
3560pub struct CompositeCreateRingBufferResponder {
3561    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3562    tx_id: u32,
3563}
3564
3565/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3566/// if the responder is dropped without sending a response, so that the client
3567/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3568impl std::ops::Drop for CompositeCreateRingBufferResponder {
3569    fn drop(&mut self) {
3570        self.control_handle.shutdown();
3571        // Safety: drops once, never accessed again
3572        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3573    }
3574}
3575
3576impl fidl::endpoints::Responder for CompositeCreateRingBufferResponder {
3577    type ControlHandle = CompositeControlHandle;
3578
3579    fn control_handle(&self) -> &CompositeControlHandle {
3580        &self.control_handle
3581    }
3582
3583    fn drop_without_shutdown(mut self) {
3584        // Safety: drops once, never accessed again due to mem::forget
3585        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3586        // Prevent Drop from running (which would shut down the channel)
3587        std::mem::forget(self);
3588    }
3589}
3590
3591impl CompositeCreateRingBufferResponder {
3592    /// Sends a response to the FIDL transaction.
3593    ///
3594    /// Sets the channel to shutdown if an error occurs.
3595    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3596        let _result = self.send_raw(result);
3597        if _result.is_err() {
3598            self.control_handle.shutdown();
3599        }
3600        self.drop_without_shutdown();
3601        _result
3602    }
3603
3604    /// Similar to "send" but does not shutdown the channel if an error occurs.
3605    pub fn send_no_shutdown_on_err(
3606        self,
3607        mut result: Result<(), DriverError>,
3608    ) -> Result<(), fidl::Error> {
3609        let _result = self.send_raw(result);
3610        self.drop_without_shutdown();
3611        _result
3612    }
3613
3614    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3615        self.control_handle.inner.send::<fidl::encoding::ResultType<
3616            fidl::encoding::EmptyStruct,
3617            DriverError,
3618        >>(
3619            result,
3620            self.tx_id,
3621            0x28c5685f85262033,
3622            fidl::encoding::DynamicFlags::empty(),
3623        )
3624    }
3625}
3626
3627#[must_use = "FIDL methods require a response to be sent"]
3628#[derive(Debug)]
3629pub struct CompositeGetDaiFormatsResponder {
3630    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3631    tx_id: u32,
3632}
3633
3634/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3635/// if the responder is dropped without sending a response, so that the client
3636/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3637impl std::ops::Drop for CompositeGetDaiFormatsResponder {
3638    fn drop(&mut self) {
3639        self.control_handle.shutdown();
3640        // Safety: drops once, never accessed again
3641        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3642    }
3643}
3644
3645impl fidl::endpoints::Responder for CompositeGetDaiFormatsResponder {
3646    type ControlHandle = CompositeControlHandle;
3647
3648    fn control_handle(&self) -> &CompositeControlHandle {
3649        &self.control_handle
3650    }
3651
3652    fn drop_without_shutdown(mut self) {
3653        // Safety: drops once, never accessed again due to mem::forget
3654        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3655        // Prevent Drop from running (which would shut down the channel)
3656        std::mem::forget(self);
3657    }
3658}
3659
3660impl CompositeGetDaiFormatsResponder {
3661    /// Sends a response to the FIDL transaction.
3662    ///
3663    /// Sets the channel to shutdown if an error occurs.
3664    pub fn send(
3665        self,
3666        mut result: Result<&[DaiSupportedFormats], DriverError>,
3667    ) -> Result<(), fidl::Error> {
3668        let _result = self.send_raw(result);
3669        if _result.is_err() {
3670            self.control_handle.shutdown();
3671        }
3672        self.drop_without_shutdown();
3673        _result
3674    }
3675
3676    /// Similar to "send" but does not shutdown the channel if an error occurs.
3677    pub fn send_no_shutdown_on_err(
3678        self,
3679        mut result: Result<&[DaiSupportedFormats], DriverError>,
3680    ) -> Result<(), fidl::Error> {
3681        let _result = self.send_raw(result);
3682        self.drop_without_shutdown();
3683        _result
3684    }
3685
3686    fn send_raw(
3687        &self,
3688        mut result: Result<&[DaiSupportedFormats], DriverError>,
3689    ) -> Result<(), fidl::Error> {
3690        self.control_handle.inner.send::<fidl::encoding::ResultType<
3691            CompositeGetDaiFormatsResponse,
3692            DriverError,
3693        >>(
3694            result.map(|dai_formats| (dai_formats,)),
3695            self.tx_id,
3696            0x3cbeaed59c8f69b,
3697            fidl::encoding::DynamicFlags::empty(),
3698        )
3699    }
3700}
3701
3702#[must_use = "FIDL methods require a response to be sent"]
3703#[derive(Debug)]
3704pub struct CompositeSetDaiFormatResponder {
3705    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3706    tx_id: u32,
3707}
3708
3709/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3710/// if the responder is dropped without sending a response, so that the client
3711/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3712impl std::ops::Drop for CompositeSetDaiFormatResponder {
3713    fn drop(&mut self) {
3714        self.control_handle.shutdown();
3715        // Safety: drops once, never accessed again
3716        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3717    }
3718}
3719
3720impl fidl::endpoints::Responder for CompositeSetDaiFormatResponder {
3721    type ControlHandle = CompositeControlHandle;
3722
3723    fn control_handle(&self) -> &CompositeControlHandle {
3724        &self.control_handle
3725    }
3726
3727    fn drop_without_shutdown(mut self) {
3728        // Safety: drops once, never accessed again due to mem::forget
3729        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3730        // Prevent Drop from running (which would shut down the channel)
3731        std::mem::forget(self);
3732    }
3733}
3734
3735impl CompositeSetDaiFormatResponder {
3736    /// Sends a response to the FIDL transaction.
3737    ///
3738    /// Sets the channel to shutdown if an error occurs.
3739    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3740        let _result = self.send_raw(result);
3741        if _result.is_err() {
3742            self.control_handle.shutdown();
3743        }
3744        self.drop_without_shutdown();
3745        _result
3746    }
3747
3748    /// Similar to "send" but does not shutdown the channel if an error occurs.
3749    pub fn send_no_shutdown_on_err(
3750        self,
3751        mut result: Result<(), DriverError>,
3752    ) -> Result<(), fidl::Error> {
3753        let _result = self.send_raw(result);
3754        self.drop_without_shutdown();
3755        _result
3756    }
3757
3758    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3759        self.control_handle.inner.send::<fidl::encoding::ResultType<
3760            fidl::encoding::EmptyStruct,
3761            DriverError,
3762        >>(
3763            result,
3764            self.tx_id,
3765            0x155acf5cc0dc8a84,
3766            fidl::encoding::DynamicFlags::empty(),
3767        )
3768    }
3769}
3770
3771#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3772pub struct CompositeConnectorMarker;
3773
3774impl fidl::endpoints::ProtocolMarker for CompositeConnectorMarker {
3775    type Proxy = CompositeConnectorProxy;
3776    type RequestStream = CompositeConnectorRequestStream;
3777    #[cfg(target_os = "fuchsia")]
3778    type SynchronousProxy = CompositeConnectorSynchronousProxy;
3779
3780    const DEBUG_NAME: &'static str = "(anonymous) CompositeConnector";
3781}
3782
3783pub trait CompositeConnectorProxyInterface: Send + Sync {
3784    fn r#connect(
3785        &self,
3786        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
3787    ) -> Result<(), fidl::Error>;
3788}
3789#[derive(Debug)]
3790#[cfg(target_os = "fuchsia")]
3791pub struct CompositeConnectorSynchronousProxy {
3792    client: fidl::client::sync::Client,
3793}
3794
3795#[cfg(target_os = "fuchsia")]
3796impl fidl::endpoints::SynchronousProxy for CompositeConnectorSynchronousProxy {
3797    type Proxy = CompositeConnectorProxy;
3798    type Protocol = CompositeConnectorMarker;
3799
3800    fn from_channel(inner: fidl::Channel) -> Self {
3801        Self::new(inner)
3802    }
3803
3804    fn into_channel(self) -> fidl::Channel {
3805        self.client.into_channel()
3806    }
3807
3808    fn as_channel(&self) -> &fidl::Channel {
3809        self.client.as_channel()
3810    }
3811}
3812
3813#[cfg(target_os = "fuchsia")]
3814impl CompositeConnectorSynchronousProxy {
3815    pub fn new(channel: fidl::Channel) -> Self {
3816        let protocol_name =
3817            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3818        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3819    }
3820
3821    pub fn into_channel(self) -> fidl::Channel {
3822        self.client.into_channel()
3823    }
3824
3825    /// Waits until an event arrives and returns it. It is safe for other
3826    /// threads to make concurrent requests while waiting for an event.
3827    pub fn wait_for_event(
3828        &self,
3829        deadline: zx::MonotonicInstant,
3830    ) -> Result<CompositeConnectorEvent, fidl::Error> {
3831        CompositeConnectorEvent::decode(self.client.wait_for_event(deadline)?)
3832    }
3833
3834    /// Connect to a `Device` protocol.
3835    /// This method allows a component to serve FIDL outside the devhost's control.
3836    pub fn r#connect(
3837        &self,
3838        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
3839    ) -> Result<(), fidl::Error> {
3840        self.client.send::<CompositeConnectorConnectRequest>(
3841            (composite_protocol,),
3842            0x7ee557529079e466,
3843            fidl::encoding::DynamicFlags::empty(),
3844        )
3845    }
3846}
3847
3848#[cfg(target_os = "fuchsia")]
3849impl From<CompositeConnectorSynchronousProxy> for zx::Handle {
3850    fn from(value: CompositeConnectorSynchronousProxy) -> Self {
3851        value.into_channel().into()
3852    }
3853}
3854
3855#[cfg(target_os = "fuchsia")]
3856impl From<fidl::Channel> for CompositeConnectorSynchronousProxy {
3857    fn from(value: fidl::Channel) -> Self {
3858        Self::new(value)
3859    }
3860}
3861
3862#[cfg(target_os = "fuchsia")]
3863impl fidl::endpoints::FromClient for CompositeConnectorSynchronousProxy {
3864    type Protocol = CompositeConnectorMarker;
3865
3866    fn from_client(value: fidl::endpoints::ClientEnd<CompositeConnectorMarker>) -> Self {
3867        Self::new(value.into_channel())
3868    }
3869}
3870
3871#[derive(Debug, Clone)]
3872pub struct CompositeConnectorProxy {
3873    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3874}
3875
3876impl fidl::endpoints::Proxy for CompositeConnectorProxy {
3877    type Protocol = CompositeConnectorMarker;
3878
3879    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3880        Self::new(inner)
3881    }
3882
3883    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3884        self.client.into_channel().map_err(|client| Self { client })
3885    }
3886
3887    fn as_channel(&self) -> &::fidl::AsyncChannel {
3888        self.client.as_channel()
3889    }
3890}
3891
3892impl CompositeConnectorProxy {
3893    /// Create a new Proxy for fuchsia.hardware.audio/CompositeConnector.
3894    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3895        let protocol_name =
3896            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3897        Self { client: fidl::client::Client::new(channel, protocol_name) }
3898    }
3899
3900    /// Get a Stream of events from the remote end of the protocol.
3901    ///
3902    /// # Panics
3903    ///
3904    /// Panics if the event stream was already taken.
3905    pub fn take_event_stream(&self) -> CompositeConnectorEventStream {
3906        CompositeConnectorEventStream { event_receiver: self.client.take_event_receiver() }
3907    }
3908
3909    /// Connect to a `Device` protocol.
3910    /// This method allows a component to serve FIDL outside the devhost's control.
3911    pub fn r#connect(
3912        &self,
3913        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
3914    ) -> Result<(), fidl::Error> {
3915        CompositeConnectorProxyInterface::r#connect(self, composite_protocol)
3916    }
3917}
3918
3919impl CompositeConnectorProxyInterface for CompositeConnectorProxy {
3920    fn r#connect(
3921        &self,
3922        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
3923    ) -> Result<(), fidl::Error> {
3924        self.client.send::<CompositeConnectorConnectRequest>(
3925            (composite_protocol,),
3926            0x7ee557529079e466,
3927            fidl::encoding::DynamicFlags::empty(),
3928        )
3929    }
3930}
3931
3932pub struct CompositeConnectorEventStream {
3933    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3934}
3935
3936impl std::marker::Unpin for CompositeConnectorEventStream {}
3937
3938impl futures::stream::FusedStream for CompositeConnectorEventStream {
3939    fn is_terminated(&self) -> bool {
3940        self.event_receiver.is_terminated()
3941    }
3942}
3943
3944impl futures::Stream for CompositeConnectorEventStream {
3945    type Item = Result<CompositeConnectorEvent, fidl::Error>;
3946
3947    fn poll_next(
3948        mut self: std::pin::Pin<&mut Self>,
3949        cx: &mut std::task::Context<'_>,
3950    ) -> std::task::Poll<Option<Self::Item>> {
3951        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3952            &mut self.event_receiver,
3953            cx
3954        )?) {
3955            Some(buf) => std::task::Poll::Ready(Some(CompositeConnectorEvent::decode(buf))),
3956            None => std::task::Poll::Ready(None),
3957        }
3958    }
3959}
3960
3961#[derive(Debug)]
3962pub enum CompositeConnectorEvent {}
3963
3964impl CompositeConnectorEvent {
3965    /// Decodes a message buffer as a [`CompositeConnectorEvent`].
3966    fn decode(
3967        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3968    ) -> Result<CompositeConnectorEvent, fidl::Error> {
3969        let (bytes, _handles) = buf.split_mut();
3970        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3971        debug_assert_eq!(tx_header.tx_id, 0);
3972        match tx_header.ordinal {
3973            _ => Err(fidl::Error::UnknownOrdinal {
3974                ordinal: tx_header.ordinal,
3975                protocol_name:
3976                    <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3977            }),
3978        }
3979    }
3980}
3981
3982/// A Stream of incoming requests for fuchsia.hardware.audio/CompositeConnector.
3983pub struct CompositeConnectorRequestStream {
3984    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3985    is_terminated: bool,
3986}
3987
3988impl std::marker::Unpin for CompositeConnectorRequestStream {}
3989
3990impl futures::stream::FusedStream for CompositeConnectorRequestStream {
3991    fn is_terminated(&self) -> bool {
3992        self.is_terminated
3993    }
3994}
3995
3996impl fidl::endpoints::RequestStream for CompositeConnectorRequestStream {
3997    type Protocol = CompositeConnectorMarker;
3998    type ControlHandle = CompositeConnectorControlHandle;
3999
4000    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4001        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4002    }
4003
4004    fn control_handle(&self) -> Self::ControlHandle {
4005        CompositeConnectorControlHandle { inner: self.inner.clone() }
4006    }
4007
4008    fn into_inner(
4009        self,
4010    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4011    {
4012        (self.inner, self.is_terminated)
4013    }
4014
4015    fn from_inner(
4016        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4017        is_terminated: bool,
4018    ) -> Self {
4019        Self { inner, is_terminated }
4020    }
4021}
4022
4023impl futures::Stream for CompositeConnectorRequestStream {
4024    type Item = Result<CompositeConnectorRequest, fidl::Error>;
4025
4026    fn poll_next(
4027        mut self: std::pin::Pin<&mut Self>,
4028        cx: &mut std::task::Context<'_>,
4029    ) -> std::task::Poll<Option<Self::Item>> {
4030        let this = &mut *self;
4031        if this.inner.check_shutdown(cx) {
4032            this.is_terminated = true;
4033            return std::task::Poll::Ready(None);
4034        }
4035        if this.is_terminated {
4036            panic!("polled CompositeConnectorRequestStream after completion");
4037        }
4038        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4039            |bytes, handles| {
4040                match this.inner.channel().read_etc(cx, bytes, handles) {
4041                    std::task::Poll::Ready(Ok(())) => {}
4042                    std::task::Poll::Pending => return std::task::Poll::Pending,
4043                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4044                        this.is_terminated = true;
4045                        return std::task::Poll::Ready(None);
4046                    }
4047                    std::task::Poll::Ready(Err(e)) => {
4048                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4049                            e.into(),
4050                        ))))
4051                    }
4052                }
4053
4054                // A message has been received from the channel
4055                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4056
4057                std::task::Poll::Ready(Some(match header.ordinal {
4058                0x7ee557529079e466 => {
4059                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4060                    let mut req = fidl::new_empty!(CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4061                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4062                    let control_handle = CompositeConnectorControlHandle {
4063                        inner: this.inner.clone(),
4064                    };
4065                    Ok(CompositeConnectorRequest::Connect {composite_protocol: req.composite_protocol,
4066
4067                        control_handle,
4068                    })
4069                }
4070                _ => Err(fidl::Error::UnknownOrdinal {
4071                    ordinal: header.ordinal,
4072                    protocol_name: <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4073                }),
4074            }))
4075            },
4076        )
4077    }
4078}
4079
4080/// For an overview see
4081/// [Audio Composite Devices](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md).
4082#[derive(Debug)]
4083pub enum CompositeConnectorRequest {
4084    /// Connect to a `Device` protocol.
4085    /// This method allows a component to serve FIDL outside the devhost's control.
4086    Connect {
4087        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4088        control_handle: CompositeConnectorControlHandle,
4089    },
4090}
4091
4092impl CompositeConnectorRequest {
4093    #[allow(irrefutable_let_patterns)]
4094    pub fn into_connect(
4095        self,
4096    ) -> Option<(fidl::endpoints::ServerEnd<CompositeMarker>, CompositeConnectorControlHandle)>
4097    {
4098        if let CompositeConnectorRequest::Connect { composite_protocol, control_handle } = self {
4099            Some((composite_protocol, control_handle))
4100        } else {
4101            None
4102        }
4103    }
4104
4105    /// Name of the method defined in FIDL
4106    pub fn method_name(&self) -> &'static str {
4107        match *self {
4108            CompositeConnectorRequest::Connect { .. } => "connect",
4109        }
4110    }
4111}
4112
4113#[derive(Debug, Clone)]
4114pub struct CompositeConnectorControlHandle {
4115    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4116}
4117
4118impl fidl::endpoints::ControlHandle for CompositeConnectorControlHandle {
4119    fn shutdown(&self) {
4120        self.inner.shutdown()
4121    }
4122    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4123        self.inner.shutdown_with_epitaph(status)
4124    }
4125
4126    fn is_closed(&self) -> bool {
4127        self.inner.channel().is_closed()
4128    }
4129    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4130        self.inner.channel().on_closed()
4131    }
4132
4133    #[cfg(target_os = "fuchsia")]
4134    fn signal_peer(
4135        &self,
4136        clear_mask: zx::Signals,
4137        set_mask: zx::Signals,
4138    ) -> Result<(), zx_status::Status> {
4139        use fidl::Peered;
4140        self.inner.channel().signal_peer(clear_mask, set_mask)
4141    }
4142}
4143
4144impl CompositeConnectorControlHandle {}
4145
4146#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4147pub struct DaiMarker;
4148
4149impl fidl::endpoints::ProtocolMarker for DaiMarker {
4150    type Proxy = DaiProxy;
4151    type RequestStream = DaiRequestStream;
4152    #[cfg(target_os = "fuchsia")]
4153    type SynchronousProxy = DaiSynchronousProxy;
4154
4155    const DEBUG_NAME: &'static str = "(anonymous) Dai";
4156}
4157pub type DaiGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
4158pub type DaiGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, i32>;
4159
4160pub trait DaiProxyInterface: Send + Sync {
4161    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
4162        + Send;
4163    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
4164    fn r#signal_processing_connect(
4165        &self,
4166        protocol: fidl::endpoints::ServerEnd<
4167            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4168        >,
4169    ) -> Result<(), fidl::Error>;
4170    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4171    fn r#reset(&self) -> Self::ResetResponseFut;
4172    type GetPropertiesResponseFut: std::future::Future<Output = Result<DaiProperties, fidl::Error>>
4173        + Send;
4174    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
4175    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<DaiGetDaiFormatsResult, fidl::Error>>
4176        + Send;
4177    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
4178    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<DaiGetRingBufferFormatsResult, fidl::Error>>
4179        + Send;
4180    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut;
4181    fn r#create_ring_buffer(
4182        &self,
4183        dai_format: &DaiFormat,
4184        ring_buffer_format: &Format,
4185        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4186    ) -> Result<(), fidl::Error>;
4187}
4188#[derive(Debug)]
4189#[cfg(target_os = "fuchsia")]
4190pub struct DaiSynchronousProxy {
4191    client: fidl::client::sync::Client,
4192}
4193
4194#[cfg(target_os = "fuchsia")]
4195impl fidl::endpoints::SynchronousProxy for DaiSynchronousProxy {
4196    type Proxy = DaiProxy;
4197    type Protocol = DaiMarker;
4198
4199    fn from_channel(inner: fidl::Channel) -> Self {
4200        Self::new(inner)
4201    }
4202
4203    fn into_channel(self) -> fidl::Channel {
4204        self.client.into_channel()
4205    }
4206
4207    fn as_channel(&self) -> &fidl::Channel {
4208        self.client.as_channel()
4209    }
4210}
4211
4212#[cfg(target_os = "fuchsia")]
4213impl DaiSynchronousProxy {
4214    pub fn new(channel: fidl::Channel) -> Self {
4215        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4216        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4217    }
4218
4219    pub fn into_channel(self) -> fidl::Channel {
4220        self.client.into_channel()
4221    }
4222
4223    /// Waits until an event arrives and returns it. It is safe for other
4224    /// threads to make concurrent requests while waiting for an event.
4225    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<DaiEvent, fidl::Error> {
4226        DaiEvent::decode(self.client.wait_for_event(deadline)?)
4227    }
4228
4229    /// Retrieves top level health state.
4230    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4231    pub fn r#get_health_state(
4232        &self,
4233        ___deadline: zx::MonotonicInstant,
4234    ) -> Result<HealthState, fidl::Error> {
4235        let _response =
4236            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
4237                (),
4238                0x4e146d6bca733a84,
4239                fidl::encoding::DynamicFlags::empty(),
4240                ___deadline,
4241            )?;
4242        Ok(_response.state)
4243    }
4244
4245    /// Connect to a `SignalProcessing` protocol.
4246    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4247    /// the maximum number of connections have already been created, for instance one, then the
4248    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4249    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4250    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4251    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4252    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4253    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4254    /// is intended to be composed, and hence the more verbose name allows differentiation and
4255    /// improved clarity.
4256    pub fn r#signal_processing_connect(
4257        &self,
4258        mut protocol: fidl::endpoints::ServerEnd<
4259            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4260        >,
4261    ) -> Result<(), fidl::Error> {
4262        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4263            (protocol,),
4264            0xa81907ce6066295,
4265            fidl::encoding::DynamicFlags::empty(),
4266        )
4267    }
4268
4269    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4270    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4271    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4272    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4273    /// protocol channel and retry.
4274    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
4275        let _response =
4276            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
4277                (),
4278                0x69e5fa9fa2f78c14,
4279                fidl::encoding::DynamicFlags::empty(),
4280                ___deadline,
4281            )?;
4282        Ok(_response)
4283    }
4284
4285    /// Retrieves top level static properties.
4286    pub fn r#get_properties(
4287        &self,
4288        ___deadline: zx::MonotonicInstant,
4289    ) -> Result<DaiProperties, fidl::Error> {
4290        let _response =
4291            self.client.send_query::<fidl::encoding::EmptyPayload, DaiGetPropertiesResponse>(
4292                (),
4293                0x2c25a1a66149510b,
4294                fidl::encoding::DynamicFlags::empty(),
4295                ___deadline,
4296            )?;
4297        Ok(_response.properties)
4298    }
4299
4300    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4301    /// may reply with an error status and the client may retry at a later time.
4302    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4303    /// the parameters in SupportedFormats may be supported.
4304    pub fn r#get_dai_formats(
4305        &self,
4306        ___deadline: zx::MonotonicInstant,
4307    ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4308        let _response = self.client.send_query::<
4309            fidl::encoding::EmptyPayload,
4310            fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
4311        >(
4312            (),
4313            0x1eb37b0cddf79d69,
4314            fidl::encoding::DynamicFlags::empty(),
4315            ___deadline,
4316        )?;
4317        Ok(_response.map(|x| x.dai_formats))
4318    }
4319
4320    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4321    /// may reply with an error status and the client may retry at a later time.
4322    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4323    /// the parameters in `SupportedFormats` may be supported.
4324    pub fn r#get_ring_buffer_formats(
4325        &self,
4326        ___deadline: zx::MonotonicInstant,
4327    ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
4328        let _response = self.client.send_query::<
4329            fidl::encoding::EmptyPayload,
4330            fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
4331        >(
4332            (),
4333            0x760371081d8c92e4,
4334            fidl::encoding::DynamicFlags::empty(),
4335            ___deadline,
4336        )?;
4337        Ok(_response.map(|x| x.ring_buffer_formats))
4338    }
4339
4340    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4341    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4342    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4343    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4344    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4345    /// gracefully quiesce any on-going streaming operations in the process.
4346    pub fn r#create_ring_buffer(
4347        &self,
4348        mut dai_format: &DaiFormat,
4349        mut ring_buffer_format: &Format,
4350        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4351    ) -> Result<(), fidl::Error> {
4352        self.client.send::<DaiCreateRingBufferRequest>(
4353            (dai_format, ring_buffer_format, ring_buffer),
4354            0x5af9760589a75257,
4355            fidl::encoding::DynamicFlags::empty(),
4356        )
4357    }
4358}
4359
4360#[cfg(target_os = "fuchsia")]
4361impl From<DaiSynchronousProxy> for zx::Handle {
4362    fn from(value: DaiSynchronousProxy) -> Self {
4363        value.into_channel().into()
4364    }
4365}
4366
4367#[cfg(target_os = "fuchsia")]
4368impl From<fidl::Channel> for DaiSynchronousProxy {
4369    fn from(value: fidl::Channel) -> Self {
4370        Self::new(value)
4371    }
4372}
4373
4374#[cfg(target_os = "fuchsia")]
4375impl fidl::endpoints::FromClient for DaiSynchronousProxy {
4376    type Protocol = DaiMarker;
4377
4378    fn from_client(value: fidl::endpoints::ClientEnd<DaiMarker>) -> Self {
4379        Self::new(value.into_channel())
4380    }
4381}
4382
4383#[derive(Debug, Clone)]
4384pub struct DaiProxy {
4385    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4386}
4387
4388impl fidl::endpoints::Proxy for DaiProxy {
4389    type Protocol = DaiMarker;
4390
4391    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4392        Self::new(inner)
4393    }
4394
4395    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4396        self.client.into_channel().map_err(|client| Self { client })
4397    }
4398
4399    fn as_channel(&self) -> &::fidl::AsyncChannel {
4400        self.client.as_channel()
4401    }
4402}
4403
4404impl DaiProxy {
4405    /// Create a new Proxy for fuchsia.hardware.audio/Dai.
4406    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4407        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4408        Self { client: fidl::client::Client::new(channel, protocol_name) }
4409    }
4410
4411    /// Get a Stream of events from the remote end of the protocol.
4412    ///
4413    /// # Panics
4414    ///
4415    /// Panics if the event stream was already taken.
4416    pub fn take_event_stream(&self) -> DaiEventStream {
4417        DaiEventStream { event_receiver: self.client.take_event_receiver() }
4418    }
4419
4420    /// Retrieves top level health state.
4421    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4422    pub fn r#get_health_state(
4423        &self,
4424    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
4425    {
4426        DaiProxyInterface::r#get_health_state(self)
4427    }
4428
4429    /// Connect to a `SignalProcessing` protocol.
4430    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4431    /// the maximum number of connections have already been created, for instance one, then the
4432    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4433    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4434    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4435    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4436    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4437    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4438    /// is intended to be composed, and hence the more verbose name allows differentiation and
4439    /// improved clarity.
4440    pub fn r#signal_processing_connect(
4441        &self,
4442        mut protocol: fidl::endpoints::ServerEnd<
4443            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4444        >,
4445    ) -> Result<(), fidl::Error> {
4446        DaiProxyInterface::r#signal_processing_connect(self, protocol)
4447    }
4448
4449    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4450    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4451    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4452    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4453    /// protocol channel and retry.
4454    pub fn r#reset(
4455        &self,
4456    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4457        DaiProxyInterface::r#reset(self)
4458    }
4459
4460    /// Retrieves top level static properties.
4461    pub fn r#get_properties(
4462        &self,
4463    ) -> fidl::client::QueryResponseFut<DaiProperties, fidl::encoding::DefaultFuchsiaResourceDialect>
4464    {
4465        DaiProxyInterface::r#get_properties(self)
4466    }
4467
4468    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4469    /// may reply with an error status and the client may retry at a later time.
4470    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4471    /// the parameters in SupportedFormats may be supported.
4472    pub fn r#get_dai_formats(
4473        &self,
4474    ) -> fidl::client::QueryResponseFut<
4475        DaiGetDaiFormatsResult,
4476        fidl::encoding::DefaultFuchsiaResourceDialect,
4477    > {
4478        DaiProxyInterface::r#get_dai_formats(self)
4479    }
4480
4481    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4482    /// may reply with an error status and the client may retry at a later time.
4483    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4484    /// the parameters in `SupportedFormats` may be supported.
4485    pub fn r#get_ring_buffer_formats(
4486        &self,
4487    ) -> fidl::client::QueryResponseFut<
4488        DaiGetRingBufferFormatsResult,
4489        fidl::encoding::DefaultFuchsiaResourceDialect,
4490    > {
4491        DaiProxyInterface::r#get_ring_buffer_formats(self)
4492    }
4493
4494    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4495    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4496    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4497    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4498    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4499    /// gracefully quiesce any on-going streaming operations in the process.
4500    pub fn r#create_ring_buffer(
4501        &self,
4502        mut dai_format: &DaiFormat,
4503        mut ring_buffer_format: &Format,
4504        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4505    ) -> Result<(), fidl::Error> {
4506        DaiProxyInterface::r#create_ring_buffer(self, dai_format, ring_buffer_format, ring_buffer)
4507    }
4508}
4509
4510impl DaiProxyInterface for DaiProxy {
4511    type GetHealthStateResponseFut =
4512        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
4513    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
4514        fn _decode(
4515            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4516        ) -> Result<HealthState, fidl::Error> {
4517            let _response = fidl::client::decode_transaction_body::<
4518                HealthGetHealthStateResponse,
4519                fidl::encoding::DefaultFuchsiaResourceDialect,
4520                0x4e146d6bca733a84,
4521            >(_buf?)?;
4522            Ok(_response.state)
4523        }
4524        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
4525            (),
4526            0x4e146d6bca733a84,
4527            fidl::encoding::DynamicFlags::empty(),
4528            _decode,
4529        )
4530    }
4531
4532    fn r#signal_processing_connect(
4533        &self,
4534        mut protocol: fidl::endpoints::ServerEnd<
4535            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4536        >,
4537    ) -> Result<(), fidl::Error> {
4538        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4539            (protocol,),
4540            0xa81907ce6066295,
4541            fidl::encoding::DynamicFlags::empty(),
4542        )
4543    }
4544
4545    type ResetResponseFut =
4546        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4547    fn r#reset(&self) -> Self::ResetResponseFut {
4548        fn _decode(
4549            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4550        ) -> Result<(), fidl::Error> {
4551            let _response = fidl::client::decode_transaction_body::<
4552                fidl::encoding::EmptyPayload,
4553                fidl::encoding::DefaultFuchsiaResourceDialect,
4554                0x69e5fa9fa2f78c14,
4555            >(_buf?)?;
4556            Ok(_response)
4557        }
4558        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4559            (),
4560            0x69e5fa9fa2f78c14,
4561            fidl::encoding::DynamicFlags::empty(),
4562            _decode,
4563        )
4564    }
4565
4566    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
4567        DaiProperties,
4568        fidl::encoding::DefaultFuchsiaResourceDialect,
4569    >;
4570    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
4571        fn _decode(
4572            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4573        ) -> Result<DaiProperties, fidl::Error> {
4574            let _response = fidl::client::decode_transaction_body::<
4575                DaiGetPropertiesResponse,
4576                fidl::encoding::DefaultFuchsiaResourceDialect,
4577                0x2c25a1a66149510b,
4578            >(_buf?)?;
4579            Ok(_response.properties)
4580        }
4581        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiProperties>(
4582            (),
4583            0x2c25a1a66149510b,
4584            fidl::encoding::DynamicFlags::empty(),
4585            _decode,
4586        )
4587    }
4588
4589    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
4590        DaiGetDaiFormatsResult,
4591        fidl::encoding::DefaultFuchsiaResourceDialect,
4592    >;
4593    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
4594        fn _decode(
4595            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4596        ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4597            let _response = fidl::client::decode_transaction_body::<
4598                fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
4599                fidl::encoding::DefaultFuchsiaResourceDialect,
4600                0x1eb37b0cddf79d69,
4601            >(_buf?)?;
4602            Ok(_response.map(|x| x.dai_formats))
4603        }
4604        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetDaiFormatsResult>(
4605            (),
4606            0x1eb37b0cddf79d69,
4607            fidl::encoding::DynamicFlags::empty(),
4608            _decode,
4609        )
4610    }
4611
4612    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
4613        DaiGetRingBufferFormatsResult,
4614        fidl::encoding::DefaultFuchsiaResourceDialect,
4615    >;
4616    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut {
4617        fn _decode(
4618            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4619        ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
4620            let _response = fidl::client::decode_transaction_body::<
4621                fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
4622                fidl::encoding::DefaultFuchsiaResourceDialect,
4623                0x760371081d8c92e4,
4624            >(_buf?)?;
4625            Ok(_response.map(|x| x.ring_buffer_formats))
4626        }
4627        self.client
4628            .send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetRingBufferFormatsResult>(
4629                (),
4630                0x760371081d8c92e4,
4631                fidl::encoding::DynamicFlags::empty(),
4632                _decode,
4633            )
4634    }
4635
4636    fn r#create_ring_buffer(
4637        &self,
4638        mut dai_format: &DaiFormat,
4639        mut ring_buffer_format: &Format,
4640        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4641    ) -> Result<(), fidl::Error> {
4642        self.client.send::<DaiCreateRingBufferRequest>(
4643            (dai_format, ring_buffer_format, ring_buffer),
4644            0x5af9760589a75257,
4645            fidl::encoding::DynamicFlags::empty(),
4646        )
4647    }
4648}
4649
4650pub struct DaiEventStream {
4651    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4652}
4653
4654impl std::marker::Unpin for DaiEventStream {}
4655
4656impl futures::stream::FusedStream for DaiEventStream {
4657    fn is_terminated(&self) -> bool {
4658        self.event_receiver.is_terminated()
4659    }
4660}
4661
4662impl futures::Stream for DaiEventStream {
4663    type Item = Result<DaiEvent, fidl::Error>;
4664
4665    fn poll_next(
4666        mut self: std::pin::Pin<&mut Self>,
4667        cx: &mut std::task::Context<'_>,
4668    ) -> std::task::Poll<Option<Self::Item>> {
4669        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4670            &mut self.event_receiver,
4671            cx
4672        )?) {
4673            Some(buf) => std::task::Poll::Ready(Some(DaiEvent::decode(buf))),
4674            None => std::task::Poll::Ready(None),
4675        }
4676    }
4677}
4678
4679#[derive(Debug)]
4680pub enum DaiEvent {}
4681
4682impl DaiEvent {
4683    /// Decodes a message buffer as a [`DaiEvent`].
4684    fn decode(
4685        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4686    ) -> Result<DaiEvent, fidl::Error> {
4687        let (bytes, _handles) = buf.split_mut();
4688        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4689        debug_assert_eq!(tx_header.tx_id, 0);
4690        match tx_header.ordinal {
4691            _ => Err(fidl::Error::UnknownOrdinal {
4692                ordinal: tx_header.ordinal,
4693                protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4694            }),
4695        }
4696    }
4697}
4698
4699/// A Stream of incoming requests for fuchsia.hardware.audio/Dai.
4700pub struct DaiRequestStream {
4701    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4702    is_terminated: bool,
4703}
4704
4705impl std::marker::Unpin for DaiRequestStream {}
4706
4707impl futures::stream::FusedStream for DaiRequestStream {
4708    fn is_terminated(&self) -> bool {
4709        self.is_terminated
4710    }
4711}
4712
4713impl fidl::endpoints::RequestStream for DaiRequestStream {
4714    type Protocol = DaiMarker;
4715    type ControlHandle = DaiControlHandle;
4716
4717    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4718        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4719    }
4720
4721    fn control_handle(&self) -> Self::ControlHandle {
4722        DaiControlHandle { inner: self.inner.clone() }
4723    }
4724
4725    fn into_inner(
4726        self,
4727    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4728    {
4729        (self.inner, self.is_terminated)
4730    }
4731
4732    fn from_inner(
4733        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4734        is_terminated: bool,
4735    ) -> Self {
4736        Self { inner, is_terminated }
4737    }
4738}
4739
4740impl futures::Stream for DaiRequestStream {
4741    type Item = Result<DaiRequest, fidl::Error>;
4742
4743    fn poll_next(
4744        mut self: std::pin::Pin<&mut Self>,
4745        cx: &mut std::task::Context<'_>,
4746    ) -> std::task::Poll<Option<Self::Item>> {
4747        let this = &mut *self;
4748        if this.inner.check_shutdown(cx) {
4749            this.is_terminated = true;
4750            return std::task::Poll::Ready(None);
4751        }
4752        if this.is_terminated {
4753            panic!("polled DaiRequestStream after completion");
4754        }
4755        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4756            |bytes, handles| {
4757                match this.inner.channel().read_etc(cx, bytes, handles) {
4758                    std::task::Poll::Ready(Ok(())) => {}
4759                    std::task::Poll::Pending => return std::task::Poll::Pending,
4760                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4761                        this.is_terminated = true;
4762                        return std::task::Poll::Ready(None);
4763                    }
4764                    std::task::Poll::Ready(Err(e)) => {
4765                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4766                            e.into(),
4767                        ))))
4768                    }
4769                }
4770
4771                // A message has been received from the channel
4772                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4773
4774                std::task::Poll::Ready(Some(match header.ordinal {
4775                    0x4e146d6bca733a84 => {
4776                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4777                        let mut req = fidl::new_empty!(
4778                            fidl::encoding::EmptyPayload,
4779                            fidl::encoding::DefaultFuchsiaResourceDialect
4780                        );
4781                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4782                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4783                        Ok(DaiRequest::GetHealthState {
4784                            responder: DaiGetHealthStateResponder {
4785                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4786                                tx_id: header.tx_id,
4787                            },
4788                        })
4789                    }
4790                    0xa81907ce6066295 => {
4791                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4792                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4793                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4794                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4795                        Ok(DaiRequest::SignalProcessingConnect {
4796                            protocol: req.protocol,
4797
4798                            control_handle,
4799                        })
4800                    }
4801                    0x69e5fa9fa2f78c14 => {
4802                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4803                        let mut req = fidl::new_empty!(
4804                            fidl::encoding::EmptyPayload,
4805                            fidl::encoding::DefaultFuchsiaResourceDialect
4806                        );
4807                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4808                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4809                        Ok(DaiRequest::Reset {
4810                            responder: DaiResetResponder {
4811                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4812                                tx_id: header.tx_id,
4813                            },
4814                        })
4815                    }
4816                    0x2c25a1a66149510b => {
4817                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4818                        let mut req = fidl::new_empty!(
4819                            fidl::encoding::EmptyPayload,
4820                            fidl::encoding::DefaultFuchsiaResourceDialect
4821                        );
4822                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4823                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4824                        Ok(DaiRequest::GetProperties {
4825                            responder: DaiGetPropertiesResponder {
4826                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4827                                tx_id: header.tx_id,
4828                            },
4829                        })
4830                    }
4831                    0x1eb37b0cddf79d69 => {
4832                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4833                        let mut req = fidl::new_empty!(
4834                            fidl::encoding::EmptyPayload,
4835                            fidl::encoding::DefaultFuchsiaResourceDialect
4836                        );
4837                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4838                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4839                        Ok(DaiRequest::GetDaiFormats {
4840                            responder: DaiGetDaiFormatsResponder {
4841                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4842                                tx_id: header.tx_id,
4843                            },
4844                        })
4845                    }
4846                    0x760371081d8c92e4 => {
4847                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4848                        let mut req = fidl::new_empty!(
4849                            fidl::encoding::EmptyPayload,
4850                            fidl::encoding::DefaultFuchsiaResourceDialect
4851                        );
4852                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4853                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4854                        Ok(DaiRequest::GetRingBufferFormats {
4855                            responder: DaiGetRingBufferFormatsResponder {
4856                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4857                                tx_id: header.tx_id,
4858                            },
4859                        })
4860                    }
4861                    0x5af9760589a75257 => {
4862                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4863                        let mut req = fidl::new_empty!(
4864                            DaiCreateRingBufferRequest,
4865                            fidl::encoding::DefaultFuchsiaResourceDialect
4866                        );
4867                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
4868                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4869                        Ok(DaiRequest::CreateRingBuffer {
4870                            dai_format: req.dai_format,
4871                            ring_buffer_format: req.ring_buffer_format,
4872                            ring_buffer: req.ring_buffer,
4873
4874                            control_handle,
4875                        })
4876                    }
4877                    _ => Err(fidl::Error::UnknownOrdinal {
4878                        ordinal: header.ordinal,
4879                        protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4880                    }),
4881                }))
4882            },
4883        )
4884    }
4885}
4886
4887/// For an overview see
4888/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_dai).
4889/// # Deprecation
4890///
4891/// Not supported anymore, instead use an
4892/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
4893/// with one DAI and one Ring Buffer, see
4894/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
4895#[derive(Debug)]
4896pub enum DaiRequest {
4897    /// Retrieves top level health state.
4898    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4899    GetHealthState { responder: DaiGetHealthStateResponder },
4900    /// Connect to a `SignalProcessing` protocol.
4901    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4902    /// the maximum number of connections have already been created, for instance one, then the
4903    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4904    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4905    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4906    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4907    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4908    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4909    /// is intended to be composed, and hence the more verbose name allows differentiation and
4910    /// improved clarity.
4911    SignalProcessingConnect {
4912        protocol: fidl::endpoints::ServerEnd<
4913            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4914        >,
4915        control_handle: DaiControlHandle,
4916    },
4917    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4918    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4919    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4920    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4921    /// protocol channel and retry.
4922    Reset { responder: DaiResetResponder },
4923    /// Retrieves top level static properties.
4924    GetProperties { responder: DaiGetPropertiesResponder },
4925    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4926    /// may reply with an error status and the client may retry at a later time.
4927    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4928    /// the parameters in SupportedFormats may be supported.
4929    GetDaiFormats { responder: DaiGetDaiFormatsResponder },
4930    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4931    /// may reply with an error status and the client may retry at a later time.
4932    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4933    /// the parameters in `SupportedFormats` may be supported.
4934    GetRingBufferFormats { responder: DaiGetRingBufferFormatsResponder },
4935    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4936    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4937    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4938    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4939    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4940    /// gracefully quiesce any on-going streaming operations in the process.
4941    CreateRingBuffer {
4942        dai_format: DaiFormat,
4943        ring_buffer_format: Format,
4944        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4945        control_handle: DaiControlHandle,
4946    },
4947}
4948
4949impl DaiRequest {
4950    #[allow(irrefutable_let_patterns)]
4951    pub fn into_get_health_state(self) -> Option<(DaiGetHealthStateResponder)> {
4952        if let DaiRequest::GetHealthState { responder } = self {
4953            Some((responder))
4954        } else {
4955            None
4956        }
4957    }
4958
4959    #[allow(irrefutable_let_patterns)]
4960    pub fn into_signal_processing_connect(
4961        self,
4962    ) -> Option<(
4963        fidl::endpoints::ServerEnd<
4964            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4965        >,
4966        DaiControlHandle,
4967    )> {
4968        if let DaiRequest::SignalProcessingConnect { protocol, control_handle } = self {
4969            Some((protocol, control_handle))
4970        } else {
4971            None
4972        }
4973    }
4974
4975    #[allow(irrefutable_let_patterns)]
4976    pub fn into_reset(self) -> Option<(DaiResetResponder)> {
4977        if let DaiRequest::Reset { responder } = self {
4978            Some((responder))
4979        } else {
4980            None
4981        }
4982    }
4983
4984    #[allow(irrefutable_let_patterns)]
4985    pub fn into_get_properties(self) -> Option<(DaiGetPropertiesResponder)> {
4986        if let DaiRequest::GetProperties { responder } = self {
4987            Some((responder))
4988        } else {
4989            None
4990        }
4991    }
4992
4993    #[allow(irrefutable_let_patterns)]
4994    pub fn into_get_dai_formats(self) -> Option<(DaiGetDaiFormatsResponder)> {
4995        if let DaiRequest::GetDaiFormats { responder } = self {
4996            Some((responder))
4997        } else {
4998            None
4999        }
5000    }
5001
5002    #[allow(irrefutable_let_patterns)]
5003    pub fn into_get_ring_buffer_formats(self) -> Option<(DaiGetRingBufferFormatsResponder)> {
5004        if let DaiRequest::GetRingBufferFormats { responder } = self {
5005            Some((responder))
5006        } else {
5007            None
5008        }
5009    }
5010
5011    #[allow(irrefutable_let_patterns)]
5012    pub fn into_create_ring_buffer(
5013        self,
5014    ) -> Option<(DaiFormat, Format, fidl::endpoints::ServerEnd<RingBufferMarker>, DaiControlHandle)>
5015    {
5016        if let DaiRequest::CreateRingBuffer {
5017            dai_format,
5018            ring_buffer_format,
5019            ring_buffer,
5020            control_handle,
5021        } = self
5022        {
5023            Some((dai_format, ring_buffer_format, ring_buffer, control_handle))
5024        } else {
5025            None
5026        }
5027    }
5028
5029    /// Name of the method defined in FIDL
5030    pub fn method_name(&self) -> &'static str {
5031        match *self {
5032            DaiRequest::GetHealthState { .. } => "get_health_state",
5033            DaiRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
5034            DaiRequest::Reset { .. } => "reset",
5035            DaiRequest::GetProperties { .. } => "get_properties",
5036            DaiRequest::GetDaiFormats { .. } => "get_dai_formats",
5037            DaiRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
5038            DaiRequest::CreateRingBuffer { .. } => "create_ring_buffer",
5039        }
5040    }
5041}
5042
5043#[derive(Debug, Clone)]
5044pub struct DaiControlHandle {
5045    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5046}
5047
5048impl fidl::endpoints::ControlHandle for DaiControlHandle {
5049    fn shutdown(&self) {
5050        self.inner.shutdown()
5051    }
5052    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5053        self.inner.shutdown_with_epitaph(status)
5054    }
5055
5056    fn is_closed(&self) -> bool {
5057        self.inner.channel().is_closed()
5058    }
5059    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5060        self.inner.channel().on_closed()
5061    }
5062
5063    #[cfg(target_os = "fuchsia")]
5064    fn signal_peer(
5065        &self,
5066        clear_mask: zx::Signals,
5067        set_mask: zx::Signals,
5068    ) -> Result<(), zx_status::Status> {
5069        use fidl::Peered;
5070        self.inner.channel().signal_peer(clear_mask, set_mask)
5071    }
5072}
5073
5074impl DaiControlHandle {}
5075
5076#[must_use = "FIDL methods require a response to be sent"]
5077#[derive(Debug)]
5078pub struct DaiGetHealthStateResponder {
5079    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5080    tx_id: u32,
5081}
5082
5083/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5084/// if the responder is dropped without sending a response, so that the client
5085/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5086impl std::ops::Drop for DaiGetHealthStateResponder {
5087    fn drop(&mut self) {
5088        self.control_handle.shutdown();
5089        // Safety: drops once, never accessed again
5090        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5091    }
5092}
5093
5094impl fidl::endpoints::Responder for DaiGetHealthStateResponder {
5095    type ControlHandle = DaiControlHandle;
5096
5097    fn control_handle(&self) -> &DaiControlHandle {
5098        &self.control_handle
5099    }
5100
5101    fn drop_without_shutdown(mut self) {
5102        // Safety: drops once, never accessed again due to mem::forget
5103        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5104        // Prevent Drop from running (which would shut down the channel)
5105        std::mem::forget(self);
5106    }
5107}
5108
5109impl DaiGetHealthStateResponder {
5110    /// Sends a response to the FIDL transaction.
5111    ///
5112    /// Sets the channel to shutdown if an error occurs.
5113    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5114        let _result = self.send_raw(state);
5115        if _result.is_err() {
5116            self.control_handle.shutdown();
5117        }
5118        self.drop_without_shutdown();
5119        _result
5120    }
5121
5122    /// Similar to "send" but does not shutdown the channel if an error occurs.
5123    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5124        let _result = self.send_raw(state);
5125        self.drop_without_shutdown();
5126        _result
5127    }
5128
5129    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
5130        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
5131            (state,),
5132            self.tx_id,
5133            0x4e146d6bca733a84,
5134            fidl::encoding::DynamicFlags::empty(),
5135        )
5136    }
5137}
5138
5139#[must_use = "FIDL methods require a response to be sent"]
5140#[derive(Debug)]
5141pub struct DaiResetResponder {
5142    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5143    tx_id: u32,
5144}
5145
5146/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5147/// if the responder is dropped without sending a response, so that the client
5148/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5149impl std::ops::Drop for DaiResetResponder {
5150    fn drop(&mut self) {
5151        self.control_handle.shutdown();
5152        // Safety: drops once, never accessed again
5153        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5154    }
5155}
5156
5157impl fidl::endpoints::Responder for DaiResetResponder {
5158    type ControlHandle = DaiControlHandle;
5159
5160    fn control_handle(&self) -> &DaiControlHandle {
5161        &self.control_handle
5162    }
5163
5164    fn drop_without_shutdown(mut self) {
5165        // Safety: drops once, never accessed again due to mem::forget
5166        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5167        // Prevent Drop from running (which would shut down the channel)
5168        std::mem::forget(self);
5169    }
5170}
5171
5172impl DaiResetResponder {
5173    /// Sends a response to the FIDL transaction.
5174    ///
5175    /// Sets the channel to shutdown if an error occurs.
5176    pub fn send(self) -> Result<(), fidl::Error> {
5177        let _result = self.send_raw();
5178        if _result.is_err() {
5179            self.control_handle.shutdown();
5180        }
5181        self.drop_without_shutdown();
5182        _result
5183    }
5184
5185    /// Similar to "send" but does not shutdown the channel if an error occurs.
5186    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5187        let _result = self.send_raw();
5188        self.drop_without_shutdown();
5189        _result
5190    }
5191
5192    fn send_raw(&self) -> Result<(), fidl::Error> {
5193        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5194            (),
5195            self.tx_id,
5196            0x69e5fa9fa2f78c14,
5197            fidl::encoding::DynamicFlags::empty(),
5198        )
5199    }
5200}
5201
5202#[must_use = "FIDL methods require a response to be sent"]
5203#[derive(Debug)]
5204pub struct DaiGetPropertiesResponder {
5205    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5206    tx_id: u32,
5207}
5208
5209/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5210/// if the responder is dropped without sending a response, so that the client
5211/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5212impl std::ops::Drop for DaiGetPropertiesResponder {
5213    fn drop(&mut self) {
5214        self.control_handle.shutdown();
5215        // Safety: drops once, never accessed again
5216        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5217    }
5218}
5219
5220impl fidl::endpoints::Responder for DaiGetPropertiesResponder {
5221    type ControlHandle = DaiControlHandle;
5222
5223    fn control_handle(&self) -> &DaiControlHandle {
5224        &self.control_handle
5225    }
5226
5227    fn drop_without_shutdown(mut self) {
5228        // Safety: drops once, never accessed again due to mem::forget
5229        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5230        // Prevent Drop from running (which would shut down the channel)
5231        std::mem::forget(self);
5232    }
5233}
5234
5235impl DaiGetPropertiesResponder {
5236    /// Sends a response to the FIDL transaction.
5237    ///
5238    /// Sets the channel to shutdown if an error occurs.
5239    pub fn send(self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5240        let _result = self.send_raw(properties);
5241        if _result.is_err() {
5242            self.control_handle.shutdown();
5243        }
5244        self.drop_without_shutdown();
5245        _result
5246    }
5247
5248    /// Similar to "send" but does not shutdown the channel if an error occurs.
5249    pub fn send_no_shutdown_on_err(
5250        self,
5251        mut properties: &DaiProperties,
5252    ) -> Result<(), fidl::Error> {
5253        let _result = self.send_raw(properties);
5254        self.drop_without_shutdown();
5255        _result
5256    }
5257
5258    fn send_raw(&self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5259        self.control_handle.inner.send::<DaiGetPropertiesResponse>(
5260            (properties,),
5261            self.tx_id,
5262            0x2c25a1a66149510b,
5263            fidl::encoding::DynamicFlags::empty(),
5264        )
5265    }
5266}
5267
5268#[must_use = "FIDL methods require a response to be sent"]
5269#[derive(Debug)]
5270pub struct DaiGetDaiFormatsResponder {
5271    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5272    tx_id: u32,
5273}
5274
5275/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5276/// if the responder is dropped without sending a response, so that the client
5277/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5278impl std::ops::Drop for DaiGetDaiFormatsResponder {
5279    fn drop(&mut self) {
5280        self.control_handle.shutdown();
5281        // Safety: drops once, never accessed again
5282        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5283    }
5284}
5285
5286impl fidl::endpoints::Responder for DaiGetDaiFormatsResponder {
5287    type ControlHandle = DaiControlHandle;
5288
5289    fn control_handle(&self) -> &DaiControlHandle {
5290        &self.control_handle
5291    }
5292
5293    fn drop_without_shutdown(mut self) {
5294        // Safety: drops once, never accessed again due to mem::forget
5295        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5296        // Prevent Drop from running (which would shut down the channel)
5297        std::mem::forget(self);
5298    }
5299}
5300
5301impl DaiGetDaiFormatsResponder {
5302    /// Sends a response to the FIDL transaction.
5303    ///
5304    /// Sets the channel to shutdown if an error occurs.
5305    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5306        let _result = self.send_raw(result);
5307        if _result.is_err() {
5308            self.control_handle.shutdown();
5309        }
5310        self.drop_without_shutdown();
5311        _result
5312    }
5313
5314    /// Similar to "send" but does not shutdown the channel if an error occurs.
5315    pub fn send_no_shutdown_on_err(
5316        self,
5317        mut result: Result<&[DaiSupportedFormats], i32>,
5318    ) -> Result<(), fidl::Error> {
5319        let _result = self.send_raw(result);
5320        self.drop_without_shutdown();
5321        _result
5322    }
5323
5324    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5325        self.control_handle.inner.send::<fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>>(
5326            result.map(|dai_formats| (dai_formats,)),
5327            self.tx_id,
5328            0x1eb37b0cddf79d69,
5329            fidl::encoding::DynamicFlags::empty(),
5330        )
5331    }
5332}
5333
5334#[must_use = "FIDL methods require a response to be sent"]
5335#[derive(Debug)]
5336pub struct DaiGetRingBufferFormatsResponder {
5337    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5338    tx_id: u32,
5339}
5340
5341/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5342/// if the responder is dropped without sending a response, so that the client
5343/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5344impl std::ops::Drop for DaiGetRingBufferFormatsResponder {
5345    fn drop(&mut self) {
5346        self.control_handle.shutdown();
5347        // Safety: drops once, never accessed again
5348        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5349    }
5350}
5351
5352impl fidl::endpoints::Responder for DaiGetRingBufferFormatsResponder {
5353    type ControlHandle = DaiControlHandle;
5354
5355    fn control_handle(&self) -> &DaiControlHandle {
5356        &self.control_handle
5357    }
5358
5359    fn drop_without_shutdown(mut self) {
5360        // Safety: drops once, never accessed again due to mem::forget
5361        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5362        // Prevent Drop from running (which would shut down the channel)
5363        std::mem::forget(self);
5364    }
5365}
5366
5367impl DaiGetRingBufferFormatsResponder {
5368    /// Sends a response to the FIDL transaction.
5369    ///
5370    /// Sets the channel to shutdown if an error occurs.
5371    pub fn send(self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5372        let _result = self.send_raw(result);
5373        if _result.is_err() {
5374            self.control_handle.shutdown();
5375        }
5376        self.drop_without_shutdown();
5377        _result
5378    }
5379
5380    /// Similar to "send" but does not shutdown the channel if an error occurs.
5381    pub fn send_no_shutdown_on_err(
5382        self,
5383        mut result: Result<&[SupportedFormats], i32>,
5384    ) -> Result<(), fidl::Error> {
5385        let _result = self.send_raw(result);
5386        self.drop_without_shutdown();
5387        _result
5388    }
5389
5390    fn send_raw(&self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5391        self.control_handle
5392            .inner
5393            .send::<fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>>(
5394                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
5395                self.tx_id,
5396                0x760371081d8c92e4,
5397                fidl::encoding::DynamicFlags::empty(),
5398            )
5399    }
5400}
5401
5402#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5403pub struct DaiConnectorMarker;
5404
5405impl fidl::endpoints::ProtocolMarker for DaiConnectorMarker {
5406    type Proxy = DaiConnectorProxy;
5407    type RequestStream = DaiConnectorRequestStream;
5408    #[cfg(target_os = "fuchsia")]
5409    type SynchronousProxy = DaiConnectorSynchronousProxy;
5410
5411    const DEBUG_NAME: &'static str = "(anonymous) DaiConnector";
5412}
5413
5414pub trait DaiConnectorProxyInterface: Send + Sync {
5415    fn r#connect(
5416        &self,
5417        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5418    ) -> Result<(), fidl::Error>;
5419}
5420#[derive(Debug)]
5421#[cfg(target_os = "fuchsia")]
5422pub struct DaiConnectorSynchronousProxy {
5423    client: fidl::client::sync::Client,
5424}
5425
5426#[cfg(target_os = "fuchsia")]
5427impl fidl::endpoints::SynchronousProxy for DaiConnectorSynchronousProxy {
5428    type Proxy = DaiConnectorProxy;
5429    type Protocol = DaiConnectorMarker;
5430
5431    fn from_channel(inner: fidl::Channel) -> Self {
5432        Self::new(inner)
5433    }
5434
5435    fn into_channel(self) -> fidl::Channel {
5436        self.client.into_channel()
5437    }
5438
5439    fn as_channel(&self) -> &fidl::Channel {
5440        self.client.as_channel()
5441    }
5442}
5443
5444#[cfg(target_os = "fuchsia")]
5445impl DaiConnectorSynchronousProxy {
5446    pub fn new(channel: fidl::Channel) -> Self {
5447        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5448        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5449    }
5450
5451    pub fn into_channel(self) -> fidl::Channel {
5452        self.client.into_channel()
5453    }
5454
5455    /// Waits until an event arrives and returns it. It is safe for other
5456    /// threads to make concurrent requests while waiting for an event.
5457    pub fn wait_for_event(
5458        &self,
5459        deadline: zx::MonotonicInstant,
5460    ) -> Result<DaiConnectorEvent, fidl::Error> {
5461        DaiConnectorEvent::decode(self.client.wait_for_event(deadline)?)
5462    }
5463
5464    /// This connects to a DAI protocol server.
5465    pub fn r#connect(
5466        &self,
5467        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5468    ) -> Result<(), fidl::Error> {
5469        self.client.send::<DaiConnectorConnectRequest>(
5470            (dai_protocol,),
5471            0x4e4db05c2eca1450,
5472            fidl::encoding::DynamicFlags::empty(),
5473        )
5474    }
5475}
5476
5477#[cfg(target_os = "fuchsia")]
5478impl From<DaiConnectorSynchronousProxy> for zx::Handle {
5479    fn from(value: DaiConnectorSynchronousProxy) -> Self {
5480        value.into_channel().into()
5481    }
5482}
5483
5484#[cfg(target_os = "fuchsia")]
5485impl From<fidl::Channel> for DaiConnectorSynchronousProxy {
5486    fn from(value: fidl::Channel) -> Self {
5487        Self::new(value)
5488    }
5489}
5490
5491#[cfg(target_os = "fuchsia")]
5492impl fidl::endpoints::FromClient for DaiConnectorSynchronousProxy {
5493    type Protocol = DaiConnectorMarker;
5494
5495    fn from_client(value: fidl::endpoints::ClientEnd<DaiConnectorMarker>) -> Self {
5496        Self::new(value.into_channel())
5497    }
5498}
5499
5500#[derive(Debug, Clone)]
5501pub struct DaiConnectorProxy {
5502    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5503}
5504
5505impl fidl::endpoints::Proxy for DaiConnectorProxy {
5506    type Protocol = DaiConnectorMarker;
5507
5508    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5509        Self::new(inner)
5510    }
5511
5512    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5513        self.client.into_channel().map_err(|client| Self { client })
5514    }
5515
5516    fn as_channel(&self) -> &::fidl::AsyncChannel {
5517        self.client.as_channel()
5518    }
5519}
5520
5521impl DaiConnectorProxy {
5522    /// Create a new Proxy for fuchsia.hardware.audio/DaiConnector.
5523    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5524        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5525        Self { client: fidl::client::Client::new(channel, protocol_name) }
5526    }
5527
5528    /// Get a Stream of events from the remote end of the protocol.
5529    ///
5530    /// # Panics
5531    ///
5532    /// Panics if the event stream was already taken.
5533    pub fn take_event_stream(&self) -> DaiConnectorEventStream {
5534        DaiConnectorEventStream { event_receiver: self.client.take_event_receiver() }
5535    }
5536
5537    /// This connects to a DAI protocol server.
5538    pub fn r#connect(
5539        &self,
5540        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5541    ) -> Result<(), fidl::Error> {
5542        DaiConnectorProxyInterface::r#connect(self, dai_protocol)
5543    }
5544}
5545
5546impl DaiConnectorProxyInterface for DaiConnectorProxy {
5547    fn r#connect(
5548        &self,
5549        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5550    ) -> Result<(), fidl::Error> {
5551        self.client.send::<DaiConnectorConnectRequest>(
5552            (dai_protocol,),
5553            0x4e4db05c2eca1450,
5554            fidl::encoding::DynamicFlags::empty(),
5555        )
5556    }
5557}
5558
5559pub struct DaiConnectorEventStream {
5560    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5561}
5562
5563impl std::marker::Unpin for DaiConnectorEventStream {}
5564
5565impl futures::stream::FusedStream for DaiConnectorEventStream {
5566    fn is_terminated(&self) -> bool {
5567        self.event_receiver.is_terminated()
5568    }
5569}
5570
5571impl futures::Stream for DaiConnectorEventStream {
5572    type Item = Result<DaiConnectorEvent, fidl::Error>;
5573
5574    fn poll_next(
5575        mut self: std::pin::Pin<&mut Self>,
5576        cx: &mut std::task::Context<'_>,
5577    ) -> std::task::Poll<Option<Self::Item>> {
5578        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5579            &mut self.event_receiver,
5580            cx
5581        )?) {
5582            Some(buf) => std::task::Poll::Ready(Some(DaiConnectorEvent::decode(buf))),
5583            None => std::task::Poll::Ready(None),
5584        }
5585    }
5586}
5587
5588#[derive(Debug)]
5589pub enum DaiConnectorEvent {}
5590
5591impl DaiConnectorEvent {
5592    /// Decodes a message buffer as a [`DaiConnectorEvent`].
5593    fn decode(
5594        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5595    ) -> Result<DaiConnectorEvent, fidl::Error> {
5596        let (bytes, _handles) = buf.split_mut();
5597        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5598        debug_assert_eq!(tx_header.tx_id, 0);
5599        match tx_header.ordinal {
5600            _ => Err(fidl::Error::UnknownOrdinal {
5601                ordinal: tx_header.ordinal,
5602                protocol_name: <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5603            }),
5604        }
5605    }
5606}
5607
5608/// A Stream of incoming requests for fuchsia.hardware.audio/DaiConnector.
5609pub struct DaiConnectorRequestStream {
5610    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5611    is_terminated: bool,
5612}
5613
5614impl std::marker::Unpin for DaiConnectorRequestStream {}
5615
5616impl futures::stream::FusedStream for DaiConnectorRequestStream {
5617    fn is_terminated(&self) -> bool {
5618        self.is_terminated
5619    }
5620}
5621
5622impl fidl::endpoints::RequestStream for DaiConnectorRequestStream {
5623    type Protocol = DaiConnectorMarker;
5624    type ControlHandle = DaiConnectorControlHandle;
5625
5626    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5627        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5628    }
5629
5630    fn control_handle(&self) -> Self::ControlHandle {
5631        DaiConnectorControlHandle { inner: self.inner.clone() }
5632    }
5633
5634    fn into_inner(
5635        self,
5636    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5637    {
5638        (self.inner, self.is_terminated)
5639    }
5640
5641    fn from_inner(
5642        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5643        is_terminated: bool,
5644    ) -> Self {
5645        Self { inner, is_terminated }
5646    }
5647}
5648
5649impl futures::Stream for DaiConnectorRequestStream {
5650    type Item = Result<DaiConnectorRequest, fidl::Error>;
5651
5652    fn poll_next(
5653        mut self: std::pin::Pin<&mut Self>,
5654        cx: &mut std::task::Context<'_>,
5655    ) -> std::task::Poll<Option<Self::Item>> {
5656        let this = &mut *self;
5657        if this.inner.check_shutdown(cx) {
5658            this.is_terminated = true;
5659            return std::task::Poll::Ready(None);
5660        }
5661        if this.is_terminated {
5662            panic!("polled DaiConnectorRequestStream after completion");
5663        }
5664        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5665            |bytes, handles| {
5666                match this.inner.channel().read_etc(cx, bytes, handles) {
5667                    std::task::Poll::Ready(Ok(())) => {}
5668                    std::task::Poll::Pending => return std::task::Poll::Pending,
5669                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5670                        this.is_terminated = true;
5671                        return std::task::Poll::Ready(None);
5672                    }
5673                    std::task::Poll::Ready(Err(e)) => {
5674                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5675                            e.into(),
5676                        ))))
5677                    }
5678                }
5679
5680                // A message has been received from the channel
5681                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5682
5683                std::task::Poll::Ready(Some(match header.ordinal {
5684                    0x4e4db05c2eca1450 => {
5685                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5686                        let mut req = fidl::new_empty!(
5687                            DaiConnectorConnectRequest,
5688                            fidl::encoding::DefaultFuchsiaResourceDialect
5689                        );
5690                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5691                        let control_handle =
5692                            DaiConnectorControlHandle { inner: this.inner.clone() };
5693                        Ok(DaiConnectorRequest::Connect {
5694                            dai_protocol: req.dai_protocol,
5695
5696                            control_handle,
5697                        })
5698                    }
5699                    _ => Err(fidl::Error::UnknownOrdinal {
5700                        ordinal: header.ordinal,
5701                        protocol_name:
5702                            <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5703                    }),
5704                }))
5705            },
5706        )
5707    }
5708}
5709
5710/// For an overview of the DAI protocols see
5711/// [Digital Audio Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_dai.md)
5712/// # Deprecation
5713///
5714/// Not supported anymore, instead use an
5715/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5716/// with one DAI and one Ring Buffer, see
5717/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5718#[derive(Debug)]
5719pub enum DaiConnectorRequest {
5720    /// This connects to a DAI protocol server.
5721    Connect {
5722        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5723        control_handle: DaiConnectorControlHandle,
5724    },
5725}
5726
5727impl DaiConnectorRequest {
5728    #[allow(irrefutable_let_patterns)]
5729    pub fn into_connect(
5730        self,
5731    ) -> Option<(fidl::endpoints::ServerEnd<DaiMarker>, DaiConnectorControlHandle)> {
5732        if let DaiConnectorRequest::Connect { dai_protocol, control_handle } = self {
5733            Some((dai_protocol, control_handle))
5734        } else {
5735            None
5736        }
5737    }
5738
5739    /// Name of the method defined in FIDL
5740    pub fn method_name(&self) -> &'static str {
5741        match *self {
5742            DaiConnectorRequest::Connect { .. } => "connect",
5743        }
5744    }
5745}
5746
5747#[derive(Debug, Clone)]
5748pub struct DaiConnectorControlHandle {
5749    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5750}
5751
5752impl fidl::endpoints::ControlHandle for DaiConnectorControlHandle {
5753    fn shutdown(&self) {
5754        self.inner.shutdown()
5755    }
5756    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5757        self.inner.shutdown_with_epitaph(status)
5758    }
5759
5760    fn is_closed(&self) -> bool {
5761        self.inner.channel().is_closed()
5762    }
5763    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5764        self.inner.channel().on_closed()
5765    }
5766
5767    #[cfg(target_os = "fuchsia")]
5768    fn signal_peer(
5769        &self,
5770        clear_mask: zx::Signals,
5771        set_mask: zx::Signals,
5772    ) -> Result<(), zx_status::Status> {
5773        use fidl::Peered;
5774        self.inner.channel().signal_peer(clear_mask, set_mask)
5775    }
5776}
5777
5778impl DaiConnectorControlHandle {}
5779
5780#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5781pub struct HealthMarker;
5782
5783impl fidl::endpoints::ProtocolMarker for HealthMarker {
5784    type Proxy = HealthProxy;
5785    type RequestStream = HealthRequestStream;
5786    #[cfg(target_os = "fuchsia")]
5787    type SynchronousProxy = HealthSynchronousProxy;
5788
5789    const DEBUG_NAME: &'static str = "(anonymous) Health";
5790}
5791
5792pub trait HealthProxyInterface: Send + Sync {
5793    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
5794        + Send;
5795    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
5796}
5797#[derive(Debug)]
5798#[cfg(target_os = "fuchsia")]
5799pub struct HealthSynchronousProxy {
5800    client: fidl::client::sync::Client,
5801}
5802
5803#[cfg(target_os = "fuchsia")]
5804impl fidl::endpoints::SynchronousProxy for HealthSynchronousProxy {
5805    type Proxy = HealthProxy;
5806    type Protocol = HealthMarker;
5807
5808    fn from_channel(inner: fidl::Channel) -> Self {
5809        Self::new(inner)
5810    }
5811
5812    fn into_channel(self) -> fidl::Channel {
5813        self.client.into_channel()
5814    }
5815
5816    fn as_channel(&self) -> &fidl::Channel {
5817        self.client.as_channel()
5818    }
5819}
5820
5821#[cfg(target_os = "fuchsia")]
5822impl HealthSynchronousProxy {
5823    pub fn new(channel: fidl::Channel) -> Self {
5824        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5825        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5826    }
5827
5828    pub fn into_channel(self) -> fidl::Channel {
5829        self.client.into_channel()
5830    }
5831
5832    /// Waits until an event arrives and returns it. It is safe for other
5833    /// threads to make concurrent requests while waiting for an event.
5834    pub fn wait_for_event(
5835        &self,
5836        deadline: zx::MonotonicInstant,
5837    ) -> Result<HealthEvent, fidl::Error> {
5838        HealthEvent::decode(self.client.wait_for_event(deadline)?)
5839    }
5840
5841    /// Retrieves top level health state.
5842    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5843    pub fn r#get_health_state(
5844        &self,
5845        ___deadline: zx::MonotonicInstant,
5846    ) -> Result<HealthState, fidl::Error> {
5847        let _response =
5848            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
5849                (),
5850                0x4e146d6bca733a84,
5851                fidl::encoding::DynamicFlags::empty(),
5852                ___deadline,
5853            )?;
5854        Ok(_response.state)
5855    }
5856}
5857
5858#[cfg(target_os = "fuchsia")]
5859impl From<HealthSynchronousProxy> for zx::Handle {
5860    fn from(value: HealthSynchronousProxy) -> Self {
5861        value.into_channel().into()
5862    }
5863}
5864
5865#[cfg(target_os = "fuchsia")]
5866impl From<fidl::Channel> for HealthSynchronousProxy {
5867    fn from(value: fidl::Channel) -> Self {
5868        Self::new(value)
5869    }
5870}
5871
5872#[cfg(target_os = "fuchsia")]
5873impl fidl::endpoints::FromClient for HealthSynchronousProxy {
5874    type Protocol = HealthMarker;
5875
5876    fn from_client(value: fidl::endpoints::ClientEnd<HealthMarker>) -> Self {
5877        Self::new(value.into_channel())
5878    }
5879}
5880
5881#[derive(Debug, Clone)]
5882pub struct HealthProxy {
5883    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5884}
5885
5886impl fidl::endpoints::Proxy for HealthProxy {
5887    type Protocol = HealthMarker;
5888
5889    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5890        Self::new(inner)
5891    }
5892
5893    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5894        self.client.into_channel().map_err(|client| Self { client })
5895    }
5896
5897    fn as_channel(&self) -> &::fidl::AsyncChannel {
5898        self.client.as_channel()
5899    }
5900}
5901
5902impl HealthProxy {
5903    /// Create a new Proxy for fuchsia.hardware.audio/Health.
5904    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5905        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5906        Self { client: fidl::client::Client::new(channel, protocol_name) }
5907    }
5908
5909    /// Get a Stream of events from the remote end of the protocol.
5910    ///
5911    /// # Panics
5912    ///
5913    /// Panics if the event stream was already taken.
5914    pub fn take_event_stream(&self) -> HealthEventStream {
5915        HealthEventStream { event_receiver: self.client.take_event_receiver() }
5916    }
5917
5918    /// Retrieves top level health state.
5919    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5920    pub fn r#get_health_state(
5921        &self,
5922    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
5923    {
5924        HealthProxyInterface::r#get_health_state(self)
5925    }
5926}
5927
5928impl HealthProxyInterface for HealthProxy {
5929    type GetHealthStateResponseFut =
5930        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
5931    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
5932        fn _decode(
5933            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5934        ) -> Result<HealthState, fidl::Error> {
5935            let _response = fidl::client::decode_transaction_body::<
5936                HealthGetHealthStateResponse,
5937                fidl::encoding::DefaultFuchsiaResourceDialect,
5938                0x4e146d6bca733a84,
5939            >(_buf?)?;
5940            Ok(_response.state)
5941        }
5942        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
5943            (),
5944            0x4e146d6bca733a84,
5945            fidl::encoding::DynamicFlags::empty(),
5946            _decode,
5947        )
5948    }
5949}
5950
5951pub struct HealthEventStream {
5952    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5953}
5954
5955impl std::marker::Unpin for HealthEventStream {}
5956
5957impl futures::stream::FusedStream for HealthEventStream {
5958    fn is_terminated(&self) -> bool {
5959        self.event_receiver.is_terminated()
5960    }
5961}
5962
5963impl futures::Stream for HealthEventStream {
5964    type Item = Result<HealthEvent, fidl::Error>;
5965
5966    fn poll_next(
5967        mut self: std::pin::Pin<&mut Self>,
5968        cx: &mut std::task::Context<'_>,
5969    ) -> std::task::Poll<Option<Self::Item>> {
5970        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5971            &mut self.event_receiver,
5972            cx
5973        )?) {
5974            Some(buf) => std::task::Poll::Ready(Some(HealthEvent::decode(buf))),
5975            None => std::task::Poll::Ready(None),
5976        }
5977    }
5978}
5979
5980#[derive(Debug)]
5981pub enum HealthEvent {}
5982
5983impl HealthEvent {
5984    /// Decodes a message buffer as a [`HealthEvent`].
5985    fn decode(
5986        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5987    ) -> Result<HealthEvent, fidl::Error> {
5988        let (bytes, _handles) = buf.split_mut();
5989        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5990        debug_assert_eq!(tx_header.tx_id, 0);
5991        match tx_header.ordinal {
5992            _ => Err(fidl::Error::UnknownOrdinal {
5993                ordinal: tx_header.ordinal,
5994                protocol_name: <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5995            }),
5996        }
5997    }
5998}
5999
6000/// A Stream of incoming requests for fuchsia.hardware.audio/Health.
6001pub struct HealthRequestStream {
6002    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6003    is_terminated: bool,
6004}
6005
6006impl std::marker::Unpin for HealthRequestStream {}
6007
6008impl futures::stream::FusedStream for HealthRequestStream {
6009    fn is_terminated(&self) -> bool {
6010        self.is_terminated
6011    }
6012}
6013
6014impl fidl::endpoints::RequestStream for HealthRequestStream {
6015    type Protocol = HealthMarker;
6016    type ControlHandle = HealthControlHandle;
6017
6018    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6019        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6020    }
6021
6022    fn control_handle(&self) -> Self::ControlHandle {
6023        HealthControlHandle { inner: self.inner.clone() }
6024    }
6025
6026    fn into_inner(
6027        self,
6028    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6029    {
6030        (self.inner, self.is_terminated)
6031    }
6032
6033    fn from_inner(
6034        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6035        is_terminated: bool,
6036    ) -> Self {
6037        Self { inner, is_terminated }
6038    }
6039}
6040
6041impl futures::Stream for HealthRequestStream {
6042    type Item = Result<HealthRequest, fidl::Error>;
6043
6044    fn poll_next(
6045        mut self: std::pin::Pin<&mut Self>,
6046        cx: &mut std::task::Context<'_>,
6047    ) -> std::task::Poll<Option<Self::Item>> {
6048        let this = &mut *self;
6049        if this.inner.check_shutdown(cx) {
6050            this.is_terminated = true;
6051            return std::task::Poll::Ready(None);
6052        }
6053        if this.is_terminated {
6054            panic!("polled HealthRequestStream after completion");
6055        }
6056        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6057            |bytes, handles| {
6058                match this.inner.channel().read_etc(cx, bytes, handles) {
6059                    std::task::Poll::Ready(Ok(())) => {}
6060                    std::task::Poll::Pending => return std::task::Poll::Pending,
6061                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6062                        this.is_terminated = true;
6063                        return std::task::Poll::Ready(None);
6064                    }
6065                    std::task::Poll::Ready(Err(e)) => {
6066                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6067                            e.into(),
6068                        ))))
6069                    }
6070                }
6071
6072                // A message has been received from the channel
6073                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6074
6075                std::task::Poll::Ready(Some(match header.ordinal {
6076                    0x4e146d6bca733a84 => {
6077                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6078                        let mut req = fidl::new_empty!(
6079                            fidl::encoding::EmptyPayload,
6080                            fidl::encoding::DefaultFuchsiaResourceDialect
6081                        );
6082                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6083                        let control_handle = HealthControlHandle { inner: this.inner.clone() };
6084                        Ok(HealthRequest::GetHealthState {
6085                            responder: HealthGetHealthStateResponder {
6086                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6087                                tx_id: header.tx_id,
6088                            },
6089                        })
6090                    }
6091                    _ => Err(fidl::Error::UnknownOrdinal {
6092                        ordinal: header.ordinal,
6093                        protocol_name:
6094                            <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6095                    }),
6096                }))
6097            },
6098        )
6099    }
6100}
6101
6102#[derive(Debug)]
6103pub enum HealthRequest {
6104    /// Retrieves top level health state.
6105    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6106    GetHealthState { responder: HealthGetHealthStateResponder },
6107}
6108
6109impl HealthRequest {
6110    #[allow(irrefutable_let_patterns)]
6111    pub fn into_get_health_state(self) -> Option<(HealthGetHealthStateResponder)> {
6112        if let HealthRequest::GetHealthState { responder } = self {
6113            Some((responder))
6114        } else {
6115            None
6116        }
6117    }
6118
6119    /// Name of the method defined in FIDL
6120    pub fn method_name(&self) -> &'static str {
6121        match *self {
6122            HealthRequest::GetHealthState { .. } => "get_health_state",
6123        }
6124    }
6125}
6126
6127#[derive(Debug, Clone)]
6128pub struct HealthControlHandle {
6129    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6130}
6131
6132impl fidl::endpoints::ControlHandle for HealthControlHandle {
6133    fn shutdown(&self) {
6134        self.inner.shutdown()
6135    }
6136    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6137        self.inner.shutdown_with_epitaph(status)
6138    }
6139
6140    fn is_closed(&self) -> bool {
6141        self.inner.channel().is_closed()
6142    }
6143    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6144        self.inner.channel().on_closed()
6145    }
6146
6147    #[cfg(target_os = "fuchsia")]
6148    fn signal_peer(
6149        &self,
6150        clear_mask: zx::Signals,
6151        set_mask: zx::Signals,
6152    ) -> Result<(), zx_status::Status> {
6153        use fidl::Peered;
6154        self.inner.channel().signal_peer(clear_mask, set_mask)
6155    }
6156}
6157
6158impl HealthControlHandle {}
6159
6160#[must_use = "FIDL methods require a response to be sent"]
6161#[derive(Debug)]
6162pub struct HealthGetHealthStateResponder {
6163    control_handle: std::mem::ManuallyDrop<HealthControlHandle>,
6164    tx_id: u32,
6165}
6166
6167/// Set the the channel to be shutdown (see [`HealthControlHandle::shutdown`])
6168/// if the responder is dropped without sending a response, so that the client
6169/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6170impl std::ops::Drop for HealthGetHealthStateResponder {
6171    fn drop(&mut self) {
6172        self.control_handle.shutdown();
6173        // Safety: drops once, never accessed again
6174        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6175    }
6176}
6177
6178impl fidl::endpoints::Responder for HealthGetHealthStateResponder {
6179    type ControlHandle = HealthControlHandle;
6180
6181    fn control_handle(&self) -> &HealthControlHandle {
6182        &self.control_handle
6183    }
6184
6185    fn drop_without_shutdown(mut self) {
6186        // Safety: drops once, never accessed again due to mem::forget
6187        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6188        // Prevent Drop from running (which would shut down the channel)
6189        std::mem::forget(self);
6190    }
6191}
6192
6193impl HealthGetHealthStateResponder {
6194    /// Sends a response to the FIDL transaction.
6195    ///
6196    /// Sets the channel to shutdown if an error occurs.
6197    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6198        let _result = self.send_raw(state);
6199        if _result.is_err() {
6200            self.control_handle.shutdown();
6201        }
6202        self.drop_without_shutdown();
6203        _result
6204    }
6205
6206    /// Similar to "send" but does not shutdown the channel if an error occurs.
6207    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6208        let _result = self.send_raw(state);
6209        self.drop_without_shutdown();
6210        _result
6211    }
6212
6213    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
6214        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
6215            (state,),
6216            self.tx_id,
6217            0x4e146d6bca733a84,
6218            fidl::encoding::DynamicFlags::empty(),
6219        )
6220    }
6221}
6222
6223#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6224pub struct RingBufferMarker;
6225
6226impl fidl::endpoints::ProtocolMarker for RingBufferMarker {
6227    type Proxy = RingBufferProxy;
6228    type RequestStream = RingBufferRequestStream;
6229    #[cfg(target_os = "fuchsia")]
6230    type SynchronousProxy = RingBufferSynchronousProxy;
6231
6232    const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
6233}
6234pub type RingBufferGetVmoResult = Result<(u32, fidl::Vmo), GetVmoError>;
6235pub type RingBufferSetActiveChannelsResult = Result<i64, i32>;
6236
6237pub trait RingBufferProxyInterface: Send + Sync {
6238    type GetPropertiesResponseFut: std::future::Future<Output = Result<RingBufferProperties, fidl::Error>>
6239        + Send;
6240    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
6241    type WatchClockRecoveryPositionInfoResponseFut: std::future::Future<Output = Result<RingBufferPositionInfo, fidl::Error>>
6242        + Send;
6243    fn r#watch_clock_recovery_position_info(
6244        &self,
6245    ) -> Self::WatchClockRecoveryPositionInfoResponseFut;
6246    type GetVmoResponseFut: std::future::Future<Output = Result<RingBufferGetVmoResult, fidl::Error>>
6247        + Send;
6248    fn r#get_vmo(
6249        &self,
6250        min_frames: u32,
6251        clock_recovery_notifications_per_ring: u32,
6252    ) -> Self::GetVmoResponseFut;
6253    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
6254    fn r#start(&self) -> Self::StartResponseFut;
6255    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6256    fn r#stop(&self) -> Self::StopResponseFut;
6257    type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
6258        + Send;
6259    fn r#set_active_channels(
6260        &self,
6261        active_channels_bitmask: u64,
6262    ) -> Self::SetActiveChannelsResponseFut;
6263    type WatchDelayInfoResponseFut: std::future::Future<Output = Result<DelayInfo, fidl::Error>>
6264        + Send;
6265    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
6266}
6267#[derive(Debug)]
6268#[cfg(target_os = "fuchsia")]
6269pub struct RingBufferSynchronousProxy {
6270    client: fidl::client::sync::Client,
6271}
6272
6273#[cfg(target_os = "fuchsia")]
6274impl fidl::endpoints::SynchronousProxy for RingBufferSynchronousProxy {
6275    type Proxy = RingBufferProxy;
6276    type Protocol = RingBufferMarker;
6277
6278    fn from_channel(inner: fidl::Channel) -> Self {
6279        Self::new(inner)
6280    }
6281
6282    fn into_channel(self) -> fidl::Channel {
6283        self.client.into_channel()
6284    }
6285
6286    fn as_channel(&self) -> &fidl::Channel {
6287        self.client.as_channel()
6288    }
6289}
6290
6291#[cfg(target_os = "fuchsia")]
6292impl RingBufferSynchronousProxy {
6293    pub fn new(channel: fidl::Channel) -> Self {
6294        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6295        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6296    }
6297
6298    pub fn into_channel(self) -> fidl::Channel {
6299        self.client.into_channel()
6300    }
6301
6302    /// Waits until an event arrives and returns it. It is safe for other
6303    /// threads to make concurrent requests while waiting for an event.
6304    pub fn wait_for_event(
6305        &self,
6306        deadline: zx::MonotonicInstant,
6307    ) -> Result<RingBufferEvent, fidl::Error> {
6308        RingBufferEvent::decode(self.client.wait_for_event(deadline)?)
6309    }
6310
6311    /// Accessor for top level static properties.
6312    pub fn r#get_properties(
6313        &self,
6314        ___deadline: zx::MonotonicInstant,
6315    ) -> Result<RingBufferProperties, fidl::Error> {
6316        let _response = self
6317            .client
6318            .send_query::<fidl::encoding::EmptyPayload, RingBufferGetPropertiesResponse>(
6319                (),
6320                0x12947f061a8fe1,
6321                fidl::encoding::DynamicFlags::empty(),
6322                ___deadline,
6323            )?;
6324        Ok(_response.properties)
6325    }
6326
6327    /// Gets the ring buffer current position via a hanging get. The driver must respond to a
6328    /// client's first `WatchClockRecoveryPositionInfo` call, but will not respond to subsequent
6329    /// client calls until the position information has changed from what was most recently
6330    /// provided to that client. The driver must not respond to a
6331    /// `WatchClockRecoveryPositionInfo` until after it has replied to the `Start` command.
6332    /// At the `start_time` returned by `Start`, position is always 0. From there, it
6333    /// progresses at the rate specified by the rate, sample format (and clock domain,
6334    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
6335    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
6336    /// estimated position to be used for clock recovery at most at
6337    /// `clock_recovery_notifications_per_ring` frequency.
6338    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, hence a
6339    /// `clock_recovery_notifications_per_ring` was specified.
6340    /// Must be delivered with timestamps that are monotonically increasing.
6341    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
6342    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
6343    pub fn r#watch_clock_recovery_position_info(
6344        &self,
6345        ___deadline: zx::MonotonicInstant,
6346    ) -> Result<RingBufferPositionInfo, fidl::Error> {
6347        let _response = self.client.send_query::<
6348            fidl::encoding::EmptyPayload,
6349            RingBufferWatchClockRecoveryPositionInfoResponse,
6350        >(
6351            (),
6352            0x694d5b898a4167e5,
6353            fidl::encoding::DynamicFlags::empty(),
6354            ___deadline,
6355        )?;
6356        Ok(_response.position_info)
6357    }
6358
6359    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
6360    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
6361    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
6362    ///
6363    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
6364    /// that ring buffer contents can be transfered in and out, or else the call must be failed
6365    /// with GetVmoError.INVALID_ARGS.
6366    ///
6367    /// The driver may increase the ring buffer size beyond `min_frames` plus
6368    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
6369    /// alignment.
6370    ///
6371    /// Clients can treat the entire returned ring buffer as safe to access, except for the
6372    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
6373    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
6374    ///
6375    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6376    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
6377    /// handle must also include ZX_RIGHT_WRITE.
6378    ///
6379    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
6380    /// `WatchClockRecoveryPositionInfo` client requests at most at
6381    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
6382    /// for clock recovery.
6383    pub fn r#get_vmo(
6384        &self,
6385        mut min_frames: u32,
6386        mut clock_recovery_notifications_per_ring: u32,
6387        ___deadline: zx::MonotonicInstant,
6388    ) -> Result<RingBufferGetVmoResult, fidl::Error> {
6389        let _response = self.client.send_query::<
6390            RingBufferGetVmoRequest,
6391            fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
6392        >(
6393            (min_frames, clock_recovery_notifications_per_ring,),
6394            0x44c8f4f5680e853a,
6395            fidl::encoding::DynamicFlags::empty(),
6396            ___deadline,
6397        )?;
6398        Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
6399    }
6400
6401    /// Start the ring buffer. The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates
6402    /// when position began moving, starting at the beginning of the ring buffer,
6403    /// i.e. the driver/HW has started to read or write from or to the ring buffer position 0,
6404    /// subject to the buffering described in `driver_transfer_bytes`.
6405    ///
6406    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
6407    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6408    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
6409    /// a second time before the first call has completed, then the channel must be closed with an
6410    /// error `ZX_ERR_BAD_STATE` returned.
6411    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
6412        let _response =
6413            self.client.send_query::<fidl::encoding::EmptyPayload, RingBufferStartResponse>(
6414                (),
6415                0x5dd780a769a8892d,
6416                fidl::encoding::DynamicFlags::empty(),
6417                ___deadline,
6418            )?;
6419        Ok(_response.start_time)
6420    }
6421
6422    /// Stop the ring buffer. Once this call's response is received, no further position
6423    /// notifications will be sent until `Start` is called again.
6424    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6425    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
6426        let _response =
6427            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
6428                (),
6429                0x49a73d9cf1d4e110,
6430                fidl::encoding::DynamicFlags::empty(),
6431                ___deadline,
6432            )?;
6433        Ok(_response)
6434    }
6435
6436    /// Sets which channels are active via a bitmask.
6437    /// The least significant bit corresponds to channel index 0.
6438    /// Channels not set (bits are 0) in the bitmask are inactive.
6439    /// By default all channels are active. Hence creating a RingBuffer turns on the
6440    /// hardware associated for all channels.
6441    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
6442    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
6443    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
6444    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
6445    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
6446    /// Deactivating one, several, or all channels does not `Stop` the ring buffer.
6447    /// `SetActiveChannels` does not change the ring buffer's behavior with regard to
6448    /// `Start`/`Stop`, specifically position.  Once `Start` is called, a ring buffer's position
6449    /// advances (and position notifications sent as needed) regardless of the number of active
6450    /// channels, including if no channels are active. This means that the format in the
6451    /// ring buffer is not changed.
6452    /// If the driver does not support deactivating channels it must return `ZX_ERR_NOT_SUPPORTED`.
6453    /// If the mask is incorrect, i.e. enables channels outside the number of bits
6454    /// to use for a given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
6455    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
6456    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
6457    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
6458    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
6459    /// hardware configuration was completed. If the requested channel configuration is already
6460    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
6461    /// before the reply is sent. If called again with the same configuration, the reply must
6462    /// include the same `set_time` value as was previously returned.
6463    /// For input channels, it is not required that the driver zero-out inactive channels.
6464    /// If `SetActiveChannels` is called for a second time before the first call has completed,
6465    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6466    pub fn r#set_active_channels(
6467        &self,
6468        mut active_channels_bitmask: u64,
6469        ___deadline: zx::MonotonicInstant,
6470    ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
6471        let _response = self.client.send_query::<
6472            RingBufferSetActiveChannelsRequest,
6473            fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
6474        >(
6475            (active_channels_bitmask,),
6476            0x605464c1d384f309,
6477            fidl::encoding::DynamicFlags::empty(),
6478            ___deadline,
6479        )?;
6480        Ok(_response.map(|x| x.set_time))
6481    }
6482
6483    /// Get information about delays via a hanging get. The driver will immediately reply to the
6484    /// first `WatchDelayInfo` sent by the client. The driver will not respond to subsequent client
6485    /// `WatchDelayInfo` calls until the delay info changes from what was most recently reported.
6486    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
6487    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6488    pub fn r#watch_delay_info(
6489        &self,
6490        ___deadline: zx::MonotonicInstant,
6491    ) -> Result<DelayInfo, fidl::Error> {
6492        let _response = self.client.send_query::<
6493            fidl::encoding::EmptyPayload,
6494            fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
6495        >(
6496            (),
6497            0x6c1248db213fcf9f,
6498            fidl::encoding::DynamicFlags::FLEXIBLE,
6499            ___deadline,
6500        )?
6501        .into_result::<RingBufferMarker>("watch_delay_info")?;
6502        Ok(_response.delay_info)
6503    }
6504}
6505
6506#[cfg(target_os = "fuchsia")]
6507impl From<RingBufferSynchronousProxy> for zx::Handle {
6508    fn from(value: RingBufferSynchronousProxy) -> Self {
6509        value.into_channel().into()
6510    }
6511}
6512
6513#[cfg(target_os = "fuchsia")]
6514impl From<fidl::Channel> for RingBufferSynchronousProxy {
6515    fn from(value: fidl::Channel) -> Self {
6516        Self::new(value)
6517    }
6518}
6519
6520#[cfg(target_os = "fuchsia")]
6521impl fidl::endpoints::FromClient for RingBufferSynchronousProxy {
6522    type Protocol = RingBufferMarker;
6523
6524    fn from_client(value: fidl::endpoints::ClientEnd<RingBufferMarker>) -> Self {
6525        Self::new(value.into_channel())
6526    }
6527}
6528
6529#[derive(Debug, Clone)]
6530pub struct RingBufferProxy {
6531    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6532}
6533
6534impl fidl::endpoints::Proxy for RingBufferProxy {
6535    type Protocol = RingBufferMarker;
6536
6537    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6538        Self::new(inner)
6539    }
6540
6541    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6542        self.client.into_channel().map_err(|client| Self { client })
6543    }
6544
6545    fn as_channel(&self) -> &::fidl::AsyncChannel {
6546        self.client.as_channel()
6547    }
6548}
6549
6550impl RingBufferProxy {
6551    /// Create a new Proxy for fuchsia.hardware.audio/RingBuffer.
6552    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6553        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6554        Self { client: fidl::client::Client::new(channel, protocol_name) }
6555    }
6556
6557    /// Get a Stream of events from the remote end of the protocol.
6558    ///
6559    /// # Panics
6560    ///
6561    /// Panics if the event stream was already taken.
6562    pub fn take_event_stream(&self) -> RingBufferEventStream {
6563        RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
6564    }
6565
6566    /// Accessor for top level static properties.
6567    pub fn r#get_properties(
6568        &self,
6569    ) -> fidl::client::QueryResponseFut<
6570        RingBufferProperties,
6571        fidl::encoding::DefaultFuchsiaResourceDialect,
6572    > {
6573        RingBufferProxyInterface::r#get_properties(self)
6574    }
6575
6576    /// Gets the ring buffer current position via a hanging get. The driver must respond to a
6577    /// client's first `WatchClockRecoveryPositionInfo` call, but will not respond to subsequent
6578    /// client calls until the position information has changed from what was most recently
6579    /// provided to that client. The driver must not respond to a
6580    /// `WatchClockRecoveryPositionInfo` until after it has replied to the `Start` command.
6581    /// At the `start_time` returned by `Start`, position is always 0. From there, it
6582    /// progresses at the rate specified by the rate, sample format (and clock domain,
6583    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
6584    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
6585    /// estimated position to be used for clock recovery at most at
6586    /// `clock_recovery_notifications_per_ring` frequency.
6587    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, hence a
6588    /// `clock_recovery_notifications_per_ring` was specified.
6589    /// Must be delivered with timestamps that are monotonically increasing.
6590    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
6591    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
6592    pub fn r#watch_clock_recovery_position_info(
6593        &self,
6594    ) -> fidl::client::QueryResponseFut<
6595        RingBufferPositionInfo,
6596        fidl::encoding::DefaultFuchsiaResourceDialect,
6597    > {
6598        RingBufferProxyInterface::r#watch_clock_recovery_position_info(self)
6599    }
6600
6601    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
6602    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
6603    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
6604    ///
6605    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
6606    /// that ring buffer contents can be transfered in and out, or else the call must be failed
6607    /// with GetVmoError.INVALID_ARGS.
6608    ///
6609    /// The driver may increase the ring buffer size beyond `min_frames` plus
6610    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
6611    /// alignment.
6612    ///
6613    /// Clients can treat the entire returned ring buffer as safe to access, except for the
6614    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
6615    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
6616    ///
6617    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6618    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
6619    /// handle must also include ZX_RIGHT_WRITE.
6620    ///
6621    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
6622    /// `WatchClockRecoveryPositionInfo` client requests at most at
6623    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
6624    /// for clock recovery.
6625    pub fn r#get_vmo(
6626        &self,
6627        mut min_frames: u32,
6628        mut clock_recovery_notifications_per_ring: u32,
6629    ) -> fidl::client::QueryResponseFut<
6630        RingBufferGetVmoResult,
6631        fidl::encoding::DefaultFuchsiaResourceDialect,
6632    > {
6633        RingBufferProxyInterface::r#get_vmo(self, min_frames, clock_recovery_notifications_per_ring)
6634    }
6635
6636    /// Start the ring buffer. The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates
6637    /// when position began moving, starting at the beginning of the ring buffer,
6638    /// i.e. the driver/HW has started to read or write from or to the ring buffer position 0,
6639    /// subject to the buffering described in `driver_transfer_bytes`.
6640    ///
6641    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
6642    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6643    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
6644    /// a second time before the first call has completed, then the channel must be closed with an
6645    /// error `ZX_ERR_BAD_STATE` returned.
6646    pub fn r#start(
6647        &self,
6648    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
6649        RingBufferProxyInterface::r#start(self)
6650    }
6651
6652    /// Stop the ring buffer. Once this call's response is received, no further position
6653    /// notifications will be sent until `Start` is called again.
6654    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6655    pub fn r#stop(
6656        &self,
6657    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6658        RingBufferProxyInterface::r#stop(self)
6659    }
6660
6661    /// Sets which channels are active via a bitmask.
6662    /// The least significant bit corresponds to channel index 0.
6663    /// Channels not set (bits are 0) in the bitmask are inactive.
6664    /// By default all channels are active. Hence creating a RingBuffer turns on the
6665    /// hardware associated for all channels.
6666    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
6667    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
6668    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
6669    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
6670    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
6671    /// Deactivating one, several, or all channels does not `Stop` the ring buffer.
6672    /// `SetActiveChannels` does not change the ring buffer's behavior with regard to
6673    /// `Start`/`Stop`, specifically position.  Once `Start` is called, a ring buffer's position
6674    /// advances (and position notifications sent as needed) regardless of the number of active
6675    /// channels, including if no channels are active. This means that the format in the
6676    /// ring buffer is not changed.
6677    /// If the driver does not support deactivating channels it must return `ZX_ERR_NOT_SUPPORTED`.
6678    /// If the mask is incorrect, i.e. enables channels outside the number of bits
6679    /// to use for a given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
6680    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
6681    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
6682    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
6683    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
6684    /// hardware configuration was completed. If the requested channel configuration is already
6685    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
6686    /// before the reply is sent. If called again with the same configuration, the reply must
6687    /// include the same `set_time` value as was previously returned.
6688    /// For input channels, it is not required that the driver zero-out inactive channels.
6689    /// If `SetActiveChannels` is called for a second time before the first call has completed,
6690    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6691    pub fn r#set_active_channels(
6692        &self,
6693        mut active_channels_bitmask: u64,
6694    ) -> fidl::client::QueryResponseFut<
6695        RingBufferSetActiveChannelsResult,
6696        fidl::encoding::DefaultFuchsiaResourceDialect,
6697    > {
6698        RingBufferProxyInterface::r#set_active_channels(self, active_channels_bitmask)
6699    }
6700
6701    /// Get information about delays via a hanging get. The driver will immediately reply to the
6702    /// first `WatchDelayInfo` sent by the client. The driver will not respond to subsequent client
6703    /// `WatchDelayInfo` calls until the delay info changes from what was most recently reported.
6704    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
6705    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6706    pub fn r#watch_delay_info(
6707        &self,
6708    ) -> fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6709    {
6710        RingBufferProxyInterface::r#watch_delay_info(self)
6711    }
6712}
6713
6714impl RingBufferProxyInterface for RingBufferProxy {
6715    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
6716        RingBufferProperties,
6717        fidl::encoding::DefaultFuchsiaResourceDialect,
6718    >;
6719    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
6720        fn _decode(
6721            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6722        ) -> Result<RingBufferProperties, fidl::Error> {
6723            let _response = fidl::client::decode_transaction_body::<
6724                RingBufferGetPropertiesResponse,
6725                fidl::encoding::DefaultFuchsiaResourceDialect,
6726                0x12947f061a8fe1,
6727            >(_buf?)?;
6728            Ok(_response.properties)
6729        }
6730        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferProperties>(
6731            (),
6732            0x12947f061a8fe1,
6733            fidl::encoding::DynamicFlags::empty(),
6734            _decode,
6735        )
6736    }
6737
6738    type WatchClockRecoveryPositionInfoResponseFut = fidl::client::QueryResponseFut<
6739        RingBufferPositionInfo,
6740        fidl::encoding::DefaultFuchsiaResourceDialect,
6741    >;
6742    fn r#watch_clock_recovery_position_info(
6743        &self,
6744    ) -> Self::WatchClockRecoveryPositionInfoResponseFut {
6745        fn _decode(
6746            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6747        ) -> Result<RingBufferPositionInfo, fidl::Error> {
6748            let _response = fidl::client::decode_transaction_body::<
6749                RingBufferWatchClockRecoveryPositionInfoResponse,
6750                fidl::encoding::DefaultFuchsiaResourceDialect,
6751                0x694d5b898a4167e5,
6752            >(_buf?)?;
6753            Ok(_response.position_info)
6754        }
6755        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferPositionInfo>(
6756            (),
6757            0x694d5b898a4167e5,
6758            fidl::encoding::DynamicFlags::empty(),
6759            _decode,
6760        )
6761    }
6762
6763    type GetVmoResponseFut = fidl::client::QueryResponseFut<
6764        RingBufferGetVmoResult,
6765        fidl::encoding::DefaultFuchsiaResourceDialect,
6766    >;
6767    fn r#get_vmo(
6768        &self,
6769        mut min_frames: u32,
6770        mut clock_recovery_notifications_per_ring: u32,
6771    ) -> Self::GetVmoResponseFut {
6772        fn _decode(
6773            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6774        ) -> Result<RingBufferGetVmoResult, fidl::Error> {
6775            let _response = fidl::client::decode_transaction_body::<
6776                fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
6777                fidl::encoding::DefaultFuchsiaResourceDialect,
6778                0x44c8f4f5680e853a,
6779            >(_buf?)?;
6780            Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
6781        }
6782        self.client.send_query_and_decode::<RingBufferGetVmoRequest, RingBufferGetVmoResult>(
6783            (min_frames, clock_recovery_notifications_per_ring),
6784            0x44c8f4f5680e853a,
6785            fidl::encoding::DynamicFlags::empty(),
6786            _decode,
6787        )
6788    }
6789
6790    type StartResponseFut =
6791        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
6792    fn r#start(&self) -> Self::StartResponseFut {
6793        fn _decode(
6794            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6795        ) -> Result<i64, fidl::Error> {
6796            let _response = fidl::client::decode_transaction_body::<
6797                RingBufferStartResponse,
6798                fidl::encoding::DefaultFuchsiaResourceDialect,
6799                0x5dd780a769a8892d,
6800            >(_buf?)?;
6801            Ok(_response.start_time)
6802        }
6803        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
6804            (),
6805            0x5dd780a769a8892d,
6806            fidl::encoding::DynamicFlags::empty(),
6807            _decode,
6808        )
6809    }
6810
6811    type StopResponseFut =
6812        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6813    fn r#stop(&self) -> Self::StopResponseFut {
6814        fn _decode(
6815            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6816        ) -> Result<(), fidl::Error> {
6817            let _response = fidl::client::decode_transaction_body::<
6818                fidl::encoding::EmptyPayload,
6819                fidl::encoding::DefaultFuchsiaResourceDialect,
6820                0x49a73d9cf1d4e110,
6821            >(_buf?)?;
6822            Ok(_response)
6823        }
6824        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
6825            (),
6826            0x49a73d9cf1d4e110,
6827            fidl::encoding::DynamicFlags::empty(),
6828            _decode,
6829        )
6830    }
6831
6832    type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
6833        RingBufferSetActiveChannelsResult,
6834        fidl::encoding::DefaultFuchsiaResourceDialect,
6835    >;
6836    fn r#set_active_channels(
6837        &self,
6838        mut active_channels_bitmask: u64,
6839    ) -> Self::SetActiveChannelsResponseFut {
6840        fn _decode(
6841            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6842        ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
6843            let _response = fidl::client::decode_transaction_body::<
6844                fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
6845                fidl::encoding::DefaultFuchsiaResourceDialect,
6846                0x605464c1d384f309,
6847            >(_buf?)?;
6848            Ok(_response.map(|x| x.set_time))
6849        }
6850        self.client.send_query_and_decode::<
6851            RingBufferSetActiveChannelsRequest,
6852            RingBufferSetActiveChannelsResult,
6853        >(
6854            (active_channels_bitmask,),
6855            0x605464c1d384f309,
6856            fidl::encoding::DynamicFlags::empty(),
6857            _decode,
6858        )
6859    }
6860
6861    type WatchDelayInfoResponseFut =
6862        fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
6863    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
6864        fn _decode(
6865            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6866        ) -> Result<DelayInfo, fidl::Error> {
6867            let _response = fidl::client::decode_transaction_body::<
6868                fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
6869                fidl::encoding::DefaultFuchsiaResourceDialect,
6870                0x6c1248db213fcf9f,
6871            >(_buf?)?
6872            .into_result::<RingBufferMarker>("watch_delay_info")?;
6873            Ok(_response.delay_info)
6874        }
6875        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelayInfo>(
6876            (),
6877            0x6c1248db213fcf9f,
6878            fidl::encoding::DynamicFlags::FLEXIBLE,
6879            _decode,
6880        )
6881    }
6882}
6883
6884pub struct RingBufferEventStream {
6885    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6886}
6887
6888impl std::marker::Unpin for RingBufferEventStream {}
6889
6890impl futures::stream::FusedStream for RingBufferEventStream {
6891    fn is_terminated(&self) -> bool {
6892        self.event_receiver.is_terminated()
6893    }
6894}
6895
6896impl futures::Stream for RingBufferEventStream {
6897    type Item = Result<RingBufferEvent, fidl::Error>;
6898
6899    fn poll_next(
6900        mut self: std::pin::Pin<&mut Self>,
6901        cx: &mut std::task::Context<'_>,
6902    ) -> std::task::Poll<Option<Self::Item>> {
6903        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6904            &mut self.event_receiver,
6905            cx
6906        )?) {
6907            Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
6908            None => std::task::Poll::Ready(None),
6909        }
6910    }
6911}
6912
6913#[derive(Debug)]
6914pub enum RingBufferEvent {
6915    #[non_exhaustive]
6916    _UnknownEvent {
6917        /// Ordinal of the event that was sent.
6918        ordinal: u64,
6919    },
6920}
6921
6922impl RingBufferEvent {
6923    /// Decodes a message buffer as a [`RingBufferEvent`].
6924    fn decode(
6925        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6926    ) -> Result<RingBufferEvent, fidl::Error> {
6927        let (bytes, _handles) = buf.split_mut();
6928        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6929        debug_assert_eq!(tx_header.tx_id, 0);
6930        match tx_header.ordinal {
6931            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6932                Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6933            }
6934            _ => Err(fidl::Error::UnknownOrdinal {
6935                ordinal: tx_header.ordinal,
6936                protocol_name: <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6937            }),
6938        }
6939    }
6940}
6941
6942/// A Stream of incoming requests for fuchsia.hardware.audio/RingBuffer.
6943pub struct RingBufferRequestStream {
6944    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6945    is_terminated: bool,
6946}
6947
6948impl std::marker::Unpin for RingBufferRequestStream {}
6949
6950impl futures::stream::FusedStream for RingBufferRequestStream {
6951    fn is_terminated(&self) -> bool {
6952        self.is_terminated
6953    }
6954}
6955
6956impl fidl::endpoints::RequestStream for RingBufferRequestStream {
6957    type Protocol = RingBufferMarker;
6958    type ControlHandle = RingBufferControlHandle;
6959
6960    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6961        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6962    }
6963
6964    fn control_handle(&self) -> Self::ControlHandle {
6965        RingBufferControlHandle { inner: self.inner.clone() }
6966    }
6967
6968    fn into_inner(
6969        self,
6970    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6971    {
6972        (self.inner, self.is_terminated)
6973    }
6974
6975    fn from_inner(
6976        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6977        is_terminated: bool,
6978    ) -> Self {
6979        Self { inner, is_terminated }
6980    }
6981}
6982
6983impl futures::Stream for RingBufferRequestStream {
6984    type Item = Result<RingBufferRequest, fidl::Error>;
6985
6986    fn poll_next(
6987        mut self: std::pin::Pin<&mut Self>,
6988        cx: &mut std::task::Context<'_>,
6989    ) -> std::task::Poll<Option<Self::Item>> {
6990        let this = &mut *self;
6991        if this.inner.check_shutdown(cx) {
6992            this.is_terminated = true;
6993            return std::task::Poll::Ready(None);
6994        }
6995        if this.is_terminated {
6996            panic!("polled RingBufferRequestStream after completion");
6997        }
6998        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6999            |bytes, handles| {
7000                match this.inner.channel().read_etc(cx, bytes, handles) {
7001                    std::task::Poll::Ready(Ok(())) => {}
7002                    std::task::Poll::Pending => return std::task::Poll::Pending,
7003                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7004                        this.is_terminated = true;
7005                        return std::task::Poll::Ready(None);
7006                    }
7007                    std::task::Poll::Ready(Err(e)) => {
7008                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7009                            e.into(),
7010                        ))))
7011                    }
7012                }
7013
7014                // A message has been received from the channel
7015                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7016
7017                std::task::Poll::Ready(Some(match header.ordinal {
7018                    0x12947f061a8fe1 => {
7019                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7020                        let mut req = fidl::new_empty!(
7021                            fidl::encoding::EmptyPayload,
7022                            fidl::encoding::DefaultFuchsiaResourceDialect
7023                        );
7024                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7025                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7026                        Ok(RingBufferRequest::GetProperties {
7027                            responder: RingBufferGetPropertiesResponder {
7028                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7029                                tx_id: header.tx_id,
7030                            },
7031                        })
7032                    }
7033                    0x694d5b898a4167e5 => {
7034                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7035                        let mut req = fidl::new_empty!(
7036                            fidl::encoding::EmptyPayload,
7037                            fidl::encoding::DefaultFuchsiaResourceDialect
7038                        );
7039                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7040                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7041                        Ok(RingBufferRequest::WatchClockRecoveryPositionInfo {
7042                            responder: RingBufferWatchClockRecoveryPositionInfoResponder {
7043                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7044                                tx_id: header.tx_id,
7045                            },
7046                        })
7047                    }
7048                    0x44c8f4f5680e853a => {
7049                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7050                        let mut req = fidl::new_empty!(
7051                            RingBufferGetVmoRequest,
7052                            fidl::encoding::DefaultFuchsiaResourceDialect
7053                        );
7054                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
7055                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7056                        Ok(RingBufferRequest::GetVmo {
7057                            min_frames: req.min_frames,
7058                            clock_recovery_notifications_per_ring: req
7059                                .clock_recovery_notifications_per_ring,
7060
7061                            responder: RingBufferGetVmoResponder {
7062                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7063                                tx_id: header.tx_id,
7064                            },
7065                        })
7066                    }
7067                    0x5dd780a769a8892d => {
7068                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7069                        let mut req = fidl::new_empty!(
7070                            fidl::encoding::EmptyPayload,
7071                            fidl::encoding::DefaultFuchsiaResourceDialect
7072                        );
7073                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7074                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7075                        Ok(RingBufferRequest::Start {
7076                            responder: RingBufferStartResponder {
7077                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7078                                tx_id: header.tx_id,
7079                            },
7080                        })
7081                    }
7082                    0x49a73d9cf1d4e110 => {
7083                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7084                        let mut req = fidl::new_empty!(
7085                            fidl::encoding::EmptyPayload,
7086                            fidl::encoding::DefaultFuchsiaResourceDialect
7087                        );
7088                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7089                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7090                        Ok(RingBufferRequest::Stop {
7091                            responder: RingBufferStopResponder {
7092                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7093                                tx_id: header.tx_id,
7094                            },
7095                        })
7096                    }
7097                    0x605464c1d384f309 => {
7098                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7099                        let mut req = fidl::new_empty!(
7100                            RingBufferSetActiveChannelsRequest,
7101                            fidl::encoding::DefaultFuchsiaResourceDialect
7102                        );
7103                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
7104                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7105                        Ok(RingBufferRequest::SetActiveChannels {
7106                            active_channels_bitmask: req.active_channels_bitmask,
7107
7108                            responder: RingBufferSetActiveChannelsResponder {
7109                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7110                                tx_id: header.tx_id,
7111                            },
7112                        })
7113                    }
7114                    0x6c1248db213fcf9f => {
7115                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7116                        let mut req = fidl::new_empty!(
7117                            fidl::encoding::EmptyPayload,
7118                            fidl::encoding::DefaultFuchsiaResourceDialect
7119                        );
7120                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7121                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7122                        Ok(RingBufferRequest::WatchDelayInfo {
7123                            responder: RingBufferWatchDelayInfoResponder {
7124                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7125                                tx_id: header.tx_id,
7126                            },
7127                        })
7128                    }
7129                    _ if header.tx_id == 0
7130                        && header
7131                            .dynamic_flags()
7132                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7133                    {
7134                        Ok(RingBufferRequest::_UnknownMethod {
7135                            ordinal: header.ordinal,
7136                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
7137                            method_type: fidl::MethodType::OneWay,
7138                        })
7139                    }
7140                    _ if header
7141                        .dynamic_flags()
7142                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7143                    {
7144                        this.inner.send_framework_err(
7145                            fidl::encoding::FrameworkErr::UnknownMethod,
7146                            header.tx_id,
7147                            header.ordinal,
7148                            header.dynamic_flags(),
7149                            (bytes, handles),
7150                        )?;
7151                        Ok(RingBufferRequest::_UnknownMethod {
7152                            ordinal: header.ordinal,
7153                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
7154                            method_type: fidl::MethodType::TwoWay,
7155                        })
7156                    }
7157                    _ => Err(fidl::Error::UnknownOrdinal {
7158                        ordinal: header.ordinal,
7159                        protocol_name:
7160                            <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7161                    }),
7162                }))
7163            },
7164        )
7165    }
7166}
7167
7168#[derive(Debug)]
7169pub enum RingBufferRequest {
7170    /// Accessor for top level static properties.
7171    GetProperties { responder: RingBufferGetPropertiesResponder },
7172    /// Gets the ring buffer current position via a hanging get. The driver must respond to a
7173    /// client's first `WatchClockRecoveryPositionInfo` call, but will not respond to subsequent
7174    /// client calls until the position information has changed from what was most recently
7175    /// provided to that client. The driver must not respond to a
7176    /// `WatchClockRecoveryPositionInfo` until after it has replied to the `Start` command.
7177    /// At the `start_time` returned by `Start`, position is always 0. From there, it
7178    /// progresses at the rate specified by the rate, sample format (and clock domain,
7179    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
7180    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
7181    /// estimated position to be used for clock recovery at most at
7182    /// `clock_recovery_notifications_per_ring` frequency.
7183    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, hence a
7184    /// `clock_recovery_notifications_per_ring` was specified.
7185    /// Must be delivered with timestamps that are monotonically increasing.
7186    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
7187    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
7188    WatchClockRecoveryPositionInfo { responder: RingBufferWatchClockRecoveryPositionInfoResponder },
7189    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
7190    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
7191    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
7192    ///
7193    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
7194    /// that ring buffer contents can be transfered in and out, or else the call must be failed
7195    /// with GetVmoError.INVALID_ARGS.
7196    ///
7197    /// The driver may increase the ring buffer size beyond `min_frames` plus
7198    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
7199    /// alignment.
7200    ///
7201    /// Clients can treat the entire returned ring buffer as safe to access, except for the
7202    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
7203    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
7204    ///
7205    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7206    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
7207    /// handle must also include ZX_RIGHT_WRITE.
7208    ///
7209    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
7210    /// `WatchClockRecoveryPositionInfo` client requests at most at
7211    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
7212    /// for clock recovery.
7213    GetVmo {
7214        min_frames: u32,
7215        clock_recovery_notifications_per_ring: u32,
7216        responder: RingBufferGetVmoResponder,
7217    },
7218    /// Start the ring buffer. The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates
7219    /// when position began moving, starting at the beginning of the ring buffer,
7220    /// i.e. the driver/HW has started to read or write from or to the ring buffer position 0,
7221    /// subject to the buffering described in `driver_transfer_bytes`.
7222    ///
7223    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
7224    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
7225    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
7226    /// a second time before the first call has completed, then the channel must be closed with an
7227    /// error `ZX_ERR_BAD_STATE` returned.
7228    Start { responder: RingBufferStartResponder },
7229    /// Stop the ring buffer. Once this call's response is received, no further position
7230    /// notifications will be sent until `Start` is called again.
7231    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
7232    Stop { responder: RingBufferStopResponder },
7233    /// Sets which channels are active via a bitmask.
7234    /// The least significant bit corresponds to channel index 0.
7235    /// Channels not set (bits are 0) in the bitmask are inactive.
7236    /// By default all channels are active. Hence creating a RingBuffer turns on the
7237    /// hardware associated for all channels.
7238    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
7239    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
7240    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
7241    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
7242    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
7243    /// Deactivating one, several, or all channels does not `Stop` the ring buffer.
7244    /// `SetActiveChannels` does not change the ring buffer's behavior with regard to
7245    /// `Start`/`Stop`, specifically position.  Once `Start` is called, a ring buffer's position
7246    /// advances (and position notifications sent as needed) regardless of the number of active
7247    /// channels, including if no channels are active. This means that the format in the
7248    /// ring buffer is not changed.
7249    /// If the driver does not support deactivating channels it must return `ZX_ERR_NOT_SUPPORTED`.
7250    /// If the mask is incorrect, i.e. enables channels outside the number of bits
7251    /// to use for a given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
7252    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
7253    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
7254    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
7255    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
7256    /// hardware configuration was completed. If the requested channel configuration is already
7257    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
7258    /// before the reply is sent. If called again with the same configuration, the reply must
7259    /// include the same `set_time` value as was previously returned.
7260    /// For input channels, it is not required that the driver zero-out inactive channels.
7261    /// If `SetActiveChannels` is called for a second time before the first call has completed,
7262    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
7263    SetActiveChannels {
7264        active_channels_bitmask: u64,
7265        responder: RingBufferSetActiveChannelsResponder,
7266    },
7267    /// Get information about delays via a hanging get. The driver will immediately reply to the
7268    /// first `WatchDelayInfo` sent by the client. The driver will not respond to subsequent client
7269    /// `WatchDelayInfo` calls until the delay info changes from what was most recently reported.
7270    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
7271    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
7272    WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
7273    /// An interaction was received which does not match any known method.
7274    #[non_exhaustive]
7275    _UnknownMethod {
7276        /// Ordinal of the method that was called.
7277        ordinal: u64,
7278        control_handle: RingBufferControlHandle,
7279        method_type: fidl::MethodType,
7280    },
7281}
7282
7283impl RingBufferRequest {
7284    #[allow(irrefutable_let_patterns)]
7285    pub fn into_get_properties(self) -> Option<(RingBufferGetPropertiesResponder)> {
7286        if let RingBufferRequest::GetProperties { responder } = self {
7287            Some((responder))
7288        } else {
7289            None
7290        }
7291    }
7292
7293    #[allow(irrefutable_let_patterns)]
7294    pub fn into_watch_clock_recovery_position_info(
7295        self,
7296    ) -> Option<(RingBufferWatchClockRecoveryPositionInfoResponder)> {
7297        if let RingBufferRequest::WatchClockRecoveryPositionInfo { responder } = self {
7298            Some((responder))
7299        } else {
7300            None
7301        }
7302    }
7303
7304    #[allow(irrefutable_let_patterns)]
7305    pub fn into_get_vmo(self) -> Option<(u32, u32, RingBufferGetVmoResponder)> {
7306        if let RingBufferRequest::GetVmo {
7307            min_frames,
7308            clock_recovery_notifications_per_ring,
7309            responder,
7310        } = self
7311        {
7312            Some((min_frames, clock_recovery_notifications_per_ring, responder))
7313        } else {
7314            None
7315        }
7316    }
7317
7318    #[allow(irrefutable_let_patterns)]
7319    pub fn into_start(self) -> Option<(RingBufferStartResponder)> {
7320        if let RingBufferRequest::Start { responder } = self {
7321            Some((responder))
7322        } else {
7323            None
7324        }
7325    }
7326
7327    #[allow(irrefutable_let_patterns)]
7328    pub fn into_stop(self) -> Option<(RingBufferStopResponder)> {
7329        if let RingBufferRequest::Stop { responder } = self {
7330            Some((responder))
7331        } else {
7332            None
7333        }
7334    }
7335
7336    #[allow(irrefutable_let_patterns)]
7337    pub fn into_set_active_channels(self) -> Option<(u64, RingBufferSetActiveChannelsResponder)> {
7338        if let RingBufferRequest::SetActiveChannels { active_channels_bitmask, responder } = self {
7339            Some((active_channels_bitmask, responder))
7340        } else {
7341            None
7342        }
7343    }
7344
7345    #[allow(irrefutable_let_patterns)]
7346    pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
7347        if let RingBufferRequest::WatchDelayInfo { responder } = self {
7348            Some((responder))
7349        } else {
7350            None
7351        }
7352    }
7353
7354    /// Name of the method defined in FIDL
7355    pub fn method_name(&self) -> &'static str {
7356        match *self {
7357            RingBufferRequest::GetProperties { .. } => "get_properties",
7358            RingBufferRequest::WatchClockRecoveryPositionInfo { .. } => {
7359                "watch_clock_recovery_position_info"
7360            }
7361            RingBufferRequest::GetVmo { .. } => "get_vmo",
7362            RingBufferRequest::Start { .. } => "start",
7363            RingBufferRequest::Stop { .. } => "stop",
7364            RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
7365            RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
7366            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
7367                "unknown one-way method"
7368            }
7369            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
7370                "unknown two-way method"
7371            }
7372        }
7373    }
7374}
7375
7376#[derive(Debug, Clone)]
7377pub struct RingBufferControlHandle {
7378    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7379}
7380
7381impl fidl::endpoints::ControlHandle for RingBufferControlHandle {
7382    fn shutdown(&self) {
7383        self.inner.shutdown()
7384    }
7385    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7386        self.inner.shutdown_with_epitaph(status)
7387    }
7388
7389    fn is_closed(&self) -> bool {
7390        self.inner.channel().is_closed()
7391    }
7392    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7393        self.inner.channel().on_closed()
7394    }
7395
7396    #[cfg(target_os = "fuchsia")]
7397    fn signal_peer(
7398        &self,
7399        clear_mask: zx::Signals,
7400        set_mask: zx::Signals,
7401    ) -> Result<(), zx_status::Status> {
7402        use fidl::Peered;
7403        self.inner.channel().signal_peer(clear_mask, set_mask)
7404    }
7405}
7406
7407impl RingBufferControlHandle {}
7408
7409#[must_use = "FIDL methods require a response to be sent"]
7410#[derive(Debug)]
7411pub struct RingBufferGetPropertiesResponder {
7412    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7413    tx_id: u32,
7414}
7415
7416/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7417/// if the responder is dropped without sending a response, so that the client
7418/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7419impl std::ops::Drop for RingBufferGetPropertiesResponder {
7420    fn drop(&mut self) {
7421        self.control_handle.shutdown();
7422        // Safety: drops once, never accessed again
7423        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7424    }
7425}
7426
7427impl fidl::endpoints::Responder for RingBufferGetPropertiesResponder {
7428    type ControlHandle = RingBufferControlHandle;
7429
7430    fn control_handle(&self) -> &RingBufferControlHandle {
7431        &self.control_handle
7432    }
7433
7434    fn drop_without_shutdown(mut self) {
7435        // Safety: drops once, never accessed again due to mem::forget
7436        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7437        // Prevent Drop from running (which would shut down the channel)
7438        std::mem::forget(self);
7439    }
7440}
7441
7442impl RingBufferGetPropertiesResponder {
7443    /// Sends a response to the FIDL transaction.
7444    ///
7445    /// Sets the channel to shutdown if an error occurs.
7446    pub fn send(self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
7447        let _result = self.send_raw(properties);
7448        if _result.is_err() {
7449            self.control_handle.shutdown();
7450        }
7451        self.drop_without_shutdown();
7452        _result
7453    }
7454
7455    /// Similar to "send" but does not shutdown the channel if an error occurs.
7456    pub fn send_no_shutdown_on_err(
7457        self,
7458        mut properties: &RingBufferProperties,
7459    ) -> Result<(), fidl::Error> {
7460        let _result = self.send_raw(properties);
7461        self.drop_without_shutdown();
7462        _result
7463    }
7464
7465    fn send_raw(&self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
7466        self.control_handle.inner.send::<RingBufferGetPropertiesResponse>(
7467            (properties,),
7468            self.tx_id,
7469            0x12947f061a8fe1,
7470            fidl::encoding::DynamicFlags::empty(),
7471        )
7472    }
7473}
7474
7475#[must_use = "FIDL methods require a response to be sent"]
7476#[derive(Debug)]
7477pub struct RingBufferWatchClockRecoveryPositionInfoResponder {
7478    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7479    tx_id: u32,
7480}
7481
7482/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7483/// if the responder is dropped without sending a response, so that the client
7484/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7485impl std::ops::Drop for RingBufferWatchClockRecoveryPositionInfoResponder {
7486    fn drop(&mut self) {
7487        self.control_handle.shutdown();
7488        // Safety: drops once, never accessed again
7489        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7490    }
7491}
7492
7493impl fidl::endpoints::Responder for RingBufferWatchClockRecoveryPositionInfoResponder {
7494    type ControlHandle = RingBufferControlHandle;
7495
7496    fn control_handle(&self) -> &RingBufferControlHandle {
7497        &self.control_handle
7498    }
7499
7500    fn drop_without_shutdown(mut self) {
7501        // Safety: drops once, never accessed again due to mem::forget
7502        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7503        // Prevent Drop from running (which would shut down the channel)
7504        std::mem::forget(self);
7505    }
7506}
7507
7508impl RingBufferWatchClockRecoveryPositionInfoResponder {
7509    /// Sends a response to the FIDL transaction.
7510    ///
7511    /// Sets the channel to shutdown if an error occurs.
7512    pub fn send(self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
7513        let _result = self.send_raw(position_info);
7514        if _result.is_err() {
7515            self.control_handle.shutdown();
7516        }
7517        self.drop_without_shutdown();
7518        _result
7519    }
7520
7521    /// Similar to "send" but does not shutdown the channel if an error occurs.
7522    pub fn send_no_shutdown_on_err(
7523        self,
7524        mut position_info: &RingBufferPositionInfo,
7525    ) -> Result<(), fidl::Error> {
7526        let _result = self.send_raw(position_info);
7527        self.drop_without_shutdown();
7528        _result
7529    }
7530
7531    fn send_raw(&self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
7532        self.control_handle.inner.send::<RingBufferWatchClockRecoveryPositionInfoResponse>(
7533            (position_info,),
7534            self.tx_id,
7535            0x694d5b898a4167e5,
7536            fidl::encoding::DynamicFlags::empty(),
7537        )
7538    }
7539}
7540
7541#[must_use = "FIDL methods require a response to be sent"]
7542#[derive(Debug)]
7543pub struct RingBufferGetVmoResponder {
7544    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7545    tx_id: u32,
7546}
7547
7548/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7549/// if the responder is dropped without sending a response, so that the client
7550/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7551impl std::ops::Drop for RingBufferGetVmoResponder {
7552    fn drop(&mut self) {
7553        self.control_handle.shutdown();
7554        // Safety: drops once, never accessed again
7555        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7556    }
7557}
7558
7559impl fidl::endpoints::Responder for RingBufferGetVmoResponder {
7560    type ControlHandle = RingBufferControlHandle;
7561
7562    fn control_handle(&self) -> &RingBufferControlHandle {
7563        &self.control_handle
7564    }
7565
7566    fn drop_without_shutdown(mut self) {
7567        // Safety: drops once, never accessed again due to mem::forget
7568        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7569        // Prevent Drop from running (which would shut down the channel)
7570        std::mem::forget(self);
7571    }
7572}
7573
7574impl RingBufferGetVmoResponder {
7575    /// Sends a response to the FIDL transaction.
7576    ///
7577    /// Sets the channel to shutdown if an error occurs.
7578    pub fn send(
7579        self,
7580        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7581    ) -> Result<(), fidl::Error> {
7582        let _result = self.send_raw(result);
7583        if _result.is_err() {
7584            self.control_handle.shutdown();
7585        }
7586        self.drop_without_shutdown();
7587        _result
7588    }
7589
7590    /// Similar to "send" but does not shutdown the channel if an error occurs.
7591    pub fn send_no_shutdown_on_err(
7592        self,
7593        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7594    ) -> Result<(), fidl::Error> {
7595        let _result = self.send_raw(result);
7596        self.drop_without_shutdown();
7597        _result
7598    }
7599
7600    fn send_raw(
7601        &self,
7602        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7603    ) -> Result<(), fidl::Error> {
7604        self.control_handle
7605            .inner
7606            .send::<fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>>(
7607                result,
7608                self.tx_id,
7609                0x44c8f4f5680e853a,
7610                fidl::encoding::DynamicFlags::empty(),
7611            )
7612    }
7613}
7614
7615#[must_use = "FIDL methods require a response to be sent"]
7616#[derive(Debug)]
7617pub struct RingBufferStartResponder {
7618    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7619    tx_id: u32,
7620}
7621
7622/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7623/// if the responder is dropped without sending a response, so that the client
7624/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7625impl std::ops::Drop for RingBufferStartResponder {
7626    fn drop(&mut self) {
7627        self.control_handle.shutdown();
7628        // Safety: drops once, never accessed again
7629        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7630    }
7631}
7632
7633impl fidl::endpoints::Responder for RingBufferStartResponder {
7634    type ControlHandle = RingBufferControlHandle;
7635
7636    fn control_handle(&self) -> &RingBufferControlHandle {
7637        &self.control_handle
7638    }
7639
7640    fn drop_without_shutdown(mut self) {
7641        // Safety: drops once, never accessed again due to mem::forget
7642        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7643        // Prevent Drop from running (which would shut down the channel)
7644        std::mem::forget(self);
7645    }
7646}
7647
7648impl RingBufferStartResponder {
7649    /// Sends a response to the FIDL transaction.
7650    ///
7651    /// Sets the channel to shutdown if an error occurs.
7652    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
7653        let _result = self.send_raw(start_time);
7654        if _result.is_err() {
7655            self.control_handle.shutdown();
7656        }
7657        self.drop_without_shutdown();
7658        _result
7659    }
7660
7661    /// Similar to "send" but does not shutdown the channel if an error occurs.
7662    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
7663        let _result = self.send_raw(start_time);
7664        self.drop_without_shutdown();
7665        _result
7666    }
7667
7668    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
7669        self.control_handle.inner.send::<RingBufferStartResponse>(
7670            (start_time,),
7671            self.tx_id,
7672            0x5dd780a769a8892d,
7673            fidl::encoding::DynamicFlags::empty(),
7674        )
7675    }
7676}
7677
7678#[must_use = "FIDL methods require a response to be sent"]
7679#[derive(Debug)]
7680pub struct RingBufferStopResponder {
7681    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7682    tx_id: u32,
7683}
7684
7685/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7686/// if the responder is dropped without sending a response, so that the client
7687/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7688impl std::ops::Drop for RingBufferStopResponder {
7689    fn drop(&mut self) {
7690        self.control_handle.shutdown();
7691        // Safety: drops once, never accessed again
7692        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7693    }
7694}
7695
7696impl fidl::endpoints::Responder for RingBufferStopResponder {
7697    type ControlHandle = RingBufferControlHandle;
7698
7699    fn control_handle(&self) -> &RingBufferControlHandle {
7700        &self.control_handle
7701    }
7702
7703    fn drop_without_shutdown(mut self) {
7704        // Safety: drops once, never accessed again due to mem::forget
7705        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7706        // Prevent Drop from running (which would shut down the channel)
7707        std::mem::forget(self);
7708    }
7709}
7710
7711impl RingBufferStopResponder {
7712    /// Sends a response to the FIDL transaction.
7713    ///
7714    /// Sets the channel to shutdown if an error occurs.
7715    pub fn send(self) -> Result<(), fidl::Error> {
7716        let _result = self.send_raw();
7717        if _result.is_err() {
7718            self.control_handle.shutdown();
7719        }
7720        self.drop_without_shutdown();
7721        _result
7722    }
7723
7724    /// Similar to "send" but does not shutdown the channel if an error occurs.
7725    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7726        let _result = self.send_raw();
7727        self.drop_without_shutdown();
7728        _result
7729    }
7730
7731    fn send_raw(&self) -> Result<(), fidl::Error> {
7732        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7733            (),
7734            self.tx_id,
7735            0x49a73d9cf1d4e110,
7736            fidl::encoding::DynamicFlags::empty(),
7737        )
7738    }
7739}
7740
7741#[must_use = "FIDL methods require a response to be sent"]
7742#[derive(Debug)]
7743pub struct RingBufferSetActiveChannelsResponder {
7744    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7745    tx_id: u32,
7746}
7747
7748/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7749/// if the responder is dropped without sending a response, so that the client
7750/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7751impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
7752    fn drop(&mut self) {
7753        self.control_handle.shutdown();
7754        // Safety: drops once, never accessed again
7755        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7756    }
7757}
7758
7759impl fidl::endpoints::Responder for RingBufferSetActiveChannelsResponder {
7760    type ControlHandle = RingBufferControlHandle;
7761
7762    fn control_handle(&self) -> &RingBufferControlHandle {
7763        &self.control_handle
7764    }
7765
7766    fn drop_without_shutdown(mut self) {
7767        // Safety: drops once, never accessed again due to mem::forget
7768        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7769        // Prevent Drop from running (which would shut down the channel)
7770        std::mem::forget(self);
7771    }
7772}
7773
7774impl RingBufferSetActiveChannelsResponder {
7775    /// Sends a response to the FIDL transaction.
7776    ///
7777    /// Sets the channel to shutdown if an error occurs.
7778    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
7779        let _result = self.send_raw(result);
7780        if _result.is_err() {
7781            self.control_handle.shutdown();
7782        }
7783        self.drop_without_shutdown();
7784        _result
7785    }
7786
7787    /// Similar to "send" but does not shutdown the channel if an error occurs.
7788    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
7789        let _result = self.send_raw(result);
7790        self.drop_without_shutdown();
7791        _result
7792    }
7793
7794    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
7795        self.control_handle.inner.send::<fidl::encoding::ResultType<
7796            RingBufferSetActiveChannelsResponse,
7797            i32,
7798        >>(
7799            result.map(|set_time| (set_time,)),
7800            self.tx_id,
7801            0x605464c1d384f309,
7802            fidl::encoding::DynamicFlags::empty(),
7803        )
7804    }
7805}
7806
7807#[must_use = "FIDL methods require a response to be sent"]
7808#[derive(Debug)]
7809pub struct RingBufferWatchDelayInfoResponder {
7810    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7811    tx_id: u32,
7812}
7813
7814/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7815/// if the responder is dropped without sending a response, so that the client
7816/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7817impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
7818    fn drop(&mut self) {
7819        self.control_handle.shutdown();
7820        // Safety: drops once, never accessed again
7821        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7822    }
7823}
7824
7825impl fidl::endpoints::Responder for RingBufferWatchDelayInfoResponder {
7826    type ControlHandle = RingBufferControlHandle;
7827
7828    fn control_handle(&self) -> &RingBufferControlHandle {
7829        &self.control_handle
7830    }
7831
7832    fn drop_without_shutdown(mut self) {
7833        // Safety: drops once, never accessed again due to mem::forget
7834        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7835        // Prevent Drop from running (which would shut down the channel)
7836        std::mem::forget(self);
7837    }
7838}
7839
7840impl RingBufferWatchDelayInfoResponder {
7841    /// Sends a response to the FIDL transaction.
7842    ///
7843    /// Sets the channel to shutdown if an error occurs.
7844    pub fn send(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
7845        let _result = self.send_raw(delay_info);
7846        if _result.is_err() {
7847            self.control_handle.shutdown();
7848        }
7849        self.drop_without_shutdown();
7850        _result
7851    }
7852
7853    /// Similar to "send" but does not shutdown the channel if an error occurs.
7854    pub fn send_no_shutdown_on_err(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
7855        let _result = self.send_raw(delay_info);
7856        self.drop_without_shutdown();
7857        _result
7858    }
7859
7860    fn send_raw(&self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
7861        self.control_handle
7862            .inner
7863            .send::<fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>>(
7864                fidl::encoding::Flexible::new((delay_info,)),
7865                self.tx_id,
7866                0x6c1248db213fcf9f,
7867                fidl::encoding::DynamicFlags::FLEXIBLE,
7868            )
7869    }
7870}
7871
7872#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7873pub struct StreamConfigMarker;
7874
7875impl fidl::endpoints::ProtocolMarker for StreamConfigMarker {
7876    type Proxy = StreamConfigProxy;
7877    type RequestStream = StreamConfigRequestStream;
7878    #[cfg(target_os = "fuchsia")]
7879    type SynchronousProxy = StreamConfigSynchronousProxy;
7880
7881    const DEBUG_NAME: &'static str = "(anonymous) StreamConfig";
7882}
7883
7884pub trait StreamConfigProxyInterface: Send + Sync {
7885    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
7886        + Send;
7887    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
7888    fn r#signal_processing_connect(
7889        &self,
7890        protocol: fidl::endpoints::ServerEnd<
7891            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
7892        >,
7893    ) -> Result<(), fidl::Error>;
7894    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
7895        + Send;
7896    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
7897    type GetSupportedFormatsResponseFut: std::future::Future<Output = Result<Vec<SupportedFormats>, fidl::Error>>
7898        + Send;
7899    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut;
7900    fn r#create_ring_buffer(
7901        &self,
7902        format: &Format,
7903        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
7904    ) -> Result<(), fidl::Error>;
7905    type WatchGainStateResponseFut: std::future::Future<Output = Result<GainState, fidl::Error>>
7906        + Send;
7907    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut;
7908    fn r#set_gain(&self, target_state: &GainState) -> Result<(), fidl::Error>;
7909    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
7910        + Send;
7911    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
7912}
7913#[derive(Debug)]
7914#[cfg(target_os = "fuchsia")]
7915pub struct StreamConfigSynchronousProxy {
7916    client: fidl::client::sync::Client,
7917}
7918
7919#[cfg(target_os = "fuchsia")]
7920impl fidl::endpoints::SynchronousProxy for StreamConfigSynchronousProxy {
7921    type Proxy = StreamConfigProxy;
7922    type Protocol = StreamConfigMarker;
7923
7924    fn from_channel(inner: fidl::Channel) -> Self {
7925        Self::new(inner)
7926    }
7927
7928    fn into_channel(self) -> fidl::Channel {
7929        self.client.into_channel()
7930    }
7931
7932    fn as_channel(&self) -> &fidl::Channel {
7933        self.client.as_channel()
7934    }
7935}
7936
7937#[cfg(target_os = "fuchsia")]
7938impl StreamConfigSynchronousProxy {
7939    pub fn new(channel: fidl::Channel) -> Self {
7940        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7941        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7942    }
7943
7944    pub fn into_channel(self) -> fidl::Channel {
7945        self.client.into_channel()
7946    }
7947
7948    /// Waits until an event arrives and returns it. It is safe for other
7949    /// threads to make concurrent requests while waiting for an event.
7950    pub fn wait_for_event(
7951        &self,
7952        deadline: zx::MonotonicInstant,
7953    ) -> Result<StreamConfigEvent, fidl::Error> {
7954        StreamConfigEvent::decode(self.client.wait_for_event(deadline)?)
7955    }
7956
7957    /// Retrieves top level health state.
7958    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
7959    pub fn r#get_health_state(
7960        &self,
7961        ___deadline: zx::MonotonicInstant,
7962    ) -> Result<HealthState, fidl::Error> {
7963        let _response =
7964            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
7965                (),
7966                0x4e146d6bca733a84,
7967                fidl::encoding::DynamicFlags::empty(),
7968                ___deadline,
7969            )?;
7970        Ok(_response.state)
7971    }
7972
7973    /// Connect to a `SignalProcessing` protocol.
7974    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
7975    /// the maximum number of connections have already been created, for instance one, then the
7976    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
7977    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
7978    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
7979    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
7980    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
7981    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
7982    /// is intended to be composed, and hence the more verbose name allows differentiation and
7983    /// improved clarity.
7984    pub fn r#signal_processing_connect(
7985        &self,
7986        mut protocol: fidl::endpoints::ServerEnd<
7987            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
7988        >,
7989    ) -> Result<(), fidl::Error> {
7990        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
7991            (protocol,),
7992            0xa81907ce6066295,
7993            fidl::encoding::DynamicFlags::empty(),
7994        )
7995    }
7996
7997    /// Retrieves top level static properties.
7998    pub fn r#get_properties(
7999        &self,
8000        ___deadline: zx::MonotonicInstant,
8001    ) -> Result<StreamProperties, fidl::Error> {
8002        let _response = self
8003            .client
8004            .send_query::<fidl::encoding::EmptyPayload, StreamConfigGetPropertiesResponse>(
8005                (),
8006                0x7d89c02f3e2d3c01,
8007                fidl::encoding::DynamicFlags::empty(),
8008                ___deadline,
8009            )?;
8010        Ok(_response.properties)
8011    }
8012
8013    /// Gets formats supported by a given driver. When not all combinations supported by the
8014    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8015    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8016    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8017    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8018    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8019    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8020    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8021    /// <<16bits,32bits>,<48KHz,96KHz>>.
8022    pub fn r#get_supported_formats(
8023        &self,
8024        ___deadline: zx::MonotonicInstant,
8025    ) -> Result<Vec<SupportedFormats>, fidl::Error> {
8026        let _response = self
8027            .client
8028            .send_query::<fidl::encoding::EmptyPayload, StreamConfigGetSupportedFormatsResponse>(
8029                (),
8030                0x448efa7850cafe7e,
8031                fidl::encoding::DynamicFlags::empty(),
8032                ___deadline,
8033            )?;
8034        Ok(_response.supported_formats)
8035    }
8036
8037    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8038    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8039    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8040    /// ring buffer channel had been established and was still active, the driver must close that
8041    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8042    /// operations in the process.
8043    pub fn r#create_ring_buffer(
8044        &self,
8045        mut format: &Format,
8046        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8047    ) -> Result<(), fidl::Error> {
8048        self.client.send::<StreamConfigCreateRingBufferRequest>(
8049            (format, ring_buffer),
8050            0x2afb19dd13faa1ba,
8051            fidl::encoding::DynamicFlags::empty(),
8052        )
8053    }
8054
8055    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8056    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8057    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8058    /// from what was most recently reported.
8059    /// If `WatchGainState` is called for a second time before the first call has completed, then
8060    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8061    pub fn r#watch_gain_state(
8062        &self,
8063        ___deadline: zx::MonotonicInstant,
8064    ) -> Result<GainState, fidl::Error> {
8065        let _response = self
8066            .client
8067            .send_query::<fidl::encoding::EmptyPayload, StreamConfigWatchGainStateResponse>(
8068                (),
8069                0x4772506136ab65c1,
8070                fidl::encoding::DynamicFlags::empty(),
8071                ___deadline,
8072            )?;
8073        Ok(_response.gain_state)
8074    }
8075
8076    /// Client update of the gain state.
8077    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8078        self.client.send::<StreamConfigSetGainRequest>(
8079            (target_state,),
8080            0x3943b41498c6a384,
8081            fidl::encoding::DynamicFlags::empty(),
8082        )
8083    }
8084
8085    /// Get the plug detect state via a hanging get. The driver will reply to the first
8086    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8087    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8088    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8089    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8090    pub fn r#watch_plug_state(
8091        &self,
8092        ___deadline: zx::MonotonicInstant,
8093    ) -> Result<PlugState, fidl::Error> {
8094        let _response = self
8095            .client
8096            .send_query::<fidl::encoding::EmptyPayload, StreamConfigWatchPlugStateResponse>(
8097                (),
8098                0x497345a6f048b2a6,
8099                fidl::encoding::DynamicFlags::empty(),
8100                ___deadline,
8101            )?;
8102        Ok(_response.plug_state)
8103    }
8104}
8105
8106#[cfg(target_os = "fuchsia")]
8107impl From<StreamConfigSynchronousProxy> for zx::Handle {
8108    fn from(value: StreamConfigSynchronousProxy) -> Self {
8109        value.into_channel().into()
8110    }
8111}
8112
8113#[cfg(target_os = "fuchsia")]
8114impl From<fidl::Channel> for StreamConfigSynchronousProxy {
8115    fn from(value: fidl::Channel) -> Self {
8116        Self::new(value)
8117    }
8118}
8119
8120#[cfg(target_os = "fuchsia")]
8121impl fidl::endpoints::FromClient for StreamConfigSynchronousProxy {
8122    type Protocol = StreamConfigMarker;
8123
8124    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigMarker>) -> Self {
8125        Self::new(value.into_channel())
8126    }
8127}
8128
8129#[derive(Debug, Clone)]
8130pub struct StreamConfigProxy {
8131    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8132}
8133
8134impl fidl::endpoints::Proxy for StreamConfigProxy {
8135    type Protocol = StreamConfigMarker;
8136
8137    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8138        Self::new(inner)
8139    }
8140
8141    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8142        self.client.into_channel().map_err(|client| Self { client })
8143    }
8144
8145    fn as_channel(&self) -> &::fidl::AsyncChannel {
8146        self.client.as_channel()
8147    }
8148}
8149
8150impl StreamConfigProxy {
8151    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfig.
8152    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8153        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8154        Self { client: fidl::client::Client::new(channel, protocol_name) }
8155    }
8156
8157    /// Get a Stream of events from the remote end of the protocol.
8158    ///
8159    /// # Panics
8160    ///
8161    /// Panics if the event stream was already taken.
8162    pub fn take_event_stream(&self) -> StreamConfigEventStream {
8163        StreamConfigEventStream { event_receiver: self.client.take_event_receiver() }
8164    }
8165
8166    /// Retrieves top level health state.
8167    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
8168    pub fn r#get_health_state(
8169        &self,
8170    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
8171    {
8172        StreamConfigProxyInterface::r#get_health_state(self)
8173    }
8174
8175    /// Connect to a `SignalProcessing` protocol.
8176    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
8177    /// the maximum number of connections have already been created, for instance one, then the
8178    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
8179    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
8180    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
8181    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
8182    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
8183    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
8184    /// is intended to be composed, and hence the more verbose name allows differentiation and
8185    /// improved clarity.
8186    pub fn r#signal_processing_connect(
8187        &self,
8188        mut protocol: fidl::endpoints::ServerEnd<
8189            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8190        >,
8191    ) -> Result<(), fidl::Error> {
8192        StreamConfigProxyInterface::r#signal_processing_connect(self, protocol)
8193    }
8194
8195    /// Retrieves top level static properties.
8196    pub fn r#get_properties(
8197        &self,
8198    ) -> fidl::client::QueryResponseFut<
8199        StreamProperties,
8200        fidl::encoding::DefaultFuchsiaResourceDialect,
8201    > {
8202        StreamConfigProxyInterface::r#get_properties(self)
8203    }
8204
8205    /// Gets formats supported by a given driver. When not all combinations supported by the
8206    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8207    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8208    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8209    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8210    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8211    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8212    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8213    /// <<16bits,32bits>,<48KHz,96KHz>>.
8214    pub fn r#get_supported_formats(
8215        &self,
8216    ) -> fidl::client::QueryResponseFut<
8217        Vec<SupportedFormats>,
8218        fidl::encoding::DefaultFuchsiaResourceDialect,
8219    > {
8220        StreamConfigProxyInterface::r#get_supported_formats(self)
8221    }
8222
8223    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8224    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8225    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8226    /// ring buffer channel had been established and was still active, the driver must close that
8227    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8228    /// operations in the process.
8229    pub fn r#create_ring_buffer(
8230        &self,
8231        mut format: &Format,
8232        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8233    ) -> Result<(), fidl::Error> {
8234        StreamConfigProxyInterface::r#create_ring_buffer(self, format, ring_buffer)
8235    }
8236
8237    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8238    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8239    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8240    /// from what was most recently reported.
8241    /// If `WatchGainState` is called for a second time before the first call has completed, then
8242    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8243    pub fn r#watch_gain_state(
8244        &self,
8245    ) -> fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>
8246    {
8247        StreamConfigProxyInterface::r#watch_gain_state(self)
8248    }
8249
8250    /// Client update of the gain state.
8251    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8252        StreamConfigProxyInterface::r#set_gain(self, target_state)
8253    }
8254
8255    /// Get the plug detect state via a hanging get. The driver will reply to the first
8256    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8257    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8258    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8259    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8260    pub fn r#watch_plug_state(
8261        &self,
8262    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
8263    {
8264        StreamConfigProxyInterface::r#watch_plug_state(self)
8265    }
8266}
8267
8268impl StreamConfigProxyInterface for StreamConfigProxy {
8269    type GetHealthStateResponseFut =
8270        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8271    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
8272        fn _decode(
8273            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8274        ) -> Result<HealthState, fidl::Error> {
8275            let _response = fidl::client::decode_transaction_body::<
8276                HealthGetHealthStateResponse,
8277                fidl::encoding::DefaultFuchsiaResourceDialect,
8278                0x4e146d6bca733a84,
8279            >(_buf?)?;
8280            Ok(_response.state)
8281        }
8282        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
8283            (),
8284            0x4e146d6bca733a84,
8285            fidl::encoding::DynamicFlags::empty(),
8286            _decode,
8287        )
8288    }
8289
8290    fn r#signal_processing_connect(
8291        &self,
8292        mut protocol: fidl::endpoints::ServerEnd<
8293            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8294        >,
8295    ) -> Result<(), fidl::Error> {
8296        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
8297            (protocol,),
8298            0xa81907ce6066295,
8299            fidl::encoding::DynamicFlags::empty(),
8300        )
8301    }
8302
8303    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
8304        StreamProperties,
8305        fidl::encoding::DefaultFuchsiaResourceDialect,
8306    >;
8307    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
8308        fn _decode(
8309            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8310        ) -> Result<StreamProperties, fidl::Error> {
8311            let _response = fidl::client::decode_transaction_body::<
8312                StreamConfigGetPropertiesResponse,
8313                fidl::encoding::DefaultFuchsiaResourceDialect,
8314                0x7d89c02f3e2d3c01,
8315            >(_buf?)?;
8316            Ok(_response.properties)
8317        }
8318        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
8319            (),
8320            0x7d89c02f3e2d3c01,
8321            fidl::encoding::DynamicFlags::empty(),
8322            _decode,
8323        )
8324    }
8325
8326    type GetSupportedFormatsResponseFut = fidl::client::QueryResponseFut<
8327        Vec<SupportedFormats>,
8328        fidl::encoding::DefaultFuchsiaResourceDialect,
8329    >;
8330    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut {
8331        fn _decode(
8332            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8333        ) -> Result<Vec<SupportedFormats>, fidl::Error> {
8334            let _response = fidl::client::decode_transaction_body::<
8335                StreamConfigGetSupportedFormatsResponse,
8336                fidl::encoding::DefaultFuchsiaResourceDialect,
8337                0x448efa7850cafe7e,
8338            >(_buf?)?;
8339            Ok(_response.supported_formats)
8340        }
8341        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<SupportedFormats>>(
8342            (),
8343            0x448efa7850cafe7e,
8344            fidl::encoding::DynamicFlags::empty(),
8345            _decode,
8346        )
8347    }
8348
8349    fn r#create_ring_buffer(
8350        &self,
8351        mut format: &Format,
8352        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8353    ) -> Result<(), fidl::Error> {
8354        self.client.send::<StreamConfigCreateRingBufferRequest>(
8355            (format, ring_buffer),
8356            0x2afb19dd13faa1ba,
8357            fidl::encoding::DynamicFlags::empty(),
8358        )
8359    }
8360
8361    type WatchGainStateResponseFut =
8362        fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8363    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut {
8364        fn _decode(
8365            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8366        ) -> Result<GainState, fidl::Error> {
8367            let _response = fidl::client::decode_transaction_body::<
8368                StreamConfigWatchGainStateResponse,
8369                fidl::encoding::DefaultFuchsiaResourceDialect,
8370                0x4772506136ab65c1,
8371            >(_buf?)?;
8372            Ok(_response.gain_state)
8373        }
8374        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GainState>(
8375            (),
8376            0x4772506136ab65c1,
8377            fidl::encoding::DynamicFlags::empty(),
8378            _decode,
8379        )
8380    }
8381
8382    fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8383        self.client.send::<StreamConfigSetGainRequest>(
8384            (target_state,),
8385            0x3943b41498c6a384,
8386            fidl::encoding::DynamicFlags::empty(),
8387        )
8388    }
8389
8390    type WatchPlugStateResponseFut =
8391        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8392    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
8393        fn _decode(
8394            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8395        ) -> Result<PlugState, fidl::Error> {
8396            let _response = fidl::client::decode_transaction_body::<
8397                StreamConfigWatchPlugStateResponse,
8398                fidl::encoding::DefaultFuchsiaResourceDialect,
8399                0x497345a6f048b2a6,
8400            >(_buf?)?;
8401            Ok(_response.plug_state)
8402        }
8403        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
8404            (),
8405            0x497345a6f048b2a6,
8406            fidl::encoding::DynamicFlags::empty(),
8407            _decode,
8408        )
8409    }
8410}
8411
8412pub struct StreamConfigEventStream {
8413    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8414}
8415
8416impl std::marker::Unpin for StreamConfigEventStream {}
8417
8418impl futures::stream::FusedStream for StreamConfigEventStream {
8419    fn is_terminated(&self) -> bool {
8420        self.event_receiver.is_terminated()
8421    }
8422}
8423
8424impl futures::Stream for StreamConfigEventStream {
8425    type Item = Result<StreamConfigEvent, fidl::Error>;
8426
8427    fn poll_next(
8428        mut self: std::pin::Pin<&mut Self>,
8429        cx: &mut std::task::Context<'_>,
8430    ) -> std::task::Poll<Option<Self::Item>> {
8431        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8432            &mut self.event_receiver,
8433            cx
8434        )?) {
8435            Some(buf) => std::task::Poll::Ready(Some(StreamConfigEvent::decode(buf))),
8436            None => std::task::Poll::Ready(None),
8437        }
8438    }
8439}
8440
8441#[derive(Debug)]
8442pub enum StreamConfigEvent {}
8443
8444impl StreamConfigEvent {
8445    /// Decodes a message buffer as a [`StreamConfigEvent`].
8446    fn decode(
8447        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8448    ) -> Result<StreamConfigEvent, fidl::Error> {
8449        let (bytes, _handles) = buf.split_mut();
8450        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8451        debug_assert_eq!(tx_header.tx_id, 0);
8452        match tx_header.ordinal {
8453            _ => Err(fidl::Error::UnknownOrdinal {
8454                ordinal: tx_header.ordinal,
8455                protocol_name: <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8456            }),
8457        }
8458    }
8459}
8460
8461/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfig.
8462pub struct StreamConfigRequestStream {
8463    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8464    is_terminated: bool,
8465}
8466
8467impl std::marker::Unpin for StreamConfigRequestStream {}
8468
8469impl futures::stream::FusedStream for StreamConfigRequestStream {
8470    fn is_terminated(&self) -> bool {
8471        self.is_terminated
8472    }
8473}
8474
8475impl fidl::endpoints::RequestStream for StreamConfigRequestStream {
8476    type Protocol = StreamConfigMarker;
8477    type ControlHandle = StreamConfigControlHandle;
8478
8479    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8480        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8481    }
8482
8483    fn control_handle(&self) -> Self::ControlHandle {
8484        StreamConfigControlHandle { inner: self.inner.clone() }
8485    }
8486
8487    fn into_inner(
8488        self,
8489    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8490    {
8491        (self.inner, self.is_terminated)
8492    }
8493
8494    fn from_inner(
8495        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8496        is_terminated: bool,
8497    ) -> Self {
8498        Self { inner, is_terminated }
8499    }
8500}
8501
8502impl futures::Stream for StreamConfigRequestStream {
8503    type Item = Result<StreamConfigRequest, fidl::Error>;
8504
8505    fn poll_next(
8506        mut self: std::pin::Pin<&mut Self>,
8507        cx: &mut std::task::Context<'_>,
8508    ) -> std::task::Poll<Option<Self::Item>> {
8509        let this = &mut *self;
8510        if this.inner.check_shutdown(cx) {
8511            this.is_terminated = true;
8512            return std::task::Poll::Ready(None);
8513        }
8514        if this.is_terminated {
8515            panic!("polled StreamConfigRequestStream after completion");
8516        }
8517        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8518            |bytes, handles| {
8519                match this.inner.channel().read_etc(cx, bytes, handles) {
8520                    std::task::Poll::Ready(Ok(())) => {}
8521                    std::task::Poll::Pending => return std::task::Poll::Pending,
8522                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8523                        this.is_terminated = true;
8524                        return std::task::Poll::Ready(None);
8525                    }
8526                    std::task::Poll::Ready(Err(e)) => {
8527                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8528                            e.into(),
8529                        ))))
8530                    }
8531                }
8532
8533                // A message has been received from the channel
8534                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8535
8536                std::task::Poll::Ready(Some(match header.ordinal {
8537                    0x4e146d6bca733a84 => {
8538                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8539                        let mut req = fidl::new_empty!(
8540                            fidl::encoding::EmptyPayload,
8541                            fidl::encoding::DefaultFuchsiaResourceDialect
8542                        );
8543                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8544                        let control_handle =
8545                            StreamConfigControlHandle { inner: this.inner.clone() };
8546                        Ok(StreamConfigRequest::GetHealthState {
8547                            responder: StreamConfigGetHealthStateResponder {
8548                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8549                                tx_id: header.tx_id,
8550                            },
8551                        })
8552                    }
8553                    0xa81907ce6066295 => {
8554                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8555                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8556                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
8557                        let control_handle =
8558                            StreamConfigControlHandle { inner: this.inner.clone() };
8559                        Ok(StreamConfigRequest::SignalProcessingConnect {
8560                            protocol: req.protocol,
8561
8562                            control_handle,
8563                        })
8564                    }
8565                    0x7d89c02f3e2d3c01 => {
8566                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8567                        let mut req = fidl::new_empty!(
8568                            fidl::encoding::EmptyPayload,
8569                            fidl::encoding::DefaultFuchsiaResourceDialect
8570                        );
8571                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8572                        let control_handle =
8573                            StreamConfigControlHandle { inner: this.inner.clone() };
8574                        Ok(StreamConfigRequest::GetProperties {
8575                            responder: StreamConfigGetPropertiesResponder {
8576                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8577                                tx_id: header.tx_id,
8578                            },
8579                        })
8580                    }
8581                    0x448efa7850cafe7e => {
8582                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8583                        let mut req = fidl::new_empty!(
8584                            fidl::encoding::EmptyPayload,
8585                            fidl::encoding::DefaultFuchsiaResourceDialect
8586                        );
8587                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8588                        let control_handle =
8589                            StreamConfigControlHandle { inner: this.inner.clone() };
8590                        Ok(StreamConfigRequest::GetSupportedFormats {
8591                            responder: StreamConfigGetSupportedFormatsResponder {
8592                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8593                                tx_id: header.tx_id,
8594                            },
8595                        })
8596                    }
8597                    0x2afb19dd13faa1ba => {
8598                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8599                        let mut req = fidl::new_empty!(
8600                            StreamConfigCreateRingBufferRequest,
8601                            fidl::encoding::DefaultFuchsiaResourceDialect
8602                        );
8603                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
8604                        let control_handle =
8605                            StreamConfigControlHandle { inner: this.inner.clone() };
8606                        Ok(StreamConfigRequest::CreateRingBuffer {
8607                            format: req.format,
8608                            ring_buffer: req.ring_buffer,
8609
8610                            control_handle,
8611                        })
8612                    }
8613                    0x4772506136ab65c1 => {
8614                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8615                        let mut req = fidl::new_empty!(
8616                            fidl::encoding::EmptyPayload,
8617                            fidl::encoding::DefaultFuchsiaResourceDialect
8618                        );
8619                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8620                        let control_handle =
8621                            StreamConfigControlHandle { inner: this.inner.clone() };
8622                        Ok(StreamConfigRequest::WatchGainState {
8623                            responder: StreamConfigWatchGainStateResponder {
8624                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8625                                tx_id: header.tx_id,
8626                            },
8627                        })
8628                    }
8629                    0x3943b41498c6a384 => {
8630                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8631                        let mut req = fidl::new_empty!(
8632                            StreamConfigSetGainRequest,
8633                            fidl::encoding::DefaultFuchsiaResourceDialect
8634                        );
8635                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
8636                        let control_handle =
8637                            StreamConfigControlHandle { inner: this.inner.clone() };
8638                        Ok(StreamConfigRequest::SetGain {
8639                            target_state: req.target_state,
8640
8641                            control_handle,
8642                        })
8643                    }
8644                    0x497345a6f048b2a6 => {
8645                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8646                        let mut req = fidl::new_empty!(
8647                            fidl::encoding::EmptyPayload,
8648                            fidl::encoding::DefaultFuchsiaResourceDialect
8649                        );
8650                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8651                        let control_handle =
8652                            StreamConfigControlHandle { inner: this.inner.clone() };
8653                        Ok(StreamConfigRequest::WatchPlugState {
8654                            responder: StreamConfigWatchPlugStateResponder {
8655                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8656                                tx_id: header.tx_id,
8657                            },
8658                        })
8659                    }
8660                    _ => Err(fidl::Error::UnknownOrdinal {
8661                        ordinal: header.ordinal,
8662                        protocol_name:
8663                            <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8664                    }),
8665                }))
8666            },
8667        )
8668    }
8669}
8670
8671/// For an overview see
8672/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming)
8673/// # Deprecation
8674///
8675/// Not supported anymore, instead use an
8676/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
8677/// with one Ring Buffer, see
8678/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
8679#[derive(Debug)]
8680pub enum StreamConfigRequest {
8681    /// Retrieves top level health state.
8682    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
8683    GetHealthState { responder: StreamConfigGetHealthStateResponder },
8684    /// Connect to a `SignalProcessing` protocol.
8685    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
8686    /// the maximum number of connections have already been created, for instance one, then the
8687    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
8688    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
8689    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
8690    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
8691    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
8692    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
8693    /// is intended to be composed, and hence the more verbose name allows differentiation and
8694    /// improved clarity.
8695    SignalProcessingConnect {
8696        protocol: fidl::endpoints::ServerEnd<
8697            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8698        >,
8699        control_handle: StreamConfigControlHandle,
8700    },
8701    /// Retrieves top level static properties.
8702    GetProperties { responder: StreamConfigGetPropertiesResponder },
8703    /// Gets formats supported by a given driver. When not all combinations supported by the
8704    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8705    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8706    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8707    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8708    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8709    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8710    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8711    /// <<16bits,32bits>,<48KHz,96KHz>>.
8712    GetSupportedFormats { responder: StreamConfigGetSupportedFormatsResponder },
8713    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8714    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8715    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8716    /// ring buffer channel had been established and was still active, the driver must close that
8717    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8718    /// operations in the process.
8719    CreateRingBuffer {
8720        format: Format,
8721        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8722        control_handle: StreamConfigControlHandle,
8723    },
8724    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8725    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8726    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8727    /// from what was most recently reported.
8728    /// If `WatchGainState` is called for a second time before the first call has completed, then
8729    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8730    WatchGainState { responder: StreamConfigWatchGainStateResponder },
8731    /// Client update of the gain state.
8732    SetGain { target_state: GainState, control_handle: StreamConfigControlHandle },
8733    /// Get the plug detect state via a hanging get. The driver will reply to the first
8734    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8735    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8736    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8737    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8738    WatchPlugState { responder: StreamConfigWatchPlugStateResponder },
8739}
8740
8741impl StreamConfigRequest {
8742    #[allow(irrefutable_let_patterns)]
8743    pub fn into_get_health_state(self) -> Option<(StreamConfigGetHealthStateResponder)> {
8744        if let StreamConfigRequest::GetHealthState { responder } = self {
8745            Some((responder))
8746        } else {
8747            None
8748        }
8749    }
8750
8751    #[allow(irrefutable_let_patterns)]
8752    pub fn into_signal_processing_connect(
8753        self,
8754    ) -> Option<(
8755        fidl::endpoints::ServerEnd<
8756            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8757        >,
8758        StreamConfigControlHandle,
8759    )> {
8760        if let StreamConfigRequest::SignalProcessingConnect { protocol, control_handle } = self {
8761            Some((protocol, control_handle))
8762        } else {
8763            None
8764        }
8765    }
8766
8767    #[allow(irrefutable_let_patterns)]
8768    pub fn into_get_properties(self) -> Option<(StreamConfigGetPropertiesResponder)> {
8769        if let StreamConfigRequest::GetProperties { responder } = self {
8770            Some((responder))
8771        } else {
8772            None
8773        }
8774    }
8775
8776    #[allow(irrefutable_let_patterns)]
8777    pub fn into_get_supported_formats(self) -> Option<(StreamConfigGetSupportedFormatsResponder)> {
8778        if let StreamConfigRequest::GetSupportedFormats { responder } = self {
8779            Some((responder))
8780        } else {
8781            None
8782        }
8783    }
8784
8785    #[allow(irrefutable_let_patterns)]
8786    pub fn into_create_ring_buffer(
8787        self,
8788    ) -> Option<(Format, fidl::endpoints::ServerEnd<RingBufferMarker>, StreamConfigControlHandle)>
8789    {
8790        if let StreamConfigRequest::CreateRingBuffer { format, ring_buffer, control_handle } = self
8791        {
8792            Some((format, ring_buffer, control_handle))
8793        } else {
8794            None
8795        }
8796    }
8797
8798    #[allow(irrefutable_let_patterns)]
8799    pub fn into_watch_gain_state(self) -> Option<(StreamConfigWatchGainStateResponder)> {
8800        if let StreamConfigRequest::WatchGainState { responder } = self {
8801            Some((responder))
8802        } else {
8803            None
8804        }
8805    }
8806
8807    #[allow(irrefutable_let_patterns)]
8808    pub fn into_set_gain(self) -> Option<(GainState, StreamConfigControlHandle)> {
8809        if let StreamConfigRequest::SetGain { target_state, control_handle } = self {
8810            Some((target_state, control_handle))
8811        } else {
8812            None
8813        }
8814    }
8815
8816    #[allow(irrefutable_let_patterns)]
8817    pub fn into_watch_plug_state(self) -> Option<(StreamConfigWatchPlugStateResponder)> {
8818        if let StreamConfigRequest::WatchPlugState { responder } = self {
8819            Some((responder))
8820        } else {
8821            None
8822        }
8823    }
8824
8825    /// Name of the method defined in FIDL
8826    pub fn method_name(&self) -> &'static str {
8827        match *self {
8828            StreamConfigRequest::GetHealthState { .. } => "get_health_state",
8829            StreamConfigRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
8830            StreamConfigRequest::GetProperties { .. } => "get_properties",
8831            StreamConfigRequest::GetSupportedFormats { .. } => "get_supported_formats",
8832            StreamConfigRequest::CreateRingBuffer { .. } => "create_ring_buffer",
8833            StreamConfigRequest::WatchGainState { .. } => "watch_gain_state",
8834            StreamConfigRequest::SetGain { .. } => "set_gain",
8835            StreamConfigRequest::WatchPlugState { .. } => "watch_plug_state",
8836        }
8837    }
8838}
8839
8840#[derive(Debug, Clone)]
8841pub struct StreamConfigControlHandle {
8842    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8843}
8844
8845impl fidl::endpoints::ControlHandle for StreamConfigControlHandle {
8846    fn shutdown(&self) {
8847        self.inner.shutdown()
8848    }
8849    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8850        self.inner.shutdown_with_epitaph(status)
8851    }
8852
8853    fn is_closed(&self) -> bool {
8854        self.inner.channel().is_closed()
8855    }
8856    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8857        self.inner.channel().on_closed()
8858    }
8859
8860    #[cfg(target_os = "fuchsia")]
8861    fn signal_peer(
8862        &self,
8863        clear_mask: zx::Signals,
8864        set_mask: zx::Signals,
8865    ) -> Result<(), zx_status::Status> {
8866        use fidl::Peered;
8867        self.inner.channel().signal_peer(clear_mask, set_mask)
8868    }
8869}
8870
8871impl StreamConfigControlHandle {}
8872
8873#[must_use = "FIDL methods require a response to be sent"]
8874#[derive(Debug)]
8875pub struct StreamConfigGetHealthStateResponder {
8876    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
8877    tx_id: u32,
8878}
8879
8880/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
8881/// if the responder is dropped without sending a response, so that the client
8882/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8883impl std::ops::Drop for StreamConfigGetHealthStateResponder {
8884    fn drop(&mut self) {
8885        self.control_handle.shutdown();
8886        // Safety: drops once, never accessed again
8887        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8888    }
8889}
8890
8891impl fidl::endpoints::Responder for StreamConfigGetHealthStateResponder {
8892    type ControlHandle = StreamConfigControlHandle;
8893
8894    fn control_handle(&self) -> &StreamConfigControlHandle {
8895        &self.control_handle
8896    }
8897
8898    fn drop_without_shutdown(mut self) {
8899        // Safety: drops once, never accessed again due to mem::forget
8900        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8901        // Prevent Drop from running (which would shut down the channel)
8902        std::mem::forget(self);
8903    }
8904}
8905
8906impl StreamConfigGetHealthStateResponder {
8907    /// Sends a response to the FIDL transaction.
8908    ///
8909    /// Sets the channel to shutdown if an error occurs.
8910    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
8911        let _result = self.send_raw(state);
8912        if _result.is_err() {
8913            self.control_handle.shutdown();
8914        }
8915        self.drop_without_shutdown();
8916        _result
8917    }
8918
8919    /// Similar to "send" but does not shutdown the channel if an error occurs.
8920    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
8921        let _result = self.send_raw(state);
8922        self.drop_without_shutdown();
8923        _result
8924    }
8925
8926    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
8927        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
8928            (state,),
8929            self.tx_id,
8930            0x4e146d6bca733a84,
8931            fidl::encoding::DynamicFlags::empty(),
8932        )
8933    }
8934}
8935
8936#[must_use = "FIDL methods require a response to be sent"]
8937#[derive(Debug)]
8938pub struct StreamConfigGetPropertiesResponder {
8939    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
8940    tx_id: u32,
8941}
8942
8943/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
8944/// if the responder is dropped without sending a response, so that the client
8945/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8946impl std::ops::Drop for StreamConfigGetPropertiesResponder {
8947    fn drop(&mut self) {
8948        self.control_handle.shutdown();
8949        // Safety: drops once, never accessed again
8950        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8951    }
8952}
8953
8954impl fidl::endpoints::Responder for StreamConfigGetPropertiesResponder {
8955    type ControlHandle = StreamConfigControlHandle;
8956
8957    fn control_handle(&self) -> &StreamConfigControlHandle {
8958        &self.control_handle
8959    }
8960
8961    fn drop_without_shutdown(mut self) {
8962        // Safety: drops once, never accessed again due to mem::forget
8963        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8964        // Prevent Drop from running (which would shut down the channel)
8965        std::mem::forget(self);
8966    }
8967}
8968
8969impl StreamConfigGetPropertiesResponder {
8970    /// Sends a response to the FIDL transaction.
8971    ///
8972    /// Sets the channel to shutdown if an error occurs.
8973    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
8974        let _result = self.send_raw(properties);
8975        if _result.is_err() {
8976            self.control_handle.shutdown();
8977        }
8978        self.drop_without_shutdown();
8979        _result
8980    }
8981
8982    /// Similar to "send" but does not shutdown the channel if an error occurs.
8983    pub fn send_no_shutdown_on_err(
8984        self,
8985        mut properties: &StreamProperties,
8986    ) -> Result<(), fidl::Error> {
8987        let _result = self.send_raw(properties);
8988        self.drop_without_shutdown();
8989        _result
8990    }
8991
8992    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
8993        self.control_handle.inner.send::<StreamConfigGetPropertiesResponse>(
8994            (properties,),
8995            self.tx_id,
8996            0x7d89c02f3e2d3c01,
8997            fidl::encoding::DynamicFlags::empty(),
8998        )
8999    }
9000}
9001
9002#[must_use = "FIDL methods require a response to be sent"]
9003#[derive(Debug)]
9004pub struct StreamConfigGetSupportedFormatsResponder {
9005    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9006    tx_id: u32,
9007}
9008
9009/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9010/// if the responder is dropped without sending a response, so that the client
9011/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9012impl std::ops::Drop for StreamConfigGetSupportedFormatsResponder {
9013    fn drop(&mut self) {
9014        self.control_handle.shutdown();
9015        // Safety: drops once, never accessed again
9016        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9017    }
9018}
9019
9020impl fidl::endpoints::Responder for StreamConfigGetSupportedFormatsResponder {
9021    type ControlHandle = StreamConfigControlHandle;
9022
9023    fn control_handle(&self) -> &StreamConfigControlHandle {
9024        &self.control_handle
9025    }
9026
9027    fn drop_without_shutdown(mut self) {
9028        // Safety: drops once, never accessed again due to mem::forget
9029        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9030        // Prevent Drop from running (which would shut down the channel)
9031        std::mem::forget(self);
9032    }
9033}
9034
9035impl StreamConfigGetSupportedFormatsResponder {
9036    /// Sends a response to the FIDL transaction.
9037    ///
9038    /// Sets the channel to shutdown if an error occurs.
9039    pub fn send(self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
9040        let _result = self.send_raw(supported_formats);
9041        if _result.is_err() {
9042            self.control_handle.shutdown();
9043        }
9044        self.drop_without_shutdown();
9045        _result
9046    }
9047
9048    /// Similar to "send" but does not shutdown the channel if an error occurs.
9049    pub fn send_no_shutdown_on_err(
9050        self,
9051        mut supported_formats: &[SupportedFormats],
9052    ) -> Result<(), fidl::Error> {
9053        let _result = self.send_raw(supported_formats);
9054        self.drop_without_shutdown();
9055        _result
9056    }
9057
9058    fn send_raw(&self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
9059        self.control_handle.inner.send::<StreamConfigGetSupportedFormatsResponse>(
9060            (supported_formats,),
9061            self.tx_id,
9062            0x448efa7850cafe7e,
9063            fidl::encoding::DynamicFlags::empty(),
9064        )
9065    }
9066}
9067
9068#[must_use = "FIDL methods require a response to be sent"]
9069#[derive(Debug)]
9070pub struct StreamConfigWatchGainStateResponder {
9071    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9072    tx_id: u32,
9073}
9074
9075/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9076/// if the responder is dropped without sending a response, so that the client
9077/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9078impl std::ops::Drop for StreamConfigWatchGainStateResponder {
9079    fn drop(&mut self) {
9080        self.control_handle.shutdown();
9081        // Safety: drops once, never accessed again
9082        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9083    }
9084}
9085
9086impl fidl::endpoints::Responder for StreamConfigWatchGainStateResponder {
9087    type ControlHandle = StreamConfigControlHandle;
9088
9089    fn control_handle(&self) -> &StreamConfigControlHandle {
9090        &self.control_handle
9091    }
9092
9093    fn drop_without_shutdown(mut self) {
9094        // Safety: drops once, never accessed again due to mem::forget
9095        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9096        // Prevent Drop from running (which would shut down the channel)
9097        std::mem::forget(self);
9098    }
9099}
9100
9101impl StreamConfigWatchGainStateResponder {
9102    /// Sends a response to the FIDL transaction.
9103    ///
9104    /// Sets the channel to shutdown if an error occurs.
9105    pub fn send(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9106        let _result = self.send_raw(gain_state);
9107        if _result.is_err() {
9108            self.control_handle.shutdown();
9109        }
9110        self.drop_without_shutdown();
9111        _result
9112    }
9113
9114    /// Similar to "send" but does not shutdown the channel if an error occurs.
9115    pub fn send_no_shutdown_on_err(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9116        let _result = self.send_raw(gain_state);
9117        self.drop_without_shutdown();
9118        _result
9119    }
9120
9121    fn send_raw(&self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9122        self.control_handle.inner.send::<StreamConfigWatchGainStateResponse>(
9123            (gain_state,),
9124            self.tx_id,
9125            0x4772506136ab65c1,
9126            fidl::encoding::DynamicFlags::empty(),
9127        )
9128    }
9129}
9130
9131#[must_use = "FIDL methods require a response to be sent"]
9132#[derive(Debug)]
9133pub struct StreamConfigWatchPlugStateResponder {
9134    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9135    tx_id: u32,
9136}
9137
9138/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9139/// if the responder is dropped without sending a response, so that the client
9140/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9141impl std::ops::Drop for StreamConfigWatchPlugStateResponder {
9142    fn drop(&mut self) {
9143        self.control_handle.shutdown();
9144        // Safety: drops once, never accessed again
9145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9146    }
9147}
9148
9149impl fidl::endpoints::Responder for StreamConfigWatchPlugStateResponder {
9150    type ControlHandle = StreamConfigControlHandle;
9151
9152    fn control_handle(&self) -> &StreamConfigControlHandle {
9153        &self.control_handle
9154    }
9155
9156    fn drop_without_shutdown(mut self) {
9157        // Safety: drops once, never accessed again due to mem::forget
9158        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9159        // Prevent Drop from running (which would shut down the channel)
9160        std::mem::forget(self);
9161    }
9162}
9163
9164impl StreamConfigWatchPlugStateResponder {
9165    /// Sends a response to the FIDL transaction.
9166    ///
9167    /// Sets the channel to shutdown if an error occurs.
9168    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9169        let _result = self.send_raw(plug_state);
9170        if _result.is_err() {
9171            self.control_handle.shutdown();
9172        }
9173        self.drop_without_shutdown();
9174        _result
9175    }
9176
9177    /// Similar to "send" but does not shutdown the channel if an error occurs.
9178    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9179        let _result = self.send_raw(plug_state);
9180        self.drop_without_shutdown();
9181        _result
9182    }
9183
9184    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9185        self.control_handle.inner.send::<StreamConfigWatchPlugStateResponse>(
9186            (plug_state,),
9187            self.tx_id,
9188            0x497345a6f048b2a6,
9189            fidl::encoding::DynamicFlags::empty(),
9190        )
9191    }
9192}
9193
9194#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9195pub struct StreamConfigConnectorMarker;
9196
9197impl fidl::endpoints::ProtocolMarker for StreamConfigConnectorMarker {
9198    type Proxy = StreamConfigConnectorProxy;
9199    type RequestStream = StreamConfigConnectorRequestStream;
9200    #[cfg(target_os = "fuchsia")]
9201    type SynchronousProxy = StreamConfigConnectorSynchronousProxy;
9202
9203    const DEBUG_NAME: &'static str = "(anonymous) StreamConfigConnector";
9204}
9205
9206pub trait StreamConfigConnectorProxyInterface: Send + Sync {
9207    fn r#connect(
9208        &self,
9209        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9210    ) -> Result<(), fidl::Error>;
9211}
9212#[derive(Debug)]
9213#[cfg(target_os = "fuchsia")]
9214pub struct StreamConfigConnectorSynchronousProxy {
9215    client: fidl::client::sync::Client,
9216}
9217
9218#[cfg(target_os = "fuchsia")]
9219impl fidl::endpoints::SynchronousProxy for StreamConfigConnectorSynchronousProxy {
9220    type Proxy = StreamConfigConnectorProxy;
9221    type Protocol = StreamConfigConnectorMarker;
9222
9223    fn from_channel(inner: fidl::Channel) -> Self {
9224        Self::new(inner)
9225    }
9226
9227    fn into_channel(self) -> fidl::Channel {
9228        self.client.into_channel()
9229    }
9230
9231    fn as_channel(&self) -> &fidl::Channel {
9232        self.client.as_channel()
9233    }
9234}
9235
9236#[cfg(target_os = "fuchsia")]
9237impl StreamConfigConnectorSynchronousProxy {
9238    pub fn new(channel: fidl::Channel) -> Self {
9239        let protocol_name =
9240            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9241        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9242    }
9243
9244    pub fn into_channel(self) -> fidl::Channel {
9245        self.client.into_channel()
9246    }
9247
9248    /// Waits until an event arrives and returns it. It is safe for other
9249    /// threads to make concurrent requests while waiting for an event.
9250    pub fn wait_for_event(
9251        &self,
9252        deadline: zx::MonotonicInstant,
9253    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
9254        StreamConfigConnectorEvent::decode(self.client.wait_for_event(deadline)?)
9255    }
9256
9257    /// Connect to a `StreamConfig` protocol.
9258    /// This method allows a component to serve FIDL outside the devhost's control.
9259    pub fn r#connect(
9260        &self,
9261        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9262    ) -> Result<(), fidl::Error> {
9263        self.client.send::<StreamConfigConnectorConnectRequest>(
9264            (protocol,),
9265            0x22051ff3021eafec,
9266            fidl::encoding::DynamicFlags::empty(),
9267        )
9268    }
9269}
9270
9271#[cfg(target_os = "fuchsia")]
9272impl From<StreamConfigConnectorSynchronousProxy> for zx::Handle {
9273    fn from(value: StreamConfigConnectorSynchronousProxy) -> Self {
9274        value.into_channel().into()
9275    }
9276}
9277
9278#[cfg(target_os = "fuchsia")]
9279impl From<fidl::Channel> for StreamConfigConnectorSynchronousProxy {
9280    fn from(value: fidl::Channel) -> Self {
9281        Self::new(value)
9282    }
9283}
9284
9285#[cfg(target_os = "fuchsia")]
9286impl fidl::endpoints::FromClient for StreamConfigConnectorSynchronousProxy {
9287    type Protocol = StreamConfigConnectorMarker;
9288
9289    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigConnectorMarker>) -> Self {
9290        Self::new(value.into_channel())
9291    }
9292}
9293
9294#[derive(Debug, Clone)]
9295pub struct StreamConfigConnectorProxy {
9296    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9297}
9298
9299impl fidl::endpoints::Proxy for StreamConfigConnectorProxy {
9300    type Protocol = StreamConfigConnectorMarker;
9301
9302    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9303        Self::new(inner)
9304    }
9305
9306    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9307        self.client.into_channel().map_err(|client| Self { client })
9308    }
9309
9310    fn as_channel(&self) -> &::fidl::AsyncChannel {
9311        self.client.as_channel()
9312    }
9313}
9314
9315impl StreamConfigConnectorProxy {
9316    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfigConnector.
9317    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9318        let protocol_name =
9319            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9320        Self { client: fidl::client::Client::new(channel, protocol_name) }
9321    }
9322
9323    /// Get a Stream of events from the remote end of the protocol.
9324    ///
9325    /// # Panics
9326    ///
9327    /// Panics if the event stream was already taken.
9328    pub fn take_event_stream(&self) -> StreamConfigConnectorEventStream {
9329        StreamConfigConnectorEventStream { event_receiver: self.client.take_event_receiver() }
9330    }
9331
9332    /// Connect to a `StreamConfig` protocol.
9333    /// This method allows a component to serve FIDL outside the devhost's control.
9334    pub fn r#connect(
9335        &self,
9336        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9337    ) -> Result<(), fidl::Error> {
9338        StreamConfigConnectorProxyInterface::r#connect(self, protocol)
9339    }
9340}
9341
9342impl StreamConfigConnectorProxyInterface for StreamConfigConnectorProxy {
9343    fn r#connect(
9344        &self,
9345        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9346    ) -> Result<(), fidl::Error> {
9347        self.client.send::<StreamConfigConnectorConnectRequest>(
9348            (protocol,),
9349            0x22051ff3021eafec,
9350            fidl::encoding::DynamicFlags::empty(),
9351        )
9352    }
9353}
9354
9355pub struct StreamConfigConnectorEventStream {
9356    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9357}
9358
9359impl std::marker::Unpin for StreamConfigConnectorEventStream {}
9360
9361impl futures::stream::FusedStream for StreamConfigConnectorEventStream {
9362    fn is_terminated(&self) -> bool {
9363        self.event_receiver.is_terminated()
9364    }
9365}
9366
9367impl futures::Stream for StreamConfigConnectorEventStream {
9368    type Item = Result<StreamConfigConnectorEvent, fidl::Error>;
9369
9370    fn poll_next(
9371        mut self: std::pin::Pin<&mut Self>,
9372        cx: &mut std::task::Context<'_>,
9373    ) -> std::task::Poll<Option<Self::Item>> {
9374        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9375            &mut self.event_receiver,
9376            cx
9377        )?) {
9378            Some(buf) => std::task::Poll::Ready(Some(StreamConfigConnectorEvent::decode(buf))),
9379            None => std::task::Poll::Ready(None),
9380        }
9381    }
9382}
9383
9384#[derive(Debug)]
9385pub enum StreamConfigConnectorEvent {}
9386
9387impl StreamConfigConnectorEvent {
9388    /// Decodes a message buffer as a [`StreamConfigConnectorEvent`].
9389    fn decode(
9390        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9391    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
9392        let (bytes, _handles) = buf.split_mut();
9393        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9394        debug_assert_eq!(tx_header.tx_id, 0);
9395        match tx_header.ordinal {
9396            _ => Err(fidl::Error::UnknownOrdinal {
9397                ordinal: tx_header.ordinal,
9398                protocol_name:
9399                    <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9400            }),
9401        }
9402    }
9403}
9404
9405/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfigConnector.
9406pub struct StreamConfigConnectorRequestStream {
9407    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9408    is_terminated: bool,
9409}
9410
9411impl std::marker::Unpin for StreamConfigConnectorRequestStream {}
9412
9413impl futures::stream::FusedStream for StreamConfigConnectorRequestStream {
9414    fn is_terminated(&self) -> bool {
9415        self.is_terminated
9416    }
9417}
9418
9419impl fidl::endpoints::RequestStream for StreamConfigConnectorRequestStream {
9420    type Protocol = StreamConfigConnectorMarker;
9421    type ControlHandle = StreamConfigConnectorControlHandle;
9422
9423    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9424        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9425    }
9426
9427    fn control_handle(&self) -> Self::ControlHandle {
9428        StreamConfigConnectorControlHandle { inner: self.inner.clone() }
9429    }
9430
9431    fn into_inner(
9432        self,
9433    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9434    {
9435        (self.inner, self.is_terminated)
9436    }
9437
9438    fn from_inner(
9439        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9440        is_terminated: bool,
9441    ) -> Self {
9442        Self { inner, is_terminated }
9443    }
9444}
9445
9446impl futures::Stream for StreamConfigConnectorRequestStream {
9447    type Item = Result<StreamConfigConnectorRequest, fidl::Error>;
9448
9449    fn poll_next(
9450        mut self: std::pin::Pin<&mut Self>,
9451        cx: &mut std::task::Context<'_>,
9452    ) -> std::task::Poll<Option<Self::Item>> {
9453        let this = &mut *self;
9454        if this.inner.check_shutdown(cx) {
9455            this.is_terminated = true;
9456            return std::task::Poll::Ready(None);
9457        }
9458        if this.is_terminated {
9459            panic!("polled StreamConfigConnectorRequestStream after completion");
9460        }
9461        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9462            |bytes, handles| {
9463                match this.inner.channel().read_etc(cx, bytes, handles) {
9464                    std::task::Poll::Ready(Ok(())) => {}
9465                    std::task::Poll::Pending => return std::task::Poll::Pending,
9466                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9467                        this.is_terminated = true;
9468                        return std::task::Poll::Ready(None);
9469                    }
9470                    std::task::Poll::Ready(Err(e)) => {
9471                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9472                            e.into(),
9473                        ))))
9474                    }
9475                }
9476
9477                // A message has been received from the channel
9478                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9479
9480                std::task::Poll::Ready(Some(match header.ordinal {
9481                0x22051ff3021eafec => {
9482                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9483                    let mut req = fidl::new_empty!(StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9484                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
9485                    let control_handle = StreamConfigConnectorControlHandle {
9486                        inner: this.inner.clone(),
9487                    };
9488                    Ok(StreamConfigConnectorRequest::Connect {protocol: req.protocol,
9489
9490                        control_handle,
9491                    })
9492                }
9493                _ => Err(fidl::Error::UnknownOrdinal {
9494                    ordinal: header.ordinal,
9495                    protocol_name: <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9496                }),
9497            }))
9498            },
9499        )
9500    }
9501}
9502
9503/// For an overview see
9504/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming).
9505/// # Deprecation
9506///
9507/// Not supported anymore, instead use an
9508/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9509/// with one Ring Buffer, see
9510/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9511#[derive(Debug)]
9512pub enum StreamConfigConnectorRequest {
9513    /// Connect to a `StreamConfig` protocol.
9514    /// This method allows a component to serve FIDL outside the devhost's control.
9515    Connect {
9516        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9517        control_handle: StreamConfigConnectorControlHandle,
9518    },
9519}
9520
9521impl StreamConfigConnectorRequest {
9522    #[allow(irrefutable_let_patterns)]
9523    pub fn into_connect(
9524        self,
9525    ) -> Option<(fidl::endpoints::ServerEnd<StreamConfigMarker>, StreamConfigConnectorControlHandle)>
9526    {
9527        if let StreamConfigConnectorRequest::Connect { protocol, control_handle } = self {
9528            Some((protocol, control_handle))
9529        } else {
9530            None
9531        }
9532    }
9533
9534    /// Name of the method defined in FIDL
9535    pub fn method_name(&self) -> &'static str {
9536        match *self {
9537            StreamConfigConnectorRequest::Connect { .. } => "connect",
9538        }
9539    }
9540}
9541
9542#[derive(Debug, Clone)]
9543pub struct StreamConfigConnectorControlHandle {
9544    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9545}
9546
9547impl fidl::endpoints::ControlHandle for StreamConfigConnectorControlHandle {
9548    fn shutdown(&self) {
9549        self.inner.shutdown()
9550    }
9551    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9552        self.inner.shutdown_with_epitaph(status)
9553    }
9554
9555    fn is_closed(&self) -> bool {
9556        self.inner.channel().is_closed()
9557    }
9558    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9559        self.inner.channel().on_closed()
9560    }
9561
9562    #[cfg(target_os = "fuchsia")]
9563    fn signal_peer(
9564        &self,
9565        clear_mask: zx::Signals,
9566        set_mask: zx::Signals,
9567    ) -> Result<(), zx_status::Status> {
9568        use fidl::Peered;
9569        self.inner.channel().signal_peer(clear_mask, set_mask)
9570    }
9571}
9572
9573impl StreamConfigConnectorControlHandle {}
9574
9575#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9576pub struct CodecConnectorServiceMarker;
9577
9578#[cfg(target_os = "fuchsia")]
9579impl fidl::endpoints::ServiceMarker for CodecConnectorServiceMarker {
9580    type Proxy = CodecConnectorServiceProxy;
9581    type Request = CodecConnectorServiceRequest;
9582    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecConnectorService";
9583}
9584
9585/// A request for one of the member protocols of CodecConnectorService.
9586///
9587/// # Deprecation
9588///
9589/// Not supported anymore, instead use an
9590/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9591/// with one DAI and no Ring Buffer, see
9592/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9593#[cfg(target_os = "fuchsia")]
9594pub enum CodecConnectorServiceRequest {
9595    CodecConnector(CodecConnectorRequestStream),
9596}
9597
9598#[cfg(target_os = "fuchsia")]
9599impl fidl::endpoints::ServiceRequest for CodecConnectorServiceRequest {
9600    type Service = CodecConnectorServiceMarker;
9601
9602    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9603        match name {
9604            "codec_connector" => Self::CodecConnector(
9605                <CodecConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
9606                    _channel,
9607                ),
9608            ),
9609            _ => panic!("no such member protocol name for service CodecConnectorService"),
9610        }
9611    }
9612
9613    fn member_names() -> &'static [&'static str] {
9614        &["codec_connector"]
9615    }
9616}
9617/// # Deprecation
9618///
9619/// Not supported anymore, instead use an
9620/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9621/// with one DAI and no Ring Buffer, see
9622/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9623#[cfg(target_os = "fuchsia")]
9624pub struct CodecConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9625
9626#[cfg(target_os = "fuchsia")]
9627impl fidl::endpoints::ServiceProxy for CodecConnectorServiceProxy {
9628    type Service = CodecConnectorServiceMarker;
9629
9630    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9631        Self(opener)
9632    }
9633}
9634
9635#[cfg(target_os = "fuchsia")]
9636impl CodecConnectorServiceProxy {
9637    pub fn connect_to_codec_connector(&self) -> Result<CodecConnectorProxy, fidl::Error> {
9638        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecConnectorMarker>();
9639        self.connect_channel_to_codec_connector(server_end)?;
9640        Ok(proxy)
9641    }
9642
9643    /// Like `connect_to_codec_connector`, but returns a sync proxy.
9644    /// See [`Self::connect_to_codec_connector`] for more details.
9645    pub fn connect_to_codec_connector_sync(
9646        &self,
9647    ) -> Result<CodecConnectorSynchronousProxy, fidl::Error> {
9648        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecConnectorMarker>();
9649        self.connect_channel_to_codec_connector(server_end)?;
9650        Ok(proxy)
9651    }
9652
9653    /// Like `connect_to_codec_connector`, but accepts a server end.
9654    /// See [`Self::connect_to_codec_connector`] for more details.
9655    pub fn connect_channel_to_codec_connector(
9656        &self,
9657        server_end: fidl::endpoints::ServerEnd<CodecConnectorMarker>,
9658    ) -> Result<(), fidl::Error> {
9659        self.0.open_member("codec_connector", server_end.into_channel())
9660    }
9661
9662    pub fn instance_name(&self) -> &str {
9663        self.0.instance_name()
9664    }
9665}
9666
9667#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9668pub struct CodecServiceMarker;
9669
9670#[cfg(target_os = "fuchsia")]
9671impl fidl::endpoints::ServiceMarker for CodecServiceMarker {
9672    type Proxy = CodecServiceProxy;
9673    type Request = CodecServiceRequest;
9674    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecService";
9675}
9676
9677/// A request for one of the member protocols of CodecService.
9678///
9679/// # Deprecation
9680///
9681/// Not supported anymore, instead use an
9682/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9683/// with one DAI and no Ring Buffer, see
9684/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9685#[cfg(target_os = "fuchsia")]
9686pub enum CodecServiceRequest {
9687    Codec(CodecRequestStream),
9688}
9689
9690#[cfg(target_os = "fuchsia")]
9691impl fidl::endpoints::ServiceRequest for CodecServiceRequest {
9692    type Service = CodecServiceMarker;
9693
9694    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9695        match name {
9696            "codec" => Self::Codec(
9697                <CodecRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
9698            ),
9699            _ => panic!("no such member protocol name for service CodecService"),
9700        }
9701    }
9702
9703    fn member_names() -> &'static [&'static str] {
9704        &["codec"]
9705    }
9706}
9707/// # Deprecation
9708///
9709/// Not supported anymore, instead use an
9710/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9711/// with one DAI and no Ring Buffer, see
9712/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9713#[cfg(target_os = "fuchsia")]
9714pub struct CodecServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9715
9716#[cfg(target_os = "fuchsia")]
9717impl fidl::endpoints::ServiceProxy for CodecServiceProxy {
9718    type Service = CodecServiceMarker;
9719
9720    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9721        Self(opener)
9722    }
9723}
9724
9725#[cfg(target_os = "fuchsia")]
9726impl CodecServiceProxy {
9727    pub fn connect_to_codec(&self) -> Result<CodecProxy, fidl::Error> {
9728        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecMarker>();
9729        self.connect_channel_to_codec(server_end)?;
9730        Ok(proxy)
9731    }
9732
9733    /// Like `connect_to_codec`, but returns a sync proxy.
9734    /// See [`Self::connect_to_codec`] for more details.
9735    pub fn connect_to_codec_sync(&self) -> Result<CodecSynchronousProxy, fidl::Error> {
9736        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecMarker>();
9737        self.connect_channel_to_codec(server_end)?;
9738        Ok(proxy)
9739    }
9740
9741    /// Like `connect_to_codec`, but accepts a server end.
9742    /// See [`Self::connect_to_codec`] for more details.
9743    pub fn connect_channel_to_codec(
9744        &self,
9745        server_end: fidl::endpoints::ServerEnd<CodecMarker>,
9746    ) -> Result<(), fidl::Error> {
9747        self.0.open_member("codec", server_end.into_channel())
9748    }
9749
9750    pub fn instance_name(&self) -> &str {
9751        self.0.instance_name()
9752    }
9753}
9754
9755#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9756pub struct CompositeConnectorServiceMarker;
9757
9758#[cfg(target_os = "fuchsia")]
9759impl fidl::endpoints::ServiceMarker for CompositeConnectorServiceMarker {
9760    type Proxy = CompositeConnectorServiceProxy;
9761    type Request = CompositeConnectorServiceRequest;
9762    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CompositeConnectorService";
9763}
9764
9765/// A request for one of the member protocols of CompositeConnectorService.
9766///
9767#[cfg(target_os = "fuchsia")]
9768pub enum CompositeConnectorServiceRequest {
9769    CompositeConnector(CompositeConnectorRequestStream),
9770}
9771
9772#[cfg(target_os = "fuchsia")]
9773impl fidl::endpoints::ServiceRequest for CompositeConnectorServiceRequest {
9774    type Service = CompositeConnectorServiceMarker;
9775
9776    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9777        match name {
9778            "composite_connector" => Self::CompositeConnector(
9779                <CompositeConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
9780                    _channel,
9781                ),
9782            ),
9783            _ => panic!("no such member protocol name for service CompositeConnectorService"),
9784        }
9785    }
9786
9787    fn member_names() -> &'static [&'static str] {
9788        &["composite_connector"]
9789    }
9790}
9791#[cfg(target_os = "fuchsia")]
9792pub struct CompositeConnectorServiceProxy(
9793    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
9794);
9795
9796#[cfg(target_os = "fuchsia")]
9797impl fidl::endpoints::ServiceProxy for CompositeConnectorServiceProxy {
9798    type Service = CompositeConnectorServiceMarker;
9799
9800    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9801        Self(opener)
9802    }
9803}
9804
9805#[cfg(target_os = "fuchsia")]
9806impl CompositeConnectorServiceProxy {
9807    pub fn connect_to_composite_connector(&self) -> Result<CompositeConnectorProxy, fidl::Error> {
9808        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeConnectorMarker>();
9809        self.connect_channel_to_composite_connector(server_end)?;
9810        Ok(proxy)
9811    }
9812
9813    /// Like `connect_to_composite_connector`, but returns a sync proxy.
9814    /// See [`Self::connect_to_composite_connector`] for more details.
9815    pub fn connect_to_composite_connector_sync(
9816        &self,
9817    ) -> Result<CompositeConnectorSynchronousProxy, fidl::Error> {
9818        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeConnectorMarker>();
9819        self.connect_channel_to_composite_connector(server_end)?;
9820        Ok(proxy)
9821    }
9822
9823    /// Like `connect_to_composite_connector`, but accepts a server end.
9824    /// See [`Self::connect_to_composite_connector`] for more details.
9825    pub fn connect_channel_to_composite_connector(
9826        &self,
9827        server_end: fidl::endpoints::ServerEnd<CompositeConnectorMarker>,
9828    ) -> Result<(), fidl::Error> {
9829        self.0.open_member("composite_connector", server_end.into_channel())
9830    }
9831
9832    pub fn instance_name(&self) -> &str {
9833        self.0.instance_name()
9834    }
9835}
9836
9837#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9838pub struct DaiConnectorServiceMarker;
9839
9840#[cfg(target_os = "fuchsia")]
9841impl fidl::endpoints::ServiceMarker for DaiConnectorServiceMarker {
9842    type Proxy = DaiConnectorServiceProxy;
9843    type Request = DaiConnectorServiceRequest;
9844    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiConnectorService";
9845}
9846
9847/// A request for one of the member protocols of DaiConnectorService.
9848///
9849/// # Deprecation
9850///
9851/// Not supported anymore, instead use an
9852/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9853/// with one DAI and one Ring Buffer, see
9854/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9855#[cfg(target_os = "fuchsia")]
9856pub enum DaiConnectorServiceRequest {
9857    DaiConnector(DaiConnectorRequestStream),
9858}
9859
9860#[cfg(target_os = "fuchsia")]
9861impl fidl::endpoints::ServiceRequest for DaiConnectorServiceRequest {
9862    type Service = DaiConnectorServiceMarker;
9863
9864    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9865        match name {
9866            "dai_connector" => Self::DaiConnector(
9867                <DaiConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
9868                    _channel,
9869                ),
9870            ),
9871            _ => panic!("no such member protocol name for service DaiConnectorService"),
9872        }
9873    }
9874
9875    fn member_names() -> &'static [&'static str] {
9876        &["dai_connector"]
9877    }
9878}
9879/// # Deprecation
9880///
9881/// Not supported anymore, instead use an
9882/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9883/// with one DAI and one Ring Buffer, see
9884/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9885#[cfg(target_os = "fuchsia")]
9886pub struct DaiConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9887
9888#[cfg(target_os = "fuchsia")]
9889impl fidl::endpoints::ServiceProxy for DaiConnectorServiceProxy {
9890    type Service = DaiConnectorServiceMarker;
9891
9892    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9893        Self(opener)
9894    }
9895}
9896
9897#[cfg(target_os = "fuchsia")]
9898impl DaiConnectorServiceProxy {
9899    pub fn connect_to_dai_connector(&self) -> Result<DaiConnectorProxy, fidl::Error> {
9900        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiConnectorMarker>();
9901        self.connect_channel_to_dai_connector(server_end)?;
9902        Ok(proxy)
9903    }
9904
9905    /// Like `connect_to_dai_connector`, but returns a sync proxy.
9906    /// See [`Self::connect_to_dai_connector`] for more details.
9907    pub fn connect_to_dai_connector_sync(
9908        &self,
9909    ) -> Result<DaiConnectorSynchronousProxy, fidl::Error> {
9910        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiConnectorMarker>();
9911        self.connect_channel_to_dai_connector(server_end)?;
9912        Ok(proxy)
9913    }
9914
9915    /// Like `connect_to_dai_connector`, but accepts a server end.
9916    /// See [`Self::connect_to_dai_connector`] for more details.
9917    pub fn connect_channel_to_dai_connector(
9918        &self,
9919        server_end: fidl::endpoints::ServerEnd<DaiConnectorMarker>,
9920    ) -> Result<(), fidl::Error> {
9921        self.0.open_member("dai_connector", server_end.into_channel())
9922    }
9923
9924    pub fn instance_name(&self) -> &str {
9925        self.0.instance_name()
9926    }
9927}
9928
9929#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9930pub struct DaiServiceMarker;
9931
9932#[cfg(target_os = "fuchsia")]
9933impl fidl::endpoints::ServiceMarker for DaiServiceMarker {
9934    type Proxy = DaiServiceProxy;
9935    type Request = DaiServiceRequest;
9936    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiService";
9937}
9938
9939/// A request for one of the member protocols of DaiService.
9940///
9941/// # Deprecation
9942///
9943/// Not supported anymore, instead use an
9944/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9945/// with one DAI and one Ring Buffer, see
9946/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9947#[cfg(target_os = "fuchsia")]
9948pub enum DaiServiceRequest {
9949    Dai(DaiRequestStream),
9950}
9951
9952#[cfg(target_os = "fuchsia")]
9953impl fidl::endpoints::ServiceRequest for DaiServiceRequest {
9954    type Service = DaiServiceMarker;
9955
9956    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9957        match name {
9958            "dai" => Self::Dai(<DaiRequestStream as fidl::endpoints::RequestStream>::from_channel(
9959                _channel,
9960            )),
9961            _ => panic!("no such member protocol name for service DaiService"),
9962        }
9963    }
9964
9965    fn member_names() -> &'static [&'static str] {
9966        &["dai"]
9967    }
9968}
9969/// # Deprecation
9970///
9971/// Not supported anymore, instead use an
9972/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9973/// with one DAI and one Ring Buffer, see
9974/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9975#[cfg(target_os = "fuchsia")]
9976pub struct DaiServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9977
9978#[cfg(target_os = "fuchsia")]
9979impl fidl::endpoints::ServiceProxy for DaiServiceProxy {
9980    type Service = DaiServiceMarker;
9981
9982    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9983        Self(opener)
9984    }
9985}
9986
9987#[cfg(target_os = "fuchsia")]
9988impl DaiServiceProxy {
9989    pub fn connect_to_dai(&self) -> Result<DaiProxy, fidl::Error> {
9990        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiMarker>();
9991        self.connect_channel_to_dai(server_end)?;
9992        Ok(proxy)
9993    }
9994
9995    /// Like `connect_to_dai`, but returns a sync proxy.
9996    /// See [`Self::connect_to_dai`] for more details.
9997    pub fn connect_to_dai_sync(&self) -> Result<DaiSynchronousProxy, fidl::Error> {
9998        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiMarker>();
9999        self.connect_channel_to_dai(server_end)?;
10000        Ok(proxy)
10001    }
10002
10003    /// Like `connect_to_dai`, but accepts a server end.
10004    /// See [`Self::connect_to_dai`] for more details.
10005    pub fn connect_channel_to_dai(
10006        &self,
10007        server_end: fidl::endpoints::ServerEnd<DaiMarker>,
10008    ) -> Result<(), fidl::Error> {
10009        self.0.open_member("dai", server_end.into_channel())
10010    }
10011
10012    pub fn instance_name(&self) -> &str {
10013        self.0.instance_name()
10014    }
10015}
10016
10017#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10018pub struct DeviceServiceMarker;
10019
10020#[cfg(target_os = "fuchsia")]
10021impl fidl::endpoints::ServiceMarker for DeviceServiceMarker {
10022    type Proxy = DeviceServiceProxy;
10023    type Request = DeviceServiceRequest;
10024    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DeviceService";
10025}
10026
10027/// A request for one of the member protocols of DeviceService.
10028///
10029#[cfg(target_os = "fuchsia")]
10030pub enum DeviceServiceRequest {
10031    Device(CompositeRequestStream),
10032}
10033
10034#[cfg(target_os = "fuchsia")]
10035impl fidl::endpoints::ServiceRequest for DeviceServiceRequest {
10036    type Service = DeviceServiceMarker;
10037
10038    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10039        match name {
10040            "device" => Self::Device(
10041                <CompositeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10042            ),
10043            _ => panic!("no such member protocol name for service DeviceService"),
10044        }
10045    }
10046
10047    fn member_names() -> &'static [&'static str] {
10048        &["device"]
10049    }
10050}
10051#[cfg(target_os = "fuchsia")]
10052pub struct DeviceServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
10053
10054#[cfg(target_os = "fuchsia")]
10055impl fidl::endpoints::ServiceProxy for DeviceServiceProxy {
10056    type Service = DeviceServiceMarker;
10057
10058    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10059        Self(opener)
10060    }
10061}
10062
10063#[cfg(target_os = "fuchsia")]
10064impl DeviceServiceProxy {
10065    pub fn connect_to_device(&self) -> Result<CompositeProxy, fidl::Error> {
10066        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeMarker>();
10067        self.connect_channel_to_device(server_end)?;
10068        Ok(proxy)
10069    }
10070
10071    /// Like `connect_to_device`, but returns a sync proxy.
10072    /// See [`Self::connect_to_device`] for more details.
10073    pub fn connect_to_device_sync(&self) -> Result<CompositeSynchronousProxy, fidl::Error> {
10074        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeMarker>();
10075        self.connect_channel_to_device(server_end)?;
10076        Ok(proxy)
10077    }
10078
10079    /// Like `connect_to_device`, but accepts a server end.
10080    /// See [`Self::connect_to_device`] for more details.
10081    pub fn connect_channel_to_device(
10082        &self,
10083        server_end: fidl::endpoints::ServerEnd<CompositeMarker>,
10084    ) -> Result<(), fidl::Error> {
10085        self.0.open_member("device", server_end.into_channel())
10086    }
10087
10088    pub fn instance_name(&self) -> &str {
10089        self.0.instance_name()
10090    }
10091}
10092
10093#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10094pub struct StreamConfigConnectorInputServiceMarker;
10095
10096#[cfg(target_os = "fuchsia")]
10097impl fidl::endpoints::ServiceMarker for StreamConfigConnectorInputServiceMarker {
10098    type Proxy = StreamConfigConnectorInputServiceProxy;
10099    type Request = StreamConfigConnectorInputServiceRequest;
10100    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorInputService";
10101}
10102
10103/// A request for one of the member protocols of StreamConfigConnectorInputService.
10104///
10105#[cfg(target_os = "fuchsia")]
10106pub enum StreamConfigConnectorInputServiceRequest {
10107    StreamConfigConnector(StreamConfigConnectorRequestStream),
10108}
10109
10110#[cfg(target_os = "fuchsia")]
10111impl fidl::endpoints::ServiceRequest for StreamConfigConnectorInputServiceRequest {
10112    type Service = StreamConfigConnectorInputServiceMarker;
10113
10114    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10115        match name {
10116            "stream_config_connector" => Self::StreamConfigConnector(
10117                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10118            ),
10119            _ => panic!("no such member protocol name for service StreamConfigConnectorInputService"),
10120        }
10121    }
10122
10123    fn member_names() -> &'static [&'static str] {
10124        &["stream_config_connector"]
10125    }
10126}
10127#[cfg(target_os = "fuchsia")]
10128pub struct StreamConfigConnectorInputServiceProxy(
10129    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10130);
10131
10132#[cfg(target_os = "fuchsia")]
10133impl fidl::endpoints::ServiceProxy for StreamConfigConnectorInputServiceProxy {
10134    type Service = StreamConfigConnectorInputServiceMarker;
10135
10136    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10137        Self(opener)
10138    }
10139}
10140
10141#[cfg(target_os = "fuchsia")]
10142impl StreamConfigConnectorInputServiceProxy {
10143    pub fn connect_to_stream_config_connector(
10144        &self,
10145    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10146        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10147        self.connect_channel_to_stream_config_connector(server_end)?;
10148        Ok(proxy)
10149    }
10150
10151    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10152    /// See [`Self::connect_to_stream_config_connector`] for more details.
10153    pub fn connect_to_stream_config_connector_sync(
10154        &self,
10155    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10156        let (proxy, server_end) =
10157            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10158        self.connect_channel_to_stream_config_connector(server_end)?;
10159        Ok(proxy)
10160    }
10161
10162    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10163    /// See [`Self::connect_to_stream_config_connector`] for more details.
10164    pub fn connect_channel_to_stream_config_connector(
10165        &self,
10166        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10167    ) -> Result<(), fidl::Error> {
10168        self.0.open_member("stream_config_connector", server_end.into_channel())
10169    }
10170
10171    pub fn instance_name(&self) -> &str {
10172        self.0.instance_name()
10173    }
10174}
10175
10176#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10177pub struct StreamConfigConnectorOutputServiceMarker;
10178
10179#[cfg(target_os = "fuchsia")]
10180impl fidl::endpoints::ServiceMarker for StreamConfigConnectorOutputServiceMarker {
10181    type Proxy = StreamConfigConnectorOutputServiceProxy;
10182    type Request = StreamConfigConnectorOutputServiceRequest;
10183    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorOutputService";
10184}
10185
10186/// A request for one of the member protocols of StreamConfigConnectorOutputService.
10187///
10188#[cfg(target_os = "fuchsia")]
10189pub enum StreamConfigConnectorOutputServiceRequest {
10190    StreamConfigConnector(StreamConfigConnectorRequestStream),
10191}
10192
10193#[cfg(target_os = "fuchsia")]
10194impl fidl::endpoints::ServiceRequest for StreamConfigConnectorOutputServiceRequest {
10195    type Service = StreamConfigConnectorOutputServiceMarker;
10196
10197    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10198        match name {
10199            "stream_config_connector" => Self::StreamConfigConnector(
10200                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10201            ),
10202            _ => panic!("no such member protocol name for service StreamConfigConnectorOutputService"),
10203        }
10204    }
10205
10206    fn member_names() -> &'static [&'static str] {
10207        &["stream_config_connector"]
10208    }
10209}
10210#[cfg(target_os = "fuchsia")]
10211pub struct StreamConfigConnectorOutputServiceProxy(
10212    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10213);
10214
10215#[cfg(target_os = "fuchsia")]
10216impl fidl::endpoints::ServiceProxy for StreamConfigConnectorOutputServiceProxy {
10217    type Service = StreamConfigConnectorOutputServiceMarker;
10218
10219    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10220        Self(opener)
10221    }
10222}
10223
10224#[cfg(target_os = "fuchsia")]
10225impl StreamConfigConnectorOutputServiceProxy {
10226    pub fn connect_to_stream_config_connector(
10227        &self,
10228    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10229        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10230        self.connect_channel_to_stream_config_connector(server_end)?;
10231        Ok(proxy)
10232    }
10233
10234    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10235    /// See [`Self::connect_to_stream_config_connector`] for more details.
10236    pub fn connect_to_stream_config_connector_sync(
10237        &self,
10238    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10239        let (proxy, server_end) =
10240            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10241        self.connect_channel_to_stream_config_connector(server_end)?;
10242        Ok(proxy)
10243    }
10244
10245    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10246    /// See [`Self::connect_to_stream_config_connector`] for more details.
10247    pub fn connect_channel_to_stream_config_connector(
10248        &self,
10249        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10250    ) -> Result<(), fidl::Error> {
10251        self.0.open_member("stream_config_connector", server_end.into_channel())
10252    }
10253
10254    pub fn instance_name(&self) -> &str {
10255        self.0.instance_name()
10256    }
10257}
10258
10259#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10260pub struct StreamConfigConnectorServiceMarker;
10261
10262#[cfg(target_os = "fuchsia")]
10263impl fidl::endpoints::ServiceMarker for StreamConfigConnectorServiceMarker {
10264    type Proxy = StreamConfigConnectorServiceProxy;
10265    type Request = StreamConfigConnectorServiceRequest;
10266    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorService";
10267}
10268
10269/// A request for one of the member protocols of StreamConfigConnectorService.
10270///
10271/// # Deprecation
10272///
10273/// Not supported anymore, instead use an
10274/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10275/// with one Ring Buffer, see
10276/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10277#[cfg(target_os = "fuchsia")]
10278pub enum StreamConfigConnectorServiceRequest {
10279    StreamConfigConnector(StreamConfigConnectorRequestStream),
10280}
10281
10282#[cfg(target_os = "fuchsia")]
10283impl fidl::endpoints::ServiceRequest for StreamConfigConnectorServiceRequest {
10284    type Service = StreamConfigConnectorServiceMarker;
10285
10286    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10287        match name {
10288            "stream_config_connector" => Self::StreamConfigConnector(
10289                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10290            ),
10291            _ => panic!("no such member protocol name for service StreamConfigConnectorService"),
10292        }
10293    }
10294
10295    fn member_names() -> &'static [&'static str] {
10296        &["stream_config_connector"]
10297    }
10298}
10299/// # Deprecation
10300///
10301/// Not supported anymore, instead use an
10302/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10303/// with one Ring Buffer, see
10304/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10305#[cfg(target_os = "fuchsia")]
10306pub struct StreamConfigConnectorServiceProxy(
10307    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10308);
10309
10310#[cfg(target_os = "fuchsia")]
10311impl fidl::endpoints::ServiceProxy for StreamConfigConnectorServiceProxy {
10312    type Service = StreamConfigConnectorServiceMarker;
10313
10314    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10315        Self(opener)
10316    }
10317}
10318
10319#[cfg(target_os = "fuchsia")]
10320impl StreamConfigConnectorServiceProxy {
10321    pub fn connect_to_stream_config_connector(
10322        &self,
10323    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10324        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10325        self.connect_channel_to_stream_config_connector(server_end)?;
10326        Ok(proxy)
10327    }
10328
10329    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10330    /// See [`Self::connect_to_stream_config_connector`] for more details.
10331    pub fn connect_to_stream_config_connector_sync(
10332        &self,
10333    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10334        let (proxy, server_end) =
10335            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10336        self.connect_channel_to_stream_config_connector(server_end)?;
10337        Ok(proxy)
10338    }
10339
10340    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10341    /// See [`Self::connect_to_stream_config_connector`] for more details.
10342    pub fn connect_channel_to_stream_config_connector(
10343        &self,
10344        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10345    ) -> Result<(), fidl::Error> {
10346        self.0.open_member("stream_config_connector", server_end.into_channel())
10347    }
10348
10349    pub fn instance_name(&self) -> &str {
10350        self.0.instance_name()
10351    }
10352}
10353
10354#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10355pub struct StreamConfigServiceMarker;
10356
10357#[cfg(target_os = "fuchsia")]
10358impl fidl::endpoints::ServiceMarker for StreamConfigServiceMarker {
10359    type Proxy = StreamConfigServiceProxy;
10360    type Request = StreamConfigServiceRequest;
10361    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigService";
10362}
10363
10364/// A request for one of the member protocols of StreamConfigService.
10365///
10366/// # Deprecation
10367///
10368/// Not supported anymore, instead use an
10369/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10370/// with one Ring Buffer, see
10371/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10372#[cfg(target_os = "fuchsia")]
10373pub enum StreamConfigServiceRequest {
10374    StreamConfig(StreamConfigRequestStream),
10375}
10376
10377#[cfg(target_os = "fuchsia")]
10378impl fidl::endpoints::ServiceRequest for StreamConfigServiceRequest {
10379    type Service = StreamConfigServiceMarker;
10380
10381    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10382        match name {
10383            "stream_config" => Self::StreamConfig(
10384                <StreamConfigRequestStream as fidl::endpoints::RequestStream>::from_channel(
10385                    _channel,
10386                ),
10387            ),
10388            _ => panic!("no such member protocol name for service StreamConfigService"),
10389        }
10390    }
10391
10392    fn member_names() -> &'static [&'static str] {
10393        &["stream_config"]
10394    }
10395}
10396/// # Deprecation
10397///
10398/// Not supported anymore, instead use an
10399/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10400/// with one Ring Buffer, see
10401/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10402#[cfg(target_os = "fuchsia")]
10403pub struct StreamConfigServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
10404
10405#[cfg(target_os = "fuchsia")]
10406impl fidl::endpoints::ServiceProxy for StreamConfigServiceProxy {
10407    type Service = StreamConfigServiceMarker;
10408
10409    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10410        Self(opener)
10411    }
10412}
10413
10414#[cfg(target_os = "fuchsia")]
10415impl StreamConfigServiceProxy {
10416    pub fn connect_to_stream_config(&self) -> Result<StreamConfigProxy, fidl::Error> {
10417        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigMarker>();
10418        self.connect_channel_to_stream_config(server_end)?;
10419        Ok(proxy)
10420    }
10421
10422    /// Like `connect_to_stream_config`, but returns a sync proxy.
10423    /// See [`Self::connect_to_stream_config`] for more details.
10424    pub fn connect_to_stream_config_sync(
10425        &self,
10426    ) -> Result<StreamConfigSynchronousProxy, fidl::Error> {
10427        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<StreamConfigMarker>();
10428        self.connect_channel_to_stream_config(server_end)?;
10429        Ok(proxy)
10430    }
10431
10432    /// Like `connect_to_stream_config`, but accepts a server end.
10433    /// See [`Self::connect_to_stream_config`] for more details.
10434    pub fn connect_channel_to_stream_config(
10435        &self,
10436        server_end: fidl::endpoints::ServerEnd<StreamConfigMarker>,
10437    ) -> Result<(), fidl::Error> {
10438        self.0.open_member("stream_config", server_end.into_channel())
10439    }
10440
10441    pub fn instance_name(&self) -> &str {
10442        self.0.instance_name()
10443    }
10444}
10445
10446mod internal {
10447    use super::*;
10448
10449    impl fidl::encoding::ResourceTypeMarker for CodecConnectorConnectRequest {
10450        type Borrowed<'a> = &'a mut Self;
10451        fn take_or_borrow<'a>(
10452            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10453        ) -> Self::Borrowed<'a> {
10454            value
10455        }
10456    }
10457
10458    unsafe impl fidl::encoding::TypeMarker for CodecConnectorConnectRequest {
10459        type Owned = Self;
10460
10461        #[inline(always)]
10462        fn inline_align(_context: fidl::encoding::Context) -> usize {
10463            4
10464        }
10465
10466        #[inline(always)]
10467        fn inline_size(_context: fidl::encoding::Context) -> usize {
10468            4
10469        }
10470    }
10471
10472    unsafe impl
10473        fidl::encoding::Encode<
10474            CodecConnectorConnectRequest,
10475            fidl::encoding::DefaultFuchsiaResourceDialect,
10476        > for &mut CodecConnectorConnectRequest
10477    {
10478        #[inline]
10479        unsafe fn encode(
10480            self,
10481            encoder: &mut fidl::encoding::Encoder<
10482                '_,
10483                fidl::encoding::DefaultFuchsiaResourceDialect,
10484            >,
10485            offset: usize,
10486            _depth: fidl::encoding::Depth,
10487        ) -> fidl::Result<()> {
10488            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10489            // Delegate to tuple encoding.
10490            fidl::encoding::Encode::<CodecConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10491                (
10492                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.codec_protocol),
10493                ),
10494                encoder, offset, _depth
10495            )
10496        }
10497    }
10498    unsafe impl<
10499            T0: fidl::encoding::Encode<
10500                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10501                fidl::encoding::DefaultFuchsiaResourceDialect,
10502            >,
10503        >
10504        fidl::encoding::Encode<
10505            CodecConnectorConnectRequest,
10506            fidl::encoding::DefaultFuchsiaResourceDialect,
10507        > for (T0,)
10508    {
10509        #[inline]
10510        unsafe fn encode(
10511            self,
10512            encoder: &mut fidl::encoding::Encoder<
10513                '_,
10514                fidl::encoding::DefaultFuchsiaResourceDialect,
10515            >,
10516            offset: usize,
10517            depth: fidl::encoding::Depth,
10518        ) -> fidl::Result<()> {
10519            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10520            // Zero out padding regions. There's no need to apply masks
10521            // because the unmasked parts will be overwritten by fields.
10522            // Write the fields.
10523            self.0.encode(encoder, offset + 0, depth)?;
10524            Ok(())
10525        }
10526    }
10527
10528    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10529        for CodecConnectorConnectRequest
10530    {
10531        #[inline(always)]
10532        fn new_empty() -> Self {
10533            Self {
10534                codec_protocol: fidl::new_empty!(
10535                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10536                    fidl::encoding::DefaultFuchsiaResourceDialect
10537                ),
10538            }
10539        }
10540
10541        #[inline]
10542        unsafe fn decode(
10543            &mut self,
10544            decoder: &mut fidl::encoding::Decoder<
10545                '_,
10546                fidl::encoding::DefaultFuchsiaResourceDialect,
10547            >,
10548            offset: usize,
10549            _depth: fidl::encoding::Depth,
10550        ) -> fidl::Result<()> {
10551            decoder.debug_check_bounds::<Self>(offset);
10552            // Verify that padding bytes are zero.
10553            fidl::decode!(
10554                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10555                fidl::encoding::DefaultFuchsiaResourceDialect,
10556                &mut self.codec_protocol,
10557                decoder,
10558                offset + 0,
10559                _depth
10560            )?;
10561            Ok(())
10562        }
10563    }
10564
10565    impl fidl::encoding::ResourceTypeMarker for CompositeConnectorConnectRequest {
10566        type Borrowed<'a> = &'a mut Self;
10567        fn take_or_borrow<'a>(
10568            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10569        ) -> Self::Borrowed<'a> {
10570            value
10571        }
10572    }
10573
10574    unsafe impl fidl::encoding::TypeMarker for CompositeConnectorConnectRequest {
10575        type Owned = Self;
10576
10577        #[inline(always)]
10578        fn inline_align(_context: fidl::encoding::Context) -> usize {
10579            4
10580        }
10581
10582        #[inline(always)]
10583        fn inline_size(_context: fidl::encoding::Context) -> usize {
10584            4
10585        }
10586    }
10587
10588    unsafe impl
10589        fidl::encoding::Encode<
10590            CompositeConnectorConnectRequest,
10591            fidl::encoding::DefaultFuchsiaResourceDialect,
10592        > for &mut CompositeConnectorConnectRequest
10593    {
10594        #[inline]
10595        unsafe fn encode(
10596            self,
10597            encoder: &mut fidl::encoding::Encoder<
10598                '_,
10599                fidl::encoding::DefaultFuchsiaResourceDialect,
10600            >,
10601            offset: usize,
10602            _depth: fidl::encoding::Depth,
10603        ) -> fidl::Result<()> {
10604            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
10605            // Delegate to tuple encoding.
10606            fidl::encoding::Encode::<CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10607                (
10608                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.composite_protocol),
10609                ),
10610                encoder, offset, _depth
10611            )
10612        }
10613    }
10614    unsafe impl<
10615            T0: fidl::encoding::Encode<
10616                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10617                fidl::encoding::DefaultFuchsiaResourceDialect,
10618            >,
10619        >
10620        fidl::encoding::Encode<
10621            CompositeConnectorConnectRequest,
10622            fidl::encoding::DefaultFuchsiaResourceDialect,
10623        > for (T0,)
10624    {
10625        #[inline]
10626        unsafe fn encode(
10627            self,
10628            encoder: &mut fidl::encoding::Encoder<
10629                '_,
10630                fidl::encoding::DefaultFuchsiaResourceDialect,
10631            >,
10632            offset: usize,
10633            depth: fidl::encoding::Depth,
10634        ) -> fidl::Result<()> {
10635            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
10636            // Zero out padding regions. There's no need to apply masks
10637            // because the unmasked parts will be overwritten by fields.
10638            // Write the fields.
10639            self.0.encode(encoder, offset + 0, depth)?;
10640            Ok(())
10641        }
10642    }
10643
10644    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10645        for CompositeConnectorConnectRequest
10646    {
10647        #[inline(always)]
10648        fn new_empty() -> Self {
10649            Self {
10650                composite_protocol: fidl::new_empty!(
10651                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10652                    fidl::encoding::DefaultFuchsiaResourceDialect
10653                ),
10654            }
10655        }
10656
10657        #[inline]
10658        unsafe fn decode(
10659            &mut self,
10660            decoder: &mut fidl::encoding::Decoder<
10661                '_,
10662                fidl::encoding::DefaultFuchsiaResourceDialect,
10663            >,
10664            offset: usize,
10665            _depth: fidl::encoding::Depth,
10666        ) -> fidl::Result<()> {
10667            decoder.debug_check_bounds::<Self>(offset);
10668            // Verify that padding bytes are zero.
10669            fidl::decode!(
10670                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10671                fidl::encoding::DefaultFuchsiaResourceDialect,
10672                &mut self.composite_protocol,
10673                decoder,
10674                offset + 0,
10675                _depth
10676            )?;
10677            Ok(())
10678        }
10679    }
10680
10681    impl fidl::encoding::ResourceTypeMarker for CompositeCreateRingBufferRequest {
10682        type Borrowed<'a> = &'a mut Self;
10683        fn take_or_borrow<'a>(
10684            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10685        ) -> Self::Borrowed<'a> {
10686            value
10687        }
10688    }
10689
10690    unsafe impl fidl::encoding::TypeMarker for CompositeCreateRingBufferRequest {
10691        type Owned = Self;
10692
10693        #[inline(always)]
10694        fn inline_align(_context: fidl::encoding::Context) -> usize {
10695            8
10696        }
10697
10698        #[inline(always)]
10699        fn inline_size(_context: fidl::encoding::Context) -> usize {
10700            32
10701        }
10702    }
10703
10704    unsafe impl
10705        fidl::encoding::Encode<
10706            CompositeCreateRingBufferRequest,
10707            fidl::encoding::DefaultFuchsiaResourceDialect,
10708        > for &mut CompositeCreateRingBufferRequest
10709    {
10710        #[inline]
10711        unsafe fn encode(
10712            self,
10713            encoder: &mut fidl::encoding::Encoder<
10714                '_,
10715                fidl::encoding::DefaultFuchsiaResourceDialect,
10716            >,
10717            offset: usize,
10718            _depth: fidl::encoding::Depth,
10719        ) -> fidl::Result<()> {
10720            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
10721            // Delegate to tuple encoding.
10722            fidl::encoding::Encode::<CompositeCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10723                (
10724                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
10725                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
10726                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
10727                ),
10728                encoder, offset, _depth
10729            )
10730        }
10731    }
10732    unsafe impl<
10733            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
10734            T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
10735            T2: fidl::encoding::Encode<
10736                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
10737                fidl::encoding::DefaultFuchsiaResourceDialect,
10738            >,
10739        >
10740        fidl::encoding::Encode<
10741            CompositeCreateRingBufferRequest,
10742            fidl::encoding::DefaultFuchsiaResourceDialect,
10743        > for (T0, T1, T2)
10744    {
10745        #[inline]
10746        unsafe fn encode(
10747            self,
10748            encoder: &mut fidl::encoding::Encoder<
10749                '_,
10750                fidl::encoding::DefaultFuchsiaResourceDialect,
10751            >,
10752            offset: usize,
10753            depth: fidl::encoding::Depth,
10754        ) -> fidl::Result<()> {
10755            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
10756            // Zero out padding regions. There's no need to apply masks
10757            // because the unmasked parts will be overwritten by fields.
10758            unsafe {
10759                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
10760                (ptr as *mut u64).write_unaligned(0);
10761            }
10762            // Write the fields.
10763            self.0.encode(encoder, offset + 0, depth)?;
10764            self.1.encode(encoder, offset + 8, depth)?;
10765            self.2.encode(encoder, offset + 24, depth)?;
10766            Ok(())
10767        }
10768    }
10769
10770    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10771        for CompositeCreateRingBufferRequest
10772    {
10773        #[inline(always)]
10774        fn new_empty() -> Self {
10775            Self {
10776                processing_element_id: fidl::new_empty!(
10777                    u64,
10778                    fidl::encoding::DefaultFuchsiaResourceDialect
10779                ),
10780                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
10781                ring_buffer: fidl::new_empty!(
10782                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
10783                    fidl::encoding::DefaultFuchsiaResourceDialect
10784                ),
10785            }
10786        }
10787
10788        #[inline]
10789        unsafe fn decode(
10790            &mut self,
10791            decoder: &mut fidl::encoding::Decoder<
10792                '_,
10793                fidl::encoding::DefaultFuchsiaResourceDialect,
10794            >,
10795            offset: usize,
10796            _depth: fidl::encoding::Depth,
10797        ) -> fidl::Result<()> {
10798            decoder.debug_check_bounds::<Self>(offset);
10799            // Verify that padding bytes are zero.
10800            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
10801            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10802            let mask = 0xffffffff00000000u64;
10803            let maskedval = padval & mask;
10804            if maskedval != 0 {
10805                return Err(fidl::Error::NonZeroPadding {
10806                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
10807                });
10808            }
10809            fidl::decode!(
10810                u64,
10811                fidl::encoding::DefaultFuchsiaResourceDialect,
10812                &mut self.processing_element_id,
10813                decoder,
10814                offset + 0,
10815                _depth
10816            )?;
10817            fidl::decode!(
10818                Format,
10819                fidl::encoding::DefaultFuchsiaResourceDialect,
10820                &mut self.format,
10821                decoder,
10822                offset + 8,
10823                _depth
10824            )?;
10825            fidl::decode!(
10826                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
10827                fidl::encoding::DefaultFuchsiaResourceDialect,
10828                &mut self.ring_buffer,
10829                decoder,
10830                offset + 24,
10831                _depth
10832            )?;
10833            Ok(())
10834        }
10835    }
10836
10837    impl fidl::encoding::ResourceTypeMarker for DaiConnectorConnectRequest {
10838        type Borrowed<'a> = &'a mut Self;
10839        fn take_or_borrow<'a>(
10840            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10841        ) -> Self::Borrowed<'a> {
10842            value
10843        }
10844    }
10845
10846    unsafe impl fidl::encoding::TypeMarker for DaiConnectorConnectRequest {
10847        type Owned = Self;
10848
10849        #[inline(always)]
10850        fn inline_align(_context: fidl::encoding::Context) -> usize {
10851            4
10852        }
10853
10854        #[inline(always)]
10855        fn inline_size(_context: fidl::encoding::Context) -> usize {
10856            4
10857        }
10858    }
10859
10860    unsafe impl
10861        fidl::encoding::Encode<
10862            DaiConnectorConnectRequest,
10863            fidl::encoding::DefaultFuchsiaResourceDialect,
10864        > for &mut DaiConnectorConnectRequest
10865    {
10866        #[inline]
10867        unsafe fn encode(
10868            self,
10869            encoder: &mut fidl::encoding::Encoder<
10870                '_,
10871                fidl::encoding::DefaultFuchsiaResourceDialect,
10872            >,
10873            offset: usize,
10874            _depth: fidl::encoding::Depth,
10875        ) -> fidl::Result<()> {
10876            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
10877            // Delegate to tuple encoding.
10878            fidl::encoding::Encode::<DaiConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10879                (
10880                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dai_protocol),
10881                ),
10882                encoder, offset, _depth
10883            )
10884        }
10885    }
10886    unsafe impl<
10887            T0: fidl::encoding::Encode<
10888                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
10889                fidl::encoding::DefaultFuchsiaResourceDialect,
10890            >,
10891        >
10892        fidl::encoding::Encode<
10893            DaiConnectorConnectRequest,
10894            fidl::encoding::DefaultFuchsiaResourceDialect,
10895        > for (T0,)
10896    {
10897        #[inline]
10898        unsafe fn encode(
10899            self,
10900            encoder: &mut fidl::encoding::Encoder<
10901                '_,
10902                fidl::encoding::DefaultFuchsiaResourceDialect,
10903            >,
10904            offset: usize,
10905            depth: fidl::encoding::Depth,
10906        ) -> fidl::Result<()> {
10907            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
10908            // Zero out padding regions. There's no need to apply masks
10909            // because the unmasked parts will be overwritten by fields.
10910            // Write the fields.
10911            self.0.encode(encoder, offset + 0, depth)?;
10912            Ok(())
10913        }
10914    }
10915
10916    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10917        for DaiConnectorConnectRequest
10918    {
10919        #[inline(always)]
10920        fn new_empty() -> Self {
10921            Self {
10922                dai_protocol: fidl::new_empty!(
10923                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
10924                    fidl::encoding::DefaultFuchsiaResourceDialect
10925                ),
10926            }
10927        }
10928
10929        #[inline]
10930        unsafe fn decode(
10931            &mut self,
10932            decoder: &mut fidl::encoding::Decoder<
10933                '_,
10934                fidl::encoding::DefaultFuchsiaResourceDialect,
10935            >,
10936            offset: usize,
10937            _depth: fidl::encoding::Depth,
10938        ) -> fidl::Result<()> {
10939            decoder.debug_check_bounds::<Self>(offset);
10940            // Verify that padding bytes are zero.
10941            fidl::decode!(
10942                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
10943                fidl::encoding::DefaultFuchsiaResourceDialect,
10944                &mut self.dai_protocol,
10945                decoder,
10946                offset + 0,
10947                _depth
10948            )?;
10949            Ok(())
10950        }
10951    }
10952
10953    impl fidl::encoding::ResourceTypeMarker for DaiCreateRingBufferRequest {
10954        type Borrowed<'a> = &'a mut Self;
10955        fn take_or_borrow<'a>(
10956            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10957        ) -> Self::Borrowed<'a> {
10958            value
10959        }
10960    }
10961
10962    unsafe impl fidl::encoding::TypeMarker for DaiCreateRingBufferRequest {
10963        type Owned = Self;
10964
10965        #[inline(always)]
10966        fn inline_align(_context: fidl::encoding::Context) -> usize {
10967            8
10968        }
10969
10970        #[inline(always)]
10971        fn inline_size(_context: fidl::encoding::Context) -> usize {
10972            72
10973        }
10974    }
10975
10976    unsafe impl
10977        fidl::encoding::Encode<
10978            DaiCreateRingBufferRequest,
10979            fidl::encoding::DefaultFuchsiaResourceDialect,
10980        > for &mut DaiCreateRingBufferRequest
10981    {
10982        #[inline]
10983        unsafe fn encode(
10984            self,
10985            encoder: &mut fidl::encoding::Encoder<
10986                '_,
10987                fidl::encoding::DefaultFuchsiaResourceDialect,
10988            >,
10989            offset: usize,
10990            _depth: fidl::encoding::Depth,
10991        ) -> fidl::Result<()> {
10992            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
10993            // Delegate to tuple encoding.
10994            fidl::encoding::Encode::<DaiCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10995                (
10996                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_format),
10997                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_format),
10998                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
10999                ),
11000                encoder, offset, _depth
11001            )
11002        }
11003    }
11004    unsafe impl<
11005            T0: fidl::encoding::Encode<DaiFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
11006            T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
11007            T2: fidl::encoding::Encode<
11008                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11009                fidl::encoding::DefaultFuchsiaResourceDialect,
11010            >,
11011        >
11012        fidl::encoding::Encode<
11013            DaiCreateRingBufferRequest,
11014            fidl::encoding::DefaultFuchsiaResourceDialect,
11015        > for (T0, T1, T2)
11016    {
11017        #[inline]
11018        unsafe fn encode(
11019            self,
11020            encoder: &mut fidl::encoding::Encoder<
11021                '_,
11022                fidl::encoding::DefaultFuchsiaResourceDialect,
11023            >,
11024            offset: usize,
11025            depth: fidl::encoding::Depth,
11026        ) -> fidl::Result<()> {
11027            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11028            // Zero out padding regions. There's no need to apply masks
11029            // because the unmasked parts will be overwritten by fields.
11030            unsafe {
11031                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
11032                (ptr as *mut u64).write_unaligned(0);
11033            }
11034            // Write the fields.
11035            self.0.encode(encoder, offset + 0, depth)?;
11036            self.1.encode(encoder, offset + 48, depth)?;
11037            self.2.encode(encoder, offset + 64, depth)?;
11038            Ok(())
11039        }
11040    }
11041
11042    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11043        for DaiCreateRingBufferRequest
11044    {
11045        #[inline(always)]
11046        fn new_empty() -> Self {
11047            Self {
11048                dai_format: fidl::new_empty!(
11049                    DaiFormat,
11050                    fidl::encoding::DefaultFuchsiaResourceDialect
11051                ),
11052                ring_buffer_format: fidl::new_empty!(
11053                    Format,
11054                    fidl::encoding::DefaultFuchsiaResourceDialect
11055                ),
11056                ring_buffer: fidl::new_empty!(
11057                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11058                    fidl::encoding::DefaultFuchsiaResourceDialect
11059                ),
11060            }
11061        }
11062
11063        #[inline]
11064        unsafe fn decode(
11065            &mut self,
11066            decoder: &mut fidl::encoding::Decoder<
11067                '_,
11068                fidl::encoding::DefaultFuchsiaResourceDialect,
11069            >,
11070            offset: usize,
11071            _depth: fidl::encoding::Depth,
11072        ) -> fidl::Result<()> {
11073            decoder.debug_check_bounds::<Self>(offset);
11074            // Verify that padding bytes are zero.
11075            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
11076            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11077            let mask = 0xffffffff00000000u64;
11078            let maskedval = padval & mask;
11079            if maskedval != 0 {
11080                return Err(fidl::Error::NonZeroPadding {
11081                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
11082                });
11083            }
11084            fidl::decode!(
11085                DaiFormat,
11086                fidl::encoding::DefaultFuchsiaResourceDialect,
11087                &mut self.dai_format,
11088                decoder,
11089                offset + 0,
11090                _depth
11091            )?;
11092            fidl::decode!(
11093                Format,
11094                fidl::encoding::DefaultFuchsiaResourceDialect,
11095                &mut self.ring_buffer_format,
11096                decoder,
11097                offset + 48,
11098                _depth
11099            )?;
11100            fidl::decode!(
11101                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11102                fidl::encoding::DefaultFuchsiaResourceDialect,
11103                &mut self.ring_buffer,
11104                decoder,
11105                offset + 64,
11106                _depth
11107            )?;
11108            Ok(())
11109        }
11110    }
11111
11112    impl fidl::encoding::ResourceTypeMarker for RingBufferGetVmoResponse {
11113        type Borrowed<'a> = &'a mut Self;
11114        fn take_or_borrow<'a>(
11115            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11116        ) -> Self::Borrowed<'a> {
11117            value
11118        }
11119    }
11120
11121    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoResponse {
11122        type Owned = Self;
11123
11124        #[inline(always)]
11125        fn inline_align(_context: fidl::encoding::Context) -> usize {
11126            4
11127        }
11128
11129        #[inline(always)]
11130        fn inline_size(_context: fidl::encoding::Context) -> usize {
11131            8
11132        }
11133    }
11134
11135    unsafe impl
11136        fidl::encoding::Encode<
11137            RingBufferGetVmoResponse,
11138            fidl::encoding::DefaultFuchsiaResourceDialect,
11139        > for &mut RingBufferGetVmoResponse
11140    {
11141        #[inline]
11142        unsafe fn encode(
11143            self,
11144            encoder: &mut fidl::encoding::Encoder<
11145                '_,
11146                fidl::encoding::DefaultFuchsiaResourceDialect,
11147            >,
11148            offset: usize,
11149            _depth: fidl::encoding::Depth,
11150        ) -> fidl::Result<()> {
11151            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11152            // Delegate to tuple encoding.
11153            fidl::encoding::Encode::<
11154                RingBufferGetVmoResponse,
11155                fidl::encoding::DefaultFuchsiaResourceDialect,
11156            >::encode(
11157                (
11158                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_frames),
11159                    <fidl::encoding::HandleType<
11160                        fidl::Vmo,
11161                        { fidl::ObjectType::VMO.into_raw() },
11162                        2147483648,
11163                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11164                        &mut self.ring_buffer
11165                    ),
11166                ),
11167                encoder,
11168                offset,
11169                _depth,
11170            )
11171        }
11172    }
11173    unsafe impl<
11174            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11175            T1: fidl::encoding::Encode<
11176                fidl::encoding::HandleType<
11177                    fidl::Vmo,
11178                    { fidl::ObjectType::VMO.into_raw() },
11179                    2147483648,
11180                >,
11181                fidl::encoding::DefaultFuchsiaResourceDialect,
11182            >,
11183        >
11184        fidl::encoding::Encode<
11185            RingBufferGetVmoResponse,
11186            fidl::encoding::DefaultFuchsiaResourceDialect,
11187        > for (T0, T1)
11188    {
11189        #[inline]
11190        unsafe fn encode(
11191            self,
11192            encoder: &mut fidl::encoding::Encoder<
11193                '_,
11194                fidl::encoding::DefaultFuchsiaResourceDialect,
11195            >,
11196            offset: usize,
11197            depth: fidl::encoding::Depth,
11198        ) -> fidl::Result<()> {
11199            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11200            // Zero out padding regions. There's no need to apply masks
11201            // because the unmasked parts will be overwritten by fields.
11202            // Write the fields.
11203            self.0.encode(encoder, offset + 0, depth)?;
11204            self.1.encode(encoder, offset + 4, depth)?;
11205            Ok(())
11206        }
11207    }
11208
11209    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11210        for RingBufferGetVmoResponse
11211    {
11212        #[inline(always)]
11213        fn new_empty() -> Self {
11214            Self {
11215                num_frames: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11216                ring_buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11217            }
11218        }
11219
11220        #[inline]
11221        unsafe fn decode(
11222            &mut self,
11223            decoder: &mut fidl::encoding::Decoder<
11224                '_,
11225                fidl::encoding::DefaultFuchsiaResourceDialect,
11226            >,
11227            offset: usize,
11228            _depth: fidl::encoding::Depth,
11229        ) -> fidl::Result<()> {
11230            decoder.debug_check_bounds::<Self>(offset);
11231            // Verify that padding bytes are zero.
11232            fidl::decode!(
11233                u32,
11234                fidl::encoding::DefaultFuchsiaResourceDialect,
11235                &mut self.num_frames,
11236                decoder,
11237                offset + 0,
11238                _depth
11239            )?;
11240            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.ring_buffer, decoder, offset + 4, _depth)?;
11241            Ok(())
11242        }
11243    }
11244
11245    impl fidl::encoding::ResourceTypeMarker for StreamConfigConnectorConnectRequest {
11246        type Borrowed<'a> = &'a mut Self;
11247        fn take_or_borrow<'a>(
11248            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11249        ) -> Self::Borrowed<'a> {
11250            value
11251        }
11252    }
11253
11254    unsafe impl fidl::encoding::TypeMarker for StreamConfigConnectorConnectRequest {
11255        type Owned = Self;
11256
11257        #[inline(always)]
11258        fn inline_align(_context: fidl::encoding::Context) -> usize {
11259            4
11260        }
11261
11262        #[inline(always)]
11263        fn inline_size(_context: fidl::encoding::Context) -> usize {
11264            4
11265        }
11266    }
11267
11268    unsafe impl
11269        fidl::encoding::Encode<
11270            StreamConfigConnectorConnectRequest,
11271            fidl::encoding::DefaultFuchsiaResourceDialect,
11272        > for &mut StreamConfigConnectorConnectRequest
11273    {
11274        #[inline]
11275        unsafe fn encode(
11276            self,
11277            encoder: &mut fidl::encoding::Encoder<
11278                '_,
11279                fidl::encoding::DefaultFuchsiaResourceDialect,
11280            >,
11281            offset: usize,
11282            _depth: fidl::encoding::Depth,
11283        ) -> fidl::Result<()> {
11284            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11285            // Delegate to tuple encoding.
11286            fidl::encoding::Encode::<StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11287                (
11288                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
11289                ),
11290                encoder, offset, _depth
11291            )
11292        }
11293    }
11294    unsafe impl<
11295            T0: fidl::encoding::Encode<
11296                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11297                fidl::encoding::DefaultFuchsiaResourceDialect,
11298            >,
11299        >
11300        fidl::encoding::Encode<
11301            StreamConfigConnectorConnectRequest,
11302            fidl::encoding::DefaultFuchsiaResourceDialect,
11303        > for (T0,)
11304    {
11305        #[inline]
11306        unsafe fn encode(
11307            self,
11308            encoder: &mut fidl::encoding::Encoder<
11309                '_,
11310                fidl::encoding::DefaultFuchsiaResourceDialect,
11311            >,
11312            offset: usize,
11313            depth: fidl::encoding::Depth,
11314        ) -> fidl::Result<()> {
11315            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11316            // Zero out padding regions. There's no need to apply masks
11317            // because the unmasked parts will be overwritten by fields.
11318            // Write the fields.
11319            self.0.encode(encoder, offset + 0, depth)?;
11320            Ok(())
11321        }
11322    }
11323
11324    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11325        for StreamConfigConnectorConnectRequest
11326    {
11327        #[inline(always)]
11328        fn new_empty() -> Self {
11329            Self {
11330                protocol: fidl::new_empty!(
11331                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11332                    fidl::encoding::DefaultFuchsiaResourceDialect
11333                ),
11334            }
11335        }
11336
11337        #[inline]
11338        unsafe fn decode(
11339            &mut self,
11340            decoder: &mut fidl::encoding::Decoder<
11341                '_,
11342                fidl::encoding::DefaultFuchsiaResourceDialect,
11343            >,
11344            offset: usize,
11345            _depth: fidl::encoding::Depth,
11346        ) -> fidl::Result<()> {
11347            decoder.debug_check_bounds::<Self>(offset);
11348            // Verify that padding bytes are zero.
11349            fidl::decode!(
11350                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11351                fidl::encoding::DefaultFuchsiaResourceDialect,
11352                &mut self.protocol,
11353                decoder,
11354                offset + 0,
11355                _depth
11356            )?;
11357            Ok(())
11358        }
11359    }
11360
11361    impl fidl::encoding::ResourceTypeMarker for StreamConfigCreateRingBufferRequest {
11362        type Borrowed<'a> = &'a mut Self;
11363        fn take_or_borrow<'a>(
11364            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11365        ) -> Self::Borrowed<'a> {
11366            value
11367        }
11368    }
11369
11370    unsafe impl fidl::encoding::TypeMarker for StreamConfigCreateRingBufferRequest {
11371        type Owned = Self;
11372
11373        #[inline(always)]
11374        fn inline_align(_context: fidl::encoding::Context) -> usize {
11375            8
11376        }
11377
11378        #[inline(always)]
11379        fn inline_size(_context: fidl::encoding::Context) -> usize {
11380            24
11381        }
11382    }
11383
11384    unsafe impl
11385        fidl::encoding::Encode<
11386            StreamConfigCreateRingBufferRequest,
11387            fidl::encoding::DefaultFuchsiaResourceDialect,
11388        > for &mut StreamConfigCreateRingBufferRequest
11389    {
11390        #[inline]
11391        unsafe fn encode(
11392            self,
11393            encoder: &mut fidl::encoding::Encoder<
11394                '_,
11395                fidl::encoding::DefaultFuchsiaResourceDialect,
11396            >,
11397            offset: usize,
11398            _depth: fidl::encoding::Depth,
11399        ) -> fidl::Result<()> {
11400            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
11401            // Delegate to tuple encoding.
11402            fidl::encoding::Encode::<StreamConfigCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11403                (
11404                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
11405                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11406                ),
11407                encoder, offset, _depth
11408            )
11409        }
11410    }
11411    unsafe impl<
11412            T0: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
11413            T1: fidl::encoding::Encode<
11414                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11415                fidl::encoding::DefaultFuchsiaResourceDialect,
11416            >,
11417        >
11418        fidl::encoding::Encode<
11419            StreamConfigCreateRingBufferRequest,
11420            fidl::encoding::DefaultFuchsiaResourceDialect,
11421        > for (T0, T1)
11422    {
11423        #[inline]
11424        unsafe fn encode(
11425            self,
11426            encoder: &mut fidl::encoding::Encoder<
11427                '_,
11428                fidl::encoding::DefaultFuchsiaResourceDialect,
11429            >,
11430            offset: usize,
11431            depth: fidl::encoding::Depth,
11432        ) -> fidl::Result<()> {
11433            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
11434            // Zero out padding regions. There's no need to apply masks
11435            // because the unmasked parts will be overwritten by fields.
11436            unsafe {
11437                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11438                (ptr as *mut u64).write_unaligned(0);
11439            }
11440            // Write the fields.
11441            self.0.encode(encoder, offset + 0, depth)?;
11442            self.1.encode(encoder, offset + 16, depth)?;
11443            Ok(())
11444        }
11445    }
11446
11447    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11448        for StreamConfigCreateRingBufferRequest
11449    {
11450        #[inline(always)]
11451        fn new_empty() -> Self {
11452            Self {
11453                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
11454                ring_buffer: fidl::new_empty!(
11455                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11456                    fidl::encoding::DefaultFuchsiaResourceDialect
11457                ),
11458            }
11459        }
11460
11461        #[inline]
11462        unsafe fn decode(
11463            &mut self,
11464            decoder: &mut fidl::encoding::Decoder<
11465                '_,
11466                fidl::encoding::DefaultFuchsiaResourceDialect,
11467            >,
11468            offset: usize,
11469            _depth: fidl::encoding::Depth,
11470        ) -> fidl::Result<()> {
11471            decoder.debug_check_bounds::<Self>(offset);
11472            // Verify that padding bytes are zero.
11473            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11474            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11475            let mask = 0xffffffff00000000u64;
11476            let maskedval = padval & mask;
11477            if maskedval != 0 {
11478                return Err(fidl::Error::NonZeroPadding {
11479                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11480                });
11481            }
11482            fidl::decode!(
11483                Format,
11484                fidl::encoding::DefaultFuchsiaResourceDialect,
11485                &mut self.format,
11486                decoder,
11487                offset + 0,
11488                _depth
11489            )?;
11490            fidl::decode!(
11491                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11492                fidl::encoding::DefaultFuchsiaResourceDialect,
11493                &mut self.ring_buffer,
11494                decoder,
11495                offset + 16,
11496                _depth
11497            )?;
11498            Ok(())
11499        }
11500    }
11501}