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