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
14pub type VmoInfos = Vec<VmoInfo>;
15
16#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
17pub struct CodecConnectorConnectRequest {
18    pub codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22    for CodecConnectorConnectRequest
23{
24}
25
26#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct CompositeConnectorConnectRequest {
28    pub composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32    for CompositeConnectorConnectRequest
33{
34}
35
36#[derive(Debug, PartialEq)]
37pub struct CompositeCreatePacketStreamRequest {
38    pub processing_element_id: u64,
39    pub format: Format2,
40    pub packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
44    for CompositeCreatePacketStreamRequest
45{
46}
47
48#[derive(Debug, PartialEq)]
49pub struct CompositeCreateRingBufferRequest {
50    pub processing_element_id: u64,
51    pub format: Format2,
52    pub ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
56    for CompositeCreateRingBufferRequest
57{
58}
59
60#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
61pub struct DaiConnectorConnectRequest {
62    pub dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
63}
64
65impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
66    for DaiConnectorConnectRequest
67{
68}
69
70#[derive(Debug, PartialEq)]
71pub struct DaiCreateRingBufferRequest {
72    pub dai_format: DaiFormat,
73    pub ring_buffer_format: Format,
74    pub ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
75}
76
77impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
78    for DaiCreateRingBufferRequest
79{
80}
81
82#[derive(Debug, PartialEq)]
83pub struct PacketStreamControlAllocateVmosResponse {
84    pub vmos: Vec<VmoInfo>,
85}
86
87impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
88    for PacketStreamControlAllocateVmosResponse
89{
90}
91
92#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
93pub struct RingBufferGetVmoResponse {
94    pub num_frames: u32,
95    pub ring_buffer: fidl::Vmo,
96}
97
98impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RingBufferGetVmoResponse {}
99
100#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
101pub struct StreamConfigConnectorConnectRequest {
102    pub protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
103}
104
105impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
106    for StreamConfigConnectorConnectRequest
107{
108}
109
110#[derive(Debug, PartialEq)]
111pub struct StreamConfigCreateRingBufferRequest {
112    pub format: Format,
113    pub ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
114}
115
116impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
117    for StreamConfigCreateRingBufferRequest
118{
119}
120
121#[derive(Debug, Default, PartialEq)]
122pub struct PacketStreamControlSetPacketStreamSinkRequest {
123    pub stream: Option<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>,
124    #[doc(hidden)]
125    pub __source_breaking: fidl::marker::SourceBreaking,
126}
127
128impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
129    for PacketStreamControlSetPacketStreamSinkRequest
130{
131}
132
133#[derive(Debug, Default, PartialEq)]
134pub struct PacketStreamControlGetPacketStreamSinkResponse {
135    pub stream: Option<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>,
136    #[doc(hidden)]
137    pub __source_breaking: fidl::marker::SourceBreaking,
138}
139
140impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
141    for PacketStreamControlGetPacketStreamSinkResponse
142{
143}
144
145#[derive(Debug, Default, PartialEq)]
146pub struct PacketStreamSinkPutPacketRequest {
147    /// Location of the payload for this packet.
148    ///
149    /// Required.
150    pub payload: Option<DataTransfer>,
151    #[doc(hidden)]
152    pub __source_breaking: fidl::marker::SourceBreaking,
153}
154
155impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
156    for PacketStreamSinkPutPacketRequest
157{
158}
159
160#[derive(Debug, Default, PartialEq)]
161pub struct RegisterVmosConfig {
162    /// The list of VMOs to register with the driver.
163    ///
164    /// Required.
165    pub vmo_infos: Option<Vec<VmoInfo>>,
166    #[doc(hidden)]
167    pub __source_breaking: fidl::marker::SourceBreaking,
168}
169
170impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RegisterVmosConfig {}
171
172/// VMO information for registering VMOs. Used in `RegisterVmos` and `AllocateVmos` to pair
173/// a VMO handle with a unique ID.
174#[derive(Debug, Default, PartialEq)]
175pub struct VmoInfo {
176    /// ID corresponding to the VMO.
177    ///
178    /// Required.
179    pub id: Option<u64>,
180    /// Handle to the VMO.
181    ///
182    /// Required.
183    pub vmo: Option<fidl::Vmo>,
184    #[doc(hidden)]
185    pub __source_breaking: fidl::marker::SourceBreaking,
186}
187
188impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VmoInfo {}
189
190/// This describes a VMO section containing audio data.
191#[derive(Debug, Default, PartialEq)]
192pub struct VmoTransfer {
193    /// ID of a VMO that was previously registered or allocated.
194    ///
195    /// Required.
196    pub vmo_id: Option<u64>,
197    /// Offset into the VMO to start reading or writing.
198    /// This is relative to the start of that VMO.
199    ///
200    /// Required.
201    pub vmo_offset: Option<u64>,
202    /// Number of bytes to read/write from/to this VMO region.
203    ///
204    /// Required.
205    pub payload_size: Option<u64>,
206    #[doc(hidden)]
207    pub __source_breaking: fidl::marker::SourceBreaking,
208}
209
210impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VmoTransfer {}
211
212/// Data to be transferred. There are two supported ways data may be conveyed, corresponding to the
213/// two members of the DataTransfer union:
214///
215/// 1) vmo_transfer: A region within a VMO previously known to the driver. This VMO must have been
216///    established via `PacketStreamControl.RegisterVmos` (if client-allocated) or
217///    `PacketStreamControl.AllocateVmos` (if driver-allocated). Future requests refer to this
218///    buffer by the unique `vmo_id`. Because VMOs are reused across requests, the one-time
219///    cost of pinning/mapping is amortized.
220///
221/// 2) data: The payload is provided directly within the message. This mode is intended for
222///    small transfers or control information, not high-throughput streaming.
223#[derive(Debug)]
224pub enum DataTransfer {
225    /// Data is stored in a region of a registered VMO.
226    /// Requires `PacketStreamProperties.supported_buffer_types` to include `CLIENT_OWNED`
227    /// or `DRIVER_OWNED`.
228    VmoTransfer(VmoTransfer),
229    /// Embedded data buffer.
230    /// Requires `PacketStreamProperties.supported_buffer_types` to include `INLINE`.
231    InlineData(Vec<u8>),
232    #[doc(hidden)]
233    __SourceBreaking { unknown_ordinal: u64 },
234}
235
236/// Pattern that matches an unknown `DataTransfer` member.
237#[macro_export]
238macro_rules! DataTransferUnknown {
239    () => {
240        _
241    };
242}
243
244// Custom PartialEq so that unknown variants are not equal to themselves.
245impl PartialEq for DataTransfer {
246    fn eq(&self, other: &Self) -> bool {
247        match (self, other) {
248            (Self::VmoTransfer(x), Self::VmoTransfer(y)) => *x == *y,
249            (Self::InlineData(x), Self::InlineData(y)) => *x == *y,
250            _ => false,
251        }
252    }
253}
254
255impl DataTransfer {
256    #[inline]
257    pub fn ordinal(&self) -> u64 {
258        match *self {
259            Self::VmoTransfer(_) => 1,
260            Self::InlineData(_) => 2,
261            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
262        }
263    }
264
265    #[inline]
266    pub fn unknown_variant_for_testing() -> Self {
267        Self::__SourceBreaking { unknown_ordinal: 0 }
268    }
269
270    #[inline]
271    pub fn is_unknown(&self) -> bool {
272        match self {
273            Self::__SourceBreaking { .. } => true,
274            _ => false,
275        }
276    }
277}
278
279impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DataTransfer {}
280
281#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
282pub struct CodecMarker;
283
284impl fidl::endpoints::ProtocolMarker for CodecMarker {
285    type Proxy = CodecProxy;
286    type RequestStream = CodecRequestStream;
287    #[cfg(target_os = "fuchsia")]
288    type SynchronousProxy = CodecSynchronousProxy;
289
290    const DEBUG_NAME: &'static str = "(anonymous) Codec";
291}
292pub type CodecGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
293pub type CodecSetDaiFormatResult = Result<CodecFormatInfo, i32>;
294
295pub trait CodecProxyInterface: Send + Sync {
296    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
297        + Send;
298    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
299    fn r#signal_processing_connect(
300        &self,
301        protocol: fidl::endpoints::ServerEnd<
302            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
303        >,
304    ) -> Result<(), fidl::Error>;
305    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
306    fn r#reset(&self) -> Self::ResetResponseFut;
307    type GetPropertiesResponseFut: std::future::Future<Output = Result<CodecProperties, fidl::Error>>
308        + Send;
309    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
310    type StopResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
311    fn r#stop(&self) -> Self::StopResponseFut;
312    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
313    fn r#start(&self) -> Self::StartResponseFut;
314    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CodecGetDaiFormatsResult, fidl::Error>>
315        + Send;
316    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
317    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CodecSetDaiFormatResult, fidl::Error>>
318        + Send;
319    fn r#set_dai_format(&self, format: &DaiFormat) -> Self::SetDaiFormatResponseFut;
320    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
321        + Send;
322    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
323}
324#[derive(Debug)]
325#[cfg(target_os = "fuchsia")]
326pub struct CodecSynchronousProxy {
327    client: fidl::client::sync::Client,
328}
329
330#[cfg(target_os = "fuchsia")]
331impl fidl::endpoints::SynchronousProxy for CodecSynchronousProxy {
332    type Proxy = CodecProxy;
333    type Protocol = CodecMarker;
334
335    fn from_channel(inner: fidl::Channel) -> Self {
336        Self::new(inner)
337    }
338
339    fn into_channel(self) -> fidl::Channel {
340        self.client.into_channel()
341    }
342
343    fn as_channel(&self) -> &fidl::Channel {
344        self.client.as_channel()
345    }
346}
347
348#[cfg(target_os = "fuchsia")]
349impl CodecSynchronousProxy {
350    pub fn new(channel: fidl::Channel) -> Self {
351        let protocol_name = <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
352        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
353    }
354
355    pub fn into_channel(self) -> fidl::Channel {
356        self.client.into_channel()
357    }
358
359    /// Waits until an event arrives and returns it. It is safe for other
360    /// threads to make concurrent requests while waiting for an event.
361    pub fn wait_for_event(
362        &self,
363        deadline: zx::MonotonicInstant,
364    ) -> Result<CodecEvent, fidl::Error> {
365        CodecEvent::decode(self.client.wait_for_event(deadline)?)
366    }
367
368    /// Retrieves top level health state.
369    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
370    pub fn r#get_health_state(
371        &self,
372        ___deadline: zx::MonotonicInstant,
373    ) -> Result<HealthState, fidl::Error> {
374        let _response =
375            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
376                (),
377                0x4e146d6bca733a84,
378                fidl::encoding::DynamicFlags::empty(),
379                ___deadline,
380            )?;
381        Ok(_response.state)
382    }
383
384    /// Connect to a `SignalProcessing` protocol.
385    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
386    /// the maximum number of connections have already been created, for instance one, then the
387    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
388    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
389    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
390    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
391    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
392    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
393    /// is intended to be composed, and hence the more verbose name allows differentiation and
394    /// improved clarity.
395    pub fn r#signal_processing_connect(
396        &self,
397        mut protocol: fidl::endpoints::ServerEnd<
398            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
399        >,
400    ) -> Result<(), fidl::Error> {
401        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
402            (protocol,),
403            0xa81907ce6066295,
404            fidl::encoding::DynamicFlags::empty(),
405        )
406    }
407
408    /// Resets the codec.
409    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
410    /// codec it will close the codec protocol channel, in this case the client may obtain a new
411    /// codec protocol channel and retry.
412    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
413        let _response =
414            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
415                (),
416                0x50757ae579a7bd6b,
417                fidl::encoding::DynamicFlags::empty(),
418                ___deadline,
419            )?;
420        Ok(_response)
421    }
422
423    /// Retrieves top level static properties.
424    pub fn r#get_properties(
425        &self,
426        ___deadline: zx::MonotonicInstant,
427    ) -> Result<CodecProperties, fidl::Error> {
428        let _response =
429            self.client.send_query::<fidl::encoding::EmptyPayload, CodecGetPropertiesResponse>(
430                (),
431                0x7a0d138a6a1d9d90,
432                fidl::encoding::DynamicFlags::empty(),
433                ___deadline,
434            )?;
435        Ok(_response.properties)
436    }
437
438    /// Stops the codec operation.
439    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
440    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
441    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
442    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
443    /// in the CLOCK_MONOTONIC timeline.
444    /// If the driver cannot successfully configure the codec to stop, it will close the codec
445    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
446    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
447        let _response = self.client.send_query::<fidl::encoding::EmptyPayload, CodecStopResponse>(
448            (),
449            0x5c2e380df1332dbd,
450            fidl::encoding::DynamicFlags::empty(),
451            ___deadline,
452        )?;
453        Ok(_response.stop_time)
454    }
455
456    /// Start/Re-start the codec operation.
457    /// `Start` returns when configuring the codec to start is completed. This method does not wait
458    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
459    /// into account), nor is any such delay reflected in the returned `start_time`.
460    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
461    /// in the CLOCK_MONOTONIC timeline.
462    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
463    /// in which case the client may obtain a new codec protocol channel and retry.
464    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
465        let _response =
466            self.client.send_query::<fidl::encoding::EmptyPayload, CodecStartResponse>(
467                (),
468                0x329cdacb286ab00,
469                fidl::encoding::DynamicFlags::empty(),
470                ___deadline,
471            )?;
472        Ok(_response.start_time)
473    }
474
475    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
476    /// may reply with an error status and the controller may retry at a later time.
477    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
478    /// combinations of the parameters in DaiSupportedFormats may be supported.
479    pub fn r#get_dai_formats(
480        &self,
481        ___deadline: zx::MonotonicInstant,
482    ) -> Result<CodecGetDaiFormatsResult, fidl::Error> {
483        let _response = self.client.send_query::<
484            fidl::encoding::EmptyPayload,
485            fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>,
486        >(
487            (),
488            0xf8bbc46b4ba6a52,
489            fidl::encoding::DynamicFlags::empty(),
490            ___deadline,
491        )?;
492        Ok(_response.map(|x| x.formats))
493    }
494
495    /// Sets the DAI format to be used in the interface between the controller and codec.
496    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
497    pub fn r#set_dai_format(
498        &self,
499        mut format: &DaiFormat,
500        ___deadline: zx::MonotonicInstant,
501    ) -> Result<CodecSetDaiFormatResult, fidl::Error> {
502        let _response = self.client.send_query::<
503            CodecSetDaiFormatRequest,
504            fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>,
505        >(
506            (format,),
507            0x2f829df9e5a7a1ea,
508            fidl::encoding::DynamicFlags::empty(),
509            ___deadline,
510        )?;
511        Ok(_response.map(|x| x.state))
512    }
513
514    /// Get the plug detect state via a hanging get. The driver will reply to the first
515    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
516    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
517    pub fn r#watch_plug_state(
518        &self,
519        ___deadline: zx::MonotonicInstant,
520    ) -> Result<PlugState, fidl::Error> {
521        let _response =
522            self.client.send_query::<fidl::encoding::EmptyPayload, CodecWatchPlugStateResponse>(
523                (),
524                0x182b87f935ca7326,
525                fidl::encoding::DynamicFlags::empty(),
526                ___deadline,
527            )?;
528        Ok(_response.plug_state)
529    }
530}
531
532#[cfg(target_os = "fuchsia")]
533impl From<CodecSynchronousProxy> for zx::NullableHandle {
534    fn from(value: CodecSynchronousProxy) -> Self {
535        value.into_channel().into()
536    }
537}
538
539#[cfg(target_os = "fuchsia")]
540impl From<fidl::Channel> for CodecSynchronousProxy {
541    fn from(value: fidl::Channel) -> Self {
542        Self::new(value)
543    }
544}
545
546#[cfg(target_os = "fuchsia")]
547impl fidl::endpoints::FromClient for CodecSynchronousProxy {
548    type Protocol = CodecMarker;
549
550    fn from_client(value: fidl::endpoints::ClientEnd<CodecMarker>) -> Self {
551        Self::new(value.into_channel())
552    }
553}
554
555#[derive(Debug, Clone)]
556pub struct CodecProxy {
557    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
558}
559
560impl fidl::endpoints::Proxy for CodecProxy {
561    type Protocol = CodecMarker;
562
563    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
564        Self::new(inner)
565    }
566
567    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
568        self.client.into_channel().map_err(|client| Self { client })
569    }
570
571    fn as_channel(&self) -> &::fidl::AsyncChannel {
572        self.client.as_channel()
573    }
574}
575
576impl CodecProxy {
577    /// Create a new Proxy for fuchsia.hardware.audio/Codec.
578    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
579        let protocol_name = <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
580        Self { client: fidl::client::Client::new(channel, protocol_name) }
581    }
582
583    /// Get a Stream of events from the remote end of the protocol.
584    ///
585    /// # Panics
586    ///
587    /// Panics if the event stream was already taken.
588    pub fn take_event_stream(&self) -> CodecEventStream {
589        CodecEventStream { event_receiver: self.client.take_event_receiver() }
590    }
591
592    /// Retrieves top level health state.
593    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
594    pub fn r#get_health_state(
595        &self,
596    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
597    {
598        CodecProxyInterface::r#get_health_state(self)
599    }
600
601    /// Connect to a `SignalProcessing` protocol.
602    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
603    /// the maximum number of connections have already been created, for instance one, then the
604    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
605    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
606    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
607    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
608    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
609    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
610    /// is intended to be composed, and hence the more verbose name allows differentiation and
611    /// improved clarity.
612    pub fn r#signal_processing_connect(
613        &self,
614        mut protocol: fidl::endpoints::ServerEnd<
615            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
616        >,
617    ) -> Result<(), fidl::Error> {
618        CodecProxyInterface::r#signal_processing_connect(self, protocol)
619    }
620
621    /// Resets the codec.
622    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
623    /// codec it will close the codec protocol channel, in this case the client may obtain a new
624    /// codec protocol channel and retry.
625    pub fn r#reset(
626        &self,
627    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
628        CodecProxyInterface::r#reset(self)
629    }
630
631    /// Retrieves top level static properties.
632    pub fn r#get_properties(
633        &self,
634    ) -> fidl::client::QueryResponseFut<
635        CodecProperties,
636        fidl::encoding::DefaultFuchsiaResourceDialect,
637    > {
638        CodecProxyInterface::r#get_properties(self)
639    }
640
641    /// Stops the codec operation.
642    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
643    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
644    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
645    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
646    /// in the CLOCK_MONOTONIC timeline.
647    /// If the driver cannot successfully configure the codec to stop, it will close the codec
648    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
649    pub fn r#stop(
650        &self,
651    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
652        CodecProxyInterface::r#stop(self)
653    }
654
655    /// Start/Re-start the codec operation.
656    /// `Start` returns when configuring the codec to start is completed. This method does not wait
657    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
658    /// into account), nor is any such delay reflected in the returned `start_time`.
659    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
660    /// in the CLOCK_MONOTONIC timeline.
661    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
662    /// in which case the client may obtain a new codec protocol channel and retry.
663    pub fn r#start(
664        &self,
665    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
666        CodecProxyInterface::r#start(self)
667    }
668
669    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
670    /// may reply with an error status and the controller may retry at a later time.
671    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
672    /// combinations of the parameters in DaiSupportedFormats may be supported.
673    pub fn r#get_dai_formats(
674        &self,
675    ) -> fidl::client::QueryResponseFut<
676        CodecGetDaiFormatsResult,
677        fidl::encoding::DefaultFuchsiaResourceDialect,
678    > {
679        CodecProxyInterface::r#get_dai_formats(self)
680    }
681
682    /// Sets the DAI format to be used in the interface between the controller and codec.
683    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
684    pub fn r#set_dai_format(
685        &self,
686        mut format: &DaiFormat,
687    ) -> fidl::client::QueryResponseFut<
688        CodecSetDaiFormatResult,
689        fidl::encoding::DefaultFuchsiaResourceDialect,
690    > {
691        CodecProxyInterface::r#set_dai_format(self, format)
692    }
693
694    /// Get the plug detect state via a hanging get. The driver will reply to the first
695    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
696    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
697    pub fn r#watch_plug_state(
698        &self,
699    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
700    {
701        CodecProxyInterface::r#watch_plug_state(self)
702    }
703}
704
705impl CodecProxyInterface for CodecProxy {
706    type GetHealthStateResponseFut =
707        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
708    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
709        fn _decode(
710            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
711        ) -> Result<HealthState, fidl::Error> {
712            let _response = fidl::client::decode_transaction_body::<
713                HealthGetHealthStateResponse,
714                fidl::encoding::DefaultFuchsiaResourceDialect,
715                0x4e146d6bca733a84,
716            >(_buf?)?;
717            Ok(_response.state)
718        }
719        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
720            (),
721            0x4e146d6bca733a84,
722            fidl::encoding::DynamicFlags::empty(),
723            _decode,
724        )
725    }
726
727    fn r#signal_processing_connect(
728        &self,
729        mut protocol: fidl::endpoints::ServerEnd<
730            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
731        >,
732    ) -> Result<(), fidl::Error> {
733        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
734            (protocol,),
735            0xa81907ce6066295,
736            fidl::encoding::DynamicFlags::empty(),
737        )
738    }
739
740    type ResetResponseFut =
741        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
742    fn r#reset(&self) -> Self::ResetResponseFut {
743        fn _decode(
744            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
745        ) -> Result<(), fidl::Error> {
746            let _response = fidl::client::decode_transaction_body::<
747                fidl::encoding::EmptyPayload,
748                fidl::encoding::DefaultFuchsiaResourceDialect,
749                0x50757ae579a7bd6b,
750            >(_buf?)?;
751            Ok(_response)
752        }
753        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
754            (),
755            0x50757ae579a7bd6b,
756            fidl::encoding::DynamicFlags::empty(),
757            _decode,
758        )
759    }
760
761    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
762        CodecProperties,
763        fidl::encoding::DefaultFuchsiaResourceDialect,
764    >;
765    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
766        fn _decode(
767            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
768        ) -> Result<CodecProperties, fidl::Error> {
769            let _response = fidl::client::decode_transaction_body::<
770                CodecGetPropertiesResponse,
771                fidl::encoding::DefaultFuchsiaResourceDialect,
772                0x7a0d138a6a1d9d90,
773            >(_buf?)?;
774            Ok(_response.properties)
775        }
776        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecProperties>(
777            (),
778            0x7a0d138a6a1d9d90,
779            fidl::encoding::DynamicFlags::empty(),
780            _decode,
781        )
782    }
783
784    type StopResponseFut =
785        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
786    fn r#stop(&self) -> Self::StopResponseFut {
787        fn _decode(
788            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
789        ) -> Result<i64, fidl::Error> {
790            let _response = fidl::client::decode_transaction_body::<
791                CodecStopResponse,
792                fidl::encoding::DefaultFuchsiaResourceDialect,
793                0x5c2e380df1332dbd,
794            >(_buf?)?;
795            Ok(_response.stop_time)
796        }
797        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
798            (),
799            0x5c2e380df1332dbd,
800            fidl::encoding::DynamicFlags::empty(),
801            _decode,
802        )
803    }
804
805    type StartResponseFut =
806        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
807    fn r#start(&self) -> Self::StartResponseFut {
808        fn _decode(
809            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
810        ) -> Result<i64, fidl::Error> {
811            let _response = fidl::client::decode_transaction_body::<
812                CodecStartResponse,
813                fidl::encoding::DefaultFuchsiaResourceDialect,
814                0x329cdacb286ab00,
815            >(_buf?)?;
816            Ok(_response.start_time)
817        }
818        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
819            (),
820            0x329cdacb286ab00,
821            fidl::encoding::DynamicFlags::empty(),
822            _decode,
823        )
824    }
825
826    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
827        CodecGetDaiFormatsResult,
828        fidl::encoding::DefaultFuchsiaResourceDialect,
829    >;
830    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
831        fn _decode(
832            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
833        ) -> Result<CodecGetDaiFormatsResult, fidl::Error> {
834            let _response = fidl::client::decode_transaction_body::<
835                fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>,
836                fidl::encoding::DefaultFuchsiaResourceDialect,
837                0xf8bbc46b4ba6a52,
838            >(_buf?)?;
839            Ok(_response.map(|x| x.formats))
840        }
841        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecGetDaiFormatsResult>(
842            (),
843            0xf8bbc46b4ba6a52,
844            fidl::encoding::DynamicFlags::empty(),
845            _decode,
846        )
847    }
848
849    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
850        CodecSetDaiFormatResult,
851        fidl::encoding::DefaultFuchsiaResourceDialect,
852    >;
853    fn r#set_dai_format(&self, mut format: &DaiFormat) -> Self::SetDaiFormatResponseFut {
854        fn _decode(
855            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
856        ) -> Result<CodecSetDaiFormatResult, fidl::Error> {
857            let _response = fidl::client::decode_transaction_body::<
858                fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>,
859                fidl::encoding::DefaultFuchsiaResourceDialect,
860                0x2f829df9e5a7a1ea,
861            >(_buf?)?;
862            Ok(_response.map(|x| x.state))
863        }
864        self.client.send_query_and_decode::<CodecSetDaiFormatRequest, CodecSetDaiFormatResult>(
865            (format,),
866            0x2f829df9e5a7a1ea,
867            fidl::encoding::DynamicFlags::empty(),
868            _decode,
869        )
870    }
871
872    type WatchPlugStateResponseFut =
873        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
874    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
875        fn _decode(
876            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
877        ) -> Result<PlugState, fidl::Error> {
878            let _response = fidl::client::decode_transaction_body::<
879                CodecWatchPlugStateResponse,
880                fidl::encoding::DefaultFuchsiaResourceDialect,
881                0x182b87f935ca7326,
882            >(_buf?)?;
883            Ok(_response.plug_state)
884        }
885        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
886            (),
887            0x182b87f935ca7326,
888            fidl::encoding::DynamicFlags::empty(),
889            _decode,
890        )
891    }
892}
893
894pub struct CodecEventStream {
895    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
896}
897
898impl std::marker::Unpin for CodecEventStream {}
899
900impl futures::stream::FusedStream for CodecEventStream {
901    fn is_terminated(&self) -> bool {
902        self.event_receiver.is_terminated()
903    }
904}
905
906impl futures::Stream for CodecEventStream {
907    type Item = Result<CodecEvent, fidl::Error>;
908
909    fn poll_next(
910        mut self: std::pin::Pin<&mut Self>,
911        cx: &mut std::task::Context<'_>,
912    ) -> std::task::Poll<Option<Self::Item>> {
913        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
914            &mut self.event_receiver,
915            cx
916        )?) {
917            Some(buf) => std::task::Poll::Ready(Some(CodecEvent::decode(buf))),
918            None => std::task::Poll::Ready(None),
919        }
920    }
921}
922
923#[derive(Debug)]
924pub enum CodecEvent {}
925
926impl CodecEvent {
927    /// Decodes a message buffer as a [`CodecEvent`].
928    fn decode(
929        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
930    ) -> Result<CodecEvent, fidl::Error> {
931        let (bytes, _handles) = buf.split_mut();
932        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
933        debug_assert_eq!(tx_header.tx_id, 0);
934        match tx_header.ordinal {
935            _ => Err(fidl::Error::UnknownOrdinal {
936                ordinal: tx_header.ordinal,
937                protocol_name: <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
938            }),
939        }
940    }
941}
942
943/// A Stream of incoming requests for fuchsia.hardware.audio/Codec.
944pub struct CodecRequestStream {
945    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
946    is_terminated: bool,
947}
948
949impl std::marker::Unpin for CodecRequestStream {}
950
951impl futures::stream::FusedStream for CodecRequestStream {
952    fn is_terminated(&self) -> bool {
953        self.is_terminated
954    }
955}
956
957impl fidl::endpoints::RequestStream for CodecRequestStream {
958    type Protocol = CodecMarker;
959    type ControlHandle = CodecControlHandle;
960
961    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
962        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
963    }
964
965    fn control_handle(&self) -> Self::ControlHandle {
966        CodecControlHandle { inner: self.inner.clone() }
967    }
968
969    fn into_inner(
970        self,
971    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
972    {
973        (self.inner, self.is_terminated)
974    }
975
976    fn from_inner(
977        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
978        is_terminated: bool,
979    ) -> Self {
980        Self { inner, is_terminated }
981    }
982}
983
984impl futures::Stream for CodecRequestStream {
985    type Item = Result<CodecRequest, fidl::Error>;
986
987    fn poll_next(
988        mut self: std::pin::Pin<&mut Self>,
989        cx: &mut std::task::Context<'_>,
990    ) -> std::task::Poll<Option<Self::Item>> {
991        let this = &mut *self;
992        if this.inner.check_shutdown(cx) {
993            this.is_terminated = true;
994            return std::task::Poll::Ready(None);
995        }
996        if this.is_terminated {
997            panic!("polled CodecRequestStream after completion");
998        }
999        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1000            |bytes, handles| {
1001                match this.inner.channel().read_etc(cx, bytes, handles) {
1002                    std::task::Poll::Ready(Ok(())) => {}
1003                    std::task::Poll::Pending => return std::task::Poll::Pending,
1004                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1005                        this.is_terminated = true;
1006                        return std::task::Poll::Ready(None);
1007                    }
1008                    std::task::Poll::Ready(Err(e)) => {
1009                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1010                            e.into(),
1011                        ))));
1012                    }
1013                }
1014
1015                // A message has been received from the channel
1016                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1017
1018                std::task::Poll::Ready(Some(match header.ordinal {
1019                    0x4e146d6bca733a84 => {
1020                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1021                        let mut req = fidl::new_empty!(
1022                            fidl::encoding::EmptyPayload,
1023                            fidl::encoding::DefaultFuchsiaResourceDialect
1024                        );
1025                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1026                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1027                        Ok(CodecRequest::GetHealthState {
1028                            responder: CodecGetHealthStateResponder {
1029                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1030                                tx_id: header.tx_id,
1031                            },
1032                        })
1033                    }
1034                    0xa81907ce6066295 => {
1035                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1036                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1037                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1038                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1039                        Ok(CodecRequest::SignalProcessingConnect {
1040                            protocol: req.protocol,
1041
1042                            control_handle,
1043                        })
1044                    }
1045                    0x50757ae579a7bd6b => {
1046                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1047                        let mut req = fidl::new_empty!(
1048                            fidl::encoding::EmptyPayload,
1049                            fidl::encoding::DefaultFuchsiaResourceDialect
1050                        );
1051                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1052                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1053                        Ok(CodecRequest::Reset {
1054                            responder: CodecResetResponder {
1055                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1056                                tx_id: header.tx_id,
1057                            },
1058                        })
1059                    }
1060                    0x7a0d138a6a1d9d90 => {
1061                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1062                        let mut req = fidl::new_empty!(
1063                            fidl::encoding::EmptyPayload,
1064                            fidl::encoding::DefaultFuchsiaResourceDialect
1065                        );
1066                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1067                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1068                        Ok(CodecRequest::GetProperties {
1069                            responder: CodecGetPropertiesResponder {
1070                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1071                                tx_id: header.tx_id,
1072                            },
1073                        })
1074                    }
1075                    0x5c2e380df1332dbd => {
1076                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1077                        let mut req = fidl::new_empty!(
1078                            fidl::encoding::EmptyPayload,
1079                            fidl::encoding::DefaultFuchsiaResourceDialect
1080                        );
1081                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1082                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1083                        Ok(CodecRequest::Stop {
1084                            responder: CodecStopResponder {
1085                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1086                                tx_id: header.tx_id,
1087                            },
1088                        })
1089                    }
1090                    0x329cdacb286ab00 => {
1091                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1092                        let mut req = fidl::new_empty!(
1093                            fidl::encoding::EmptyPayload,
1094                            fidl::encoding::DefaultFuchsiaResourceDialect
1095                        );
1096                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1097                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1098                        Ok(CodecRequest::Start {
1099                            responder: CodecStartResponder {
1100                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1101                                tx_id: header.tx_id,
1102                            },
1103                        })
1104                    }
1105                    0xf8bbc46b4ba6a52 => {
1106                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1107                        let mut req = fidl::new_empty!(
1108                            fidl::encoding::EmptyPayload,
1109                            fidl::encoding::DefaultFuchsiaResourceDialect
1110                        );
1111                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1112                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1113                        Ok(CodecRequest::GetDaiFormats {
1114                            responder: CodecGetDaiFormatsResponder {
1115                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1116                                tx_id: header.tx_id,
1117                            },
1118                        })
1119                    }
1120                    0x2f829df9e5a7a1ea => {
1121                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1122                        let mut req = fidl::new_empty!(
1123                            CodecSetDaiFormatRequest,
1124                            fidl::encoding::DefaultFuchsiaResourceDialect
1125                        );
1126                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
1127                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1128                        Ok(CodecRequest::SetDaiFormat {
1129                            format: req.format,
1130
1131                            responder: CodecSetDaiFormatResponder {
1132                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1133                                tx_id: header.tx_id,
1134                            },
1135                        })
1136                    }
1137                    0x182b87f935ca7326 => {
1138                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1139                        let mut req = fidl::new_empty!(
1140                            fidl::encoding::EmptyPayload,
1141                            fidl::encoding::DefaultFuchsiaResourceDialect
1142                        );
1143                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1144                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1145                        Ok(CodecRequest::WatchPlugState {
1146                            responder: CodecWatchPlugStateResponder {
1147                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1148                                tx_id: header.tx_id,
1149                            },
1150                        })
1151                    }
1152                    _ => Err(fidl::Error::UnknownOrdinal {
1153                        ordinal: header.ordinal,
1154                        protocol_name: <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1155                    }),
1156                }))
1157            },
1158        )
1159    }
1160}
1161
1162/// For an overview see
1163/// [[Audio Codec Interface]](https://fuchsia.dev/fuchsia-src/development/audio/drivers/codec).
1164/// # Deprecation
1165///
1166/// Not supported anymore, instead use an
1167/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
1168/// with one DAI and no Ring Buffer, see
1169/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
1170#[derive(Debug)]
1171pub enum CodecRequest {
1172    /// Retrieves top level health state.
1173    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
1174    GetHealthState { responder: CodecGetHealthStateResponder },
1175    /// Connect to a `SignalProcessing` protocol.
1176    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
1177    /// the maximum number of connections have already been created, for instance one, then the
1178    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
1179    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
1180    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
1181    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
1182    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
1183    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
1184    /// is intended to be composed, and hence the more verbose name allows differentiation and
1185    /// improved clarity.
1186    SignalProcessingConnect {
1187        protocol: fidl::endpoints::ServerEnd<
1188            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1189        >,
1190        control_handle: CodecControlHandle,
1191    },
1192    /// Resets the codec.
1193    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
1194    /// codec it will close the codec protocol channel, in this case the client may obtain a new
1195    /// codec protocol channel and retry.
1196    Reset { responder: CodecResetResponder },
1197    /// Retrieves top level static properties.
1198    GetProperties { responder: CodecGetPropertiesResponder },
1199    /// Stops the codec operation.
1200    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
1201    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
1202    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
1203    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
1204    /// in the CLOCK_MONOTONIC timeline.
1205    /// If the driver cannot successfully configure the codec to stop, it will close the codec
1206    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
1207    Stop { responder: CodecStopResponder },
1208    /// Start/Re-start the codec operation.
1209    /// `Start` returns when configuring the codec to start is completed. This method does not wait
1210    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
1211    /// into account), nor is any such delay reflected in the returned `start_time`.
1212    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
1213    /// in the CLOCK_MONOTONIC timeline.
1214    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
1215    /// in which case the client may obtain a new codec protocol channel and retry.
1216    Start { responder: CodecStartResponder },
1217    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
1218    /// may reply with an error status and the controller may retry at a later time.
1219    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
1220    /// combinations of the parameters in DaiSupportedFormats may be supported.
1221    GetDaiFormats { responder: CodecGetDaiFormatsResponder },
1222    /// Sets the DAI format to be used in the interface between the controller and codec.
1223    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
1224    SetDaiFormat { format: DaiFormat, responder: CodecSetDaiFormatResponder },
1225    /// Get the plug detect state via a hanging get. The driver will reply to the first
1226    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
1227    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
1228    WatchPlugState { responder: CodecWatchPlugStateResponder },
1229}
1230
1231impl CodecRequest {
1232    #[allow(irrefutable_let_patterns)]
1233    pub fn into_get_health_state(self) -> Option<(CodecGetHealthStateResponder)> {
1234        if let CodecRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
1235    }
1236
1237    #[allow(irrefutable_let_patterns)]
1238    pub fn into_signal_processing_connect(
1239        self,
1240    ) -> Option<(
1241        fidl::endpoints::ServerEnd<
1242            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1243        >,
1244        CodecControlHandle,
1245    )> {
1246        if let CodecRequest::SignalProcessingConnect { protocol, control_handle } = self {
1247            Some((protocol, control_handle))
1248        } else {
1249            None
1250        }
1251    }
1252
1253    #[allow(irrefutable_let_patterns)]
1254    pub fn into_reset(self) -> Option<(CodecResetResponder)> {
1255        if let CodecRequest::Reset { responder } = self { Some((responder)) } else { None }
1256    }
1257
1258    #[allow(irrefutable_let_patterns)]
1259    pub fn into_get_properties(self) -> Option<(CodecGetPropertiesResponder)> {
1260        if let CodecRequest::GetProperties { responder } = self { Some((responder)) } else { None }
1261    }
1262
1263    #[allow(irrefutable_let_patterns)]
1264    pub fn into_stop(self) -> Option<(CodecStopResponder)> {
1265        if let CodecRequest::Stop { responder } = self { Some((responder)) } else { None }
1266    }
1267
1268    #[allow(irrefutable_let_patterns)]
1269    pub fn into_start(self) -> Option<(CodecStartResponder)> {
1270        if let CodecRequest::Start { responder } = self { Some((responder)) } else { None }
1271    }
1272
1273    #[allow(irrefutable_let_patterns)]
1274    pub fn into_get_dai_formats(self) -> Option<(CodecGetDaiFormatsResponder)> {
1275        if let CodecRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
1276    }
1277
1278    #[allow(irrefutable_let_patterns)]
1279    pub fn into_set_dai_format(self) -> Option<(DaiFormat, CodecSetDaiFormatResponder)> {
1280        if let CodecRequest::SetDaiFormat { format, responder } = self {
1281            Some((format, responder))
1282        } else {
1283            None
1284        }
1285    }
1286
1287    #[allow(irrefutable_let_patterns)]
1288    pub fn into_watch_plug_state(self) -> Option<(CodecWatchPlugStateResponder)> {
1289        if let CodecRequest::WatchPlugState { responder } = self { Some((responder)) } else { None }
1290    }
1291
1292    /// Name of the method defined in FIDL
1293    pub fn method_name(&self) -> &'static str {
1294        match *self {
1295            CodecRequest::GetHealthState { .. } => "get_health_state",
1296            CodecRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
1297            CodecRequest::Reset { .. } => "reset",
1298            CodecRequest::GetProperties { .. } => "get_properties",
1299            CodecRequest::Stop { .. } => "stop",
1300            CodecRequest::Start { .. } => "start",
1301            CodecRequest::GetDaiFormats { .. } => "get_dai_formats",
1302            CodecRequest::SetDaiFormat { .. } => "set_dai_format",
1303            CodecRequest::WatchPlugState { .. } => "watch_plug_state",
1304        }
1305    }
1306}
1307
1308#[derive(Debug, Clone)]
1309pub struct CodecControlHandle {
1310    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1311}
1312
1313impl fidl::endpoints::ControlHandle for CodecControlHandle {
1314    fn shutdown(&self) {
1315        self.inner.shutdown()
1316    }
1317
1318    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1319        self.inner.shutdown_with_epitaph(status)
1320    }
1321
1322    fn is_closed(&self) -> bool {
1323        self.inner.channel().is_closed()
1324    }
1325    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1326        self.inner.channel().on_closed()
1327    }
1328
1329    #[cfg(target_os = "fuchsia")]
1330    fn signal_peer(
1331        &self,
1332        clear_mask: zx::Signals,
1333        set_mask: zx::Signals,
1334    ) -> Result<(), zx_status::Status> {
1335        use fidl::Peered;
1336        self.inner.channel().signal_peer(clear_mask, set_mask)
1337    }
1338}
1339
1340impl CodecControlHandle {}
1341
1342#[must_use = "FIDL methods require a response to be sent"]
1343#[derive(Debug)]
1344pub struct CodecGetHealthStateResponder {
1345    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1346    tx_id: u32,
1347}
1348
1349/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1350/// if the responder is dropped without sending a response, so that the client
1351/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1352impl std::ops::Drop for CodecGetHealthStateResponder {
1353    fn drop(&mut self) {
1354        self.control_handle.shutdown();
1355        // Safety: drops once, never accessed again
1356        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1357    }
1358}
1359
1360impl fidl::endpoints::Responder for CodecGetHealthStateResponder {
1361    type ControlHandle = CodecControlHandle;
1362
1363    fn control_handle(&self) -> &CodecControlHandle {
1364        &self.control_handle
1365    }
1366
1367    fn drop_without_shutdown(mut self) {
1368        // Safety: drops once, never accessed again due to mem::forget
1369        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1370        // Prevent Drop from running (which would shut down the channel)
1371        std::mem::forget(self);
1372    }
1373}
1374
1375impl CodecGetHealthStateResponder {
1376    /// Sends a response to the FIDL transaction.
1377    ///
1378    /// Sets the channel to shutdown if an error occurs.
1379    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1380        let _result = self.send_raw(state);
1381        if _result.is_err() {
1382            self.control_handle.shutdown();
1383        }
1384        self.drop_without_shutdown();
1385        _result
1386    }
1387
1388    /// Similar to "send" but does not shutdown the channel if an error occurs.
1389    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1390        let _result = self.send_raw(state);
1391        self.drop_without_shutdown();
1392        _result
1393    }
1394
1395    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
1396        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
1397            (state,),
1398            self.tx_id,
1399            0x4e146d6bca733a84,
1400            fidl::encoding::DynamicFlags::empty(),
1401        )
1402    }
1403}
1404
1405#[must_use = "FIDL methods require a response to be sent"]
1406#[derive(Debug)]
1407pub struct CodecResetResponder {
1408    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1409    tx_id: u32,
1410}
1411
1412/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1413/// if the responder is dropped without sending a response, so that the client
1414/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1415impl std::ops::Drop for CodecResetResponder {
1416    fn drop(&mut self) {
1417        self.control_handle.shutdown();
1418        // Safety: drops once, never accessed again
1419        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1420    }
1421}
1422
1423impl fidl::endpoints::Responder for CodecResetResponder {
1424    type ControlHandle = CodecControlHandle;
1425
1426    fn control_handle(&self) -> &CodecControlHandle {
1427        &self.control_handle
1428    }
1429
1430    fn drop_without_shutdown(mut self) {
1431        // Safety: drops once, never accessed again due to mem::forget
1432        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1433        // Prevent Drop from running (which would shut down the channel)
1434        std::mem::forget(self);
1435    }
1436}
1437
1438impl CodecResetResponder {
1439    /// Sends a response to the FIDL transaction.
1440    ///
1441    /// Sets the channel to shutdown if an error occurs.
1442    pub fn send(self) -> Result<(), fidl::Error> {
1443        let _result = self.send_raw();
1444        if _result.is_err() {
1445            self.control_handle.shutdown();
1446        }
1447        self.drop_without_shutdown();
1448        _result
1449    }
1450
1451    /// Similar to "send" but does not shutdown the channel if an error occurs.
1452    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1453        let _result = self.send_raw();
1454        self.drop_without_shutdown();
1455        _result
1456    }
1457
1458    fn send_raw(&self) -> Result<(), fidl::Error> {
1459        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1460            (),
1461            self.tx_id,
1462            0x50757ae579a7bd6b,
1463            fidl::encoding::DynamicFlags::empty(),
1464        )
1465    }
1466}
1467
1468#[must_use = "FIDL methods require a response to be sent"]
1469#[derive(Debug)]
1470pub struct CodecGetPropertiesResponder {
1471    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1472    tx_id: u32,
1473}
1474
1475/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1476/// if the responder is dropped without sending a response, so that the client
1477/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1478impl std::ops::Drop for CodecGetPropertiesResponder {
1479    fn drop(&mut self) {
1480        self.control_handle.shutdown();
1481        // Safety: drops once, never accessed again
1482        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1483    }
1484}
1485
1486impl fidl::endpoints::Responder for CodecGetPropertiesResponder {
1487    type ControlHandle = CodecControlHandle;
1488
1489    fn control_handle(&self) -> &CodecControlHandle {
1490        &self.control_handle
1491    }
1492
1493    fn drop_without_shutdown(mut self) {
1494        // Safety: drops once, never accessed again due to mem::forget
1495        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1496        // Prevent Drop from running (which would shut down the channel)
1497        std::mem::forget(self);
1498    }
1499}
1500
1501impl CodecGetPropertiesResponder {
1502    /// Sends a response to the FIDL transaction.
1503    ///
1504    /// Sets the channel to shutdown if an error occurs.
1505    pub fn send(self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1506        let _result = self.send_raw(properties);
1507        if _result.is_err() {
1508            self.control_handle.shutdown();
1509        }
1510        self.drop_without_shutdown();
1511        _result
1512    }
1513
1514    /// Similar to "send" but does not shutdown the channel if an error occurs.
1515    pub fn send_no_shutdown_on_err(
1516        self,
1517        mut properties: &CodecProperties,
1518    ) -> Result<(), fidl::Error> {
1519        let _result = self.send_raw(properties);
1520        self.drop_without_shutdown();
1521        _result
1522    }
1523
1524    fn send_raw(&self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1525        self.control_handle.inner.send::<CodecGetPropertiesResponse>(
1526            (properties,),
1527            self.tx_id,
1528            0x7a0d138a6a1d9d90,
1529            fidl::encoding::DynamicFlags::empty(),
1530        )
1531    }
1532}
1533
1534#[must_use = "FIDL methods require a response to be sent"]
1535#[derive(Debug)]
1536pub struct CodecStopResponder {
1537    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1538    tx_id: u32,
1539}
1540
1541/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1542/// if the responder is dropped without sending a response, so that the client
1543/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1544impl std::ops::Drop for CodecStopResponder {
1545    fn drop(&mut self) {
1546        self.control_handle.shutdown();
1547        // Safety: drops once, never accessed again
1548        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1549    }
1550}
1551
1552impl fidl::endpoints::Responder for CodecStopResponder {
1553    type ControlHandle = CodecControlHandle;
1554
1555    fn control_handle(&self) -> &CodecControlHandle {
1556        &self.control_handle
1557    }
1558
1559    fn drop_without_shutdown(mut self) {
1560        // Safety: drops once, never accessed again due to mem::forget
1561        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1562        // Prevent Drop from running (which would shut down the channel)
1563        std::mem::forget(self);
1564    }
1565}
1566
1567impl CodecStopResponder {
1568    /// Sends a response to the FIDL transaction.
1569    ///
1570    /// Sets the channel to shutdown if an error occurs.
1571    pub fn send(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1572        let _result = self.send_raw(stop_time);
1573        if _result.is_err() {
1574            self.control_handle.shutdown();
1575        }
1576        self.drop_without_shutdown();
1577        _result
1578    }
1579
1580    /// Similar to "send" but does not shutdown the channel if an error occurs.
1581    pub fn send_no_shutdown_on_err(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1582        let _result = self.send_raw(stop_time);
1583        self.drop_without_shutdown();
1584        _result
1585    }
1586
1587    fn send_raw(&self, mut stop_time: i64) -> Result<(), fidl::Error> {
1588        self.control_handle.inner.send::<CodecStopResponse>(
1589            (stop_time,),
1590            self.tx_id,
1591            0x5c2e380df1332dbd,
1592            fidl::encoding::DynamicFlags::empty(),
1593        )
1594    }
1595}
1596
1597#[must_use = "FIDL methods require a response to be sent"]
1598#[derive(Debug)]
1599pub struct CodecStartResponder {
1600    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1601    tx_id: u32,
1602}
1603
1604/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1605/// if the responder is dropped without sending a response, so that the client
1606/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1607impl std::ops::Drop for CodecStartResponder {
1608    fn drop(&mut self) {
1609        self.control_handle.shutdown();
1610        // Safety: drops once, never accessed again
1611        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1612    }
1613}
1614
1615impl fidl::endpoints::Responder for CodecStartResponder {
1616    type ControlHandle = CodecControlHandle;
1617
1618    fn control_handle(&self) -> &CodecControlHandle {
1619        &self.control_handle
1620    }
1621
1622    fn drop_without_shutdown(mut self) {
1623        // Safety: drops once, never accessed again due to mem::forget
1624        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1625        // Prevent Drop from running (which would shut down the channel)
1626        std::mem::forget(self);
1627    }
1628}
1629
1630impl CodecStartResponder {
1631    /// Sends a response to the FIDL transaction.
1632    ///
1633    /// Sets the channel to shutdown if an error occurs.
1634    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
1635        let _result = self.send_raw(start_time);
1636        if _result.is_err() {
1637            self.control_handle.shutdown();
1638        }
1639        self.drop_without_shutdown();
1640        _result
1641    }
1642
1643    /// Similar to "send" but does not shutdown the channel if an error occurs.
1644    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
1645        let _result = self.send_raw(start_time);
1646        self.drop_without_shutdown();
1647        _result
1648    }
1649
1650    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
1651        self.control_handle.inner.send::<CodecStartResponse>(
1652            (start_time,),
1653            self.tx_id,
1654            0x329cdacb286ab00,
1655            fidl::encoding::DynamicFlags::empty(),
1656        )
1657    }
1658}
1659
1660#[must_use = "FIDL methods require a response to be sent"]
1661#[derive(Debug)]
1662pub struct CodecGetDaiFormatsResponder {
1663    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1664    tx_id: u32,
1665}
1666
1667/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1668/// if the responder is dropped without sending a response, so that the client
1669/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1670impl std::ops::Drop for CodecGetDaiFormatsResponder {
1671    fn drop(&mut self) {
1672        self.control_handle.shutdown();
1673        // Safety: drops once, never accessed again
1674        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1675    }
1676}
1677
1678impl fidl::endpoints::Responder for CodecGetDaiFormatsResponder {
1679    type ControlHandle = CodecControlHandle;
1680
1681    fn control_handle(&self) -> &CodecControlHandle {
1682        &self.control_handle
1683    }
1684
1685    fn drop_without_shutdown(mut self) {
1686        // Safety: drops once, never accessed again due to mem::forget
1687        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1688        // Prevent Drop from running (which would shut down the channel)
1689        std::mem::forget(self);
1690    }
1691}
1692
1693impl CodecGetDaiFormatsResponder {
1694    /// Sends a response to the FIDL transaction.
1695    ///
1696    /// Sets the channel to shutdown if an error occurs.
1697    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1698        let _result = self.send_raw(result);
1699        if _result.is_err() {
1700            self.control_handle.shutdown();
1701        }
1702        self.drop_without_shutdown();
1703        _result
1704    }
1705
1706    /// Similar to "send" but does not shutdown the channel if an error occurs.
1707    pub fn send_no_shutdown_on_err(
1708        self,
1709        mut result: Result<&[DaiSupportedFormats], i32>,
1710    ) -> Result<(), fidl::Error> {
1711        let _result = self.send_raw(result);
1712        self.drop_without_shutdown();
1713        _result
1714    }
1715
1716    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1717        self.control_handle
1718            .inner
1719            .send::<fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>>(
1720                result.map(|formats| (formats,)),
1721                self.tx_id,
1722                0xf8bbc46b4ba6a52,
1723                fidl::encoding::DynamicFlags::empty(),
1724            )
1725    }
1726}
1727
1728#[must_use = "FIDL methods require a response to be sent"]
1729#[derive(Debug)]
1730pub struct CodecSetDaiFormatResponder {
1731    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1732    tx_id: u32,
1733}
1734
1735/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1736/// if the responder is dropped without sending a response, so that the client
1737/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1738impl std::ops::Drop for CodecSetDaiFormatResponder {
1739    fn drop(&mut self) {
1740        self.control_handle.shutdown();
1741        // Safety: drops once, never accessed again
1742        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1743    }
1744}
1745
1746impl fidl::endpoints::Responder for CodecSetDaiFormatResponder {
1747    type ControlHandle = CodecControlHandle;
1748
1749    fn control_handle(&self) -> &CodecControlHandle {
1750        &self.control_handle
1751    }
1752
1753    fn drop_without_shutdown(mut self) {
1754        // Safety: drops once, never accessed again due to mem::forget
1755        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1756        // Prevent Drop from running (which would shut down the channel)
1757        std::mem::forget(self);
1758    }
1759}
1760
1761impl CodecSetDaiFormatResponder {
1762    /// Sends a response to the FIDL transaction.
1763    ///
1764    /// Sets the channel to shutdown if an error occurs.
1765    pub fn send(self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1766        let _result = self.send_raw(result);
1767        if _result.is_err() {
1768            self.control_handle.shutdown();
1769        }
1770        self.drop_without_shutdown();
1771        _result
1772    }
1773
1774    /// Similar to "send" but does not shutdown the channel if an error occurs.
1775    pub fn send_no_shutdown_on_err(
1776        self,
1777        mut result: Result<&CodecFormatInfo, i32>,
1778    ) -> Result<(), fidl::Error> {
1779        let _result = self.send_raw(result);
1780        self.drop_without_shutdown();
1781        _result
1782    }
1783
1784    fn send_raw(&self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1785        self.control_handle
1786            .inner
1787            .send::<fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>>(
1788                result.map(|state| (state,)),
1789                self.tx_id,
1790                0x2f829df9e5a7a1ea,
1791                fidl::encoding::DynamicFlags::empty(),
1792            )
1793    }
1794}
1795
1796#[must_use = "FIDL methods require a response to be sent"]
1797#[derive(Debug)]
1798pub struct CodecWatchPlugStateResponder {
1799    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1800    tx_id: u32,
1801}
1802
1803/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1804/// if the responder is dropped without sending a response, so that the client
1805/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1806impl std::ops::Drop for CodecWatchPlugStateResponder {
1807    fn drop(&mut self) {
1808        self.control_handle.shutdown();
1809        // Safety: drops once, never accessed again
1810        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1811    }
1812}
1813
1814impl fidl::endpoints::Responder for CodecWatchPlugStateResponder {
1815    type ControlHandle = CodecControlHandle;
1816
1817    fn control_handle(&self) -> &CodecControlHandle {
1818        &self.control_handle
1819    }
1820
1821    fn drop_without_shutdown(mut self) {
1822        // Safety: drops once, never accessed again due to mem::forget
1823        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1824        // Prevent Drop from running (which would shut down the channel)
1825        std::mem::forget(self);
1826    }
1827}
1828
1829impl CodecWatchPlugStateResponder {
1830    /// Sends a response to the FIDL transaction.
1831    ///
1832    /// Sets the channel to shutdown if an error occurs.
1833    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1834        let _result = self.send_raw(plug_state);
1835        if _result.is_err() {
1836            self.control_handle.shutdown();
1837        }
1838        self.drop_without_shutdown();
1839        _result
1840    }
1841
1842    /// Similar to "send" but does not shutdown the channel if an error occurs.
1843    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1844        let _result = self.send_raw(plug_state);
1845        self.drop_without_shutdown();
1846        _result
1847    }
1848
1849    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1850        self.control_handle.inner.send::<CodecWatchPlugStateResponse>(
1851            (plug_state,),
1852            self.tx_id,
1853            0x182b87f935ca7326,
1854            fidl::encoding::DynamicFlags::empty(),
1855        )
1856    }
1857}
1858
1859#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1860pub struct CodecConnectorMarker;
1861
1862impl fidl::endpoints::ProtocolMarker for CodecConnectorMarker {
1863    type Proxy = CodecConnectorProxy;
1864    type RequestStream = CodecConnectorRequestStream;
1865    #[cfg(target_os = "fuchsia")]
1866    type SynchronousProxy = CodecConnectorSynchronousProxy;
1867
1868    const DEBUG_NAME: &'static str = "(anonymous) CodecConnector";
1869}
1870
1871pub trait CodecConnectorProxyInterface: Send + Sync {
1872    fn r#connect(
1873        &self,
1874        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1875    ) -> Result<(), fidl::Error>;
1876}
1877#[derive(Debug)]
1878#[cfg(target_os = "fuchsia")]
1879pub struct CodecConnectorSynchronousProxy {
1880    client: fidl::client::sync::Client,
1881}
1882
1883#[cfg(target_os = "fuchsia")]
1884impl fidl::endpoints::SynchronousProxy for CodecConnectorSynchronousProxy {
1885    type Proxy = CodecConnectorProxy;
1886    type Protocol = CodecConnectorMarker;
1887
1888    fn from_channel(inner: fidl::Channel) -> Self {
1889        Self::new(inner)
1890    }
1891
1892    fn into_channel(self) -> fidl::Channel {
1893        self.client.into_channel()
1894    }
1895
1896    fn as_channel(&self) -> &fidl::Channel {
1897        self.client.as_channel()
1898    }
1899}
1900
1901#[cfg(target_os = "fuchsia")]
1902impl CodecConnectorSynchronousProxy {
1903    pub fn new(channel: fidl::Channel) -> Self {
1904        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1905        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1906    }
1907
1908    pub fn into_channel(self) -> fidl::Channel {
1909        self.client.into_channel()
1910    }
1911
1912    /// Waits until an event arrives and returns it. It is safe for other
1913    /// threads to make concurrent requests while waiting for an event.
1914    pub fn wait_for_event(
1915        &self,
1916        deadline: zx::MonotonicInstant,
1917    ) -> Result<CodecConnectorEvent, fidl::Error> {
1918        CodecConnectorEvent::decode(self.client.wait_for_event(deadline)?)
1919    }
1920
1921    /// Connect to a Codec protocol server.
1922    /// This indirection into the Codec protocol allows us to support independent codec client
1923    /// connections.
1924    pub fn r#connect(
1925        &self,
1926        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1927    ) -> Result<(), fidl::Error> {
1928        self.client.send::<CodecConnectorConnectRequest>(
1929            (codec_protocol,),
1930            0x1413f551544026c9,
1931            fidl::encoding::DynamicFlags::empty(),
1932        )
1933    }
1934}
1935
1936#[cfg(target_os = "fuchsia")]
1937impl From<CodecConnectorSynchronousProxy> for zx::NullableHandle {
1938    fn from(value: CodecConnectorSynchronousProxy) -> Self {
1939        value.into_channel().into()
1940    }
1941}
1942
1943#[cfg(target_os = "fuchsia")]
1944impl From<fidl::Channel> for CodecConnectorSynchronousProxy {
1945    fn from(value: fidl::Channel) -> Self {
1946        Self::new(value)
1947    }
1948}
1949
1950#[cfg(target_os = "fuchsia")]
1951impl fidl::endpoints::FromClient for CodecConnectorSynchronousProxy {
1952    type Protocol = CodecConnectorMarker;
1953
1954    fn from_client(value: fidl::endpoints::ClientEnd<CodecConnectorMarker>) -> Self {
1955        Self::new(value.into_channel())
1956    }
1957}
1958
1959#[derive(Debug, Clone)]
1960pub struct CodecConnectorProxy {
1961    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1962}
1963
1964impl fidl::endpoints::Proxy for CodecConnectorProxy {
1965    type Protocol = CodecConnectorMarker;
1966
1967    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1968        Self::new(inner)
1969    }
1970
1971    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1972        self.client.into_channel().map_err(|client| Self { client })
1973    }
1974
1975    fn as_channel(&self) -> &::fidl::AsyncChannel {
1976        self.client.as_channel()
1977    }
1978}
1979
1980impl CodecConnectorProxy {
1981    /// Create a new Proxy for fuchsia.hardware.audio/CodecConnector.
1982    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1983        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1984        Self { client: fidl::client::Client::new(channel, protocol_name) }
1985    }
1986
1987    /// Get a Stream of events from the remote end of the protocol.
1988    ///
1989    /// # Panics
1990    ///
1991    /// Panics if the event stream was already taken.
1992    pub fn take_event_stream(&self) -> CodecConnectorEventStream {
1993        CodecConnectorEventStream { event_receiver: self.client.take_event_receiver() }
1994    }
1995
1996    /// Connect to a Codec protocol server.
1997    /// This indirection into the Codec protocol allows us to support independent codec client
1998    /// connections.
1999    pub fn r#connect(
2000        &self,
2001        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2002    ) -> Result<(), fidl::Error> {
2003        CodecConnectorProxyInterface::r#connect(self, codec_protocol)
2004    }
2005}
2006
2007impl CodecConnectorProxyInterface for CodecConnectorProxy {
2008    fn r#connect(
2009        &self,
2010        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2011    ) -> Result<(), fidl::Error> {
2012        self.client.send::<CodecConnectorConnectRequest>(
2013            (codec_protocol,),
2014            0x1413f551544026c9,
2015            fidl::encoding::DynamicFlags::empty(),
2016        )
2017    }
2018}
2019
2020pub struct CodecConnectorEventStream {
2021    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2022}
2023
2024impl std::marker::Unpin for CodecConnectorEventStream {}
2025
2026impl futures::stream::FusedStream for CodecConnectorEventStream {
2027    fn is_terminated(&self) -> bool {
2028        self.event_receiver.is_terminated()
2029    }
2030}
2031
2032impl futures::Stream for CodecConnectorEventStream {
2033    type Item = Result<CodecConnectorEvent, fidl::Error>;
2034
2035    fn poll_next(
2036        mut self: std::pin::Pin<&mut Self>,
2037        cx: &mut std::task::Context<'_>,
2038    ) -> std::task::Poll<Option<Self::Item>> {
2039        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2040            &mut self.event_receiver,
2041            cx
2042        )?) {
2043            Some(buf) => std::task::Poll::Ready(Some(CodecConnectorEvent::decode(buf))),
2044            None => std::task::Poll::Ready(None),
2045        }
2046    }
2047}
2048
2049#[derive(Debug)]
2050pub enum CodecConnectorEvent {}
2051
2052impl CodecConnectorEvent {
2053    /// Decodes a message buffer as a [`CodecConnectorEvent`].
2054    fn decode(
2055        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2056    ) -> Result<CodecConnectorEvent, fidl::Error> {
2057        let (bytes, _handles) = buf.split_mut();
2058        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2059        debug_assert_eq!(tx_header.tx_id, 0);
2060        match tx_header.ordinal {
2061            _ => Err(fidl::Error::UnknownOrdinal {
2062                ordinal: tx_header.ordinal,
2063                protocol_name:
2064                    <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2065            }),
2066        }
2067    }
2068}
2069
2070/// A Stream of incoming requests for fuchsia.hardware.audio/CodecConnector.
2071pub struct CodecConnectorRequestStream {
2072    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2073    is_terminated: bool,
2074}
2075
2076impl std::marker::Unpin for CodecConnectorRequestStream {}
2077
2078impl futures::stream::FusedStream for CodecConnectorRequestStream {
2079    fn is_terminated(&self) -> bool {
2080        self.is_terminated
2081    }
2082}
2083
2084impl fidl::endpoints::RequestStream for CodecConnectorRequestStream {
2085    type Protocol = CodecConnectorMarker;
2086    type ControlHandle = CodecConnectorControlHandle;
2087
2088    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2089        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2090    }
2091
2092    fn control_handle(&self) -> Self::ControlHandle {
2093        CodecConnectorControlHandle { inner: self.inner.clone() }
2094    }
2095
2096    fn into_inner(
2097        self,
2098    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2099    {
2100        (self.inner, self.is_terminated)
2101    }
2102
2103    fn from_inner(
2104        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2105        is_terminated: bool,
2106    ) -> Self {
2107        Self { inner, is_terminated }
2108    }
2109}
2110
2111impl futures::Stream for CodecConnectorRequestStream {
2112    type Item = Result<CodecConnectorRequest, fidl::Error>;
2113
2114    fn poll_next(
2115        mut self: std::pin::Pin<&mut Self>,
2116        cx: &mut std::task::Context<'_>,
2117    ) -> std::task::Poll<Option<Self::Item>> {
2118        let this = &mut *self;
2119        if this.inner.check_shutdown(cx) {
2120            this.is_terminated = true;
2121            return std::task::Poll::Ready(None);
2122        }
2123        if this.is_terminated {
2124            panic!("polled CodecConnectorRequestStream after completion");
2125        }
2126        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2127            |bytes, handles| {
2128                match this.inner.channel().read_etc(cx, bytes, handles) {
2129                    std::task::Poll::Ready(Ok(())) => {}
2130                    std::task::Poll::Pending => return std::task::Poll::Pending,
2131                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2132                        this.is_terminated = true;
2133                        return std::task::Poll::Ready(None);
2134                    }
2135                    std::task::Poll::Ready(Err(e)) => {
2136                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2137                            e.into(),
2138                        ))));
2139                    }
2140                }
2141
2142                // A message has been received from the channel
2143                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2144
2145                std::task::Poll::Ready(Some(match header.ordinal {
2146                    0x1413f551544026c9 => {
2147                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2148                        let mut req = fidl::new_empty!(
2149                            CodecConnectorConnectRequest,
2150                            fidl::encoding::DefaultFuchsiaResourceDialect
2151                        );
2152                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2153                        let control_handle =
2154                            CodecConnectorControlHandle { inner: this.inner.clone() };
2155                        Ok(CodecConnectorRequest::Connect {
2156                            codec_protocol: req.codec_protocol,
2157
2158                            control_handle,
2159                        })
2160                    }
2161                    _ => Err(fidl::Error::UnknownOrdinal {
2162                        ordinal: header.ordinal,
2163                        protocol_name:
2164                            <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2165                    }),
2166                }))
2167            },
2168        )
2169    }
2170}
2171
2172/// For an overview of the Codec protocols see
2173/// [Codec Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_codec.md)
2174/// # Deprecation
2175///
2176/// Not supported anymore, instead use an
2177/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
2178/// with one DAI and no Ring Buffer, see
2179/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
2180#[derive(Debug)]
2181pub enum CodecConnectorRequest {
2182    /// Connect to a Codec protocol server.
2183    /// This indirection into the Codec protocol allows us to support independent codec client
2184    /// connections.
2185    Connect {
2186        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2187        control_handle: CodecConnectorControlHandle,
2188    },
2189}
2190
2191impl CodecConnectorRequest {
2192    #[allow(irrefutable_let_patterns)]
2193    pub fn into_connect(
2194        self,
2195    ) -> Option<(fidl::endpoints::ServerEnd<CodecMarker>, CodecConnectorControlHandle)> {
2196        if let CodecConnectorRequest::Connect { codec_protocol, control_handle } = self {
2197            Some((codec_protocol, control_handle))
2198        } else {
2199            None
2200        }
2201    }
2202
2203    /// Name of the method defined in FIDL
2204    pub fn method_name(&self) -> &'static str {
2205        match *self {
2206            CodecConnectorRequest::Connect { .. } => "connect",
2207        }
2208    }
2209}
2210
2211#[derive(Debug, Clone)]
2212pub struct CodecConnectorControlHandle {
2213    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2214}
2215
2216impl fidl::endpoints::ControlHandle for CodecConnectorControlHandle {
2217    fn shutdown(&self) {
2218        self.inner.shutdown()
2219    }
2220
2221    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2222        self.inner.shutdown_with_epitaph(status)
2223    }
2224
2225    fn is_closed(&self) -> bool {
2226        self.inner.channel().is_closed()
2227    }
2228    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2229        self.inner.channel().on_closed()
2230    }
2231
2232    #[cfg(target_os = "fuchsia")]
2233    fn signal_peer(
2234        &self,
2235        clear_mask: zx::Signals,
2236        set_mask: zx::Signals,
2237    ) -> Result<(), zx_status::Status> {
2238        use fidl::Peered;
2239        self.inner.channel().signal_peer(clear_mask, set_mask)
2240    }
2241}
2242
2243impl CodecConnectorControlHandle {}
2244
2245#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2246pub struct CompositeMarker;
2247
2248impl fidl::endpoints::ProtocolMarker for CompositeMarker {
2249    type Proxy = CompositeProxy;
2250    type RequestStream = CompositeRequestStream;
2251    #[cfg(target_os = "fuchsia")]
2252    type SynchronousProxy = CompositeSynchronousProxy;
2253
2254    const DEBUG_NAME: &'static str = "(anonymous) Composite";
2255}
2256pub type CompositeResetResult = Result<(), DriverError>;
2257pub type CompositeGetRingBufferFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
2258pub type CompositeCreateRingBufferResult = Result<(), DriverError>;
2259pub type CompositeGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, DriverError>;
2260pub type CompositeSetDaiFormatResult = Result<(), DriverError>;
2261pub type CompositeGetPacketStreamFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
2262pub type CompositeCreatePacketStreamResult = Result<(), DriverError>;
2263
2264pub trait CompositeProxyInterface: Send + Sync {
2265    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
2266        + Send;
2267    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
2268    fn r#signal_processing_connect(
2269        &self,
2270        protocol: fidl::endpoints::ServerEnd<
2271            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2272        >,
2273    ) -> Result<(), fidl::Error>;
2274    type ResetResponseFut: std::future::Future<Output = Result<CompositeResetResult, fidl::Error>>
2275        + Send;
2276    fn r#reset(&self) -> Self::ResetResponseFut;
2277    type GetPropertiesResponseFut: std::future::Future<Output = Result<CompositeProperties, fidl::Error>>
2278        + Send;
2279    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
2280    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<CompositeGetRingBufferFormatsResult, fidl::Error>>
2281        + Send;
2282    fn r#get_ring_buffer_formats(
2283        &self,
2284        processing_element_id: u64,
2285    ) -> Self::GetRingBufferFormatsResponseFut;
2286    type CreateRingBufferResponseFut: std::future::Future<Output = Result<CompositeCreateRingBufferResult, fidl::Error>>
2287        + Send;
2288    fn r#create_ring_buffer(
2289        &self,
2290        processing_element_id: u64,
2291        format: &Format2,
2292        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2293    ) -> Self::CreateRingBufferResponseFut;
2294    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CompositeGetDaiFormatsResult, fidl::Error>>
2295        + Send;
2296    fn r#get_dai_formats(&self, processing_element_id: u64) -> Self::GetDaiFormatsResponseFut;
2297    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CompositeSetDaiFormatResult, fidl::Error>>
2298        + Send;
2299    fn r#set_dai_format(
2300        &self,
2301        processing_element_id: u64,
2302        format: &DaiFormat,
2303    ) -> Self::SetDaiFormatResponseFut;
2304    type GetPacketStreamFormatsResponseFut: std::future::Future<Output = Result<CompositeGetPacketStreamFormatsResult, fidl::Error>>
2305        + Send;
2306    fn r#get_packet_stream_formats(
2307        &self,
2308        processing_element_id: u64,
2309    ) -> Self::GetPacketStreamFormatsResponseFut;
2310    type CreatePacketStreamResponseFut: std::future::Future<Output = Result<CompositeCreatePacketStreamResult, fidl::Error>>
2311        + Send;
2312    fn r#create_packet_stream(
2313        &self,
2314        processing_element_id: u64,
2315        format: &Format2,
2316        packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
2317    ) -> Self::CreatePacketStreamResponseFut;
2318}
2319#[derive(Debug)]
2320#[cfg(target_os = "fuchsia")]
2321pub struct CompositeSynchronousProxy {
2322    client: fidl::client::sync::Client,
2323}
2324
2325#[cfg(target_os = "fuchsia")]
2326impl fidl::endpoints::SynchronousProxy for CompositeSynchronousProxy {
2327    type Proxy = CompositeProxy;
2328    type Protocol = CompositeMarker;
2329
2330    fn from_channel(inner: fidl::Channel) -> Self {
2331        Self::new(inner)
2332    }
2333
2334    fn into_channel(self) -> fidl::Channel {
2335        self.client.into_channel()
2336    }
2337
2338    fn as_channel(&self) -> &fidl::Channel {
2339        self.client.as_channel()
2340    }
2341}
2342
2343#[cfg(target_os = "fuchsia")]
2344impl CompositeSynchronousProxy {
2345    pub fn new(channel: fidl::Channel) -> Self {
2346        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2347        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2348    }
2349
2350    pub fn into_channel(self) -> fidl::Channel {
2351        self.client.into_channel()
2352    }
2353
2354    /// Waits until an event arrives and returns it. It is safe for other
2355    /// threads to make concurrent requests while waiting for an event.
2356    pub fn wait_for_event(
2357        &self,
2358        deadline: zx::MonotonicInstant,
2359    ) -> Result<CompositeEvent, fidl::Error> {
2360        CompositeEvent::decode(self.client.wait_for_event(deadline)?)
2361    }
2362
2363    /// Retrieves top level health state.
2364    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2365    pub fn r#get_health_state(
2366        &self,
2367        ___deadline: zx::MonotonicInstant,
2368    ) -> Result<HealthState, fidl::Error> {
2369        let _response =
2370            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
2371                (),
2372                0x4e146d6bca733a84,
2373                fidl::encoding::DynamicFlags::empty(),
2374                ___deadline,
2375            )?;
2376        Ok(_response.state)
2377    }
2378
2379    /// Connect to a `SignalProcessing` protocol.
2380    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2381    /// the maximum number of connections have already been created, for instance one, then the
2382    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2383    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2384    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2385    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2386    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2387    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2388    /// is intended to be composed, and hence the more verbose name allows differentiation and
2389    /// improved clarity.
2390    pub fn r#signal_processing_connect(
2391        &self,
2392        mut protocol: fidl::endpoints::ServerEnd<
2393            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2394        >,
2395    ) -> Result<(), fidl::Error> {
2396        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2397            (protocol,),
2398            0xa81907ce6066295,
2399            fidl::encoding::DynamicFlags::empty(),
2400        )
2401    }
2402
2403    /// Resets the hardware including all DAI interconnects and signal processing.
2404    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2405    ///
2406    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2407    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2408    /// any processing elements, and reconstruct any ring buffers.
2409    ///
2410    /// If the driver can't successfully reset the hardware, it will return an error and then close
2411    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2412    pub fn r#reset(
2413        &self,
2414        ___deadline: zx::MonotonicInstant,
2415    ) -> Result<CompositeResetResult, fidl::Error> {
2416        let _response = self.client.send_query::<
2417            fidl::encoding::EmptyPayload,
2418            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2419        >(
2420            (),
2421            0xac355fb98341996,
2422            fidl::encoding::DynamicFlags::FLEXIBLE,
2423            ___deadline,
2424        )?
2425        .into_result::<CompositeMarker>("reset")?;
2426        Ok(_response.map(|x| x))
2427    }
2428
2429    /// Retrieves top level static properties.
2430    pub fn r#get_properties(
2431        &self,
2432        ___deadline: zx::MonotonicInstant,
2433    ) -> Result<CompositeProperties, fidl::Error> {
2434        let _response = self.client.send_query::<
2435            fidl::encoding::EmptyPayload,
2436            fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>,
2437        >(
2438            (),
2439            0x31846fa0a459942b,
2440            fidl::encoding::DynamicFlags::FLEXIBLE,
2441            ___deadline,
2442        )?
2443        .into_result::<CompositeMarker>("get_properties")?;
2444        Ok(_response.properties)
2445    }
2446
2447    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2448    /// in the topology supported by this driver as returned by `GetElements` from
2449    /// fuchsia.hardware.audio.signalprocessing.
2450    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2451    /// client may retry at a later time.
2452    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2453    /// by `GetElements`.
2454    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2455    /// `RING_BUFFER`.
2456    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2457    /// the parameters in `SupportedFormats2` may be supported.
2458    /// The vector returned to the caller must contain at least one entry.
2459    pub fn r#get_ring_buffer_formats(
2460        &self,
2461        mut processing_element_id: u64,
2462        ___deadline: zx::MonotonicInstant,
2463    ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2464        let _response = self.client.send_query::<
2465            CompositeGetRingBufferFormatsRequest,
2466            fidl::encoding::FlexibleResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2467        >(
2468            (processing_element_id,),
2469            0x1d89b701b6816ac4,
2470            fidl::encoding::DynamicFlags::FLEXIBLE,
2471            ___deadline,
2472        )?
2473        .into_result::<CompositeMarker>("get_ring_buffer_formats")?;
2474        Ok(_response.map(|x| x.ring_buffer_formats))
2475    }
2476
2477    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2478    /// processing element specified by `processing_element_id`. The format is based on information
2479    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2480    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2481    /// audio buffer provided by the driver.
2482    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2483    /// by `GetElements`.
2484    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2485    /// `RING_BUFFER`.
2486    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2487    /// `format` is not supported.
2488    pub fn r#create_ring_buffer(
2489        &self,
2490        mut processing_element_id: u64,
2491        mut format: &Format2,
2492        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2493        ___deadline: zx::MonotonicInstant,
2494    ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2495        let _response = self.client.send_query::<
2496            CompositeCreateRingBufferRequest,
2497            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2498        >(
2499            (processing_element_id, format, ring_buffer,),
2500            0x28c5685f85262033,
2501            fidl::encoding::DynamicFlags::FLEXIBLE,
2502            ___deadline,
2503        )?
2504        .into_result::<CompositeMarker>("create_ring_buffer")?;
2505        Ok(_response.map(|x| x))
2506    }
2507
2508    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2509    /// in the topology supported by this driver as returned by `GetElements` from
2510    /// fuchsia.hardware.audio.signalprocessing.
2511    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2512    /// may retry at a later time.
2513    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2514    /// by `GetElements`.
2515    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2516    /// `DAI_INTERCONNECT`.
2517    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2518    /// the parameters in DaiSupportedFormats may be supported.
2519    /// The vector returned to the caller must contain at least one entry.
2520    pub fn r#get_dai_formats(
2521        &self,
2522        mut processing_element_id: u64,
2523        ___deadline: zx::MonotonicInstant,
2524    ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2525        let _response = self.client.send_query::<
2526            CompositeGetDaiFormatsRequest,
2527            fidl::encoding::FlexibleResultType<CompositeGetDaiFormatsResponse, DriverError>,
2528        >(
2529            (processing_element_id,),
2530            0x3cbeaed59c8f69b,
2531            fidl::encoding::DynamicFlags::FLEXIBLE,
2532            ___deadline,
2533        )?
2534        .into_result::<CompositeMarker>("get_dai_formats")?;
2535        Ok(_response.map(|x| x.dai_formats))
2536    }
2537
2538    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2539    /// processing element specified by `processing_element_id`. The format is based on information
2540    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2541    /// requirement.
2542    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2543    /// by `GetElements`.
2544    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2545    /// `DAI_INTERCONNECT`.
2546    pub fn r#set_dai_format(
2547        &self,
2548        mut processing_element_id: u64,
2549        mut format: &DaiFormat,
2550        ___deadline: zx::MonotonicInstant,
2551    ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2552        let _response = self.client.send_query::<
2553            CompositeSetDaiFormatRequest,
2554            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2555        >(
2556            (processing_element_id, format,),
2557            0x155acf5cc0dc8a84,
2558            fidl::encoding::DynamicFlags::FLEXIBLE,
2559            ___deadline,
2560        )?
2561        .into_result::<CompositeMarker>("set_dai_format")?;
2562        Ok(_response.map(|x| x))
2563    }
2564
2565    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2566    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2567    /// from fuchsia.hardware.audio.signalprocessing.
2568    ///
2569    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2570    /// client may retry this request at a later time.
2571    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2572    /// `GetElements`.
2573    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2574    /// `PACKET_STREAM`.
2575    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2576    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2577    /// combinations of the parameters in `SupportedFormats2` may be supported.
2578    /// The vector returned to the caller must contain at least one entry.
2579    pub fn r#get_packet_stream_formats(
2580        &self,
2581        mut processing_element_id: u64,
2582        ___deadline: zx::MonotonicInstant,
2583    ) -> Result<CompositeGetPacketStreamFormatsResult, fidl::Error> {
2584        let _response = self.client.send_query::<
2585            CompositeGetPacketStreamFormatsRequest,
2586            fidl::encoding::FlexibleResultType<CompositeGetPacketStreamFormatsResponse, DriverError>,
2587        >(
2588            (processing_element_id,),
2589            0x73cc47c6ad39bca7,
2590            fidl::encoding::DynamicFlags::FLEXIBLE,
2591            ___deadline,
2592        )?
2593        .into_result::<CompositeMarker>("get_packet_stream_formats")?;
2594        Ok(_response.map(|x| x.packet_stream_formats))
2595    }
2596
2597    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2598    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
2599    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
2600    /// the client, and any other requirement. The returned `packet_stream` channel is used to
2601    /// access and control the packet stream protocol served by the driver.
2602    ///
2603    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2604    /// `GetElements`.
2605    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2606    /// `PACKET_STREAM`.
2607    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2608    /// at this time, but it should be able to at some future time. This request can be retried.
2609    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2610    ///`format` is not supported.
2611    pub fn r#create_packet_stream(
2612        &self,
2613        mut processing_element_id: u64,
2614        mut format: &Format2,
2615        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
2616        ___deadline: zx::MonotonicInstant,
2617    ) -> Result<CompositeCreatePacketStreamResult, fidl::Error> {
2618        let _response = self.client.send_query::<
2619            CompositeCreatePacketStreamRequest,
2620            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2621        >(
2622            (processing_element_id, format, packet_stream_control,),
2623            0x50e8902b756c707c,
2624            fidl::encoding::DynamicFlags::FLEXIBLE,
2625            ___deadline,
2626        )?
2627        .into_result::<CompositeMarker>("create_packet_stream")?;
2628        Ok(_response.map(|x| x))
2629    }
2630}
2631
2632#[cfg(target_os = "fuchsia")]
2633impl From<CompositeSynchronousProxy> for zx::NullableHandle {
2634    fn from(value: CompositeSynchronousProxy) -> Self {
2635        value.into_channel().into()
2636    }
2637}
2638
2639#[cfg(target_os = "fuchsia")]
2640impl From<fidl::Channel> for CompositeSynchronousProxy {
2641    fn from(value: fidl::Channel) -> Self {
2642        Self::new(value)
2643    }
2644}
2645
2646#[cfg(target_os = "fuchsia")]
2647impl fidl::endpoints::FromClient for CompositeSynchronousProxy {
2648    type Protocol = CompositeMarker;
2649
2650    fn from_client(value: fidl::endpoints::ClientEnd<CompositeMarker>) -> Self {
2651        Self::new(value.into_channel())
2652    }
2653}
2654
2655#[derive(Debug, Clone)]
2656pub struct CompositeProxy {
2657    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2658}
2659
2660impl fidl::endpoints::Proxy for CompositeProxy {
2661    type Protocol = CompositeMarker;
2662
2663    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2664        Self::new(inner)
2665    }
2666
2667    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2668        self.client.into_channel().map_err(|client| Self { client })
2669    }
2670
2671    fn as_channel(&self) -> &::fidl::AsyncChannel {
2672        self.client.as_channel()
2673    }
2674}
2675
2676impl CompositeProxy {
2677    /// Create a new Proxy for fuchsia.hardware.audio/Composite.
2678    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2679        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2680        Self { client: fidl::client::Client::new(channel, protocol_name) }
2681    }
2682
2683    /// Get a Stream of events from the remote end of the protocol.
2684    ///
2685    /// # Panics
2686    ///
2687    /// Panics if the event stream was already taken.
2688    pub fn take_event_stream(&self) -> CompositeEventStream {
2689        CompositeEventStream { event_receiver: self.client.take_event_receiver() }
2690    }
2691
2692    /// Retrieves top level health state.
2693    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2694    pub fn r#get_health_state(
2695        &self,
2696    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
2697    {
2698        CompositeProxyInterface::r#get_health_state(self)
2699    }
2700
2701    /// Connect to a `SignalProcessing` protocol.
2702    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2703    /// the maximum number of connections have already been created, for instance one, then the
2704    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2705    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2706    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2707    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2708    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2709    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2710    /// is intended to be composed, and hence the more verbose name allows differentiation and
2711    /// improved clarity.
2712    pub fn r#signal_processing_connect(
2713        &self,
2714        mut protocol: fidl::endpoints::ServerEnd<
2715            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2716        >,
2717    ) -> Result<(), fidl::Error> {
2718        CompositeProxyInterface::r#signal_processing_connect(self, protocol)
2719    }
2720
2721    /// Resets the hardware including all DAI interconnects and signal processing.
2722    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2723    ///
2724    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2725    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2726    /// any processing elements, and reconstruct any ring buffers.
2727    ///
2728    /// If the driver can't successfully reset the hardware, it will return an error and then close
2729    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2730    pub fn r#reset(
2731        &self,
2732    ) -> fidl::client::QueryResponseFut<
2733        CompositeResetResult,
2734        fidl::encoding::DefaultFuchsiaResourceDialect,
2735    > {
2736        CompositeProxyInterface::r#reset(self)
2737    }
2738
2739    /// Retrieves top level static properties.
2740    pub fn r#get_properties(
2741        &self,
2742    ) -> fidl::client::QueryResponseFut<
2743        CompositeProperties,
2744        fidl::encoding::DefaultFuchsiaResourceDialect,
2745    > {
2746        CompositeProxyInterface::r#get_properties(self)
2747    }
2748
2749    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2750    /// in the topology supported by this driver as returned by `GetElements` from
2751    /// fuchsia.hardware.audio.signalprocessing.
2752    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2753    /// client may retry at a later time.
2754    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2755    /// by `GetElements`.
2756    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2757    /// `RING_BUFFER`.
2758    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2759    /// the parameters in `SupportedFormats2` may be supported.
2760    /// The vector returned to the caller must contain at least one entry.
2761    pub fn r#get_ring_buffer_formats(
2762        &self,
2763        mut processing_element_id: u64,
2764    ) -> fidl::client::QueryResponseFut<
2765        CompositeGetRingBufferFormatsResult,
2766        fidl::encoding::DefaultFuchsiaResourceDialect,
2767    > {
2768        CompositeProxyInterface::r#get_ring_buffer_formats(self, processing_element_id)
2769    }
2770
2771    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2772    /// processing element specified by `processing_element_id`. The format is based on information
2773    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2774    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2775    /// audio buffer provided by the driver.
2776    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2777    /// by `GetElements`.
2778    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2779    /// `RING_BUFFER`.
2780    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2781    /// `format` is not supported.
2782    pub fn r#create_ring_buffer(
2783        &self,
2784        mut processing_element_id: u64,
2785        mut format: &Format2,
2786        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2787    ) -> fidl::client::QueryResponseFut<
2788        CompositeCreateRingBufferResult,
2789        fidl::encoding::DefaultFuchsiaResourceDialect,
2790    > {
2791        CompositeProxyInterface::r#create_ring_buffer(
2792            self,
2793            processing_element_id,
2794            format,
2795            ring_buffer,
2796        )
2797    }
2798
2799    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2800    /// in the topology supported by this driver as returned by `GetElements` from
2801    /// fuchsia.hardware.audio.signalprocessing.
2802    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2803    /// may retry at a later time.
2804    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2805    /// by `GetElements`.
2806    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2807    /// `DAI_INTERCONNECT`.
2808    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2809    /// the parameters in DaiSupportedFormats may be supported.
2810    /// The vector returned to the caller must contain at least one entry.
2811    pub fn r#get_dai_formats(
2812        &self,
2813        mut processing_element_id: u64,
2814    ) -> fidl::client::QueryResponseFut<
2815        CompositeGetDaiFormatsResult,
2816        fidl::encoding::DefaultFuchsiaResourceDialect,
2817    > {
2818        CompositeProxyInterface::r#get_dai_formats(self, processing_element_id)
2819    }
2820
2821    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2822    /// processing element specified by `processing_element_id`. The format is based on information
2823    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2824    /// requirement.
2825    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2826    /// by `GetElements`.
2827    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2828    /// `DAI_INTERCONNECT`.
2829    pub fn r#set_dai_format(
2830        &self,
2831        mut processing_element_id: u64,
2832        mut format: &DaiFormat,
2833    ) -> fidl::client::QueryResponseFut<
2834        CompositeSetDaiFormatResult,
2835        fidl::encoding::DefaultFuchsiaResourceDialect,
2836    > {
2837        CompositeProxyInterface::r#set_dai_format(self, processing_element_id, format)
2838    }
2839
2840    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2841    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2842    /// from fuchsia.hardware.audio.signalprocessing.
2843    ///
2844    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2845    /// client may retry this request at a later time.
2846    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2847    /// `GetElements`.
2848    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2849    /// `PACKET_STREAM`.
2850    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2851    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2852    /// combinations of the parameters in `SupportedFormats2` may be supported.
2853    /// The vector returned to the caller must contain at least one entry.
2854    pub fn r#get_packet_stream_formats(
2855        &self,
2856        mut processing_element_id: u64,
2857    ) -> fidl::client::QueryResponseFut<
2858        CompositeGetPacketStreamFormatsResult,
2859        fidl::encoding::DefaultFuchsiaResourceDialect,
2860    > {
2861        CompositeProxyInterface::r#get_packet_stream_formats(self, processing_element_id)
2862    }
2863
2864    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2865    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
2866    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
2867    /// the client, and any other requirement. The returned `packet_stream` channel is used to
2868    /// access and control the packet stream protocol served by the driver.
2869    ///
2870    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2871    /// `GetElements`.
2872    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2873    /// `PACKET_STREAM`.
2874    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2875    /// at this time, but it should be able to at some future time. This request can be retried.
2876    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2877    ///`format` is not supported.
2878    pub fn r#create_packet_stream(
2879        &self,
2880        mut processing_element_id: u64,
2881        mut format: &Format2,
2882        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
2883    ) -> fidl::client::QueryResponseFut<
2884        CompositeCreatePacketStreamResult,
2885        fidl::encoding::DefaultFuchsiaResourceDialect,
2886    > {
2887        CompositeProxyInterface::r#create_packet_stream(
2888            self,
2889            processing_element_id,
2890            format,
2891            packet_stream_control,
2892        )
2893    }
2894}
2895
2896impl CompositeProxyInterface for CompositeProxy {
2897    type GetHealthStateResponseFut =
2898        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
2899    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
2900        fn _decode(
2901            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2902        ) -> Result<HealthState, fidl::Error> {
2903            let _response = fidl::client::decode_transaction_body::<
2904                HealthGetHealthStateResponse,
2905                fidl::encoding::DefaultFuchsiaResourceDialect,
2906                0x4e146d6bca733a84,
2907            >(_buf?)?;
2908            Ok(_response.state)
2909        }
2910        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
2911            (),
2912            0x4e146d6bca733a84,
2913            fidl::encoding::DynamicFlags::empty(),
2914            _decode,
2915        )
2916    }
2917
2918    fn r#signal_processing_connect(
2919        &self,
2920        mut protocol: fidl::endpoints::ServerEnd<
2921            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2922        >,
2923    ) -> Result<(), fidl::Error> {
2924        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2925            (protocol,),
2926            0xa81907ce6066295,
2927            fidl::encoding::DynamicFlags::empty(),
2928        )
2929    }
2930
2931    type ResetResponseFut = fidl::client::QueryResponseFut<
2932        CompositeResetResult,
2933        fidl::encoding::DefaultFuchsiaResourceDialect,
2934    >;
2935    fn r#reset(&self) -> Self::ResetResponseFut {
2936        fn _decode(
2937            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2938        ) -> Result<CompositeResetResult, fidl::Error> {
2939            let _response = fidl::client::decode_transaction_body::<
2940                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2941                fidl::encoding::DefaultFuchsiaResourceDialect,
2942                0xac355fb98341996,
2943            >(_buf?)?
2944            .into_result::<CompositeMarker>("reset")?;
2945            Ok(_response.map(|x| x))
2946        }
2947        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeResetResult>(
2948            (),
2949            0xac355fb98341996,
2950            fidl::encoding::DynamicFlags::FLEXIBLE,
2951            _decode,
2952        )
2953    }
2954
2955    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2956        CompositeProperties,
2957        fidl::encoding::DefaultFuchsiaResourceDialect,
2958    >;
2959    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2960        fn _decode(
2961            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2962        ) -> Result<CompositeProperties, fidl::Error> {
2963            let _response = fidl::client::decode_transaction_body::<
2964                fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>,
2965                fidl::encoding::DefaultFuchsiaResourceDialect,
2966                0x31846fa0a459942b,
2967            >(_buf?)?
2968            .into_result::<CompositeMarker>("get_properties")?;
2969            Ok(_response.properties)
2970        }
2971        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeProperties>(
2972            (),
2973            0x31846fa0a459942b,
2974            fidl::encoding::DynamicFlags::FLEXIBLE,
2975            _decode,
2976        )
2977    }
2978
2979    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
2980        CompositeGetRingBufferFormatsResult,
2981        fidl::encoding::DefaultFuchsiaResourceDialect,
2982    >;
2983    fn r#get_ring_buffer_formats(
2984        &self,
2985        mut processing_element_id: u64,
2986    ) -> Self::GetRingBufferFormatsResponseFut {
2987        fn _decode(
2988            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2989        ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2990            let _response = fidl::client::decode_transaction_body::<
2991                fidl::encoding::FlexibleResultType<
2992                    CompositeGetRingBufferFormatsResponse,
2993                    DriverError,
2994                >,
2995                fidl::encoding::DefaultFuchsiaResourceDialect,
2996                0x1d89b701b6816ac4,
2997            >(_buf?)?
2998            .into_result::<CompositeMarker>("get_ring_buffer_formats")?;
2999            Ok(_response.map(|x| x.ring_buffer_formats))
3000        }
3001        self.client.send_query_and_decode::<
3002            CompositeGetRingBufferFormatsRequest,
3003            CompositeGetRingBufferFormatsResult,
3004        >(
3005            (processing_element_id,),
3006            0x1d89b701b6816ac4,
3007            fidl::encoding::DynamicFlags::FLEXIBLE,
3008            _decode,
3009        )
3010    }
3011
3012    type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
3013        CompositeCreateRingBufferResult,
3014        fidl::encoding::DefaultFuchsiaResourceDialect,
3015    >;
3016    fn r#create_ring_buffer(
3017        &self,
3018        mut processing_element_id: u64,
3019        mut format: &Format2,
3020        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3021    ) -> Self::CreateRingBufferResponseFut {
3022        fn _decode(
3023            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3024        ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
3025            let _response = fidl::client::decode_transaction_body::<
3026                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3027                fidl::encoding::DefaultFuchsiaResourceDialect,
3028                0x28c5685f85262033,
3029            >(_buf?)?
3030            .into_result::<CompositeMarker>("create_ring_buffer")?;
3031            Ok(_response.map(|x| x))
3032        }
3033        self.client.send_query_and_decode::<
3034            CompositeCreateRingBufferRequest,
3035            CompositeCreateRingBufferResult,
3036        >(
3037            (processing_element_id, format, ring_buffer,),
3038            0x28c5685f85262033,
3039            fidl::encoding::DynamicFlags::FLEXIBLE,
3040            _decode,
3041        )
3042    }
3043
3044    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
3045        CompositeGetDaiFormatsResult,
3046        fidl::encoding::DefaultFuchsiaResourceDialect,
3047    >;
3048    fn r#get_dai_formats(&self, mut processing_element_id: u64) -> Self::GetDaiFormatsResponseFut {
3049        fn _decode(
3050            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3051        ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
3052            let _response = fidl::client::decode_transaction_body::<
3053                fidl::encoding::FlexibleResultType<CompositeGetDaiFormatsResponse, DriverError>,
3054                fidl::encoding::DefaultFuchsiaResourceDialect,
3055                0x3cbeaed59c8f69b,
3056            >(_buf?)?
3057            .into_result::<CompositeMarker>("get_dai_formats")?;
3058            Ok(_response.map(|x| x.dai_formats))
3059        }
3060        self.client
3061            .send_query_and_decode::<CompositeGetDaiFormatsRequest, CompositeGetDaiFormatsResult>(
3062                (processing_element_id,),
3063                0x3cbeaed59c8f69b,
3064                fidl::encoding::DynamicFlags::FLEXIBLE,
3065                _decode,
3066            )
3067    }
3068
3069    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
3070        CompositeSetDaiFormatResult,
3071        fidl::encoding::DefaultFuchsiaResourceDialect,
3072    >;
3073    fn r#set_dai_format(
3074        &self,
3075        mut processing_element_id: u64,
3076        mut format: &DaiFormat,
3077    ) -> Self::SetDaiFormatResponseFut {
3078        fn _decode(
3079            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3080        ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
3081            let _response = fidl::client::decode_transaction_body::<
3082                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3083                fidl::encoding::DefaultFuchsiaResourceDialect,
3084                0x155acf5cc0dc8a84,
3085            >(_buf?)?
3086            .into_result::<CompositeMarker>("set_dai_format")?;
3087            Ok(_response.map(|x| x))
3088        }
3089        self.client
3090            .send_query_and_decode::<CompositeSetDaiFormatRequest, CompositeSetDaiFormatResult>(
3091                (processing_element_id, format),
3092                0x155acf5cc0dc8a84,
3093                fidl::encoding::DynamicFlags::FLEXIBLE,
3094                _decode,
3095            )
3096    }
3097
3098    type GetPacketStreamFormatsResponseFut = fidl::client::QueryResponseFut<
3099        CompositeGetPacketStreamFormatsResult,
3100        fidl::encoding::DefaultFuchsiaResourceDialect,
3101    >;
3102    fn r#get_packet_stream_formats(
3103        &self,
3104        mut processing_element_id: u64,
3105    ) -> Self::GetPacketStreamFormatsResponseFut {
3106        fn _decode(
3107            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3108        ) -> Result<CompositeGetPacketStreamFormatsResult, fidl::Error> {
3109            let _response = fidl::client::decode_transaction_body::<
3110                fidl::encoding::FlexibleResultType<
3111                    CompositeGetPacketStreamFormatsResponse,
3112                    DriverError,
3113                >,
3114                fidl::encoding::DefaultFuchsiaResourceDialect,
3115                0x73cc47c6ad39bca7,
3116            >(_buf?)?
3117            .into_result::<CompositeMarker>("get_packet_stream_formats")?;
3118            Ok(_response.map(|x| x.packet_stream_formats))
3119        }
3120        self.client.send_query_and_decode::<
3121            CompositeGetPacketStreamFormatsRequest,
3122            CompositeGetPacketStreamFormatsResult,
3123        >(
3124            (processing_element_id,),
3125            0x73cc47c6ad39bca7,
3126            fidl::encoding::DynamicFlags::FLEXIBLE,
3127            _decode,
3128        )
3129    }
3130
3131    type CreatePacketStreamResponseFut = fidl::client::QueryResponseFut<
3132        CompositeCreatePacketStreamResult,
3133        fidl::encoding::DefaultFuchsiaResourceDialect,
3134    >;
3135    fn r#create_packet_stream(
3136        &self,
3137        mut processing_element_id: u64,
3138        mut format: &Format2,
3139        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3140    ) -> Self::CreatePacketStreamResponseFut {
3141        fn _decode(
3142            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3143        ) -> Result<CompositeCreatePacketStreamResult, fidl::Error> {
3144            let _response = fidl::client::decode_transaction_body::<
3145                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3146                fidl::encoding::DefaultFuchsiaResourceDialect,
3147                0x50e8902b756c707c,
3148            >(_buf?)?
3149            .into_result::<CompositeMarker>("create_packet_stream")?;
3150            Ok(_response.map(|x| x))
3151        }
3152        self.client.send_query_and_decode::<
3153            CompositeCreatePacketStreamRequest,
3154            CompositeCreatePacketStreamResult,
3155        >(
3156            (processing_element_id, format, packet_stream_control,),
3157            0x50e8902b756c707c,
3158            fidl::encoding::DynamicFlags::FLEXIBLE,
3159            _decode,
3160        )
3161    }
3162}
3163
3164pub struct CompositeEventStream {
3165    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3166}
3167
3168impl std::marker::Unpin for CompositeEventStream {}
3169
3170impl futures::stream::FusedStream for CompositeEventStream {
3171    fn is_terminated(&self) -> bool {
3172        self.event_receiver.is_terminated()
3173    }
3174}
3175
3176impl futures::Stream for CompositeEventStream {
3177    type Item = Result<CompositeEvent, fidl::Error>;
3178
3179    fn poll_next(
3180        mut self: std::pin::Pin<&mut Self>,
3181        cx: &mut std::task::Context<'_>,
3182    ) -> std::task::Poll<Option<Self::Item>> {
3183        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3184            &mut self.event_receiver,
3185            cx
3186        )?) {
3187            Some(buf) => std::task::Poll::Ready(Some(CompositeEvent::decode(buf))),
3188            None => std::task::Poll::Ready(None),
3189        }
3190    }
3191}
3192
3193#[derive(Debug)]
3194pub enum CompositeEvent {
3195    #[non_exhaustive]
3196    _UnknownEvent {
3197        /// Ordinal of the event that was sent.
3198        ordinal: u64,
3199    },
3200}
3201
3202impl CompositeEvent {
3203    /// Decodes a message buffer as a [`CompositeEvent`].
3204    fn decode(
3205        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3206    ) -> Result<CompositeEvent, fidl::Error> {
3207        let (bytes, _handles) = buf.split_mut();
3208        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3209        debug_assert_eq!(tx_header.tx_id, 0);
3210        match tx_header.ordinal {
3211            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3212                Ok(CompositeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3213            }
3214            _ => Err(fidl::Error::UnknownOrdinal {
3215                ordinal: tx_header.ordinal,
3216                protocol_name: <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3217            }),
3218        }
3219    }
3220}
3221
3222/// A Stream of incoming requests for fuchsia.hardware.audio/Composite.
3223pub struct CompositeRequestStream {
3224    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3225    is_terminated: bool,
3226}
3227
3228impl std::marker::Unpin for CompositeRequestStream {}
3229
3230impl futures::stream::FusedStream for CompositeRequestStream {
3231    fn is_terminated(&self) -> bool {
3232        self.is_terminated
3233    }
3234}
3235
3236impl fidl::endpoints::RequestStream for CompositeRequestStream {
3237    type Protocol = CompositeMarker;
3238    type ControlHandle = CompositeControlHandle;
3239
3240    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3241        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3242    }
3243
3244    fn control_handle(&self) -> Self::ControlHandle {
3245        CompositeControlHandle { inner: self.inner.clone() }
3246    }
3247
3248    fn into_inner(
3249        self,
3250    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3251    {
3252        (self.inner, self.is_terminated)
3253    }
3254
3255    fn from_inner(
3256        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3257        is_terminated: bool,
3258    ) -> Self {
3259        Self { inner, is_terminated }
3260    }
3261}
3262
3263impl futures::Stream for CompositeRequestStream {
3264    type Item = Result<CompositeRequest, fidl::Error>;
3265
3266    fn poll_next(
3267        mut self: std::pin::Pin<&mut Self>,
3268        cx: &mut std::task::Context<'_>,
3269    ) -> std::task::Poll<Option<Self::Item>> {
3270        let this = &mut *self;
3271        if this.inner.check_shutdown(cx) {
3272            this.is_terminated = true;
3273            return std::task::Poll::Ready(None);
3274        }
3275        if this.is_terminated {
3276            panic!("polled CompositeRequestStream after completion");
3277        }
3278        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3279            |bytes, handles| {
3280                match this.inner.channel().read_etc(cx, bytes, handles) {
3281                    std::task::Poll::Ready(Ok(())) => {}
3282                    std::task::Poll::Pending => return std::task::Poll::Pending,
3283                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3284                        this.is_terminated = true;
3285                        return std::task::Poll::Ready(None);
3286                    }
3287                    std::task::Poll::Ready(Err(e)) => {
3288                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3289                            e.into(),
3290                        ))));
3291                    }
3292                }
3293
3294                // A message has been received from the channel
3295                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3296
3297                std::task::Poll::Ready(Some(match header.ordinal {
3298                    0x4e146d6bca733a84 => {
3299                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3300                        let mut req = fidl::new_empty!(
3301                            fidl::encoding::EmptyPayload,
3302                            fidl::encoding::DefaultFuchsiaResourceDialect
3303                        );
3304                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3305                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3306                        Ok(CompositeRequest::GetHealthState {
3307                            responder: CompositeGetHealthStateResponder {
3308                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3309                                tx_id: header.tx_id,
3310                            },
3311                        })
3312                    }
3313                    0xa81907ce6066295 => {
3314                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3315                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3316                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3317                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3318                        Ok(CompositeRequest::SignalProcessingConnect {
3319                            protocol: req.protocol,
3320
3321                            control_handle,
3322                        })
3323                    }
3324                    0xac355fb98341996 => {
3325                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3326                        let mut req = fidl::new_empty!(
3327                            fidl::encoding::EmptyPayload,
3328                            fidl::encoding::DefaultFuchsiaResourceDialect
3329                        );
3330                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3331                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3332                        Ok(CompositeRequest::Reset {
3333                            responder: CompositeResetResponder {
3334                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3335                                tx_id: header.tx_id,
3336                            },
3337                        })
3338                    }
3339                    0x31846fa0a459942b => {
3340                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3341                        let mut req = fidl::new_empty!(
3342                            fidl::encoding::EmptyPayload,
3343                            fidl::encoding::DefaultFuchsiaResourceDialect
3344                        );
3345                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3346                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3347                        Ok(CompositeRequest::GetProperties {
3348                            responder: CompositeGetPropertiesResponder {
3349                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3350                                tx_id: header.tx_id,
3351                            },
3352                        })
3353                    }
3354                    0x1d89b701b6816ac4 => {
3355                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3356                        let mut req = fidl::new_empty!(
3357                            CompositeGetRingBufferFormatsRequest,
3358                            fidl::encoding::DefaultFuchsiaResourceDialect
3359                        );
3360                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetRingBufferFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3361                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3362                        Ok(CompositeRequest::GetRingBufferFormats {
3363                            processing_element_id: req.processing_element_id,
3364
3365                            responder: CompositeGetRingBufferFormatsResponder {
3366                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3367                                tx_id: header.tx_id,
3368                            },
3369                        })
3370                    }
3371                    0x28c5685f85262033 => {
3372                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3373                        let mut req = fidl::new_empty!(
3374                            CompositeCreateRingBufferRequest,
3375                            fidl::encoding::DefaultFuchsiaResourceDialect
3376                        );
3377                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
3378                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3379                        Ok(CompositeRequest::CreateRingBuffer {
3380                            processing_element_id: req.processing_element_id,
3381                            format: req.format,
3382                            ring_buffer: req.ring_buffer,
3383
3384                            responder: CompositeCreateRingBufferResponder {
3385                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3386                                tx_id: header.tx_id,
3387                            },
3388                        })
3389                    }
3390                    0x3cbeaed59c8f69b => {
3391                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3392                        let mut req = fidl::new_empty!(
3393                            CompositeGetDaiFormatsRequest,
3394                            fidl::encoding::DefaultFuchsiaResourceDialect
3395                        );
3396                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetDaiFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3397                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3398                        Ok(CompositeRequest::GetDaiFormats {
3399                            processing_element_id: req.processing_element_id,
3400
3401                            responder: CompositeGetDaiFormatsResponder {
3402                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3403                                tx_id: header.tx_id,
3404                            },
3405                        })
3406                    }
3407                    0x155acf5cc0dc8a84 => {
3408                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3409                        let mut req = fidl::new_empty!(
3410                            CompositeSetDaiFormatRequest,
3411                            fidl::encoding::DefaultFuchsiaResourceDialect
3412                        );
3413                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
3414                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3415                        Ok(CompositeRequest::SetDaiFormat {
3416                            processing_element_id: req.processing_element_id,
3417                            format: req.format,
3418
3419                            responder: CompositeSetDaiFormatResponder {
3420                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3421                                tx_id: header.tx_id,
3422                            },
3423                        })
3424                    }
3425                    0x73cc47c6ad39bca7 => {
3426                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3427                        let mut req = fidl::new_empty!(
3428                            CompositeGetPacketStreamFormatsRequest,
3429                            fidl::encoding::DefaultFuchsiaResourceDialect
3430                        );
3431                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetPacketStreamFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3432                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3433                        Ok(CompositeRequest::GetPacketStreamFormats {
3434                            processing_element_id: req.processing_element_id,
3435
3436                            responder: CompositeGetPacketStreamFormatsResponder {
3437                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3438                                tx_id: header.tx_id,
3439                            },
3440                        })
3441                    }
3442                    0x50e8902b756c707c => {
3443                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3444                        let mut req = fidl::new_empty!(
3445                            CompositeCreatePacketStreamRequest,
3446                            fidl::encoding::DefaultFuchsiaResourceDialect
3447                        );
3448                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreatePacketStreamRequest>(&header, _body_bytes, handles, &mut req)?;
3449                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3450                        Ok(CompositeRequest::CreatePacketStream {
3451                            processing_element_id: req.processing_element_id,
3452                            format: req.format,
3453                            packet_stream_control: req.packet_stream_control,
3454
3455                            responder: CompositeCreatePacketStreamResponder {
3456                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3457                                tx_id: header.tx_id,
3458                            },
3459                        })
3460                    }
3461                    _ if header.tx_id == 0
3462                        && header
3463                            .dynamic_flags()
3464                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3465                    {
3466                        Ok(CompositeRequest::_UnknownMethod {
3467                            ordinal: header.ordinal,
3468                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
3469                            method_type: fidl::MethodType::OneWay,
3470                        })
3471                    }
3472                    _ if header
3473                        .dynamic_flags()
3474                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3475                    {
3476                        this.inner.send_framework_err(
3477                            fidl::encoding::FrameworkErr::UnknownMethod,
3478                            header.tx_id,
3479                            header.ordinal,
3480                            header.dynamic_flags(),
3481                            (bytes, handles),
3482                        )?;
3483                        Ok(CompositeRequest::_UnknownMethod {
3484                            ordinal: header.ordinal,
3485                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
3486                            method_type: fidl::MethodType::TwoWay,
3487                        })
3488                    }
3489                    _ => Err(fidl::Error::UnknownOrdinal {
3490                        ordinal: header.ordinal,
3491                        protocol_name:
3492                            <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3493                    }),
3494                }))
3495            },
3496        )
3497    }
3498}
3499
3500#[derive(Debug)]
3501pub enum CompositeRequest {
3502    /// Retrieves top level health state.
3503    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
3504    GetHealthState { responder: CompositeGetHealthStateResponder },
3505    /// Connect to a `SignalProcessing` protocol.
3506    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
3507    /// the maximum number of connections have already been created, for instance one, then the
3508    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
3509    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
3510    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
3511    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
3512    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
3513    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
3514    /// is intended to be composed, and hence the more verbose name allows differentiation and
3515    /// improved clarity.
3516    SignalProcessingConnect {
3517        protocol: fidl::endpoints::ServerEnd<
3518            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3519        >,
3520        control_handle: CompositeControlHandle,
3521    },
3522    /// Resets the hardware including all DAI interconnects and signal processing.
3523    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
3524    ///
3525    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
3526    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
3527    /// any processing elements, and reconstruct any ring buffers.
3528    ///
3529    /// If the driver can't successfully reset the hardware, it will return an error and then close
3530    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
3531    Reset { responder: CompositeResetResponder },
3532    /// Retrieves top level static properties.
3533    GetProperties { responder: CompositeGetPropertiesResponder },
3534    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
3535    /// in the topology supported by this driver as returned by `GetElements` from
3536    /// fuchsia.hardware.audio.signalprocessing.
3537    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
3538    /// client may retry at a later time.
3539    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3540    /// by `GetElements`.
3541    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3542    /// `RING_BUFFER`.
3543    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
3544    /// the parameters in `SupportedFormats2` may be supported.
3545    /// The vector returned to the caller must contain at least one entry.
3546    GetRingBufferFormats {
3547        processing_element_id: u64,
3548        responder: CompositeGetRingBufferFormatsResponder,
3549    },
3550    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
3551    /// processing element specified by `processing_element_id`. The format is based on information
3552    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
3553    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
3554    /// audio buffer provided by the driver.
3555    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3556    /// by `GetElements`.
3557    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3558    /// `RING_BUFFER`.
3559    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
3560    /// `format` is not supported.
3561    CreateRingBuffer {
3562        processing_element_id: u64,
3563        format: Format2,
3564        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3565        responder: CompositeCreateRingBufferResponder,
3566    },
3567    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
3568    /// in the topology supported by this driver as returned by `GetElements` from
3569    /// fuchsia.hardware.audio.signalprocessing.
3570    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
3571    /// may retry at a later time.
3572    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3573    /// by `GetElements`.
3574    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3575    /// `DAI_INTERCONNECT`.
3576    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
3577    /// the parameters in DaiSupportedFormats may be supported.
3578    /// The vector returned to the caller must contain at least one entry.
3579    GetDaiFormats { processing_element_id: u64, responder: CompositeGetDaiFormatsResponder },
3580    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
3581    /// processing element specified by `processing_element_id`. The format is based on information
3582    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
3583    /// requirement.
3584    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3585    /// by `GetElements`.
3586    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3587    /// `DAI_INTERCONNECT`.
3588    SetDaiFormat {
3589        processing_element_id: u64,
3590        format: DaiFormat,
3591        responder: CompositeSetDaiFormatResponder,
3592    },
3593    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
3594    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
3595    /// from fuchsia.hardware.audio.signalprocessing.
3596    ///
3597    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
3598    /// client may retry this request at a later time.
3599    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
3600    /// `GetElements`.
3601    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3602    /// `PACKET_STREAM`.
3603    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
3604    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
3605    /// combinations of the parameters in `SupportedFormats2` may be supported.
3606    /// The vector returned to the caller must contain at least one entry.
3607    GetPacketStreamFormats {
3608        processing_element_id: u64,
3609        responder: CompositeGetPacketStreamFormatsResponder,
3610    },
3611    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
3612    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
3613    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
3614    /// the client, and any other requirement. The returned `packet_stream` channel is used to
3615    /// access and control the packet stream protocol served by the driver.
3616    ///
3617    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
3618    /// `GetElements`.
3619    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3620    /// `PACKET_STREAM`.
3621    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
3622    /// at this time, but it should be able to at some future time. This request can be retried.
3623    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
3624    ///`format` is not supported.
3625    CreatePacketStream {
3626        processing_element_id: u64,
3627        format: Format2,
3628        packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3629        responder: CompositeCreatePacketStreamResponder,
3630    },
3631    /// An interaction was received which does not match any known method.
3632    #[non_exhaustive]
3633    _UnknownMethod {
3634        /// Ordinal of the method that was called.
3635        ordinal: u64,
3636        control_handle: CompositeControlHandle,
3637        method_type: fidl::MethodType,
3638    },
3639}
3640
3641impl CompositeRequest {
3642    #[allow(irrefutable_let_patterns)]
3643    pub fn into_get_health_state(self) -> Option<(CompositeGetHealthStateResponder)> {
3644        if let CompositeRequest::GetHealthState { responder } = self {
3645            Some((responder))
3646        } else {
3647            None
3648        }
3649    }
3650
3651    #[allow(irrefutable_let_patterns)]
3652    pub fn into_signal_processing_connect(
3653        self,
3654    ) -> Option<(
3655        fidl::endpoints::ServerEnd<
3656            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3657        >,
3658        CompositeControlHandle,
3659    )> {
3660        if let CompositeRequest::SignalProcessingConnect { protocol, control_handle } = self {
3661            Some((protocol, control_handle))
3662        } else {
3663            None
3664        }
3665    }
3666
3667    #[allow(irrefutable_let_patterns)]
3668    pub fn into_reset(self) -> Option<(CompositeResetResponder)> {
3669        if let CompositeRequest::Reset { responder } = self { Some((responder)) } else { None }
3670    }
3671
3672    #[allow(irrefutable_let_patterns)]
3673    pub fn into_get_properties(self) -> Option<(CompositeGetPropertiesResponder)> {
3674        if let CompositeRequest::GetProperties { responder } = self {
3675            Some((responder))
3676        } else {
3677            None
3678        }
3679    }
3680
3681    #[allow(irrefutable_let_patterns)]
3682    pub fn into_get_ring_buffer_formats(
3683        self,
3684    ) -> Option<(u64, CompositeGetRingBufferFormatsResponder)> {
3685        if let CompositeRequest::GetRingBufferFormats { processing_element_id, responder } = self {
3686            Some((processing_element_id, responder))
3687        } else {
3688            None
3689        }
3690    }
3691
3692    #[allow(irrefutable_let_patterns)]
3693    pub fn into_create_ring_buffer(
3694        self,
3695    ) -> Option<(
3696        u64,
3697        Format2,
3698        fidl::endpoints::ServerEnd<RingBufferMarker>,
3699        CompositeCreateRingBufferResponder,
3700    )> {
3701        if let CompositeRequest::CreateRingBuffer {
3702            processing_element_id,
3703            format,
3704            ring_buffer,
3705            responder,
3706        } = self
3707        {
3708            Some((processing_element_id, format, ring_buffer, responder))
3709        } else {
3710            None
3711        }
3712    }
3713
3714    #[allow(irrefutable_let_patterns)]
3715    pub fn into_get_dai_formats(self) -> Option<(u64, CompositeGetDaiFormatsResponder)> {
3716        if let CompositeRequest::GetDaiFormats { processing_element_id, responder } = self {
3717            Some((processing_element_id, responder))
3718        } else {
3719            None
3720        }
3721    }
3722
3723    #[allow(irrefutable_let_patterns)]
3724    pub fn into_set_dai_format(self) -> Option<(u64, DaiFormat, CompositeSetDaiFormatResponder)> {
3725        if let CompositeRequest::SetDaiFormat { processing_element_id, format, responder } = self {
3726            Some((processing_element_id, format, responder))
3727        } else {
3728            None
3729        }
3730    }
3731
3732    #[allow(irrefutable_let_patterns)]
3733    pub fn into_get_packet_stream_formats(
3734        self,
3735    ) -> Option<(u64, CompositeGetPacketStreamFormatsResponder)> {
3736        if let CompositeRequest::GetPacketStreamFormats { processing_element_id, responder } = self
3737        {
3738            Some((processing_element_id, responder))
3739        } else {
3740            None
3741        }
3742    }
3743
3744    #[allow(irrefutable_let_patterns)]
3745    pub fn into_create_packet_stream(
3746        self,
3747    ) -> Option<(
3748        u64,
3749        Format2,
3750        fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3751        CompositeCreatePacketStreamResponder,
3752    )> {
3753        if let CompositeRequest::CreatePacketStream {
3754            processing_element_id,
3755            format,
3756            packet_stream_control,
3757            responder,
3758        } = self
3759        {
3760            Some((processing_element_id, format, packet_stream_control, responder))
3761        } else {
3762            None
3763        }
3764    }
3765
3766    /// Name of the method defined in FIDL
3767    pub fn method_name(&self) -> &'static str {
3768        match *self {
3769            CompositeRequest::GetHealthState { .. } => "get_health_state",
3770            CompositeRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
3771            CompositeRequest::Reset { .. } => "reset",
3772            CompositeRequest::GetProperties { .. } => "get_properties",
3773            CompositeRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
3774            CompositeRequest::CreateRingBuffer { .. } => "create_ring_buffer",
3775            CompositeRequest::GetDaiFormats { .. } => "get_dai_formats",
3776            CompositeRequest::SetDaiFormat { .. } => "set_dai_format",
3777            CompositeRequest::GetPacketStreamFormats { .. } => "get_packet_stream_formats",
3778            CompositeRequest::CreatePacketStream { .. } => "create_packet_stream",
3779            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3780                "unknown one-way method"
3781            }
3782            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3783                "unknown two-way method"
3784            }
3785        }
3786    }
3787}
3788
3789#[derive(Debug, Clone)]
3790pub struct CompositeControlHandle {
3791    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3792}
3793
3794impl fidl::endpoints::ControlHandle for CompositeControlHandle {
3795    fn shutdown(&self) {
3796        self.inner.shutdown()
3797    }
3798
3799    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3800        self.inner.shutdown_with_epitaph(status)
3801    }
3802
3803    fn is_closed(&self) -> bool {
3804        self.inner.channel().is_closed()
3805    }
3806    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3807        self.inner.channel().on_closed()
3808    }
3809
3810    #[cfg(target_os = "fuchsia")]
3811    fn signal_peer(
3812        &self,
3813        clear_mask: zx::Signals,
3814        set_mask: zx::Signals,
3815    ) -> Result<(), zx_status::Status> {
3816        use fidl::Peered;
3817        self.inner.channel().signal_peer(clear_mask, set_mask)
3818    }
3819}
3820
3821impl CompositeControlHandle {}
3822
3823#[must_use = "FIDL methods require a response to be sent"]
3824#[derive(Debug)]
3825pub struct CompositeGetHealthStateResponder {
3826    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3827    tx_id: u32,
3828}
3829
3830/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3831/// if the responder is dropped without sending a response, so that the client
3832/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3833impl std::ops::Drop for CompositeGetHealthStateResponder {
3834    fn drop(&mut self) {
3835        self.control_handle.shutdown();
3836        // Safety: drops once, never accessed again
3837        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3838    }
3839}
3840
3841impl fidl::endpoints::Responder for CompositeGetHealthStateResponder {
3842    type ControlHandle = CompositeControlHandle;
3843
3844    fn control_handle(&self) -> &CompositeControlHandle {
3845        &self.control_handle
3846    }
3847
3848    fn drop_without_shutdown(mut self) {
3849        // Safety: drops once, never accessed again due to mem::forget
3850        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3851        // Prevent Drop from running (which would shut down the channel)
3852        std::mem::forget(self);
3853    }
3854}
3855
3856impl CompositeGetHealthStateResponder {
3857    /// Sends a response to the FIDL transaction.
3858    ///
3859    /// Sets the channel to shutdown if an error occurs.
3860    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3861        let _result = self.send_raw(state);
3862        if _result.is_err() {
3863            self.control_handle.shutdown();
3864        }
3865        self.drop_without_shutdown();
3866        _result
3867    }
3868
3869    /// Similar to "send" but does not shutdown the channel if an error occurs.
3870    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3871        let _result = self.send_raw(state);
3872        self.drop_without_shutdown();
3873        _result
3874    }
3875
3876    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
3877        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
3878            (state,),
3879            self.tx_id,
3880            0x4e146d6bca733a84,
3881            fidl::encoding::DynamicFlags::empty(),
3882        )
3883    }
3884}
3885
3886#[must_use = "FIDL methods require a response to be sent"]
3887#[derive(Debug)]
3888pub struct CompositeResetResponder {
3889    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3890    tx_id: u32,
3891}
3892
3893/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3894/// if the responder is dropped without sending a response, so that the client
3895/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3896impl std::ops::Drop for CompositeResetResponder {
3897    fn drop(&mut self) {
3898        self.control_handle.shutdown();
3899        // Safety: drops once, never accessed again
3900        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3901    }
3902}
3903
3904impl fidl::endpoints::Responder for CompositeResetResponder {
3905    type ControlHandle = CompositeControlHandle;
3906
3907    fn control_handle(&self) -> &CompositeControlHandle {
3908        &self.control_handle
3909    }
3910
3911    fn drop_without_shutdown(mut self) {
3912        // Safety: drops once, never accessed again due to mem::forget
3913        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3914        // Prevent Drop from running (which would shut down the channel)
3915        std::mem::forget(self);
3916    }
3917}
3918
3919impl CompositeResetResponder {
3920    /// Sends a response to the FIDL transaction.
3921    ///
3922    /// Sets the channel to shutdown if an error occurs.
3923    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3924        let _result = self.send_raw(result);
3925        if _result.is_err() {
3926            self.control_handle.shutdown();
3927        }
3928        self.drop_without_shutdown();
3929        _result
3930    }
3931
3932    /// Similar to "send" but does not shutdown the channel if an error occurs.
3933    pub fn send_no_shutdown_on_err(
3934        self,
3935        mut result: Result<(), DriverError>,
3936    ) -> Result<(), fidl::Error> {
3937        let _result = self.send_raw(result);
3938        self.drop_without_shutdown();
3939        _result
3940    }
3941
3942    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3943        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3944            fidl::encoding::EmptyStruct,
3945            DriverError,
3946        >>(
3947            fidl::encoding::FlexibleResult::new(result),
3948            self.tx_id,
3949            0xac355fb98341996,
3950            fidl::encoding::DynamicFlags::FLEXIBLE,
3951        )
3952    }
3953}
3954
3955#[must_use = "FIDL methods require a response to be sent"]
3956#[derive(Debug)]
3957pub struct CompositeGetPropertiesResponder {
3958    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3959    tx_id: u32,
3960}
3961
3962/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3963/// if the responder is dropped without sending a response, so that the client
3964/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3965impl std::ops::Drop for CompositeGetPropertiesResponder {
3966    fn drop(&mut self) {
3967        self.control_handle.shutdown();
3968        // Safety: drops once, never accessed again
3969        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3970    }
3971}
3972
3973impl fidl::endpoints::Responder for CompositeGetPropertiesResponder {
3974    type ControlHandle = CompositeControlHandle;
3975
3976    fn control_handle(&self) -> &CompositeControlHandle {
3977        &self.control_handle
3978    }
3979
3980    fn drop_without_shutdown(mut self) {
3981        // Safety: drops once, never accessed again due to mem::forget
3982        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3983        // Prevent Drop from running (which would shut down the channel)
3984        std::mem::forget(self);
3985    }
3986}
3987
3988impl CompositeGetPropertiesResponder {
3989    /// Sends a response to the FIDL transaction.
3990    ///
3991    /// Sets the channel to shutdown if an error occurs.
3992    pub fn send(self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3993        let _result = self.send_raw(properties);
3994        if _result.is_err() {
3995            self.control_handle.shutdown();
3996        }
3997        self.drop_without_shutdown();
3998        _result
3999    }
4000
4001    /// Similar to "send" but does not shutdown the channel if an error occurs.
4002    pub fn send_no_shutdown_on_err(
4003        self,
4004        mut properties: &CompositeProperties,
4005    ) -> Result<(), fidl::Error> {
4006        let _result = self.send_raw(properties);
4007        self.drop_without_shutdown();
4008        _result
4009    }
4010
4011    fn send_raw(&self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
4012        self.control_handle
4013            .inner
4014            .send::<fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>>(
4015                fidl::encoding::Flexible::new((properties,)),
4016                self.tx_id,
4017                0x31846fa0a459942b,
4018                fidl::encoding::DynamicFlags::FLEXIBLE,
4019            )
4020    }
4021}
4022
4023#[must_use = "FIDL methods require a response to be sent"]
4024#[derive(Debug)]
4025pub struct CompositeGetRingBufferFormatsResponder {
4026    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4027    tx_id: u32,
4028}
4029
4030/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4031/// if the responder is dropped without sending a response, so that the client
4032/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4033impl std::ops::Drop for CompositeGetRingBufferFormatsResponder {
4034    fn drop(&mut self) {
4035        self.control_handle.shutdown();
4036        // Safety: drops once, never accessed again
4037        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4038    }
4039}
4040
4041impl fidl::endpoints::Responder for CompositeGetRingBufferFormatsResponder {
4042    type ControlHandle = CompositeControlHandle;
4043
4044    fn control_handle(&self) -> &CompositeControlHandle {
4045        &self.control_handle
4046    }
4047
4048    fn drop_without_shutdown(mut self) {
4049        // Safety: drops once, never accessed again due to mem::forget
4050        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4051        // Prevent Drop from running (which would shut down the channel)
4052        std::mem::forget(self);
4053    }
4054}
4055
4056impl CompositeGetRingBufferFormatsResponder {
4057    /// Sends a response to the FIDL transaction.
4058    ///
4059    /// Sets the channel to shutdown if an error occurs.
4060    pub fn send(
4061        self,
4062        mut result: Result<&[SupportedFormats2], DriverError>,
4063    ) -> Result<(), fidl::Error> {
4064        let _result = self.send_raw(result);
4065        if _result.is_err() {
4066            self.control_handle.shutdown();
4067        }
4068        self.drop_without_shutdown();
4069        _result
4070    }
4071
4072    /// Similar to "send" but does not shutdown the channel if an error occurs.
4073    pub fn send_no_shutdown_on_err(
4074        self,
4075        mut result: Result<&[SupportedFormats2], DriverError>,
4076    ) -> Result<(), fidl::Error> {
4077        let _result = self.send_raw(result);
4078        self.drop_without_shutdown();
4079        _result
4080    }
4081
4082    fn send_raw(
4083        &self,
4084        mut result: Result<&[SupportedFormats2], DriverError>,
4085    ) -> Result<(), fidl::Error> {
4086        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4087            CompositeGetRingBufferFormatsResponse,
4088            DriverError,
4089        >>(
4090            fidl::encoding::FlexibleResult::new(
4091                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
4092            ),
4093            self.tx_id,
4094            0x1d89b701b6816ac4,
4095            fidl::encoding::DynamicFlags::FLEXIBLE,
4096        )
4097    }
4098}
4099
4100#[must_use = "FIDL methods require a response to be sent"]
4101#[derive(Debug)]
4102pub struct CompositeCreateRingBufferResponder {
4103    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4104    tx_id: u32,
4105}
4106
4107/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4108/// if the responder is dropped without sending a response, so that the client
4109/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4110impl std::ops::Drop for CompositeCreateRingBufferResponder {
4111    fn drop(&mut self) {
4112        self.control_handle.shutdown();
4113        // Safety: drops once, never accessed again
4114        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4115    }
4116}
4117
4118impl fidl::endpoints::Responder for CompositeCreateRingBufferResponder {
4119    type ControlHandle = CompositeControlHandle;
4120
4121    fn control_handle(&self) -> &CompositeControlHandle {
4122        &self.control_handle
4123    }
4124
4125    fn drop_without_shutdown(mut self) {
4126        // Safety: drops once, never accessed again due to mem::forget
4127        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4128        // Prevent Drop from running (which would shut down the channel)
4129        std::mem::forget(self);
4130    }
4131}
4132
4133impl CompositeCreateRingBufferResponder {
4134    /// Sends a response to the FIDL transaction.
4135    ///
4136    /// Sets the channel to shutdown if an error occurs.
4137    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4138        let _result = self.send_raw(result);
4139        if _result.is_err() {
4140            self.control_handle.shutdown();
4141        }
4142        self.drop_without_shutdown();
4143        _result
4144    }
4145
4146    /// Similar to "send" but does not shutdown the channel if an error occurs.
4147    pub fn send_no_shutdown_on_err(
4148        self,
4149        mut result: Result<(), DriverError>,
4150    ) -> Result<(), fidl::Error> {
4151        let _result = self.send_raw(result);
4152        self.drop_without_shutdown();
4153        _result
4154    }
4155
4156    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4157        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4158            fidl::encoding::EmptyStruct,
4159            DriverError,
4160        >>(
4161            fidl::encoding::FlexibleResult::new(result),
4162            self.tx_id,
4163            0x28c5685f85262033,
4164            fidl::encoding::DynamicFlags::FLEXIBLE,
4165        )
4166    }
4167}
4168
4169#[must_use = "FIDL methods require a response to be sent"]
4170#[derive(Debug)]
4171pub struct CompositeGetDaiFormatsResponder {
4172    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4173    tx_id: u32,
4174}
4175
4176/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4177/// if the responder is dropped without sending a response, so that the client
4178/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4179impl std::ops::Drop for CompositeGetDaiFormatsResponder {
4180    fn drop(&mut self) {
4181        self.control_handle.shutdown();
4182        // Safety: drops once, never accessed again
4183        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4184    }
4185}
4186
4187impl fidl::endpoints::Responder for CompositeGetDaiFormatsResponder {
4188    type ControlHandle = CompositeControlHandle;
4189
4190    fn control_handle(&self) -> &CompositeControlHandle {
4191        &self.control_handle
4192    }
4193
4194    fn drop_without_shutdown(mut self) {
4195        // Safety: drops once, never accessed again due to mem::forget
4196        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4197        // Prevent Drop from running (which would shut down the channel)
4198        std::mem::forget(self);
4199    }
4200}
4201
4202impl CompositeGetDaiFormatsResponder {
4203    /// Sends a response to the FIDL transaction.
4204    ///
4205    /// Sets the channel to shutdown if an error occurs.
4206    pub fn send(
4207        self,
4208        mut result: Result<&[DaiSupportedFormats], DriverError>,
4209    ) -> Result<(), fidl::Error> {
4210        let _result = self.send_raw(result);
4211        if _result.is_err() {
4212            self.control_handle.shutdown();
4213        }
4214        self.drop_without_shutdown();
4215        _result
4216    }
4217
4218    /// Similar to "send" but does not shutdown the channel if an error occurs.
4219    pub fn send_no_shutdown_on_err(
4220        self,
4221        mut result: Result<&[DaiSupportedFormats], DriverError>,
4222    ) -> Result<(), fidl::Error> {
4223        let _result = self.send_raw(result);
4224        self.drop_without_shutdown();
4225        _result
4226    }
4227
4228    fn send_raw(
4229        &self,
4230        mut result: Result<&[DaiSupportedFormats], DriverError>,
4231    ) -> Result<(), fidl::Error> {
4232        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4233            CompositeGetDaiFormatsResponse,
4234            DriverError,
4235        >>(
4236            fidl::encoding::FlexibleResult::new(result.map(|dai_formats| (dai_formats,))),
4237            self.tx_id,
4238            0x3cbeaed59c8f69b,
4239            fidl::encoding::DynamicFlags::FLEXIBLE,
4240        )
4241    }
4242}
4243
4244#[must_use = "FIDL methods require a response to be sent"]
4245#[derive(Debug)]
4246pub struct CompositeSetDaiFormatResponder {
4247    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4248    tx_id: u32,
4249}
4250
4251/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4252/// if the responder is dropped without sending a response, so that the client
4253/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4254impl std::ops::Drop for CompositeSetDaiFormatResponder {
4255    fn drop(&mut self) {
4256        self.control_handle.shutdown();
4257        // Safety: drops once, never accessed again
4258        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4259    }
4260}
4261
4262impl fidl::endpoints::Responder for CompositeSetDaiFormatResponder {
4263    type ControlHandle = CompositeControlHandle;
4264
4265    fn control_handle(&self) -> &CompositeControlHandle {
4266        &self.control_handle
4267    }
4268
4269    fn drop_without_shutdown(mut self) {
4270        // Safety: drops once, never accessed again due to mem::forget
4271        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4272        // Prevent Drop from running (which would shut down the channel)
4273        std::mem::forget(self);
4274    }
4275}
4276
4277impl CompositeSetDaiFormatResponder {
4278    /// Sends a response to the FIDL transaction.
4279    ///
4280    /// Sets the channel to shutdown if an error occurs.
4281    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4282        let _result = self.send_raw(result);
4283        if _result.is_err() {
4284            self.control_handle.shutdown();
4285        }
4286        self.drop_without_shutdown();
4287        _result
4288    }
4289
4290    /// Similar to "send" but does not shutdown the channel if an error occurs.
4291    pub fn send_no_shutdown_on_err(
4292        self,
4293        mut result: Result<(), DriverError>,
4294    ) -> Result<(), fidl::Error> {
4295        let _result = self.send_raw(result);
4296        self.drop_without_shutdown();
4297        _result
4298    }
4299
4300    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4301        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4302            fidl::encoding::EmptyStruct,
4303            DriverError,
4304        >>(
4305            fidl::encoding::FlexibleResult::new(result),
4306            self.tx_id,
4307            0x155acf5cc0dc8a84,
4308            fidl::encoding::DynamicFlags::FLEXIBLE,
4309        )
4310    }
4311}
4312
4313#[must_use = "FIDL methods require a response to be sent"]
4314#[derive(Debug)]
4315pub struct CompositeGetPacketStreamFormatsResponder {
4316    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4317    tx_id: u32,
4318}
4319
4320/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4321/// if the responder is dropped without sending a response, so that the client
4322/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4323impl std::ops::Drop for CompositeGetPacketStreamFormatsResponder {
4324    fn drop(&mut self) {
4325        self.control_handle.shutdown();
4326        // Safety: drops once, never accessed again
4327        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4328    }
4329}
4330
4331impl fidl::endpoints::Responder for CompositeGetPacketStreamFormatsResponder {
4332    type ControlHandle = CompositeControlHandle;
4333
4334    fn control_handle(&self) -> &CompositeControlHandle {
4335        &self.control_handle
4336    }
4337
4338    fn drop_without_shutdown(mut self) {
4339        // Safety: drops once, never accessed again due to mem::forget
4340        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4341        // Prevent Drop from running (which would shut down the channel)
4342        std::mem::forget(self);
4343    }
4344}
4345
4346impl CompositeGetPacketStreamFormatsResponder {
4347    /// Sends a response to the FIDL transaction.
4348    ///
4349    /// Sets the channel to shutdown if an error occurs.
4350    pub fn send(
4351        self,
4352        mut result: Result<&[SupportedFormats2], DriverError>,
4353    ) -> Result<(), fidl::Error> {
4354        let _result = self.send_raw(result);
4355        if _result.is_err() {
4356            self.control_handle.shutdown();
4357        }
4358        self.drop_without_shutdown();
4359        _result
4360    }
4361
4362    /// Similar to "send" but does not shutdown the channel if an error occurs.
4363    pub fn send_no_shutdown_on_err(
4364        self,
4365        mut result: Result<&[SupportedFormats2], DriverError>,
4366    ) -> Result<(), fidl::Error> {
4367        let _result = self.send_raw(result);
4368        self.drop_without_shutdown();
4369        _result
4370    }
4371
4372    fn send_raw(
4373        &self,
4374        mut result: Result<&[SupportedFormats2], DriverError>,
4375    ) -> Result<(), fidl::Error> {
4376        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4377            CompositeGetPacketStreamFormatsResponse,
4378            DriverError,
4379        >>(
4380            fidl::encoding::FlexibleResult::new(
4381                result.map(|packet_stream_formats| (packet_stream_formats,)),
4382            ),
4383            self.tx_id,
4384            0x73cc47c6ad39bca7,
4385            fidl::encoding::DynamicFlags::FLEXIBLE,
4386        )
4387    }
4388}
4389
4390#[must_use = "FIDL methods require a response to be sent"]
4391#[derive(Debug)]
4392pub struct CompositeCreatePacketStreamResponder {
4393    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4394    tx_id: u32,
4395}
4396
4397/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4398/// if the responder is dropped without sending a response, so that the client
4399/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4400impl std::ops::Drop for CompositeCreatePacketStreamResponder {
4401    fn drop(&mut self) {
4402        self.control_handle.shutdown();
4403        // Safety: drops once, never accessed again
4404        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4405    }
4406}
4407
4408impl fidl::endpoints::Responder for CompositeCreatePacketStreamResponder {
4409    type ControlHandle = CompositeControlHandle;
4410
4411    fn control_handle(&self) -> &CompositeControlHandle {
4412        &self.control_handle
4413    }
4414
4415    fn drop_without_shutdown(mut self) {
4416        // Safety: drops once, never accessed again due to mem::forget
4417        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4418        // Prevent Drop from running (which would shut down the channel)
4419        std::mem::forget(self);
4420    }
4421}
4422
4423impl CompositeCreatePacketStreamResponder {
4424    /// Sends a response to the FIDL transaction.
4425    ///
4426    /// Sets the channel to shutdown if an error occurs.
4427    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4428        let _result = self.send_raw(result);
4429        if _result.is_err() {
4430            self.control_handle.shutdown();
4431        }
4432        self.drop_without_shutdown();
4433        _result
4434    }
4435
4436    /// Similar to "send" but does not shutdown the channel if an error occurs.
4437    pub fn send_no_shutdown_on_err(
4438        self,
4439        mut result: Result<(), DriverError>,
4440    ) -> Result<(), fidl::Error> {
4441        let _result = self.send_raw(result);
4442        self.drop_without_shutdown();
4443        _result
4444    }
4445
4446    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4447        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4448            fidl::encoding::EmptyStruct,
4449            DriverError,
4450        >>(
4451            fidl::encoding::FlexibleResult::new(result),
4452            self.tx_id,
4453            0x50e8902b756c707c,
4454            fidl::encoding::DynamicFlags::FLEXIBLE,
4455        )
4456    }
4457}
4458
4459#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4460pub struct CompositeConnectorMarker;
4461
4462impl fidl::endpoints::ProtocolMarker for CompositeConnectorMarker {
4463    type Proxy = CompositeConnectorProxy;
4464    type RequestStream = CompositeConnectorRequestStream;
4465    #[cfg(target_os = "fuchsia")]
4466    type SynchronousProxy = CompositeConnectorSynchronousProxy;
4467
4468    const DEBUG_NAME: &'static str = "(anonymous) CompositeConnector";
4469}
4470
4471pub trait CompositeConnectorProxyInterface: Send + Sync {
4472    fn r#connect(
4473        &self,
4474        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4475    ) -> Result<(), fidl::Error>;
4476}
4477#[derive(Debug)]
4478#[cfg(target_os = "fuchsia")]
4479pub struct CompositeConnectorSynchronousProxy {
4480    client: fidl::client::sync::Client,
4481}
4482
4483#[cfg(target_os = "fuchsia")]
4484impl fidl::endpoints::SynchronousProxy for CompositeConnectorSynchronousProxy {
4485    type Proxy = CompositeConnectorProxy;
4486    type Protocol = CompositeConnectorMarker;
4487
4488    fn from_channel(inner: fidl::Channel) -> Self {
4489        Self::new(inner)
4490    }
4491
4492    fn into_channel(self) -> fidl::Channel {
4493        self.client.into_channel()
4494    }
4495
4496    fn as_channel(&self) -> &fidl::Channel {
4497        self.client.as_channel()
4498    }
4499}
4500
4501#[cfg(target_os = "fuchsia")]
4502impl CompositeConnectorSynchronousProxy {
4503    pub fn new(channel: fidl::Channel) -> Self {
4504        let protocol_name =
4505            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4506        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4507    }
4508
4509    pub fn into_channel(self) -> fidl::Channel {
4510        self.client.into_channel()
4511    }
4512
4513    /// Waits until an event arrives and returns it. It is safe for other
4514    /// threads to make concurrent requests while waiting for an event.
4515    pub fn wait_for_event(
4516        &self,
4517        deadline: zx::MonotonicInstant,
4518    ) -> Result<CompositeConnectorEvent, fidl::Error> {
4519        CompositeConnectorEvent::decode(self.client.wait_for_event(deadline)?)
4520    }
4521
4522    /// Connect to a `Device` protocol.
4523    /// This method allows a component to serve FIDL outside the devhost's control.
4524    pub fn r#connect(
4525        &self,
4526        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4527    ) -> Result<(), fidl::Error> {
4528        self.client.send::<CompositeConnectorConnectRequest>(
4529            (composite_protocol,),
4530            0x7ee557529079e466,
4531            fidl::encoding::DynamicFlags::empty(),
4532        )
4533    }
4534}
4535
4536#[cfg(target_os = "fuchsia")]
4537impl From<CompositeConnectorSynchronousProxy> for zx::NullableHandle {
4538    fn from(value: CompositeConnectorSynchronousProxy) -> Self {
4539        value.into_channel().into()
4540    }
4541}
4542
4543#[cfg(target_os = "fuchsia")]
4544impl From<fidl::Channel> for CompositeConnectorSynchronousProxy {
4545    fn from(value: fidl::Channel) -> Self {
4546        Self::new(value)
4547    }
4548}
4549
4550#[cfg(target_os = "fuchsia")]
4551impl fidl::endpoints::FromClient for CompositeConnectorSynchronousProxy {
4552    type Protocol = CompositeConnectorMarker;
4553
4554    fn from_client(value: fidl::endpoints::ClientEnd<CompositeConnectorMarker>) -> Self {
4555        Self::new(value.into_channel())
4556    }
4557}
4558
4559#[derive(Debug, Clone)]
4560pub struct CompositeConnectorProxy {
4561    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4562}
4563
4564impl fidl::endpoints::Proxy for CompositeConnectorProxy {
4565    type Protocol = CompositeConnectorMarker;
4566
4567    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4568        Self::new(inner)
4569    }
4570
4571    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4572        self.client.into_channel().map_err(|client| Self { client })
4573    }
4574
4575    fn as_channel(&self) -> &::fidl::AsyncChannel {
4576        self.client.as_channel()
4577    }
4578}
4579
4580impl CompositeConnectorProxy {
4581    /// Create a new Proxy for fuchsia.hardware.audio/CompositeConnector.
4582    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4583        let protocol_name =
4584            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4585        Self { client: fidl::client::Client::new(channel, protocol_name) }
4586    }
4587
4588    /// Get a Stream of events from the remote end of the protocol.
4589    ///
4590    /// # Panics
4591    ///
4592    /// Panics if the event stream was already taken.
4593    pub fn take_event_stream(&self) -> CompositeConnectorEventStream {
4594        CompositeConnectorEventStream { event_receiver: self.client.take_event_receiver() }
4595    }
4596
4597    /// Connect to a `Device` protocol.
4598    /// This method allows a component to serve FIDL outside the devhost's control.
4599    pub fn r#connect(
4600        &self,
4601        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4602    ) -> Result<(), fidl::Error> {
4603        CompositeConnectorProxyInterface::r#connect(self, composite_protocol)
4604    }
4605}
4606
4607impl CompositeConnectorProxyInterface for CompositeConnectorProxy {
4608    fn r#connect(
4609        &self,
4610        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4611    ) -> Result<(), fidl::Error> {
4612        self.client.send::<CompositeConnectorConnectRequest>(
4613            (composite_protocol,),
4614            0x7ee557529079e466,
4615            fidl::encoding::DynamicFlags::empty(),
4616        )
4617    }
4618}
4619
4620pub struct CompositeConnectorEventStream {
4621    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4622}
4623
4624impl std::marker::Unpin for CompositeConnectorEventStream {}
4625
4626impl futures::stream::FusedStream for CompositeConnectorEventStream {
4627    fn is_terminated(&self) -> bool {
4628        self.event_receiver.is_terminated()
4629    }
4630}
4631
4632impl futures::Stream for CompositeConnectorEventStream {
4633    type Item = Result<CompositeConnectorEvent, fidl::Error>;
4634
4635    fn poll_next(
4636        mut self: std::pin::Pin<&mut Self>,
4637        cx: &mut std::task::Context<'_>,
4638    ) -> std::task::Poll<Option<Self::Item>> {
4639        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4640            &mut self.event_receiver,
4641            cx
4642        )?) {
4643            Some(buf) => std::task::Poll::Ready(Some(CompositeConnectorEvent::decode(buf))),
4644            None => std::task::Poll::Ready(None),
4645        }
4646    }
4647}
4648
4649#[derive(Debug)]
4650pub enum CompositeConnectorEvent {}
4651
4652impl CompositeConnectorEvent {
4653    /// Decodes a message buffer as a [`CompositeConnectorEvent`].
4654    fn decode(
4655        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4656    ) -> Result<CompositeConnectorEvent, fidl::Error> {
4657        let (bytes, _handles) = buf.split_mut();
4658        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4659        debug_assert_eq!(tx_header.tx_id, 0);
4660        match tx_header.ordinal {
4661            _ => Err(fidl::Error::UnknownOrdinal {
4662                ordinal: tx_header.ordinal,
4663                protocol_name:
4664                    <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4665            }),
4666        }
4667    }
4668}
4669
4670/// A Stream of incoming requests for fuchsia.hardware.audio/CompositeConnector.
4671pub struct CompositeConnectorRequestStream {
4672    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4673    is_terminated: bool,
4674}
4675
4676impl std::marker::Unpin for CompositeConnectorRequestStream {}
4677
4678impl futures::stream::FusedStream for CompositeConnectorRequestStream {
4679    fn is_terminated(&self) -> bool {
4680        self.is_terminated
4681    }
4682}
4683
4684impl fidl::endpoints::RequestStream for CompositeConnectorRequestStream {
4685    type Protocol = CompositeConnectorMarker;
4686    type ControlHandle = CompositeConnectorControlHandle;
4687
4688    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4689        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4690    }
4691
4692    fn control_handle(&self) -> Self::ControlHandle {
4693        CompositeConnectorControlHandle { inner: self.inner.clone() }
4694    }
4695
4696    fn into_inner(
4697        self,
4698    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4699    {
4700        (self.inner, self.is_terminated)
4701    }
4702
4703    fn from_inner(
4704        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4705        is_terminated: bool,
4706    ) -> Self {
4707        Self { inner, is_terminated }
4708    }
4709}
4710
4711impl futures::Stream for CompositeConnectorRequestStream {
4712    type Item = Result<CompositeConnectorRequest, fidl::Error>;
4713
4714    fn poll_next(
4715        mut self: std::pin::Pin<&mut Self>,
4716        cx: &mut std::task::Context<'_>,
4717    ) -> std::task::Poll<Option<Self::Item>> {
4718        let this = &mut *self;
4719        if this.inner.check_shutdown(cx) {
4720            this.is_terminated = true;
4721            return std::task::Poll::Ready(None);
4722        }
4723        if this.is_terminated {
4724            panic!("polled CompositeConnectorRequestStream after completion");
4725        }
4726        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4727            |bytes, handles| {
4728                match this.inner.channel().read_etc(cx, bytes, handles) {
4729                    std::task::Poll::Ready(Ok(())) => {}
4730                    std::task::Poll::Pending => return std::task::Poll::Pending,
4731                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4732                        this.is_terminated = true;
4733                        return std::task::Poll::Ready(None);
4734                    }
4735                    std::task::Poll::Ready(Err(e)) => {
4736                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4737                            e.into(),
4738                        ))));
4739                    }
4740                }
4741
4742                // A message has been received from the channel
4743                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4744
4745                std::task::Poll::Ready(Some(match header.ordinal {
4746                0x7ee557529079e466 => {
4747                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4748                    let mut req = fidl::new_empty!(CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4749                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4750                    let control_handle = CompositeConnectorControlHandle {
4751                        inner: this.inner.clone(),
4752                    };
4753                    Ok(CompositeConnectorRequest::Connect {composite_protocol: req.composite_protocol,
4754
4755                        control_handle,
4756                    })
4757                }
4758                _ => Err(fidl::Error::UnknownOrdinal {
4759                    ordinal: header.ordinal,
4760                    protocol_name: <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4761                }),
4762            }))
4763            },
4764        )
4765    }
4766}
4767
4768/// For an overview see
4769/// [Audio Composite Devices](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md).
4770#[derive(Debug)]
4771pub enum CompositeConnectorRequest {
4772    /// Connect to a `Device` protocol.
4773    /// This method allows a component to serve FIDL outside the devhost's control.
4774    Connect {
4775        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4776        control_handle: CompositeConnectorControlHandle,
4777    },
4778}
4779
4780impl CompositeConnectorRequest {
4781    #[allow(irrefutable_let_patterns)]
4782    pub fn into_connect(
4783        self,
4784    ) -> Option<(fidl::endpoints::ServerEnd<CompositeMarker>, CompositeConnectorControlHandle)>
4785    {
4786        if let CompositeConnectorRequest::Connect { composite_protocol, control_handle } = self {
4787            Some((composite_protocol, control_handle))
4788        } else {
4789            None
4790        }
4791    }
4792
4793    /// Name of the method defined in FIDL
4794    pub fn method_name(&self) -> &'static str {
4795        match *self {
4796            CompositeConnectorRequest::Connect { .. } => "connect",
4797        }
4798    }
4799}
4800
4801#[derive(Debug, Clone)]
4802pub struct CompositeConnectorControlHandle {
4803    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4804}
4805
4806impl fidl::endpoints::ControlHandle for CompositeConnectorControlHandle {
4807    fn shutdown(&self) {
4808        self.inner.shutdown()
4809    }
4810
4811    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4812        self.inner.shutdown_with_epitaph(status)
4813    }
4814
4815    fn is_closed(&self) -> bool {
4816        self.inner.channel().is_closed()
4817    }
4818    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4819        self.inner.channel().on_closed()
4820    }
4821
4822    #[cfg(target_os = "fuchsia")]
4823    fn signal_peer(
4824        &self,
4825        clear_mask: zx::Signals,
4826        set_mask: zx::Signals,
4827    ) -> Result<(), zx_status::Status> {
4828        use fidl::Peered;
4829        self.inner.channel().signal_peer(clear_mask, set_mask)
4830    }
4831}
4832
4833impl CompositeConnectorControlHandle {}
4834
4835#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4836pub struct DaiMarker;
4837
4838impl fidl::endpoints::ProtocolMarker for DaiMarker {
4839    type Proxy = DaiProxy;
4840    type RequestStream = DaiRequestStream;
4841    #[cfg(target_os = "fuchsia")]
4842    type SynchronousProxy = DaiSynchronousProxy;
4843
4844    const DEBUG_NAME: &'static str = "(anonymous) Dai";
4845}
4846pub type DaiGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
4847pub type DaiGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, i32>;
4848
4849pub trait DaiProxyInterface: Send + Sync {
4850    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
4851        + Send;
4852    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
4853    fn r#signal_processing_connect(
4854        &self,
4855        protocol: fidl::endpoints::ServerEnd<
4856            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4857        >,
4858    ) -> Result<(), fidl::Error>;
4859    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4860    fn r#reset(&self) -> Self::ResetResponseFut;
4861    type GetPropertiesResponseFut: std::future::Future<Output = Result<DaiProperties, fidl::Error>>
4862        + Send;
4863    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
4864    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<DaiGetDaiFormatsResult, fidl::Error>>
4865        + Send;
4866    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
4867    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<DaiGetRingBufferFormatsResult, fidl::Error>>
4868        + Send;
4869    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut;
4870    fn r#create_ring_buffer(
4871        &self,
4872        dai_format: &DaiFormat,
4873        ring_buffer_format: &Format,
4874        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4875    ) -> Result<(), fidl::Error>;
4876}
4877#[derive(Debug)]
4878#[cfg(target_os = "fuchsia")]
4879pub struct DaiSynchronousProxy {
4880    client: fidl::client::sync::Client,
4881}
4882
4883#[cfg(target_os = "fuchsia")]
4884impl fidl::endpoints::SynchronousProxy for DaiSynchronousProxy {
4885    type Proxy = DaiProxy;
4886    type Protocol = DaiMarker;
4887
4888    fn from_channel(inner: fidl::Channel) -> Self {
4889        Self::new(inner)
4890    }
4891
4892    fn into_channel(self) -> fidl::Channel {
4893        self.client.into_channel()
4894    }
4895
4896    fn as_channel(&self) -> &fidl::Channel {
4897        self.client.as_channel()
4898    }
4899}
4900
4901#[cfg(target_os = "fuchsia")]
4902impl DaiSynchronousProxy {
4903    pub fn new(channel: fidl::Channel) -> Self {
4904        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4905        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4906    }
4907
4908    pub fn into_channel(self) -> fidl::Channel {
4909        self.client.into_channel()
4910    }
4911
4912    /// Waits until an event arrives and returns it. It is safe for other
4913    /// threads to make concurrent requests while waiting for an event.
4914    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<DaiEvent, fidl::Error> {
4915        DaiEvent::decode(self.client.wait_for_event(deadline)?)
4916    }
4917
4918    /// Retrieves top level health state.
4919    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4920    pub fn r#get_health_state(
4921        &self,
4922        ___deadline: zx::MonotonicInstant,
4923    ) -> Result<HealthState, fidl::Error> {
4924        let _response =
4925            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
4926                (),
4927                0x4e146d6bca733a84,
4928                fidl::encoding::DynamicFlags::empty(),
4929                ___deadline,
4930            )?;
4931        Ok(_response.state)
4932    }
4933
4934    /// Connect to a `SignalProcessing` protocol.
4935    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4936    /// the maximum number of connections have already been created, for instance one, then the
4937    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4938    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4939    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4940    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4941    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4942    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4943    /// is intended to be composed, and hence the more verbose name allows differentiation and
4944    /// improved clarity.
4945    pub fn r#signal_processing_connect(
4946        &self,
4947        mut protocol: fidl::endpoints::ServerEnd<
4948            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4949        >,
4950    ) -> Result<(), fidl::Error> {
4951        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4952            (protocol,),
4953            0xa81907ce6066295,
4954            fidl::encoding::DynamicFlags::empty(),
4955        )
4956    }
4957
4958    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4959    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4960    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4961    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4962    /// protocol channel and retry.
4963    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
4964        let _response =
4965            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
4966                (),
4967                0x69e5fa9fa2f78c14,
4968                fidl::encoding::DynamicFlags::empty(),
4969                ___deadline,
4970            )?;
4971        Ok(_response)
4972    }
4973
4974    /// Retrieves top level static properties.
4975    pub fn r#get_properties(
4976        &self,
4977        ___deadline: zx::MonotonicInstant,
4978    ) -> Result<DaiProperties, fidl::Error> {
4979        let _response =
4980            self.client.send_query::<fidl::encoding::EmptyPayload, DaiGetPropertiesResponse>(
4981                (),
4982                0x2c25a1a66149510b,
4983                fidl::encoding::DynamicFlags::empty(),
4984                ___deadline,
4985            )?;
4986        Ok(_response.properties)
4987    }
4988
4989    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4990    /// may reply with an error status and the client may retry at a later time.
4991    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4992    /// the parameters in SupportedFormats may be supported.
4993    pub fn r#get_dai_formats(
4994        &self,
4995        ___deadline: zx::MonotonicInstant,
4996    ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4997        let _response = self.client.send_query::<
4998            fidl::encoding::EmptyPayload,
4999            fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
5000        >(
5001            (),
5002            0x1eb37b0cddf79d69,
5003            fidl::encoding::DynamicFlags::empty(),
5004            ___deadline,
5005        )?;
5006        Ok(_response.map(|x| x.dai_formats))
5007    }
5008
5009    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5010    /// may reply with an error status and the client may retry at a later time.
5011    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5012    /// the parameters in `SupportedFormats` may be supported.
5013    pub fn r#get_ring_buffer_formats(
5014        &self,
5015        ___deadline: zx::MonotonicInstant,
5016    ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
5017        let _response = self.client.send_query::<
5018            fidl::encoding::EmptyPayload,
5019            fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
5020        >(
5021            (),
5022            0x760371081d8c92e4,
5023            fidl::encoding::DynamicFlags::empty(),
5024            ___deadline,
5025        )?;
5026        Ok(_response.map(|x| x.ring_buffer_formats))
5027    }
5028
5029    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5030    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5031    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5032    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5033    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5034    /// gracefully quiesce any on-going streaming operations in the process.
5035    pub fn r#create_ring_buffer(
5036        &self,
5037        mut dai_format: &DaiFormat,
5038        mut ring_buffer_format: &Format,
5039        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5040    ) -> Result<(), fidl::Error> {
5041        self.client.send::<DaiCreateRingBufferRequest>(
5042            (dai_format, ring_buffer_format, ring_buffer),
5043            0x5af9760589a75257,
5044            fidl::encoding::DynamicFlags::empty(),
5045        )
5046    }
5047}
5048
5049#[cfg(target_os = "fuchsia")]
5050impl From<DaiSynchronousProxy> for zx::NullableHandle {
5051    fn from(value: DaiSynchronousProxy) -> Self {
5052        value.into_channel().into()
5053    }
5054}
5055
5056#[cfg(target_os = "fuchsia")]
5057impl From<fidl::Channel> for DaiSynchronousProxy {
5058    fn from(value: fidl::Channel) -> Self {
5059        Self::new(value)
5060    }
5061}
5062
5063#[cfg(target_os = "fuchsia")]
5064impl fidl::endpoints::FromClient for DaiSynchronousProxy {
5065    type Protocol = DaiMarker;
5066
5067    fn from_client(value: fidl::endpoints::ClientEnd<DaiMarker>) -> Self {
5068        Self::new(value.into_channel())
5069    }
5070}
5071
5072#[derive(Debug, Clone)]
5073pub struct DaiProxy {
5074    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5075}
5076
5077impl fidl::endpoints::Proxy for DaiProxy {
5078    type Protocol = DaiMarker;
5079
5080    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5081        Self::new(inner)
5082    }
5083
5084    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5085        self.client.into_channel().map_err(|client| Self { client })
5086    }
5087
5088    fn as_channel(&self) -> &::fidl::AsyncChannel {
5089        self.client.as_channel()
5090    }
5091}
5092
5093impl DaiProxy {
5094    /// Create a new Proxy for fuchsia.hardware.audio/Dai.
5095    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5096        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5097        Self { client: fidl::client::Client::new(channel, protocol_name) }
5098    }
5099
5100    /// Get a Stream of events from the remote end of the protocol.
5101    ///
5102    /// # Panics
5103    ///
5104    /// Panics if the event stream was already taken.
5105    pub fn take_event_stream(&self) -> DaiEventStream {
5106        DaiEventStream { event_receiver: self.client.take_event_receiver() }
5107    }
5108
5109    /// Retrieves top level health state.
5110    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5111    pub fn r#get_health_state(
5112        &self,
5113    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
5114    {
5115        DaiProxyInterface::r#get_health_state(self)
5116    }
5117
5118    /// Connect to a `SignalProcessing` protocol.
5119    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
5120    /// the maximum number of connections have already been created, for instance one, then the
5121    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
5122    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
5123    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
5124    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
5125    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
5126    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
5127    /// is intended to be composed, and hence the more verbose name allows differentiation and
5128    /// improved clarity.
5129    pub fn r#signal_processing_connect(
5130        &self,
5131        mut protocol: fidl::endpoints::ServerEnd<
5132            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5133        >,
5134    ) -> Result<(), fidl::Error> {
5135        DaiProxyInterface::r#signal_processing_connect(self, protocol)
5136    }
5137
5138    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5139    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5140    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5141    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5142    /// protocol channel and retry.
5143    pub fn r#reset(
5144        &self,
5145    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5146        DaiProxyInterface::r#reset(self)
5147    }
5148
5149    /// Retrieves top level static properties.
5150    pub fn r#get_properties(
5151        &self,
5152    ) -> fidl::client::QueryResponseFut<DaiProperties, fidl::encoding::DefaultFuchsiaResourceDialect>
5153    {
5154        DaiProxyInterface::r#get_properties(self)
5155    }
5156
5157    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5158    /// may reply with an error status and the client may retry at a later time.
5159    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5160    /// the parameters in SupportedFormats may be supported.
5161    pub fn r#get_dai_formats(
5162        &self,
5163    ) -> fidl::client::QueryResponseFut<
5164        DaiGetDaiFormatsResult,
5165        fidl::encoding::DefaultFuchsiaResourceDialect,
5166    > {
5167        DaiProxyInterface::r#get_dai_formats(self)
5168    }
5169
5170    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5171    /// may reply with an error status and the client may retry at a later time.
5172    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5173    /// the parameters in `SupportedFormats` may be supported.
5174    pub fn r#get_ring_buffer_formats(
5175        &self,
5176    ) -> fidl::client::QueryResponseFut<
5177        DaiGetRingBufferFormatsResult,
5178        fidl::encoding::DefaultFuchsiaResourceDialect,
5179    > {
5180        DaiProxyInterface::r#get_ring_buffer_formats(self)
5181    }
5182
5183    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5184    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5185    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5186    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5187    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5188    /// gracefully quiesce any on-going streaming operations in the process.
5189    pub fn r#create_ring_buffer(
5190        &self,
5191        mut dai_format: &DaiFormat,
5192        mut ring_buffer_format: &Format,
5193        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5194    ) -> Result<(), fidl::Error> {
5195        DaiProxyInterface::r#create_ring_buffer(self, dai_format, ring_buffer_format, ring_buffer)
5196    }
5197}
5198
5199impl DaiProxyInterface for DaiProxy {
5200    type GetHealthStateResponseFut =
5201        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
5202    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
5203        fn _decode(
5204            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5205        ) -> Result<HealthState, fidl::Error> {
5206            let _response = fidl::client::decode_transaction_body::<
5207                HealthGetHealthStateResponse,
5208                fidl::encoding::DefaultFuchsiaResourceDialect,
5209                0x4e146d6bca733a84,
5210            >(_buf?)?;
5211            Ok(_response.state)
5212        }
5213        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
5214            (),
5215            0x4e146d6bca733a84,
5216            fidl::encoding::DynamicFlags::empty(),
5217            _decode,
5218        )
5219    }
5220
5221    fn r#signal_processing_connect(
5222        &self,
5223        mut protocol: fidl::endpoints::ServerEnd<
5224            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5225        >,
5226    ) -> Result<(), fidl::Error> {
5227        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
5228            (protocol,),
5229            0xa81907ce6066295,
5230            fidl::encoding::DynamicFlags::empty(),
5231        )
5232    }
5233
5234    type ResetResponseFut =
5235        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5236    fn r#reset(&self) -> Self::ResetResponseFut {
5237        fn _decode(
5238            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5239        ) -> Result<(), fidl::Error> {
5240            let _response = fidl::client::decode_transaction_body::<
5241                fidl::encoding::EmptyPayload,
5242                fidl::encoding::DefaultFuchsiaResourceDialect,
5243                0x69e5fa9fa2f78c14,
5244            >(_buf?)?;
5245            Ok(_response)
5246        }
5247        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
5248            (),
5249            0x69e5fa9fa2f78c14,
5250            fidl::encoding::DynamicFlags::empty(),
5251            _decode,
5252        )
5253    }
5254
5255    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
5256        DaiProperties,
5257        fidl::encoding::DefaultFuchsiaResourceDialect,
5258    >;
5259    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
5260        fn _decode(
5261            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5262        ) -> Result<DaiProperties, fidl::Error> {
5263            let _response = fidl::client::decode_transaction_body::<
5264                DaiGetPropertiesResponse,
5265                fidl::encoding::DefaultFuchsiaResourceDialect,
5266                0x2c25a1a66149510b,
5267            >(_buf?)?;
5268            Ok(_response.properties)
5269        }
5270        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiProperties>(
5271            (),
5272            0x2c25a1a66149510b,
5273            fidl::encoding::DynamicFlags::empty(),
5274            _decode,
5275        )
5276    }
5277
5278    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
5279        DaiGetDaiFormatsResult,
5280        fidl::encoding::DefaultFuchsiaResourceDialect,
5281    >;
5282    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
5283        fn _decode(
5284            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5285        ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
5286            let _response = fidl::client::decode_transaction_body::<
5287                fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
5288                fidl::encoding::DefaultFuchsiaResourceDialect,
5289                0x1eb37b0cddf79d69,
5290            >(_buf?)?;
5291            Ok(_response.map(|x| x.dai_formats))
5292        }
5293        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetDaiFormatsResult>(
5294            (),
5295            0x1eb37b0cddf79d69,
5296            fidl::encoding::DynamicFlags::empty(),
5297            _decode,
5298        )
5299    }
5300
5301    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
5302        DaiGetRingBufferFormatsResult,
5303        fidl::encoding::DefaultFuchsiaResourceDialect,
5304    >;
5305    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut {
5306        fn _decode(
5307            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5308        ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
5309            let _response = fidl::client::decode_transaction_body::<
5310                fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
5311                fidl::encoding::DefaultFuchsiaResourceDialect,
5312                0x760371081d8c92e4,
5313            >(_buf?)?;
5314            Ok(_response.map(|x| x.ring_buffer_formats))
5315        }
5316        self.client
5317            .send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetRingBufferFormatsResult>(
5318                (),
5319                0x760371081d8c92e4,
5320                fidl::encoding::DynamicFlags::empty(),
5321                _decode,
5322            )
5323    }
5324
5325    fn r#create_ring_buffer(
5326        &self,
5327        mut dai_format: &DaiFormat,
5328        mut ring_buffer_format: &Format,
5329        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5330    ) -> Result<(), fidl::Error> {
5331        self.client.send::<DaiCreateRingBufferRequest>(
5332            (dai_format, ring_buffer_format, ring_buffer),
5333            0x5af9760589a75257,
5334            fidl::encoding::DynamicFlags::empty(),
5335        )
5336    }
5337}
5338
5339pub struct DaiEventStream {
5340    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5341}
5342
5343impl std::marker::Unpin for DaiEventStream {}
5344
5345impl futures::stream::FusedStream for DaiEventStream {
5346    fn is_terminated(&self) -> bool {
5347        self.event_receiver.is_terminated()
5348    }
5349}
5350
5351impl futures::Stream for DaiEventStream {
5352    type Item = Result<DaiEvent, fidl::Error>;
5353
5354    fn poll_next(
5355        mut self: std::pin::Pin<&mut Self>,
5356        cx: &mut std::task::Context<'_>,
5357    ) -> std::task::Poll<Option<Self::Item>> {
5358        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5359            &mut self.event_receiver,
5360            cx
5361        )?) {
5362            Some(buf) => std::task::Poll::Ready(Some(DaiEvent::decode(buf))),
5363            None => std::task::Poll::Ready(None),
5364        }
5365    }
5366}
5367
5368#[derive(Debug)]
5369pub enum DaiEvent {}
5370
5371impl DaiEvent {
5372    /// Decodes a message buffer as a [`DaiEvent`].
5373    fn decode(
5374        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5375    ) -> Result<DaiEvent, fidl::Error> {
5376        let (bytes, _handles) = buf.split_mut();
5377        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5378        debug_assert_eq!(tx_header.tx_id, 0);
5379        match tx_header.ordinal {
5380            _ => Err(fidl::Error::UnknownOrdinal {
5381                ordinal: tx_header.ordinal,
5382                protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5383            }),
5384        }
5385    }
5386}
5387
5388/// A Stream of incoming requests for fuchsia.hardware.audio/Dai.
5389pub struct DaiRequestStream {
5390    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5391    is_terminated: bool,
5392}
5393
5394impl std::marker::Unpin for DaiRequestStream {}
5395
5396impl futures::stream::FusedStream for DaiRequestStream {
5397    fn is_terminated(&self) -> bool {
5398        self.is_terminated
5399    }
5400}
5401
5402impl fidl::endpoints::RequestStream for DaiRequestStream {
5403    type Protocol = DaiMarker;
5404    type ControlHandle = DaiControlHandle;
5405
5406    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5407        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5408    }
5409
5410    fn control_handle(&self) -> Self::ControlHandle {
5411        DaiControlHandle { inner: self.inner.clone() }
5412    }
5413
5414    fn into_inner(
5415        self,
5416    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5417    {
5418        (self.inner, self.is_terminated)
5419    }
5420
5421    fn from_inner(
5422        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5423        is_terminated: bool,
5424    ) -> Self {
5425        Self { inner, is_terminated }
5426    }
5427}
5428
5429impl futures::Stream for DaiRequestStream {
5430    type Item = Result<DaiRequest, fidl::Error>;
5431
5432    fn poll_next(
5433        mut self: std::pin::Pin<&mut Self>,
5434        cx: &mut std::task::Context<'_>,
5435    ) -> std::task::Poll<Option<Self::Item>> {
5436        let this = &mut *self;
5437        if this.inner.check_shutdown(cx) {
5438            this.is_terminated = true;
5439            return std::task::Poll::Ready(None);
5440        }
5441        if this.is_terminated {
5442            panic!("polled DaiRequestStream after completion");
5443        }
5444        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5445            |bytes, handles| {
5446                match this.inner.channel().read_etc(cx, bytes, handles) {
5447                    std::task::Poll::Ready(Ok(())) => {}
5448                    std::task::Poll::Pending => return std::task::Poll::Pending,
5449                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5450                        this.is_terminated = true;
5451                        return std::task::Poll::Ready(None);
5452                    }
5453                    std::task::Poll::Ready(Err(e)) => {
5454                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5455                            e.into(),
5456                        ))));
5457                    }
5458                }
5459
5460                // A message has been received from the channel
5461                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5462
5463                std::task::Poll::Ready(Some(match header.ordinal {
5464                    0x4e146d6bca733a84 => {
5465                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5466                        let mut req = fidl::new_empty!(
5467                            fidl::encoding::EmptyPayload,
5468                            fidl::encoding::DefaultFuchsiaResourceDialect
5469                        );
5470                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5471                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5472                        Ok(DaiRequest::GetHealthState {
5473                            responder: DaiGetHealthStateResponder {
5474                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5475                                tx_id: header.tx_id,
5476                            },
5477                        })
5478                    }
5479                    0xa81907ce6066295 => {
5480                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5481                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5482                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5483                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5484                        Ok(DaiRequest::SignalProcessingConnect {
5485                            protocol: req.protocol,
5486
5487                            control_handle,
5488                        })
5489                    }
5490                    0x69e5fa9fa2f78c14 => {
5491                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5492                        let mut req = fidl::new_empty!(
5493                            fidl::encoding::EmptyPayload,
5494                            fidl::encoding::DefaultFuchsiaResourceDialect
5495                        );
5496                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5497                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5498                        Ok(DaiRequest::Reset {
5499                            responder: DaiResetResponder {
5500                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5501                                tx_id: header.tx_id,
5502                            },
5503                        })
5504                    }
5505                    0x2c25a1a66149510b => {
5506                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5507                        let mut req = fidl::new_empty!(
5508                            fidl::encoding::EmptyPayload,
5509                            fidl::encoding::DefaultFuchsiaResourceDialect
5510                        );
5511                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5512                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5513                        Ok(DaiRequest::GetProperties {
5514                            responder: DaiGetPropertiesResponder {
5515                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5516                                tx_id: header.tx_id,
5517                            },
5518                        })
5519                    }
5520                    0x1eb37b0cddf79d69 => {
5521                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5522                        let mut req = fidl::new_empty!(
5523                            fidl::encoding::EmptyPayload,
5524                            fidl::encoding::DefaultFuchsiaResourceDialect
5525                        );
5526                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5527                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5528                        Ok(DaiRequest::GetDaiFormats {
5529                            responder: DaiGetDaiFormatsResponder {
5530                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5531                                tx_id: header.tx_id,
5532                            },
5533                        })
5534                    }
5535                    0x760371081d8c92e4 => {
5536                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5537                        let mut req = fidl::new_empty!(
5538                            fidl::encoding::EmptyPayload,
5539                            fidl::encoding::DefaultFuchsiaResourceDialect
5540                        );
5541                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5542                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5543                        Ok(DaiRequest::GetRingBufferFormats {
5544                            responder: DaiGetRingBufferFormatsResponder {
5545                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5546                                tx_id: header.tx_id,
5547                            },
5548                        })
5549                    }
5550                    0x5af9760589a75257 => {
5551                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5552                        let mut req = fidl::new_empty!(
5553                            DaiCreateRingBufferRequest,
5554                            fidl::encoding::DefaultFuchsiaResourceDialect
5555                        );
5556                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
5557                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5558                        Ok(DaiRequest::CreateRingBuffer {
5559                            dai_format: req.dai_format,
5560                            ring_buffer_format: req.ring_buffer_format,
5561                            ring_buffer: req.ring_buffer,
5562
5563                            control_handle,
5564                        })
5565                    }
5566                    _ => Err(fidl::Error::UnknownOrdinal {
5567                        ordinal: header.ordinal,
5568                        protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5569                    }),
5570                }))
5571            },
5572        )
5573    }
5574}
5575
5576/// For an overview see
5577/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_dai).
5578/// # Deprecation
5579///
5580/// Not supported anymore, instead use an
5581/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5582/// with one DAI and one Ring Buffer, see
5583/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5584#[derive(Debug)]
5585pub enum DaiRequest {
5586    /// Retrieves top level health state.
5587    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5588    GetHealthState { responder: DaiGetHealthStateResponder },
5589    /// Connect to a `SignalProcessing` protocol.
5590    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
5591    /// the maximum number of connections have already been created, for instance one, then the
5592    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
5593    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
5594    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
5595    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
5596    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
5597    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
5598    /// is intended to be composed, and hence the more verbose name allows differentiation and
5599    /// improved clarity.
5600    SignalProcessingConnect {
5601        protocol: fidl::endpoints::ServerEnd<
5602            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5603        >,
5604        control_handle: DaiControlHandle,
5605    },
5606    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5607    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5608    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5609    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5610    /// protocol channel and retry.
5611    Reset { responder: DaiResetResponder },
5612    /// Retrieves top level static properties.
5613    GetProperties { responder: DaiGetPropertiesResponder },
5614    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5615    /// may reply with an error status and the client may retry at a later time.
5616    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5617    /// the parameters in SupportedFormats may be supported.
5618    GetDaiFormats { responder: DaiGetDaiFormatsResponder },
5619    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5620    /// may reply with an error status and the client may retry at a later time.
5621    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5622    /// the parameters in `SupportedFormats` may be supported.
5623    GetRingBufferFormats { responder: DaiGetRingBufferFormatsResponder },
5624    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5625    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5626    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5627    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5628    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5629    /// gracefully quiesce any on-going streaming operations in the process.
5630    CreateRingBuffer {
5631        dai_format: DaiFormat,
5632        ring_buffer_format: Format,
5633        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5634        control_handle: DaiControlHandle,
5635    },
5636}
5637
5638impl DaiRequest {
5639    #[allow(irrefutable_let_patterns)]
5640    pub fn into_get_health_state(self) -> Option<(DaiGetHealthStateResponder)> {
5641        if let DaiRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
5642    }
5643
5644    #[allow(irrefutable_let_patterns)]
5645    pub fn into_signal_processing_connect(
5646        self,
5647    ) -> Option<(
5648        fidl::endpoints::ServerEnd<
5649            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5650        >,
5651        DaiControlHandle,
5652    )> {
5653        if let DaiRequest::SignalProcessingConnect { protocol, control_handle } = self {
5654            Some((protocol, control_handle))
5655        } else {
5656            None
5657        }
5658    }
5659
5660    #[allow(irrefutable_let_patterns)]
5661    pub fn into_reset(self) -> Option<(DaiResetResponder)> {
5662        if let DaiRequest::Reset { responder } = self { Some((responder)) } else { None }
5663    }
5664
5665    #[allow(irrefutable_let_patterns)]
5666    pub fn into_get_properties(self) -> Option<(DaiGetPropertiesResponder)> {
5667        if let DaiRequest::GetProperties { responder } = self { Some((responder)) } else { None }
5668    }
5669
5670    #[allow(irrefutable_let_patterns)]
5671    pub fn into_get_dai_formats(self) -> Option<(DaiGetDaiFormatsResponder)> {
5672        if let DaiRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
5673    }
5674
5675    #[allow(irrefutable_let_patterns)]
5676    pub fn into_get_ring_buffer_formats(self) -> Option<(DaiGetRingBufferFormatsResponder)> {
5677        if let DaiRequest::GetRingBufferFormats { responder } = self {
5678            Some((responder))
5679        } else {
5680            None
5681        }
5682    }
5683
5684    #[allow(irrefutable_let_patterns)]
5685    pub fn into_create_ring_buffer(
5686        self,
5687    ) -> Option<(DaiFormat, Format, fidl::endpoints::ServerEnd<RingBufferMarker>, DaiControlHandle)>
5688    {
5689        if let DaiRequest::CreateRingBuffer {
5690            dai_format,
5691            ring_buffer_format,
5692            ring_buffer,
5693            control_handle,
5694        } = self
5695        {
5696            Some((dai_format, ring_buffer_format, ring_buffer, control_handle))
5697        } else {
5698            None
5699        }
5700    }
5701
5702    /// Name of the method defined in FIDL
5703    pub fn method_name(&self) -> &'static str {
5704        match *self {
5705            DaiRequest::GetHealthState { .. } => "get_health_state",
5706            DaiRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
5707            DaiRequest::Reset { .. } => "reset",
5708            DaiRequest::GetProperties { .. } => "get_properties",
5709            DaiRequest::GetDaiFormats { .. } => "get_dai_formats",
5710            DaiRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
5711            DaiRequest::CreateRingBuffer { .. } => "create_ring_buffer",
5712        }
5713    }
5714}
5715
5716#[derive(Debug, Clone)]
5717pub struct DaiControlHandle {
5718    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5719}
5720
5721impl fidl::endpoints::ControlHandle for DaiControlHandle {
5722    fn shutdown(&self) {
5723        self.inner.shutdown()
5724    }
5725
5726    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5727        self.inner.shutdown_with_epitaph(status)
5728    }
5729
5730    fn is_closed(&self) -> bool {
5731        self.inner.channel().is_closed()
5732    }
5733    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5734        self.inner.channel().on_closed()
5735    }
5736
5737    #[cfg(target_os = "fuchsia")]
5738    fn signal_peer(
5739        &self,
5740        clear_mask: zx::Signals,
5741        set_mask: zx::Signals,
5742    ) -> Result<(), zx_status::Status> {
5743        use fidl::Peered;
5744        self.inner.channel().signal_peer(clear_mask, set_mask)
5745    }
5746}
5747
5748impl DaiControlHandle {}
5749
5750#[must_use = "FIDL methods require a response to be sent"]
5751#[derive(Debug)]
5752pub struct DaiGetHealthStateResponder {
5753    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5754    tx_id: u32,
5755}
5756
5757/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5758/// if the responder is dropped without sending a response, so that the client
5759/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5760impl std::ops::Drop for DaiGetHealthStateResponder {
5761    fn drop(&mut self) {
5762        self.control_handle.shutdown();
5763        // Safety: drops once, never accessed again
5764        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5765    }
5766}
5767
5768impl fidl::endpoints::Responder for DaiGetHealthStateResponder {
5769    type ControlHandle = DaiControlHandle;
5770
5771    fn control_handle(&self) -> &DaiControlHandle {
5772        &self.control_handle
5773    }
5774
5775    fn drop_without_shutdown(mut self) {
5776        // Safety: drops once, never accessed again due to mem::forget
5777        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5778        // Prevent Drop from running (which would shut down the channel)
5779        std::mem::forget(self);
5780    }
5781}
5782
5783impl DaiGetHealthStateResponder {
5784    /// Sends a response to the FIDL transaction.
5785    ///
5786    /// Sets the channel to shutdown if an error occurs.
5787    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5788        let _result = self.send_raw(state);
5789        if _result.is_err() {
5790            self.control_handle.shutdown();
5791        }
5792        self.drop_without_shutdown();
5793        _result
5794    }
5795
5796    /// Similar to "send" but does not shutdown the channel if an error occurs.
5797    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5798        let _result = self.send_raw(state);
5799        self.drop_without_shutdown();
5800        _result
5801    }
5802
5803    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
5804        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
5805            (state,),
5806            self.tx_id,
5807            0x4e146d6bca733a84,
5808            fidl::encoding::DynamicFlags::empty(),
5809        )
5810    }
5811}
5812
5813#[must_use = "FIDL methods require a response to be sent"]
5814#[derive(Debug)]
5815pub struct DaiResetResponder {
5816    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5817    tx_id: u32,
5818}
5819
5820/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5821/// if the responder is dropped without sending a response, so that the client
5822/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5823impl std::ops::Drop for DaiResetResponder {
5824    fn drop(&mut self) {
5825        self.control_handle.shutdown();
5826        // Safety: drops once, never accessed again
5827        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5828    }
5829}
5830
5831impl fidl::endpoints::Responder for DaiResetResponder {
5832    type ControlHandle = DaiControlHandle;
5833
5834    fn control_handle(&self) -> &DaiControlHandle {
5835        &self.control_handle
5836    }
5837
5838    fn drop_without_shutdown(mut self) {
5839        // Safety: drops once, never accessed again due to mem::forget
5840        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5841        // Prevent Drop from running (which would shut down the channel)
5842        std::mem::forget(self);
5843    }
5844}
5845
5846impl DaiResetResponder {
5847    /// Sends a response to the FIDL transaction.
5848    ///
5849    /// Sets the channel to shutdown if an error occurs.
5850    pub fn send(self) -> Result<(), fidl::Error> {
5851        let _result = self.send_raw();
5852        if _result.is_err() {
5853            self.control_handle.shutdown();
5854        }
5855        self.drop_without_shutdown();
5856        _result
5857    }
5858
5859    /// Similar to "send" but does not shutdown the channel if an error occurs.
5860    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5861        let _result = self.send_raw();
5862        self.drop_without_shutdown();
5863        _result
5864    }
5865
5866    fn send_raw(&self) -> Result<(), fidl::Error> {
5867        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5868            (),
5869            self.tx_id,
5870            0x69e5fa9fa2f78c14,
5871            fidl::encoding::DynamicFlags::empty(),
5872        )
5873    }
5874}
5875
5876#[must_use = "FIDL methods require a response to be sent"]
5877#[derive(Debug)]
5878pub struct DaiGetPropertiesResponder {
5879    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5880    tx_id: u32,
5881}
5882
5883/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5884/// if the responder is dropped without sending a response, so that the client
5885/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5886impl std::ops::Drop for DaiGetPropertiesResponder {
5887    fn drop(&mut self) {
5888        self.control_handle.shutdown();
5889        // Safety: drops once, never accessed again
5890        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5891    }
5892}
5893
5894impl fidl::endpoints::Responder for DaiGetPropertiesResponder {
5895    type ControlHandle = DaiControlHandle;
5896
5897    fn control_handle(&self) -> &DaiControlHandle {
5898        &self.control_handle
5899    }
5900
5901    fn drop_without_shutdown(mut self) {
5902        // Safety: drops once, never accessed again due to mem::forget
5903        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5904        // Prevent Drop from running (which would shut down the channel)
5905        std::mem::forget(self);
5906    }
5907}
5908
5909impl DaiGetPropertiesResponder {
5910    /// Sends a response to the FIDL transaction.
5911    ///
5912    /// Sets the channel to shutdown if an error occurs.
5913    pub fn send(self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5914        let _result = self.send_raw(properties);
5915        if _result.is_err() {
5916            self.control_handle.shutdown();
5917        }
5918        self.drop_without_shutdown();
5919        _result
5920    }
5921
5922    /// Similar to "send" but does not shutdown the channel if an error occurs.
5923    pub fn send_no_shutdown_on_err(
5924        self,
5925        mut properties: &DaiProperties,
5926    ) -> Result<(), fidl::Error> {
5927        let _result = self.send_raw(properties);
5928        self.drop_without_shutdown();
5929        _result
5930    }
5931
5932    fn send_raw(&self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5933        self.control_handle.inner.send::<DaiGetPropertiesResponse>(
5934            (properties,),
5935            self.tx_id,
5936            0x2c25a1a66149510b,
5937            fidl::encoding::DynamicFlags::empty(),
5938        )
5939    }
5940}
5941
5942#[must_use = "FIDL methods require a response to be sent"]
5943#[derive(Debug)]
5944pub struct DaiGetDaiFormatsResponder {
5945    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5946    tx_id: u32,
5947}
5948
5949/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5950/// if the responder is dropped without sending a response, so that the client
5951/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5952impl std::ops::Drop for DaiGetDaiFormatsResponder {
5953    fn drop(&mut self) {
5954        self.control_handle.shutdown();
5955        // Safety: drops once, never accessed again
5956        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5957    }
5958}
5959
5960impl fidl::endpoints::Responder for DaiGetDaiFormatsResponder {
5961    type ControlHandle = DaiControlHandle;
5962
5963    fn control_handle(&self) -> &DaiControlHandle {
5964        &self.control_handle
5965    }
5966
5967    fn drop_without_shutdown(mut self) {
5968        // Safety: drops once, never accessed again due to mem::forget
5969        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5970        // Prevent Drop from running (which would shut down the channel)
5971        std::mem::forget(self);
5972    }
5973}
5974
5975impl DaiGetDaiFormatsResponder {
5976    /// Sends a response to the FIDL transaction.
5977    ///
5978    /// Sets the channel to shutdown if an error occurs.
5979    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5980        let _result = self.send_raw(result);
5981        if _result.is_err() {
5982            self.control_handle.shutdown();
5983        }
5984        self.drop_without_shutdown();
5985        _result
5986    }
5987
5988    /// Similar to "send" but does not shutdown the channel if an error occurs.
5989    pub fn send_no_shutdown_on_err(
5990        self,
5991        mut result: Result<&[DaiSupportedFormats], i32>,
5992    ) -> Result<(), fidl::Error> {
5993        let _result = self.send_raw(result);
5994        self.drop_without_shutdown();
5995        _result
5996    }
5997
5998    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5999        self.control_handle.inner.send::<fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>>(
6000            result.map(|dai_formats| (dai_formats,)),
6001            self.tx_id,
6002            0x1eb37b0cddf79d69,
6003            fidl::encoding::DynamicFlags::empty(),
6004        )
6005    }
6006}
6007
6008#[must_use = "FIDL methods require a response to be sent"]
6009#[derive(Debug)]
6010pub struct DaiGetRingBufferFormatsResponder {
6011    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
6012    tx_id: u32,
6013}
6014
6015/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
6016/// if the responder is dropped without sending a response, so that the client
6017/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6018impl std::ops::Drop for DaiGetRingBufferFormatsResponder {
6019    fn drop(&mut self) {
6020        self.control_handle.shutdown();
6021        // Safety: drops once, never accessed again
6022        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6023    }
6024}
6025
6026impl fidl::endpoints::Responder for DaiGetRingBufferFormatsResponder {
6027    type ControlHandle = DaiControlHandle;
6028
6029    fn control_handle(&self) -> &DaiControlHandle {
6030        &self.control_handle
6031    }
6032
6033    fn drop_without_shutdown(mut self) {
6034        // Safety: drops once, never accessed again due to mem::forget
6035        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6036        // Prevent Drop from running (which would shut down the channel)
6037        std::mem::forget(self);
6038    }
6039}
6040
6041impl DaiGetRingBufferFormatsResponder {
6042    /// Sends a response to the FIDL transaction.
6043    ///
6044    /// Sets the channel to shutdown if an error occurs.
6045    pub fn send(self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
6046        let _result = self.send_raw(result);
6047        if _result.is_err() {
6048            self.control_handle.shutdown();
6049        }
6050        self.drop_without_shutdown();
6051        _result
6052    }
6053
6054    /// Similar to "send" but does not shutdown the channel if an error occurs.
6055    pub fn send_no_shutdown_on_err(
6056        self,
6057        mut result: Result<&[SupportedFormats], i32>,
6058    ) -> Result<(), fidl::Error> {
6059        let _result = self.send_raw(result);
6060        self.drop_without_shutdown();
6061        _result
6062    }
6063
6064    fn send_raw(&self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
6065        self.control_handle
6066            .inner
6067            .send::<fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>>(
6068                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
6069                self.tx_id,
6070                0x760371081d8c92e4,
6071                fidl::encoding::DynamicFlags::empty(),
6072            )
6073    }
6074}
6075
6076#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6077pub struct DaiConnectorMarker;
6078
6079impl fidl::endpoints::ProtocolMarker for DaiConnectorMarker {
6080    type Proxy = DaiConnectorProxy;
6081    type RequestStream = DaiConnectorRequestStream;
6082    #[cfg(target_os = "fuchsia")]
6083    type SynchronousProxy = DaiConnectorSynchronousProxy;
6084
6085    const DEBUG_NAME: &'static str = "(anonymous) DaiConnector";
6086}
6087
6088pub trait DaiConnectorProxyInterface: Send + Sync {
6089    fn r#connect(
6090        &self,
6091        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6092    ) -> Result<(), fidl::Error>;
6093}
6094#[derive(Debug)]
6095#[cfg(target_os = "fuchsia")]
6096pub struct DaiConnectorSynchronousProxy {
6097    client: fidl::client::sync::Client,
6098}
6099
6100#[cfg(target_os = "fuchsia")]
6101impl fidl::endpoints::SynchronousProxy for DaiConnectorSynchronousProxy {
6102    type Proxy = DaiConnectorProxy;
6103    type Protocol = DaiConnectorMarker;
6104
6105    fn from_channel(inner: fidl::Channel) -> Self {
6106        Self::new(inner)
6107    }
6108
6109    fn into_channel(self) -> fidl::Channel {
6110        self.client.into_channel()
6111    }
6112
6113    fn as_channel(&self) -> &fidl::Channel {
6114        self.client.as_channel()
6115    }
6116}
6117
6118#[cfg(target_os = "fuchsia")]
6119impl DaiConnectorSynchronousProxy {
6120    pub fn new(channel: fidl::Channel) -> Self {
6121        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6122        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6123    }
6124
6125    pub fn into_channel(self) -> fidl::Channel {
6126        self.client.into_channel()
6127    }
6128
6129    /// Waits until an event arrives and returns it. It is safe for other
6130    /// threads to make concurrent requests while waiting for an event.
6131    pub fn wait_for_event(
6132        &self,
6133        deadline: zx::MonotonicInstant,
6134    ) -> Result<DaiConnectorEvent, fidl::Error> {
6135        DaiConnectorEvent::decode(self.client.wait_for_event(deadline)?)
6136    }
6137
6138    /// This connects to a DAI protocol server.
6139    pub fn r#connect(
6140        &self,
6141        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6142    ) -> Result<(), fidl::Error> {
6143        self.client.send::<DaiConnectorConnectRequest>(
6144            (dai_protocol,),
6145            0x4e4db05c2eca1450,
6146            fidl::encoding::DynamicFlags::empty(),
6147        )
6148    }
6149}
6150
6151#[cfg(target_os = "fuchsia")]
6152impl From<DaiConnectorSynchronousProxy> for zx::NullableHandle {
6153    fn from(value: DaiConnectorSynchronousProxy) -> Self {
6154        value.into_channel().into()
6155    }
6156}
6157
6158#[cfg(target_os = "fuchsia")]
6159impl From<fidl::Channel> for DaiConnectorSynchronousProxy {
6160    fn from(value: fidl::Channel) -> Self {
6161        Self::new(value)
6162    }
6163}
6164
6165#[cfg(target_os = "fuchsia")]
6166impl fidl::endpoints::FromClient for DaiConnectorSynchronousProxy {
6167    type Protocol = DaiConnectorMarker;
6168
6169    fn from_client(value: fidl::endpoints::ClientEnd<DaiConnectorMarker>) -> Self {
6170        Self::new(value.into_channel())
6171    }
6172}
6173
6174#[derive(Debug, Clone)]
6175pub struct DaiConnectorProxy {
6176    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6177}
6178
6179impl fidl::endpoints::Proxy for DaiConnectorProxy {
6180    type Protocol = DaiConnectorMarker;
6181
6182    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6183        Self::new(inner)
6184    }
6185
6186    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6187        self.client.into_channel().map_err(|client| Self { client })
6188    }
6189
6190    fn as_channel(&self) -> &::fidl::AsyncChannel {
6191        self.client.as_channel()
6192    }
6193}
6194
6195impl DaiConnectorProxy {
6196    /// Create a new Proxy for fuchsia.hardware.audio/DaiConnector.
6197    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6198        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6199        Self { client: fidl::client::Client::new(channel, protocol_name) }
6200    }
6201
6202    /// Get a Stream of events from the remote end of the protocol.
6203    ///
6204    /// # Panics
6205    ///
6206    /// Panics if the event stream was already taken.
6207    pub fn take_event_stream(&self) -> DaiConnectorEventStream {
6208        DaiConnectorEventStream { event_receiver: self.client.take_event_receiver() }
6209    }
6210
6211    /// This connects to a DAI protocol server.
6212    pub fn r#connect(
6213        &self,
6214        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6215    ) -> Result<(), fidl::Error> {
6216        DaiConnectorProxyInterface::r#connect(self, dai_protocol)
6217    }
6218}
6219
6220impl DaiConnectorProxyInterface for DaiConnectorProxy {
6221    fn r#connect(
6222        &self,
6223        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6224    ) -> Result<(), fidl::Error> {
6225        self.client.send::<DaiConnectorConnectRequest>(
6226            (dai_protocol,),
6227            0x4e4db05c2eca1450,
6228            fidl::encoding::DynamicFlags::empty(),
6229        )
6230    }
6231}
6232
6233pub struct DaiConnectorEventStream {
6234    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6235}
6236
6237impl std::marker::Unpin for DaiConnectorEventStream {}
6238
6239impl futures::stream::FusedStream for DaiConnectorEventStream {
6240    fn is_terminated(&self) -> bool {
6241        self.event_receiver.is_terminated()
6242    }
6243}
6244
6245impl futures::Stream for DaiConnectorEventStream {
6246    type Item = Result<DaiConnectorEvent, fidl::Error>;
6247
6248    fn poll_next(
6249        mut self: std::pin::Pin<&mut Self>,
6250        cx: &mut std::task::Context<'_>,
6251    ) -> std::task::Poll<Option<Self::Item>> {
6252        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6253            &mut self.event_receiver,
6254            cx
6255        )?) {
6256            Some(buf) => std::task::Poll::Ready(Some(DaiConnectorEvent::decode(buf))),
6257            None => std::task::Poll::Ready(None),
6258        }
6259    }
6260}
6261
6262#[derive(Debug)]
6263pub enum DaiConnectorEvent {}
6264
6265impl DaiConnectorEvent {
6266    /// Decodes a message buffer as a [`DaiConnectorEvent`].
6267    fn decode(
6268        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6269    ) -> Result<DaiConnectorEvent, fidl::Error> {
6270        let (bytes, _handles) = buf.split_mut();
6271        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6272        debug_assert_eq!(tx_header.tx_id, 0);
6273        match tx_header.ordinal {
6274            _ => Err(fidl::Error::UnknownOrdinal {
6275                ordinal: tx_header.ordinal,
6276                protocol_name: <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6277            }),
6278        }
6279    }
6280}
6281
6282/// A Stream of incoming requests for fuchsia.hardware.audio/DaiConnector.
6283pub struct DaiConnectorRequestStream {
6284    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6285    is_terminated: bool,
6286}
6287
6288impl std::marker::Unpin for DaiConnectorRequestStream {}
6289
6290impl futures::stream::FusedStream for DaiConnectorRequestStream {
6291    fn is_terminated(&self) -> bool {
6292        self.is_terminated
6293    }
6294}
6295
6296impl fidl::endpoints::RequestStream for DaiConnectorRequestStream {
6297    type Protocol = DaiConnectorMarker;
6298    type ControlHandle = DaiConnectorControlHandle;
6299
6300    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6301        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6302    }
6303
6304    fn control_handle(&self) -> Self::ControlHandle {
6305        DaiConnectorControlHandle { inner: self.inner.clone() }
6306    }
6307
6308    fn into_inner(
6309        self,
6310    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6311    {
6312        (self.inner, self.is_terminated)
6313    }
6314
6315    fn from_inner(
6316        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6317        is_terminated: bool,
6318    ) -> Self {
6319        Self { inner, is_terminated }
6320    }
6321}
6322
6323impl futures::Stream for DaiConnectorRequestStream {
6324    type Item = Result<DaiConnectorRequest, fidl::Error>;
6325
6326    fn poll_next(
6327        mut self: std::pin::Pin<&mut Self>,
6328        cx: &mut std::task::Context<'_>,
6329    ) -> std::task::Poll<Option<Self::Item>> {
6330        let this = &mut *self;
6331        if this.inner.check_shutdown(cx) {
6332            this.is_terminated = true;
6333            return std::task::Poll::Ready(None);
6334        }
6335        if this.is_terminated {
6336            panic!("polled DaiConnectorRequestStream after completion");
6337        }
6338        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6339            |bytes, handles| {
6340                match this.inner.channel().read_etc(cx, bytes, handles) {
6341                    std::task::Poll::Ready(Ok(())) => {}
6342                    std::task::Poll::Pending => return std::task::Poll::Pending,
6343                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6344                        this.is_terminated = true;
6345                        return std::task::Poll::Ready(None);
6346                    }
6347                    std::task::Poll::Ready(Err(e)) => {
6348                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6349                            e.into(),
6350                        ))));
6351                    }
6352                }
6353
6354                // A message has been received from the channel
6355                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6356
6357                std::task::Poll::Ready(Some(match header.ordinal {
6358                    0x4e4db05c2eca1450 => {
6359                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6360                        let mut req = fidl::new_empty!(
6361                            DaiConnectorConnectRequest,
6362                            fidl::encoding::DefaultFuchsiaResourceDialect
6363                        );
6364                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
6365                        let control_handle =
6366                            DaiConnectorControlHandle { inner: this.inner.clone() };
6367                        Ok(DaiConnectorRequest::Connect {
6368                            dai_protocol: req.dai_protocol,
6369
6370                            control_handle,
6371                        })
6372                    }
6373                    _ => Err(fidl::Error::UnknownOrdinal {
6374                        ordinal: header.ordinal,
6375                        protocol_name:
6376                            <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6377                    }),
6378                }))
6379            },
6380        )
6381    }
6382}
6383
6384/// For an overview of the DAI protocols see
6385/// [Digital Audio Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_dai.md)
6386/// # Deprecation
6387///
6388/// Not supported anymore, instead use an
6389/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
6390/// with one DAI and one Ring Buffer, see
6391/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
6392#[derive(Debug)]
6393pub enum DaiConnectorRequest {
6394    /// This connects to a DAI protocol server.
6395    Connect {
6396        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6397        control_handle: DaiConnectorControlHandle,
6398    },
6399}
6400
6401impl DaiConnectorRequest {
6402    #[allow(irrefutable_let_patterns)]
6403    pub fn into_connect(
6404        self,
6405    ) -> Option<(fidl::endpoints::ServerEnd<DaiMarker>, DaiConnectorControlHandle)> {
6406        if let DaiConnectorRequest::Connect { dai_protocol, control_handle } = self {
6407            Some((dai_protocol, control_handle))
6408        } else {
6409            None
6410        }
6411    }
6412
6413    /// Name of the method defined in FIDL
6414    pub fn method_name(&self) -> &'static str {
6415        match *self {
6416            DaiConnectorRequest::Connect { .. } => "connect",
6417        }
6418    }
6419}
6420
6421#[derive(Debug, Clone)]
6422pub struct DaiConnectorControlHandle {
6423    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6424}
6425
6426impl fidl::endpoints::ControlHandle for DaiConnectorControlHandle {
6427    fn shutdown(&self) {
6428        self.inner.shutdown()
6429    }
6430
6431    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6432        self.inner.shutdown_with_epitaph(status)
6433    }
6434
6435    fn is_closed(&self) -> bool {
6436        self.inner.channel().is_closed()
6437    }
6438    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6439        self.inner.channel().on_closed()
6440    }
6441
6442    #[cfg(target_os = "fuchsia")]
6443    fn signal_peer(
6444        &self,
6445        clear_mask: zx::Signals,
6446        set_mask: zx::Signals,
6447    ) -> Result<(), zx_status::Status> {
6448        use fidl::Peered;
6449        self.inner.channel().signal_peer(clear_mask, set_mask)
6450    }
6451}
6452
6453impl DaiConnectorControlHandle {}
6454
6455#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6456pub struct HealthMarker;
6457
6458impl fidl::endpoints::ProtocolMarker for HealthMarker {
6459    type Proxy = HealthProxy;
6460    type RequestStream = HealthRequestStream;
6461    #[cfg(target_os = "fuchsia")]
6462    type SynchronousProxy = HealthSynchronousProxy;
6463
6464    const DEBUG_NAME: &'static str = "(anonymous) Health";
6465}
6466
6467pub trait HealthProxyInterface: Send + Sync {
6468    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
6469        + Send;
6470    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
6471}
6472#[derive(Debug)]
6473#[cfg(target_os = "fuchsia")]
6474pub struct HealthSynchronousProxy {
6475    client: fidl::client::sync::Client,
6476}
6477
6478#[cfg(target_os = "fuchsia")]
6479impl fidl::endpoints::SynchronousProxy for HealthSynchronousProxy {
6480    type Proxy = HealthProxy;
6481    type Protocol = HealthMarker;
6482
6483    fn from_channel(inner: fidl::Channel) -> Self {
6484        Self::new(inner)
6485    }
6486
6487    fn into_channel(self) -> fidl::Channel {
6488        self.client.into_channel()
6489    }
6490
6491    fn as_channel(&self) -> &fidl::Channel {
6492        self.client.as_channel()
6493    }
6494}
6495
6496#[cfg(target_os = "fuchsia")]
6497impl HealthSynchronousProxy {
6498    pub fn new(channel: fidl::Channel) -> Self {
6499        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6500        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6501    }
6502
6503    pub fn into_channel(self) -> fidl::Channel {
6504        self.client.into_channel()
6505    }
6506
6507    /// Waits until an event arrives and returns it. It is safe for other
6508    /// threads to make concurrent requests while waiting for an event.
6509    pub fn wait_for_event(
6510        &self,
6511        deadline: zx::MonotonicInstant,
6512    ) -> Result<HealthEvent, fidl::Error> {
6513        HealthEvent::decode(self.client.wait_for_event(deadline)?)
6514    }
6515
6516    /// Retrieves top level health state.
6517    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6518    pub fn r#get_health_state(
6519        &self,
6520        ___deadline: zx::MonotonicInstant,
6521    ) -> Result<HealthState, fidl::Error> {
6522        let _response =
6523            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
6524                (),
6525                0x4e146d6bca733a84,
6526                fidl::encoding::DynamicFlags::empty(),
6527                ___deadline,
6528            )?;
6529        Ok(_response.state)
6530    }
6531}
6532
6533#[cfg(target_os = "fuchsia")]
6534impl From<HealthSynchronousProxy> for zx::NullableHandle {
6535    fn from(value: HealthSynchronousProxy) -> Self {
6536        value.into_channel().into()
6537    }
6538}
6539
6540#[cfg(target_os = "fuchsia")]
6541impl From<fidl::Channel> for HealthSynchronousProxy {
6542    fn from(value: fidl::Channel) -> Self {
6543        Self::new(value)
6544    }
6545}
6546
6547#[cfg(target_os = "fuchsia")]
6548impl fidl::endpoints::FromClient for HealthSynchronousProxy {
6549    type Protocol = HealthMarker;
6550
6551    fn from_client(value: fidl::endpoints::ClientEnd<HealthMarker>) -> Self {
6552        Self::new(value.into_channel())
6553    }
6554}
6555
6556#[derive(Debug, Clone)]
6557pub struct HealthProxy {
6558    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6559}
6560
6561impl fidl::endpoints::Proxy for HealthProxy {
6562    type Protocol = HealthMarker;
6563
6564    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6565        Self::new(inner)
6566    }
6567
6568    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6569        self.client.into_channel().map_err(|client| Self { client })
6570    }
6571
6572    fn as_channel(&self) -> &::fidl::AsyncChannel {
6573        self.client.as_channel()
6574    }
6575}
6576
6577impl HealthProxy {
6578    /// Create a new Proxy for fuchsia.hardware.audio/Health.
6579    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6580        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6581        Self { client: fidl::client::Client::new(channel, protocol_name) }
6582    }
6583
6584    /// Get a Stream of events from the remote end of the protocol.
6585    ///
6586    /// # Panics
6587    ///
6588    /// Panics if the event stream was already taken.
6589    pub fn take_event_stream(&self) -> HealthEventStream {
6590        HealthEventStream { event_receiver: self.client.take_event_receiver() }
6591    }
6592
6593    /// Retrieves top level health state.
6594    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6595    pub fn r#get_health_state(
6596        &self,
6597    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
6598    {
6599        HealthProxyInterface::r#get_health_state(self)
6600    }
6601}
6602
6603impl HealthProxyInterface for HealthProxy {
6604    type GetHealthStateResponseFut =
6605        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
6606    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
6607        fn _decode(
6608            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6609        ) -> Result<HealthState, fidl::Error> {
6610            let _response = fidl::client::decode_transaction_body::<
6611                HealthGetHealthStateResponse,
6612                fidl::encoding::DefaultFuchsiaResourceDialect,
6613                0x4e146d6bca733a84,
6614            >(_buf?)?;
6615            Ok(_response.state)
6616        }
6617        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
6618            (),
6619            0x4e146d6bca733a84,
6620            fidl::encoding::DynamicFlags::empty(),
6621            _decode,
6622        )
6623    }
6624}
6625
6626pub struct HealthEventStream {
6627    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6628}
6629
6630impl std::marker::Unpin for HealthEventStream {}
6631
6632impl futures::stream::FusedStream for HealthEventStream {
6633    fn is_terminated(&self) -> bool {
6634        self.event_receiver.is_terminated()
6635    }
6636}
6637
6638impl futures::Stream for HealthEventStream {
6639    type Item = Result<HealthEvent, fidl::Error>;
6640
6641    fn poll_next(
6642        mut self: std::pin::Pin<&mut Self>,
6643        cx: &mut std::task::Context<'_>,
6644    ) -> std::task::Poll<Option<Self::Item>> {
6645        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6646            &mut self.event_receiver,
6647            cx
6648        )?) {
6649            Some(buf) => std::task::Poll::Ready(Some(HealthEvent::decode(buf))),
6650            None => std::task::Poll::Ready(None),
6651        }
6652    }
6653}
6654
6655#[derive(Debug)]
6656pub enum HealthEvent {}
6657
6658impl HealthEvent {
6659    /// Decodes a message buffer as a [`HealthEvent`].
6660    fn decode(
6661        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6662    ) -> Result<HealthEvent, fidl::Error> {
6663        let (bytes, _handles) = buf.split_mut();
6664        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6665        debug_assert_eq!(tx_header.tx_id, 0);
6666        match tx_header.ordinal {
6667            _ => Err(fidl::Error::UnknownOrdinal {
6668                ordinal: tx_header.ordinal,
6669                protocol_name: <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6670            }),
6671        }
6672    }
6673}
6674
6675/// A Stream of incoming requests for fuchsia.hardware.audio/Health.
6676pub struct HealthRequestStream {
6677    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6678    is_terminated: bool,
6679}
6680
6681impl std::marker::Unpin for HealthRequestStream {}
6682
6683impl futures::stream::FusedStream for HealthRequestStream {
6684    fn is_terminated(&self) -> bool {
6685        self.is_terminated
6686    }
6687}
6688
6689impl fidl::endpoints::RequestStream for HealthRequestStream {
6690    type Protocol = HealthMarker;
6691    type ControlHandle = HealthControlHandle;
6692
6693    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6694        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6695    }
6696
6697    fn control_handle(&self) -> Self::ControlHandle {
6698        HealthControlHandle { inner: self.inner.clone() }
6699    }
6700
6701    fn into_inner(
6702        self,
6703    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6704    {
6705        (self.inner, self.is_terminated)
6706    }
6707
6708    fn from_inner(
6709        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6710        is_terminated: bool,
6711    ) -> Self {
6712        Self { inner, is_terminated }
6713    }
6714}
6715
6716impl futures::Stream for HealthRequestStream {
6717    type Item = Result<HealthRequest, fidl::Error>;
6718
6719    fn poll_next(
6720        mut self: std::pin::Pin<&mut Self>,
6721        cx: &mut std::task::Context<'_>,
6722    ) -> std::task::Poll<Option<Self::Item>> {
6723        let this = &mut *self;
6724        if this.inner.check_shutdown(cx) {
6725            this.is_terminated = true;
6726            return std::task::Poll::Ready(None);
6727        }
6728        if this.is_terminated {
6729            panic!("polled HealthRequestStream after completion");
6730        }
6731        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6732            |bytes, handles| {
6733                match this.inner.channel().read_etc(cx, bytes, handles) {
6734                    std::task::Poll::Ready(Ok(())) => {}
6735                    std::task::Poll::Pending => return std::task::Poll::Pending,
6736                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6737                        this.is_terminated = true;
6738                        return std::task::Poll::Ready(None);
6739                    }
6740                    std::task::Poll::Ready(Err(e)) => {
6741                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6742                            e.into(),
6743                        ))));
6744                    }
6745                }
6746
6747                // A message has been received from the channel
6748                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6749
6750                std::task::Poll::Ready(Some(match header.ordinal {
6751                    0x4e146d6bca733a84 => {
6752                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6753                        let mut req = fidl::new_empty!(
6754                            fidl::encoding::EmptyPayload,
6755                            fidl::encoding::DefaultFuchsiaResourceDialect
6756                        );
6757                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6758                        let control_handle = HealthControlHandle { inner: this.inner.clone() };
6759                        Ok(HealthRequest::GetHealthState {
6760                            responder: HealthGetHealthStateResponder {
6761                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6762                                tx_id: header.tx_id,
6763                            },
6764                        })
6765                    }
6766                    _ => Err(fidl::Error::UnknownOrdinal {
6767                        ordinal: header.ordinal,
6768                        protocol_name:
6769                            <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6770                    }),
6771                }))
6772            },
6773        )
6774    }
6775}
6776
6777#[derive(Debug)]
6778pub enum HealthRequest {
6779    /// Retrieves top level health state.
6780    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6781    GetHealthState { responder: HealthGetHealthStateResponder },
6782}
6783
6784impl HealthRequest {
6785    #[allow(irrefutable_let_patterns)]
6786    pub fn into_get_health_state(self) -> Option<(HealthGetHealthStateResponder)> {
6787        if let HealthRequest::GetHealthState { responder } = self {
6788            Some((responder))
6789        } else {
6790            None
6791        }
6792    }
6793
6794    /// Name of the method defined in FIDL
6795    pub fn method_name(&self) -> &'static str {
6796        match *self {
6797            HealthRequest::GetHealthState { .. } => "get_health_state",
6798        }
6799    }
6800}
6801
6802#[derive(Debug, Clone)]
6803pub struct HealthControlHandle {
6804    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6805}
6806
6807impl fidl::endpoints::ControlHandle for HealthControlHandle {
6808    fn shutdown(&self) {
6809        self.inner.shutdown()
6810    }
6811
6812    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6813        self.inner.shutdown_with_epitaph(status)
6814    }
6815
6816    fn is_closed(&self) -> bool {
6817        self.inner.channel().is_closed()
6818    }
6819    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6820        self.inner.channel().on_closed()
6821    }
6822
6823    #[cfg(target_os = "fuchsia")]
6824    fn signal_peer(
6825        &self,
6826        clear_mask: zx::Signals,
6827        set_mask: zx::Signals,
6828    ) -> Result<(), zx_status::Status> {
6829        use fidl::Peered;
6830        self.inner.channel().signal_peer(clear_mask, set_mask)
6831    }
6832}
6833
6834impl HealthControlHandle {}
6835
6836#[must_use = "FIDL methods require a response to be sent"]
6837#[derive(Debug)]
6838pub struct HealthGetHealthStateResponder {
6839    control_handle: std::mem::ManuallyDrop<HealthControlHandle>,
6840    tx_id: u32,
6841}
6842
6843/// Set the the channel to be shutdown (see [`HealthControlHandle::shutdown`])
6844/// if the responder is dropped without sending a response, so that the client
6845/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6846impl std::ops::Drop for HealthGetHealthStateResponder {
6847    fn drop(&mut self) {
6848        self.control_handle.shutdown();
6849        // Safety: drops once, never accessed again
6850        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6851    }
6852}
6853
6854impl fidl::endpoints::Responder for HealthGetHealthStateResponder {
6855    type ControlHandle = HealthControlHandle;
6856
6857    fn control_handle(&self) -> &HealthControlHandle {
6858        &self.control_handle
6859    }
6860
6861    fn drop_without_shutdown(mut self) {
6862        // Safety: drops once, never accessed again due to mem::forget
6863        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6864        // Prevent Drop from running (which would shut down the channel)
6865        std::mem::forget(self);
6866    }
6867}
6868
6869impl HealthGetHealthStateResponder {
6870    /// Sends a response to the FIDL transaction.
6871    ///
6872    /// Sets the channel to shutdown if an error occurs.
6873    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6874        let _result = self.send_raw(state);
6875        if _result.is_err() {
6876            self.control_handle.shutdown();
6877        }
6878        self.drop_without_shutdown();
6879        _result
6880    }
6881
6882    /// Similar to "send" but does not shutdown the channel if an error occurs.
6883    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6884        let _result = self.send_raw(state);
6885        self.drop_without_shutdown();
6886        _result
6887    }
6888
6889    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
6890        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
6891            (state,),
6892            self.tx_id,
6893            0x4e146d6bca733a84,
6894            fidl::encoding::DynamicFlags::empty(),
6895        )
6896    }
6897}
6898
6899#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6900pub struct PacketStreamControlMarker;
6901
6902impl fidl::endpoints::ProtocolMarker for PacketStreamControlMarker {
6903    type Proxy = PacketStreamControlProxy;
6904    type RequestStream = PacketStreamControlRequestStream;
6905    #[cfg(target_os = "fuchsia")]
6906    type SynchronousProxy = PacketStreamControlSynchronousProxy;
6907
6908    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamControl";
6909}
6910pub type PacketStreamControlAllocateVmosResult = Result<Vec<VmoInfo>, i32>;
6911pub type PacketStreamControlDeallocateVmosResult = Result<(), i32>;
6912pub type PacketStreamControlRegisterVmosResult = Result<(), i32>;
6913pub type PacketStreamControlUnregisterVmosResult = Result<(), i32>;
6914pub type PacketStreamControlGetPacketStreamSinkResult =
6915    Result<PacketStreamControlGetPacketStreamSinkResponse, i32>;
6916pub type PacketStreamControlSetPacketStreamSinkResult = Result<(), i32>;
6917pub type PacketStreamControlStartResult = Result<(), i32>;
6918pub type PacketStreamControlStopResult = Result<(), i32>;
6919
6920pub trait PacketStreamControlProxyInterface: Send + Sync {
6921    type GetPropertiesResponseFut: std::future::Future<Output = Result<PacketStreamProperties, fidl::Error>>
6922        + Send;
6923    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
6924    type AllocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlAllocateVmosResult, fidl::Error>>
6925        + Send;
6926    fn r#allocate_vmos(&self, payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut;
6927    type DeallocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlDeallocateVmosResult, fidl::Error>>
6928        + Send;
6929    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut;
6930    type RegisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlRegisterVmosResult, fidl::Error>>
6931        + Send;
6932    fn r#register_vmos(&self, payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut;
6933    type UnregisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlUnregisterVmosResult, fidl::Error>>
6934        + Send;
6935    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut;
6936    type GetPacketStreamSinkResponseFut: std::future::Future<
6937            Output = Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error>,
6938        > + Send;
6939    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut;
6940    type SetPacketStreamSinkResponseFut: std::future::Future<
6941            Output = Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error>,
6942        > + Send;
6943    fn r#set_packet_stream_sink(
6944        &self,
6945        payload: PacketStreamControlSetPacketStreamSinkRequest,
6946    ) -> Self::SetPacketStreamSinkResponseFut;
6947    type StartResponseFut: std::future::Future<Output = Result<PacketStreamControlStartResult, fidl::Error>>
6948        + Send;
6949    fn r#start(&self) -> Self::StartResponseFut;
6950    type StopResponseFut: std::future::Future<Output = Result<PacketStreamControlStopResult, fidl::Error>>
6951        + Send;
6952    fn r#stop(&self) -> Self::StopResponseFut;
6953}
6954#[derive(Debug)]
6955#[cfg(target_os = "fuchsia")]
6956pub struct PacketStreamControlSynchronousProxy {
6957    client: fidl::client::sync::Client,
6958}
6959
6960#[cfg(target_os = "fuchsia")]
6961impl fidl::endpoints::SynchronousProxy for PacketStreamControlSynchronousProxy {
6962    type Proxy = PacketStreamControlProxy;
6963    type Protocol = PacketStreamControlMarker;
6964
6965    fn from_channel(inner: fidl::Channel) -> Self {
6966        Self::new(inner)
6967    }
6968
6969    fn into_channel(self) -> fidl::Channel {
6970        self.client.into_channel()
6971    }
6972
6973    fn as_channel(&self) -> &fidl::Channel {
6974        self.client.as_channel()
6975    }
6976}
6977
6978#[cfg(target_os = "fuchsia")]
6979impl PacketStreamControlSynchronousProxy {
6980    pub fn new(channel: fidl::Channel) -> Self {
6981        let protocol_name =
6982            <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6983        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6984    }
6985
6986    pub fn into_channel(self) -> fidl::Channel {
6987        self.client.into_channel()
6988    }
6989
6990    /// Waits until an event arrives and returns it. It is safe for other
6991    /// threads to make concurrent requests while waiting for an event.
6992    pub fn wait_for_event(
6993        &self,
6994        deadline: zx::MonotonicInstant,
6995    ) -> Result<PacketStreamControlEvent, fidl::Error> {
6996        PacketStreamControlEvent::decode(self.client.wait_for_event(deadline)?)
6997    }
6998
6999    /// Accessor for top level static properties.
7000    pub fn r#get_properties(
7001        &self,
7002        ___deadline: zx::MonotonicInstant,
7003    ) -> Result<PacketStreamProperties, fidl::Error> {
7004        let _response = self.client.send_query::<
7005            fidl::encoding::EmptyPayload,
7006            fidl::encoding::FlexibleType<PacketStreamControlGetPropertiesResponse>,
7007        >(
7008            (),
7009            0x586cf4f0f8d2771f,
7010            fidl::encoding::DynamicFlags::FLEXIBLE,
7011            ___deadline,
7012        )?
7013        .into_result::<PacketStreamControlMarker>("get_properties")?;
7014        Ok(_response.properties)
7015    }
7016
7017    /// Request the driver to allocate VMOs for data transfer.
7018    /// Returns the allocated VMOs and their assigned IDs.
7019    ///
7020    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7021    /// If the packet stream is an output stream, then the handle must also include
7022    /// ZX_RIGHT_WRITE.
7023    ///
7024    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
7025    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
7026    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
7027    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
7028    /// reconfigure.
7029    pub fn r#allocate_vmos(
7030        &self,
7031        mut payload: &AllocateVmosConfig,
7032        ___deadline: zx::MonotonicInstant,
7033    ) -> Result<PacketStreamControlAllocateVmosResult, fidl::Error> {
7034        let _response = self.client.send_query::<
7035            AllocateVmosConfig,
7036            fidl::encoding::FlexibleResultType<PacketStreamControlAllocateVmosResponse, i32>,
7037        >(
7038            payload,
7039            0x7ff1473165ed344b,
7040            fidl::encoding::DynamicFlags::FLEXIBLE,
7041            ___deadline,
7042        )?
7043        .into_result::<PacketStreamControlMarker>("allocate_vmos")?;
7044        Ok(_response.map(|x| x.vmos))
7045    }
7046
7047    /// Releases all VMOs previously allocated via `AllocateVmos`.
7048    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7049    ///
7050    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
7051    /// not stopped.
7052    pub fn r#deallocate_vmos(
7053        &self,
7054        ___deadline: zx::MonotonicInstant,
7055    ) -> Result<PacketStreamControlDeallocateVmosResult, fidl::Error> {
7056        let _response = self.client.send_query::<
7057            fidl::encoding::EmptyPayload,
7058            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7059        >(
7060            (),
7061            0x4db5cc85a7b8405b,
7062            fidl::encoding::DynamicFlags::FLEXIBLE,
7063            ___deadline,
7064        )?
7065        .into_result::<PacketStreamControlMarker>("deallocate_vmos")?;
7066        Ok(_response.map(|x| x))
7067    }
7068
7069    /// Registers client-allocated VMOs with the driver.
7070    ///
7071    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7072    /// If the packet stream is an input stream, then the handle must also include
7073    /// ZX_RIGHT_WRITE.
7074    ///
7075    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
7076    /// or if duplicate `vmo_id`s are found.
7077    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
7078    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
7079    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
7080    /// reconfigure.
7081    pub fn r#register_vmos(
7082        &self,
7083        mut payload: RegisterVmosConfig,
7084        ___deadline: zx::MonotonicInstant,
7085    ) -> Result<PacketStreamControlRegisterVmosResult, fidl::Error> {
7086        let _response = self.client.send_query::<
7087            RegisterVmosConfig,
7088            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7089        >(
7090            &mut payload,
7091            0x29c3b656a1020bfd,
7092            fidl::encoding::DynamicFlags::FLEXIBLE,
7093            ___deadline,
7094        )?
7095        .into_result::<PacketStreamControlMarker>("register_vmos")?;
7096        Ok(_response.map(|x| x))
7097    }
7098
7099    /// Unregisters all VMOs previously registered via `RegisterVmos`.
7100    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7101    ///
7102    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
7103    /// not stopped.
7104    pub fn r#unregister_vmos(
7105        &self,
7106        ___deadline: zx::MonotonicInstant,
7107    ) -> Result<PacketStreamControlUnregisterVmosResult, fidl::Error> {
7108        let _response = self.client.send_query::<
7109            fidl::encoding::EmptyPayload,
7110            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7111        >(
7112            (),
7113            0x3e3b4dbfe26b6094,
7114            fidl::encoding::DynamicFlags::FLEXIBLE,
7115            ___deadline,
7116        )?
7117        .into_result::<PacketStreamControlMarker>("unregister_vmos")?;
7118        Ok(_response.map(|x| x))
7119    }
7120
7121    /// Connects to the data sink implemented by the driver.
7122    /// This is used for audio **Output** where the driver consumes data.
7123    ///
7124    /// Flow:
7125    /// 1. App writes audio data to a registered VMO.
7126    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
7127    ///    true).
7128    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
7129    /// 4. Driver consumes the data.
7130    ///
7131    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
7132    /// and any pending requests on that channel are discarded. The new channel replaces the old
7133    /// one.
7134    ///
7135    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
7136    /// not support this method.
7137    pub fn r#get_packet_stream_sink(
7138        &self,
7139        ___deadline: zx::MonotonicInstant,
7140    ) -> Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error> {
7141        let _response =
7142            self.client
7143                .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
7144                    PacketStreamControlGetPacketStreamSinkResponse,
7145                    i32,
7146                >>(
7147                    (), 0x7394726463ebbc6a, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
7148                )?
7149                .into_result::<PacketStreamControlMarker>("get_packet_stream_sink")?;
7150        Ok(_response.map(|x| x))
7151    }
7152
7153    /// Provides a data sink to the driver.
7154    /// This is used for audio **Input** where the driver produces data.
7155    ///
7156    /// Flow:
7157    /// 1. Driver writes audio data to a registered VMO.
7158    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
7159    /// 3. App receives `PutPacket`.
7160    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
7161    ///    true).
7162    /// 5. App reads the data.
7163    ///
7164    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
7165    /// channel. The new channel replaces the old one.
7166    ///
7167    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
7168    /// not support this method.
7169    pub fn r#set_packet_stream_sink(
7170        &self,
7171        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7172        ___deadline: zx::MonotonicInstant,
7173    ) -> Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error> {
7174        let _response = self.client.send_query::<
7175            PacketStreamControlSetPacketStreamSinkRequest,
7176            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7177        >(
7178            &mut payload,
7179            0xab88800e31dc0e4,
7180            fidl::encoding::DynamicFlags::FLEXIBLE,
7181            ___deadline,
7182        )?
7183        .into_result::<PacketStreamControlMarker>("set_packet_stream_sink")?;
7184        Ok(_response.map(|x| x))
7185    }
7186
7187    /// Start the packet-stream.
7188    ///
7189    /// Returns `ZX_ERR_BAD_STATE` if:
7190    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
7191    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
7192    ///   `INLINE` is supported.
7193    /// * The stream is already started.
7194    pub fn r#start(
7195        &self,
7196        ___deadline: zx::MonotonicInstant,
7197    ) -> Result<PacketStreamControlStartResult, fidl::Error> {
7198        let _response = self.client.send_query::<
7199            fidl::encoding::EmptyPayload,
7200            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7201        >(
7202            (),
7203            0x3a584b94d8a6bfd0,
7204            fidl::encoding::DynamicFlags::FLEXIBLE,
7205            ___deadline,
7206        )?
7207        .into_result::<PacketStreamControlMarker>("start")?;
7208        Ok(_response.map(|x| x))
7209    }
7210
7211    /// Stop the packet-stream.
7212    ///
7213    /// Once the response is received, the stream is halted.
7214    ///
7215    /// Behavior depends on the stream direction:
7216    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
7217    ///   requests will remain pending until `Start` is called again. Clients may call
7218    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
7219    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
7220    ///   calls will be made by the driver until `Start` is called again.
7221    ///
7222    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
7223    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
7224    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
7225    ///   complete successfully after `Stop` has returned.
7226    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
7227    ///   arrive at the client after `Stop` has returned.
7228    ///
7229    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
7230    pub fn r#stop(
7231        &self,
7232        ___deadline: zx::MonotonicInstant,
7233    ) -> Result<PacketStreamControlStopResult, fidl::Error> {
7234        let _response = self.client.send_query::<
7235            fidl::encoding::EmptyPayload,
7236            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7237        >(
7238            (),
7239            0x703e4fafcdd7ef32,
7240            fidl::encoding::DynamicFlags::FLEXIBLE,
7241            ___deadline,
7242        )?
7243        .into_result::<PacketStreamControlMarker>("stop")?;
7244        Ok(_response.map(|x| x))
7245    }
7246}
7247
7248#[cfg(target_os = "fuchsia")]
7249impl From<PacketStreamControlSynchronousProxy> for zx::NullableHandle {
7250    fn from(value: PacketStreamControlSynchronousProxy) -> Self {
7251        value.into_channel().into()
7252    }
7253}
7254
7255#[cfg(target_os = "fuchsia")]
7256impl From<fidl::Channel> for PacketStreamControlSynchronousProxy {
7257    fn from(value: fidl::Channel) -> Self {
7258        Self::new(value)
7259    }
7260}
7261
7262#[cfg(target_os = "fuchsia")]
7263impl fidl::endpoints::FromClient for PacketStreamControlSynchronousProxy {
7264    type Protocol = PacketStreamControlMarker;
7265
7266    fn from_client(value: fidl::endpoints::ClientEnd<PacketStreamControlMarker>) -> Self {
7267        Self::new(value.into_channel())
7268    }
7269}
7270
7271#[derive(Debug, Clone)]
7272pub struct PacketStreamControlProxy {
7273    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7274}
7275
7276impl fidl::endpoints::Proxy for PacketStreamControlProxy {
7277    type Protocol = PacketStreamControlMarker;
7278
7279    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7280        Self::new(inner)
7281    }
7282
7283    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7284        self.client.into_channel().map_err(|client| Self { client })
7285    }
7286
7287    fn as_channel(&self) -> &::fidl::AsyncChannel {
7288        self.client.as_channel()
7289    }
7290}
7291
7292impl PacketStreamControlProxy {
7293    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamControl.
7294    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7295        let protocol_name =
7296            <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7297        Self { client: fidl::client::Client::new(channel, protocol_name) }
7298    }
7299
7300    /// Get a Stream of events from the remote end of the protocol.
7301    ///
7302    /// # Panics
7303    ///
7304    /// Panics if the event stream was already taken.
7305    pub fn take_event_stream(&self) -> PacketStreamControlEventStream {
7306        PacketStreamControlEventStream { event_receiver: self.client.take_event_receiver() }
7307    }
7308
7309    /// Accessor for top level static properties.
7310    pub fn r#get_properties(
7311        &self,
7312    ) -> fidl::client::QueryResponseFut<
7313        PacketStreamProperties,
7314        fidl::encoding::DefaultFuchsiaResourceDialect,
7315    > {
7316        PacketStreamControlProxyInterface::r#get_properties(self)
7317    }
7318
7319    /// Request the driver to allocate VMOs for data transfer.
7320    /// Returns the allocated VMOs and their assigned IDs.
7321    ///
7322    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7323    /// If the packet stream is an output stream, then the handle must also include
7324    /// ZX_RIGHT_WRITE.
7325    ///
7326    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
7327    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
7328    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
7329    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
7330    /// reconfigure.
7331    pub fn r#allocate_vmos(
7332        &self,
7333        mut payload: &AllocateVmosConfig,
7334    ) -> fidl::client::QueryResponseFut<
7335        PacketStreamControlAllocateVmosResult,
7336        fidl::encoding::DefaultFuchsiaResourceDialect,
7337    > {
7338        PacketStreamControlProxyInterface::r#allocate_vmos(self, payload)
7339    }
7340
7341    /// Releases all VMOs previously allocated via `AllocateVmos`.
7342    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7343    ///
7344    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
7345    /// not stopped.
7346    pub fn r#deallocate_vmos(
7347        &self,
7348    ) -> fidl::client::QueryResponseFut<
7349        PacketStreamControlDeallocateVmosResult,
7350        fidl::encoding::DefaultFuchsiaResourceDialect,
7351    > {
7352        PacketStreamControlProxyInterface::r#deallocate_vmos(self)
7353    }
7354
7355    /// Registers client-allocated VMOs with the driver.
7356    ///
7357    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7358    /// If the packet stream is an input stream, then the handle must also include
7359    /// ZX_RIGHT_WRITE.
7360    ///
7361    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
7362    /// or if duplicate `vmo_id`s are found.
7363    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
7364    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
7365    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
7366    /// reconfigure.
7367    pub fn r#register_vmos(
7368        &self,
7369        mut payload: RegisterVmosConfig,
7370    ) -> fidl::client::QueryResponseFut<
7371        PacketStreamControlRegisterVmosResult,
7372        fidl::encoding::DefaultFuchsiaResourceDialect,
7373    > {
7374        PacketStreamControlProxyInterface::r#register_vmos(self, payload)
7375    }
7376
7377    /// Unregisters all VMOs previously registered via `RegisterVmos`.
7378    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7379    ///
7380    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
7381    /// not stopped.
7382    pub fn r#unregister_vmos(
7383        &self,
7384    ) -> fidl::client::QueryResponseFut<
7385        PacketStreamControlUnregisterVmosResult,
7386        fidl::encoding::DefaultFuchsiaResourceDialect,
7387    > {
7388        PacketStreamControlProxyInterface::r#unregister_vmos(self)
7389    }
7390
7391    /// Connects to the data sink implemented by the driver.
7392    /// This is used for audio **Output** where the driver consumes data.
7393    ///
7394    /// Flow:
7395    /// 1. App writes audio data to a registered VMO.
7396    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
7397    ///    true).
7398    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
7399    /// 4. Driver consumes the data.
7400    ///
7401    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
7402    /// and any pending requests on that channel are discarded. The new channel replaces the old
7403    /// one.
7404    ///
7405    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
7406    /// not support this method.
7407    pub fn r#get_packet_stream_sink(
7408        &self,
7409    ) -> fidl::client::QueryResponseFut<
7410        PacketStreamControlGetPacketStreamSinkResult,
7411        fidl::encoding::DefaultFuchsiaResourceDialect,
7412    > {
7413        PacketStreamControlProxyInterface::r#get_packet_stream_sink(self)
7414    }
7415
7416    /// Provides a data sink to the driver.
7417    /// This is used for audio **Input** where the driver produces data.
7418    ///
7419    /// Flow:
7420    /// 1. Driver writes audio data to a registered VMO.
7421    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
7422    /// 3. App receives `PutPacket`.
7423    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
7424    ///    true).
7425    /// 5. App reads the data.
7426    ///
7427    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
7428    /// channel. The new channel replaces the old one.
7429    ///
7430    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
7431    /// not support this method.
7432    pub fn r#set_packet_stream_sink(
7433        &self,
7434        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7435    ) -> fidl::client::QueryResponseFut<
7436        PacketStreamControlSetPacketStreamSinkResult,
7437        fidl::encoding::DefaultFuchsiaResourceDialect,
7438    > {
7439        PacketStreamControlProxyInterface::r#set_packet_stream_sink(self, payload)
7440    }
7441
7442    /// Start the packet-stream.
7443    ///
7444    /// Returns `ZX_ERR_BAD_STATE` if:
7445    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
7446    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
7447    ///   `INLINE` is supported.
7448    /// * The stream is already started.
7449    pub fn r#start(
7450        &self,
7451    ) -> fidl::client::QueryResponseFut<
7452        PacketStreamControlStartResult,
7453        fidl::encoding::DefaultFuchsiaResourceDialect,
7454    > {
7455        PacketStreamControlProxyInterface::r#start(self)
7456    }
7457
7458    /// Stop the packet-stream.
7459    ///
7460    /// Once the response is received, the stream is halted.
7461    ///
7462    /// Behavior depends on the stream direction:
7463    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
7464    ///   requests will remain pending until `Start` is called again. Clients may call
7465    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
7466    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
7467    ///   calls will be made by the driver until `Start` is called again.
7468    ///
7469    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
7470    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
7471    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
7472    ///   complete successfully after `Stop` has returned.
7473    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
7474    ///   arrive at the client after `Stop` has returned.
7475    ///
7476    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
7477    pub fn r#stop(
7478        &self,
7479    ) -> fidl::client::QueryResponseFut<
7480        PacketStreamControlStopResult,
7481        fidl::encoding::DefaultFuchsiaResourceDialect,
7482    > {
7483        PacketStreamControlProxyInterface::r#stop(self)
7484    }
7485}
7486
7487impl PacketStreamControlProxyInterface for PacketStreamControlProxy {
7488    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
7489        PacketStreamProperties,
7490        fidl::encoding::DefaultFuchsiaResourceDialect,
7491    >;
7492    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
7493        fn _decode(
7494            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7495        ) -> Result<PacketStreamProperties, fidl::Error> {
7496            let _response = fidl::client::decode_transaction_body::<
7497                fidl::encoding::FlexibleType<PacketStreamControlGetPropertiesResponse>,
7498                fidl::encoding::DefaultFuchsiaResourceDialect,
7499                0x586cf4f0f8d2771f,
7500            >(_buf?)?
7501            .into_result::<PacketStreamControlMarker>("get_properties")?;
7502            Ok(_response.properties)
7503        }
7504        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamProperties>(
7505            (),
7506            0x586cf4f0f8d2771f,
7507            fidl::encoding::DynamicFlags::FLEXIBLE,
7508            _decode,
7509        )
7510    }
7511
7512    type AllocateVmosResponseFut = fidl::client::QueryResponseFut<
7513        PacketStreamControlAllocateVmosResult,
7514        fidl::encoding::DefaultFuchsiaResourceDialect,
7515    >;
7516    fn r#allocate_vmos(&self, mut payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut {
7517        fn _decode(
7518            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7519        ) -> Result<PacketStreamControlAllocateVmosResult, fidl::Error> {
7520            let _response = fidl::client::decode_transaction_body::<
7521                fidl::encoding::FlexibleResultType<PacketStreamControlAllocateVmosResponse, i32>,
7522                fidl::encoding::DefaultFuchsiaResourceDialect,
7523                0x7ff1473165ed344b,
7524            >(_buf?)?
7525            .into_result::<PacketStreamControlMarker>("allocate_vmos")?;
7526            Ok(_response.map(|x| x.vmos))
7527        }
7528        self.client
7529            .send_query_and_decode::<AllocateVmosConfig, PacketStreamControlAllocateVmosResult>(
7530                payload,
7531                0x7ff1473165ed344b,
7532                fidl::encoding::DynamicFlags::FLEXIBLE,
7533                _decode,
7534            )
7535    }
7536
7537    type DeallocateVmosResponseFut = fidl::client::QueryResponseFut<
7538        PacketStreamControlDeallocateVmosResult,
7539        fidl::encoding::DefaultFuchsiaResourceDialect,
7540    >;
7541    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut {
7542        fn _decode(
7543            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7544        ) -> Result<PacketStreamControlDeallocateVmosResult, fidl::Error> {
7545            let _response = fidl::client::decode_transaction_body::<
7546                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7547                fidl::encoding::DefaultFuchsiaResourceDialect,
7548                0x4db5cc85a7b8405b,
7549            >(_buf?)?
7550            .into_result::<PacketStreamControlMarker>("deallocate_vmos")?;
7551            Ok(_response.map(|x| x))
7552        }
7553        self.client.send_query_and_decode::<
7554            fidl::encoding::EmptyPayload,
7555            PacketStreamControlDeallocateVmosResult,
7556        >(
7557            (),
7558            0x4db5cc85a7b8405b,
7559            fidl::encoding::DynamicFlags::FLEXIBLE,
7560            _decode,
7561        )
7562    }
7563
7564    type RegisterVmosResponseFut = fidl::client::QueryResponseFut<
7565        PacketStreamControlRegisterVmosResult,
7566        fidl::encoding::DefaultFuchsiaResourceDialect,
7567    >;
7568    fn r#register_vmos(&self, mut payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut {
7569        fn _decode(
7570            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7571        ) -> Result<PacketStreamControlRegisterVmosResult, fidl::Error> {
7572            let _response = fidl::client::decode_transaction_body::<
7573                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7574                fidl::encoding::DefaultFuchsiaResourceDialect,
7575                0x29c3b656a1020bfd,
7576            >(_buf?)?
7577            .into_result::<PacketStreamControlMarker>("register_vmos")?;
7578            Ok(_response.map(|x| x))
7579        }
7580        self.client
7581            .send_query_and_decode::<RegisterVmosConfig, PacketStreamControlRegisterVmosResult>(
7582                &mut payload,
7583                0x29c3b656a1020bfd,
7584                fidl::encoding::DynamicFlags::FLEXIBLE,
7585                _decode,
7586            )
7587    }
7588
7589    type UnregisterVmosResponseFut = fidl::client::QueryResponseFut<
7590        PacketStreamControlUnregisterVmosResult,
7591        fidl::encoding::DefaultFuchsiaResourceDialect,
7592    >;
7593    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut {
7594        fn _decode(
7595            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7596        ) -> Result<PacketStreamControlUnregisterVmosResult, fidl::Error> {
7597            let _response = fidl::client::decode_transaction_body::<
7598                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7599                fidl::encoding::DefaultFuchsiaResourceDialect,
7600                0x3e3b4dbfe26b6094,
7601            >(_buf?)?
7602            .into_result::<PacketStreamControlMarker>("unregister_vmos")?;
7603            Ok(_response.map(|x| x))
7604        }
7605        self.client.send_query_and_decode::<
7606            fidl::encoding::EmptyPayload,
7607            PacketStreamControlUnregisterVmosResult,
7608        >(
7609            (),
7610            0x3e3b4dbfe26b6094,
7611            fidl::encoding::DynamicFlags::FLEXIBLE,
7612            _decode,
7613        )
7614    }
7615
7616    type GetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
7617        PacketStreamControlGetPacketStreamSinkResult,
7618        fidl::encoding::DefaultFuchsiaResourceDialect,
7619    >;
7620    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut {
7621        fn _decode(
7622            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7623        ) -> Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error> {
7624            let _response = fidl::client::decode_transaction_body::<
7625                fidl::encoding::FlexibleResultType<
7626                    PacketStreamControlGetPacketStreamSinkResponse,
7627                    i32,
7628                >,
7629                fidl::encoding::DefaultFuchsiaResourceDialect,
7630                0x7394726463ebbc6a,
7631            >(_buf?)?
7632            .into_result::<PacketStreamControlMarker>("get_packet_stream_sink")?;
7633            Ok(_response.map(|x| x))
7634        }
7635        self.client.send_query_and_decode::<
7636            fidl::encoding::EmptyPayload,
7637            PacketStreamControlGetPacketStreamSinkResult,
7638        >(
7639            (),
7640            0x7394726463ebbc6a,
7641            fidl::encoding::DynamicFlags::FLEXIBLE,
7642            _decode,
7643        )
7644    }
7645
7646    type SetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
7647        PacketStreamControlSetPacketStreamSinkResult,
7648        fidl::encoding::DefaultFuchsiaResourceDialect,
7649    >;
7650    fn r#set_packet_stream_sink(
7651        &self,
7652        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7653    ) -> Self::SetPacketStreamSinkResponseFut {
7654        fn _decode(
7655            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7656        ) -> Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error> {
7657            let _response = fidl::client::decode_transaction_body::<
7658                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7659                fidl::encoding::DefaultFuchsiaResourceDialect,
7660                0xab88800e31dc0e4,
7661            >(_buf?)?
7662            .into_result::<PacketStreamControlMarker>("set_packet_stream_sink")?;
7663            Ok(_response.map(|x| x))
7664        }
7665        self.client.send_query_and_decode::<
7666            PacketStreamControlSetPacketStreamSinkRequest,
7667            PacketStreamControlSetPacketStreamSinkResult,
7668        >(
7669            &mut payload,
7670            0xab88800e31dc0e4,
7671            fidl::encoding::DynamicFlags::FLEXIBLE,
7672            _decode,
7673        )
7674    }
7675
7676    type StartResponseFut = fidl::client::QueryResponseFut<
7677        PacketStreamControlStartResult,
7678        fidl::encoding::DefaultFuchsiaResourceDialect,
7679    >;
7680    fn r#start(&self) -> Self::StartResponseFut {
7681        fn _decode(
7682            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7683        ) -> Result<PacketStreamControlStartResult, fidl::Error> {
7684            let _response = fidl::client::decode_transaction_body::<
7685                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7686                fidl::encoding::DefaultFuchsiaResourceDialect,
7687                0x3a584b94d8a6bfd0,
7688            >(_buf?)?
7689            .into_result::<PacketStreamControlMarker>("start")?;
7690            Ok(_response.map(|x| x))
7691        }
7692        self.client
7693            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStartResult>(
7694                (),
7695                0x3a584b94d8a6bfd0,
7696                fidl::encoding::DynamicFlags::FLEXIBLE,
7697                _decode,
7698            )
7699    }
7700
7701    type StopResponseFut = fidl::client::QueryResponseFut<
7702        PacketStreamControlStopResult,
7703        fidl::encoding::DefaultFuchsiaResourceDialect,
7704    >;
7705    fn r#stop(&self) -> Self::StopResponseFut {
7706        fn _decode(
7707            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7708        ) -> Result<PacketStreamControlStopResult, fidl::Error> {
7709            let _response = fidl::client::decode_transaction_body::<
7710                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7711                fidl::encoding::DefaultFuchsiaResourceDialect,
7712                0x703e4fafcdd7ef32,
7713            >(_buf?)?
7714            .into_result::<PacketStreamControlMarker>("stop")?;
7715            Ok(_response.map(|x| x))
7716        }
7717        self.client
7718            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStopResult>(
7719                (),
7720                0x703e4fafcdd7ef32,
7721                fidl::encoding::DynamicFlags::FLEXIBLE,
7722                _decode,
7723            )
7724    }
7725}
7726
7727pub struct PacketStreamControlEventStream {
7728    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7729}
7730
7731impl std::marker::Unpin for PacketStreamControlEventStream {}
7732
7733impl futures::stream::FusedStream for PacketStreamControlEventStream {
7734    fn is_terminated(&self) -> bool {
7735        self.event_receiver.is_terminated()
7736    }
7737}
7738
7739impl futures::Stream for PacketStreamControlEventStream {
7740    type Item = Result<PacketStreamControlEvent, fidl::Error>;
7741
7742    fn poll_next(
7743        mut self: std::pin::Pin<&mut Self>,
7744        cx: &mut std::task::Context<'_>,
7745    ) -> std::task::Poll<Option<Self::Item>> {
7746        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7747            &mut self.event_receiver,
7748            cx
7749        )?) {
7750            Some(buf) => std::task::Poll::Ready(Some(PacketStreamControlEvent::decode(buf))),
7751            None => std::task::Poll::Ready(None),
7752        }
7753    }
7754}
7755
7756#[derive(Debug)]
7757pub enum PacketStreamControlEvent {
7758    #[non_exhaustive]
7759    _UnknownEvent {
7760        /// Ordinal of the event that was sent.
7761        ordinal: u64,
7762    },
7763}
7764
7765impl PacketStreamControlEvent {
7766    /// Decodes a message buffer as a [`PacketStreamControlEvent`].
7767    fn decode(
7768        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7769    ) -> Result<PacketStreamControlEvent, fidl::Error> {
7770        let (bytes, _handles) = buf.split_mut();
7771        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7772        debug_assert_eq!(tx_header.tx_id, 0);
7773        match tx_header.ordinal {
7774            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7775                Ok(PacketStreamControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7776            }
7777            _ => Err(fidl::Error::UnknownOrdinal {
7778                ordinal: tx_header.ordinal,
7779                protocol_name:
7780                    <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7781            }),
7782        }
7783    }
7784}
7785
7786/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamControl.
7787pub struct PacketStreamControlRequestStream {
7788    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7789    is_terminated: bool,
7790}
7791
7792impl std::marker::Unpin for PacketStreamControlRequestStream {}
7793
7794impl futures::stream::FusedStream for PacketStreamControlRequestStream {
7795    fn is_terminated(&self) -> bool {
7796        self.is_terminated
7797    }
7798}
7799
7800impl fidl::endpoints::RequestStream for PacketStreamControlRequestStream {
7801    type Protocol = PacketStreamControlMarker;
7802    type ControlHandle = PacketStreamControlControlHandle;
7803
7804    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7805        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7806    }
7807
7808    fn control_handle(&self) -> Self::ControlHandle {
7809        PacketStreamControlControlHandle { inner: self.inner.clone() }
7810    }
7811
7812    fn into_inner(
7813        self,
7814    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7815    {
7816        (self.inner, self.is_terminated)
7817    }
7818
7819    fn from_inner(
7820        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7821        is_terminated: bool,
7822    ) -> Self {
7823        Self { inner, is_terminated }
7824    }
7825}
7826
7827impl futures::Stream for PacketStreamControlRequestStream {
7828    type Item = Result<PacketStreamControlRequest, fidl::Error>;
7829
7830    fn poll_next(
7831        mut self: std::pin::Pin<&mut Self>,
7832        cx: &mut std::task::Context<'_>,
7833    ) -> std::task::Poll<Option<Self::Item>> {
7834        let this = &mut *self;
7835        if this.inner.check_shutdown(cx) {
7836            this.is_terminated = true;
7837            return std::task::Poll::Ready(None);
7838        }
7839        if this.is_terminated {
7840            panic!("polled PacketStreamControlRequestStream after completion");
7841        }
7842        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7843            |bytes, handles| {
7844                match this.inner.channel().read_etc(cx, bytes, handles) {
7845                    std::task::Poll::Ready(Ok(())) => {}
7846                    std::task::Poll::Pending => return std::task::Poll::Pending,
7847                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7848                        this.is_terminated = true;
7849                        return std::task::Poll::Ready(None);
7850                    }
7851                    std::task::Poll::Ready(Err(e)) => {
7852                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7853                            e.into(),
7854                        ))));
7855                    }
7856                }
7857
7858                // A message has been received from the channel
7859                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7860
7861                std::task::Poll::Ready(Some(match header.ordinal {
7862                0x586cf4f0f8d2771f => {
7863                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7864                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7865                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7866                    let control_handle = PacketStreamControlControlHandle {
7867                        inner: this.inner.clone(),
7868                    };
7869                    Ok(PacketStreamControlRequest::GetProperties {
7870                        responder: PacketStreamControlGetPropertiesResponder {
7871                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7872                            tx_id: header.tx_id,
7873                        },
7874                    })
7875                }
7876                0x7ff1473165ed344b => {
7877                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7878                    let mut req = fidl::new_empty!(AllocateVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect);
7879                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocateVmosConfig>(&header, _body_bytes, handles, &mut req)?;
7880                    let control_handle = PacketStreamControlControlHandle {
7881                        inner: this.inner.clone(),
7882                    };
7883                    Ok(PacketStreamControlRequest::AllocateVmos {payload: req,
7884                        responder: PacketStreamControlAllocateVmosResponder {
7885                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7886                            tx_id: header.tx_id,
7887                        },
7888                    })
7889                }
7890                0x4db5cc85a7b8405b => {
7891                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7892                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7893                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7894                    let control_handle = PacketStreamControlControlHandle {
7895                        inner: this.inner.clone(),
7896                    };
7897                    Ok(PacketStreamControlRequest::DeallocateVmos {
7898                        responder: PacketStreamControlDeallocateVmosResponder {
7899                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7900                            tx_id: header.tx_id,
7901                        },
7902                    })
7903                }
7904                0x29c3b656a1020bfd => {
7905                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7906                    let mut req = fidl::new_empty!(RegisterVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect);
7907                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegisterVmosConfig>(&header, _body_bytes, handles, &mut req)?;
7908                    let control_handle = PacketStreamControlControlHandle {
7909                        inner: this.inner.clone(),
7910                    };
7911                    Ok(PacketStreamControlRequest::RegisterVmos {payload: req,
7912                        responder: PacketStreamControlRegisterVmosResponder {
7913                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7914                            tx_id: header.tx_id,
7915                        },
7916                    })
7917                }
7918                0x3e3b4dbfe26b6094 => {
7919                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7920                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7921                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7922                    let control_handle = PacketStreamControlControlHandle {
7923                        inner: this.inner.clone(),
7924                    };
7925                    Ok(PacketStreamControlRequest::UnregisterVmos {
7926                        responder: PacketStreamControlUnregisterVmosResponder {
7927                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7928                            tx_id: header.tx_id,
7929                        },
7930                    })
7931                }
7932                0x7394726463ebbc6a => {
7933                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7934                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7935                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7936                    let control_handle = PacketStreamControlControlHandle {
7937                        inner: this.inner.clone(),
7938                    };
7939                    Ok(PacketStreamControlRequest::GetPacketStreamSink {
7940                        responder: PacketStreamControlGetPacketStreamSinkResponder {
7941                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7942                            tx_id: header.tx_id,
7943                        },
7944                    })
7945                }
7946                0xab88800e31dc0e4 => {
7947                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7948                    let mut req = fidl::new_empty!(PacketStreamControlSetPacketStreamSinkRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7949                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PacketStreamControlSetPacketStreamSinkRequest>(&header, _body_bytes, handles, &mut req)?;
7950                    let control_handle = PacketStreamControlControlHandle {
7951                        inner: this.inner.clone(),
7952                    };
7953                    Ok(PacketStreamControlRequest::SetPacketStreamSink {payload: req,
7954                        responder: PacketStreamControlSetPacketStreamSinkResponder {
7955                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7956                            tx_id: header.tx_id,
7957                        },
7958                    })
7959                }
7960                0x3a584b94d8a6bfd0 => {
7961                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7962                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7963                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7964                    let control_handle = PacketStreamControlControlHandle {
7965                        inner: this.inner.clone(),
7966                    };
7967                    Ok(PacketStreamControlRequest::Start {
7968                        responder: PacketStreamControlStartResponder {
7969                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7970                            tx_id: header.tx_id,
7971                        },
7972                    })
7973                }
7974                0x703e4fafcdd7ef32 => {
7975                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7976                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7977                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7978                    let control_handle = PacketStreamControlControlHandle {
7979                        inner: this.inner.clone(),
7980                    };
7981                    Ok(PacketStreamControlRequest::Stop {
7982                        responder: PacketStreamControlStopResponder {
7983                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7984                            tx_id: header.tx_id,
7985                        },
7986                    })
7987                }
7988                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7989                    Ok(PacketStreamControlRequest::_UnknownMethod {
7990                        ordinal: header.ordinal,
7991                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
7992                        method_type: fidl::MethodType::OneWay,
7993                    })
7994                }
7995                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7996                    this.inner.send_framework_err(
7997                        fidl::encoding::FrameworkErr::UnknownMethod,
7998                        header.tx_id,
7999                        header.ordinal,
8000                        header.dynamic_flags(),
8001                        (bytes, handles),
8002                    )?;
8003                    Ok(PacketStreamControlRequest::_UnknownMethod {
8004                        ordinal: header.ordinal,
8005                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
8006                        method_type: fidl::MethodType::TwoWay,
8007                    })
8008                }
8009                _ => Err(fidl::Error::UnknownOrdinal {
8010                    ordinal: header.ordinal,
8011                    protocol_name: <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8012                }),
8013            }))
8014            },
8015        )
8016    }
8017}
8018
8019/// Control protocol for establishing and managing the packet stream.
8020#[derive(Debug)]
8021pub enum PacketStreamControlRequest {
8022    /// Accessor for top level static properties.
8023    GetProperties { responder: PacketStreamControlGetPropertiesResponder },
8024    /// Request the driver to allocate VMOs for data transfer.
8025    /// Returns the allocated VMOs and their assigned IDs.
8026    ///
8027    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8028    /// If the packet stream is an output stream, then the handle must also include
8029    /// ZX_RIGHT_WRITE.
8030    ///
8031    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
8032    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
8033    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
8034    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
8035    /// reconfigure.
8036    AllocateVmos {
8037        payload: AllocateVmosConfig,
8038        responder: PacketStreamControlAllocateVmosResponder,
8039    },
8040    /// Releases all VMOs previously allocated via `AllocateVmos`.
8041    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
8042    ///
8043    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
8044    /// not stopped.
8045    DeallocateVmos { responder: PacketStreamControlDeallocateVmosResponder },
8046    /// Registers client-allocated VMOs with the driver.
8047    ///
8048    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8049    /// If the packet stream is an input stream, then the handle must also include
8050    /// ZX_RIGHT_WRITE.
8051    ///
8052    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
8053    /// or if duplicate `vmo_id`s are found.
8054    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
8055    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
8056    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
8057    /// reconfigure.
8058    RegisterVmos {
8059        payload: RegisterVmosConfig,
8060        responder: PacketStreamControlRegisterVmosResponder,
8061    },
8062    /// Unregisters all VMOs previously registered via `RegisterVmos`.
8063    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
8064    ///
8065    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
8066    /// not stopped.
8067    UnregisterVmos { responder: PacketStreamControlUnregisterVmosResponder },
8068    /// Connects to the data sink implemented by the driver.
8069    /// This is used for audio **Output** where the driver consumes data.
8070    ///
8071    /// Flow:
8072    /// 1. App writes audio data to a registered VMO.
8073    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
8074    ///    true).
8075    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
8076    /// 4. Driver consumes the data.
8077    ///
8078    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
8079    /// and any pending requests on that channel are discarded. The new channel replaces the old
8080    /// one.
8081    ///
8082    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
8083    /// not support this method.
8084    GetPacketStreamSink { responder: PacketStreamControlGetPacketStreamSinkResponder },
8085    /// Provides a data sink to the driver.
8086    /// This is used for audio **Input** where the driver produces data.
8087    ///
8088    /// Flow:
8089    /// 1. Driver writes audio data to a registered VMO.
8090    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
8091    /// 3. App receives `PutPacket`.
8092    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
8093    ///    true).
8094    /// 5. App reads the data.
8095    ///
8096    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
8097    /// channel. The new channel replaces the old one.
8098    ///
8099    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
8100    /// not support this method.
8101    SetPacketStreamSink {
8102        payload: PacketStreamControlSetPacketStreamSinkRequest,
8103        responder: PacketStreamControlSetPacketStreamSinkResponder,
8104    },
8105    /// Start the packet-stream.
8106    ///
8107    /// Returns `ZX_ERR_BAD_STATE` if:
8108    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
8109    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
8110    ///   `INLINE` is supported.
8111    /// * The stream is already started.
8112    Start { responder: PacketStreamControlStartResponder },
8113    /// Stop the packet-stream.
8114    ///
8115    /// Once the response is received, the stream is halted.
8116    ///
8117    /// Behavior depends on the stream direction:
8118    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
8119    ///   requests will remain pending until `Start` is called again. Clients may call
8120    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
8121    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
8122    ///   calls will be made by the driver until `Start` is called again.
8123    ///
8124    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
8125    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
8126    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
8127    ///   complete successfully after `Stop` has returned.
8128    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
8129    ///   arrive at the client after `Stop` has returned.
8130    ///
8131    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
8132    Stop { responder: PacketStreamControlStopResponder },
8133    /// An interaction was received which does not match any known method.
8134    #[non_exhaustive]
8135    _UnknownMethod {
8136        /// Ordinal of the method that was called.
8137        ordinal: u64,
8138        control_handle: PacketStreamControlControlHandle,
8139        method_type: fidl::MethodType,
8140    },
8141}
8142
8143impl PacketStreamControlRequest {
8144    #[allow(irrefutable_let_patterns)]
8145    pub fn into_get_properties(self) -> Option<(PacketStreamControlGetPropertiesResponder)> {
8146        if let PacketStreamControlRequest::GetProperties { responder } = self {
8147            Some((responder))
8148        } else {
8149            None
8150        }
8151    }
8152
8153    #[allow(irrefutable_let_patterns)]
8154    pub fn into_allocate_vmos(
8155        self,
8156    ) -> Option<(AllocateVmosConfig, PacketStreamControlAllocateVmosResponder)> {
8157        if let PacketStreamControlRequest::AllocateVmos { payload, responder } = self {
8158            Some((payload, responder))
8159        } else {
8160            None
8161        }
8162    }
8163
8164    #[allow(irrefutable_let_patterns)]
8165    pub fn into_deallocate_vmos(self) -> Option<(PacketStreamControlDeallocateVmosResponder)> {
8166        if let PacketStreamControlRequest::DeallocateVmos { responder } = self {
8167            Some((responder))
8168        } else {
8169            None
8170        }
8171    }
8172
8173    #[allow(irrefutable_let_patterns)]
8174    pub fn into_register_vmos(
8175        self,
8176    ) -> Option<(RegisterVmosConfig, PacketStreamControlRegisterVmosResponder)> {
8177        if let PacketStreamControlRequest::RegisterVmos { payload, responder } = self {
8178            Some((payload, responder))
8179        } else {
8180            None
8181        }
8182    }
8183
8184    #[allow(irrefutable_let_patterns)]
8185    pub fn into_unregister_vmos(self) -> Option<(PacketStreamControlUnregisterVmosResponder)> {
8186        if let PacketStreamControlRequest::UnregisterVmos { responder } = self {
8187            Some((responder))
8188        } else {
8189            None
8190        }
8191    }
8192
8193    #[allow(irrefutable_let_patterns)]
8194    pub fn into_get_packet_stream_sink(
8195        self,
8196    ) -> Option<(PacketStreamControlGetPacketStreamSinkResponder)> {
8197        if let PacketStreamControlRequest::GetPacketStreamSink { responder } = self {
8198            Some((responder))
8199        } else {
8200            None
8201        }
8202    }
8203
8204    #[allow(irrefutable_let_patterns)]
8205    pub fn into_set_packet_stream_sink(
8206        self,
8207    ) -> Option<(
8208        PacketStreamControlSetPacketStreamSinkRequest,
8209        PacketStreamControlSetPacketStreamSinkResponder,
8210    )> {
8211        if let PacketStreamControlRequest::SetPacketStreamSink { payload, responder } = self {
8212            Some((payload, responder))
8213        } else {
8214            None
8215        }
8216    }
8217
8218    #[allow(irrefutable_let_patterns)]
8219    pub fn into_start(self) -> Option<(PacketStreamControlStartResponder)> {
8220        if let PacketStreamControlRequest::Start { responder } = self {
8221            Some((responder))
8222        } else {
8223            None
8224        }
8225    }
8226
8227    #[allow(irrefutable_let_patterns)]
8228    pub fn into_stop(self) -> Option<(PacketStreamControlStopResponder)> {
8229        if let PacketStreamControlRequest::Stop { responder } = self {
8230            Some((responder))
8231        } else {
8232            None
8233        }
8234    }
8235
8236    /// Name of the method defined in FIDL
8237    pub fn method_name(&self) -> &'static str {
8238        match *self {
8239            PacketStreamControlRequest::GetProperties { .. } => "get_properties",
8240            PacketStreamControlRequest::AllocateVmos { .. } => "allocate_vmos",
8241            PacketStreamControlRequest::DeallocateVmos { .. } => "deallocate_vmos",
8242            PacketStreamControlRequest::RegisterVmos { .. } => "register_vmos",
8243            PacketStreamControlRequest::UnregisterVmos { .. } => "unregister_vmos",
8244            PacketStreamControlRequest::GetPacketStreamSink { .. } => "get_packet_stream_sink",
8245            PacketStreamControlRequest::SetPacketStreamSink { .. } => "set_packet_stream_sink",
8246            PacketStreamControlRequest::Start { .. } => "start",
8247            PacketStreamControlRequest::Stop { .. } => "stop",
8248            PacketStreamControlRequest::_UnknownMethod {
8249                method_type: fidl::MethodType::OneWay,
8250                ..
8251            } => "unknown one-way method",
8252            PacketStreamControlRequest::_UnknownMethod {
8253                method_type: fidl::MethodType::TwoWay,
8254                ..
8255            } => "unknown two-way method",
8256        }
8257    }
8258}
8259
8260#[derive(Debug, Clone)]
8261pub struct PacketStreamControlControlHandle {
8262    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8263}
8264
8265impl fidl::endpoints::ControlHandle for PacketStreamControlControlHandle {
8266    fn shutdown(&self) {
8267        self.inner.shutdown()
8268    }
8269
8270    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8271        self.inner.shutdown_with_epitaph(status)
8272    }
8273
8274    fn is_closed(&self) -> bool {
8275        self.inner.channel().is_closed()
8276    }
8277    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8278        self.inner.channel().on_closed()
8279    }
8280
8281    #[cfg(target_os = "fuchsia")]
8282    fn signal_peer(
8283        &self,
8284        clear_mask: zx::Signals,
8285        set_mask: zx::Signals,
8286    ) -> Result<(), zx_status::Status> {
8287        use fidl::Peered;
8288        self.inner.channel().signal_peer(clear_mask, set_mask)
8289    }
8290}
8291
8292impl PacketStreamControlControlHandle {}
8293
8294#[must_use = "FIDL methods require a response to be sent"]
8295#[derive(Debug)]
8296pub struct PacketStreamControlGetPropertiesResponder {
8297    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8298    tx_id: u32,
8299}
8300
8301/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8302/// if the responder is dropped without sending a response, so that the client
8303/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8304impl std::ops::Drop for PacketStreamControlGetPropertiesResponder {
8305    fn drop(&mut self) {
8306        self.control_handle.shutdown();
8307        // Safety: drops once, never accessed again
8308        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8309    }
8310}
8311
8312impl fidl::endpoints::Responder for PacketStreamControlGetPropertiesResponder {
8313    type ControlHandle = PacketStreamControlControlHandle;
8314
8315    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8316        &self.control_handle
8317    }
8318
8319    fn drop_without_shutdown(mut self) {
8320        // Safety: drops once, never accessed again due to mem::forget
8321        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8322        // Prevent Drop from running (which would shut down the channel)
8323        std::mem::forget(self);
8324    }
8325}
8326
8327impl PacketStreamControlGetPropertiesResponder {
8328    /// Sends a response to the FIDL transaction.
8329    ///
8330    /// Sets the channel to shutdown if an error occurs.
8331    pub fn send(self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
8332        let _result = self.send_raw(properties);
8333        if _result.is_err() {
8334            self.control_handle.shutdown();
8335        }
8336        self.drop_without_shutdown();
8337        _result
8338    }
8339
8340    /// Similar to "send" but does not shutdown the channel if an error occurs.
8341    pub fn send_no_shutdown_on_err(
8342        self,
8343        mut properties: &PacketStreamProperties,
8344    ) -> Result<(), fidl::Error> {
8345        let _result = self.send_raw(properties);
8346        self.drop_without_shutdown();
8347        _result
8348    }
8349
8350    fn send_raw(&self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
8351        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
8352            PacketStreamControlGetPropertiesResponse,
8353        >>(
8354            fidl::encoding::Flexible::new((properties,)),
8355            self.tx_id,
8356            0x586cf4f0f8d2771f,
8357            fidl::encoding::DynamicFlags::FLEXIBLE,
8358        )
8359    }
8360}
8361
8362#[must_use = "FIDL methods require a response to be sent"]
8363#[derive(Debug)]
8364pub struct PacketStreamControlAllocateVmosResponder {
8365    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8366    tx_id: u32,
8367}
8368
8369/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8370/// if the responder is dropped without sending a response, so that the client
8371/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8372impl std::ops::Drop for PacketStreamControlAllocateVmosResponder {
8373    fn drop(&mut self) {
8374        self.control_handle.shutdown();
8375        // Safety: drops once, never accessed again
8376        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8377    }
8378}
8379
8380impl fidl::endpoints::Responder for PacketStreamControlAllocateVmosResponder {
8381    type ControlHandle = PacketStreamControlControlHandle;
8382
8383    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8384        &self.control_handle
8385    }
8386
8387    fn drop_without_shutdown(mut self) {
8388        // Safety: drops once, never accessed again due to mem::forget
8389        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8390        // Prevent Drop from running (which would shut down the channel)
8391        std::mem::forget(self);
8392    }
8393}
8394
8395impl PacketStreamControlAllocateVmosResponder {
8396    /// Sends a response to the FIDL transaction.
8397    ///
8398    /// Sets the channel to shutdown if an error occurs.
8399    pub fn send(self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
8400        let _result = self.send_raw(result);
8401        if _result.is_err() {
8402            self.control_handle.shutdown();
8403        }
8404        self.drop_without_shutdown();
8405        _result
8406    }
8407
8408    /// Similar to "send" but does not shutdown the channel if an error occurs.
8409    pub fn send_no_shutdown_on_err(
8410        self,
8411        mut result: Result<Vec<VmoInfo>, i32>,
8412    ) -> Result<(), fidl::Error> {
8413        let _result = self.send_raw(result);
8414        self.drop_without_shutdown();
8415        _result
8416    }
8417
8418    fn send_raw(&self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
8419        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8420            PacketStreamControlAllocateVmosResponse,
8421            i32,
8422        >>(
8423            fidl::encoding::FlexibleResult::new(
8424                result.as_mut().map_err(|e| *e).map(|vmos| (vmos.as_mut_slice(),)),
8425            ),
8426            self.tx_id,
8427            0x7ff1473165ed344b,
8428            fidl::encoding::DynamicFlags::FLEXIBLE,
8429        )
8430    }
8431}
8432
8433#[must_use = "FIDL methods require a response to be sent"]
8434#[derive(Debug)]
8435pub struct PacketStreamControlDeallocateVmosResponder {
8436    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8437    tx_id: u32,
8438}
8439
8440/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8441/// if the responder is dropped without sending a response, so that the client
8442/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8443impl std::ops::Drop for PacketStreamControlDeallocateVmosResponder {
8444    fn drop(&mut self) {
8445        self.control_handle.shutdown();
8446        // Safety: drops once, never accessed again
8447        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8448    }
8449}
8450
8451impl fidl::endpoints::Responder for PacketStreamControlDeallocateVmosResponder {
8452    type ControlHandle = PacketStreamControlControlHandle;
8453
8454    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8455        &self.control_handle
8456    }
8457
8458    fn drop_without_shutdown(mut self) {
8459        // Safety: drops once, never accessed again due to mem::forget
8460        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8461        // Prevent Drop from running (which would shut down the channel)
8462        std::mem::forget(self);
8463    }
8464}
8465
8466impl PacketStreamControlDeallocateVmosResponder {
8467    /// Sends a response to the FIDL transaction.
8468    ///
8469    /// Sets the channel to shutdown if an error occurs.
8470    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8471        let _result = self.send_raw(result);
8472        if _result.is_err() {
8473            self.control_handle.shutdown();
8474        }
8475        self.drop_without_shutdown();
8476        _result
8477    }
8478
8479    /// Similar to "send" but does not shutdown the channel if an error occurs.
8480    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8481        let _result = self.send_raw(result);
8482        self.drop_without_shutdown();
8483        _result
8484    }
8485
8486    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8487        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8488            fidl::encoding::EmptyStruct,
8489            i32,
8490        >>(
8491            fidl::encoding::FlexibleResult::new(result),
8492            self.tx_id,
8493            0x4db5cc85a7b8405b,
8494            fidl::encoding::DynamicFlags::FLEXIBLE,
8495        )
8496    }
8497}
8498
8499#[must_use = "FIDL methods require a response to be sent"]
8500#[derive(Debug)]
8501pub struct PacketStreamControlRegisterVmosResponder {
8502    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8503    tx_id: u32,
8504}
8505
8506/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8507/// if the responder is dropped without sending a response, so that the client
8508/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8509impl std::ops::Drop for PacketStreamControlRegisterVmosResponder {
8510    fn drop(&mut self) {
8511        self.control_handle.shutdown();
8512        // Safety: drops once, never accessed again
8513        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8514    }
8515}
8516
8517impl fidl::endpoints::Responder for PacketStreamControlRegisterVmosResponder {
8518    type ControlHandle = PacketStreamControlControlHandle;
8519
8520    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8521        &self.control_handle
8522    }
8523
8524    fn drop_without_shutdown(mut self) {
8525        // Safety: drops once, never accessed again due to mem::forget
8526        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8527        // Prevent Drop from running (which would shut down the channel)
8528        std::mem::forget(self);
8529    }
8530}
8531
8532impl PacketStreamControlRegisterVmosResponder {
8533    /// Sends a response to the FIDL transaction.
8534    ///
8535    /// Sets the channel to shutdown if an error occurs.
8536    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8537        let _result = self.send_raw(result);
8538        if _result.is_err() {
8539            self.control_handle.shutdown();
8540        }
8541        self.drop_without_shutdown();
8542        _result
8543    }
8544
8545    /// Similar to "send" but does not shutdown the channel if an error occurs.
8546    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8547        let _result = self.send_raw(result);
8548        self.drop_without_shutdown();
8549        _result
8550    }
8551
8552    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8553        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8554            fidl::encoding::EmptyStruct,
8555            i32,
8556        >>(
8557            fidl::encoding::FlexibleResult::new(result),
8558            self.tx_id,
8559            0x29c3b656a1020bfd,
8560            fidl::encoding::DynamicFlags::FLEXIBLE,
8561        )
8562    }
8563}
8564
8565#[must_use = "FIDL methods require a response to be sent"]
8566#[derive(Debug)]
8567pub struct PacketStreamControlUnregisterVmosResponder {
8568    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8569    tx_id: u32,
8570}
8571
8572/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8573/// if the responder is dropped without sending a response, so that the client
8574/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8575impl std::ops::Drop for PacketStreamControlUnregisterVmosResponder {
8576    fn drop(&mut self) {
8577        self.control_handle.shutdown();
8578        // Safety: drops once, never accessed again
8579        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8580    }
8581}
8582
8583impl fidl::endpoints::Responder for PacketStreamControlUnregisterVmosResponder {
8584    type ControlHandle = PacketStreamControlControlHandle;
8585
8586    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8587        &self.control_handle
8588    }
8589
8590    fn drop_without_shutdown(mut self) {
8591        // Safety: drops once, never accessed again due to mem::forget
8592        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8593        // Prevent Drop from running (which would shut down the channel)
8594        std::mem::forget(self);
8595    }
8596}
8597
8598impl PacketStreamControlUnregisterVmosResponder {
8599    /// Sends a response to the FIDL transaction.
8600    ///
8601    /// Sets the channel to shutdown if an error occurs.
8602    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8603        let _result = self.send_raw(result);
8604        if _result.is_err() {
8605            self.control_handle.shutdown();
8606        }
8607        self.drop_without_shutdown();
8608        _result
8609    }
8610
8611    /// Similar to "send" but does not shutdown the channel if an error occurs.
8612    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8613        let _result = self.send_raw(result);
8614        self.drop_without_shutdown();
8615        _result
8616    }
8617
8618    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8619        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8620            fidl::encoding::EmptyStruct,
8621            i32,
8622        >>(
8623            fidl::encoding::FlexibleResult::new(result),
8624            self.tx_id,
8625            0x3e3b4dbfe26b6094,
8626            fidl::encoding::DynamicFlags::FLEXIBLE,
8627        )
8628    }
8629}
8630
8631#[must_use = "FIDL methods require a response to be sent"]
8632#[derive(Debug)]
8633pub struct PacketStreamControlGetPacketStreamSinkResponder {
8634    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8635    tx_id: u32,
8636}
8637
8638/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8639/// if the responder is dropped without sending a response, so that the client
8640/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8641impl std::ops::Drop for PacketStreamControlGetPacketStreamSinkResponder {
8642    fn drop(&mut self) {
8643        self.control_handle.shutdown();
8644        // Safety: drops once, never accessed again
8645        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8646    }
8647}
8648
8649impl fidl::endpoints::Responder for PacketStreamControlGetPacketStreamSinkResponder {
8650    type ControlHandle = PacketStreamControlControlHandle;
8651
8652    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8653        &self.control_handle
8654    }
8655
8656    fn drop_without_shutdown(mut self) {
8657        // Safety: drops once, never accessed again due to mem::forget
8658        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8659        // Prevent Drop from running (which would shut down the channel)
8660        std::mem::forget(self);
8661    }
8662}
8663
8664impl PacketStreamControlGetPacketStreamSinkResponder {
8665    /// Sends a response to the FIDL transaction.
8666    ///
8667    /// Sets the channel to shutdown if an error occurs.
8668    pub fn send(
8669        self,
8670        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8671    ) -> Result<(), fidl::Error> {
8672        let _result = self.send_raw(result);
8673        if _result.is_err() {
8674            self.control_handle.shutdown();
8675        }
8676        self.drop_without_shutdown();
8677        _result
8678    }
8679
8680    /// Similar to "send" but does not shutdown the channel if an error occurs.
8681    pub fn send_no_shutdown_on_err(
8682        self,
8683        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8684    ) -> Result<(), fidl::Error> {
8685        let _result = self.send_raw(result);
8686        self.drop_without_shutdown();
8687        _result
8688    }
8689
8690    fn send_raw(
8691        &self,
8692        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8693    ) -> Result<(), fidl::Error> {
8694        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8695            PacketStreamControlGetPacketStreamSinkResponse,
8696            i32,
8697        >>(
8698            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
8699            self.tx_id,
8700            0x7394726463ebbc6a,
8701            fidl::encoding::DynamicFlags::FLEXIBLE,
8702        )
8703    }
8704}
8705
8706#[must_use = "FIDL methods require a response to be sent"]
8707#[derive(Debug)]
8708pub struct PacketStreamControlSetPacketStreamSinkResponder {
8709    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8710    tx_id: u32,
8711}
8712
8713/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8714/// if the responder is dropped without sending a response, so that the client
8715/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8716impl std::ops::Drop for PacketStreamControlSetPacketStreamSinkResponder {
8717    fn drop(&mut self) {
8718        self.control_handle.shutdown();
8719        // Safety: drops once, never accessed again
8720        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8721    }
8722}
8723
8724impl fidl::endpoints::Responder for PacketStreamControlSetPacketStreamSinkResponder {
8725    type ControlHandle = PacketStreamControlControlHandle;
8726
8727    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8728        &self.control_handle
8729    }
8730
8731    fn drop_without_shutdown(mut self) {
8732        // Safety: drops once, never accessed again due to mem::forget
8733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8734        // Prevent Drop from running (which would shut down the channel)
8735        std::mem::forget(self);
8736    }
8737}
8738
8739impl PacketStreamControlSetPacketStreamSinkResponder {
8740    /// Sends a response to the FIDL transaction.
8741    ///
8742    /// Sets the channel to shutdown if an error occurs.
8743    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8744        let _result = self.send_raw(result);
8745        if _result.is_err() {
8746            self.control_handle.shutdown();
8747        }
8748        self.drop_without_shutdown();
8749        _result
8750    }
8751
8752    /// Similar to "send" but does not shutdown the channel if an error occurs.
8753    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8754        let _result = self.send_raw(result);
8755        self.drop_without_shutdown();
8756        _result
8757    }
8758
8759    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8760        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8761            fidl::encoding::EmptyStruct,
8762            i32,
8763        >>(
8764            fidl::encoding::FlexibleResult::new(result),
8765            self.tx_id,
8766            0xab88800e31dc0e4,
8767            fidl::encoding::DynamicFlags::FLEXIBLE,
8768        )
8769    }
8770}
8771
8772#[must_use = "FIDL methods require a response to be sent"]
8773#[derive(Debug)]
8774pub struct PacketStreamControlStartResponder {
8775    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8776    tx_id: u32,
8777}
8778
8779/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8780/// if the responder is dropped without sending a response, so that the client
8781/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8782impl std::ops::Drop for PacketStreamControlStartResponder {
8783    fn drop(&mut self) {
8784        self.control_handle.shutdown();
8785        // Safety: drops once, never accessed again
8786        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8787    }
8788}
8789
8790impl fidl::endpoints::Responder for PacketStreamControlStartResponder {
8791    type ControlHandle = PacketStreamControlControlHandle;
8792
8793    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8794        &self.control_handle
8795    }
8796
8797    fn drop_without_shutdown(mut self) {
8798        // Safety: drops once, never accessed again due to mem::forget
8799        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8800        // Prevent Drop from running (which would shut down the channel)
8801        std::mem::forget(self);
8802    }
8803}
8804
8805impl PacketStreamControlStartResponder {
8806    /// Sends a response to the FIDL transaction.
8807    ///
8808    /// Sets the channel to shutdown if an error occurs.
8809    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8810        let _result = self.send_raw(result);
8811        if _result.is_err() {
8812            self.control_handle.shutdown();
8813        }
8814        self.drop_without_shutdown();
8815        _result
8816    }
8817
8818    /// Similar to "send" but does not shutdown the channel if an error occurs.
8819    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8820        let _result = self.send_raw(result);
8821        self.drop_without_shutdown();
8822        _result
8823    }
8824
8825    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8826        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8827            fidl::encoding::EmptyStruct,
8828            i32,
8829        >>(
8830            fidl::encoding::FlexibleResult::new(result),
8831            self.tx_id,
8832            0x3a584b94d8a6bfd0,
8833            fidl::encoding::DynamicFlags::FLEXIBLE,
8834        )
8835    }
8836}
8837
8838#[must_use = "FIDL methods require a response to be sent"]
8839#[derive(Debug)]
8840pub struct PacketStreamControlStopResponder {
8841    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8842    tx_id: u32,
8843}
8844
8845/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8846/// if the responder is dropped without sending a response, so that the client
8847/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8848impl std::ops::Drop for PacketStreamControlStopResponder {
8849    fn drop(&mut self) {
8850        self.control_handle.shutdown();
8851        // Safety: drops once, never accessed again
8852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8853    }
8854}
8855
8856impl fidl::endpoints::Responder for PacketStreamControlStopResponder {
8857    type ControlHandle = PacketStreamControlControlHandle;
8858
8859    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8860        &self.control_handle
8861    }
8862
8863    fn drop_without_shutdown(mut self) {
8864        // Safety: drops once, never accessed again due to mem::forget
8865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8866        // Prevent Drop from running (which would shut down the channel)
8867        std::mem::forget(self);
8868    }
8869}
8870
8871impl PacketStreamControlStopResponder {
8872    /// Sends a response to the FIDL transaction.
8873    ///
8874    /// Sets the channel to shutdown if an error occurs.
8875    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8876        let _result = self.send_raw(result);
8877        if _result.is_err() {
8878            self.control_handle.shutdown();
8879        }
8880        self.drop_without_shutdown();
8881        _result
8882    }
8883
8884    /// Similar to "send" but does not shutdown the channel if an error occurs.
8885    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8886        let _result = self.send_raw(result);
8887        self.drop_without_shutdown();
8888        _result
8889    }
8890
8891    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8892        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8893            fidl::encoding::EmptyStruct,
8894            i32,
8895        >>(
8896            fidl::encoding::FlexibleResult::new(result),
8897            self.tx_id,
8898            0x703e4fafcdd7ef32,
8899            fidl::encoding::DynamicFlags::FLEXIBLE,
8900        )
8901    }
8902}
8903
8904#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8905pub struct PacketStreamSinkMarker;
8906
8907impl fidl::endpoints::ProtocolMarker for PacketStreamSinkMarker {
8908    type Proxy = PacketStreamSinkProxy;
8909    type RequestStream = PacketStreamSinkRequestStream;
8910    #[cfg(target_os = "fuchsia")]
8911    type SynchronousProxy = PacketStreamSinkSynchronousProxy;
8912
8913    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamSink";
8914}
8915pub type PacketStreamSinkPutPacketResult = Result<PacketStreamSinkPutPacketResponse, i32>;
8916pub type PacketStreamSinkFlushPacketsResult = Result<(), i32>;
8917
8918pub trait PacketStreamSinkProxyInterface: Send + Sync {
8919    type PutPacketResponseFut: std::future::Future<Output = Result<PacketStreamSinkPutPacketResult, fidl::Error>>
8920        + Send;
8921    fn r#put_packet(&self, payload: PacketStreamSinkPutPacketRequest)
8922    -> Self::PutPacketResponseFut;
8923    type FlushPacketsResponseFut: std::future::Future<Output = Result<PacketStreamSinkFlushPacketsResult, fidl::Error>>
8924        + Send;
8925    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut;
8926}
8927#[derive(Debug)]
8928#[cfg(target_os = "fuchsia")]
8929pub struct PacketStreamSinkSynchronousProxy {
8930    client: fidl::client::sync::Client,
8931}
8932
8933#[cfg(target_os = "fuchsia")]
8934impl fidl::endpoints::SynchronousProxy for PacketStreamSinkSynchronousProxy {
8935    type Proxy = PacketStreamSinkProxy;
8936    type Protocol = PacketStreamSinkMarker;
8937
8938    fn from_channel(inner: fidl::Channel) -> Self {
8939        Self::new(inner)
8940    }
8941
8942    fn into_channel(self) -> fidl::Channel {
8943        self.client.into_channel()
8944    }
8945
8946    fn as_channel(&self) -> &fidl::Channel {
8947        self.client.as_channel()
8948    }
8949}
8950
8951#[cfg(target_os = "fuchsia")]
8952impl PacketStreamSinkSynchronousProxy {
8953    pub fn new(channel: fidl::Channel) -> Self {
8954        let protocol_name = <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8955        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8956    }
8957
8958    pub fn into_channel(self) -> fidl::Channel {
8959        self.client.into_channel()
8960    }
8961
8962    /// Waits until an event arrives and returns it. It is safe for other
8963    /// threads to make concurrent requests while waiting for an event.
8964    pub fn wait_for_event(
8965        &self,
8966        deadline: zx::MonotonicInstant,
8967    ) -> Result<PacketStreamSinkEvent, fidl::Error> {
8968        PacketStreamSinkEvent::decode(self.client.wait_for_event(deadline)?)
8969    }
8970
8971    /// Submits a packet to be processed by the server.
8972    ///
8973    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
8974    /// Packets are processed in the order they were submitted. This call
8975    /// blocks until the payload is processed. When this call returns, the
8976    /// buffer region is guaranteed to be available for reuse.
8977    ///
8978    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
8979    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
8980    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
8981    /// * The payload is missing.
8982    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
8983    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
8984    ///   `DRIVER_OWNED`.
8985    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
8986    ///
8987    /// Note: The server is not required to detect if a VMO region is currently in use by a
8988    /// previous pending packet. Clients are responsible for managing buffer usage.
8989    pub fn r#put_packet(
8990        &self,
8991        mut payload: PacketStreamSinkPutPacketRequest,
8992        ___deadline: zx::MonotonicInstant,
8993    ) -> Result<PacketStreamSinkPutPacketResult, fidl::Error> {
8994        let _response = self.client.send_query::<
8995            PacketStreamSinkPutPacketRequest,
8996            fidl::encoding::FlexibleResultType<PacketStreamSinkPutPacketResponse, i32>,
8997        >(
8998            &mut payload,
8999            0x25a8e35efba81f2b,
9000            fidl::encoding::DynamicFlags::FLEXIBLE,
9001            ___deadline,
9002        )?
9003        .into_result::<PacketStreamSinkMarker>("put_packet")?;
9004        Ok(_response.map(|x| x))
9005    }
9006
9007    /// Flushes all packets currently pending without processing them.
9008    /// This call waits until all pending packets are completed or canceled.
9009    ///
9010    /// Note: A packet may be partially processed (e.g. if it contains multiple
9011    /// audio frames, or if the data does not align with encoded frame boundaries)
9012    /// before it is canceled.
9013    pub fn r#flush_packets(
9014        &self,
9015        ___deadline: zx::MonotonicInstant,
9016    ) -> Result<PacketStreamSinkFlushPacketsResult, fidl::Error> {
9017        let _response = self.client.send_query::<
9018            fidl::encoding::EmptyPayload,
9019            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
9020        >(
9021            (),
9022            0x13f16ca37ede8a4,
9023            fidl::encoding::DynamicFlags::FLEXIBLE,
9024            ___deadline,
9025        )?
9026        .into_result::<PacketStreamSinkMarker>("flush_packets")?;
9027        Ok(_response.map(|x| x))
9028    }
9029}
9030
9031#[cfg(target_os = "fuchsia")]
9032impl From<PacketStreamSinkSynchronousProxy> for zx::NullableHandle {
9033    fn from(value: PacketStreamSinkSynchronousProxy) -> Self {
9034        value.into_channel().into()
9035    }
9036}
9037
9038#[cfg(target_os = "fuchsia")]
9039impl From<fidl::Channel> for PacketStreamSinkSynchronousProxy {
9040    fn from(value: fidl::Channel) -> Self {
9041        Self::new(value)
9042    }
9043}
9044
9045#[cfg(target_os = "fuchsia")]
9046impl fidl::endpoints::FromClient for PacketStreamSinkSynchronousProxy {
9047    type Protocol = PacketStreamSinkMarker;
9048
9049    fn from_client(value: fidl::endpoints::ClientEnd<PacketStreamSinkMarker>) -> Self {
9050        Self::new(value.into_channel())
9051    }
9052}
9053
9054#[derive(Debug, Clone)]
9055pub struct PacketStreamSinkProxy {
9056    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9057}
9058
9059impl fidl::endpoints::Proxy for PacketStreamSinkProxy {
9060    type Protocol = PacketStreamSinkMarker;
9061
9062    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9063        Self::new(inner)
9064    }
9065
9066    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9067        self.client.into_channel().map_err(|client| Self { client })
9068    }
9069
9070    fn as_channel(&self) -> &::fidl::AsyncChannel {
9071        self.client.as_channel()
9072    }
9073}
9074
9075impl PacketStreamSinkProxy {
9076    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamSink.
9077    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9078        let protocol_name = <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9079        Self { client: fidl::client::Client::new(channel, protocol_name) }
9080    }
9081
9082    /// Get a Stream of events from the remote end of the protocol.
9083    ///
9084    /// # Panics
9085    ///
9086    /// Panics if the event stream was already taken.
9087    pub fn take_event_stream(&self) -> PacketStreamSinkEventStream {
9088        PacketStreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
9089    }
9090
9091    /// Submits a packet to be processed by the server.
9092    ///
9093    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
9094    /// Packets are processed in the order they were submitted. This call
9095    /// blocks until the payload is processed. When this call returns, the
9096    /// buffer region is guaranteed to be available for reuse.
9097    ///
9098    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
9099    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
9100    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
9101    /// * The payload is missing.
9102    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
9103    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
9104    ///   `DRIVER_OWNED`.
9105    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
9106    ///
9107    /// Note: The server is not required to detect if a VMO region is currently in use by a
9108    /// previous pending packet. Clients are responsible for managing buffer usage.
9109    pub fn r#put_packet(
9110        &self,
9111        mut payload: PacketStreamSinkPutPacketRequest,
9112    ) -> fidl::client::QueryResponseFut<
9113        PacketStreamSinkPutPacketResult,
9114        fidl::encoding::DefaultFuchsiaResourceDialect,
9115    > {
9116        PacketStreamSinkProxyInterface::r#put_packet(self, payload)
9117    }
9118
9119    /// Flushes all packets currently pending without processing them.
9120    /// This call waits until all pending packets are completed or canceled.
9121    ///
9122    /// Note: A packet may be partially processed (e.g. if it contains multiple
9123    /// audio frames, or if the data does not align with encoded frame boundaries)
9124    /// before it is canceled.
9125    pub fn r#flush_packets(
9126        &self,
9127    ) -> fidl::client::QueryResponseFut<
9128        PacketStreamSinkFlushPacketsResult,
9129        fidl::encoding::DefaultFuchsiaResourceDialect,
9130    > {
9131        PacketStreamSinkProxyInterface::r#flush_packets(self)
9132    }
9133}
9134
9135impl PacketStreamSinkProxyInterface for PacketStreamSinkProxy {
9136    type PutPacketResponseFut = fidl::client::QueryResponseFut<
9137        PacketStreamSinkPutPacketResult,
9138        fidl::encoding::DefaultFuchsiaResourceDialect,
9139    >;
9140    fn r#put_packet(
9141        &self,
9142        mut payload: PacketStreamSinkPutPacketRequest,
9143    ) -> Self::PutPacketResponseFut {
9144        fn _decode(
9145            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9146        ) -> Result<PacketStreamSinkPutPacketResult, fidl::Error> {
9147            let _response = fidl::client::decode_transaction_body::<
9148                fidl::encoding::FlexibleResultType<PacketStreamSinkPutPacketResponse, i32>,
9149                fidl::encoding::DefaultFuchsiaResourceDialect,
9150                0x25a8e35efba81f2b,
9151            >(_buf?)?
9152            .into_result::<PacketStreamSinkMarker>("put_packet")?;
9153            Ok(_response.map(|x| x))
9154        }
9155        self.client.send_query_and_decode::<
9156            PacketStreamSinkPutPacketRequest,
9157            PacketStreamSinkPutPacketResult,
9158        >(
9159            &mut payload,
9160            0x25a8e35efba81f2b,
9161            fidl::encoding::DynamicFlags::FLEXIBLE,
9162            _decode,
9163        )
9164    }
9165
9166    type FlushPacketsResponseFut = fidl::client::QueryResponseFut<
9167        PacketStreamSinkFlushPacketsResult,
9168        fidl::encoding::DefaultFuchsiaResourceDialect,
9169    >;
9170    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut {
9171        fn _decode(
9172            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9173        ) -> Result<PacketStreamSinkFlushPacketsResult, fidl::Error> {
9174            let _response = fidl::client::decode_transaction_body::<
9175                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
9176                fidl::encoding::DefaultFuchsiaResourceDialect,
9177                0x13f16ca37ede8a4,
9178            >(_buf?)?
9179            .into_result::<PacketStreamSinkMarker>("flush_packets")?;
9180            Ok(_response.map(|x| x))
9181        }
9182        self.client.send_query_and_decode::<
9183            fidl::encoding::EmptyPayload,
9184            PacketStreamSinkFlushPacketsResult,
9185        >(
9186            (),
9187            0x13f16ca37ede8a4,
9188            fidl::encoding::DynamicFlags::FLEXIBLE,
9189            _decode,
9190        )
9191    }
9192}
9193
9194pub struct PacketStreamSinkEventStream {
9195    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9196}
9197
9198impl std::marker::Unpin for PacketStreamSinkEventStream {}
9199
9200impl futures::stream::FusedStream for PacketStreamSinkEventStream {
9201    fn is_terminated(&self) -> bool {
9202        self.event_receiver.is_terminated()
9203    }
9204}
9205
9206impl futures::Stream for PacketStreamSinkEventStream {
9207    type Item = Result<PacketStreamSinkEvent, fidl::Error>;
9208
9209    fn poll_next(
9210        mut self: std::pin::Pin<&mut Self>,
9211        cx: &mut std::task::Context<'_>,
9212    ) -> std::task::Poll<Option<Self::Item>> {
9213        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9214            &mut self.event_receiver,
9215            cx
9216        )?) {
9217            Some(buf) => std::task::Poll::Ready(Some(PacketStreamSinkEvent::decode(buf))),
9218            None => std::task::Poll::Ready(None),
9219        }
9220    }
9221}
9222
9223#[derive(Debug)]
9224pub enum PacketStreamSinkEvent {
9225    #[non_exhaustive]
9226    _UnknownEvent {
9227        /// Ordinal of the event that was sent.
9228        ordinal: u64,
9229    },
9230}
9231
9232impl PacketStreamSinkEvent {
9233    /// Decodes a message buffer as a [`PacketStreamSinkEvent`].
9234    fn decode(
9235        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9236    ) -> Result<PacketStreamSinkEvent, fidl::Error> {
9237        let (bytes, _handles) = buf.split_mut();
9238        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9239        debug_assert_eq!(tx_header.tx_id, 0);
9240        match tx_header.ordinal {
9241            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
9242                Ok(PacketStreamSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
9243            }
9244            _ => Err(fidl::Error::UnknownOrdinal {
9245                ordinal: tx_header.ordinal,
9246                protocol_name:
9247                    <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9248            }),
9249        }
9250    }
9251}
9252
9253/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamSink.
9254pub struct PacketStreamSinkRequestStream {
9255    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9256    is_terminated: bool,
9257}
9258
9259impl std::marker::Unpin for PacketStreamSinkRequestStream {}
9260
9261impl futures::stream::FusedStream for PacketStreamSinkRequestStream {
9262    fn is_terminated(&self) -> bool {
9263        self.is_terminated
9264    }
9265}
9266
9267impl fidl::endpoints::RequestStream for PacketStreamSinkRequestStream {
9268    type Protocol = PacketStreamSinkMarker;
9269    type ControlHandle = PacketStreamSinkControlHandle;
9270
9271    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9272        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9273    }
9274
9275    fn control_handle(&self) -> Self::ControlHandle {
9276        PacketStreamSinkControlHandle { inner: self.inner.clone() }
9277    }
9278
9279    fn into_inner(
9280        self,
9281    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9282    {
9283        (self.inner, self.is_terminated)
9284    }
9285
9286    fn from_inner(
9287        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9288        is_terminated: bool,
9289    ) -> Self {
9290        Self { inner, is_terminated }
9291    }
9292}
9293
9294impl futures::Stream for PacketStreamSinkRequestStream {
9295    type Item = Result<PacketStreamSinkRequest, fidl::Error>;
9296
9297    fn poll_next(
9298        mut self: std::pin::Pin<&mut Self>,
9299        cx: &mut std::task::Context<'_>,
9300    ) -> std::task::Poll<Option<Self::Item>> {
9301        let this = &mut *self;
9302        if this.inner.check_shutdown(cx) {
9303            this.is_terminated = true;
9304            return std::task::Poll::Ready(None);
9305        }
9306        if this.is_terminated {
9307            panic!("polled PacketStreamSinkRequestStream after completion");
9308        }
9309        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9310            |bytes, handles| {
9311                match this.inner.channel().read_etc(cx, bytes, handles) {
9312                    std::task::Poll::Ready(Ok(())) => {}
9313                    std::task::Poll::Pending => return std::task::Poll::Pending,
9314                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9315                        this.is_terminated = true;
9316                        return std::task::Poll::Ready(None);
9317                    }
9318                    std::task::Poll::Ready(Err(e)) => {
9319                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9320                            e.into(),
9321                        ))));
9322                    }
9323                }
9324
9325                // A message has been received from the channel
9326                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9327
9328                std::task::Poll::Ready(Some(match header.ordinal {
9329                    0x25a8e35efba81f2b => {
9330                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9331                        let mut req = fidl::new_empty!(
9332                            PacketStreamSinkPutPacketRequest,
9333                            fidl::encoding::DefaultFuchsiaResourceDialect
9334                        );
9335                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PacketStreamSinkPutPacketRequest>(&header, _body_bytes, handles, &mut req)?;
9336                        let control_handle =
9337                            PacketStreamSinkControlHandle { inner: this.inner.clone() };
9338                        Ok(PacketStreamSinkRequest::PutPacket {
9339                            payload: req,
9340                            responder: PacketStreamSinkPutPacketResponder {
9341                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9342                                tx_id: header.tx_id,
9343                            },
9344                        })
9345                    }
9346                    0x13f16ca37ede8a4 => {
9347                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9348                        let mut req = fidl::new_empty!(
9349                            fidl::encoding::EmptyPayload,
9350                            fidl::encoding::DefaultFuchsiaResourceDialect
9351                        );
9352                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9353                        let control_handle =
9354                            PacketStreamSinkControlHandle { inner: this.inner.clone() };
9355                        Ok(PacketStreamSinkRequest::FlushPackets {
9356                            responder: PacketStreamSinkFlushPacketsResponder {
9357                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9358                                tx_id: header.tx_id,
9359                            },
9360                        })
9361                    }
9362                    _ if header.tx_id == 0
9363                        && header
9364                            .dynamic_flags()
9365                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9366                    {
9367                        Ok(PacketStreamSinkRequest::_UnknownMethod {
9368                            ordinal: header.ordinal,
9369                            control_handle: PacketStreamSinkControlHandle {
9370                                inner: this.inner.clone(),
9371                            },
9372                            method_type: fidl::MethodType::OneWay,
9373                        })
9374                    }
9375                    _ if header
9376                        .dynamic_flags()
9377                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9378                    {
9379                        this.inner.send_framework_err(
9380                            fidl::encoding::FrameworkErr::UnknownMethod,
9381                            header.tx_id,
9382                            header.ordinal,
9383                            header.dynamic_flags(),
9384                            (bytes, handles),
9385                        )?;
9386                        Ok(PacketStreamSinkRequest::_UnknownMethod {
9387                            ordinal: header.ordinal,
9388                            control_handle: PacketStreamSinkControlHandle {
9389                                inner: this.inner.clone(),
9390                            },
9391                            method_type: fidl::MethodType::TwoWay,
9392                        })
9393                    }
9394                    _ => Err(fidl::Error::UnknownOrdinal {
9395                        ordinal: header.ordinal,
9396                        protocol_name:
9397                            <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9398                    }),
9399                }))
9400            },
9401        )
9402    }
9403}
9404
9405/// The protocol for streaming packet-based audio data.
9406/// This protocol functions as a data sink. The "server" of this protocol consumes packets,
9407/// and the "client" produces packets.
9408///
9409/// This protocol can be used in two directions:
9410/// 1. **Output (Client -> Driver)**: The Driver implements `PacketStreamSink`. The Client (App)
9411///    calls `PutPacket`.
9412/// 2. **Input (Driver -> Client)**: The Client (App) implements `PacketStreamSink`. The Driver
9413///    calls `PutPacket`.
9414#[derive(Debug)]
9415pub enum PacketStreamSinkRequest {
9416    /// Submits a packet to be processed by the server.
9417    ///
9418    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
9419    /// Packets are processed in the order they were submitted. This call
9420    /// blocks until the payload is processed. When this call returns, the
9421    /// buffer region is guaranteed to be available for reuse.
9422    ///
9423    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
9424    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
9425    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
9426    /// * The payload is missing.
9427    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
9428    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
9429    ///   `DRIVER_OWNED`.
9430    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
9431    ///
9432    /// Note: The server is not required to detect if a VMO region is currently in use by a
9433    /// previous pending packet. Clients are responsible for managing buffer usage.
9434    PutPacket {
9435        payload: PacketStreamSinkPutPacketRequest,
9436        responder: PacketStreamSinkPutPacketResponder,
9437    },
9438    /// Flushes all packets currently pending without processing them.
9439    /// This call waits until all pending packets are completed or canceled.
9440    ///
9441    /// Note: A packet may be partially processed (e.g. if it contains multiple
9442    /// audio frames, or if the data does not align with encoded frame boundaries)
9443    /// before it is canceled.
9444    FlushPackets { responder: PacketStreamSinkFlushPacketsResponder },
9445    /// An interaction was received which does not match any known method.
9446    #[non_exhaustive]
9447    _UnknownMethod {
9448        /// Ordinal of the method that was called.
9449        ordinal: u64,
9450        control_handle: PacketStreamSinkControlHandle,
9451        method_type: fidl::MethodType,
9452    },
9453}
9454
9455impl PacketStreamSinkRequest {
9456    #[allow(irrefutable_let_patterns)]
9457    pub fn into_put_packet(
9458        self,
9459    ) -> Option<(PacketStreamSinkPutPacketRequest, PacketStreamSinkPutPacketResponder)> {
9460        if let PacketStreamSinkRequest::PutPacket { payload, responder } = self {
9461            Some((payload, responder))
9462        } else {
9463            None
9464        }
9465    }
9466
9467    #[allow(irrefutable_let_patterns)]
9468    pub fn into_flush_packets(self) -> Option<(PacketStreamSinkFlushPacketsResponder)> {
9469        if let PacketStreamSinkRequest::FlushPackets { responder } = self {
9470            Some((responder))
9471        } else {
9472            None
9473        }
9474    }
9475
9476    /// Name of the method defined in FIDL
9477    pub fn method_name(&self) -> &'static str {
9478        match *self {
9479            PacketStreamSinkRequest::PutPacket { .. } => "put_packet",
9480            PacketStreamSinkRequest::FlushPackets { .. } => "flush_packets",
9481            PacketStreamSinkRequest::_UnknownMethod {
9482                method_type: fidl::MethodType::OneWay,
9483                ..
9484            } => "unknown one-way method",
9485            PacketStreamSinkRequest::_UnknownMethod {
9486                method_type: fidl::MethodType::TwoWay,
9487                ..
9488            } => "unknown two-way method",
9489        }
9490    }
9491}
9492
9493#[derive(Debug, Clone)]
9494pub struct PacketStreamSinkControlHandle {
9495    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9496}
9497
9498impl fidl::endpoints::ControlHandle for PacketStreamSinkControlHandle {
9499    fn shutdown(&self) {
9500        self.inner.shutdown()
9501    }
9502
9503    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9504        self.inner.shutdown_with_epitaph(status)
9505    }
9506
9507    fn is_closed(&self) -> bool {
9508        self.inner.channel().is_closed()
9509    }
9510    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9511        self.inner.channel().on_closed()
9512    }
9513
9514    #[cfg(target_os = "fuchsia")]
9515    fn signal_peer(
9516        &self,
9517        clear_mask: zx::Signals,
9518        set_mask: zx::Signals,
9519    ) -> Result<(), zx_status::Status> {
9520        use fidl::Peered;
9521        self.inner.channel().signal_peer(clear_mask, set_mask)
9522    }
9523}
9524
9525impl PacketStreamSinkControlHandle {}
9526
9527#[must_use = "FIDL methods require a response to be sent"]
9528#[derive(Debug)]
9529pub struct PacketStreamSinkPutPacketResponder {
9530    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
9531    tx_id: u32,
9532}
9533
9534/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
9535/// if the responder is dropped without sending a response, so that the client
9536/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9537impl std::ops::Drop for PacketStreamSinkPutPacketResponder {
9538    fn drop(&mut self) {
9539        self.control_handle.shutdown();
9540        // Safety: drops once, never accessed again
9541        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9542    }
9543}
9544
9545impl fidl::endpoints::Responder for PacketStreamSinkPutPacketResponder {
9546    type ControlHandle = PacketStreamSinkControlHandle;
9547
9548    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
9549        &self.control_handle
9550    }
9551
9552    fn drop_without_shutdown(mut self) {
9553        // Safety: drops once, never accessed again due to mem::forget
9554        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9555        // Prevent Drop from running (which would shut down the channel)
9556        std::mem::forget(self);
9557    }
9558}
9559
9560impl PacketStreamSinkPutPacketResponder {
9561    /// Sends a response to the FIDL transaction.
9562    ///
9563    /// Sets the channel to shutdown if an error occurs.
9564    pub fn send(
9565        self,
9566        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9567    ) -> Result<(), fidl::Error> {
9568        let _result = self.send_raw(result);
9569        if _result.is_err() {
9570            self.control_handle.shutdown();
9571        }
9572        self.drop_without_shutdown();
9573        _result
9574    }
9575
9576    /// Similar to "send" but does not shutdown the channel if an error occurs.
9577    pub fn send_no_shutdown_on_err(
9578        self,
9579        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9580    ) -> Result<(), fidl::Error> {
9581        let _result = self.send_raw(result);
9582        self.drop_without_shutdown();
9583        _result
9584    }
9585
9586    fn send_raw(
9587        &self,
9588        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9589    ) -> Result<(), fidl::Error> {
9590        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
9591            PacketStreamSinkPutPacketResponse,
9592            i32,
9593        >>(
9594            fidl::encoding::FlexibleResult::new(result),
9595            self.tx_id,
9596            0x25a8e35efba81f2b,
9597            fidl::encoding::DynamicFlags::FLEXIBLE,
9598        )
9599    }
9600}
9601
9602#[must_use = "FIDL methods require a response to be sent"]
9603#[derive(Debug)]
9604pub struct PacketStreamSinkFlushPacketsResponder {
9605    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
9606    tx_id: u32,
9607}
9608
9609/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
9610/// if the responder is dropped without sending a response, so that the client
9611/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9612impl std::ops::Drop for PacketStreamSinkFlushPacketsResponder {
9613    fn drop(&mut self) {
9614        self.control_handle.shutdown();
9615        // Safety: drops once, never accessed again
9616        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9617    }
9618}
9619
9620impl fidl::endpoints::Responder for PacketStreamSinkFlushPacketsResponder {
9621    type ControlHandle = PacketStreamSinkControlHandle;
9622
9623    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
9624        &self.control_handle
9625    }
9626
9627    fn drop_without_shutdown(mut self) {
9628        // Safety: drops once, never accessed again due to mem::forget
9629        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9630        // Prevent Drop from running (which would shut down the channel)
9631        std::mem::forget(self);
9632    }
9633}
9634
9635impl PacketStreamSinkFlushPacketsResponder {
9636    /// Sends a response to the FIDL transaction.
9637    ///
9638    /// Sets the channel to shutdown if an error occurs.
9639    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9640        let _result = self.send_raw(result);
9641        if _result.is_err() {
9642            self.control_handle.shutdown();
9643        }
9644        self.drop_without_shutdown();
9645        _result
9646    }
9647
9648    /// Similar to "send" but does not shutdown the channel if an error occurs.
9649    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9650        let _result = self.send_raw(result);
9651        self.drop_without_shutdown();
9652        _result
9653    }
9654
9655    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9656        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
9657            fidl::encoding::EmptyStruct,
9658            i32,
9659        >>(
9660            fidl::encoding::FlexibleResult::new(result),
9661            self.tx_id,
9662            0x13f16ca37ede8a4,
9663            fidl::encoding::DynamicFlags::FLEXIBLE,
9664        )
9665    }
9666}
9667
9668#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9669pub struct RingBufferMarker;
9670
9671impl fidl::endpoints::ProtocolMarker for RingBufferMarker {
9672    type Proxy = RingBufferProxy;
9673    type RequestStream = RingBufferRequestStream;
9674    #[cfg(target_os = "fuchsia")]
9675    type SynchronousProxy = RingBufferSynchronousProxy;
9676
9677    const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
9678}
9679pub type RingBufferGetVmoResult = Result<(u32, fidl::Vmo), GetVmoError>;
9680pub type RingBufferSetActiveChannelsResult = Result<i64, i32>;
9681
9682pub trait RingBufferProxyInterface: Send + Sync {
9683    type GetPropertiesResponseFut: std::future::Future<Output = Result<RingBufferProperties, fidl::Error>>
9684        + Send;
9685    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
9686    type WatchClockRecoveryPositionInfoResponseFut: std::future::Future<Output = Result<RingBufferPositionInfo, fidl::Error>>
9687        + Send;
9688    fn r#watch_clock_recovery_position_info(
9689        &self,
9690    ) -> Self::WatchClockRecoveryPositionInfoResponseFut;
9691    type GetVmoResponseFut: std::future::Future<Output = Result<RingBufferGetVmoResult, fidl::Error>>
9692        + Send;
9693    fn r#get_vmo(
9694        &self,
9695        min_frames: u32,
9696        clock_recovery_notifications_per_ring: u32,
9697    ) -> Self::GetVmoResponseFut;
9698    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
9699    fn r#start(&self) -> Self::StartResponseFut;
9700    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
9701    fn r#stop(&self) -> Self::StopResponseFut;
9702    type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
9703        + Send;
9704    fn r#set_active_channels(
9705        &self,
9706        active_channels_bitmask: u64,
9707    ) -> Self::SetActiveChannelsResponseFut;
9708    type WatchDelayInfoResponseFut: std::future::Future<Output = Result<DelayInfo, fidl::Error>>
9709        + Send;
9710    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
9711}
9712#[derive(Debug)]
9713#[cfg(target_os = "fuchsia")]
9714pub struct RingBufferSynchronousProxy {
9715    client: fidl::client::sync::Client,
9716}
9717
9718#[cfg(target_os = "fuchsia")]
9719impl fidl::endpoints::SynchronousProxy for RingBufferSynchronousProxy {
9720    type Proxy = RingBufferProxy;
9721    type Protocol = RingBufferMarker;
9722
9723    fn from_channel(inner: fidl::Channel) -> Self {
9724        Self::new(inner)
9725    }
9726
9727    fn into_channel(self) -> fidl::Channel {
9728        self.client.into_channel()
9729    }
9730
9731    fn as_channel(&self) -> &fidl::Channel {
9732        self.client.as_channel()
9733    }
9734}
9735
9736#[cfg(target_os = "fuchsia")]
9737impl RingBufferSynchronousProxy {
9738    pub fn new(channel: fidl::Channel) -> Self {
9739        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9740        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9741    }
9742
9743    pub fn into_channel(self) -> fidl::Channel {
9744        self.client.into_channel()
9745    }
9746
9747    /// Waits until an event arrives and returns it. It is safe for other
9748    /// threads to make concurrent requests while waiting for an event.
9749    pub fn wait_for_event(
9750        &self,
9751        deadline: zx::MonotonicInstant,
9752    ) -> Result<RingBufferEvent, fidl::Error> {
9753        RingBufferEvent::decode(self.client.wait_for_event(deadline)?)
9754    }
9755
9756    /// Accessor for top level static properties.
9757    pub fn r#get_properties(
9758        &self,
9759        ___deadline: zx::MonotonicInstant,
9760    ) -> Result<RingBufferProperties, fidl::Error> {
9761        let _response = self
9762            .client
9763            .send_query::<fidl::encoding::EmptyPayload, RingBufferGetPropertiesResponse>(
9764                (),
9765                0x12947f061a8fe1,
9766                fidl::encoding::DynamicFlags::empty(),
9767                ___deadline,
9768            )?;
9769        Ok(_response.properties)
9770    }
9771
9772    /// Gets the ring buffer current position via a hanging get.
9773    ///
9774    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
9775    /// `clock_recovery_notifications_per_ring` was specified.
9776    ///
9777    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
9778    /// not respond to subsequent client calls until the position information has changed from what
9779    /// was most recently provided to that client.
9780    ///
9781    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
9782    /// to the `Start` command.
9783    ///
9784    /// At the `start_time` returned by `Start`, position is always 0. From there, it
9785    /// progresses at the rate specified by the rate, sample format (and clock domain,
9786    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
9787    ///
9788    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
9789    /// estimated position to be used for clock recovery at most at
9790    /// `clock_recovery_notifications_per_ring` frequency.
9791    ///
9792    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
9793    /// increasing.
9794    ///
9795    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
9796    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
9797    pub fn r#watch_clock_recovery_position_info(
9798        &self,
9799        ___deadline: zx::MonotonicInstant,
9800    ) -> Result<RingBufferPositionInfo, fidl::Error> {
9801        let _response = self.client.send_query::<
9802            fidl::encoding::EmptyPayload,
9803            RingBufferWatchClockRecoveryPositionInfoResponse,
9804        >(
9805            (),
9806            0x694d5b898a4167e5,
9807            fidl::encoding::DynamicFlags::empty(),
9808            ___deadline,
9809        )?;
9810        Ok(_response.position_info)
9811    }
9812
9813    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
9814    ///
9815    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
9816    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
9817    ///
9818    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
9819    /// that ring buffer contents can be transfered in and out, or else the call must be failed
9820    /// with GetVmoError.INVALID_ARGS.
9821    ///
9822    /// The driver may increase the ring buffer size beyond `min_frames` plus
9823    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
9824    /// alignment.
9825    ///
9826    /// Clients can treat the entire returned ring buffer as safe to access, except for the
9827    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
9828    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
9829    ///
9830    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
9831    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
9832    /// handle must also include ZX_RIGHT_WRITE.
9833    ///
9834    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
9835    /// `WatchClockRecoveryPositionInfo` client requests at most at
9836    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
9837    /// for clock recovery.
9838    pub fn r#get_vmo(
9839        &self,
9840        mut min_frames: u32,
9841        mut clock_recovery_notifications_per_ring: u32,
9842        ___deadline: zx::MonotonicInstant,
9843    ) -> Result<RingBufferGetVmoResult, fidl::Error> {
9844        let _response = self.client.send_query::<
9845            RingBufferGetVmoRequest,
9846            fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
9847        >(
9848            (min_frames, clock_recovery_notifications_per_ring,),
9849            0x44c8f4f5680e853a,
9850            fidl::encoding::DynamicFlags::empty(),
9851            ___deadline,
9852        )?;
9853        Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
9854    }
9855
9856    /// Start the ring buffer.
9857    ///
9858    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
9859    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
9860    /// write from or to the ring buffer position 0, subject to the overall position and buffering
9861    /// behavior described in 'Ring buffer behavior' below.
9862    ///
9863    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
9864    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
9865    /// a second time before the first call has completed, then the channel must be closed with an
9866    /// error `ZX_ERR_BAD_STATE` returned.
9867    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
9868    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
9869        let _response =
9870            self.client.send_query::<fidl::encoding::EmptyPayload, RingBufferStartResponse>(
9871                (),
9872                0x5dd780a769a8892d,
9873                fidl::encoding::DynamicFlags::empty(),
9874                ___deadline,
9875            )?;
9876        Ok(_response.start_time)
9877    }
9878
9879    /// Stop the ring buffer.
9880    ///
9881    /// Once this call's response is received, no further position notifications will be sent until
9882    /// `Start` is called again.
9883    ///
9884    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
9885    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
9886        let _response =
9887            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
9888                (),
9889                0x49a73d9cf1d4e110,
9890                fidl::encoding::DynamicFlags::empty(),
9891                ___deadline,
9892            )?;
9893        Ok(_response)
9894    }
9895
9896    /// Sets which channels are active via a bitmask.
9897    ///
9898    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
9899    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
9900    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
9901    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
9902    /// turns on the hardware associated for all channels.
9903    ///
9904    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
9905    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
9906    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
9907    ///
9908    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
9909    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
9910    /// buffer's position advances (and position notifications sent as needed) regardless of the
9911    /// number of active channels, including if no channels are active. This means that the format
9912    /// in the ring buffer is not changed.
9913    ///
9914    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
9915    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
9916    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
9917    ///
9918    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
9919    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
9920    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
9921    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
9922    /// hardware configuration was completed. If the requested channel configuration is already
9923    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
9924    /// before the reply is sent. If called again with the same configuration, the reply must
9925    /// include the same `set_time` value as was previously returned.
9926    ///
9927    /// For input channels, it is not required that the driver zero-out inactive channels.
9928    ///
9929    /// If `SetActiveChannels` is called for a second time before the first call has completed,
9930    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
9931    pub fn r#set_active_channels(
9932        &self,
9933        mut active_channels_bitmask: u64,
9934        ___deadline: zx::MonotonicInstant,
9935    ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
9936        let _response = self.client.send_query::<
9937            RingBufferSetActiveChannelsRequest,
9938            fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
9939        >(
9940            (active_channels_bitmask,),
9941            0x605464c1d384f309,
9942            fidl::encoding::DynamicFlags::empty(),
9943            ___deadline,
9944        )?;
9945        Ok(_response.map(|x| x.set_time))
9946    }
9947
9948    /// Get information about delays via a hanging get.
9949    ///
9950    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
9951    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
9952    /// changes from what was most recently reported.
9953    ///
9954    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
9955    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
9956    pub fn r#watch_delay_info(
9957        &self,
9958        ___deadline: zx::MonotonicInstant,
9959    ) -> Result<DelayInfo, fidl::Error> {
9960        let _response = self.client.send_query::<
9961            fidl::encoding::EmptyPayload,
9962            fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
9963        >(
9964            (),
9965            0x6c1248db213fcf9f,
9966            fidl::encoding::DynamicFlags::FLEXIBLE,
9967            ___deadline,
9968        )?
9969        .into_result::<RingBufferMarker>("watch_delay_info")?;
9970        Ok(_response.delay_info)
9971    }
9972}
9973
9974#[cfg(target_os = "fuchsia")]
9975impl From<RingBufferSynchronousProxy> for zx::NullableHandle {
9976    fn from(value: RingBufferSynchronousProxy) -> Self {
9977        value.into_channel().into()
9978    }
9979}
9980
9981#[cfg(target_os = "fuchsia")]
9982impl From<fidl::Channel> for RingBufferSynchronousProxy {
9983    fn from(value: fidl::Channel) -> Self {
9984        Self::new(value)
9985    }
9986}
9987
9988#[cfg(target_os = "fuchsia")]
9989impl fidl::endpoints::FromClient for RingBufferSynchronousProxy {
9990    type Protocol = RingBufferMarker;
9991
9992    fn from_client(value: fidl::endpoints::ClientEnd<RingBufferMarker>) -> Self {
9993        Self::new(value.into_channel())
9994    }
9995}
9996
9997#[derive(Debug, Clone)]
9998pub struct RingBufferProxy {
9999    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10000}
10001
10002impl fidl::endpoints::Proxy for RingBufferProxy {
10003    type Protocol = RingBufferMarker;
10004
10005    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10006        Self::new(inner)
10007    }
10008
10009    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10010        self.client.into_channel().map_err(|client| Self { client })
10011    }
10012
10013    fn as_channel(&self) -> &::fidl::AsyncChannel {
10014        self.client.as_channel()
10015    }
10016}
10017
10018impl RingBufferProxy {
10019    /// Create a new Proxy for fuchsia.hardware.audio/RingBuffer.
10020    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10021        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10022        Self { client: fidl::client::Client::new(channel, protocol_name) }
10023    }
10024
10025    /// Get a Stream of events from the remote end of the protocol.
10026    ///
10027    /// # Panics
10028    ///
10029    /// Panics if the event stream was already taken.
10030    pub fn take_event_stream(&self) -> RingBufferEventStream {
10031        RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
10032    }
10033
10034    /// Accessor for top level static properties.
10035    pub fn r#get_properties(
10036        &self,
10037    ) -> fidl::client::QueryResponseFut<
10038        RingBufferProperties,
10039        fidl::encoding::DefaultFuchsiaResourceDialect,
10040    > {
10041        RingBufferProxyInterface::r#get_properties(self)
10042    }
10043
10044    /// Gets the ring buffer current position via a hanging get.
10045    ///
10046    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
10047    /// `clock_recovery_notifications_per_ring` was specified.
10048    ///
10049    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
10050    /// not respond to subsequent client calls until the position information has changed from what
10051    /// was most recently provided to that client.
10052    ///
10053    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
10054    /// to the `Start` command.
10055    ///
10056    /// At the `start_time` returned by `Start`, position is always 0. From there, it
10057    /// progresses at the rate specified by the rate, sample format (and clock domain,
10058    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
10059    ///
10060    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
10061    /// estimated position to be used for clock recovery at most at
10062    /// `clock_recovery_notifications_per_ring` frequency.
10063    ///
10064    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
10065    /// increasing.
10066    ///
10067    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
10068    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
10069    pub fn r#watch_clock_recovery_position_info(
10070        &self,
10071    ) -> fidl::client::QueryResponseFut<
10072        RingBufferPositionInfo,
10073        fidl::encoding::DefaultFuchsiaResourceDialect,
10074    > {
10075        RingBufferProxyInterface::r#watch_clock_recovery_position_info(self)
10076    }
10077
10078    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
10079    ///
10080    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
10081    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
10082    ///
10083    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
10084    /// that ring buffer contents can be transfered in and out, or else the call must be failed
10085    /// with GetVmoError.INVALID_ARGS.
10086    ///
10087    /// The driver may increase the ring buffer size beyond `min_frames` plus
10088    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
10089    /// alignment.
10090    ///
10091    /// Clients can treat the entire returned ring buffer as safe to access, except for the
10092    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
10093    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
10094    ///
10095    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
10096    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
10097    /// handle must also include ZX_RIGHT_WRITE.
10098    ///
10099    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
10100    /// `WatchClockRecoveryPositionInfo` client requests at most at
10101    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
10102    /// for clock recovery.
10103    pub fn r#get_vmo(
10104        &self,
10105        mut min_frames: u32,
10106        mut clock_recovery_notifications_per_ring: u32,
10107    ) -> fidl::client::QueryResponseFut<
10108        RingBufferGetVmoResult,
10109        fidl::encoding::DefaultFuchsiaResourceDialect,
10110    > {
10111        RingBufferProxyInterface::r#get_vmo(self, min_frames, clock_recovery_notifications_per_ring)
10112    }
10113
10114    /// Start the ring buffer.
10115    ///
10116    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
10117    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
10118    /// write from or to the ring buffer position 0, subject to the overall position and buffering
10119    /// behavior described in 'Ring buffer behavior' below.
10120    ///
10121    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10122    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
10123    /// a second time before the first call has completed, then the channel must be closed with an
10124    /// error `ZX_ERR_BAD_STATE` returned.
10125    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
10126    pub fn r#start(
10127        &self,
10128    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
10129        RingBufferProxyInterface::r#start(self)
10130    }
10131
10132    /// Stop the ring buffer.
10133    ///
10134    /// Once this call's response is received, no further position notifications will be sent until
10135    /// `Start` is called again.
10136    ///
10137    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10138    pub fn r#stop(
10139        &self,
10140    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
10141        RingBufferProxyInterface::r#stop(self)
10142    }
10143
10144    /// Sets which channels are active via a bitmask.
10145    ///
10146    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
10147    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
10148    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
10149    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
10150    /// turns on the hardware associated for all channels.
10151    ///
10152    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
10153    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
10154    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
10155    ///
10156    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
10157    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
10158    /// buffer's position advances (and position notifications sent as needed) regardless of the
10159    /// number of active channels, including if no channels are active. This means that the format
10160    /// in the ring buffer is not changed.
10161    ///
10162    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
10163    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
10164    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
10165    ///
10166    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
10167    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
10168    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
10169    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
10170    /// hardware configuration was completed. If the requested channel configuration is already
10171    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
10172    /// before the reply is sent. If called again with the same configuration, the reply must
10173    /// include the same `set_time` value as was previously returned.
10174    ///
10175    /// For input channels, it is not required that the driver zero-out inactive channels.
10176    ///
10177    /// If `SetActiveChannels` is called for a second time before the first call has completed,
10178    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10179    pub fn r#set_active_channels(
10180        &self,
10181        mut active_channels_bitmask: u64,
10182    ) -> fidl::client::QueryResponseFut<
10183        RingBufferSetActiveChannelsResult,
10184        fidl::encoding::DefaultFuchsiaResourceDialect,
10185    > {
10186        RingBufferProxyInterface::r#set_active_channels(self, active_channels_bitmask)
10187    }
10188
10189    /// Get information about delays via a hanging get.
10190    ///
10191    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
10192    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
10193    /// changes from what was most recently reported.
10194    ///
10195    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
10196    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10197    pub fn r#watch_delay_info(
10198        &self,
10199    ) -> fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
10200    {
10201        RingBufferProxyInterface::r#watch_delay_info(self)
10202    }
10203}
10204
10205impl RingBufferProxyInterface for RingBufferProxy {
10206    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
10207        RingBufferProperties,
10208        fidl::encoding::DefaultFuchsiaResourceDialect,
10209    >;
10210    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
10211        fn _decode(
10212            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10213        ) -> Result<RingBufferProperties, fidl::Error> {
10214            let _response = fidl::client::decode_transaction_body::<
10215                RingBufferGetPropertiesResponse,
10216                fidl::encoding::DefaultFuchsiaResourceDialect,
10217                0x12947f061a8fe1,
10218            >(_buf?)?;
10219            Ok(_response.properties)
10220        }
10221        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferProperties>(
10222            (),
10223            0x12947f061a8fe1,
10224            fidl::encoding::DynamicFlags::empty(),
10225            _decode,
10226        )
10227    }
10228
10229    type WatchClockRecoveryPositionInfoResponseFut = fidl::client::QueryResponseFut<
10230        RingBufferPositionInfo,
10231        fidl::encoding::DefaultFuchsiaResourceDialect,
10232    >;
10233    fn r#watch_clock_recovery_position_info(
10234        &self,
10235    ) -> Self::WatchClockRecoveryPositionInfoResponseFut {
10236        fn _decode(
10237            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10238        ) -> Result<RingBufferPositionInfo, fidl::Error> {
10239            let _response = fidl::client::decode_transaction_body::<
10240                RingBufferWatchClockRecoveryPositionInfoResponse,
10241                fidl::encoding::DefaultFuchsiaResourceDialect,
10242                0x694d5b898a4167e5,
10243            >(_buf?)?;
10244            Ok(_response.position_info)
10245        }
10246        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferPositionInfo>(
10247            (),
10248            0x694d5b898a4167e5,
10249            fidl::encoding::DynamicFlags::empty(),
10250            _decode,
10251        )
10252    }
10253
10254    type GetVmoResponseFut = fidl::client::QueryResponseFut<
10255        RingBufferGetVmoResult,
10256        fidl::encoding::DefaultFuchsiaResourceDialect,
10257    >;
10258    fn r#get_vmo(
10259        &self,
10260        mut min_frames: u32,
10261        mut clock_recovery_notifications_per_ring: u32,
10262    ) -> Self::GetVmoResponseFut {
10263        fn _decode(
10264            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10265        ) -> Result<RingBufferGetVmoResult, fidl::Error> {
10266            let _response = fidl::client::decode_transaction_body::<
10267                fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
10268                fidl::encoding::DefaultFuchsiaResourceDialect,
10269                0x44c8f4f5680e853a,
10270            >(_buf?)?;
10271            Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
10272        }
10273        self.client.send_query_and_decode::<RingBufferGetVmoRequest, RingBufferGetVmoResult>(
10274            (min_frames, clock_recovery_notifications_per_ring),
10275            0x44c8f4f5680e853a,
10276            fidl::encoding::DynamicFlags::empty(),
10277            _decode,
10278        )
10279    }
10280
10281    type StartResponseFut =
10282        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
10283    fn r#start(&self) -> Self::StartResponseFut {
10284        fn _decode(
10285            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10286        ) -> Result<i64, fidl::Error> {
10287            let _response = fidl::client::decode_transaction_body::<
10288                RingBufferStartResponse,
10289                fidl::encoding::DefaultFuchsiaResourceDialect,
10290                0x5dd780a769a8892d,
10291            >(_buf?)?;
10292            Ok(_response.start_time)
10293        }
10294        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
10295            (),
10296            0x5dd780a769a8892d,
10297            fidl::encoding::DynamicFlags::empty(),
10298            _decode,
10299        )
10300    }
10301
10302    type StopResponseFut =
10303        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
10304    fn r#stop(&self) -> Self::StopResponseFut {
10305        fn _decode(
10306            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10307        ) -> Result<(), fidl::Error> {
10308            let _response = fidl::client::decode_transaction_body::<
10309                fidl::encoding::EmptyPayload,
10310                fidl::encoding::DefaultFuchsiaResourceDialect,
10311                0x49a73d9cf1d4e110,
10312            >(_buf?)?;
10313            Ok(_response)
10314        }
10315        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
10316            (),
10317            0x49a73d9cf1d4e110,
10318            fidl::encoding::DynamicFlags::empty(),
10319            _decode,
10320        )
10321    }
10322
10323    type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
10324        RingBufferSetActiveChannelsResult,
10325        fidl::encoding::DefaultFuchsiaResourceDialect,
10326    >;
10327    fn r#set_active_channels(
10328        &self,
10329        mut active_channels_bitmask: u64,
10330    ) -> Self::SetActiveChannelsResponseFut {
10331        fn _decode(
10332            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10333        ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
10334            let _response = fidl::client::decode_transaction_body::<
10335                fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
10336                fidl::encoding::DefaultFuchsiaResourceDialect,
10337                0x605464c1d384f309,
10338            >(_buf?)?;
10339            Ok(_response.map(|x| x.set_time))
10340        }
10341        self.client.send_query_and_decode::<
10342            RingBufferSetActiveChannelsRequest,
10343            RingBufferSetActiveChannelsResult,
10344        >(
10345            (active_channels_bitmask,),
10346            0x605464c1d384f309,
10347            fidl::encoding::DynamicFlags::empty(),
10348            _decode,
10349        )
10350    }
10351
10352    type WatchDelayInfoResponseFut =
10353        fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
10354    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
10355        fn _decode(
10356            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10357        ) -> Result<DelayInfo, fidl::Error> {
10358            let _response = fidl::client::decode_transaction_body::<
10359                fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
10360                fidl::encoding::DefaultFuchsiaResourceDialect,
10361                0x6c1248db213fcf9f,
10362            >(_buf?)?
10363            .into_result::<RingBufferMarker>("watch_delay_info")?;
10364            Ok(_response.delay_info)
10365        }
10366        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelayInfo>(
10367            (),
10368            0x6c1248db213fcf9f,
10369            fidl::encoding::DynamicFlags::FLEXIBLE,
10370            _decode,
10371        )
10372    }
10373}
10374
10375pub struct RingBufferEventStream {
10376    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10377}
10378
10379impl std::marker::Unpin for RingBufferEventStream {}
10380
10381impl futures::stream::FusedStream for RingBufferEventStream {
10382    fn is_terminated(&self) -> bool {
10383        self.event_receiver.is_terminated()
10384    }
10385}
10386
10387impl futures::Stream for RingBufferEventStream {
10388    type Item = Result<RingBufferEvent, fidl::Error>;
10389
10390    fn poll_next(
10391        mut self: std::pin::Pin<&mut Self>,
10392        cx: &mut std::task::Context<'_>,
10393    ) -> std::task::Poll<Option<Self::Item>> {
10394        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10395            &mut self.event_receiver,
10396            cx
10397        )?) {
10398            Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
10399            None => std::task::Poll::Ready(None),
10400        }
10401    }
10402}
10403
10404#[derive(Debug)]
10405pub enum RingBufferEvent {
10406    #[non_exhaustive]
10407    _UnknownEvent {
10408        /// Ordinal of the event that was sent.
10409        ordinal: u64,
10410    },
10411}
10412
10413impl RingBufferEvent {
10414    /// Decodes a message buffer as a [`RingBufferEvent`].
10415    fn decode(
10416        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10417    ) -> Result<RingBufferEvent, fidl::Error> {
10418        let (bytes, _handles) = buf.split_mut();
10419        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10420        debug_assert_eq!(tx_header.tx_id, 0);
10421        match tx_header.ordinal {
10422            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
10423                Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
10424            }
10425            _ => Err(fidl::Error::UnknownOrdinal {
10426                ordinal: tx_header.ordinal,
10427                protocol_name: <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10428            }),
10429        }
10430    }
10431}
10432
10433/// A Stream of incoming requests for fuchsia.hardware.audio/RingBuffer.
10434pub struct RingBufferRequestStream {
10435    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10436    is_terminated: bool,
10437}
10438
10439impl std::marker::Unpin for RingBufferRequestStream {}
10440
10441impl futures::stream::FusedStream for RingBufferRequestStream {
10442    fn is_terminated(&self) -> bool {
10443        self.is_terminated
10444    }
10445}
10446
10447impl fidl::endpoints::RequestStream for RingBufferRequestStream {
10448    type Protocol = RingBufferMarker;
10449    type ControlHandle = RingBufferControlHandle;
10450
10451    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10452        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10453    }
10454
10455    fn control_handle(&self) -> Self::ControlHandle {
10456        RingBufferControlHandle { inner: self.inner.clone() }
10457    }
10458
10459    fn into_inner(
10460        self,
10461    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10462    {
10463        (self.inner, self.is_terminated)
10464    }
10465
10466    fn from_inner(
10467        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10468        is_terminated: bool,
10469    ) -> Self {
10470        Self { inner, is_terminated }
10471    }
10472}
10473
10474impl futures::Stream for RingBufferRequestStream {
10475    type Item = Result<RingBufferRequest, fidl::Error>;
10476
10477    fn poll_next(
10478        mut self: std::pin::Pin<&mut Self>,
10479        cx: &mut std::task::Context<'_>,
10480    ) -> std::task::Poll<Option<Self::Item>> {
10481        let this = &mut *self;
10482        if this.inner.check_shutdown(cx) {
10483            this.is_terminated = true;
10484            return std::task::Poll::Ready(None);
10485        }
10486        if this.is_terminated {
10487            panic!("polled RingBufferRequestStream after completion");
10488        }
10489        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10490            |bytes, handles| {
10491                match this.inner.channel().read_etc(cx, bytes, handles) {
10492                    std::task::Poll::Ready(Ok(())) => {}
10493                    std::task::Poll::Pending => return std::task::Poll::Pending,
10494                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10495                        this.is_terminated = true;
10496                        return std::task::Poll::Ready(None);
10497                    }
10498                    std::task::Poll::Ready(Err(e)) => {
10499                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10500                            e.into(),
10501                        ))));
10502                    }
10503                }
10504
10505                // A message has been received from the channel
10506                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10507
10508                std::task::Poll::Ready(Some(match header.ordinal {
10509                    0x12947f061a8fe1 => {
10510                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10511                        let mut req = fidl::new_empty!(
10512                            fidl::encoding::EmptyPayload,
10513                            fidl::encoding::DefaultFuchsiaResourceDialect
10514                        );
10515                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10516                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10517                        Ok(RingBufferRequest::GetProperties {
10518                            responder: RingBufferGetPropertiesResponder {
10519                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10520                                tx_id: header.tx_id,
10521                            },
10522                        })
10523                    }
10524                    0x694d5b898a4167e5 => {
10525                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10526                        let mut req = fidl::new_empty!(
10527                            fidl::encoding::EmptyPayload,
10528                            fidl::encoding::DefaultFuchsiaResourceDialect
10529                        );
10530                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10531                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10532                        Ok(RingBufferRequest::WatchClockRecoveryPositionInfo {
10533                            responder: RingBufferWatchClockRecoveryPositionInfoResponder {
10534                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10535                                tx_id: header.tx_id,
10536                            },
10537                        })
10538                    }
10539                    0x44c8f4f5680e853a => {
10540                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10541                        let mut req = fidl::new_empty!(
10542                            RingBufferGetVmoRequest,
10543                            fidl::encoding::DefaultFuchsiaResourceDialect
10544                        );
10545                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
10546                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10547                        Ok(RingBufferRequest::GetVmo {
10548                            min_frames: req.min_frames,
10549                            clock_recovery_notifications_per_ring: req
10550                                .clock_recovery_notifications_per_ring,
10551
10552                            responder: RingBufferGetVmoResponder {
10553                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10554                                tx_id: header.tx_id,
10555                            },
10556                        })
10557                    }
10558                    0x5dd780a769a8892d => {
10559                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10560                        let mut req = fidl::new_empty!(
10561                            fidl::encoding::EmptyPayload,
10562                            fidl::encoding::DefaultFuchsiaResourceDialect
10563                        );
10564                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10565                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10566                        Ok(RingBufferRequest::Start {
10567                            responder: RingBufferStartResponder {
10568                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10569                                tx_id: header.tx_id,
10570                            },
10571                        })
10572                    }
10573                    0x49a73d9cf1d4e110 => {
10574                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10575                        let mut req = fidl::new_empty!(
10576                            fidl::encoding::EmptyPayload,
10577                            fidl::encoding::DefaultFuchsiaResourceDialect
10578                        );
10579                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10580                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10581                        Ok(RingBufferRequest::Stop {
10582                            responder: RingBufferStopResponder {
10583                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10584                                tx_id: header.tx_id,
10585                            },
10586                        })
10587                    }
10588                    0x605464c1d384f309 => {
10589                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10590                        let mut req = fidl::new_empty!(
10591                            RingBufferSetActiveChannelsRequest,
10592                            fidl::encoding::DefaultFuchsiaResourceDialect
10593                        );
10594                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
10595                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10596                        Ok(RingBufferRequest::SetActiveChannels {
10597                            active_channels_bitmask: req.active_channels_bitmask,
10598
10599                            responder: RingBufferSetActiveChannelsResponder {
10600                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10601                                tx_id: header.tx_id,
10602                            },
10603                        })
10604                    }
10605                    0x6c1248db213fcf9f => {
10606                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10607                        let mut req = fidl::new_empty!(
10608                            fidl::encoding::EmptyPayload,
10609                            fidl::encoding::DefaultFuchsiaResourceDialect
10610                        );
10611                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10612                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10613                        Ok(RingBufferRequest::WatchDelayInfo {
10614                            responder: RingBufferWatchDelayInfoResponder {
10615                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10616                                tx_id: header.tx_id,
10617                            },
10618                        })
10619                    }
10620                    _ if header.tx_id == 0
10621                        && header
10622                            .dynamic_flags()
10623                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
10624                    {
10625                        Ok(RingBufferRequest::_UnknownMethod {
10626                            ordinal: header.ordinal,
10627                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
10628                            method_type: fidl::MethodType::OneWay,
10629                        })
10630                    }
10631                    _ if header
10632                        .dynamic_flags()
10633                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
10634                    {
10635                        this.inner.send_framework_err(
10636                            fidl::encoding::FrameworkErr::UnknownMethod,
10637                            header.tx_id,
10638                            header.ordinal,
10639                            header.dynamic_flags(),
10640                            (bytes, handles),
10641                        )?;
10642                        Ok(RingBufferRequest::_UnknownMethod {
10643                            ordinal: header.ordinal,
10644                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
10645                            method_type: fidl::MethodType::TwoWay,
10646                        })
10647                    }
10648                    _ => Err(fidl::Error::UnknownOrdinal {
10649                        ordinal: header.ordinal,
10650                        protocol_name:
10651                            <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10652                    }),
10653                }))
10654            },
10655        )
10656    }
10657}
10658
10659/// Ring buffers are used to convey audio between parties (usually in different processes), allowing
10660/// concurrent, asynchronous data access without requiring locks. This pattern works because both
10661/// parties share an understanding of which buffer areas are safe to access, and how those areas
10662/// change over time.
10663///
10664/// For in-depth description of the responsibilities for both _producers_ and _consumers_,
10665/// before the ring buffer is started as well as while it is active, please see
10666/// [Ring Buffer Behavior](https://fuchsia.dev/fuchsia-src/development/audio/ring_buffer.md).
10667#[derive(Debug)]
10668pub enum RingBufferRequest {
10669    /// Accessor for top level static properties.
10670    GetProperties { responder: RingBufferGetPropertiesResponder },
10671    /// Gets the ring buffer current position via a hanging get.
10672    ///
10673    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
10674    /// `clock_recovery_notifications_per_ring` was specified.
10675    ///
10676    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
10677    /// not respond to subsequent client calls until the position information has changed from what
10678    /// was most recently provided to that client.
10679    ///
10680    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
10681    /// to the `Start` command.
10682    ///
10683    /// At the `start_time` returned by `Start`, position is always 0. From there, it
10684    /// progresses at the rate specified by the rate, sample format (and clock domain,
10685    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
10686    ///
10687    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
10688    /// estimated position to be used for clock recovery at most at
10689    /// `clock_recovery_notifications_per_ring` frequency.
10690    ///
10691    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
10692    /// increasing.
10693    ///
10694    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
10695    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
10696    WatchClockRecoveryPositionInfo { responder: RingBufferWatchClockRecoveryPositionInfoResponder },
10697    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
10698    ///
10699    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
10700    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
10701    ///
10702    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
10703    /// that ring buffer contents can be transfered in and out, or else the call must be failed
10704    /// with GetVmoError.INVALID_ARGS.
10705    ///
10706    /// The driver may increase the ring buffer size beyond `min_frames` plus
10707    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
10708    /// alignment.
10709    ///
10710    /// Clients can treat the entire returned ring buffer as safe to access, except for the
10711    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
10712    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
10713    ///
10714    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
10715    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
10716    /// handle must also include ZX_RIGHT_WRITE.
10717    ///
10718    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
10719    /// `WatchClockRecoveryPositionInfo` client requests at most at
10720    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
10721    /// for clock recovery.
10722    GetVmo {
10723        min_frames: u32,
10724        clock_recovery_notifications_per_ring: u32,
10725        responder: RingBufferGetVmoResponder,
10726    },
10727    /// Start the ring buffer.
10728    ///
10729    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
10730    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
10731    /// write from or to the ring buffer position 0, subject to the overall position and buffering
10732    /// behavior described in 'Ring buffer behavior' below.
10733    ///
10734    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10735    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
10736    /// a second time before the first call has completed, then the channel must be closed with an
10737    /// error `ZX_ERR_BAD_STATE` returned.
10738    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
10739    Start { responder: RingBufferStartResponder },
10740    /// Stop the ring buffer.
10741    ///
10742    /// Once this call's response is received, no further position notifications will be sent until
10743    /// `Start` is called again.
10744    ///
10745    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10746    Stop { responder: RingBufferStopResponder },
10747    /// Sets which channels are active via a bitmask.
10748    ///
10749    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
10750    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
10751    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
10752    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
10753    /// turns on the hardware associated for all channels.
10754    ///
10755    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
10756    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
10757    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
10758    ///
10759    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
10760    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
10761    /// buffer's position advances (and position notifications sent as needed) regardless of the
10762    /// number of active channels, including if no channels are active. This means that the format
10763    /// in the ring buffer is not changed.
10764    ///
10765    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
10766    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
10767    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
10768    ///
10769    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
10770    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
10771    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
10772    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
10773    /// hardware configuration was completed. If the requested channel configuration is already
10774    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
10775    /// before the reply is sent. If called again with the same configuration, the reply must
10776    /// include the same `set_time` value as was previously returned.
10777    ///
10778    /// For input channels, it is not required that the driver zero-out inactive channels.
10779    ///
10780    /// If `SetActiveChannels` is called for a second time before the first call has completed,
10781    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10782    SetActiveChannels {
10783        active_channels_bitmask: u64,
10784        responder: RingBufferSetActiveChannelsResponder,
10785    },
10786    /// Get information about delays via a hanging get.
10787    ///
10788    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
10789    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
10790    /// changes from what was most recently reported.
10791    ///
10792    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
10793    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10794    WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
10795    /// An interaction was received which does not match any known method.
10796    #[non_exhaustive]
10797    _UnknownMethod {
10798        /// Ordinal of the method that was called.
10799        ordinal: u64,
10800        control_handle: RingBufferControlHandle,
10801        method_type: fidl::MethodType,
10802    },
10803}
10804
10805impl RingBufferRequest {
10806    #[allow(irrefutable_let_patterns)]
10807    pub fn into_get_properties(self) -> Option<(RingBufferGetPropertiesResponder)> {
10808        if let RingBufferRequest::GetProperties { responder } = self {
10809            Some((responder))
10810        } else {
10811            None
10812        }
10813    }
10814
10815    #[allow(irrefutable_let_patterns)]
10816    pub fn into_watch_clock_recovery_position_info(
10817        self,
10818    ) -> Option<(RingBufferWatchClockRecoveryPositionInfoResponder)> {
10819        if let RingBufferRequest::WatchClockRecoveryPositionInfo { responder } = self {
10820            Some((responder))
10821        } else {
10822            None
10823        }
10824    }
10825
10826    #[allow(irrefutable_let_patterns)]
10827    pub fn into_get_vmo(self) -> Option<(u32, u32, RingBufferGetVmoResponder)> {
10828        if let RingBufferRequest::GetVmo {
10829            min_frames,
10830            clock_recovery_notifications_per_ring,
10831            responder,
10832        } = self
10833        {
10834            Some((min_frames, clock_recovery_notifications_per_ring, responder))
10835        } else {
10836            None
10837        }
10838    }
10839
10840    #[allow(irrefutable_let_patterns)]
10841    pub fn into_start(self) -> Option<(RingBufferStartResponder)> {
10842        if let RingBufferRequest::Start { responder } = self { Some((responder)) } else { None }
10843    }
10844
10845    #[allow(irrefutable_let_patterns)]
10846    pub fn into_stop(self) -> Option<(RingBufferStopResponder)> {
10847        if let RingBufferRequest::Stop { responder } = self { Some((responder)) } else { None }
10848    }
10849
10850    #[allow(irrefutable_let_patterns)]
10851    pub fn into_set_active_channels(self) -> Option<(u64, RingBufferSetActiveChannelsResponder)> {
10852        if let RingBufferRequest::SetActiveChannels { active_channels_bitmask, responder } = self {
10853            Some((active_channels_bitmask, responder))
10854        } else {
10855            None
10856        }
10857    }
10858
10859    #[allow(irrefutable_let_patterns)]
10860    pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
10861        if let RingBufferRequest::WatchDelayInfo { responder } = self {
10862            Some((responder))
10863        } else {
10864            None
10865        }
10866    }
10867
10868    /// Name of the method defined in FIDL
10869    pub fn method_name(&self) -> &'static str {
10870        match *self {
10871            RingBufferRequest::GetProperties { .. } => "get_properties",
10872            RingBufferRequest::WatchClockRecoveryPositionInfo { .. } => {
10873                "watch_clock_recovery_position_info"
10874            }
10875            RingBufferRequest::GetVmo { .. } => "get_vmo",
10876            RingBufferRequest::Start { .. } => "start",
10877            RingBufferRequest::Stop { .. } => "stop",
10878            RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
10879            RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
10880            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
10881                "unknown one-way method"
10882            }
10883            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
10884                "unknown two-way method"
10885            }
10886        }
10887    }
10888}
10889
10890#[derive(Debug, Clone)]
10891pub struct RingBufferControlHandle {
10892    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10893}
10894
10895impl fidl::endpoints::ControlHandle for RingBufferControlHandle {
10896    fn shutdown(&self) {
10897        self.inner.shutdown()
10898    }
10899
10900    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10901        self.inner.shutdown_with_epitaph(status)
10902    }
10903
10904    fn is_closed(&self) -> bool {
10905        self.inner.channel().is_closed()
10906    }
10907    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10908        self.inner.channel().on_closed()
10909    }
10910
10911    #[cfg(target_os = "fuchsia")]
10912    fn signal_peer(
10913        &self,
10914        clear_mask: zx::Signals,
10915        set_mask: zx::Signals,
10916    ) -> Result<(), zx_status::Status> {
10917        use fidl::Peered;
10918        self.inner.channel().signal_peer(clear_mask, set_mask)
10919    }
10920}
10921
10922impl RingBufferControlHandle {}
10923
10924#[must_use = "FIDL methods require a response to be sent"]
10925#[derive(Debug)]
10926pub struct RingBufferGetPropertiesResponder {
10927    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
10928    tx_id: u32,
10929}
10930
10931/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
10932/// if the responder is dropped without sending a response, so that the client
10933/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10934impl std::ops::Drop for RingBufferGetPropertiesResponder {
10935    fn drop(&mut self) {
10936        self.control_handle.shutdown();
10937        // Safety: drops once, never accessed again
10938        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10939    }
10940}
10941
10942impl fidl::endpoints::Responder for RingBufferGetPropertiesResponder {
10943    type ControlHandle = RingBufferControlHandle;
10944
10945    fn control_handle(&self) -> &RingBufferControlHandle {
10946        &self.control_handle
10947    }
10948
10949    fn drop_without_shutdown(mut self) {
10950        // Safety: drops once, never accessed again due to mem::forget
10951        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10952        // Prevent Drop from running (which would shut down the channel)
10953        std::mem::forget(self);
10954    }
10955}
10956
10957impl RingBufferGetPropertiesResponder {
10958    /// Sends a response to the FIDL transaction.
10959    ///
10960    /// Sets the channel to shutdown if an error occurs.
10961    pub fn send(self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
10962        let _result = self.send_raw(properties);
10963        if _result.is_err() {
10964            self.control_handle.shutdown();
10965        }
10966        self.drop_without_shutdown();
10967        _result
10968    }
10969
10970    /// Similar to "send" but does not shutdown the channel if an error occurs.
10971    pub fn send_no_shutdown_on_err(
10972        self,
10973        mut properties: &RingBufferProperties,
10974    ) -> Result<(), fidl::Error> {
10975        let _result = self.send_raw(properties);
10976        self.drop_without_shutdown();
10977        _result
10978    }
10979
10980    fn send_raw(&self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
10981        self.control_handle.inner.send::<RingBufferGetPropertiesResponse>(
10982            (properties,),
10983            self.tx_id,
10984            0x12947f061a8fe1,
10985            fidl::encoding::DynamicFlags::empty(),
10986        )
10987    }
10988}
10989
10990#[must_use = "FIDL methods require a response to be sent"]
10991#[derive(Debug)]
10992pub struct RingBufferWatchClockRecoveryPositionInfoResponder {
10993    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
10994    tx_id: u32,
10995}
10996
10997/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
10998/// if the responder is dropped without sending a response, so that the client
10999/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11000impl std::ops::Drop for RingBufferWatchClockRecoveryPositionInfoResponder {
11001    fn drop(&mut self) {
11002        self.control_handle.shutdown();
11003        // Safety: drops once, never accessed again
11004        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11005    }
11006}
11007
11008impl fidl::endpoints::Responder for RingBufferWatchClockRecoveryPositionInfoResponder {
11009    type ControlHandle = RingBufferControlHandle;
11010
11011    fn control_handle(&self) -> &RingBufferControlHandle {
11012        &self.control_handle
11013    }
11014
11015    fn drop_without_shutdown(mut self) {
11016        // Safety: drops once, never accessed again due to mem::forget
11017        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11018        // Prevent Drop from running (which would shut down the channel)
11019        std::mem::forget(self);
11020    }
11021}
11022
11023impl RingBufferWatchClockRecoveryPositionInfoResponder {
11024    /// Sends a response to the FIDL transaction.
11025    ///
11026    /// Sets the channel to shutdown if an error occurs.
11027    pub fn send(self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
11028        let _result = self.send_raw(position_info);
11029        if _result.is_err() {
11030            self.control_handle.shutdown();
11031        }
11032        self.drop_without_shutdown();
11033        _result
11034    }
11035
11036    /// Similar to "send" but does not shutdown the channel if an error occurs.
11037    pub fn send_no_shutdown_on_err(
11038        self,
11039        mut position_info: &RingBufferPositionInfo,
11040    ) -> Result<(), fidl::Error> {
11041        let _result = self.send_raw(position_info);
11042        self.drop_without_shutdown();
11043        _result
11044    }
11045
11046    fn send_raw(&self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
11047        self.control_handle.inner.send::<RingBufferWatchClockRecoveryPositionInfoResponse>(
11048            (position_info,),
11049            self.tx_id,
11050            0x694d5b898a4167e5,
11051            fidl::encoding::DynamicFlags::empty(),
11052        )
11053    }
11054}
11055
11056#[must_use = "FIDL methods require a response to be sent"]
11057#[derive(Debug)]
11058pub struct RingBufferGetVmoResponder {
11059    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11060    tx_id: u32,
11061}
11062
11063/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11064/// if the responder is dropped without sending a response, so that the client
11065/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11066impl std::ops::Drop for RingBufferGetVmoResponder {
11067    fn drop(&mut self) {
11068        self.control_handle.shutdown();
11069        // Safety: drops once, never accessed again
11070        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11071    }
11072}
11073
11074impl fidl::endpoints::Responder for RingBufferGetVmoResponder {
11075    type ControlHandle = RingBufferControlHandle;
11076
11077    fn control_handle(&self) -> &RingBufferControlHandle {
11078        &self.control_handle
11079    }
11080
11081    fn drop_without_shutdown(mut self) {
11082        // Safety: drops once, never accessed again due to mem::forget
11083        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11084        // Prevent Drop from running (which would shut down the channel)
11085        std::mem::forget(self);
11086    }
11087}
11088
11089impl RingBufferGetVmoResponder {
11090    /// Sends a response to the FIDL transaction.
11091    ///
11092    /// Sets the channel to shutdown if an error occurs.
11093    pub fn send(
11094        self,
11095        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11096    ) -> Result<(), fidl::Error> {
11097        let _result = self.send_raw(result);
11098        if _result.is_err() {
11099            self.control_handle.shutdown();
11100        }
11101        self.drop_without_shutdown();
11102        _result
11103    }
11104
11105    /// Similar to "send" but does not shutdown the channel if an error occurs.
11106    pub fn send_no_shutdown_on_err(
11107        self,
11108        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11109    ) -> Result<(), fidl::Error> {
11110        let _result = self.send_raw(result);
11111        self.drop_without_shutdown();
11112        _result
11113    }
11114
11115    fn send_raw(
11116        &self,
11117        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11118    ) -> Result<(), fidl::Error> {
11119        self.control_handle
11120            .inner
11121            .send::<fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>>(
11122                result,
11123                self.tx_id,
11124                0x44c8f4f5680e853a,
11125                fidl::encoding::DynamicFlags::empty(),
11126            )
11127    }
11128}
11129
11130#[must_use = "FIDL methods require a response to be sent"]
11131#[derive(Debug)]
11132pub struct RingBufferStartResponder {
11133    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11134    tx_id: u32,
11135}
11136
11137/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11138/// if the responder is dropped without sending a response, so that the client
11139/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11140impl std::ops::Drop for RingBufferStartResponder {
11141    fn drop(&mut self) {
11142        self.control_handle.shutdown();
11143        // Safety: drops once, never accessed again
11144        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11145    }
11146}
11147
11148impl fidl::endpoints::Responder for RingBufferStartResponder {
11149    type ControlHandle = RingBufferControlHandle;
11150
11151    fn control_handle(&self) -> &RingBufferControlHandle {
11152        &self.control_handle
11153    }
11154
11155    fn drop_without_shutdown(mut self) {
11156        // Safety: drops once, never accessed again due to mem::forget
11157        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11158        // Prevent Drop from running (which would shut down the channel)
11159        std::mem::forget(self);
11160    }
11161}
11162
11163impl RingBufferStartResponder {
11164    /// Sends a response to the FIDL transaction.
11165    ///
11166    /// Sets the channel to shutdown if an error occurs.
11167    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
11168        let _result = self.send_raw(start_time);
11169        if _result.is_err() {
11170            self.control_handle.shutdown();
11171        }
11172        self.drop_without_shutdown();
11173        _result
11174    }
11175
11176    /// Similar to "send" but does not shutdown the channel if an error occurs.
11177    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
11178        let _result = self.send_raw(start_time);
11179        self.drop_without_shutdown();
11180        _result
11181    }
11182
11183    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
11184        self.control_handle.inner.send::<RingBufferStartResponse>(
11185            (start_time,),
11186            self.tx_id,
11187            0x5dd780a769a8892d,
11188            fidl::encoding::DynamicFlags::empty(),
11189        )
11190    }
11191}
11192
11193#[must_use = "FIDL methods require a response to be sent"]
11194#[derive(Debug)]
11195pub struct RingBufferStopResponder {
11196    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11197    tx_id: u32,
11198}
11199
11200/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11201/// if the responder is dropped without sending a response, so that the client
11202/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11203impl std::ops::Drop for RingBufferStopResponder {
11204    fn drop(&mut self) {
11205        self.control_handle.shutdown();
11206        // Safety: drops once, never accessed again
11207        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11208    }
11209}
11210
11211impl fidl::endpoints::Responder for RingBufferStopResponder {
11212    type ControlHandle = RingBufferControlHandle;
11213
11214    fn control_handle(&self) -> &RingBufferControlHandle {
11215        &self.control_handle
11216    }
11217
11218    fn drop_without_shutdown(mut self) {
11219        // Safety: drops once, never accessed again due to mem::forget
11220        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11221        // Prevent Drop from running (which would shut down the channel)
11222        std::mem::forget(self);
11223    }
11224}
11225
11226impl RingBufferStopResponder {
11227    /// Sends a response to the FIDL transaction.
11228    ///
11229    /// Sets the channel to shutdown if an error occurs.
11230    pub fn send(self) -> Result<(), fidl::Error> {
11231        let _result = self.send_raw();
11232        if _result.is_err() {
11233            self.control_handle.shutdown();
11234        }
11235        self.drop_without_shutdown();
11236        _result
11237    }
11238
11239    /// Similar to "send" but does not shutdown the channel if an error occurs.
11240    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11241        let _result = self.send_raw();
11242        self.drop_without_shutdown();
11243        _result
11244    }
11245
11246    fn send_raw(&self) -> Result<(), fidl::Error> {
11247        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11248            (),
11249            self.tx_id,
11250            0x49a73d9cf1d4e110,
11251            fidl::encoding::DynamicFlags::empty(),
11252        )
11253    }
11254}
11255
11256#[must_use = "FIDL methods require a response to be sent"]
11257#[derive(Debug)]
11258pub struct RingBufferSetActiveChannelsResponder {
11259    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11260    tx_id: u32,
11261}
11262
11263/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11264/// if the responder is dropped without sending a response, so that the client
11265/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11266impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
11267    fn drop(&mut self) {
11268        self.control_handle.shutdown();
11269        // Safety: drops once, never accessed again
11270        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11271    }
11272}
11273
11274impl fidl::endpoints::Responder for RingBufferSetActiveChannelsResponder {
11275    type ControlHandle = RingBufferControlHandle;
11276
11277    fn control_handle(&self) -> &RingBufferControlHandle {
11278        &self.control_handle
11279    }
11280
11281    fn drop_without_shutdown(mut self) {
11282        // Safety: drops once, never accessed again due to mem::forget
11283        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11284        // Prevent Drop from running (which would shut down the channel)
11285        std::mem::forget(self);
11286    }
11287}
11288
11289impl RingBufferSetActiveChannelsResponder {
11290    /// Sends a response to the FIDL transaction.
11291    ///
11292    /// Sets the channel to shutdown if an error occurs.
11293    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11294        let _result = self.send_raw(result);
11295        if _result.is_err() {
11296            self.control_handle.shutdown();
11297        }
11298        self.drop_without_shutdown();
11299        _result
11300    }
11301
11302    /// Similar to "send" but does not shutdown the channel if an error occurs.
11303    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11304        let _result = self.send_raw(result);
11305        self.drop_without_shutdown();
11306        _result
11307    }
11308
11309    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11310        self.control_handle.inner.send::<fidl::encoding::ResultType<
11311            RingBufferSetActiveChannelsResponse,
11312            i32,
11313        >>(
11314            result.map(|set_time| (set_time,)),
11315            self.tx_id,
11316            0x605464c1d384f309,
11317            fidl::encoding::DynamicFlags::empty(),
11318        )
11319    }
11320}
11321
11322#[must_use = "FIDL methods require a response to be sent"]
11323#[derive(Debug)]
11324pub struct RingBufferWatchDelayInfoResponder {
11325    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11326    tx_id: u32,
11327}
11328
11329/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11330/// if the responder is dropped without sending a response, so that the client
11331/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11332impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
11333    fn drop(&mut self) {
11334        self.control_handle.shutdown();
11335        // Safety: drops once, never accessed again
11336        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11337    }
11338}
11339
11340impl fidl::endpoints::Responder for RingBufferWatchDelayInfoResponder {
11341    type ControlHandle = RingBufferControlHandle;
11342
11343    fn control_handle(&self) -> &RingBufferControlHandle {
11344        &self.control_handle
11345    }
11346
11347    fn drop_without_shutdown(mut self) {
11348        // Safety: drops once, never accessed again due to mem::forget
11349        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11350        // Prevent Drop from running (which would shut down the channel)
11351        std::mem::forget(self);
11352    }
11353}
11354
11355impl RingBufferWatchDelayInfoResponder {
11356    /// Sends a response to the FIDL transaction.
11357    ///
11358    /// Sets the channel to shutdown if an error occurs.
11359    pub fn send(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11360        let _result = self.send_raw(delay_info);
11361        if _result.is_err() {
11362            self.control_handle.shutdown();
11363        }
11364        self.drop_without_shutdown();
11365        _result
11366    }
11367
11368    /// Similar to "send" but does not shutdown the channel if an error occurs.
11369    pub fn send_no_shutdown_on_err(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11370        let _result = self.send_raw(delay_info);
11371        self.drop_without_shutdown();
11372        _result
11373    }
11374
11375    fn send_raw(&self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11376        self.control_handle
11377            .inner
11378            .send::<fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>>(
11379                fidl::encoding::Flexible::new((delay_info,)),
11380                self.tx_id,
11381                0x6c1248db213fcf9f,
11382                fidl::encoding::DynamicFlags::FLEXIBLE,
11383            )
11384    }
11385}
11386
11387#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11388pub struct StreamConfigMarker;
11389
11390impl fidl::endpoints::ProtocolMarker for StreamConfigMarker {
11391    type Proxy = StreamConfigProxy;
11392    type RequestStream = StreamConfigRequestStream;
11393    #[cfg(target_os = "fuchsia")]
11394    type SynchronousProxy = StreamConfigSynchronousProxy;
11395
11396    const DEBUG_NAME: &'static str = "(anonymous) StreamConfig";
11397}
11398
11399pub trait StreamConfigProxyInterface: Send + Sync {
11400    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
11401        + Send;
11402    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
11403    fn r#signal_processing_connect(
11404        &self,
11405        protocol: fidl::endpoints::ServerEnd<
11406            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11407        >,
11408    ) -> Result<(), fidl::Error>;
11409    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
11410        + Send;
11411    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
11412    type GetSupportedFormatsResponseFut: std::future::Future<Output = Result<Vec<SupportedFormats>, fidl::Error>>
11413        + Send;
11414    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut;
11415    fn r#create_ring_buffer(
11416        &self,
11417        format: &Format,
11418        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11419    ) -> Result<(), fidl::Error>;
11420    type WatchGainStateResponseFut: std::future::Future<Output = Result<GainState, fidl::Error>>
11421        + Send;
11422    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut;
11423    fn r#set_gain(&self, target_state: &GainState) -> Result<(), fidl::Error>;
11424    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
11425        + Send;
11426    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
11427}
11428#[derive(Debug)]
11429#[cfg(target_os = "fuchsia")]
11430pub struct StreamConfigSynchronousProxy {
11431    client: fidl::client::sync::Client,
11432}
11433
11434#[cfg(target_os = "fuchsia")]
11435impl fidl::endpoints::SynchronousProxy for StreamConfigSynchronousProxy {
11436    type Proxy = StreamConfigProxy;
11437    type Protocol = StreamConfigMarker;
11438
11439    fn from_channel(inner: fidl::Channel) -> Self {
11440        Self::new(inner)
11441    }
11442
11443    fn into_channel(self) -> fidl::Channel {
11444        self.client.into_channel()
11445    }
11446
11447    fn as_channel(&self) -> &fidl::Channel {
11448        self.client.as_channel()
11449    }
11450}
11451
11452#[cfg(target_os = "fuchsia")]
11453impl StreamConfigSynchronousProxy {
11454    pub fn new(channel: fidl::Channel) -> Self {
11455        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11456        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
11457    }
11458
11459    pub fn into_channel(self) -> fidl::Channel {
11460        self.client.into_channel()
11461    }
11462
11463    /// Waits until an event arrives and returns it. It is safe for other
11464    /// threads to make concurrent requests while waiting for an event.
11465    pub fn wait_for_event(
11466        &self,
11467        deadline: zx::MonotonicInstant,
11468    ) -> Result<StreamConfigEvent, fidl::Error> {
11469        StreamConfigEvent::decode(self.client.wait_for_event(deadline)?)
11470    }
11471
11472    /// Retrieves top level health state.
11473    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
11474    pub fn r#get_health_state(
11475        &self,
11476        ___deadline: zx::MonotonicInstant,
11477    ) -> Result<HealthState, fidl::Error> {
11478        let _response =
11479            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
11480                (),
11481                0x4e146d6bca733a84,
11482                fidl::encoding::DynamicFlags::empty(),
11483                ___deadline,
11484            )?;
11485        Ok(_response.state)
11486    }
11487
11488    /// Connect to a `SignalProcessing` protocol.
11489    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
11490    /// the maximum number of connections have already been created, for instance one, then the
11491    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
11492    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
11493    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
11494    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
11495    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
11496    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
11497    /// is intended to be composed, and hence the more verbose name allows differentiation and
11498    /// improved clarity.
11499    pub fn r#signal_processing_connect(
11500        &self,
11501        mut protocol: fidl::endpoints::ServerEnd<
11502            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11503        >,
11504    ) -> Result<(), fidl::Error> {
11505        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
11506            (protocol,),
11507            0xa81907ce6066295,
11508            fidl::encoding::DynamicFlags::empty(),
11509        )
11510    }
11511
11512    /// Retrieves top level static properties.
11513    pub fn r#get_properties(
11514        &self,
11515        ___deadline: zx::MonotonicInstant,
11516    ) -> Result<StreamProperties, fidl::Error> {
11517        let _response = self
11518            .client
11519            .send_query::<fidl::encoding::EmptyPayload, StreamConfigGetPropertiesResponse>(
11520                (),
11521                0x7d89c02f3e2d3c01,
11522                fidl::encoding::DynamicFlags::empty(),
11523                ___deadline,
11524            )?;
11525        Ok(_response.properties)
11526    }
11527
11528    /// Gets formats supported by a given driver. When not all combinations supported by the
11529    /// driver can be described with one `SupportedFormats`, the driver returns more than one
11530    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
11531    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
11532    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
11533    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
11534    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
11535    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
11536    /// <<16bits,32bits>,<48KHz,96KHz>>.
11537    pub fn r#get_supported_formats(
11538        &self,
11539        ___deadline: zx::MonotonicInstant,
11540    ) -> Result<Vec<SupportedFormats>, fidl::Error> {
11541        let _response = self
11542            .client
11543            .send_query::<fidl::encoding::EmptyPayload, StreamConfigGetSupportedFormatsResponse>(
11544                (),
11545                0x448efa7850cafe7e,
11546                fidl::encoding::DynamicFlags::empty(),
11547                ___deadline,
11548            )?;
11549        Ok(_response.supported_formats)
11550    }
11551
11552    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
11553    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
11554    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
11555    /// ring buffer channel had been established and was still active, the driver must close that
11556    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
11557    /// operations in the process.
11558    pub fn r#create_ring_buffer(
11559        &self,
11560        mut format: &Format,
11561        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11562    ) -> Result<(), fidl::Error> {
11563        self.client.send::<StreamConfigCreateRingBufferRequest>(
11564            (format, ring_buffer),
11565            0x2afb19dd13faa1ba,
11566            fidl::encoding::DynamicFlags::empty(),
11567        )
11568    }
11569
11570    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
11571    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
11572    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
11573    /// from what was most recently reported.
11574    /// If `WatchGainState` is called for a second time before the first call has completed, then
11575    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11576    pub fn r#watch_gain_state(
11577        &self,
11578        ___deadline: zx::MonotonicInstant,
11579    ) -> Result<GainState, fidl::Error> {
11580        let _response = self
11581            .client
11582            .send_query::<fidl::encoding::EmptyPayload, StreamConfigWatchGainStateResponse>(
11583                (),
11584                0x4772506136ab65c1,
11585                fidl::encoding::DynamicFlags::empty(),
11586                ___deadline,
11587            )?;
11588        Ok(_response.gain_state)
11589    }
11590
11591    /// Client update of the gain state.
11592    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
11593        self.client.send::<StreamConfigSetGainRequest>(
11594            (target_state,),
11595            0x3943b41498c6a384,
11596            fidl::encoding::DynamicFlags::empty(),
11597        )
11598    }
11599
11600    /// Get the plug detect state via a hanging get. The driver will reply to the first
11601    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
11602    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
11603    /// If `WatchPlugState` is called for a second time before the first call has completed, then
11604    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11605    pub fn r#watch_plug_state(
11606        &self,
11607        ___deadline: zx::MonotonicInstant,
11608    ) -> Result<PlugState, fidl::Error> {
11609        let _response = self
11610            .client
11611            .send_query::<fidl::encoding::EmptyPayload, StreamConfigWatchPlugStateResponse>(
11612                (),
11613                0x497345a6f048b2a6,
11614                fidl::encoding::DynamicFlags::empty(),
11615                ___deadline,
11616            )?;
11617        Ok(_response.plug_state)
11618    }
11619}
11620
11621#[cfg(target_os = "fuchsia")]
11622impl From<StreamConfigSynchronousProxy> for zx::NullableHandle {
11623    fn from(value: StreamConfigSynchronousProxy) -> Self {
11624        value.into_channel().into()
11625    }
11626}
11627
11628#[cfg(target_os = "fuchsia")]
11629impl From<fidl::Channel> for StreamConfigSynchronousProxy {
11630    fn from(value: fidl::Channel) -> Self {
11631        Self::new(value)
11632    }
11633}
11634
11635#[cfg(target_os = "fuchsia")]
11636impl fidl::endpoints::FromClient for StreamConfigSynchronousProxy {
11637    type Protocol = StreamConfigMarker;
11638
11639    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigMarker>) -> Self {
11640        Self::new(value.into_channel())
11641    }
11642}
11643
11644#[derive(Debug, Clone)]
11645pub struct StreamConfigProxy {
11646    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11647}
11648
11649impl fidl::endpoints::Proxy for StreamConfigProxy {
11650    type Protocol = StreamConfigMarker;
11651
11652    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11653        Self::new(inner)
11654    }
11655
11656    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11657        self.client.into_channel().map_err(|client| Self { client })
11658    }
11659
11660    fn as_channel(&self) -> &::fidl::AsyncChannel {
11661        self.client.as_channel()
11662    }
11663}
11664
11665impl StreamConfigProxy {
11666    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfig.
11667    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11668        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11669        Self { client: fidl::client::Client::new(channel, protocol_name) }
11670    }
11671
11672    /// Get a Stream of events from the remote end of the protocol.
11673    ///
11674    /// # Panics
11675    ///
11676    /// Panics if the event stream was already taken.
11677    pub fn take_event_stream(&self) -> StreamConfigEventStream {
11678        StreamConfigEventStream { event_receiver: self.client.take_event_receiver() }
11679    }
11680
11681    /// Retrieves top level health state.
11682    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
11683    pub fn r#get_health_state(
11684        &self,
11685    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
11686    {
11687        StreamConfigProxyInterface::r#get_health_state(self)
11688    }
11689
11690    /// Connect to a `SignalProcessing` protocol.
11691    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
11692    /// the maximum number of connections have already been created, for instance one, then the
11693    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
11694    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
11695    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
11696    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
11697    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
11698    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
11699    /// is intended to be composed, and hence the more verbose name allows differentiation and
11700    /// improved clarity.
11701    pub fn r#signal_processing_connect(
11702        &self,
11703        mut protocol: fidl::endpoints::ServerEnd<
11704            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11705        >,
11706    ) -> Result<(), fidl::Error> {
11707        StreamConfigProxyInterface::r#signal_processing_connect(self, protocol)
11708    }
11709
11710    /// Retrieves top level static properties.
11711    pub fn r#get_properties(
11712        &self,
11713    ) -> fidl::client::QueryResponseFut<
11714        StreamProperties,
11715        fidl::encoding::DefaultFuchsiaResourceDialect,
11716    > {
11717        StreamConfigProxyInterface::r#get_properties(self)
11718    }
11719
11720    /// Gets formats supported by a given driver. When not all combinations supported by the
11721    /// driver can be described with one `SupportedFormats`, the driver returns more than one
11722    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
11723    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
11724    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
11725    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
11726    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
11727    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
11728    /// <<16bits,32bits>,<48KHz,96KHz>>.
11729    pub fn r#get_supported_formats(
11730        &self,
11731    ) -> fidl::client::QueryResponseFut<
11732        Vec<SupportedFormats>,
11733        fidl::encoding::DefaultFuchsiaResourceDialect,
11734    > {
11735        StreamConfigProxyInterface::r#get_supported_formats(self)
11736    }
11737
11738    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
11739    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
11740    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
11741    /// ring buffer channel had been established and was still active, the driver must close that
11742    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
11743    /// operations in the process.
11744    pub fn r#create_ring_buffer(
11745        &self,
11746        mut format: &Format,
11747        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11748    ) -> Result<(), fidl::Error> {
11749        StreamConfigProxyInterface::r#create_ring_buffer(self, format, ring_buffer)
11750    }
11751
11752    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
11753    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
11754    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
11755    /// from what was most recently reported.
11756    /// If `WatchGainState` is called for a second time before the first call has completed, then
11757    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11758    pub fn r#watch_gain_state(
11759        &self,
11760    ) -> fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>
11761    {
11762        StreamConfigProxyInterface::r#watch_gain_state(self)
11763    }
11764
11765    /// Client update of the gain state.
11766    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
11767        StreamConfigProxyInterface::r#set_gain(self, target_state)
11768    }
11769
11770    /// Get the plug detect state via a hanging get. The driver will reply to the first
11771    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
11772    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
11773    /// If `WatchPlugState` is called for a second time before the first call has completed, then
11774    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11775    pub fn r#watch_plug_state(
11776        &self,
11777    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
11778    {
11779        StreamConfigProxyInterface::r#watch_plug_state(self)
11780    }
11781}
11782
11783impl StreamConfigProxyInterface for StreamConfigProxy {
11784    type GetHealthStateResponseFut =
11785        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
11786    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
11787        fn _decode(
11788            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11789        ) -> Result<HealthState, fidl::Error> {
11790            let _response = fidl::client::decode_transaction_body::<
11791                HealthGetHealthStateResponse,
11792                fidl::encoding::DefaultFuchsiaResourceDialect,
11793                0x4e146d6bca733a84,
11794            >(_buf?)?;
11795            Ok(_response.state)
11796        }
11797        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
11798            (),
11799            0x4e146d6bca733a84,
11800            fidl::encoding::DynamicFlags::empty(),
11801            _decode,
11802        )
11803    }
11804
11805    fn r#signal_processing_connect(
11806        &self,
11807        mut protocol: fidl::endpoints::ServerEnd<
11808            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11809        >,
11810    ) -> Result<(), fidl::Error> {
11811        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
11812            (protocol,),
11813            0xa81907ce6066295,
11814            fidl::encoding::DynamicFlags::empty(),
11815        )
11816    }
11817
11818    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
11819        StreamProperties,
11820        fidl::encoding::DefaultFuchsiaResourceDialect,
11821    >;
11822    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
11823        fn _decode(
11824            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11825        ) -> Result<StreamProperties, fidl::Error> {
11826            let _response = fidl::client::decode_transaction_body::<
11827                StreamConfigGetPropertiesResponse,
11828                fidl::encoding::DefaultFuchsiaResourceDialect,
11829                0x7d89c02f3e2d3c01,
11830            >(_buf?)?;
11831            Ok(_response.properties)
11832        }
11833        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
11834            (),
11835            0x7d89c02f3e2d3c01,
11836            fidl::encoding::DynamicFlags::empty(),
11837            _decode,
11838        )
11839    }
11840
11841    type GetSupportedFormatsResponseFut = fidl::client::QueryResponseFut<
11842        Vec<SupportedFormats>,
11843        fidl::encoding::DefaultFuchsiaResourceDialect,
11844    >;
11845    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut {
11846        fn _decode(
11847            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11848        ) -> Result<Vec<SupportedFormats>, fidl::Error> {
11849            let _response = fidl::client::decode_transaction_body::<
11850                StreamConfigGetSupportedFormatsResponse,
11851                fidl::encoding::DefaultFuchsiaResourceDialect,
11852                0x448efa7850cafe7e,
11853            >(_buf?)?;
11854            Ok(_response.supported_formats)
11855        }
11856        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<SupportedFormats>>(
11857            (),
11858            0x448efa7850cafe7e,
11859            fidl::encoding::DynamicFlags::empty(),
11860            _decode,
11861        )
11862    }
11863
11864    fn r#create_ring_buffer(
11865        &self,
11866        mut format: &Format,
11867        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11868    ) -> Result<(), fidl::Error> {
11869        self.client.send::<StreamConfigCreateRingBufferRequest>(
11870            (format, ring_buffer),
11871            0x2afb19dd13faa1ba,
11872            fidl::encoding::DynamicFlags::empty(),
11873        )
11874    }
11875
11876    type WatchGainStateResponseFut =
11877        fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>;
11878    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut {
11879        fn _decode(
11880            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11881        ) -> Result<GainState, fidl::Error> {
11882            let _response = fidl::client::decode_transaction_body::<
11883                StreamConfigWatchGainStateResponse,
11884                fidl::encoding::DefaultFuchsiaResourceDialect,
11885                0x4772506136ab65c1,
11886            >(_buf?)?;
11887            Ok(_response.gain_state)
11888        }
11889        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GainState>(
11890            (),
11891            0x4772506136ab65c1,
11892            fidl::encoding::DynamicFlags::empty(),
11893            _decode,
11894        )
11895    }
11896
11897    fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
11898        self.client.send::<StreamConfigSetGainRequest>(
11899            (target_state,),
11900            0x3943b41498c6a384,
11901            fidl::encoding::DynamicFlags::empty(),
11902        )
11903    }
11904
11905    type WatchPlugStateResponseFut =
11906        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
11907    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
11908        fn _decode(
11909            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11910        ) -> Result<PlugState, fidl::Error> {
11911            let _response = fidl::client::decode_transaction_body::<
11912                StreamConfigWatchPlugStateResponse,
11913                fidl::encoding::DefaultFuchsiaResourceDialect,
11914                0x497345a6f048b2a6,
11915            >(_buf?)?;
11916            Ok(_response.plug_state)
11917        }
11918        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
11919            (),
11920            0x497345a6f048b2a6,
11921            fidl::encoding::DynamicFlags::empty(),
11922            _decode,
11923        )
11924    }
11925}
11926
11927pub struct StreamConfigEventStream {
11928    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11929}
11930
11931impl std::marker::Unpin for StreamConfigEventStream {}
11932
11933impl futures::stream::FusedStream for StreamConfigEventStream {
11934    fn is_terminated(&self) -> bool {
11935        self.event_receiver.is_terminated()
11936    }
11937}
11938
11939impl futures::Stream for StreamConfigEventStream {
11940    type Item = Result<StreamConfigEvent, fidl::Error>;
11941
11942    fn poll_next(
11943        mut self: std::pin::Pin<&mut Self>,
11944        cx: &mut std::task::Context<'_>,
11945    ) -> std::task::Poll<Option<Self::Item>> {
11946        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11947            &mut self.event_receiver,
11948            cx
11949        )?) {
11950            Some(buf) => std::task::Poll::Ready(Some(StreamConfigEvent::decode(buf))),
11951            None => std::task::Poll::Ready(None),
11952        }
11953    }
11954}
11955
11956#[derive(Debug)]
11957pub enum StreamConfigEvent {}
11958
11959impl StreamConfigEvent {
11960    /// Decodes a message buffer as a [`StreamConfigEvent`].
11961    fn decode(
11962        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11963    ) -> Result<StreamConfigEvent, fidl::Error> {
11964        let (bytes, _handles) = buf.split_mut();
11965        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11966        debug_assert_eq!(tx_header.tx_id, 0);
11967        match tx_header.ordinal {
11968            _ => Err(fidl::Error::UnknownOrdinal {
11969                ordinal: tx_header.ordinal,
11970                protocol_name: <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11971            }),
11972        }
11973    }
11974}
11975
11976/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfig.
11977pub struct StreamConfigRequestStream {
11978    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11979    is_terminated: bool,
11980}
11981
11982impl std::marker::Unpin for StreamConfigRequestStream {}
11983
11984impl futures::stream::FusedStream for StreamConfigRequestStream {
11985    fn is_terminated(&self) -> bool {
11986        self.is_terminated
11987    }
11988}
11989
11990impl fidl::endpoints::RequestStream for StreamConfigRequestStream {
11991    type Protocol = StreamConfigMarker;
11992    type ControlHandle = StreamConfigControlHandle;
11993
11994    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11995        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11996    }
11997
11998    fn control_handle(&self) -> Self::ControlHandle {
11999        StreamConfigControlHandle { inner: self.inner.clone() }
12000    }
12001
12002    fn into_inner(
12003        self,
12004    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12005    {
12006        (self.inner, self.is_terminated)
12007    }
12008
12009    fn from_inner(
12010        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12011        is_terminated: bool,
12012    ) -> Self {
12013        Self { inner, is_terminated }
12014    }
12015}
12016
12017impl futures::Stream for StreamConfigRequestStream {
12018    type Item = Result<StreamConfigRequest, fidl::Error>;
12019
12020    fn poll_next(
12021        mut self: std::pin::Pin<&mut Self>,
12022        cx: &mut std::task::Context<'_>,
12023    ) -> std::task::Poll<Option<Self::Item>> {
12024        let this = &mut *self;
12025        if this.inner.check_shutdown(cx) {
12026            this.is_terminated = true;
12027            return std::task::Poll::Ready(None);
12028        }
12029        if this.is_terminated {
12030            panic!("polled StreamConfigRequestStream after completion");
12031        }
12032        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12033            |bytes, handles| {
12034                match this.inner.channel().read_etc(cx, bytes, handles) {
12035                    std::task::Poll::Ready(Ok(())) => {}
12036                    std::task::Poll::Pending => return std::task::Poll::Pending,
12037                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12038                        this.is_terminated = true;
12039                        return std::task::Poll::Ready(None);
12040                    }
12041                    std::task::Poll::Ready(Err(e)) => {
12042                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12043                            e.into(),
12044                        ))));
12045                    }
12046                }
12047
12048                // A message has been received from the channel
12049                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12050
12051                std::task::Poll::Ready(Some(match header.ordinal {
12052                    0x4e146d6bca733a84 => {
12053                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12054                        let mut req = fidl::new_empty!(
12055                            fidl::encoding::EmptyPayload,
12056                            fidl::encoding::DefaultFuchsiaResourceDialect
12057                        );
12058                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12059                        let control_handle =
12060                            StreamConfigControlHandle { inner: this.inner.clone() };
12061                        Ok(StreamConfigRequest::GetHealthState {
12062                            responder: StreamConfigGetHealthStateResponder {
12063                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12064                                tx_id: header.tx_id,
12065                            },
12066                        })
12067                    }
12068                    0xa81907ce6066295 => {
12069                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12070                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12071                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
12072                        let control_handle =
12073                            StreamConfigControlHandle { inner: this.inner.clone() };
12074                        Ok(StreamConfigRequest::SignalProcessingConnect {
12075                            protocol: req.protocol,
12076
12077                            control_handle,
12078                        })
12079                    }
12080                    0x7d89c02f3e2d3c01 => {
12081                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12082                        let mut req = fidl::new_empty!(
12083                            fidl::encoding::EmptyPayload,
12084                            fidl::encoding::DefaultFuchsiaResourceDialect
12085                        );
12086                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12087                        let control_handle =
12088                            StreamConfigControlHandle { inner: this.inner.clone() };
12089                        Ok(StreamConfigRequest::GetProperties {
12090                            responder: StreamConfigGetPropertiesResponder {
12091                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12092                                tx_id: header.tx_id,
12093                            },
12094                        })
12095                    }
12096                    0x448efa7850cafe7e => {
12097                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12098                        let mut req = fidl::new_empty!(
12099                            fidl::encoding::EmptyPayload,
12100                            fidl::encoding::DefaultFuchsiaResourceDialect
12101                        );
12102                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12103                        let control_handle =
12104                            StreamConfigControlHandle { inner: this.inner.clone() };
12105                        Ok(StreamConfigRequest::GetSupportedFormats {
12106                            responder: StreamConfigGetSupportedFormatsResponder {
12107                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12108                                tx_id: header.tx_id,
12109                            },
12110                        })
12111                    }
12112                    0x2afb19dd13faa1ba => {
12113                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12114                        let mut req = fidl::new_empty!(
12115                            StreamConfigCreateRingBufferRequest,
12116                            fidl::encoding::DefaultFuchsiaResourceDialect
12117                        );
12118                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
12119                        let control_handle =
12120                            StreamConfigControlHandle { inner: this.inner.clone() };
12121                        Ok(StreamConfigRequest::CreateRingBuffer {
12122                            format: req.format,
12123                            ring_buffer: req.ring_buffer,
12124
12125                            control_handle,
12126                        })
12127                    }
12128                    0x4772506136ab65c1 => {
12129                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12130                        let mut req = fidl::new_empty!(
12131                            fidl::encoding::EmptyPayload,
12132                            fidl::encoding::DefaultFuchsiaResourceDialect
12133                        );
12134                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12135                        let control_handle =
12136                            StreamConfigControlHandle { inner: this.inner.clone() };
12137                        Ok(StreamConfigRequest::WatchGainState {
12138                            responder: StreamConfigWatchGainStateResponder {
12139                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12140                                tx_id: header.tx_id,
12141                            },
12142                        })
12143                    }
12144                    0x3943b41498c6a384 => {
12145                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12146                        let mut req = fidl::new_empty!(
12147                            StreamConfigSetGainRequest,
12148                            fidl::encoding::DefaultFuchsiaResourceDialect
12149                        );
12150                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
12151                        let control_handle =
12152                            StreamConfigControlHandle { inner: this.inner.clone() };
12153                        Ok(StreamConfigRequest::SetGain {
12154                            target_state: req.target_state,
12155
12156                            control_handle,
12157                        })
12158                    }
12159                    0x497345a6f048b2a6 => {
12160                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12161                        let mut req = fidl::new_empty!(
12162                            fidl::encoding::EmptyPayload,
12163                            fidl::encoding::DefaultFuchsiaResourceDialect
12164                        );
12165                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12166                        let control_handle =
12167                            StreamConfigControlHandle { inner: this.inner.clone() };
12168                        Ok(StreamConfigRequest::WatchPlugState {
12169                            responder: StreamConfigWatchPlugStateResponder {
12170                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12171                                tx_id: header.tx_id,
12172                            },
12173                        })
12174                    }
12175                    _ => Err(fidl::Error::UnknownOrdinal {
12176                        ordinal: header.ordinal,
12177                        protocol_name:
12178                            <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12179                    }),
12180                }))
12181            },
12182        )
12183    }
12184}
12185
12186/// For an overview see
12187/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming)
12188/// # Deprecation
12189///
12190/// Not supported anymore, instead use an
12191/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
12192/// with one Ring Buffer, see
12193/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
12194#[derive(Debug)]
12195pub enum StreamConfigRequest {
12196    /// Retrieves top level health state.
12197    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
12198    GetHealthState { responder: StreamConfigGetHealthStateResponder },
12199    /// Connect to a `SignalProcessing` protocol.
12200    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
12201    /// the maximum number of connections have already been created, for instance one, then the
12202    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
12203    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
12204    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
12205    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
12206    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
12207    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
12208    /// is intended to be composed, and hence the more verbose name allows differentiation and
12209    /// improved clarity.
12210    SignalProcessingConnect {
12211        protocol: fidl::endpoints::ServerEnd<
12212            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
12213        >,
12214        control_handle: StreamConfigControlHandle,
12215    },
12216    /// Retrieves top level static properties.
12217    GetProperties { responder: StreamConfigGetPropertiesResponder },
12218    /// Gets formats supported by a given driver. When not all combinations supported by the
12219    /// driver can be described with one `SupportedFormats`, the driver returns more than one
12220    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
12221    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
12222    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
12223    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
12224    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
12225    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
12226    /// <<16bits,32bits>,<48KHz,96KHz>>.
12227    GetSupportedFormats { responder: StreamConfigGetSupportedFormatsResponder },
12228    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
12229    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
12230    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
12231    /// ring buffer channel had been established and was still active, the driver must close that
12232    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
12233    /// operations in the process.
12234    CreateRingBuffer {
12235        format: Format,
12236        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
12237        control_handle: StreamConfigControlHandle,
12238    },
12239    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
12240    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
12241    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
12242    /// from what was most recently reported.
12243    /// If `WatchGainState` is called for a second time before the first call has completed, then
12244    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
12245    WatchGainState { responder: StreamConfigWatchGainStateResponder },
12246    /// Client update of the gain state.
12247    SetGain { target_state: GainState, control_handle: StreamConfigControlHandle },
12248    /// Get the plug detect state via a hanging get. The driver will reply to the first
12249    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
12250    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
12251    /// If `WatchPlugState` is called for a second time before the first call has completed, then
12252    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
12253    WatchPlugState { responder: StreamConfigWatchPlugStateResponder },
12254}
12255
12256impl StreamConfigRequest {
12257    #[allow(irrefutable_let_patterns)]
12258    pub fn into_get_health_state(self) -> Option<(StreamConfigGetHealthStateResponder)> {
12259        if let StreamConfigRequest::GetHealthState { responder } = self {
12260            Some((responder))
12261        } else {
12262            None
12263        }
12264    }
12265
12266    #[allow(irrefutable_let_patterns)]
12267    pub fn into_signal_processing_connect(
12268        self,
12269    ) -> Option<(
12270        fidl::endpoints::ServerEnd<
12271            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
12272        >,
12273        StreamConfigControlHandle,
12274    )> {
12275        if let StreamConfigRequest::SignalProcessingConnect { protocol, control_handle } = self {
12276            Some((protocol, control_handle))
12277        } else {
12278            None
12279        }
12280    }
12281
12282    #[allow(irrefutable_let_patterns)]
12283    pub fn into_get_properties(self) -> Option<(StreamConfigGetPropertiesResponder)> {
12284        if let StreamConfigRequest::GetProperties { responder } = self {
12285            Some((responder))
12286        } else {
12287            None
12288        }
12289    }
12290
12291    #[allow(irrefutable_let_patterns)]
12292    pub fn into_get_supported_formats(self) -> Option<(StreamConfigGetSupportedFormatsResponder)> {
12293        if let StreamConfigRequest::GetSupportedFormats { responder } = self {
12294            Some((responder))
12295        } else {
12296            None
12297        }
12298    }
12299
12300    #[allow(irrefutable_let_patterns)]
12301    pub fn into_create_ring_buffer(
12302        self,
12303    ) -> Option<(Format, fidl::endpoints::ServerEnd<RingBufferMarker>, StreamConfigControlHandle)>
12304    {
12305        if let StreamConfigRequest::CreateRingBuffer { format, ring_buffer, control_handle } = self
12306        {
12307            Some((format, ring_buffer, control_handle))
12308        } else {
12309            None
12310        }
12311    }
12312
12313    #[allow(irrefutable_let_patterns)]
12314    pub fn into_watch_gain_state(self) -> Option<(StreamConfigWatchGainStateResponder)> {
12315        if let StreamConfigRequest::WatchGainState { responder } = self {
12316            Some((responder))
12317        } else {
12318            None
12319        }
12320    }
12321
12322    #[allow(irrefutable_let_patterns)]
12323    pub fn into_set_gain(self) -> Option<(GainState, StreamConfigControlHandle)> {
12324        if let StreamConfigRequest::SetGain { target_state, control_handle } = self {
12325            Some((target_state, control_handle))
12326        } else {
12327            None
12328        }
12329    }
12330
12331    #[allow(irrefutable_let_patterns)]
12332    pub fn into_watch_plug_state(self) -> Option<(StreamConfigWatchPlugStateResponder)> {
12333        if let StreamConfigRequest::WatchPlugState { responder } = self {
12334            Some((responder))
12335        } else {
12336            None
12337        }
12338    }
12339
12340    /// Name of the method defined in FIDL
12341    pub fn method_name(&self) -> &'static str {
12342        match *self {
12343            StreamConfigRequest::GetHealthState { .. } => "get_health_state",
12344            StreamConfigRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
12345            StreamConfigRequest::GetProperties { .. } => "get_properties",
12346            StreamConfigRequest::GetSupportedFormats { .. } => "get_supported_formats",
12347            StreamConfigRequest::CreateRingBuffer { .. } => "create_ring_buffer",
12348            StreamConfigRequest::WatchGainState { .. } => "watch_gain_state",
12349            StreamConfigRequest::SetGain { .. } => "set_gain",
12350            StreamConfigRequest::WatchPlugState { .. } => "watch_plug_state",
12351        }
12352    }
12353}
12354
12355#[derive(Debug, Clone)]
12356pub struct StreamConfigControlHandle {
12357    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12358}
12359
12360impl fidl::endpoints::ControlHandle for StreamConfigControlHandle {
12361    fn shutdown(&self) {
12362        self.inner.shutdown()
12363    }
12364
12365    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
12366        self.inner.shutdown_with_epitaph(status)
12367    }
12368
12369    fn is_closed(&self) -> bool {
12370        self.inner.channel().is_closed()
12371    }
12372    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12373        self.inner.channel().on_closed()
12374    }
12375
12376    #[cfg(target_os = "fuchsia")]
12377    fn signal_peer(
12378        &self,
12379        clear_mask: zx::Signals,
12380        set_mask: zx::Signals,
12381    ) -> Result<(), zx_status::Status> {
12382        use fidl::Peered;
12383        self.inner.channel().signal_peer(clear_mask, set_mask)
12384    }
12385}
12386
12387impl StreamConfigControlHandle {}
12388
12389#[must_use = "FIDL methods require a response to be sent"]
12390#[derive(Debug)]
12391pub struct StreamConfigGetHealthStateResponder {
12392    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12393    tx_id: u32,
12394}
12395
12396/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12397/// if the responder is dropped without sending a response, so that the client
12398/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12399impl std::ops::Drop for StreamConfigGetHealthStateResponder {
12400    fn drop(&mut self) {
12401        self.control_handle.shutdown();
12402        // Safety: drops once, never accessed again
12403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12404    }
12405}
12406
12407impl fidl::endpoints::Responder for StreamConfigGetHealthStateResponder {
12408    type ControlHandle = StreamConfigControlHandle;
12409
12410    fn control_handle(&self) -> &StreamConfigControlHandle {
12411        &self.control_handle
12412    }
12413
12414    fn drop_without_shutdown(mut self) {
12415        // Safety: drops once, never accessed again due to mem::forget
12416        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12417        // Prevent Drop from running (which would shut down the channel)
12418        std::mem::forget(self);
12419    }
12420}
12421
12422impl StreamConfigGetHealthStateResponder {
12423    /// Sends a response to the FIDL transaction.
12424    ///
12425    /// Sets the channel to shutdown if an error occurs.
12426    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
12427        let _result = self.send_raw(state);
12428        if _result.is_err() {
12429            self.control_handle.shutdown();
12430        }
12431        self.drop_without_shutdown();
12432        _result
12433    }
12434
12435    /// Similar to "send" but does not shutdown the channel if an error occurs.
12436    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
12437        let _result = self.send_raw(state);
12438        self.drop_without_shutdown();
12439        _result
12440    }
12441
12442    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
12443        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
12444            (state,),
12445            self.tx_id,
12446            0x4e146d6bca733a84,
12447            fidl::encoding::DynamicFlags::empty(),
12448        )
12449    }
12450}
12451
12452#[must_use = "FIDL methods require a response to be sent"]
12453#[derive(Debug)]
12454pub struct StreamConfigGetPropertiesResponder {
12455    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12456    tx_id: u32,
12457}
12458
12459/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12460/// if the responder is dropped without sending a response, so that the client
12461/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12462impl std::ops::Drop for StreamConfigGetPropertiesResponder {
12463    fn drop(&mut self) {
12464        self.control_handle.shutdown();
12465        // Safety: drops once, never accessed again
12466        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12467    }
12468}
12469
12470impl fidl::endpoints::Responder for StreamConfigGetPropertiesResponder {
12471    type ControlHandle = StreamConfigControlHandle;
12472
12473    fn control_handle(&self) -> &StreamConfigControlHandle {
12474        &self.control_handle
12475    }
12476
12477    fn drop_without_shutdown(mut self) {
12478        // Safety: drops once, never accessed again due to mem::forget
12479        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12480        // Prevent Drop from running (which would shut down the channel)
12481        std::mem::forget(self);
12482    }
12483}
12484
12485impl StreamConfigGetPropertiesResponder {
12486    /// Sends a response to the FIDL transaction.
12487    ///
12488    /// Sets the channel to shutdown if an error occurs.
12489    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
12490        let _result = self.send_raw(properties);
12491        if _result.is_err() {
12492            self.control_handle.shutdown();
12493        }
12494        self.drop_without_shutdown();
12495        _result
12496    }
12497
12498    /// Similar to "send" but does not shutdown the channel if an error occurs.
12499    pub fn send_no_shutdown_on_err(
12500        self,
12501        mut properties: &StreamProperties,
12502    ) -> Result<(), fidl::Error> {
12503        let _result = self.send_raw(properties);
12504        self.drop_without_shutdown();
12505        _result
12506    }
12507
12508    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
12509        self.control_handle.inner.send::<StreamConfigGetPropertiesResponse>(
12510            (properties,),
12511            self.tx_id,
12512            0x7d89c02f3e2d3c01,
12513            fidl::encoding::DynamicFlags::empty(),
12514        )
12515    }
12516}
12517
12518#[must_use = "FIDL methods require a response to be sent"]
12519#[derive(Debug)]
12520pub struct StreamConfigGetSupportedFormatsResponder {
12521    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12522    tx_id: u32,
12523}
12524
12525/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12526/// if the responder is dropped without sending a response, so that the client
12527/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12528impl std::ops::Drop for StreamConfigGetSupportedFormatsResponder {
12529    fn drop(&mut self) {
12530        self.control_handle.shutdown();
12531        // Safety: drops once, never accessed again
12532        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12533    }
12534}
12535
12536impl fidl::endpoints::Responder for StreamConfigGetSupportedFormatsResponder {
12537    type ControlHandle = StreamConfigControlHandle;
12538
12539    fn control_handle(&self) -> &StreamConfigControlHandle {
12540        &self.control_handle
12541    }
12542
12543    fn drop_without_shutdown(mut self) {
12544        // Safety: drops once, never accessed again due to mem::forget
12545        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12546        // Prevent Drop from running (which would shut down the channel)
12547        std::mem::forget(self);
12548    }
12549}
12550
12551impl StreamConfigGetSupportedFormatsResponder {
12552    /// Sends a response to the FIDL transaction.
12553    ///
12554    /// Sets the channel to shutdown if an error occurs.
12555    pub fn send(self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
12556        let _result = self.send_raw(supported_formats);
12557        if _result.is_err() {
12558            self.control_handle.shutdown();
12559        }
12560        self.drop_without_shutdown();
12561        _result
12562    }
12563
12564    /// Similar to "send" but does not shutdown the channel if an error occurs.
12565    pub fn send_no_shutdown_on_err(
12566        self,
12567        mut supported_formats: &[SupportedFormats],
12568    ) -> Result<(), fidl::Error> {
12569        let _result = self.send_raw(supported_formats);
12570        self.drop_without_shutdown();
12571        _result
12572    }
12573
12574    fn send_raw(&self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
12575        self.control_handle.inner.send::<StreamConfigGetSupportedFormatsResponse>(
12576            (supported_formats,),
12577            self.tx_id,
12578            0x448efa7850cafe7e,
12579            fidl::encoding::DynamicFlags::empty(),
12580        )
12581    }
12582}
12583
12584#[must_use = "FIDL methods require a response to be sent"]
12585#[derive(Debug)]
12586pub struct StreamConfigWatchGainStateResponder {
12587    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12588    tx_id: u32,
12589}
12590
12591/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12592/// if the responder is dropped without sending a response, so that the client
12593/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12594impl std::ops::Drop for StreamConfigWatchGainStateResponder {
12595    fn drop(&mut self) {
12596        self.control_handle.shutdown();
12597        // Safety: drops once, never accessed again
12598        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12599    }
12600}
12601
12602impl fidl::endpoints::Responder for StreamConfigWatchGainStateResponder {
12603    type ControlHandle = StreamConfigControlHandle;
12604
12605    fn control_handle(&self) -> &StreamConfigControlHandle {
12606        &self.control_handle
12607    }
12608
12609    fn drop_without_shutdown(mut self) {
12610        // Safety: drops once, never accessed again due to mem::forget
12611        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12612        // Prevent Drop from running (which would shut down the channel)
12613        std::mem::forget(self);
12614    }
12615}
12616
12617impl StreamConfigWatchGainStateResponder {
12618    /// Sends a response to the FIDL transaction.
12619    ///
12620    /// Sets the channel to shutdown if an error occurs.
12621    pub fn send(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12622        let _result = self.send_raw(gain_state);
12623        if _result.is_err() {
12624            self.control_handle.shutdown();
12625        }
12626        self.drop_without_shutdown();
12627        _result
12628    }
12629
12630    /// Similar to "send" but does not shutdown the channel if an error occurs.
12631    pub fn send_no_shutdown_on_err(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12632        let _result = self.send_raw(gain_state);
12633        self.drop_without_shutdown();
12634        _result
12635    }
12636
12637    fn send_raw(&self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12638        self.control_handle.inner.send::<StreamConfigWatchGainStateResponse>(
12639            (gain_state,),
12640            self.tx_id,
12641            0x4772506136ab65c1,
12642            fidl::encoding::DynamicFlags::empty(),
12643        )
12644    }
12645}
12646
12647#[must_use = "FIDL methods require a response to be sent"]
12648#[derive(Debug)]
12649pub struct StreamConfigWatchPlugStateResponder {
12650    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12651    tx_id: u32,
12652}
12653
12654/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12655/// if the responder is dropped without sending a response, so that the client
12656/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12657impl std::ops::Drop for StreamConfigWatchPlugStateResponder {
12658    fn drop(&mut self) {
12659        self.control_handle.shutdown();
12660        // Safety: drops once, never accessed again
12661        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12662    }
12663}
12664
12665impl fidl::endpoints::Responder for StreamConfigWatchPlugStateResponder {
12666    type ControlHandle = StreamConfigControlHandle;
12667
12668    fn control_handle(&self) -> &StreamConfigControlHandle {
12669        &self.control_handle
12670    }
12671
12672    fn drop_without_shutdown(mut self) {
12673        // Safety: drops once, never accessed again due to mem::forget
12674        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12675        // Prevent Drop from running (which would shut down the channel)
12676        std::mem::forget(self);
12677    }
12678}
12679
12680impl StreamConfigWatchPlugStateResponder {
12681    /// Sends a response to the FIDL transaction.
12682    ///
12683    /// Sets the channel to shutdown if an error occurs.
12684    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12685        let _result = self.send_raw(plug_state);
12686        if _result.is_err() {
12687            self.control_handle.shutdown();
12688        }
12689        self.drop_without_shutdown();
12690        _result
12691    }
12692
12693    /// Similar to "send" but does not shutdown the channel if an error occurs.
12694    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12695        let _result = self.send_raw(plug_state);
12696        self.drop_without_shutdown();
12697        _result
12698    }
12699
12700    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12701        self.control_handle.inner.send::<StreamConfigWatchPlugStateResponse>(
12702            (plug_state,),
12703            self.tx_id,
12704            0x497345a6f048b2a6,
12705            fidl::encoding::DynamicFlags::empty(),
12706        )
12707    }
12708}
12709
12710#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
12711pub struct StreamConfigConnectorMarker;
12712
12713impl fidl::endpoints::ProtocolMarker for StreamConfigConnectorMarker {
12714    type Proxy = StreamConfigConnectorProxy;
12715    type RequestStream = StreamConfigConnectorRequestStream;
12716    #[cfg(target_os = "fuchsia")]
12717    type SynchronousProxy = StreamConfigConnectorSynchronousProxy;
12718
12719    const DEBUG_NAME: &'static str = "(anonymous) StreamConfigConnector";
12720}
12721
12722pub trait StreamConfigConnectorProxyInterface: Send + Sync {
12723    fn r#connect(
12724        &self,
12725        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12726    ) -> Result<(), fidl::Error>;
12727}
12728#[derive(Debug)]
12729#[cfg(target_os = "fuchsia")]
12730pub struct StreamConfigConnectorSynchronousProxy {
12731    client: fidl::client::sync::Client,
12732}
12733
12734#[cfg(target_os = "fuchsia")]
12735impl fidl::endpoints::SynchronousProxy for StreamConfigConnectorSynchronousProxy {
12736    type Proxy = StreamConfigConnectorProxy;
12737    type Protocol = StreamConfigConnectorMarker;
12738
12739    fn from_channel(inner: fidl::Channel) -> Self {
12740        Self::new(inner)
12741    }
12742
12743    fn into_channel(self) -> fidl::Channel {
12744        self.client.into_channel()
12745    }
12746
12747    fn as_channel(&self) -> &fidl::Channel {
12748        self.client.as_channel()
12749    }
12750}
12751
12752#[cfg(target_os = "fuchsia")]
12753impl StreamConfigConnectorSynchronousProxy {
12754    pub fn new(channel: fidl::Channel) -> Self {
12755        let protocol_name =
12756            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12757        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
12758    }
12759
12760    pub fn into_channel(self) -> fidl::Channel {
12761        self.client.into_channel()
12762    }
12763
12764    /// Waits until an event arrives and returns it. It is safe for other
12765    /// threads to make concurrent requests while waiting for an event.
12766    pub fn wait_for_event(
12767        &self,
12768        deadline: zx::MonotonicInstant,
12769    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
12770        StreamConfigConnectorEvent::decode(self.client.wait_for_event(deadline)?)
12771    }
12772
12773    /// Connect to a `StreamConfig` protocol.
12774    /// This method allows a component to serve FIDL outside the devhost's control.
12775    pub fn r#connect(
12776        &self,
12777        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12778    ) -> Result<(), fidl::Error> {
12779        self.client.send::<StreamConfigConnectorConnectRequest>(
12780            (protocol,),
12781            0x22051ff3021eafec,
12782            fidl::encoding::DynamicFlags::empty(),
12783        )
12784    }
12785}
12786
12787#[cfg(target_os = "fuchsia")]
12788impl From<StreamConfigConnectorSynchronousProxy> for zx::NullableHandle {
12789    fn from(value: StreamConfigConnectorSynchronousProxy) -> Self {
12790        value.into_channel().into()
12791    }
12792}
12793
12794#[cfg(target_os = "fuchsia")]
12795impl From<fidl::Channel> for StreamConfigConnectorSynchronousProxy {
12796    fn from(value: fidl::Channel) -> Self {
12797        Self::new(value)
12798    }
12799}
12800
12801#[cfg(target_os = "fuchsia")]
12802impl fidl::endpoints::FromClient for StreamConfigConnectorSynchronousProxy {
12803    type Protocol = StreamConfigConnectorMarker;
12804
12805    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigConnectorMarker>) -> Self {
12806        Self::new(value.into_channel())
12807    }
12808}
12809
12810#[derive(Debug, Clone)]
12811pub struct StreamConfigConnectorProxy {
12812    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
12813}
12814
12815impl fidl::endpoints::Proxy for StreamConfigConnectorProxy {
12816    type Protocol = StreamConfigConnectorMarker;
12817
12818    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
12819        Self::new(inner)
12820    }
12821
12822    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
12823        self.client.into_channel().map_err(|client| Self { client })
12824    }
12825
12826    fn as_channel(&self) -> &::fidl::AsyncChannel {
12827        self.client.as_channel()
12828    }
12829}
12830
12831impl StreamConfigConnectorProxy {
12832    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfigConnector.
12833    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
12834        let protocol_name =
12835            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12836        Self { client: fidl::client::Client::new(channel, protocol_name) }
12837    }
12838
12839    /// Get a Stream of events from the remote end of the protocol.
12840    ///
12841    /// # Panics
12842    ///
12843    /// Panics if the event stream was already taken.
12844    pub fn take_event_stream(&self) -> StreamConfigConnectorEventStream {
12845        StreamConfigConnectorEventStream { event_receiver: self.client.take_event_receiver() }
12846    }
12847
12848    /// Connect to a `StreamConfig` protocol.
12849    /// This method allows a component to serve FIDL outside the devhost's control.
12850    pub fn r#connect(
12851        &self,
12852        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12853    ) -> Result<(), fidl::Error> {
12854        StreamConfigConnectorProxyInterface::r#connect(self, protocol)
12855    }
12856}
12857
12858impl StreamConfigConnectorProxyInterface for StreamConfigConnectorProxy {
12859    fn r#connect(
12860        &self,
12861        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12862    ) -> Result<(), fidl::Error> {
12863        self.client.send::<StreamConfigConnectorConnectRequest>(
12864            (protocol,),
12865            0x22051ff3021eafec,
12866            fidl::encoding::DynamicFlags::empty(),
12867        )
12868    }
12869}
12870
12871pub struct StreamConfigConnectorEventStream {
12872    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12873}
12874
12875impl std::marker::Unpin for StreamConfigConnectorEventStream {}
12876
12877impl futures::stream::FusedStream for StreamConfigConnectorEventStream {
12878    fn is_terminated(&self) -> bool {
12879        self.event_receiver.is_terminated()
12880    }
12881}
12882
12883impl futures::Stream for StreamConfigConnectorEventStream {
12884    type Item = Result<StreamConfigConnectorEvent, fidl::Error>;
12885
12886    fn poll_next(
12887        mut self: std::pin::Pin<&mut Self>,
12888        cx: &mut std::task::Context<'_>,
12889    ) -> std::task::Poll<Option<Self::Item>> {
12890        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12891            &mut self.event_receiver,
12892            cx
12893        )?) {
12894            Some(buf) => std::task::Poll::Ready(Some(StreamConfigConnectorEvent::decode(buf))),
12895            None => std::task::Poll::Ready(None),
12896        }
12897    }
12898}
12899
12900#[derive(Debug)]
12901pub enum StreamConfigConnectorEvent {}
12902
12903impl StreamConfigConnectorEvent {
12904    /// Decodes a message buffer as a [`StreamConfigConnectorEvent`].
12905    fn decode(
12906        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12907    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
12908        let (bytes, _handles) = buf.split_mut();
12909        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12910        debug_assert_eq!(tx_header.tx_id, 0);
12911        match tx_header.ordinal {
12912            _ => Err(fidl::Error::UnknownOrdinal {
12913                ordinal: tx_header.ordinal,
12914                protocol_name:
12915                    <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12916            }),
12917        }
12918    }
12919}
12920
12921/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfigConnector.
12922pub struct StreamConfigConnectorRequestStream {
12923    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12924    is_terminated: bool,
12925}
12926
12927impl std::marker::Unpin for StreamConfigConnectorRequestStream {}
12928
12929impl futures::stream::FusedStream for StreamConfigConnectorRequestStream {
12930    fn is_terminated(&self) -> bool {
12931        self.is_terminated
12932    }
12933}
12934
12935impl fidl::endpoints::RequestStream for StreamConfigConnectorRequestStream {
12936    type Protocol = StreamConfigConnectorMarker;
12937    type ControlHandle = StreamConfigConnectorControlHandle;
12938
12939    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12940        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12941    }
12942
12943    fn control_handle(&self) -> Self::ControlHandle {
12944        StreamConfigConnectorControlHandle { inner: self.inner.clone() }
12945    }
12946
12947    fn into_inner(
12948        self,
12949    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12950    {
12951        (self.inner, self.is_terminated)
12952    }
12953
12954    fn from_inner(
12955        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12956        is_terminated: bool,
12957    ) -> Self {
12958        Self { inner, is_terminated }
12959    }
12960}
12961
12962impl futures::Stream for StreamConfigConnectorRequestStream {
12963    type Item = Result<StreamConfigConnectorRequest, fidl::Error>;
12964
12965    fn poll_next(
12966        mut self: std::pin::Pin<&mut Self>,
12967        cx: &mut std::task::Context<'_>,
12968    ) -> std::task::Poll<Option<Self::Item>> {
12969        let this = &mut *self;
12970        if this.inner.check_shutdown(cx) {
12971            this.is_terminated = true;
12972            return std::task::Poll::Ready(None);
12973        }
12974        if this.is_terminated {
12975            panic!("polled StreamConfigConnectorRequestStream after completion");
12976        }
12977        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12978            |bytes, handles| {
12979                match this.inner.channel().read_etc(cx, bytes, handles) {
12980                    std::task::Poll::Ready(Ok(())) => {}
12981                    std::task::Poll::Pending => return std::task::Poll::Pending,
12982                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12983                        this.is_terminated = true;
12984                        return std::task::Poll::Ready(None);
12985                    }
12986                    std::task::Poll::Ready(Err(e)) => {
12987                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12988                            e.into(),
12989                        ))));
12990                    }
12991                }
12992
12993                // A message has been received from the channel
12994                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12995
12996                std::task::Poll::Ready(Some(match header.ordinal {
12997                0x22051ff3021eafec => {
12998                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12999                    let mut req = fidl::new_empty!(StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
13000                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
13001                    let control_handle = StreamConfigConnectorControlHandle {
13002                        inner: this.inner.clone(),
13003                    };
13004                    Ok(StreamConfigConnectorRequest::Connect {protocol: req.protocol,
13005
13006                        control_handle,
13007                    })
13008                }
13009                _ => Err(fidl::Error::UnknownOrdinal {
13010                    ordinal: header.ordinal,
13011                    protocol_name: <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13012                }),
13013            }))
13014            },
13015        )
13016    }
13017}
13018
13019/// For an overview see
13020/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming).
13021/// # Deprecation
13022///
13023/// Not supported anymore, instead use an
13024/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13025/// with one Ring Buffer, see
13026/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13027#[derive(Debug)]
13028pub enum StreamConfigConnectorRequest {
13029    /// Connect to a `StreamConfig` protocol.
13030    /// This method allows a component to serve FIDL outside the devhost's control.
13031    Connect {
13032        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
13033        control_handle: StreamConfigConnectorControlHandle,
13034    },
13035}
13036
13037impl StreamConfigConnectorRequest {
13038    #[allow(irrefutable_let_patterns)]
13039    pub fn into_connect(
13040        self,
13041    ) -> Option<(fidl::endpoints::ServerEnd<StreamConfigMarker>, StreamConfigConnectorControlHandle)>
13042    {
13043        if let StreamConfigConnectorRequest::Connect { protocol, control_handle } = self {
13044            Some((protocol, control_handle))
13045        } else {
13046            None
13047        }
13048    }
13049
13050    /// Name of the method defined in FIDL
13051    pub fn method_name(&self) -> &'static str {
13052        match *self {
13053            StreamConfigConnectorRequest::Connect { .. } => "connect",
13054        }
13055    }
13056}
13057
13058#[derive(Debug, Clone)]
13059pub struct StreamConfigConnectorControlHandle {
13060    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13061}
13062
13063impl fidl::endpoints::ControlHandle for StreamConfigConnectorControlHandle {
13064    fn shutdown(&self) {
13065        self.inner.shutdown()
13066    }
13067
13068    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
13069        self.inner.shutdown_with_epitaph(status)
13070    }
13071
13072    fn is_closed(&self) -> bool {
13073        self.inner.channel().is_closed()
13074    }
13075    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
13076        self.inner.channel().on_closed()
13077    }
13078
13079    #[cfg(target_os = "fuchsia")]
13080    fn signal_peer(
13081        &self,
13082        clear_mask: zx::Signals,
13083        set_mask: zx::Signals,
13084    ) -> Result<(), zx_status::Status> {
13085        use fidl::Peered;
13086        self.inner.channel().signal_peer(clear_mask, set_mask)
13087    }
13088}
13089
13090impl StreamConfigConnectorControlHandle {}
13091
13092#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13093pub struct CodecConnectorServiceMarker;
13094
13095#[cfg(target_os = "fuchsia")]
13096impl fidl::endpoints::ServiceMarker for CodecConnectorServiceMarker {
13097    type Proxy = CodecConnectorServiceProxy;
13098    type Request = CodecConnectorServiceRequest;
13099    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecConnectorService";
13100}
13101
13102/// A request for one of the member protocols of CodecConnectorService.
13103///
13104/// # Deprecation
13105///
13106/// Not supported anymore, instead use an
13107/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13108/// with one DAI and no Ring Buffer, see
13109/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13110#[cfg(target_os = "fuchsia")]
13111pub enum CodecConnectorServiceRequest {
13112    CodecConnector(CodecConnectorRequestStream),
13113}
13114
13115#[cfg(target_os = "fuchsia")]
13116impl fidl::endpoints::ServiceRequest for CodecConnectorServiceRequest {
13117    type Service = CodecConnectorServiceMarker;
13118
13119    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13120        match name {
13121            "codec_connector" => Self::CodecConnector(
13122                <CodecConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13123                    _channel,
13124                ),
13125            ),
13126            _ => panic!("no such member protocol name for service CodecConnectorService"),
13127        }
13128    }
13129
13130    fn member_names() -> &'static [&'static str] {
13131        &["codec_connector"]
13132    }
13133}
13134/// # Deprecation
13135///
13136/// Not supported anymore, instead use an
13137/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13138/// with one DAI and no Ring Buffer, see
13139/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13140#[cfg(target_os = "fuchsia")]
13141pub struct CodecConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13142
13143#[cfg(target_os = "fuchsia")]
13144impl fidl::endpoints::ServiceProxy for CodecConnectorServiceProxy {
13145    type Service = CodecConnectorServiceMarker;
13146
13147    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13148        Self(opener)
13149    }
13150}
13151
13152#[cfg(target_os = "fuchsia")]
13153impl CodecConnectorServiceProxy {
13154    pub fn connect_to_codec_connector(&self) -> Result<CodecConnectorProxy, fidl::Error> {
13155        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecConnectorMarker>();
13156        self.connect_channel_to_codec_connector(server_end)?;
13157        Ok(proxy)
13158    }
13159
13160    /// Like `connect_to_codec_connector`, but returns a sync proxy.
13161    /// See [`Self::connect_to_codec_connector`] for more details.
13162    pub fn connect_to_codec_connector_sync(
13163        &self,
13164    ) -> Result<CodecConnectorSynchronousProxy, fidl::Error> {
13165        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecConnectorMarker>();
13166        self.connect_channel_to_codec_connector(server_end)?;
13167        Ok(proxy)
13168    }
13169
13170    /// Like `connect_to_codec_connector`, but accepts a server end.
13171    /// See [`Self::connect_to_codec_connector`] for more details.
13172    pub fn connect_channel_to_codec_connector(
13173        &self,
13174        server_end: fidl::endpoints::ServerEnd<CodecConnectorMarker>,
13175    ) -> Result<(), fidl::Error> {
13176        self.0.open_member("codec_connector", server_end.into_channel())
13177    }
13178
13179    pub fn instance_name(&self) -> &str {
13180        self.0.instance_name()
13181    }
13182}
13183
13184#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13185pub struct CodecServiceMarker;
13186
13187#[cfg(target_os = "fuchsia")]
13188impl fidl::endpoints::ServiceMarker for CodecServiceMarker {
13189    type Proxy = CodecServiceProxy;
13190    type Request = CodecServiceRequest;
13191    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecService";
13192}
13193
13194/// A request for one of the member protocols of CodecService.
13195///
13196/// # Deprecation
13197///
13198/// Not supported anymore, instead use an
13199/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13200/// with one DAI and no Ring Buffer, see
13201/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13202#[cfg(target_os = "fuchsia")]
13203pub enum CodecServiceRequest {
13204    Codec(CodecRequestStream),
13205}
13206
13207#[cfg(target_os = "fuchsia")]
13208impl fidl::endpoints::ServiceRequest for CodecServiceRequest {
13209    type Service = CodecServiceMarker;
13210
13211    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13212        match name {
13213            "codec" => Self::Codec(
13214                <CodecRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13215            ),
13216            _ => panic!("no such member protocol name for service CodecService"),
13217        }
13218    }
13219
13220    fn member_names() -> &'static [&'static str] {
13221        &["codec"]
13222    }
13223}
13224/// # Deprecation
13225///
13226/// Not supported anymore, instead use an
13227/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13228/// with one DAI and no Ring Buffer, see
13229/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13230#[cfg(target_os = "fuchsia")]
13231pub struct CodecServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13232
13233#[cfg(target_os = "fuchsia")]
13234impl fidl::endpoints::ServiceProxy for CodecServiceProxy {
13235    type Service = CodecServiceMarker;
13236
13237    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13238        Self(opener)
13239    }
13240}
13241
13242#[cfg(target_os = "fuchsia")]
13243impl CodecServiceProxy {
13244    pub fn connect_to_codec(&self) -> Result<CodecProxy, fidl::Error> {
13245        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecMarker>();
13246        self.connect_channel_to_codec(server_end)?;
13247        Ok(proxy)
13248    }
13249
13250    /// Like `connect_to_codec`, but returns a sync proxy.
13251    /// See [`Self::connect_to_codec`] for more details.
13252    pub fn connect_to_codec_sync(&self) -> Result<CodecSynchronousProxy, fidl::Error> {
13253        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecMarker>();
13254        self.connect_channel_to_codec(server_end)?;
13255        Ok(proxy)
13256    }
13257
13258    /// Like `connect_to_codec`, but accepts a server end.
13259    /// See [`Self::connect_to_codec`] for more details.
13260    pub fn connect_channel_to_codec(
13261        &self,
13262        server_end: fidl::endpoints::ServerEnd<CodecMarker>,
13263    ) -> Result<(), fidl::Error> {
13264        self.0.open_member("codec", server_end.into_channel())
13265    }
13266
13267    pub fn instance_name(&self) -> &str {
13268        self.0.instance_name()
13269    }
13270}
13271
13272#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13273pub struct CompositeConnectorServiceMarker;
13274
13275#[cfg(target_os = "fuchsia")]
13276impl fidl::endpoints::ServiceMarker for CompositeConnectorServiceMarker {
13277    type Proxy = CompositeConnectorServiceProxy;
13278    type Request = CompositeConnectorServiceRequest;
13279    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CompositeConnectorService";
13280}
13281
13282/// A request for one of the member protocols of CompositeConnectorService.
13283///
13284#[cfg(target_os = "fuchsia")]
13285pub enum CompositeConnectorServiceRequest {
13286    CompositeConnector(CompositeConnectorRequestStream),
13287}
13288
13289#[cfg(target_os = "fuchsia")]
13290impl fidl::endpoints::ServiceRequest for CompositeConnectorServiceRequest {
13291    type Service = CompositeConnectorServiceMarker;
13292
13293    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13294        match name {
13295            "composite_connector" => Self::CompositeConnector(
13296                <CompositeConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13297                    _channel,
13298                ),
13299            ),
13300            _ => panic!("no such member protocol name for service CompositeConnectorService"),
13301        }
13302    }
13303
13304    fn member_names() -> &'static [&'static str] {
13305        &["composite_connector"]
13306    }
13307}
13308#[cfg(target_os = "fuchsia")]
13309pub struct CompositeConnectorServiceProxy(
13310    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13311);
13312
13313#[cfg(target_os = "fuchsia")]
13314impl fidl::endpoints::ServiceProxy for CompositeConnectorServiceProxy {
13315    type Service = CompositeConnectorServiceMarker;
13316
13317    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13318        Self(opener)
13319    }
13320}
13321
13322#[cfg(target_os = "fuchsia")]
13323impl CompositeConnectorServiceProxy {
13324    pub fn connect_to_composite_connector(&self) -> Result<CompositeConnectorProxy, fidl::Error> {
13325        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeConnectorMarker>();
13326        self.connect_channel_to_composite_connector(server_end)?;
13327        Ok(proxy)
13328    }
13329
13330    /// Like `connect_to_composite_connector`, but returns a sync proxy.
13331    /// See [`Self::connect_to_composite_connector`] for more details.
13332    pub fn connect_to_composite_connector_sync(
13333        &self,
13334    ) -> Result<CompositeConnectorSynchronousProxy, fidl::Error> {
13335        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeConnectorMarker>();
13336        self.connect_channel_to_composite_connector(server_end)?;
13337        Ok(proxy)
13338    }
13339
13340    /// Like `connect_to_composite_connector`, but accepts a server end.
13341    /// See [`Self::connect_to_composite_connector`] for more details.
13342    pub fn connect_channel_to_composite_connector(
13343        &self,
13344        server_end: fidl::endpoints::ServerEnd<CompositeConnectorMarker>,
13345    ) -> Result<(), fidl::Error> {
13346        self.0.open_member("composite_connector", server_end.into_channel())
13347    }
13348
13349    pub fn instance_name(&self) -> &str {
13350        self.0.instance_name()
13351    }
13352}
13353
13354#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13355pub struct DaiConnectorServiceMarker;
13356
13357#[cfg(target_os = "fuchsia")]
13358impl fidl::endpoints::ServiceMarker for DaiConnectorServiceMarker {
13359    type Proxy = DaiConnectorServiceProxy;
13360    type Request = DaiConnectorServiceRequest;
13361    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiConnectorService";
13362}
13363
13364/// A request for one of the member protocols of DaiConnectorService.
13365///
13366/// # Deprecation
13367///
13368/// Not supported anymore, instead use an
13369/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13370/// with one DAI and one Ring Buffer, see
13371/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13372#[cfg(target_os = "fuchsia")]
13373pub enum DaiConnectorServiceRequest {
13374    DaiConnector(DaiConnectorRequestStream),
13375}
13376
13377#[cfg(target_os = "fuchsia")]
13378impl fidl::endpoints::ServiceRequest for DaiConnectorServiceRequest {
13379    type Service = DaiConnectorServiceMarker;
13380
13381    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13382        match name {
13383            "dai_connector" => Self::DaiConnector(
13384                <DaiConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13385                    _channel,
13386                ),
13387            ),
13388            _ => panic!("no such member protocol name for service DaiConnectorService"),
13389        }
13390    }
13391
13392    fn member_names() -> &'static [&'static str] {
13393        &["dai_connector"]
13394    }
13395}
13396/// # Deprecation
13397///
13398/// Not supported anymore, instead use an
13399/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13400/// with one DAI and one Ring Buffer, see
13401/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13402#[cfg(target_os = "fuchsia")]
13403pub struct DaiConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13404
13405#[cfg(target_os = "fuchsia")]
13406impl fidl::endpoints::ServiceProxy for DaiConnectorServiceProxy {
13407    type Service = DaiConnectorServiceMarker;
13408
13409    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13410        Self(opener)
13411    }
13412}
13413
13414#[cfg(target_os = "fuchsia")]
13415impl DaiConnectorServiceProxy {
13416    pub fn connect_to_dai_connector(&self) -> Result<DaiConnectorProxy, fidl::Error> {
13417        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiConnectorMarker>();
13418        self.connect_channel_to_dai_connector(server_end)?;
13419        Ok(proxy)
13420    }
13421
13422    /// Like `connect_to_dai_connector`, but returns a sync proxy.
13423    /// See [`Self::connect_to_dai_connector`] for more details.
13424    pub fn connect_to_dai_connector_sync(
13425        &self,
13426    ) -> Result<DaiConnectorSynchronousProxy, fidl::Error> {
13427        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiConnectorMarker>();
13428        self.connect_channel_to_dai_connector(server_end)?;
13429        Ok(proxy)
13430    }
13431
13432    /// Like `connect_to_dai_connector`, but accepts a server end.
13433    /// See [`Self::connect_to_dai_connector`] for more details.
13434    pub fn connect_channel_to_dai_connector(
13435        &self,
13436        server_end: fidl::endpoints::ServerEnd<DaiConnectorMarker>,
13437    ) -> Result<(), fidl::Error> {
13438        self.0.open_member("dai_connector", server_end.into_channel())
13439    }
13440
13441    pub fn instance_name(&self) -> &str {
13442        self.0.instance_name()
13443    }
13444}
13445
13446#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13447pub struct DaiServiceMarker;
13448
13449#[cfg(target_os = "fuchsia")]
13450impl fidl::endpoints::ServiceMarker for DaiServiceMarker {
13451    type Proxy = DaiServiceProxy;
13452    type Request = DaiServiceRequest;
13453    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiService";
13454}
13455
13456/// A request for one of the member protocols of DaiService.
13457///
13458/// # Deprecation
13459///
13460/// Not supported anymore, instead use an
13461/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13462/// with one DAI and one Ring Buffer, see
13463/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13464#[cfg(target_os = "fuchsia")]
13465pub enum DaiServiceRequest {
13466    Dai(DaiRequestStream),
13467}
13468
13469#[cfg(target_os = "fuchsia")]
13470impl fidl::endpoints::ServiceRequest for DaiServiceRequest {
13471    type Service = DaiServiceMarker;
13472
13473    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13474        match name {
13475            "dai" => Self::Dai(<DaiRequestStream as fidl::endpoints::RequestStream>::from_channel(
13476                _channel,
13477            )),
13478            _ => panic!("no such member protocol name for service DaiService"),
13479        }
13480    }
13481
13482    fn member_names() -> &'static [&'static str] {
13483        &["dai"]
13484    }
13485}
13486/// # Deprecation
13487///
13488/// Not supported anymore, instead use an
13489/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13490/// with one DAI and one Ring Buffer, see
13491/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13492#[cfg(target_os = "fuchsia")]
13493pub struct DaiServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13494
13495#[cfg(target_os = "fuchsia")]
13496impl fidl::endpoints::ServiceProxy for DaiServiceProxy {
13497    type Service = DaiServiceMarker;
13498
13499    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13500        Self(opener)
13501    }
13502}
13503
13504#[cfg(target_os = "fuchsia")]
13505impl DaiServiceProxy {
13506    pub fn connect_to_dai(&self) -> Result<DaiProxy, fidl::Error> {
13507        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiMarker>();
13508        self.connect_channel_to_dai(server_end)?;
13509        Ok(proxy)
13510    }
13511
13512    /// Like `connect_to_dai`, but returns a sync proxy.
13513    /// See [`Self::connect_to_dai`] for more details.
13514    pub fn connect_to_dai_sync(&self) -> Result<DaiSynchronousProxy, fidl::Error> {
13515        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiMarker>();
13516        self.connect_channel_to_dai(server_end)?;
13517        Ok(proxy)
13518    }
13519
13520    /// Like `connect_to_dai`, but accepts a server end.
13521    /// See [`Self::connect_to_dai`] for more details.
13522    pub fn connect_channel_to_dai(
13523        &self,
13524        server_end: fidl::endpoints::ServerEnd<DaiMarker>,
13525    ) -> Result<(), fidl::Error> {
13526        self.0.open_member("dai", server_end.into_channel())
13527    }
13528
13529    pub fn instance_name(&self) -> &str {
13530        self.0.instance_name()
13531    }
13532}
13533
13534#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13535pub struct DeviceServiceMarker;
13536
13537#[cfg(target_os = "fuchsia")]
13538impl fidl::endpoints::ServiceMarker for DeviceServiceMarker {
13539    type Proxy = DeviceServiceProxy;
13540    type Request = DeviceServiceRequest;
13541    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DeviceService";
13542}
13543
13544/// A request for one of the member protocols of DeviceService.
13545///
13546#[cfg(target_os = "fuchsia")]
13547pub enum DeviceServiceRequest {
13548    Device(CompositeRequestStream),
13549}
13550
13551#[cfg(target_os = "fuchsia")]
13552impl fidl::endpoints::ServiceRequest for DeviceServiceRequest {
13553    type Service = DeviceServiceMarker;
13554
13555    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13556        match name {
13557            "device" => Self::Device(
13558                <CompositeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13559            ),
13560            _ => panic!("no such member protocol name for service DeviceService"),
13561        }
13562    }
13563
13564    fn member_names() -> &'static [&'static str] {
13565        &["device"]
13566    }
13567}
13568#[cfg(target_os = "fuchsia")]
13569pub struct DeviceServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13570
13571#[cfg(target_os = "fuchsia")]
13572impl fidl::endpoints::ServiceProxy for DeviceServiceProxy {
13573    type Service = DeviceServiceMarker;
13574
13575    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13576        Self(opener)
13577    }
13578}
13579
13580#[cfg(target_os = "fuchsia")]
13581impl DeviceServiceProxy {
13582    pub fn connect_to_device(&self) -> Result<CompositeProxy, fidl::Error> {
13583        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeMarker>();
13584        self.connect_channel_to_device(server_end)?;
13585        Ok(proxy)
13586    }
13587
13588    /// Like `connect_to_device`, but returns a sync proxy.
13589    /// See [`Self::connect_to_device`] for more details.
13590    pub fn connect_to_device_sync(&self) -> Result<CompositeSynchronousProxy, fidl::Error> {
13591        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeMarker>();
13592        self.connect_channel_to_device(server_end)?;
13593        Ok(proxy)
13594    }
13595
13596    /// Like `connect_to_device`, but accepts a server end.
13597    /// See [`Self::connect_to_device`] for more details.
13598    pub fn connect_channel_to_device(
13599        &self,
13600        server_end: fidl::endpoints::ServerEnd<CompositeMarker>,
13601    ) -> Result<(), fidl::Error> {
13602        self.0.open_member("device", server_end.into_channel())
13603    }
13604
13605    pub fn instance_name(&self) -> &str {
13606        self.0.instance_name()
13607    }
13608}
13609
13610#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13611pub struct StreamConfigConnectorInputServiceMarker;
13612
13613#[cfg(target_os = "fuchsia")]
13614impl fidl::endpoints::ServiceMarker for StreamConfigConnectorInputServiceMarker {
13615    type Proxy = StreamConfigConnectorInputServiceProxy;
13616    type Request = StreamConfigConnectorInputServiceRequest;
13617    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorInputService";
13618}
13619
13620/// A request for one of the member protocols of StreamConfigConnectorInputService.
13621///
13622#[cfg(target_os = "fuchsia")]
13623pub enum StreamConfigConnectorInputServiceRequest {
13624    StreamConfigConnector(StreamConfigConnectorRequestStream),
13625}
13626
13627#[cfg(target_os = "fuchsia")]
13628impl fidl::endpoints::ServiceRequest for StreamConfigConnectorInputServiceRequest {
13629    type Service = StreamConfigConnectorInputServiceMarker;
13630
13631    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13632        match name {
13633            "stream_config_connector" => Self::StreamConfigConnector(
13634                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13635            ),
13636            _ => panic!("no such member protocol name for service StreamConfigConnectorInputService"),
13637        }
13638    }
13639
13640    fn member_names() -> &'static [&'static str] {
13641        &["stream_config_connector"]
13642    }
13643}
13644#[cfg(target_os = "fuchsia")]
13645pub struct StreamConfigConnectorInputServiceProxy(
13646    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13647);
13648
13649#[cfg(target_os = "fuchsia")]
13650impl fidl::endpoints::ServiceProxy for StreamConfigConnectorInputServiceProxy {
13651    type Service = StreamConfigConnectorInputServiceMarker;
13652
13653    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13654        Self(opener)
13655    }
13656}
13657
13658#[cfg(target_os = "fuchsia")]
13659impl StreamConfigConnectorInputServiceProxy {
13660    pub fn connect_to_stream_config_connector(
13661        &self,
13662    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13663        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13664        self.connect_channel_to_stream_config_connector(server_end)?;
13665        Ok(proxy)
13666    }
13667
13668    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13669    /// See [`Self::connect_to_stream_config_connector`] for more details.
13670    pub fn connect_to_stream_config_connector_sync(
13671        &self,
13672    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13673        let (proxy, server_end) =
13674            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13675        self.connect_channel_to_stream_config_connector(server_end)?;
13676        Ok(proxy)
13677    }
13678
13679    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13680    /// See [`Self::connect_to_stream_config_connector`] for more details.
13681    pub fn connect_channel_to_stream_config_connector(
13682        &self,
13683        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13684    ) -> Result<(), fidl::Error> {
13685        self.0.open_member("stream_config_connector", server_end.into_channel())
13686    }
13687
13688    pub fn instance_name(&self) -> &str {
13689        self.0.instance_name()
13690    }
13691}
13692
13693#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13694pub struct StreamConfigConnectorOutputServiceMarker;
13695
13696#[cfg(target_os = "fuchsia")]
13697impl fidl::endpoints::ServiceMarker for StreamConfigConnectorOutputServiceMarker {
13698    type Proxy = StreamConfigConnectorOutputServiceProxy;
13699    type Request = StreamConfigConnectorOutputServiceRequest;
13700    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorOutputService";
13701}
13702
13703/// A request for one of the member protocols of StreamConfigConnectorOutputService.
13704///
13705#[cfg(target_os = "fuchsia")]
13706pub enum StreamConfigConnectorOutputServiceRequest {
13707    StreamConfigConnector(StreamConfigConnectorRequestStream),
13708}
13709
13710#[cfg(target_os = "fuchsia")]
13711impl fidl::endpoints::ServiceRequest for StreamConfigConnectorOutputServiceRequest {
13712    type Service = StreamConfigConnectorOutputServiceMarker;
13713
13714    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13715        match name {
13716            "stream_config_connector" => Self::StreamConfigConnector(
13717                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13718            ),
13719            _ => panic!("no such member protocol name for service StreamConfigConnectorOutputService"),
13720        }
13721    }
13722
13723    fn member_names() -> &'static [&'static str] {
13724        &["stream_config_connector"]
13725    }
13726}
13727#[cfg(target_os = "fuchsia")]
13728pub struct StreamConfigConnectorOutputServiceProxy(
13729    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13730);
13731
13732#[cfg(target_os = "fuchsia")]
13733impl fidl::endpoints::ServiceProxy for StreamConfigConnectorOutputServiceProxy {
13734    type Service = StreamConfigConnectorOutputServiceMarker;
13735
13736    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13737        Self(opener)
13738    }
13739}
13740
13741#[cfg(target_os = "fuchsia")]
13742impl StreamConfigConnectorOutputServiceProxy {
13743    pub fn connect_to_stream_config_connector(
13744        &self,
13745    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13746        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13747        self.connect_channel_to_stream_config_connector(server_end)?;
13748        Ok(proxy)
13749    }
13750
13751    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13752    /// See [`Self::connect_to_stream_config_connector`] for more details.
13753    pub fn connect_to_stream_config_connector_sync(
13754        &self,
13755    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13756        let (proxy, server_end) =
13757            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13758        self.connect_channel_to_stream_config_connector(server_end)?;
13759        Ok(proxy)
13760    }
13761
13762    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13763    /// See [`Self::connect_to_stream_config_connector`] for more details.
13764    pub fn connect_channel_to_stream_config_connector(
13765        &self,
13766        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13767    ) -> Result<(), fidl::Error> {
13768        self.0.open_member("stream_config_connector", server_end.into_channel())
13769    }
13770
13771    pub fn instance_name(&self) -> &str {
13772        self.0.instance_name()
13773    }
13774}
13775
13776#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13777pub struct StreamConfigConnectorServiceMarker;
13778
13779#[cfg(target_os = "fuchsia")]
13780impl fidl::endpoints::ServiceMarker for StreamConfigConnectorServiceMarker {
13781    type Proxy = StreamConfigConnectorServiceProxy;
13782    type Request = StreamConfigConnectorServiceRequest;
13783    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorService";
13784}
13785
13786/// A request for one of the member protocols of StreamConfigConnectorService.
13787///
13788/// # Deprecation
13789///
13790/// Not supported anymore, instead use an
13791/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13792/// with one Ring Buffer, see
13793/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13794#[cfg(target_os = "fuchsia")]
13795pub enum StreamConfigConnectorServiceRequest {
13796    StreamConfigConnector(StreamConfigConnectorRequestStream),
13797}
13798
13799#[cfg(target_os = "fuchsia")]
13800impl fidl::endpoints::ServiceRequest for StreamConfigConnectorServiceRequest {
13801    type Service = StreamConfigConnectorServiceMarker;
13802
13803    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13804        match name {
13805            "stream_config_connector" => Self::StreamConfigConnector(
13806                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13807            ),
13808            _ => panic!("no such member protocol name for service StreamConfigConnectorService"),
13809        }
13810    }
13811
13812    fn member_names() -> &'static [&'static str] {
13813        &["stream_config_connector"]
13814    }
13815}
13816/// # Deprecation
13817///
13818/// Not supported anymore, instead use an
13819/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13820/// with one Ring Buffer, see
13821/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13822#[cfg(target_os = "fuchsia")]
13823pub struct StreamConfigConnectorServiceProxy(
13824    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13825);
13826
13827#[cfg(target_os = "fuchsia")]
13828impl fidl::endpoints::ServiceProxy for StreamConfigConnectorServiceProxy {
13829    type Service = StreamConfigConnectorServiceMarker;
13830
13831    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13832        Self(opener)
13833    }
13834}
13835
13836#[cfg(target_os = "fuchsia")]
13837impl StreamConfigConnectorServiceProxy {
13838    pub fn connect_to_stream_config_connector(
13839        &self,
13840    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13841        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13842        self.connect_channel_to_stream_config_connector(server_end)?;
13843        Ok(proxy)
13844    }
13845
13846    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13847    /// See [`Self::connect_to_stream_config_connector`] for more details.
13848    pub fn connect_to_stream_config_connector_sync(
13849        &self,
13850    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13851        let (proxy, server_end) =
13852            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13853        self.connect_channel_to_stream_config_connector(server_end)?;
13854        Ok(proxy)
13855    }
13856
13857    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13858    /// See [`Self::connect_to_stream_config_connector`] for more details.
13859    pub fn connect_channel_to_stream_config_connector(
13860        &self,
13861        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13862    ) -> Result<(), fidl::Error> {
13863        self.0.open_member("stream_config_connector", server_end.into_channel())
13864    }
13865
13866    pub fn instance_name(&self) -> &str {
13867        self.0.instance_name()
13868    }
13869}
13870
13871#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13872pub struct StreamConfigServiceMarker;
13873
13874#[cfg(target_os = "fuchsia")]
13875impl fidl::endpoints::ServiceMarker for StreamConfigServiceMarker {
13876    type Proxy = StreamConfigServiceProxy;
13877    type Request = StreamConfigServiceRequest;
13878    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigService";
13879}
13880
13881/// A request for one of the member protocols of StreamConfigService.
13882///
13883/// # Deprecation
13884///
13885/// Not supported anymore, instead use an
13886/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13887/// with one Ring Buffer, see
13888/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13889#[cfg(target_os = "fuchsia")]
13890pub enum StreamConfigServiceRequest {
13891    StreamConfig(StreamConfigRequestStream),
13892}
13893
13894#[cfg(target_os = "fuchsia")]
13895impl fidl::endpoints::ServiceRequest for StreamConfigServiceRequest {
13896    type Service = StreamConfigServiceMarker;
13897
13898    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13899        match name {
13900            "stream_config" => Self::StreamConfig(
13901                <StreamConfigRequestStream as fidl::endpoints::RequestStream>::from_channel(
13902                    _channel,
13903                ),
13904            ),
13905            _ => panic!("no such member protocol name for service StreamConfigService"),
13906        }
13907    }
13908
13909    fn member_names() -> &'static [&'static str] {
13910        &["stream_config"]
13911    }
13912}
13913/// # Deprecation
13914///
13915/// Not supported anymore, instead use an
13916/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13917/// with one Ring Buffer, see
13918/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13919#[cfg(target_os = "fuchsia")]
13920pub struct StreamConfigServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13921
13922#[cfg(target_os = "fuchsia")]
13923impl fidl::endpoints::ServiceProxy for StreamConfigServiceProxy {
13924    type Service = StreamConfigServiceMarker;
13925
13926    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13927        Self(opener)
13928    }
13929}
13930
13931#[cfg(target_os = "fuchsia")]
13932impl StreamConfigServiceProxy {
13933    pub fn connect_to_stream_config(&self) -> Result<StreamConfigProxy, fidl::Error> {
13934        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigMarker>();
13935        self.connect_channel_to_stream_config(server_end)?;
13936        Ok(proxy)
13937    }
13938
13939    /// Like `connect_to_stream_config`, but returns a sync proxy.
13940    /// See [`Self::connect_to_stream_config`] for more details.
13941    pub fn connect_to_stream_config_sync(
13942        &self,
13943    ) -> Result<StreamConfigSynchronousProxy, fidl::Error> {
13944        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<StreamConfigMarker>();
13945        self.connect_channel_to_stream_config(server_end)?;
13946        Ok(proxy)
13947    }
13948
13949    /// Like `connect_to_stream_config`, but accepts a server end.
13950    /// See [`Self::connect_to_stream_config`] for more details.
13951    pub fn connect_channel_to_stream_config(
13952        &self,
13953        server_end: fidl::endpoints::ServerEnd<StreamConfigMarker>,
13954    ) -> Result<(), fidl::Error> {
13955        self.0.open_member("stream_config", server_end.into_channel())
13956    }
13957
13958    pub fn instance_name(&self) -> &str {
13959        self.0.instance_name()
13960    }
13961}
13962
13963mod internal {
13964    use super::*;
13965
13966    impl fidl::encoding::ResourceTypeMarker for CodecConnectorConnectRequest {
13967        type Borrowed<'a> = &'a mut Self;
13968        fn take_or_borrow<'a>(
13969            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13970        ) -> Self::Borrowed<'a> {
13971            value
13972        }
13973    }
13974
13975    unsafe impl fidl::encoding::TypeMarker for CodecConnectorConnectRequest {
13976        type Owned = Self;
13977
13978        #[inline(always)]
13979        fn inline_align(_context: fidl::encoding::Context) -> usize {
13980            4
13981        }
13982
13983        #[inline(always)]
13984        fn inline_size(_context: fidl::encoding::Context) -> usize {
13985            4
13986        }
13987    }
13988
13989    unsafe impl
13990        fidl::encoding::Encode<
13991            CodecConnectorConnectRequest,
13992            fidl::encoding::DefaultFuchsiaResourceDialect,
13993        > for &mut CodecConnectorConnectRequest
13994    {
13995        #[inline]
13996        unsafe fn encode(
13997            self,
13998            encoder: &mut fidl::encoding::Encoder<
13999                '_,
14000                fidl::encoding::DefaultFuchsiaResourceDialect,
14001            >,
14002            offset: usize,
14003            _depth: fidl::encoding::Depth,
14004        ) -> fidl::Result<()> {
14005            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
14006            // Delegate to tuple encoding.
14007            fidl::encoding::Encode::<CodecConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14008                (
14009                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.codec_protocol),
14010                ),
14011                encoder, offset, _depth
14012            )
14013        }
14014    }
14015    unsafe impl<
14016        T0: fidl::encoding::Encode<
14017                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14018                fidl::encoding::DefaultFuchsiaResourceDialect,
14019            >,
14020    >
14021        fidl::encoding::Encode<
14022            CodecConnectorConnectRequest,
14023            fidl::encoding::DefaultFuchsiaResourceDialect,
14024        > for (T0,)
14025    {
14026        #[inline]
14027        unsafe fn encode(
14028            self,
14029            encoder: &mut fidl::encoding::Encoder<
14030                '_,
14031                fidl::encoding::DefaultFuchsiaResourceDialect,
14032            >,
14033            offset: usize,
14034            depth: fidl::encoding::Depth,
14035        ) -> fidl::Result<()> {
14036            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
14037            // Zero out padding regions. There's no need to apply masks
14038            // because the unmasked parts will be overwritten by fields.
14039            // Write the fields.
14040            self.0.encode(encoder, offset + 0, depth)?;
14041            Ok(())
14042        }
14043    }
14044
14045    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14046        for CodecConnectorConnectRequest
14047    {
14048        #[inline(always)]
14049        fn new_empty() -> Self {
14050            Self {
14051                codec_protocol: fidl::new_empty!(
14052                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14053                    fidl::encoding::DefaultFuchsiaResourceDialect
14054                ),
14055            }
14056        }
14057
14058        #[inline]
14059        unsafe fn decode(
14060            &mut self,
14061            decoder: &mut fidl::encoding::Decoder<
14062                '_,
14063                fidl::encoding::DefaultFuchsiaResourceDialect,
14064            >,
14065            offset: usize,
14066            _depth: fidl::encoding::Depth,
14067        ) -> fidl::Result<()> {
14068            decoder.debug_check_bounds::<Self>(offset);
14069            // Verify that padding bytes are zero.
14070            fidl::decode!(
14071                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14072                fidl::encoding::DefaultFuchsiaResourceDialect,
14073                &mut self.codec_protocol,
14074                decoder,
14075                offset + 0,
14076                _depth
14077            )?;
14078            Ok(())
14079        }
14080    }
14081
14082    impl fidl::encoding::ResourceTypeMarker for CompositeConnectorConnectRequest {
14083        type Borrowed<'a> = &'a mut Self;
14084        fn take_or_borrow<'a>(
14085            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14086        ) -> Self::Borrowed<'a> {
14087            value
14088        }
14089    }
14090
14091    unsafe impl fidl::encoding::TypeMarker for CompositeConnectorConnectRequest {
14092        type Owned = Self;
14093
14094        #[inline(always)]
14095        fn inline_align(_context: fidl::encoding::Context) -> usize {
14096            4
14097        }
14098
14099        #[inline(always)]
14100        fn inline_size(_context: fidl::encoding::Context) -> usize {
14101            4
14102        }
14103    }
14104
14105    unsafe impl
14106        fidl::encoding::Encode<
14107            CompositeConnectorConnectRequest,
14108            fidl::encoding::DefaultFuchsiaResourceDialect,
14109        > for &mut CompositeConnectorConnectRequest
14110    {
14111        #[inline]
14112        unsafe fn encode(
14113            self,
14114            encoder: &mut fidl::encoding::Encoder<
14115                '_,
14116                fidl::encoding::DefaultFuchsiaResourceDialect,
14117            >,
14118            offset: usize,
14119            _depth: fidl::encoding::Depth,
14120        ) -> fidl::Result<()> {
14121            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
14122            // Delegate to tuple encoding.
14123            fidl::encoding::Encode::<CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14124                (
14125                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.composite_protocol),
14126                ),
14127                encoder, offset, _depth
14128            )
14129        }
14130    }
14131    unsafe impl<
14132        T0: fidl::encoding::Encode<
14133                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14134                fidl::encoding::DefaultFuchsiaResourceDialect,
14135            >,
14136    >
14137        fidl::encoding::Encode<
14138            CompositeConnectorConnectRequest,
14139            fidl::encoding::DefaultFuchsiaResourceDialect,
14140        > for (T0,)
14141    {
14142        #[inline]
14143        unsafe fn encode(
14144            self,
14145            encoder: &mut fidl::encoding::Encoder<
14146                '_,
14147                fidl::encoding::DefaultFuchsiaResourceDialect,
14148            >,
14149            offset: usize,
14150            depth: fidl::encoding::Depth,
14151        ) -> fidl::Result<()> {
14152            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
14153            // Zero out padding regions. There's no need to apply masks
14154            // because the unmasked parts will be overwritten by fields.
14155            // Write the fields.
14156            self.0.encode(encoder, offset + 0, depth)?;
14157            Ok(())
14158        }
14159    }
14160
14161    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14162        for CompositeConnectorConnectRequest
14163    {
14164        #[inline(always)]
14165        fn new_empty() -> Self {
14166            Self {
14167                composite_protocol: fidl::new_empty!(
14168                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14169                    fidl::encoding::DefaultFuchsiaResourceDialect
14170                ),
14171            }
14172        }
14173
14174        #[inline]
14175        unsafe fn decode(
14176            &mut self,
14177            decoder: &mut fidl::encoding::Decoder<
14178                '_,
14179                fidl::encoding::DefaultFuchsiaResourceDialect,
14180            >,
14181            offset: usize,
14182            _depth: fidl::encoding::Depth,
14183        ) -> fidl::Result<()> {
14184            decoder.debug_check_bounds::<Self>(offset);
14185            // Verify that padding bytes are zero.
14186            fidl::decode!(
14187                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14188                fidl::encoding::DefaultFuchsiaResourceDialect,
14189                &mut self.composite_protocol,
14190                decoder,
14191                offset + 0,
14192                _depth
14193            )?;
14194            Ok(())
14195        }
14196    }
14197
14198    impl fidl::encoding::ResourceTypeMarker for CompositeCreatePacketStreamRequest {
14199        type Borrowed<'a> = &'a mut Self;
14200        fn take_or_borrow<'a>(
14201            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14202        ) -> Self::Borrowed<'a> {
14203            value
14204        }
14205    }
14206
14207    unsafe impl fidl::encoding::TypeMarker for CompositeCreatePacketStreamRequest {
14208        type Owned = Self;
14209
14210        #[inline(always)]
14211        fn inline_align(_context: fidl::encoding::Context) -> usize {
14212            8
14213        }
14214
14215        #[inline(always)]
14216        fn inline_size(_context: fidl::encoding::Context) -> usize {
14217            32
14218        }
14219    }
14220
14221    unsafe impl
14222        fidl::encoding::Encode<
14223            CompositeCreatePacketStreamRequest,
14224            fidl::encoding::DefaultFuchsiaResourceDialect,
14225        > for &mut CompositeCreatePacketStreamRequest
14226    {
14227        #[inline]
14228        unsafe fn encode(
14229            self,
14230            encoder: &mut fidl::encoding::Encoder<
14231                '_,
14232                fidl::encoding::DefaultFuchsiaResourceDialect,
14233            >,
14234            offset: usize,
14235            _depth: fidl::encoding::Depth,
14236        ) -> fidl::Result<()> {
14237            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
14238            // Delegate to tuple encoding.
14239            fidl::encoding::Encode::<CompositeCreatePacketStreamRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14240                (
14241                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
14242                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
14243                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.packet_stream_control),
14244                ),
14245                encoder, offset, _depth
14246            )
14247        }
14248    }
14249    unsafe impl<
14250        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
14251        T1: fidl::encoding::Encode<Format2, fidl::encoding::DefaultFuchsiaResourceDialect>,
14252        T2: fidl::encoding::Encode<
14253                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14254                fidl::encoding::DefaultFuchsiaResourceDialect,
14255            >,
14256    >
14257        fidl::encoding::Encode<
14258            CompositeCreatePacketStreamRequest,
14259            fidl::encoding::DefaultFuchsiaResourceDialect,
14260        > for (T0, T1, T2)
14261    {
14262        #[inline]
14263        unsafe fn encode(
14264            self,
14265            encoder: &mut fidl::encoding::Encoder<
14266                '_,
14267                fidl::encoding::DefaultFuchsiaResourceDialect,
14268            >,
14269            offset: usize,
14270            depth: fidl::encoding::Depth,
14271        ) -> fidl::Result<()> {
14272            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
14273            // Zero out padding regions. There's no need to apply masks
14274            // because the unmasked parts will be overwritten by fields.
14275            unsafe {
14276                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
14277                (ptr as *mut u64).write_unaligned(0);
14278            }
14279            // Write the fields.
14280            self.0.encode(encoder, offset + 0, depth)?;
14281            self.1.encode(encoder, offset + 8, depth)?;
14282            self.2.encode(encoder, offset + 24, depth)?;
14283            Ok(())
14284        }
14285    }
14286
14287    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14288        for CompositeCreatePacketStreamRequest
14289    {
14290        #[inline(always)]
14291        fn new_empty() -> Self {
14292            Self {
14293                processing_element_id: fidl::new_empty!(
14294                    u64,
14295                    fidl::encoding::DefaultFuchsiaResourceDialect
14296                ),
14297                format: fidl::new_empty!(Format2, fidl::encoding::DefaultFuchsiaResourceDialect),
14298                packet_stream_control: fidl::new_empty!(
14299                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14300                    fidl::encoding::DefaultFuchsiaResourceDialect
14301                ),
14302            }
14303        }
14304
14305        #[inline]
14306        unsafe fn decode(
14307            &mut self,
14308            decoder: &mut fidl::encoding::Decoder<
14309                '_,
14310                fidl::encoding::DefaultFuchsiaResourceDialect,
14311            >,
14312            offset: usize,
14313            _depth: fidl::encoding::Depth,
14314        ) -> fidl::Result<()> {
14315            decoder.debug_check_bounds::<Self>(offset);
14316            // Verify that padding bytes are zero.
14317            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
14318            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14319            let mask = 0xffffffff00000000u64;
14320            let maskedval = padval & mask;
14321            if maskedval != 0 {
14322                return Err(fidl::Error::NonZeroPadding {
14323                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
14324                });
14325            }
14326            fidl::decode!(
14327                u64,
14328                fidl::encoding::DefaultFuchsiaResourceDialect,
14329                &mut self.processing_element_id,
14330                decoder,
14331                offset + 0,
14332                _depth
14333            )?;
14334            fidl::decode!(
14335                Format2,
14336                fidl::encoding::DefaultFuchsiaResourceDialect,
14337                &mut self.format,
14338                decoder,
14339                offset + 8,
14340                _depth
14341            )?;
14342            fidl::decode!(
14343                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14344                fidl::encoding::DefaultFuchsiaResourceDialect,
14345                &mut self.packet_stream_control,
14346                decoder,
14347                offset + 24,
14348                _depth
14349            )?;
14350            Ok(())
14351        }
14352    }
14353
14354    impl fidl::encoding::ResourceTypeMarker for CompositeCreateRingBufferRequest {
14355        type Borrowed<'a> = &'a mut Self;
14356        fn take_or_borrow<'a>(
14357            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14358        ) -> Self::Borrowed<'a> {
14359            value
14360        }
14361    }
14362
14363    unsafe impl fidl::encoding::TypeMarker for CompositeCreateRingBufferRequest {
14364        type Owned = Self;
14365
14366        #[inline(always)]
14367        fn inline_align(_context: fidl::encoding::Context) -> usize {
14368            8
14369        }
14370
14371        #[inline(always)]
14372        fn inline_size(_context: fidl::encoding::Context) -> usize {
14373            32
14374        }
14375    }
14376
14377    unsafe impl
14378        fidl::encoding::Encode<
14379            CompositeCreateRingBufferRequest,
14380            fidl::encoding::DefaultFuchsiaResourceDialect,
14381        > for &mut CompositeCreateRingBufferRequest
14382    {
14383        #[inline]
14384        unsafe fn encode(
14385            self,
14386            encoder: &mut fidl::encoding::Encoder<
14387                '_,
14388                fidl::encoding::DefaultFuchsiaResourceDialect,
14389            >,
14390            offset: usize,
14391            _depth: fidl::encoding::Depth,
14392        ) -> fidl::Result<()> {
14393            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
14394            // Delegate to tuple encoding.
14395            fidl::encoding::Encode::<CompositeCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14396                (
14397                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
14398                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
14399                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
14400                ),
14401                encoder, offset, _depth
14402            )
14403        }
14404    }
14405    unsafe impl<
14406        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
14407        T1: fidl::encoding::Encode<Format2, fidl::encoding::DefaultFuchsiaResourceDialect>,
14408        T2: fidl::encoding::Encode<
14409                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14410                fidl::encoding::DefaultFuchsiaResourceDialect,
14411            >,
14412    >
14413        fidl::encoding::Encode<
14414            CompositeCreateRingBufferRequest,
14415            fidl::encoding::DefaultFuchsiaResourceDialect,
14416        > for (T0, T1, T2)
14417    {
14418        #[inline]
14419        unsafe fn encode(
14420            self,
14421            encoder: &mut fidl::encoding::Encoder<
14422                '_,
14423                fidl::encoding::DefaultFuchsiaResourceDialect,
14424            >,
14425            offset: usize,
14426            depth: fidl::encoding::Depth,
14427        ) -> fidl::Result<()> {
14428            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
14429            // Zero out padding regions. There's no need to apply masks
14430            // because the unmasked parts will be overwritten by fields.
14431            unsafe {
14432                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
14433                (ptr as *mut u64).write_unaligned(0);
14434            }
14435            // Write the fields.
14436            self.0.encode(encoder, offset + 0, depth)?;
14437            self.1.encode(encoder, offset + 8, depth)?;
14438            self.2.encode(encoder, offset + 24, depth)?;
14439            Ok(())
14440        }
14441    }
14442
14443    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14444        for CompositeCreateRingBufferRequest
14445    {
14446        #[inline(always)]
14447        fn new_empty() -> Self {
14448            Self {
14449                processing_element_id: fidl::new_empty!(
14450                    u64,
14451                    fidl::encoding::DefaultFuchsiaResourceDialect
14452                ),
14453                format: fidl::new_empty!(Format2, fidl::encoding::DefaultFuchsiaResourceDialect),
14454                ring_buffer: fidl::new_empty!(
14455                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14456                    fidl::encoding::DefaultFuchsiaResourceDialect
14457                ),
14458            }
14459        }
14460
14461        #[inline]
14462        unsafe fn decode(
14463            &mut self,
14464            decoder: &mut fidl::encoding::Decoder<
14465                '_,
14466                fidl::encoding::DefaultFuchsiaResourceDialect,
14467            >,
14468            offset: usize,
14469            _depth: fidl::encoding::Depth,
14470        ) -> fidl::Result<()> {
14471            decoder.debug_check_bounds::<Self>(offset);
14472            // Verify that padding bytes are zero.
14473            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
14474            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14475            let mask = 0xffffffff00000000u64;
14476            let maskedval = padval & mask;
14477            if maskedval != 0 {
14478                return Err(fidl::Error::NonZeroPadding {
14479                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
14480                });
14481            }
14482            fidl::decode!(
14483                u64,
14484                fidl::encoding::DefaultFuchsiaResourceDialect,
14485                &mut self.processing_element_id,
14486                decoder,
14487                offset + 0,
14488                _depth
14489            )?;
14490            fidl::decode!(
14491                Format2,
14492                fidl::encoding::DefaultFuchsiaResourceDialect,
14493                &mut self.format,
14494                decoder,
14495                offset + 8,
14496                _depth
14497            )?;
14498            fidl::decode!(
14499                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14500                fidl::encoding::DefaultFuchsiaResourceDialect,
14501                &mut self.ring_buffer,
14502                decoder,
14503                offset + 24,
14504                _depth
14505            )?;
14506            Ok(())
14507        }
14508    }
14509
14510    impl fidl::encoding::ResourceTypeMarker for DaiConnectorConnectRequest {
14511        type Borrowed<'a> = &'a mut Self;
14512        fn take_or_borrow<'a>(
14513            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14514        ) -> Self::Borrowed<'a> {
14515            value
14516        }
14517    }
14518
14519    unsafe impl fidl::encoding::TypeMarker for DaiConnectorConnectRequest {
14520        type Owned = Self;
14521
14522        #[inline(always)]
14523        fn inline_align(_context: fidl::encoding::Context) -> usize {
14524            4
14525        }
14526
14527        #[inline(always)]
14528        fn inline_size(_context: fidl::encoding::Context) -> usize {
14529            4
14530        }
14531    }
14532
14533    unsafe impl
14534        fidl::encoding::Encode<
14535            DaiConnectorConnectRequest,
14536            fidl::encoding::DefaultFuchsiaResourceDialect,
14537        > for &mut DaiConnectorConnectRequest
14538    {
14539        #[inline]
14540        unsafe fn encode(
14541            self,
14542            encoder: &mut fidl::encoding::Encoder<
14543                '_,
14544                fidl::encoding::DefaultFuchsiaResourceDialect,
14545            >,
14546            offset: usize,
14547            _depth: fidl::encoding::Depth,
14548        ) -> fidl::Result<()> {
14549            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
14550            // Delegate to tuple encoding.
14551            fidl::encoding::Encode::<DaiConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14552                (
14553                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dai_protocol),
14554                ),
14555                encoder, offset, _depth
14556            )
14557        }
14558    }
14559    unsafe impl<
14560        T0: fidl::encoding::Encode<
14561                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14562                fidl::encoding::DefaultFuchsiaResourceDialect,
14563            >,
14564    >
14565        fidl::encoding::Encode<
14566            DaiConnectorConnectRequest,
14567            fidl::encoding::DefaultFuchsiaResourceDialect,
14568        > for (T0,)
14569    {
14570        #[inline]
14571        unsafe fn encode(
14572            self,
14573            encoder: &mut fidl::encoding::Encoder<
14574                '_,
14575                fidl::encoding::DefaultFuchsiaResourceDialect,
14576            >,
14577            offset: usize,
14578            depth: fidl::encoding::Depth,
14579        ) -> fidl::Result<()> {
14580            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
14581            // Zero out padding regions. There's no need to apply masks
14582            // because the unmasked parts will be overwritten by fields.
14583            // Write the fields.
14584            self.0.encode(encoder, offset + 0, depth)?;
14585            Ok(())
14586        }
14587    }
14588
14589    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14590        for DaiConnectorConnectRequest
14591    {
14592        #[inline(always)]
14593        fn new_empty() -> Self {
14594            Self {
14595                dai_protocol: fidl::new_empty!(
14596                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14597                    fidl::encoding::DefaultFuchsiaResourceDialect
14598                ),
14599            }
14600        }
14601
14602        #[inline]
14603        unsafe fn decode(
14604            &mut self,
14605            decoder: &mut fidl::encoding::Decoder<
14606                '_,
14607                fidl::encoding::DefaultFuchsiaResourceDialect,
14608            >,
14609            offset: usize,
14610            _depth: fidl::encoding::Depth,
14611        ) -> fidl::Result<()> {
14612            decoder.debug_check_bounds::<Self>(offset);
14613            // Verify that padding bytes are zero.
14614            fidl::decode!(
14615                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14616                fidl::encoding::DefaultFuchsiaResourceDialect,
14617                &mut self.dai_protocol,
14618                decoder,
14619                offset + 0,
14620                _depth
14621            )?;
14622            Ok(())
14623        }
14624    }
14625
14626    impl fidl::encoding::ResourceTypeMarker for DaiCreateRingBufferRequest {
14627        type Borrowed<'a> = &'a mut Self;
14628        fn take_or_borrow<'a>(
14629            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14630        ) -> Self::Borrowed<'a> {
14631            value
14632        }
14633    }
14634
14635    unsafe impl fidl::encoding::TypeMarker for DaiCreateRingBufferRequest {
14636        type Owned = Self;
14637
14638        #[inline(always)]
14639        fn inline_align(_context: fidl::encoding::Context) -> usize {
14640            8
14641        }
14642
14643        #[inline(always)]
14644        fn inline_size(_context: fidl::encoding::Context) -> usize {
14645            72
14646        }
14647    }
14648
14649    unsafe impl
14650        fidl::encoding::Encode<
14651            DaiCreateRingBufferRequest,
14652            fidl::encoding::DefaultFuchsiaResourceDialect,
14653        > for &mut DaiCreateRingBufferRequest
14654    {
14655        #[inline]
14656        unsafe fn encode(
14657            self,
14658            encoder: &mut fidl::encoding::Encoder<
14659                '_,
14660                fidl::encoding::DefaultFuchsiaResourceDialect,
14661            >,
14662            offset: usize,
14663            _depth: fidl::encoding::Depth,
14664        ) -> fidl::Result<()> {
14665            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
14666            // Delegate to tuple encoding.
14667            fidl::encoding::Encode::<DaiCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14668                (
14669                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_format),
14670                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_format),
14671                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
14672                ),
14673                encoder, offset, _depth
14674            )
14675        }
14676    }
14677    unsafe impl<
14678        T0: fidl::encoding::Encode<DaiFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
14679        T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
14680        T2: fidl::encoding::Encode<
14681                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14682                fidl::encoding::DefaultFuchsiaResourceDialect,
14683            >,
14684    >
14685        fidl::encoding::Encode<
14686            DaiCreateRingBufferRequest,
14687            fidl::encoding::DefaultFuchsiaResourceDialect,
14688        > for (T0, T1, T2)
14689    {
14690        #[inline]
14691        unsafe fn encode(
14692            self,
14693            encoder: &mut fidl::encoding::Encoder<
14694                '_,
14695                fidl::encoding::DefaultFuchsiaResourceDialect,
14696            >,
14697            offset: usize,
14698            depth: fidl::encoding::Depth,
14699        ) -> fidl::Result<()> {
14700            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
14701            // Zero out padding regions. There's no need to apply masks
14702            // because the unmasked parts will be overwritten by fields.
14703            unsafe {
14704                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
14705                (ptr as *mut u64).write_unaligned(0);
14706            }
14707            // Write the fields.
14708            self.0.encode(encoder, offset + 0, depth)?;
14709            self.1.encode(encoder, offset + 48, depth)?;
14710            self.2.encode(encoder, offset + 64, depth)?;
14711            Ok(())
14712        }
14713    }
14714
14715    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14716        for DaiCreateRingBufferRequest
14717    {
14718        #[inline(always)]
14719        fn new_empty() -> Self {
14720            Self {
14721                dai_format: fidl::new_empty!(
14722                    DaiFormat,
14723                    fidl::encoding::DefaultFuchsiaResourceDialect
14724                ),
14725                ring_buffer_format: fidl::new_empty!(
14726                    Format,
14727                    fidl::encoding::DefaultFuchsiaResourceDialect
14728                ),
14729                ring_buffer: fidl::new_empty!(
14730                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14731                    fidl::encoding::DefaultFuchsiaResourceDialect
14732                ),
14733            }
14734        }
14735
14736        #[inline]
14737        unsafe fn decode(
14738            &mut self,
14739            decoder: &mut fidl::encoding::Decoder<
14740                '_,
14741                fidl::encoding::DefaultFuchsiaResourceDialect,
14742            >,
14743            offset: usize,
14744            _depth: fidl::encoding::Depth,
14745        ) -> fidl::Result<()> {
14746            decoder.debug_check_bounds::<Self>(offset);
14747            // Verify that padding bytes are zero.
14748            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
14749            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14750            let mask = 0xffffffff00000000u64;
14751            let maskedval = padval & mask;
14752            if maskedval != 0 {
14753                return Err(fidl::Error::NonZeroPadding {
14754                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
14755                });
14756            }
14757            fidl::decode!(
14758                DaiFormat,
14759                fidl::encoding::DefaultFuchsiaResourceDialect,
14760                &mut self.dai_format,
14761                decoder,
14762                offset + 0,
14763                _depth
14764            )?;
14765            fidl::decode!(
14766                Format,
14767                fidl::encoding::DefaultFuchsiaResourceDialect,
14768                &mut self.ring_buffer_format,
14769                decoder,
14770                offset + 48,
14771                _depth
14772            )?;
14773            fidl::decode!(
14774                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14775                fidl::encoding::DefaultFuchsiaResourceDialect,
14776                &mut self.ring_buffer,
14777                decoder,
14778                offset + 64,
14779                _depth
14780            )?;
14781            Ok(())
14782        }
14783    }
14784
14785    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlAllocateVmosResponse {
14786        type Borrowed<'a> = &'a mut Self;
14787        fn take_or_borrow<'a>(
14788            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14789        ) -> Self::Borrowed<'a> {
14790            value
14791        }
14792    }
14793
14794    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlAllocateVmosResponse {
14795        type Owned = Self;
14796
14797        #[inline(always)]
14798        fn inline_align(_context: fidl::encoding::Context) -> usize {
14799            8
14800        }
14801
14802        #[inline(always)]
14803        fn inline_size(_context: fidl::encoding::Context) -> usize {
14804            16
14805        }
14806    }
14807
14808    unsafe impl
14809        fidl::encoding::Encode<
14810            PacketStreamControlAllocateVmosResponse,
14811            fidl::encoding::DefaultFuchsiaResourceDialect,
14812        > for &mut PacketStreamControlAllocateVmosResponse
14813    {
14814        #[inline]
14815        unsafe fn encode(
14816            self,
14817            encoder: &mut fidl::encoding::Encoder<
14818                '_,
14819                fidl::encoding::DefaultFuchsiaResourceDialect,
14820            >,
14821            offset: usize,
14822            _depth: fidl::encoding::Depth,
14823        ) -> fidl::Result<()> {
14824            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
14825            // Delegate to tuple encoding.
14826            fidl::encoding::Encode::<PacketStreamControlAllocateVmosResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14827                (
14828                    <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmos),
14829                ),
14830                encoder, offset, _depth
14831            )
14832        }
14833    }
14834    unsafe impl<
14835        T0: fidl::encoding::Encode<
14836                fidl::encoding::Vector<VmoInfo, 256>,
14837                fidl::encoding::DefaultFuchsiaResourceDialect,
14838            >,
14839    >
14840        fidl::encoding::Encode<
14841            PacketStreamControlAllocateVmosResponse,
14842            fidl::encoding::DefaultFuchsiaResourceDialect,
14843        > for (T0,)
14844    {
14845        #[inline]
14846        unsafe fn encode(
14847            self,
14848            encoder: &mut fidl::encoding::Encoder<
14849                '_,
14850                fidl::encoding::DefaultFuchsiaResourceDialect,
14851            >,
14852            offset: usize,
14853            depth: fidl::encoding::Depth,
14854        ) -> fidl::Result<()> {
14855            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
14856            // Zero out padding regions. There's no need to apply masks
14857            // because the unmasked parts will be overwritten by fields.
14858            // Write the fields.
14859            self.0.encode(encoder, offset + 0, depth)?;
14860            Ok(())
14861        }
14862    }
14863
14864    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14865        for PacketStreamControlAllocateVmosResponse
14866    {
14867        #[inline(always)]
14868        fn new_empty() -> Self {
14869            Self {
14870                vmos: fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect),
14871            }
14872        }
14873
14874        #[inline]
14875        unsafe fn decode(
14876            &mut self,
14877            decoder: &mut fidl::encoding::Decoder<
14878                '_,
14879                fidl::encoding::DefaultFuchsiaResourceDialect,
14880            >,
14881            offset: usize,
14882            _depth: fidl::encoding::Depth,
14883        ) -> fidl::Result<()> {
14884            decoder.debug_check_bounds::<Self>(offset);
14885            // Verify that padding bytes are zero.
14886            fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmos, decoder, offset + 0, _depth)?;
14887            Ok(())
14888        }
14889    }
14890
14891    impl fidl::encoding::ResourceTypeMarker for RingBufferGetVmoResponse {
14892        type Borrowed<'a> = &'a mut Self;
14893        fn take_or_borrow<'a>(
14894            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14895        ) -> Self::Borrowed<'a> {
14896            value
14897        }
14898    }
14899
14900    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoResponse {
14901        type Owned = Self;
14902
14903        #[inline(always)]
14904        fn inline_align(_context: fidl::encoding::Context) -> usize {
14905            4
14906        }
14907
14908        #[inline(always)]
14909        fn inline_size(_context: fidl::encoding::Context) -> usize {
14910            8
14911        }
14912    }
14913
14914    unsafe impl
14915        fidl::encoding::Encode<
14916            RingBufferGetVmoResponse,
14917            fidl::encoding::DefaultFuchsiaResourceDialect,
14918        > for &mut RingBufferGetVmoResponse
14919    {
14920        #[inline]
14921        unsafe fn encode(
14922            self,
14923            encoder: &mut fidl::encoding::Encoder<
14924                '_,
14925                fidl::encoding::DefaultFuchsiaResourceDialect,
14926            >,
14927            offset: usize,
14928            _depth: fidl::encoding::Depth,
14929        ) -> fidl::Result<()> {
14930            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
14931            // Delegate to tuple encoding.
14932            fidl::encoding::Encode::<
14933                RingBufferGetVmoResponse,
14934                fidl::encoding::DefaultFuchsiaResourceDialect,
14935            >::encode(
14936                (
14937                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_frames),
14938                    <fidl::encoding::HandleType<
14939                        fidl::Vmo,
14940                        { fidl::ObjectType::VMO.into_raw() },
14941                        2147483648,
14942                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14943                        &mut self.ring_buffer
14944                    ),
14945                ),
14946                encoder,
14947                offset,
14948                _depth,
14949            )
14950        }
14951    }
14952    unsafe impl<
14953        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
14954        T1: fidl::encoding::Encode<
14955                fidl::encoding::HandleType<
14956                    fidl::Vmo,
14957                    { fidl::ObjectType::VMO.into_raw() },
14958                    2147483648,
14959                >,
14960                fidl::encoding::DefaultFuchsiaResourceDialect,
14961            >,
14962    >
14963        fidl::encoding::Encode<
14964            RingBufferGetVmoResponse,
14965            fidl::encoding::DefaultFuchsiaResourceDialect,
14966        > for (T0, T1)
14967    {
14968        #[inline]
14969        unsafe fn encode(
14970            self,
14971            encoder: &mut fidl::encoding::Encoder<
14972                '_,
14973                fidl::encoding::DefaultFuchsiaResourceDialect,
14974            >,
14975            offset: usize,
14976            depth: fidl::encoding::Depth,
14977        ) -> fidl::Result<()> {
14978            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
14979            // Zero out padding regions. There's no need to apply masks
14980            // because the unmasked parts will be overwritten by fields.
14981            // Write the fields.
14982            self.0.encode(encoder, offset + 0, depth)?;
14983            self.1.encode(encoder, offset + 4, depth)?;
14984            Ok(())
14985        }
14986    }
14987
14988    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14989        for RingBufferGetVmoResponse
14990    {
14991        #[inline(always)]
14992        fn new_empty() -> Self {
14993            Self {
14994                num_frames: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
14995                ring_buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14996            }
14997        }
14998
14999        #[inline]
15000        unsafe fn decode(
15001            &mut self,
15002            decoder: &mut fidl::encoding::Decoder<
15003                '_,
15004                fidl::encoding::DefaultFuchsiaResourceDialect,
15005            >,
15006            offset: usize,
15007            _depth: fidl::encoding::Depth,
15008        ) -> fidl::Result<()> {
15009            decoder.debug_check_bounds::<Self>(offset);
15010            // Verify that padding bytes are zero.
15011            fidl::decode!(
15012                u32,
15013                fidl::encoding::DefaultFuchsiaResourceDialect,
15014                &mut self.num_frames,
15015                decoder,
15016                offset + 0,
15017                _depth
15018            )?;
15019            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.ring_buffer, decoder, offset + 4, _depth)?;
15020            Ok(())
15021        }
15022    }
15023
15024    impl fidl::encoding::ResourceTypeMarker for StreamConfigConnectorConnectRequest {
15025        type Borrowed<'a> = &'a mut Self;
15026        fn take_or_borrow<'a>(
15027            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15028        ) -> Self::Borrowed<'a> {
15029            value
15030        }
15031    }
15032
15033    unsafe impl fidl::encoding::TypeMarker for StreamConfigConnectorConnectRequest {
15034        type Owned = Self;
15035
15036        #[inline(always)]
15037        fn inline_align(_context: fidl::encoding::Context) -> usize {
15038            4
15039        }
15040
15041        #[inline(always)]
15042        fn inline_size(_context: fidl::encoding::Context) -> usize {
15043            4
15044        }
15045    }
15046
15047    unsafe impl
15048        fidl::encoding::Encode<
15049            StreamConfigConnectorConnectRequest,
15050            fidl::encoding::DefaultFuchsiaResourceDialect,
15051        > for &mut StreamConfigConnectorConnectRequest
15052    {
15053        #[inline]
15054        unsafe fn encode(
15055            self,
15056            encoder: &mut fidl::encoding::Encoder<
15057                '_,
15058                fidl::encoding::DefaultFuchsiaResourceDialect,
15059            >,
15060            offset: usize,
15061            _depth: fidl::encoding::Depth,
15062        ) -> fidl::Result<()> {
15063            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
15064            // Delegate to tuple encoding.
15065            fidl::encoding::Encode::<StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15066                (
15067                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
15068                ),
15069                encoder, offset, _depth
15070            )
15071        }
15072    }
15073    unsafe impl<
15074        T0: fidl::encoding::Encode<
15075                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15076                fidl::encoding::DefaultFuchsiaResourceDialect,
15077            >,
15078    >
15079        fidl::encoding::Encode<
15080            StreamConfigConnectorConnectRequest,
15081            fidl::encoding::DefaultFuchsiaResourceDialect,
15082        > for (T0,)
15083    {
15084        #[inline]
15085        unsafe fn encode(
15086            self,
15087            encoder: &mut fidl::encoding::Encoder<
15088                '_,
15089                fidl::encoding::DefaultFuchsiaResourceDialect,
15090            >,
15091            offset: usize,
15092            depth: fidl::encoding::Depth,
15093        ) -> fidl::Result<()> {
15094            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
15095            // Zero out padding regions. There's no need to apply masks
15096            // because the unmasked parts will be overwritten by fields.
15097            // Write the fields.
15098            self.0.encode(encoder, offset + 0, depth)?;
15099            Ok(())
15100        }
15101    }
15102
15103    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15104        for StreamConfigConnectorConnectRequest
15105    {
15106        #[inline(always)]
15107        fn new_empty() -> Self {
15108            Self {
15109                protocol: fidl::new_empty!(
15110                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15111                    fidl::encoding::DefaultFuchsiaResourceDialect
15112                ),
15113            }
15114        }
15115
15116        #[inline]
15117        unsafe fn decode(
15118            &mut self,
15119            decoder: &mut fidl::encoding::Decoder<
15120                '_,
15121                fidl::encoding::DefaultFuchsiaResourceDialect,
15122            >,
15123            offset: usize,
15124            _depth: fidl::encoding::Depth,
15125        ) -> fidl::Result<()> {
15126            decoder.debug_check_bounds::<Self>(offset);
15127            // Verify that padding bytes are zero.
15128            fidl::decode!(
15129                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15130                fidl::encoding::DefaultFuchsiaResourceDialect,
15131                &mut self.protocol,
15132                decoder,
15133                offset + 0,
15134                _depth
15135            )?;
15136            Ok(())
15137        }
15138    }
15139
15140    impl fidl::encoding::ResourceTypeMarker for StreamConfigCreateRingBufferRequest {
15141        type Borrowed<'a> = &'a mut Self;
15142        fn take_or_borrow<'a>(
15143            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15144        ) -> Self::Borrowed<'a> {
15145            value
15146        }
15147    }
15148
15149    unsafe impl fidl::encoding::TypeMarker for StreamConfigCreateRingBufferRequest {
15150        type Owned = Self;
15151
15152        #[inline(always)]
15153        fn inline_align(_context: fidl::encoding::Context) -> usize {
15154            8
15155        }
15156
15157        #[inline(always)]
15158        fn inline_size(_context: fidl::encoding::Context) -> usize {
15159            24
15160        }
15161    }
15162
15163    unsafe impl
15164        fidl::encoding::Encode<
15165            StreamConfigCreateRingBufferRequest,
15166            fidl::encoding::DefaultFuchsiaResourceDialect,
15167        > for &mut StreamConfigCreateRingBufferRequest
15168    {
15169        #[inline]
15170        unsafe fn encode(
15171            self,
15172            encoder: &mut fidl::encoding::Encoder<
15173                '_,
15174                fidl::encoding::DefaultFuchsiaResourceDialect,
15175            >,
15176            offset: usize,
15177            _depth: fidl::encoding::Depth,
15178        ) -> fidl::Result<()> {
15179            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
15180            // Delegate to tuple encoding.
15181            fidl::encoding::Encode::<StreamConfigCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15182                (
15183                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
15184                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
15185                ),
15186                encoder, offset, _depth
15187            )
15188        }
15189    }
15190    unsafe impl<
15191        T0: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
15192        T1: fidl::encoding::Encode<
15193                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15194                fidl::encoding::DefaultFuchsiaResourceDialect,
15195            >,
15196    >
15197        fidl::encoding::Encode<
15198            StreamConfigCreateRingBufferRequest,
15199            fidl::encoding::DefaultFuchsiaResourceDialect,
15200        > for (T0, T1)
15201    {
15202        #[inline]
15203        unsafe fn encode(
15204            self,
15205            encoder: &mut fidl::encoding::Encoder<
15206                '_,
15207                fidl::encoding::DefaultFuchsiaResourceDialect,
15208            >,
15209            offset: usize,
15210            depth: fidl::encoding::Depth,
15211        ) -> fidl::Result<()> {
15212            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
15213            // Zero out padding regions. There's no need to apply masks
15214            // because the unmasked parts will be overwritten by fields.
15215            unsafe {
15216                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
15217                (ptr as *mut u64).write_unaligned(0);
15218            }
15219            // Write the fields.
15220            self.0.encode(encoder, offset + 0, depth)?;
15221            self.1.encode(encoder, offset + 16, depth)?;
15222            Ok(())
15223        }
15224    }
15225
15226    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15227        for StreamConfigCreateRingBufferRequest
15228    {
15229        #[inline(always)]
15230        fn new_empty() -> Self {
15231            Self {
15232                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
15233                ring_buffer: fidl::new_empty!(
15234                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15235                    fidl::encoding::DefaultFuchsiaResourceDialect
15236                ),
15237            }
15238        }
15239
15240        #[inline]
15241        unsafe fn decode(
15242            &mut self,
15243            decoder: &mut fidl::encoding::Decoder<
15244                '_,
15245                fidl::encoding::DefaultFuchsiaResourceDialect,
15246            >,
15247            offset: usize,
15248            _depth: fidl::encoding::Depth,
15249        ) -> fidl::Result<()> {
15250            decoder.debug_check_bounds::<Self>(offset);
15251            // Verify that padding bytes are zero.
15252            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
15253            let padval = unsafe { (ptr as *const u64).read_unaligned() };
15254            let mask = 0xffffffff00000000u64;
15255            let maskedval = padval & mask;
15256            if maskedval != 0 {
15257                return Err(fidl::Error::NonZeroPadding {
15258                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
15259                });
15260            }
15261            fidl::decode!(
15262                Format,
15263                fidl::encoding::DefaultFuchsiaResourceDialect,
15264                &mut self.format,
15265                decoder,
15266                offset + 0,
15267                _depth
15268            )?;
15269            fidl::decode!(
15270                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15271                fidl::encoding::DefaultFuchsiaResourceDialect,
15272                &mut self.ring_buffer,
15273                decoder,
15274                offset + 16,
15275                _depth
15276            )?;
15277            Ok(())
15278        }
15279    }
15280
15281    impl PacketStreamControlSetPacketStreamSinkRequest {
15282        #[inline(always)]
15283        fn max_ordinal_present(&self) -> u64 {
15284            if let Some(_) = self.stream {
15285                return 1;
15286            }
15287            0
15288        }
15289    }
15290
15291    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
15292        type Borrowed<'a> = &'a mut Self;
15293        fn take_or_borrow<'a>(
15294            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15295        ) -> Self::Borrowed<'a> {
15296            value
15297        }
15298    }
15299
15300    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
15301        type Owned = Self;
15302
15303        #[inline(always)]
15304        fn inline_align(_context: fidl::encoding::Context) -> usize {
15305            8
15306        }
15307
15308        #[inline(always)]
15309        fn inline_size(_context: fidl::encoding::Context) -> usize {
15310            16
15311        }
15312    }
15313
15314    unsafe impl
15315        fidl::encoding::Encode<
15316            PacketStreamControlSetPacketStreamSinkRequest,
15317            fidl::encoding::DefaultFuchsiaResourceDialect,
15318        > for &mut PacketStreamControlSetPacketStreamSinkRequest
15319    {
15320        unsafe fn encode(
15321            self,
15322            encoder: &mut fidl::encoding::Encoder<
15323                '_,
15324                fidl::encoding::DefaultFuchsiaResourceDialect,
15325            >,
15326            offset: usize,
15327            mut depth: fidl::encoding::Depth,
15328        ) -> fidl::Result<()> {
15329            encoder.debug_check_bounds::<PacketStreamControlSetPacketStreamSinkRequest>(offset);
15330            // Vector header
15331            let max_ordinal: u64 = self.max_ordinal_present();
15332            encoder.write_num(max_ordinal, offset);
15333            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15334            // Calling encoder.out_of_line_offset(0) is not allowed.
15335            if max_ordinal == 0 {
15336                return Ok(());
15337            }
15338            depth.increment()?;
15339            let envelope_size = 8;
15340            let bytes_len = max_ordinal as usize * envelope_size;
15341            #[allow(unused_variables)]
15342            let offset = encoder.out_of_line_offset(bytes_len);
15343            let mut _prev_end_offset: usize = 0;
15344            if 1 > max_ordinal {
15345                return Ok(());
15346            }
15347
15348            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15349            // are envelope_size bytes.
15350            let cur_offset: usize = (1 - 1) * envelope_size;
15351
15352            // Zero reserved fields.
15353            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15354
15355            // Safety:
15356            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15357            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15358            //   envelope_size bytes, there is always sufficient room.
15359            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15360            self.stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15361            encoder, offset + cur_offset, depth
15362        )?;
15363
15364            _prev_end_offset = cur_offset + envelope_size;
15365
15366            Ok(())
15367        }
15368    }
15369
15370    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15371        for PacketStreamControlSetPacketStreamSinkRequest
15372    {
15373        #[inline(always)]
15374        fn new_empty() -> Self {
15375            Self::default()
15376        }
15377
15378        unsafe fn decode(
15379            &mut self,
15380            decoder: &mut fidl::encoding::Decoder<
15381                '_,
15382                fidl::encoding::DefaultFuchsiaResourceDialect,
15383            >,
15384            offset: usize,
15385            mut depth: fidl::encoding::Depth,
15386        ) -> fidl::Result<()> {
15387            decoder.debug_check_bounds::<Self>(offset);
15388            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15389                None => return Err(fidl::Error::NotNullable),
15390                Some(len) => len,
15391            };
15392            // Calling decoder.out_of_line_offset(0) is not allowed.
15393            if len == 0 {
15394                return Ok(());
15395            };
15396            depth.increment()?;
15397            let envelope_size = 8;
15398            let bytes_len = len * envelope_size;
15399            let offset = decoder.out_of_line_offset(bytes_len)?;
15400            // Decode the envelope for each type.
15401            let mut _next_ordinal_to_read = 0;
15402            let mut next_offset = offset;
15403            let end_offset = offset + bytes_len;
15404            _next_ordinal_to_read += 1;
15405            if next_offset >= end_offset {
15406                return Ok(());
15407            }
15408
15409            // Decode unknown envelopes for gaps in ordinals.
15410            while _next_ordinal_to_read < 1 {
15411                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15412                _next_ordinal_to_read += 1;
15413                next_offset += envelope_size;
15414            }
15415
15416            let next_out_of_line = decoder.next_out_of_line();
15417            let handles_before = decoder.remaining_handles();
15418            if let Some((inlined, num_bytes, num_handles)) =
15419                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15420            {
15421                let member_inline_size = <fidl::encoding::Endpoint<
15422                    fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15423                > as fidl::encoding::TypeMarker>::inline_size(
15424                    decoder.context
15425                );
15426                if inlined != (member_inline_size <= 4) {
15427                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15428                }
15429                let inner_offset;
15430                let mut inner_depth = depth.clone();
15431                if inlined {
15432                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15433                    inner_offset = next_offset;
15434                } else {
15435                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15436                    inner_depth.increment()?;
15437                }
15438                let val_ref = self.stream.get_or_insert_with(|| {
15439                    fidl::new_empty!(
15440                        fidl::encoding::Endpoint<
15441                            fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15442                        >,
15443                        fidl::encoding::DefaultFuchsiaResourceDialect
15444                    )
15445                });
15446                fidl::decode!(
15447                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>,
15448                    fidl::encoding::DefaultFuchsiaResourceDialect,
15449                    val_ref,
15450                    decoder,
15451                    inner_offset,
15452                    inner_depth
15453                )?;
15454                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15455                {
15456                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15457                }
15458                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15459                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15460                }
15461            }
15462
15463            next_offset += envelope_size;
15464
15465            // Decode the remaining unknown envelopes.
15466            while next_offset < end_offset {
15467                _next_ordinal_to_read += 1;
15468                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15469                next_offset += envelope_size;
15470            }
15471
15472            Ok(())
15473        }
15474    }
15475
15476    impl PacketStreamControlGetPacketStreamSinkResponse {
15477        #[inline(always)]
15478        fn max_ordinal_present(&self) -> u64 {
15479            if let Some(_) = self.stream {
15480                return 1;
15481            }
15482            0
15483        }
15484    }
15485
15486    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
15487        type Borrowed<'a> = &'a mut Self;
15488        fn take_or_borrow<'a>(
15489            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15490        ) -> Self::Borrowed<'a> {
15491            value
15492        }
15493    }
15494
15495    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
15496        type Owned = Self;
15497
15498        #[inline(always)]
15499        fn inline_align(_context: fidl::encoding::Context) -> usize {
15500            8
15501        }
15502
15503        #[inline(always)]
15504        fn inline_size(_context: fidl::encoding::Context) -> usize {
15505            16
15506        }
15507    }
15508
15509    unsafe impl
15510        fidl::encoding::Encode<
15511            PacketStreamControlGetPacketStreamSinkResponse,
15512            fidl::encoding::DefaultFuchsiaResourceDialect,
15513        > for &mut PacketStreamControlGetPacketStreamSinkResponse
15514    {
15515        unsafe fn encode(
15516            self,
15517            encoder: &mut fidl::encoding::Encoder<
15518                '_,
15519                fidl::encoding::DefaultFuchsiaResourceDialect,
15520            >,
15521            offset: usize,
15522            mut depth: fidl::encoding::Depth,
15523        ) -> fidl::Result<()> {
15524            encoder.debug_check_bounds::<PacketStreamControlGetPacketStreamSinkResponse>(offset);
15525            // Vector header
15526            let max_ordinal: u64 = self.max_ordinal_present();
15527            encoder.write_num(max_ordinal, offset);
15528            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15529            // Calling encoder.out_of_line_offset(0) is not allowed.
15530            if max_ordinal == 0 {
15531                return Ok(());
15532            }
15533            depth.increment()?;
15534            let envelope_size = 8;
15535            let bytes_len = max_ordinal as usize * envelope_size;
15536            #[allow(unused_variables)]
15537            let offset = encoder.out_of_line_offset(bytes_len);
15538            let mut _prev_end_offset: usize = 0;
15539            if 1 > max_ordinal {
15540                return Ok(());
15541            }
15542
15543            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15544            // are envelope_size bytes.
15545            let cur_offset: usize = (1 - 1) * envelope_size;
15546
15547            // Zero reserved fields.
15548            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15549
15550            // Safety:
15551            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15552            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15553            //   envelope_size bytes, there is always sufficient room.
15554            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15555            self.stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15556            encoder, offset + cur_offset, depth
15557        )?;
15558
15559            _prev_end_offset = cur_offset + envelope_size;
15560
15561            Ok(())
15562        }
15563    }
15564
15565    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15566        for PacketStreamControlGetPacketStreamSinkResponse
15567    {
15568        #[inline(always)]
15569        fn new_empty() -> Self {
15570            Self::default()
15571        }
15572
15573        unsafe fn decode(
15574            &mut self,
15575            decoder: &mut fidl::encoding::Decoder<
15576                '_,
15577                fidl::encoding::DefaultFuchsiaResourceDialect,
15578            >,
15579            offset: usize,
15580            mut depth: fidl::encoding::Depth,
15581        ) -> fidl::Result<()> {
15582            decoder.debug_check_bounds::<Self>(offset);
15583            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15584                None => return Err(fidl::Error::NotNullable),
15585                Some(len) => len,
15586            };
15587            // Calling decoder.out_of_line_offset(0) is not allowed.
15588            if len == 0 {
15589                return Ok(());
15590            };
15591            depth.increment()?;
15592            let envelope_size = 8;
15593            let bytes_len = len * envelope_size;
15594            let offset = decoder.out_of_line_offset(bytes_len)?;
15595            // Decode the envelope for each type.
15596            let mut _next_ordinal_to_read = 0;
15597            let mut next_offset = offset;
15598            let end_offset = offset + bytes_len;
15599            _next_ordinal_to_read += 1;
15600            if next_offset >= end_offset {
15601                return Ok(());
15602            }
15603
15604            // Decode unknown envelopes for gaps in ordinals.
15605            while _next_ordinal_to_read < 1 {
15606                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15607                _next_ordinal_to_read += 1;
15608                next_offset += envelope_size;
15609            }
15610
15611            let next_out_of_line = decoder.next_out_of_line();
15612            let handles_before = decoder.remaining_handles();
15613            if let Some((inlined, num_bytes, num_handles)) =
15614                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15615            {
15616                let member_inline_size = <fidl::encoding::Endpoint<
15617                    fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15618                > as fidl::encoding::TypeMarker>::inline_size(
15619                    decoder.context
15620                );
15621                if inlined != (member_inline_size <= 4) {
15622                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15623                }
15624                let inner_offset;
15625                let mut inner_depth = depth.clone();
15626                if inlined {
15627                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15628                    inner_offset = next_offset;
15629                } else {
15630                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15631                    inner_depth.increment()?;
15632                }
15633                let val_ref = self.stream.get_or_insert_with(|| {
15634                    fidl::new_empty!(
15635                        fidl::encoding::Endpoint<
15636                            fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15637                        >,
15638                        fidl::encoding::DefaultFuchsiaResourceDialect
15639                    )
15640                });
15641                fidl::decode!(
15642                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>,
15643                    fidl::encoding::DefaultFuchsiaResourceDialect,
15644                    val_ref,
15645                    decoder,
15646                    inner_offset,
15647                    inner_depth
15648                )?;
15649                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15650                {
15651                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15652                }
15653                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15654                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15655                }
15656            }
15657
15658            next_offset += envelope_size;
15659
15660            // Decode the remaining unknown envelopes.
15661            while next_offset < end_offset {
15662                _next_ordinal_to_read += 1;
15663                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15664                next_offset += envelope_size;
15665            }
15666
15667            Ok(())
15668        }
15669    }
15670
15671    impl PacketStreamSinkPutPacketRequest {
15672        #[inline(always)]
15673        fn max_ordinal_present(&self) -> u64 {
15674            if let Some(_) = self.payload {
15675                return 1;
15676            }
15677            0
15678        }
15679    }
15680
15681    impl fidl::encoding::ResourceTypeMarker for PacketStreamSinkPutPacketRequest {
15682        type Borrowed<'a> = &'a mut Self;
15683        fn take_or_borrow<'a>(
15684            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15685        ) -> Self::Borrowed<'a> {
15686            value
15687        }
15688    }
15689
15690    unsafe impl fidl::encoding::TypeMarker for PacketStreamSinkPutPacketRequest {
15691        type Owned = Self;
15692
15693        #[inline(always)]
15694        fn inline_align(_context: fidl::encoding::Context) -> usize {
15695            8
15696        }
15697
15698        #[inline(always)]
15699        fn inline_size(_context: fidl::encoding::Context) -> usize {
15700            16
15701        }
15702    }
15703
15704    unsafe impl
15705        fidl::encoding::Encode<
15706            PacketStreamSinkPutPacketRequest,
15707            fidl::encoding::DefaultFuchsiaResourceDialect,
15708        > for &mut PacketStreamSinkPutPacketRequest
15709    {
15710        unsafe fn encode(
15711            self,
15712            encoder: &mut fidl::encoding::Encoder<
15713                '_,
15714                fidl::encoding::DefaultFuchsiaResourceDialect,
15715            >,
15716            offset: usize,
15717            mut depth: fidl::encoding::Depth,
15718        ) -> fidl::Result<()> {
15719            encoder.debug_check_bounds::<PacketStreamSinkPutPacketRequest>(offset);
15720            // Vector header
15721            let max_ordinal: u64 = self.max_ordinal_present();
15722            encoder.write_num(max_ordinal, offset);
15723            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15724            // Calling encoder.out_of_line_offset(0) is not allowed.
15725            if max_ordinal == 0 {
15726                return Ok(());
15727            }
15728            depth.increment()?;
15729            let envelope_size = 8;
15730            let bytes_len = max_ordinal as usize * envelope_size;
15731            #[allow(unused_variables)]
15732            let offset = encoder.out_of_line_offset(bytes_len);
15733            let mut _prev_end_offset: usize = 0;
15734            if 1 > max_ordinal {
15735                return Ok(());
15736            }
15737
15738            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15739            // are envelope_size bytes.
15740            let cur_offset: usize = (1 - 1) * envelope_size;
15741
15742            // Zero reserved fields.
15743            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15744
15745            // Safety:
15746            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15747            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15748            //   envelope_size bytes, there is always sufficient room.
15749            fidl::encoding::encode_in_envelope_optional::<
15750                DataTransfer,
15751                fidl::encoding::DefaultFuchsiaResourceDialect,
15752            >(
15753                self.payload
15754                    .as_mut()
15755                    .map(<DataTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15756                encoder,
15757                offset + cur_offset,
15758                depth,
15759            )?;
15760
15761            _prev_end_offset = cur_offset + envelope_size;
15762
15763            Ok(())
15764        }
15765    }
15766
15767    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15768        for PacketStreamSinkPutPacketRequest
15769    {
15770        #[inline(always)]
15771        fn new_empty() -> Self {
15772            Self::default()
15773        }
15774
15775        unsafe fn decode(
15776            &mut self,
15777            decoder: &mut fidl::encoding::Decoder<
15778                '_,
15779                fidl::encoding::DefaultFuchsiaResourceDialect,
15780            >,
15781            offset: usize,
15782            mut depth: fidl::encoding::Depth,
15783        ) -> fidl::Result<()> {
15784            decoder.debug_check_bounds::<Self>(offset);
15785            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15786                None => return Err(fidl::Error::NotNullable),
15787                Some(len) => len,
15788            };
15789            // Calling decoder.out_of_line_offset(0) is not allowed.
15790            if len == 0 {
15791                return Ok(());
15792            };
15793            depth.increment()?;
15794            let envelope_size = 8;
15795            let bytes_len = len * envelope_size;
15796            let offset = decoder.out_of_line_offset(bytes_len)?;
15797            // Decode the envelope for each type.
15798            let mut _next_ordinal_to_read = 0;
15799            let mut next_offset = offset;
15800            let end_offset = offset + bytes_len;
15801            _next_ordinal_to_read += 1;
15802            if next_offset >= end_offset {
15803                return Ok(());
15804            }
15805
15806            // Decode unknown envelopes for gaps in ordinals.
15807            while _next_ordinal_to_read < 1 {
15808                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15809                _next_ordinal_to_read += 1;
15810                next_offset += envelope_size;
15811            }
15812
15813            let next_out_of_line = decoder.next_out_of_line();
15814            let handles_before = decoder.remaining_handles();
15815            if let Some((inlined, num_bytes, num_handles)) =
15816                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15817            {
15818                let member_inline_size =
15819                    <DataTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15820                if inlined != (member_inline_size <= 4) {
15821                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15822                }
15823                let inner_offset;
15824                let mut inner_depth = depth.clone();
15825                if inlined {
15826                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15827                    inner_offset = next_offset;
15828                } else {
15829                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15830                    inner_depth.increment()?;
15831                }
15832                let val_ref = self.payload.get_or_insert_with(|| {
15833                    fidl::new_empty!(DataTransfer, fidl::encoding::DefaultFuchsiaResourceDialect)
15834                });
15835                fidl::decode!(
15836                    DataTransfer,
15837                    fidl::encoding::DefaultFuchsiaResourceDialect,
15838                    val_ref,
15839                    decoder,
15840                    inner_offset,
15841                    inner_depth
15842                )?;
15843                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15844                {
15845                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15846                }
15847                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15848                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15849                }
15850            }
15851
15852            next_offset += envelope_size;
15853
15854            // Decode the remaining unknown envelopes.
15855            while next_offset < end_offset {
15856                _next_ordinal_to_read += 1;
15857                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15858                next_offset += envelope_size;
15859            }
15860
15861            Ok(())
15862        }
15863    }
15864
15865    impl RegisterVmosConfig {
15866        #[inline(always)]
15867        fn max_ordinal_present(&self) -> u64 {
15868            if let Some(_) = self.vmo_infos {
15869                return 1;
15870            }
15871            0
15872        }
15873    }
15874
15875    impl fidl::encoding::ResourceTypeMarker for RegisterVmosConfig {
15876        type Borrowed<'a> = &'a mut Self;
15877        fn take_or_borrow<'a>(
15878            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15879        ) -> Self::Borrowed<'a> {
15880            value
15881        }
15882    }
15883
15884    unsafe impl fidl::encoding::TypeMarker for RegisterVmosConfig {
15885        type Owned = Self;
15886
15887        #[inline(always)]
15888        fn inline_align(_context: fidl::encoding::Context) -> usize {
15889            8
15890        }
15891
15892        #[inline(always)]
15893        fn inline_size(_context: fidl::encoding::Context) -> usize {
15894            16
15895        }
15896    }
15897
15898    unsafe impl
15899        fidl::encoding::Encode<RegisterVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
15900        for &mut RegisterVmosConfig
15901    {
15902        unsafe fn encode(
15903            self,
15904            encoder: &mut fidl::encoding::Encoder<
15905                '_,
15906                fidl::encoding::DefaultFuchsiaResourceDialect,
15907            >,
15908            offset: usize,
15909            mut depth: fidl::encoding::Depth,
15910        ) -> fidl::Result<()> {
15911            encoder.debug_check_bounds::<RegisterVmosConfig>(offset);
15912            // Vector header
15913            let max_ordinal: u64 = self.max_ordinal_present();
15914            encoder.write_num(max_ordinal, offset);
15915            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15916            // Calling encoder.out_of_line_offset(0) is not allowed.
15917            if max_ordinal == 0 {
15918                return Ok(());
15919            }
15920            depth.increment()?;
15921            let envelope_size = 8;
15922            let bytes_len = max_ordinal as usize * envelope_size;
15923            #[allow(unused_variables)]
15924            let offset = encoder.out_of_line_offset(bytes_len);
15925            let mut _prev_end_offset: usize = 0;
15926            if 1 > max_ordinal {
15927                return Ok(());
15928            }
15929
15930            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15931            // are envelope_size bytes.
15932            let cur_offset: usize = (1 - 1) * envelope_size;
15933
15934            // Zero reserved fields.
15935            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15936
15937            // Safety:
15938            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15939            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15940            //   envelope_size bytes, there is always sufficient room.
15941            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15942            self.vmo_infos.as_mut().map(<fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15943            encoder, offset + cur_offset, depth
15944        )?;
15945
15946            _prev_end_offset = cur_offset + envelope_size;
15947
15948            Ok(())
15949        }
15950    }
15951
15952    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15953        for RegisterVmosConfig
15954    {
15955        #[inline(always)]
15956        fn new_empty() -> Self {
15957            Self::default()
15958        }
15959
15960        unsafe fn decode(
15961            &mut self,
15962            decoder: &mut fidl::encoding::Decoder<
15963                '_,
15964                fidl::encoding::DefaultFuchsiaResourceDialect,
15965            >,
15966            offset: usize,
15967            mut depth: fidl::encoding::Depth,
15968        ) -> fidl::Result<()> {
15969            decoder.debug_check_bounds::<Self>(offset);
15970            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15971                None => return Err(fidl::Error::NotNullable),
15972                Some(len) => len,
15973            };
15974            // Calling decoder.out_of_line_offset(0) is not allowed.
15975            if len == 0 {
15976                return Ok(());
15977            };
15978            depth.increment()?;
15979            let envelope_size = 8;
15980            let bytes_len = len * envelope_size;
15981            let offset = decoder.out_of_line_offset(bytes_len)?;
15982            // Decode the envelope for each type.
15983            let mut _next_ordinal_to_read = 0;
15984            let mut next_offset = offset;
15985            let end_offset = offset + bytes_len;
15986            _next_ordinal_to_read += 1;
15987            if next_offset >= end_offset {
15988                return Ok(());
15989            }
15990
15991            // Decode unknown envelopes for gaps in ordinals.
15992            while _next_ordinal_to_read < 1 {
15993                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15994                _next_ordinal_to_read += 1;
15995                next_offset += envelope_size;
15996            }
15997
15998            let next_out_of_line = decoder.next_out_of_line();
15999            let handles_before = decoder.remaining_handles();
16000            if let Some((inlined, num_bytes, num_handles)) =
16001                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16002            {
16003                let member_inline_size = <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16004                if inlined != (member_inline_size <= 4) {
16005                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16006                }
16007                let inner_offset;
16008                let mut inner_depth = depth.clone();
16009                if inlined {
16010                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16011                    inner_offset = next_offset;
16012                } else {
16013                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16014                    inner_depth.increment()?;
16015                }
16016                let val_ref =
16017                self.vmo_infos.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect));
16018                fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
16019                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16020                {
16021                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16022                }
16023                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16024                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16025                }
16026            }
16027
16028            next_offset += envelope_size;
16029
16030            // Decode the remaining unknown envelopes.
16031            while next_offset < end_offset {
16032                _next_ordinal_to_read += 1;
16033                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16034                next_offset += envelope_size;
16035            }
16036
16037            Ok(())
16038        }
16039    }
16040
16041    impl VmoInfo {
16042        #[inline(always)]
16043        fn max_ordinal_present(&self) -> u64 {
16044            if let Some(_) = self.vmo {
16045                return 2;
16046            }
16047            if let Some(_) = self.id {
16048                return 1;
16049            }
16050            0
16051        }
16052    }
16053
16054    impl fidl::encoding::ResourceTypeMarker for VmoInfo {
16055        type Borrowed<'a> = &'a mut Self;
16056        fn take_or_borrow<'a>(
16057            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16058        ) -> Self::Borrowed<'a> {
16059            value
16060        }
16061    }
16062
16063    unsafe impl fidl::encoding::TypeMarker for VmoInfo {
16064        type Owned = Self;
16065
16066        #[inline(always)]
16067        fn inline_align(_context: fidl::encoding::Context) -> usize {
16068            8
16069        }
16070
16071        #[inline(always)]
16072        fn inline_size(_context: fidl::encoding::Context) -> usize {
16073            16
16074        }
16075    }
16076
16077    unsafe impl fidl::encoding::Encode<VmoInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
16078        for &mut VmoInfo
16079    {
16080        unsafe fn encode(
16081            self,
16082            encoder: &mut fidl::encoding::Encoder<
16083                '_,
16084                fidl::encoding::DefaultFuchsiaResourceDialect,
16085            >,
16086            offset: usize,
16087            mut depth: fidl::encoding::Depth,
16088        ) -> fidl::Result<()> {
16089            encoder.debug_check_bounds::<VmoInfo>(offset);
16090            // Vector header
16091            let max_ordinal: u64 = self.max_ordinal_present();
16092            encoder.write_num(max_ordinal, offset);
16093            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16094            // Calling encoder.out_of_line_offset(0) is not allowed.
16095            if max_ordinal == 0 {
16096                return Ok(());
16097            }
16098            depth.increment()?;
16099            let envelope_size = 8;
16100            let bytes_len = max_ordinal as usize * envelope_size;
16101            #[allow(unused_variables)]
16102            let offset = encoder.out_of_line_offset(bytes_len);
16103            let mut _prev_end_offset: usize = 0;
16104            if 1 > max_ordinal {
16105                return Ok(());
16106            }
16107
16108            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16109            // are envelope_size bytes.
16110            let cur_offset: usize = (1 - 1) * envelope_size;
16111
16112            // Zero reserved fields.
16113            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16114
16115            // Safety:
16116            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16117            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16118            //   envelope_size bytes, there is always sufficient room.
16119            fidl::encoding::encode_in_envelope_optional::<
16120                u64,
16121                fidl::encoding::DefaultFuchsiaResourceDialect,
16122            >(
16123                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16124                encoder,
16125                offset + cur_offset,
16126                depth,
16127            )?;
16128
16129            _prev_end_offset = cur_offset + envelope_size;
16130            if 2 > max_ordinal {
16131                return Ok(());
16132            }
16133
16134            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16135            // are envelope_size bytes.
16136            let cur_offset: usize = (2 - 1) * envelope_size;
16137
16138            // Zero reserved fields.
16139            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16140
16141            // Safety:
16142            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16143            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16144            //   envelope_size bytes, there is always sufficient room.
16145            fidl::encoding::encode_in_envelope_optional::<
16146                fidl::encoding::HandleType<
16147                    fidl::Vmo,
16148                    { fidl::ObjectType::VMO.into_raw() },
16149                    2147483648,
16150                >,
16151                fidl::encoding::DefaultFuchsiaResourceDialect,
16152            >(
16153                self.vmo.as_mut().map(
16154                    <fidl::encoding::HandleType<
16155                        fidl::Vmo,
16156                        { fidl::ObjectType::VMO.into_raw() },
16157                        2147483648,
16158                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16159                ),
16160                encoder,
16161                offset + cur_offset,
16162                depth,
16163            )?;
16164
16165            _prev_end_offset = cur_offset + envelope_size;
16166
16167            Ok(())
16168        }
16169    }
16170
16171    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for VmoInfo {
16172        #[inline(always)]
16173        fn new_empty() -> Self {
16174            Self::default()
16175        }
16176
16177        unsafe fn decode(
16178            &mut self,
16179            decoder: &mut fidl::encoding::Decoder<
16180                '_,
16181                fidl::encoding::DefaultFuchsiaResourceDialect,
16182            >,
16183            offset: usize,
16184            mut depth: fidl::encoding::Depth,
16185        ) -> fidl::Result<()> {
16186            decoder.debug_check_bounds::<Self>(offset);
16187            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16188                None => return Err(fidl::Error::NotNullable),
16189                Some(len) => len,
16190            };
16191            // Calling decoder.out_of_line_offset(0) is not allowed.
16192            if len == 0 {
16193                return Ok(());
16194            };
16195            depth.increment()?;
16196            let envelope_size = 8;
16197            let bytes_len = len * envelope_size;
16198            let offset = decoder.out_of_line_offset(bytes_len)?;
16199            // Decode the envelope for each type.
16200            let mut _next_ordinal_to_read = 0;
16201            let mut next_offset = offset;
16202            let end_offset = offset + bytes_len;
16203            _next_ordinal_to_read += 1;
16204            if next_offset >= end_offset {
16205                return Ok(());
16206            }
16207
16208            // Decode unknown envelopes for gaps in ordinals.
16209            while _next_ordinal_to_read < 1 {
16210                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16211                _next_ordinal_to_read += 1;
16212                next_offset += envelope_size;
16213            }
16214
16215            let next_out_of_line = decoder.next_out_of_line();
16216            let handles_before = decoder.remaining_handles();
16217            if let Some((inlined, num_bytes, num_handles)) =
16218                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16219            {
16220                let member_inline_size =
16221                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16222                if inlined != (member_inline_size <= 4) {
16223                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16224                }
16225                let inner_offset;
16226                let mut inner_depth = depth.clone();
16227                if inlined {
16228                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16229                    inner_offset = next_offset;
16230                } else {
16231                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16232                    inner_depth.increment()?;
16233                }
16234                let val_ref = self.id.get_or_insert_with(|| {
16235                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16236                });
16237                fidl::decode!(
16238                    u64,
16239                    fidl::encoding::DefaultFuchsiaResourceDialect,
16240                    val_ref,
16241                    decoder,
16242                    inner_offset,
16243                    inner_depth
16244                )?;
16245                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16246                {
16247                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16248                }
16249                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16250                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16251                }
16252            }
16253
16254            next_offset += envelope_size;
16255            _next_ordinal_to_read += 1;
16256            if next_offset >= end_offset {
16257                return Ok(());
16258            }
16259
16260            // Decode unknown envelopes for gaps in ordinals.
16261            while _next_ordinal_to_read < 2 {
16262                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16263                _next_ordinal_to_read += 1;
16264                next_offset += envelope_size;
16265            }
16266
16267            let next_out_of_line = decoder.next_out_of_line();
16268            let handles_before = decoder.remaining_handles();
16269            if let Some((inlined, num_bytes, num_handles)) =
16270                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16271            {
16272                let member_inline_size = <fidl::encoding::HandleType<
16273                    fidl::Vmo,
16274                    { fidl::ObjectType::VMO.into_raw() },
16275                    2147483648,
16276                > as fidl::encoding::TypeMarker>::inline_size(
16277                    decoder.context
16278                );
16279                if inlined != (member_inline_size <= 4) {
16280                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16281                }
16282                let inner_offset;
16283                let mut inner_depth = depth.clone();
16284                if inlined {
16285                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16286                    inner_offset = next_offset;
16287                } else {
16288                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16289                    inner_depth.increment()?;
16290                }
16291                let val_ref =
16292                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
16293                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
16294                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16295                {
16296                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16297                }
16298                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16299                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16300                }
16301            }
16302
16303            next_offset += envelope_size;
16304
16305            // Decode the remaining unknown envelopes.
16306            while next_offset < end_offset {
16307                _next_ordinal_to_read += 1;
16308                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16309                next_offset += envelope_size;
16310            }
16311
16312            Ok(())
16313        }
16314    }
16315
16316    impl VmoTransfer {
16317        #[inline(always)]
16318        fn max_ordinal_present(&self) -> u64 {
16319            if let Some(_) = self.payload_size {
16320                return 3;
16321            }
16322            if let Some(_) = self.vmo_offset {
16323                return 2;
16324            }
16325            if let Some(_) = self.vmo_id {
16326                return 1;
16327            }
16328            0
16329        }
16330    }
16331
16332    impl fidl::encoding::ResourceTypeMarker for VmoTransfer {
16333        type Borrowed<'a> = &'a mut Self;
16334        fn take_or_borrow<'a>(
16335            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16336        ) -> Self::Borrowed<'a> {
16337            value
16338        }
16339    }
16340
16341    unsafe impl fidl::encoding::TypeMarker for VmoTransfer {
16342        type Owned = Self;
16343
16344        #[inline(always)]
16345        fn inline_align(_context: fidl::encoding::Context) -> usize {
16346            8
16347        }
16348
16349        #[inline(always)]
16350        fn inline_size(_context: fidl::encoding::Context) -> usize {
16351            16
16352        }
16353    }
16354
16355    unsafe impl fidl::encoding::Encode<VmoTransfer, fidl::encoding::DefaultFuchsiaResourceDialect>
16356        for &mut VmoTransfer
16357    {
16358        unsafe fn encode(
16359            self,
16360            encoder: &mut fidl::encoding::Encoder<
16361                '_,
16362                fidl::encoding::DefaultFuchsiaResourceDialect,
16363            >,
16364            offset: usize,
16365            mut depth: fidl::encoding::Depth,
16366        ) -> fidl::Result<()> {
16367            encoder.debug_check_bounds::<VmoTransfer>(offset);
16368            // Vector header
16369            let max_ordinal: u64 = self.max_ordinal_present();
16370            encoder.write_num(max_ordinal, offset);
16371            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16372            // Calling encoder.out_of_line_offset(0) is not allowed.
16373            if max_ordinal == 0 {
16374                return Ok(());
16375            }
16376            depth.increment()?;
16377            let envelope_size = 8;
16378            let bytes_len = max_ordinal as usize * envelope_size;
16379            #[allow(unused_variables)]
16380            let offset = encoder.out_of_line_offset(bytes_len);
16381            let mut _prev_end_offset: usize = 0;
16382            if 1 > max_ordinal {
16383                return Ok(());
16384            }
16385
16386            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16387            // are envelope_size bytes.
16388            let cur_offset: usize = (1 - 1) * envelope_size;
16389
16390            // Zero reserved fields.
16391            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16392
16393            // Safety:
16394            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16395            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16396            //   envelope_size bytes, there is always sufficient room.
16397            fidl::encoding::encode_in_envelope_optional::<
16398                u64,
16399                fidl::encoding::DefaultFuchsiaResourceDialect,
16400            >(
16401                self.vmo_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16402                encoder,
16403                offset + cur_offset,
16404                depth,
16405            )?;
16406
16407            _prev_end_offset = cur_offset + envelope_size;
16408            if 2 > max_ordinal {
16409                return Ok(());
16410            }
16411
16412            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16413            // are envelope_size bytes.
16414            let cur_offset: usize = (2 - 1) * envelope_size;
16415
16416            // Zero reserved fields.
16417            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16418
16419            // Safety:
16420            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16421            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16422            //   envelope_size bytes, there is always sufficient room.
16423            fidl::encoding::encode_in_envelope_optional::<
16424                u64,
16425                fidl::encoding::DefaultFuchsiaResourceDialect,
16426            >(
16427                self.vmo_offset.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16428                encoder,
16429                offset + cur_offset,
16430                depth,
16431            )?;
16432
16433            _prev_end_offset = cur_offset + envelope_size;
16434            if 3 > max_ordinal {
16435                return Ok(());
16436            }
16437
16438            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16439            // are envelope_size bytes.
16440            let cur_offset: usize = (3 - 1) * envelope_size;
16441
16442            // Zero reserved fields.
16443            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16444
16445            // Safety:
16446            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16447            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16448            //   envelope_size bytes, there is always sufficient room.
16449            fidl::encoding::encode_in_envelope_optional::<
16450                u64,
16451                fidl::encoding::DefaultFuchsiaResourceDialect,
16452            >(
16453                self.payload_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16454                encoder,
16455                offset + cur_offset,
16456                depth,
16457            )?;
16458
16459            _prev_end_offset = cur_offset + envelope_size;
16460
16461            Ok(())
16462        }
16463    }
16464
16465    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for VmoTransfer {
16466        #[inline(always)]
16467        fn new_empty() -> Self {
16468            Self::default()
16469        }
16470
16471        unsafe fn decode(
16472            &mut self,
16473            decoder: &mut fidl::encoding::Decoder<
16474                '_,
16475                fidl::encoding::DefaultFuchsiaResourceDialect,
16476            >,
16477            offset: usize,
16478            mut depth: fidl::encoding::Depth,
16479        ) -> fidl::Result<()> {
16480            decoder.debug_check_bounds::<Self>(offset);
16481            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16482                None => return Err(fidl::Error::NotNullable),
16483                Some(len) => len,
16484            };
16485            // Calling decoder.out_of_line_offset(0) is not allowed.
16486            if len == 0 {
16487                return Ok(());
16488            };
16489            depth.increment()?;
16490            let envelope_size = 8;
16491            let bytes_len = len * envelope_size;
16492            let offset = decoder.out_of_line_offset(bytes_len)?;
16493            // Decode the envelope for each type.
16494            let mut _next_ordinal_to_read = 0;
16495            let mut next_offset = offset;
16496            let end_offset = offset + bytes_len;
16497            _next_ordinal_to_read += 1;
16498            if next_offset >= end_offset {
16499                return Ok(());
16500            }
16501
16502            // Decode unknown envelopes for gaps in ordinals.
16503            while _next_ordinal_to_read < 1 {
16504                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16505                _next_ordinal_to_read += 1;
16506                next_offset += envelope_size;
16507            }
16508
16509            let next_out_of_line = decoder.next_out_of_line();
16510            let handles_before = decoder.remaining_handles();
16511            if let Some((inlined, num_bytes, num_handles)) =
16512                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16513            {
16514                let member_inline_size =
16515                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16516                if inlined != (member_inline_size <= 4) {
16517                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16518                }
16519                let inner_offset;
16520                let mut inner_depth = depth.clone();
16521                if inlined {
16522                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16523                    inner_offset = next_offset;
16524                } else {
16525                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16526                    inner_depth.increment()?;
16527                }
16528                let val_ref = self.vmo_id.get_or_insert_with(|| {
16529                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16530                });
16531                fidl::decode!(
16532                    u64,
16533                    fidl::encoding::DefaultFuchsiaResourceDialect,
16534                    val_ref,
16535                    decoder,
16536                    inner_offset,
16537                    inner_depth
16538                )?;
16539                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16540                {
16541                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16542                }
16543                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16544                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16545                }
16546            }
16547
16548            next_offset += envelope_size;
16549            _next_ordinal_to_read += 1;
16550            if next_offset >= end_offset {
16551                return Ok(());
16552            }
16553
16554            // Decode unknown envelopes for gaps in ordinals.
16555            while _next_ordinal_to_read < 2 {
16556                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16557                _next_ordinal_to_read += 1;
16558                next_offset += envelope_size;
16559            }
16560
16561            let next_out_of_line = decoder.next_out_of_line();
16562            let handles_before = decoder.remaining_handles();
16563            if let Some((inlined, num_bytes, num_handles)) =
16564                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16565            {
16566                let member_inline_size =
16567                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16568                if inlined != (member_inline_size <= 4) {
16569                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16570                }
16571                let inner_offset;
16572                let mut inner_depth = depth.clone();
16573                if inlined {
16574                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16575                    inner_offset = next_offset;
16576                } else {
16577                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16578                    inner_depth.increment()?;
16579                }
16580                let val_ref = self.vmo_offset.get_or_insert_with(|| {
16581                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16582                });
16583                fidl::decode!(
16584                    u64,
16585                    fidl::encoding::DefaultFuchsiaResourceDialect,
16586                    val_ref,
16587                    decoder,
16588                    inner_offset,
16589                    inner_depth
16590                )?;
16591                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16592                {
16593                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16594                }
16595                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16596                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16597                }
16598            }
16599
16600            next_offset += envelope_size;
16601            _next_ordinal_to_read += 1;
16602            if next_offset >= end_offset {
16603                return Ok(());
16604            }
16605
16606            // Decode unknown envelopes for gaps in ordinals.
16607            while _next_ordinal_to_read < 3 {
16608                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16609                _next_ordinal_to_read += 1;
16610                next_offset += envelope_size;
16611            }
16612
16613            let next_out_of_line = decoder.next_out_of_line();
16614            let handles_before = decoder.remaining_handles();
16615            if let Some((inlined, num_bytes, num_handles)) =
16616                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16617            {
16618                let member_inline_size =
16619                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16620                if inlined != (member_inline_size <= 4) {
16621                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16622                }
16623                let inner_offset;
16624                let mut inner_depth = depth.clone();
16625                if inlined {
16626                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16627                    inner_offset = next_offset;
16628                } else {
16629                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16630                    inner_depth.increment()?;
16631                }
16632                let val_ref = self.payload_size.get_or_insert_with(|| {
16633                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16634                });
16635                fidl::decode!(
16636                    u64,
16637                    fidl::encoding::DefaultFuchsiaResourceDialect,
16638                    val_ref,
16639                    decoder,
16640                    inner_offset,
16641                    inner_depth
16642                )?;
16643                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16644                {
16645                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16646                }
16647                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16648                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16649                }
16650            }
16651
16652            next_offset += envelope_size;
16653
16654            // Decode the remaining unknown envelopes.
16655            while next_offset < end_offset {
16656                _next_ordinal_to_read += 1;
16657                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16658                next_offset += envelope_size;
16659            }
16660
16661            Ok(())
16662        }
16663    }
16664
16665    impl fidl::encoding::ResourceTypeMarker for DataTransfer {
16666        type Borrowed<'a> = &'a mut Self;
16667        fn take_or_borrow<'a>(
16668            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16669        ) -> Self::Borrowed<'a> {
16670            value
16671        }
16672    }
16673
16674    unsafe impl fidl::encoding::TypeMarker for DataTransfer {
16675        type Owned = Self;
16676
16677        #[inline(always)]
16678        fn inline_align(_context: fidl::encoding::Context) -> usize {
16679            8
16680        }
16681
16682        #[inline(always)]
16683        fn inline_size(_context: fidl::encoding::Context) -> usize {
16684            16
16685        }
16686    }
16687
16688    unsafe impl fidl::encoding::Encode<DataTransfer, fidl::encoding::DefaultFuchsiaResourceDialect>
16689        for &mut DataTransfer
16690    {
16691        #[inline]
16692        unsafe fn encode(
16693            self,
16694            encoder: &mut fidl::encoding::Encoder<
16695                '_,
16696                fidl::encoding::DefaultFuchsiaResourceDialect,
16697            >,
16698            offset: usize,
16699            _depth: fidl::encoding::Depth,
16700        ) -> fidl::Result<()> {
16701            encoder.debug_check_bounds::<DataTransfer>(offset);
16702            encoder.write_num::<u64>(self.ordinal(), offset);
16703            match self {
16704                DataTransfer::VmoTransfer(ref mut val) => fidl::encoding::encode_in_envelope::<
16705                    VmoTransfer,
16706                    fidl::encoding::DefaultFuchsiaResourceDialect,
16707                >(
16708                    <VmoTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
16709                    encoder,
16710                    offset + 8,
16711                    _depth,
16712                ),
16713                DataTransfer::InlineData(ref val) => fidl::encoding::encode_in_envelope::<
16714                    fidl::encoding::Vector<u8, 8192>,
16715                    fidl::encoding::DefaultFuchsiaResourceDialect,
16716                >(
16717                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
16718                        val,
16719                    ),
16720                    encoder,
16721                    offset + 8,
16722                    _depth,
16723                ),
16724                DataTransfer::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
16725            }
16726        }
16727    }
16728
16729    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DataTransfer {
16730        #[inline(always)]
16731        fn new_empty() -> Self {
16732            Self::__SourceBreaking { unknown_ordinal: 0 }
16733        }
16734
16735        #[inline]
16736        unsafe fn decode(
16737            &mut self,
16738            decoder: &mut fidl::encoding::Decoder<
16739                '_,
16740                fidl::encoding::DefaultFuchsiaResourceDialect,
16741            >,
16742            offset: usize,
16743            mut depth: fidl::encoding::Depth,
16744        ) -> fidl::Result<()> {
16745            decoder.debug_check_bounds::<Self>(offset);
16746            #[allow(unused_variables)]
16747            let next_out_of_line = decoder.next_out_of_line();
16748            let handles_before = decoder.remaining_handles();
16749            let (ordinal, inlined, num_bytes, num_handles) =
16750                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
16751
16752            let member_inline_size = match ordinal {
16753                1 => <VmoTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context),
16754                2 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
16755                    decoder.context,
16756                ),
16757                0 => return Err(fidl::Error::UnknownUnionTag),
16758                _ => num_bytes as usize,
16759            };
16760
16761            if inlined != (member_inline_size <= 4) {
16762                return Err(fidl::Error::InvalidInlineBitInEnvelope);
16763            }
16764            let _inner_offset;
16765            if inlined {
16766                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
16767                _inner_offset = offset + 8;
16768            } else {
16769                depth.increment()?;
16770                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16771            }
16772            match ordinal {
16773                1 => {
16774                    #[allow(irrefutable_let_patterns)]
16775                    if let DataTransfer::VmoTransfer(_) = self {
16776                        // Do nothing, read the value into the object
16777                    } else {
16778                        // Initialize `self` to the right variant
16779                        *self = DataTransfer::VmoTransfer(fidl::new_empty!(
16780                            VmoTransfer,
16781                            fidl::encoding::DefaultFuchsiaResourceDialect
16782                        ));
16783                    }
16784                    #[allow(irrefutable_let_patterns)]
16785                    if let DataTransfer::VmoTransfer(ref mut val) = self {
16786                        fidl::decode!(
16787                            VmoTransfer,
16788                            fidl::encoding::DefaultFuchsiaResourceDialect,
16789                            val,
16790                            decoder,
16791                            _inner_offset,
16792                            depth
16793                        )?;
16794                    } else {
16795                        unreachable!()
16796                    }
16797                }
16798                2 => {
16799                    #[allow(irrefutable_let_patterns)]
16800                    if let DataTransfer::InlineData(_) = self {
16801                        // Do nothing, read the value into the object
16802                    } else {
16803                        // Initialize `self` to the right variant
16804                        *self = DataTransfer::InlineData(
16805                            fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect),
16806                        );
16807                    }
16808                    #[allow(irrefutable_let_patterns)]
16809                    if let DataTransfer::InlineData(ref mut val) = self {
16810                        fidl::decode!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
16811                    } else {
16812                        unreachable!()
16813                    }
16814                }
16815                #[allow(deprecated)]
16816                ordinal => {
16817                    for _ in 0..num_handles {
16818                        decoder.drop_next_handle()?;
16819                    }
16820                    *self = DataTransfer::__SourceBreaking { unknown_ordinal: ordinal };
16821                }
16822            }
16823            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
16824                return Err(fidl::Error::InvalidNumBytesInEnvelope);
16825            }
16826            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16827                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16828            }
16829            Ok(())
16830        }
16831    }
16832}