Skip to main content

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        Self { client: fidl::client::sync::Client::new(channel) }
352    }
353
354    pub fn into_channel(self) -> fidl::Channel {
355        self.client.into_channel()
356    }
357
358    /// Waits until an event arrives and returns it. It is safe for other
359    /// threads to make concurrent requests while waiting for an event.
360    pub fn wait_for_event(
361        &self,
362        deadline: zx::MonotonicInstant,
363    ) -> Result<CodecEvent, fidl::Error> {
364        CodecEvent::decode(self.client.wait_for_event::<CodecMarker>(deadline)?)
365    }
366
367    /// Retrieves top level health state.
368    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
369    pub fn r#get_health_state(
370        &self,
371        ___deadline: zx::MonotonicInstant,
372    ) -> Result<HealthState, fidl::Error> {
373        let _response = self
374            .client
375            .send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse, CodecMarker>(
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 = self
414            .client
415            .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload, CodecMarker>(
416                (),
417                0x50757ae579a7bd6b,
418                fidl::encoding::DynamicFlags::empty(),
419                ___deadline,
420            )?;
421        Ok(_response)
422    }
423
424    /// Retrieves top level static properties.
425    pub fn r#get_properties(
426        &self,
427        ___deadline: zx::MonotonicInstant,
428    ) -> Result<CodecProperties, fidl::Error> {
429        let _response = self
430            .client
431            .send_query::<fidl::encoding::EmptyPayload, CodecGetPropertiesResponse, CodecMarker>(
432                (),
433                0x7a0d138a6a1d9d90,
434                fidl::encoding::DynamicFlags::empty(),
435                ___deadline,
436            )?;
437        Ok(_response.properties)
438    }
439
440    /// Stops the codec operation.
441    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
442    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
443    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
444    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
445    /// in the CLOCK_MONOTONIC timeline.
446    /// If the driver cannot successfully configure the codec to stop, it will close the codec
447    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
448    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
449        let _response = self
450            .client
451            .send_query::<fidl::encoding::EmptyPayload, CodecStopResponse, CodecMarker>(
452                (),
453                0x5c2e380df1332dbd,
454                fidl::encoding::DynamicFlags::empty(),
455                ___deadline,
456            )?;
457        Ok(_response.stop_time)
458    }
459
460    /// Start/Re-start the codec operation.
461    /// `Start` returns when configuring the codec to start is completed. This method does not wait
462    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
463    /// into account), nor is any such delay reflected in the returned `start_time`.
464    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
465    /// in the CLOCK_MONOTONIC timeline.
466    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
467    /// in which case the client may obtain a new codec protocol channel and retry.
468    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
469        let _response = self
470            .client
471            .send_query::<fidl::encoding::EmptyPayload, CodecStartResponse, CodecMarker>(
472                (),
473                0x329cdacb286ab00,
474                fidl::encoding::DynamicFlags::empty(),
475                ___deadline,
476            )?;
477        Ok(_response.start_time)
478    }
479
480    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
481    /// may reply with an error status and the controller may retry at a later time.
482    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
483    /// combinations of the parameters in DaiSupportedFormats may be supported.
484    pub fn r#get_dai_formats(
485        &self,
486        ___deadline: zx::MonotonicInstant,
487    ) -> Result<CodecGetDaiFormatsResult, fidl::Error> {
488        let _response = self.client.send_query::<
489            fidl::encoding::EmptyPayload,
490            fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>,
491            CodecMarker,
492        >(
493            (),
494            0xf8bbc46b4ba6a52,
495            fidl::encoding::DynamicFlags::empty(),
496            ___deadline,
497        )?;
498        Ok(_response.map(|x| x.formats))
499    }
500
501    /// Sets the DAI format to be used in the interface between the controller and codec.
502    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
503    pub fn r#set_dai_format(
504        &self,
505        mut format: &DaiFormat,
506        ___deadline: zx::MonotonicInstant,
507    ) -> Result<CodecSetDaiFormatResult, fidl::Error> {
508        let _response = self.client.send_query::<
509            CodecSetDaiFormatRequest,
510            fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>,
511            CodecMarker,
512        >(
513            (format,),
514            0x2f829df9e5a7a1ea,
515            fidl::encoding::DynamicFlags::empty(),
516            ___deadline,
517        )?;
518        Ok(_response.map(|x| x.state))
519    }
520
521    /// Get the plug detect state via a hanging get. The driver will reply to the first
522    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
523    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
524    pub fn r#watch_plug_state(
525        &self,
526        ___deadline: zx::MonotonicInstant,
527    ) -> Result<PlugState, fidl::Error> {
528        let _response = self
529            .client
530            .send_query::<fidl::encoding::EmptyPayload, CodecWatchPlugStateResponse, CodecMarker>(
531                (),
532                0x182b87f935ca7326,
533                fidl::encoding::DynamicFlags::empty(),
534                ___deadline,
535            )?;
536        Ok(_response.plug_state)
537    }
538}
539
540#[cfg(target_os = "fuchsia")]
541impl From<CodecSynchronousProxy> for zx::NullableHandle {
542    fn from(value: CodecSynchronousProxy) -> Self {
543        value.into_channel().into()
544    }
545}
546
547#[cfg(target_os = "fuchsia")]
548impl From<fidl::Channel> for CodecSynchronousProxy {
549    fn from(value: fidl::Channel) -> Self {
550        Self::new(value)
551    }
552}
553
554#[cfg(target_os = "fuchsia")]
555impl fidl::endpoints::FromClient for CodecSynchronousProxy {
556    type Protocol = CodecMarker;
557
558    fn from_client(value: fidl::endpoints::ClientEnd<CodecMarker>) -> Self {
559        Self::new(value.into_channel())
560    }
561}
562
563#[derive(Debug, Clone)]
564pub struct CodecProxy {
565    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
566}
567
568impl fidl::endpoints::Proxy for CodecProxy {
569    type Protocol = CodecMarker;
570
571    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
572        Self::new(inner)
573    }
574
575    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
576        self.client.into_channel().map_err(|client| Self { client })
577    }
578
579    fn as_channel(&self) -> &::fidl::AsyncChannel {
580        self.client.as_channel()
581    }
582}
583
584impl CodecProxy {
585    /// Create a new Proxy for fuchsia.hardware.audio/Codec.
586    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
587        let protocol_name = <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
588        Self { client: fidl::client::Client::new(channel, protocol_name) }
589    }
590
591    /// Get a Stream of events from the remote end of the protocol.
592    ///
593    /// # Panics
594    ///
595    /// Panics if the event stream was already taken.
596    pub fn take_event_stream(&self) -> CodecEventStream {
597        CodecEventStream { event_receiver: self.client.take_event_receiver() }
598    }
599
600    /// Retrieves top level health state.
601    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
602    pub fn r#get_health_state(
603        &self,
604    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
605    {
606        CodecProxyInterface::r#get_health_state(self)
607    }
608
609    /// Connect to a `SignalProcessing` protocol.
610    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
611    /// the maximum number of connections have already been created, for instance one, then the
612    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
613    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
614    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
615    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
616    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
617    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
618    /// is intended to be composed, and hence the more verbose name allows differentiation and
619    /// improved clarity.
620    pub fn r#signal_processing_connect(
621        &self,
622        mut protocol: fidl::endpoints::ServerEnd<
623            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
624        >,
625    ) -> Result<(), fidl::Error> {
626        CodecProxyInterface::r#signal_processing_connect(self, protocol)
627    }
628
629    /// Resets the codec.
630    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
631    /// codec it will close the codec protocol channel, in this case the client may obtain a new
632    /// codec protocol channel and retry.
633    pub fn r#reset(
634        &self,
635    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
636        CodecProxyInterface::r#reset(self)
637    }
638
639    /// Retrieves top level static properties.
640    pub fn r#get_properties(
641        &self,
642    ) -> fidl::client::QueryResponseFut<
643        CodecProperties,
644        fidl::encoding::DefaultFuchsiaResourceDialect,
645    > {
646        CodecProxyInterface::r#get_properties(self)
647    }
648
649    /// Stops the codec operation.
650    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
651    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
652    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
653    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
654    /// in the CLOCK_MONOTONIC timeline.
655    /// If the driver cannot successfully configure the codec to stop, it will close the codec
656    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
657    pub fn r#stop(
658        &self,
659    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
660        CodecProxyInterface::r#stop(self)
661    }
662
663    /// Start/Re-start the codec operation.
664    /// `Start` returns when configuring the codec to start is completed. This method does not wait
665    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
666    /// into account), nor is any such delay reflected in the returned `start_time`.
667    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
668    /// in the CLOCK_MONOTONIC timeline.
669    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
670    /// in which case the client may obtain a new codec protocol channel and retry.
671    pub fn r#start(
672        &self,
673    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
674        CodecProxyInterface::r#start(self)
675    }
676
677    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
678    /// may reply with an error status and the controller may retry at a later time.
679    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
680    /// combinations of the parameters in DaiSupportedFormats may be supported.
681    pub fn r#get_dai_formats(
682        &self,
683    ) -> fidl::client::QueryResponseFut<
684        CodecGetDaiFormatsResult,
685        fidl::encoding::DefaultFuchsiaResourceDialect,
686    > {
687        CodecProxyInterface::r#get_dai_formats(self)
688    }
689
690    /// Sets the DAI format to be used in the interface between the controller and codec.
691    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
692    pub fn r#set_dai_format(
693        &self,
694        mut format: &DaiFormat,
695    ) -> fidl::client::QueryResponseFut<
696        CodecSetDaiFormatResult,
697        fidl::encoding::DefaultFuchsiaResourceDialect,
698    > {
699        CodecProxyInterface::r#set_dai_format(self, format)
700    }
701
702    /// Get the plug detect state via a hanging get. The driver will reply to the first
703    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
704    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
705    pub fn r#watch_plug_state(
706        &self,
707    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
708    {
709        CodecProxyInterface::r#watch_plug_state(self)
710    }
711}
712
713impl CodecProxyInterface for CodecProxy {
714    type GetHealthStateResponseFut =
715        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
716    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
717        fn _decode(
718            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
719        ) -> Result<HealthState, fidl::Error> {
720            let _response = fidl::client::decode_transaction_body::<
721                HealthGetHealthStateResponse,
722                fidl::encoding::DefaultFuchsiaResourceDialect,
723                0x4e146d6bca733a84,
724            >(_buf?)?;
725            Ok(_response.state)
726        }
727        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
728            (),
729            0x4e146d6bca733a84,
730            fidl::encoding::DynamicFlags::empty(),
731            _decode,
732        )
733    }
734
735    fn r#signal_processing_connect(
736        &self,
737        mut protocol: fidl::endpoints::ServerEnd<
738            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
739        >,
740    ) -> Result<(), fidl::Error> {
741        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
742            (protocol,),
743            0xa81907ce6066295,
744            fidl::encoding::DynamicFlags::empty(),
745        )
746    }
747
748    type ResetResponseFut =
749        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
750    fn r#reset(&self) -> Self::ResetResponseFut {
751        fn _decode(
752            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
753        ) -> Result<(), fidl::Error> {
754            let _response = fidl::client::decode_transaction_body::<
755                fidl::encoding::EmptyPayload,
756                fidl::encoding::DefaultFuchsiaResourceDialect,
757                0x50757ae579a7bd6b,
758            >(_buf?)?;
759            Ok(_response)
760        }
761        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
762            (),
763            0x50757ae579a7bd6b,
764            fidl::encoding::DynamicFlags::empty(),
765            _decode,
766        )
767    }
768
769    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
770        CodecProperties,
771        fidl::encoding::DefaultFuchsiaResourceDialect,
772    >;
773    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
774        fn _decode(
775            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
776        ) -> Result<CodecProperties, fidl::Error> {
777            let _response = fidl::client::decode_transaction_body::<
778                CodecGetPropertiesResponse,
779                fidl::encoding::DefaultFuchsiaResourceDialect,
780                0x7a0d138a6a1d9d90,
781            >(_buf?)?;
782            Ok(_response.properties)
783        }
784        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecProperties>(
785            (),
786            0x7a0d138a6a1d9d90,
787            fidl::encoding::DynamicFlags::empty(),
788            _decode,
789        )
790    }
791
792    type StopResponseFut =
793        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
794    fn r#stop(&self) -> Self::StopResponseFut {
795        fn _decode(
796            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
797        ) -> Result<i64, fidl::Error> {
798            let _response = fidl::client::decode_transaction_body::<
799                CodecStopResponse,
800                fidl::encoding::DefaultFuchsiaResourceDialect,
801                0x5c2e380df1332dbd,
802            >(_buf?)?;
803            Ok(_response.stop_time)
804        }
805        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
806            (),
807            0x5c2e380df1332dbd,
808            fidl::encoding::DynamicFlags::empty(),
809            _decode,
810        )
811    }
812
813    type StartResponseFut =
814        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
815    fn r#start(&self) -> Self::StartResponseFut {
816        fn _decode(
817            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
818        ) -> Result<i64, fidl::Error> {
819            let _response = fidl::client::decode_transaction_body::<
820                CodecStartResponse,
821                fidl::encoding::DefaultFuchsiaResourceDialect,
822                0x329cdacb286ab00,
823            >(_buf?)?;
824            Ok(_response.start_time)
825        }
826        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
827            (),
828            0x329cdacb286ab00,
829            fidl::encoding::DynamicFlags::empty(),
830            _decode,
831        )
832    }
833
834    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
835        CodecGetDaiFormatsResult,
836        fidl::encoding::DefaultFuchsiaResourceDialect,
837    >;
838    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
839        fn _decode(
840            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
841        ) -> Result<CodecGetDaiFormatsResult, fidl::Error> {
842            let _response = fidl::client::decode_transaction_body::<
843                fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>,
844                fidl::encoding::DefaultFuchsiaResourceDialect,
845                0xf8bbc46b4ba6a52,
846            >(_buf?)?;
847            Ok(_response.map(|x| x.formats))
848        }
849        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecGetDaiFormatsResult>(
850            (),
851            0xf8bbc46b4ba6a52,
852            fidl::encoding::DynamicFlags::empty(),
853            _decode,
854        )
855    }
856
857    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
858        CodecSetDaiFormatResult,
859        fidl::encoding::DefaultFuchsiaResourceDialect,
860    >;
861    fn r#set_dai_format(&self, mut format: &DaiFormat) -> Self::SetDaiFormatResponseFut {
862        fn _decode(
863            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
864        ) -> Result<CodecSetDaiFormatResult, fidl::Error> {
865            let _response = fidl::client::decode_transaction_body::<
866                fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>,
867                fidl::encoding::DefaultFuchsiaResourceDialect,
868                0x2f829df9e5a7a1ea,
869            >(_buf?)?;
870            Ok(_response.map(|x| x.state))
871        }
872        self.client.send_query_and_decode::<CodecSetDaiFormatRequest, CodecSetDaiFormatResult>(
873            (format,),
874            0x2f829df9e5a7a1ea,
875            fidl::encoding::DynamicFlags::empty(),
876            _decode,
877        )
878    }
879
880    type WatchPlugStateResponseFut =
881        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
882    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
883        fn _decode(
884            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
885        ) -> Result<PlugState, fidl::Error> {
886            let _response = fidl::client::decode_transaction_body::<
887                CodecWatchPlugStateResponse,
888                fidl::encoding::DefaultFuchsiaResourceDialect,
889                0x182b87f935ca7326,
890            >(_buf?)?;
891            Ok(_response.plug_state)
892        }
893        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
894            (),
895            0x182b87f935ca7326,
896            fidl::encoding::DynamicFlags::empty(),
897            _decode,
898        )
899    }
900}
901
902pub struct CodecEventStream {
903    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
904}
905
906impl std::marker::Unpin for CodecEventStream {}
907
908impl futures::stream::FusedStream for CodecEventStream {
909    fn is_terminated(&self) -> bool {
910        self.event_receiver.is_terminated()
911    }
912}
913
914impl futures::Stream for CodecEventStream {
915    type Item = Result<CodecEvent, fidl::Error>;
916
917    fn poll_next(
918        mut self: std::pin::Pin<&mut Self>,
919        cx: &mut std::task::Context<'_>,
920    ) -> std::task::Poll<Option<Self::Item>> {
921        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
922            &mut self.event_receiver,
923            cx
924        )?) {
925            Some(buf) => std::task::Poll::Ready(Some(CodecEvent::decode(buf))),
926            None => std::task::Poll::Ready(None),
927        }
928    }
929}
930
931#[derive(Debug)]
932pub enum CodecEvent {}
933
934impl CodecEvent {
935    /// Decodes a message buffer as a [`CodecEvent`].
936    fn decode(
937        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
938    ) -> Result<CodecEvent, fidl::Error> {
939        let (bytes, _handles) = buf.split_mut();
940        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
941        debug_assert_eq!(tx_header.tx_id, 0);
942        match tx_header.ordinal {
943            _ => Err(fidl::Error::UnknownOrdinal {
944                ordinal: tx_header.ordinal,
945                protocol_name: <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
946            }),
947        }
948    }
949}
950
951/// A Stream of incoming requests for fuchsia.hardware.audio/Codec.
952pub struct CodecRequestStream {
953    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
954    is_terminated: bool,
955}
956
957impl std::marker::Unpin for CodecRequestStream {}
958
959impl futures::stream::FusedStream for CodecRequestStream {
960    fn is_terminated(&self) -> bool {
961        self.is_terminated
962    }
963}
964
965impl fidl::endpoints::RequestStream for CodecRequestStream {
966    type Protocol = CodecMarker;
967    type ControlHandle = CodecControlHandle;
968
969    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
970        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
971    }
972
973    fn control_handle(&self) -> Self::ControlHandle {
974        CodecControlHandle { inner: self.inner.clone() }
975    }
976
977    fn into_inner(
978        self,
979    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
980    {
981        (self.inner, self.is_terminated)
982    }
983
984    fn from_inner(
985        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
986        is_terminated: bool,
987    ) -> Self {
988        Self { inner, is_terminated }
989    }
990}
991
992impl futures::Stream for CodecRequestStream {
993    type Item = Result<CodecRequest, fidl::Error>;
994
995    fn poll_next(
996        mut self: std::pin::Pin<&mut Self>,
997        cx: &mut std::task::Context<'_>,
998    ) -> std::task::Poll<Option<Self::Item>> {
999        let this = &mut *self;
1000        if this.inner.check_shutdown(cx) {
1001            this.is_terminated = true;
1002            return std::task::Poll::Ready(None);
1003        }
1004        if this.is_terminated {
1005            panic!("polled CodecRequestStream after completion");
1006        }
1007        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1008            |bytes, handles| {
1009                match this.inner.channel().read_etc(cx, bytes, handles) {
1010                    std::task::Poll::Ready(Ok(())) => {}
1011                    std::task::Poll::Pending => return std::task::Poll::Pending,
1012                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1013                        this.is_terminated = true;
1014                        return std::task::Poll::Ready(None);
1015                    }
1016                    std::task::Poll::Ready(Err(e)) => {
1017                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1018                            e.into(),
1019                        ))));
1020                    }
1021                }
1022
1023                // A message has been received from the channel
1024                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1025
1026                std::task::Poll::Ready(Some(match header.ordinal {
1027                    0x4e146d6bca733a84 => {
1028                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1029                        let mut req = fidl::new_empty!(
1030                            fidl::encoding::EmptyPayload,
1031                            fidl::encoding::DefaultFuchsiaResourceDialect
1032                        );
1033                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1034                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1035                        Ok(CodecRequest::GetHealthState {
1036                            responder: CodecGetHealthStateResponder {
1037                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1038                                tx_id: header.tx_id,
1039                            },
1040                        })
1041                    }
1042                    0xa81907ce6066295 => {
1043                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1044                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1045                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1046                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1047                        Ok(CodecRequest::SignalProcessingConnect {
1048                            protocol: req.protocol,
1049
1050                            control_handle,
1051                        })
1052                    }
1053                    0x50757ae579a7bd6b => {
1054                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1055                        let mut req = fidl::new_empty!(
1056                            fidl::encoding::EmptyPayload,
1057                            fidl::encoding::DefaultFuchsiaResourceDialect
1058                        );
1059                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1060                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1061                        Ok(CodecRequest::Reset {
1062                            responder: CodecResetResponder {
1063                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1064                                tx_id: header.tx_id,
1065                            },
1066                        })
1067                    }
1068                    0x7a0d138a6a1d9d90 => {
1069                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1070                        let mut req = fidl::new_empty!(
1071                            fidl::encoding::EmptyPayload,
1072                            fidl::encoding::DefaultFuchsiaResourceDialect
1073                        );
1074                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1075                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1076                        Ok(CodecRequest::GetProperties {
1077                            responder: CodecGetPropertiesResponder {
1078                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1079                                tx_id: header.tx_id,
1080                            },
1081                        })
1082                    }
1083                    0x5c2e380df1332dbd => {
1084                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1085                        let mut req = fidl::new_empty!(
1086                            fidl::encoding::EmptyPayload,
1087                            fidl::encoding::DefaultFuchsiaResourceDialect
1088                        );
1089                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1090                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1091                        Ok(CodecRequest::Stop {
1092                            responder: CodecStopResponder {
1093                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1094                                tx_id: header.tx_id,
1095                            },
1096                        })
1097                    }
1098                    0x329cdacb286ab00 => {
1099                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1100                        let mut req = fidl::new_empty!(
1101                            fidl::encoding::EmptyPayload,
1102                            fidl::encoding::DefaultFuchsiaResourceDialect
1103                        );
1104                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1105                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1106                        Ok(CodecRequest::Start {
1107                            responder: CodecStartResponder {
1108                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1109                                tx_id: header.tx_id,
1110                            },
1111                        })
1112                    }
1113                    0xf8bbc46b4ba6a52 => {
1114                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1115                        let mut req = fidl::new_empty!(
1116                            fidl::encoding::EmptyPayload,
1117                            fidl::encoding::DefaultFuchsiaResourceDialect
1118                        );
1119                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1120                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1121                        Ok(CodecRequest::GetDaiFormats {
1122                            responder: CodecGetDaiFormatsResponder {
1123                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1124                                tx_id: header.tx_id,
1125                            },
1126                        })
1127                    }
1128                    0x2f829df9e5a7a1ea => {
1129                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1130                        let mut req = fidl::new_empty!(
1131                            CodecSetDaiFormatRequest,
1132                            fidl::encoding::DefaultFuchsiaResourceDialect
1133                        );
1134                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
1135                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1136                        Ok(CodecRequest::SetDaiFormat {
1137                            format: req.format,
1138
1139                            responder: CodecSetDaiFormatResponder {
1140                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1141                                tx_id: header.tx_id,
1142                            },
1143                        })
1144                    }
1145                    0x182b87f935ca7326 => {
1146                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1147                        let mut req = fidl::new_empty!(
1148                            fidl::encoding::EmptyPayload,
1149                            fidl::encoding::DefaultFuchsiaResourceDialect
1150                        );
1151                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1152                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1153                        Ok(CodecRequest::WatchPlugState {
1154                            responder: CodecWatchPlugStateResponder {
1155                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1156                                tx_id: header.tx_id,
1157                            },
1158                        })
1159                    }
1160                    _ => Err(fidl::Error::UnknownOrdinal {
1161                        ordinal: header.ordinal,
1162                        protocol_name: <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1163                    }),
1164                }))
1165            },
1166        )
1167    }
1168}
1169
1170/// For an overview see
1171/// [[Audio Codec Interface]](https://fuchsia.dev/fuchsia-src/development/audio/drivers/codec).
1172/// # Deprecation
1173///
1174/// Not supported anymore, instead use an
1175/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
1176/// with one DAI and no Ring Buffer, see
1177/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
1178#[derive(Debug)]
1179pub enum CodecRequest {
1180    /// Retrieves top level health state.
1181    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
1182    GetHealthState { responder: CodecGetHealthStateResponder },
1183    /// Connect to a `SignalProcessing` protocol.
1184    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
1185    /// the maximum number of connections have already been created, for instance one, then the
1186    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
1187    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
1188    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
1189    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
1190    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
1191    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
1192    /// is intended to be composed, and hence the more verbose name allows differentiation and
1193    /// improved clarity.
1194    SignalProcessingConnect {
1195        protocol: fidl::endpoints::ServerEnd<
1196            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1197        >,
1198        control_handle: CodecControlHandle,
1199    },
1200    /// Resets the codec.
1201    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
1202    /// codec it will close the codec protocol channel, in this case the client may obtain a new
1203    /// codec protocol channel and retry.
1204    Reset { responder: CodecResetResponder },
1205    /// Retrieves top level static properties.
1206    GetProperties { responder: CodecGetPropertiesResponder },
1207    /// Stops the codec operation.
1208    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
1209    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
1210    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
1211    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
1212    /// in the CLOCK_MONOTONIC timeline.
1213    /// If the driver cannot successfully configure the codec to stop, it will close the codec
1214    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
1215    Stop { responder: CodecStopResponder },
1216    /// Start/Re-start the codec operation.
1217    /// `Start` returns when configuring the codec to start is completed. This method does not wait
1218    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
1219    /// into account), nor is any such delay reflected in the returned `start_time`.
1220    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
1221    /// in the CLOCK_MONOTONIC timeline.
1222    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
1223    /// in which case the client may obtain a new codec protocol channel and retry.
1224    Start { responder: CodecStartResponder },
1225    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
1226    /// may reply with an error status and the controller may retry at a later time.
1227    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
1228    /// combinations of the parameters in DaiSupportedFormats may be supported.
1229    GetDaiFormats { responder: CodecGetDaiFormatsResponder },
1230    /// Sets the DAI format to be used in the interface between the controller and codec.
1231    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
1232    SetDaiFormat { format: DaiFormat, responder: CodecSetDaiFormatResponder },
1233    /// Get the plug detect state via a hanging get. The driver will reply to the first
1234    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
1235    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
1236    WatchPlugState { responder: CodecWatchPlugStateResponder },
1237}
1238
1239impl CodecRequest {
1240    #[allow(irrefutable_let_patterns)]
1241    pub fn into_get_health_state(self) -> Option<(CodecGetHealthStateResponder)> {
1242        if let CodecRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
1243    }
1244
1245    #[allow(irrefutable_let_patterns)]
1246    pub fn into_signal_processing_connect(
1247        self,
1248    ) -> Option<(
1249        fidl::endpoints::ServerEnd<
1250            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1251        >,
1252        CodecControlHandle,
1253    )> {
1254        if let CodecRequest::SignalProcessingConnect { protocol, control_handle } = self {
1255            Some((protocol, control_handle))
1256        } else {
1257            None
1258        }
1259    }
1260
1261    #[allow(irrefutable_let_patterns)]
1262    pub fn into_reset(self) -> Option<(CodecResetResponder)> {
1263        if let CodecRequest::Reset { responder } = self { Some((responder)) } else { None }
1264    }
1265
1266    #[allow(irrefutable_let_patterns)]
1267    pub fn into_get_properties(self) -> Option<(CodecGetPropertiesResponder)> {
1268        if let CodecRequest::GetProperties { responder } = self { Some((responder)) } else { None }
1269    }
1270
1271    #[allow(irrefutable_let_patterns)]
1272    pub fn into_stop(self) -> Option<(CodecStopResponder)> {
1273        if let CodecRequest::Stop { responder } = self { Some((responder)) } else { None }
1274    }
1275
1276    #[allow(irrefutable_let_patterns)]
1277    pub fn into_start(self) -> Option<(CodecStartResponder)> {
1278        if let CodecRequest::Start { responder } = self { Some((responder)) } else { None }
1279    }
1280
1281    #[allow(irrefutable_let_patterns)]
1282    pub fn into_get_dai_formats(self) -> Option<(CodecGetDaiFormatsResponder)> {
1283        if let CodecRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
1284    }
1285
1286    #[allow(irrefutable_let_patterns)]
1287    pub fn into_set_dai_format(self) -> Option<(DaiFormat, CodecSetDaiFormatResponder)> {
1288        if let CodecRequest::SetDaiFormat { format, responder } = self {
1289            Some((format, responder))
1290        } else {
1291            None
1292        }
1293    }
1294
1295    #[allow(irrefutable_let_patterns)]
1296    pub fn into_watch_plug_state(self) -> Option<(CodecWatchPlugStateResponder)> {
1297        if let CodecRequest::WatchPlugState { responder } = self { Some((responder)) } else { None }
1298    }
1299
1300    /// Name of the method defined in FIDL
1301    pub fn method_name(&self) -> &'static str {
1302        match *self {
1303            CodecRequest::GetHealthState { .. } => "get_health_state",
1304            CodecRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
1305            CodecRequest::Reset { .. } => "reset",
1306            CodecRequest::GetProperties { .. } => "get_properties",
1307            CodecRequest::Stop { .. } => "stop",
1308            CodecRequest::Start { .. } => "start",
1309            CodecRequest::GetDaiFormats { .. } => "get_dai_formats",
1310            CodecRequest::SetDaiFormat { .. } => "set_dai_format",
1311            CodecRequest::WatchPlugState { .. } => "watch_plug_state",
1312        }
1313    }
1314}
1315
1316#[derive(Debug, Clone)]
1317pub struct CodecControlHandle {
1318    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1319}
1320
1321impl fidl::endpoints::ControlHandle for CodecControlHandle {
1322    fn shutdown(&self) {
1323        self.inner.shutdown()
1324    }
1325
1326    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1327        self.inner.shutdown_with_epitaph(status)
1328    }
1329
1330    fn is_closed(&self) -> bool {
1331        self.inner.channel().is_closed()
1332    }
1333    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1334        self.inner.channel().on_closed()
1335    }
1336
1337    #[cfg(target_os = "fuchsia")]
1338    fn signal_peer(
1339        &self,
1340        clear_mask: zx::Signals,
1341        set_mask: zx::Signals,
1342    ) -> Result<(), zx_status::Status> {
1343        use fidl::Peered;
1344        self.inner.channel().signal_peer(clear_mask, set_mask)
1345    }
1346}
1347
1348impl CodecControlHandle {}
1349
1350#[must_use = "FIDL methods require a response to be sent"]
1351#[derive(Debug)]
1352pub struct CodecGetHealthStateResponder {
1353    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1354    tx_id: u32,
1355}
1356
1357/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1358/// if the responder is dropped without sending a response, so that the client
1359/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1360impl std::ops::Drop for CodecGetHealthStateResponder {
1361    fn drop(&mut self) {
1362        self.control_handle.shutdown();
1363        // Safety: drops once, never accessed again
1364        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1365    }
1366}
1367
1368impl fidl::endpoints::Responder for CodecGetHealthStateResponder {
1369    type ControlHandle = CodecControlHandle;
1370
1371    fn control_handle(&self) -> &CodecControlHandle {
1372        &self.control_handle
1373    }
1374
1375    fn drop_without_shutdown(mut self) {
1376        // Safety: drops once, never accessed again due to mem::forget
1377        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1378        // Prevent Drop from running (which would shut down the channel)
1379        std::mem::forget(self);
1380    }
1381}
1382
1383impl CodecGetHealthStateResponder {
1384    /// Sends a response to the FIDL transaction.
1385    ///
1386    /// Sets the channel to shutdown if an error occurs.
1387    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1388        let _result = self.send_raw(state);
1389        if _result.is_err() {
1390            self.control_handle.shutdown();
1391        }
1392        self.drop_without_shutdown();
1393        _result
1394    }
1395
1396    /// Similar to "send" but does not shutdown the channel if an error occurs.
1397    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1398        let _result = self.send_raw(state);
1399        self.drop_without_shutdown();
1400        _result
1401    }
1402
1403    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
1404        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
1405            (state,),
1406            self.tx_id,
1407            0x4e146d6bca733a84,
1408            fidl::encoding::DynamicFlags::empty(),
1409        )
1410    }
1411}
1412
1413#[must_use = "FIDL methods require a response to be sent"]
1414#[derive(Debug)]
1415pub struct CodecResetResponder {
1416    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1417    tx_id: u32,
1418}
1419
1420/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1421/// if the responder is dropped without sending a response, so that the client
1422/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1423impl std::ops::Drop for CodecResetResponder {
1424    fn drop(&mut self) {
1425        self.control_handle.shutdown();
1426        // Safety: drops once, never accessed again
1427        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1428    }
1429}
1430
1431impl fidl::endpoints::Responder for CodecResetResponder {
1432    type ControlHandle = CodecControlHandle;
1433
1434    fn control_handle(&self) -> &CodecControlHandle {
1435        &self.control_handle
1436    }
1437
1438    fn drop_without_shutdown(mut self) {
1439        // Safety: drops once, never accessed again due to mem::forget
1440        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1441        // Prevent Drop from running (which would shut down the channel)
1442        std::mem::forget(self);
1443    }
1444}
1445
1446impl CodecResetResponder {
1447    /// Sends a response to the FIDL transaction.
1448    ///
1449    /// Sets the channel to shutdown if an error occurs.
1450    pub fn send(self) -> Result<(), fidl::Error> {
1451        let _result = self.send_raw();
1452        if _result.is_err() {
1453            self.control_handle.shutdown();
1454        }
1455        self.drop_without_shutdown();
1456        _result
1457    }
1458
1459    /// Similar to "send" but does not shutdown the channel if an error occurs.
1460    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1461        let _result = self.send_raw();
1462        self.drop_without_shutdown();
1463        _result
1464    }
1465
1466    fn send_raw(&self) -> Result<(), fidl::Error> {
1467        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1468            (),
1469            self.tx_id,
1470            0x50757ae579a7bd6b,
1471            fidl::encoding::DynamicFlags::empty(),
1472        )
1473    }
1474}
1475
1476#[must_use = "FIDL methods require a response to be sent"]
1477#[derive(Debug)]
1478pub struct CodecGetPropertiesResponder {
1479    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1480    tx_id: u32,
1481}
1482
1483/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1484/// if the responder is dropped without sending a response, so that the client
1485/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1486impl std::ops::Drop for CodecGetPropertiesResponder {
1487    fn drop(&mut self) {
1488        self.control_handle.shutdown();
1489        // Safety: drops once, never accessed again
1490        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1491    }
1492}
1493
1494impl fidl::endpoints::Responder for CodecGetPropertiesResponder {
1495    type ControlHandle = CodecControlHandle;
1496
1497    fn control_handle(&self) -> &CodecControlHandle {
1498        &self.control_handle
1499    }
1500
1501    fn drop_without_shutdown(mut self) {
1502        // Safety: drops once, never accessed again due to mem::forget
1503        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1504        // Prevent Drop from running (which would shut down the channel)
1505        std::mem::forget(self);
1506    }
1507}
1508
1509impl CodecGetPropertiesResponder {
1510    /// Sends a response to the FIDL transaction.
1511    ///
1512    /// Sets the channel to shutdown if an error occurs.
1513    pub fn send(self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1514        let _result = self.send_raw(properties);
1515        if _result.is_err() {
1516            self.control_handle.shutdown();
1517        }
1518        self.drop_without_shutdown();
1519        _result
1520    }
1521
1522    /// Similar to "send" but does not shutdown the channel if an error occurs.
1523    pub fn send_no_shutdown_on_err(
1524        self,
1525        mut properties: &CodecProperties,
1526    ) -> Result<(), fidl::Error> {
1527        let _result = self.send_raw(properties);
1528        self.drop_without_shutdown();
1529        _result
1530    }
1531
1532    fn send_raw(&self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1533        self.control_handle.inner.send::<CodecGetPropertiesResponse>(
1534            (properties,),
1535            self.tx_id,
1536            0x7a0d138a6a1d9d90,
1537            fidl::encoding::DynamicFlags::empty(),
1538        )
1539    }
1540}
1541
1542#[must_use = "FIDL methods require a response to be sent"]
1543#[derive(Debug)]
1544pub struct CodecStopResponder {
1545    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1546    tx_id: u32,
1547}
1548
1549/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1550/// if the responder is dropped without sending a response, so that the client
1551/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1552impl std::ops::Drop for CodecStopResponder {
1553    fn drop(&mut self) {
1554        self.control_handle.shutdown();
1555        // Safety: drops once, never accessed again
1556        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1557    }
1558}
1559
1560impl fidl::endpoints::Responder for CodecStopResponder {
1561    type ControlHandle = CodecControlHandle;
1562
1563    fn control_handle(&self) -> &CodecControlHandle {
1564        &self.control_handle
1565    }
1566
1567    fn drop_without_shutdown(mut self) {
1568        // Safety: drops once, never accessed again due to mem::forget
1569        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1570        // Prevent Drop from running (which would shut down the channel)
1571        std::mem::forget(self);
1572    }
1573}
1574
1575impl CodecStopResponder {
1576    /// Sends a response to the FIDL transaction.
1577    ///
1578    /// Sets the channel to shutdown if an error occurs.
1579    pub fn send(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1580        let _result = self.send_raw(stop_time);
1581        if _result.is_err() {
1582            self.control_handle.shutdown();
1583        }
1584        self.drop_without_shutdown();
1585        _result
1586    }
1587
1588    /// Similar to "send" but does not shutdown the channel if an error occurs.
1589    pub fn send_no_shutdown_on_err(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1590        let _result = self.send_raw(stop_time);
1591        self.drop_without_shutdown();
1592        _result
1593    }
1594
1595    fn send_raw(&self, mut stop_time: i64) -> Result<(), fidl::Error> {
1596        self.control_handle.inner.send::<CodecStopResponse>(
1597            (stop_time,),
1598            self.tx_id,
1599            0x5c2e380df1332dbd,
1600            fidl::encoding::DynamicFlags::empty(),
1601        )
1602    }
1603}
1604
1605#[must_use = "FIDL methods require a response to be sent"]
1606#[derive(Debug)]
1607pub struct CodecStartResponder {
1608    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1609    tx_id: u32,
1610}
1611
1612/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1613/// if the responder is dropped without sending a response, so that the client
1614/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1615impl std::ops::Drop for CodecStartResponder {
1616    fn drop(&mut self) {
1617        self.control_handle.shutdown();
1618        // Safety: drops once, never accessed again
1619        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1620    }
1621}
1622
1623impl fidl::endpoints::Responder for CodecStartResponder {
1624    type ControlHandle = CodecControlHandle;
1625
1626    fn control_handle(&self) -> &CodecControlHandle {
1627        &self.control_handle
1628    }
1629
1630    fn drop_without_shutdown(mut self) {
1631        // Safety: drops once, never accessed again due to mem::forget
1632        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1633        // Prevent Drop from running (which would shut down the channel)
1634        std::mem::forget(self);
1635    }
1636}
1637
1638impl CodecStartResponder {
1639    /// Sends a response to the FIDL transaction.
1640    ///
1641    /// Sets the channel to shutdown if an error occurs.
1642    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
1643        let _result = self.send_raw(start_time);
1644        if _result.is_err() {
1645            self.control_handle.shutdown();
1646        }
1647        self.drop_without_shutdown();
1648        _result
1649    }
1650
1651    /// Similar to "send" but does not shutdown the channel if an error occurs.
1652    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
1653        let _result = self.send_raw(start_time);
1654        self.drop_without_shutdown();
1655        _result
1656    }
1657
1658    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
1659        self.control_handle.inner.send::<CodecStartResponse>(
1660            (start_time,),
1661            self.tx_id,
1662            0x329cdacb286ab00,
1663            fidl::encoding::DynamicFlags::empty(),
1664        )
1665    }
1666}
1667
1668#[must_use = "FIDL methods require a response to be sent"]
1669#[derive(Debug)]
1670pub struct CodecGetDaiFormatsResponder {
1671    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1672    tx_id: u32,
1673}
1674
1675/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1676/// if the responder is dropped without sending a response, so that the client
1677/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1678impl std::ops::Drop for CodecGetDaiFormatsResponder {
1679    fn drop(&mut self) {
1680        self.control_handle.shutdown();
1681        // Safety: drops once, never accessed again
1682        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1683    }
1684}
1685
1686impl fidl::endpoints::Responder for CodecGetDaiFormatsResponder {
1687    type ControlHandle = CodecControlHandle;
1688
1689    fn control_handle(&self) -> &CodecControlHandle {
1690        &self.control_handle
1691    }
1692
1693    fn drop_without_shutdown(mut self) {
1694        // Safety: drops once, never accessed again due to mem::forget
1695        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1696        // Prevent Drop from running (which would shut down the channel)
1697        std::mem::forget(self);
1698    }
1699}
1700
1701impl CodecGetDaiFormatsResponder {
1702    /// Sends a response to the FIDL transaction.
1703    ///
1704    /// Sets the channel to shutdown if an error occurs.
1705    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1706        let _result = self.send_raw(result);
1707        if _result.is_err() {
1708            self.control_handle.shutdown();
1709        }
1710        self.drop_without_shutdown();
1711        _result
1712    }
1713
1714    /// Similar to "send" but does not shutdown the channel if an error occurs.
1715    pub fn send_no_shutdown_on_err(
1716        self,
1717        mut result: Result<&[DaiSupportedFormats], i32>,
1718    ) -> Result<(), fidl::Error> {
1719        let _result = self.send_raw(result);
1720        self.drop_without_shutdown();
1721        _result
1722    }
1723
1724    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1725        self.control_handle
1726            .inner
1727            .send::<fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>>(
1728                result.map(|formats| (formats,)),
1729                self.tx_id,
1730                0xf8bbc46b4ba6a52,
1731                fidl::encoding::DynamicFlags::empty(),
1732            )
1733    }
1734}
1735
1736#[must_use = "FIDL methods require a response to be sent"]
1737#[derive(Debug)]
1738pub struct CodecSetDaiFormatResponder {
1739    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1740    tx_id: u32,
1741}
1742
1743/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1744/// if the responder is dropped without sending a response, so that the client
1745/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1746impl std::ops::Drop for CodecSetDaiFormatResponder {
1747    fn drop(&mut self) {
1748        self.control_handle.shutdown();
1749        // Safety: drops once, never accessed again
1750        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1751    }
1752}
1753
1754impl fidl::endpoints::Responder for CodecSetDaiFormatResponder {
1755    type ControlHandle = CodecControlHandle;
1756
1757    fn control_handle(&self) -> &CodecControlHandle {
1758        &self.control_handle
1759    }
1760
1761    fn drop_without_shutdown(mut self) {
1762        // Safety: drops once, never accessed again due to mem::forget
1763        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1764        // Prevent Drop from running (which would shut down the channel)
1765        std::mem::forget(self);
1766    }
1767}
1768
1769impl CodecSetDaiFormatResponder {
1770    /// Sends a response to the FIDL transaction.
1771    ///
1772    /// Sets the channel to shutdown if an error occurs.
1773    pub fn send(self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1774        let _result = self.send_raw(result);
1775        if _result.is_err() {
1776            self.control_handle.shutdown();
1777        }
1778        self.drop_without_shutdown();
1779        _result
1780    }
1781
1782    /// Similar to "send" but does not shutdown the channel if an error occurs.
1783    pub fn send_no_shutdown_on_err(
1784        self,
1785        mut result: Result<&CodecFormatInfo, i32>,
1786    ) -> Result<(), fidl::Error> {
1787        let _result = self.send_raw(result);
1788        self.drop_without_shutdown();
1789        _result
1790    }
1791
1792    fn send_raw(&self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1793        self.control_handle
1794            .inner
1795            .send::<fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>>(
1796                result.map(|state| (state,)),
1797                self.tx_id,
1798                0x2f829df9e5a7a1ea,
1799                fidl::encoding::DynamicFlags::empty(),
1800            )
1801    }
1802}
1803
1804#[must_use = "FIDL methods require a response to be sent"]
1805#[derive(Debug)]
1806pub struct CodecWatchPlugStateResponder {
1807    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1808    tx_id: u32,
1809}
1810
1811/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1812/// if the responder is dropped without sending a response, so that the client
1813/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1814impl std::ops::Drop for CodecWatchPlugStateResponder {
1815    fn drop(&mut self) {
1816        self.control_handle.shutdown();
1817        // Safety: drops once, never accessed again
1818        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1819    }
1820}
1821
1822impl fidl::endpoints::Responder for CodecWatchPlugStateResponder {
1823    type ControlHandle = CodecControlHandle;
1824
1825    fn control_handle(&self) -> &CodecControlHandle {
1826        &self.control_handle
1827    }
1828
1829    fn drop_without_shutdown(mut self) {
1830        // Safety: drops once, never accessed again due to mem::forget
1831        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1832        // Prevent Drop from running (which would shut down the channel)
1833        std::mem::forget(self);
1834    }
1835}
1836
1837impl CodecWatchPlugStateResponder {
1838    /// Sends a response to the FIDL transaction.
1839    ///
1840    /// Sets the channel to shutdown if an error occurs.
1841    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1842        let _result = self.send_raw(plug_state);
1843        if _result.is_err() {
1844            self.control_handle.shutdown();
1845        }
1846        self.drop_without_shutdown();
1847        _result
1848    }
1849
1850    /// Similar to "send" but does not shutdown the channel if an error occurs.
1851    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1852        let _result = self.send_raw(plug_state);
1853        self.drop_without_shutdown();
1854        _result
1855    }
1856
1857    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1858        self.control_handle.inner.send::<CodecWatchPlugStateResponse>(
1859            (plug_state,),
1860            self.tx_id,
1861            0x182b87f935ca7326,
1862            fidl::encoding::DynamicFlags::empty(),
1863        )
1864    }
1865}
1866
1867#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1868pub struct CodecConnectorMarker;
1869
1870impl fidl::endpoints::ProtocolMarker for CodecConnectorMarker {
1871    type Proxy = CodecConnectorProxy;
1872    type RequestStream = CodecConnectorRequestStream;
1873    #[cfg(target_os = "fuchsia")]
1874    type SynchronousProxy = CodecConnectorSynchronousProxy;
1875
1876    const DEBUG_NAME: &'static str = "(anonymous) CodecConnector";
1877}
1878
1879pub trait CodecConnectorProxyInterface: Send + Sync {
1880    fn r#connect(
1881        &self,
1882        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1883    ) -> Result<(), fidl::Error>;
1884}
1885#[derive(Debug)]
1886#[cfg(target_os = "fuchsia")]
1887pub struct CodecConnectorSynchronousProxy {
1888    client: fidl::client::sync::Client,
1889}
1890
1891#[cfg(target_os = "fuchsia")]
1892impl fidl::endpoints::SynchronousProxy for CodecConnectorSynchronousProxy {
1893    type Proxy = CodecConnectorProxy;
1894    type Protocol = CodecConnectorMarker;
1895
1896    fn from_channel(inner: fidl::Channel) -> Self {
1897        Self::new(inner)
1898    }
1899
1900    fn into_channel(self) -> fidl::Channel {
1901        self.client.into_channel()
1902    }
1903
1904    fn as_channel(&self) -> &fidl::Channel {
1905        self.client.as_channel()
1906    }
1907}
1908
1909#[cfg(target_os = "fuchsia")]
1910impl CodecConnectorSynchronousProxy {
1911    pub fn new(channel: fidl::Channel) -> Self {
1912        Self { client: fidl::client::sync::Client::new(channel) }
1913    }
1914
1915    pub fn into_channel(self) -> fidl::Channel {
1916        self.client.into_channel()
1917    }
1918
1919    /// Waits until an event arrives and returns it. It is safe for other
1920    /// threads to make concurrent requests while waiting for an event.
1921    pub fn wait_for_event(
1922        &self,
1923        deadline: zx::MonotonicInstant,
1924    ) -> Result<CodecConnectorEvent, fidl::Error> {
1925        CodecConnectorEvent::decode(self.client.wait_for_event::<CodecConnectorMarker>(deadline)?)
1926    }
1927
1928    /// Connect to a Codec protocol server.
1929    /// This indirection into the Codec protocol allows us to support independent codec client
1930    /// connections.
1931    pub fn r#connect(
1932        &self,
1933        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1934    ) -> Result<(), fidl::Error> {
1935        self.client.send::<CodecConnectorConnectRequest>(
1936            (codec_protocol,),
1937            0x1413f551544026c9,
1938            fidl::encoding::DynamicFlags::empty(),
1939        )
1940    }
1941}
1942
1943#[cfg(target_os = "fuchsia")]
1944impl From<CodecConnectorSynchronousProxy> for zx::NullableHandle {
1945    fn from(value: CodecConnectorSynchronousProxy) -> Self {
1946        value.into_channel().into()
1947    }
1948}
1949
1950#[cfg(target_os = "fuchsia")]
1951impl From<fidl::Channel> for CodecConnectorSynchronousProxy {
1952    fn from(value: fidl::Channel) -> Self {
1953        Self::new(value)
1954    }
1955}
1956
1957#[cfg(target_os = "fuchsia")]
1958impl fidl::endpoints::FromClient for CodecConnectorSynchronousProxy {
1959    type Protocol = CodecConnectorMarker;
1960
1961    fn from_client(value: fidl::endpoints::ClientEnd<CodecConnectorMarker>) -> Self {
1962        Self::new(value.into_channel())
1963    }
1964}
1965
1966#[derive(Debug, Clone)]
1967pub struct CodecConnectorProxy {
1968    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1969}
1970
1971impl fidl::endpoints::Proxy for CodecConnectorProxy {
1972    type Protocol = CodecConnectorMarker;
1973
1974    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1975        Self::new(inner)
1976    }
1977
1978    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1979        self.client.into_channel().map_err(|client| Self { client })
1980    }
1981
1982    fn as_channel(&self) -> &::fidl::AsyncChannel {
1983        self.client.as_channel()
1984    }
1985}
1986
1987impl CodecConnectorProxy {
1988    /// Create a new Proxy for fuchsia.hardware.audio/CodecConnector.
1989    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1990        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1991        Self { client: fidl::client::Client::new(channel, protocol_name) }
1992    }
1993
1994    /// Get a Stream of events from the remote end of the protocol.
1995    ///
1996    /// # Panics
1997    ///
1998    /// Panics if the event stream was already taken.
1999    pub fn take_event_stream(&self) -> CodecConnectorEventStream {
2000        CodecConnectorEventStream { event_receiver: self.client.take_event_receiver() }
2001    }
2002
2003    /// Connect to a Codec protocol server.
2004    /// This indirection into the Codec protocol allows us to support independent codec client
2005    /// connections.
2006    pub fn r#connect(
2007        &self,
2008        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2009    ) -> Result<(), fidl::Error> {
2010        CodecConnectorProxyInterface::r#connect(self, codec_protocol)
2011    }
2012}
2013
2014impl CodecConnectorProxyInterface for CodecConnectorProxy {
2015    fn r#connect(
2016        &self,
2017        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2018    ) -> Result<(), fidl::Error> {
2019        self.client.send::<CodecConnectorConnectRequest>(
2020            (codec_protocol,),
2021            0x1413f551544026c9,
2022            fidl::encoding::DynamicFlags::empty(),
2023        )
2024    }
2025}
2026
2027pub struct CodecConnectorEventStream {
2028    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2029}
2030
2031impl std::marker::Unpin for CodecConnectorEventStream {}
2032
2033impl futures::stream::FusedStream for CodecConnectorEventStream {
2034    fn is_terminated(&self) -> bool {
2035        self.event_receiver.is_terminated()
2036    }
2037}
2038
2039impl futures::Stream for CodecConnectorEventStream {
2040    type Item = Result<CodecConnectorEvent, fidl::Error>;
2041
2042    fn poll_next(
2043        mut self: std::pin::Pin<&mut Self>,
2044        cx: &mut std::task::Context<'_>,
2045    ) -> std::task::Poll<Option<Self::Item>> {
2046        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2047            &mut self.event_receiver,
2048            cx
2049        )?) {
2050            Some(buf) => std::task::Poll::Ready(Some(CodecConnectorEvent::decode(buf))),
2051            None => std::task::Poll::Ready(None),
2052        }
2053    }
2054}
2055
2056#[derive(Debug)]
2057pub enum CodecConnectorEvent {}
2058
2059impl CodecConnectorEvent {
2060    /// Decodes a message buffer as a [`CodecConnectorEvent`].
2061    fn decode(
2062        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2063    ) -> Result<CodecConnectorEvent, fidl::Error> {
2064        let (bytes, _handles) = buf.split_mut();
2065        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2066        debug_assert_eq!(tx_header.tx_id, 0);
2067        match tx_header.ordinal {
2068            _ => Err(fidl::Error::UnknownOrdinal {
2069                ordinal: tx_header.ordinal,
2070                protocol_name:
2071                    <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2072            }),
2073        }
2074    }
2075}
2076
2077/// A Stream of incoming requests for fuchsia.hardware.audio/CodecConnector.
2078pub struct CodecConnectorRequestStream {
2079    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2080    is_terminated: bool,
2081}
2082
2083impl std::marker::Unpin for CodecConnectorRequestStream {}
2084
2085impl futures::stream::FusedStream for CodecConnectorRequestStream {
2086    fn is_terminated(&self) -> bool {
2087        self.is_terminated
2088    }
2089}
2090
2091impl fidl::endpoints::RequestStream for CodecConnectorRequestStream {
2092    type Protocol = CodecConnectorMarker;
2093    type ControlHandle = CodecConnectorControlHandle;
2094
2095    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2096        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2097    }
2098
2099    fn control_handle(&self) -> Self::ControlHandle {
2100        CodecConnectorControlHandle { inner: self.inner.clone() }
2101    }
2102
2103    fn into_inner(
2104        self,
2105    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2106    {
2107        (self.inner, self.is_terminated)
2108    }
2109
2110    fn from_inner(
2111        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2112        is_terminated: bool,
2113    ) -> Self {
2114        Self { inner, is_terminated }
2115    }
2116}
2117
2118impl futures::Stream for CodecConnectorRequestStream {
2119    type Item = Result<CodecConnectorRequest, fidl::Error>;
2120
2121    fn poll_next(
2122        mut self: std::pin::Pin<&mut Self>,
2123        cx: &mut std::task::Context<'_>,
2124    ) -> std::task::Poll<Option<Self::Item>> {
2125        let this = &mut *self;
2126        if this.inner.check_shutdown(cx) {
2127            this.is_terminated = true;
2128            return std::task::Poll::Ready(None);
2129        }
2130        if this.is_terminated {
2131            panic!("polled CodecConnectorRequestStream after completion");
2132        }
2133        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2134            |bytes, handles| {
2135                match this.inner.channel().read_etc(cx, bytes, handles) {
2136                    std::task::Poll::Ready(Ok(())) => {}
2137                    std::task::Poll::Pending => return std::task::Poll::Pending,
2138                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2139                        this.is_terminated = true;
2140                        return std::task::Poll::Ready(None);
2141                    }
2142                    std::task::Poll::Ready(Err(e)) => {
2143                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2144                            e.into(),
2145                        ))));
2146                    }
2147                }
2148
2149                // A message has been received from the channel
2150                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2151
2152                std::task::Poll::Ready(Some(match header.ordinal {
2153                    0x1413f551544026c9 => {
2154                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2155                        let mut req = fidl::new_empty!(
2156                            CodecConnectorConnectRequest,
2157                            fidl::encoding::DefaultFuchsiaResourceDialect
2158                        );
2159                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2160                        let control_handle =
2161                            CodecConnectorControlHandle { inner: this.inner.clone() };
2162                        Ok(CodecConnectorRequest::Connect {
2163                            codec_protocol: req.codec_protocol,
2164
2165                            control_handle,
2166                        })
2167                    }
2168                    _ => Err(fidl::Error::UnknownOrdinal {
2169                        ordinal: header.ordinal,
2170                        protocol_name:
2171                            <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2172                    }),
2173                }))
2174            },
2175        )
2176    }
2177}
2178
2179/// For an overview of the Codec protocols see
2180/// [Codec Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_codec.md)
2181/// # Deprecation
2182///
2183/// Not supported anymore, instead use an
2184/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
2185/// with one DAI and no Ring Buffer, see
2186/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
2187#[derive(Debug)]
2188pub enum CodecConnectorRequest {
2189    /// Connect to a Codec protocol server.
2190    /// This indirection into the Codec protocol allows us to support independent codec client
2191    /// connections.
2192    Connect {
2193        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2194        control_handle: CodecConnectorControlHandle,
2195    },
2196}
2197
2198impl CodecConnectorRequest {
2199    #[allow(irrefutable_let_patterns)]
2200    pub fn into_connect(
2201        self,
2202    ) -> Option<(fidl::endpoints::ServerEnd<CodecMarker>, CodecConnectorControlHandle)> {
2203        if let CodecConnectorRequest::Connect { codec_protocol, control_handle } = self {
2204            Some((codec_protocol, control_handle))
2205        } else {
2206            None
2207        }
2208    }
2209
2210    /// Name of the method defined in FIDL
2211    pub fn method_name(&self) -> &'static str {
2212        match *self {
2213            CodecConnectorRequest::Connect { .. } => "connect",
2214        }
2215    }
2216}
2217
2218#[derive(Debug, Clone)]
2219pub struct CodecConnectorControlHandle {
2220    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2221}
2222
2223impl fidl::endpoints::ControlHandle for CodecConnectorControlHandle {
2224    fn shutdown(&self) {
2225        self.inner.shutdown()
2226    }
2227
2228    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2229        self.inner.shutdown_with_epitaph(status)
2230    }
2231
2232    fn is_closed(&self) -> bool {
2233        self.inner.channel().is_closed()
2234    }
2235    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2236        self.inner.channel().on_closed()
2237    }
2238
2239    #[cfg(target_os = "fuchsia")]
2240    fn signal_peer(
2241        &self,
2242        clear_mask: zx::Signals,
2243        set_mask: zx::Signals,
2244    ) -> Result<(), zx_status::Status> {
2245        use fidl::Peered;
2246        self.inner.channel().signal_peer(clear_mask, set_mask)
2247    }
2248}
2249
2250impl CodecConnectorControlHandle {}
2251
2252#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2253pub struct CompositeMarker;
2254
2255impl fidl::endpoints::ProtocolMarker for CompositeMarker {
2256    type Proxy = CompositeProxy;
2257    type RequestStream = CompositeRequestStream;
2258    #[cfg(target_os = "fuchsia")]
2259    type SynchronousProxy = CompositeSynchronousProxy;
2260
2261    const DEBUG_NAME: &'static str = "(anonymous) Composite";
2262}
2263pub type CompositeResetResult = Result<(), DriverError>;
2264pub type CompositeGetRingBufferFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
2265pub type CompositeCreateRingBufferResult = Result<(), DriverError>;
2266pub type CompositeGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, DriverError>;
2267pub type CompositeSetDaiFormatResult = Result<(), DriverError>;
2268pub type CompositeGetPacketStreamFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
2269pub type CompositeCreatePacketStreamResult = Result<(), DriverError>;
2270
2271pub trait CompositeProxyInterface: Send + Sync {
2272    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
2273        + Send;
2274    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
2275    fn r#signal_processing_connect(
2276        &self,
2277        protocol: fidl::endpoints::ServerEnd<
2278            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2279        >,
2280    ) -> Result<(), fidl::Error>;
2281    type ResetResponseFut: std::future::Future<Output = Result<CompositeResetResult, fidl::Error>>
2282        + Send;
2283    fn r#reset(&self) -> Self::ResetResponseFut;
2284    type GetPropertiesResponseFut: std::future::Future<Output = Result<CompositeProperties, fidl::Error>>
2285        + Send;
2286    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
2287    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<CompositeGetRingBufferFormatsResult, fidl::Error>>
2288        + Send;
2289    fn r#get_ring_buffer_formats(
2290        &self,
2291        processing_element_id: u64,
2292    ) -> Self::GetRingBufferFormatsResponseFut;
2293    type CreateRingBufferResponseFut: std::future::Future<Output = Result<CompositeCreateRingBufferResult, fidl::Error>>
2294        + Send;
2295    fn r#create_ring_buffer(
2296        &self,
2297        processing_element_id: u64,
2298        format: &Format2,
2299        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2300    ) -> Self::CreateRingBufferResponseFut;
2301    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CompositeGetDaiFormatsResult, fidl::Error>>
2302        + Send;
2303    fn r#get_dai_formats(&self, processing_element_id: u64) -> Self::GetDaiFormatsResponseFut;
2304    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CompositeSetDaiFormatResult, fidl::Error>>
2305        + Send;
2306    fn r#set_dai_format(
2307        &self,
2308        processing_element_id: u64,
2309        format: &DaiFormat,
2310    ) -> Self::SetDaiFormatResponseFut;
2311    type GetPacketStreamFormatsResponseFut: std::future::Future<Output = Result<CompositeGetPacketStreamFormatsResult, fidl::Error>>
2312        + Send;
2313    fn r#get_packet_stream_formats(
2314        &self,
2315        processing_element_id: u64,
2316    ) -> Self::GetPacketStreamFormatsResponseFut;
2317    type CreatePacketStreamResponseFut: std::future::Future<Output = Result<CompositeCreatePacketStreamResult, fidl::Error>>
2318        + Send;
2319    fn r#create_packet_stream(
2320        &self,
2321        processing_element_id: u64,
2322        format: &Format2,
2323        packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
2324    ) -> Self::CreatePacketStreamResponseFut;
2325}
2326#[derive(Debug)]
2327#[cfg(target_os = "fuchsia")]
2328pub struct CompositeSynchronousProxy {
2329    client: fidl::client::sync::Client,
2330}
2331
2332#[cfg(target_os = "fuchsia")]
2333impl fidl::endpoints::SynchronousProxy for CompositeSynchronousProxy {
2334    type Proxy = CompositeProxy;
2335    type Protocol = CompositeMarker;
2336
2337    fn from_channel(inner: fidl::Channel) -> Self {
2338        Self::new(inner)
2339    }
2340
2341    fn into_channel(self) -> fidl::Channel {
2342        self.client.into_channel()
2343    }
2344
2345    fn as_channel(&self) -> &fidl::Channel {
2346        self.client.as_channel()
2347    }
2348}
2349
2350#[cfg(target_os = "fuchsia")]
2351impl CompositeSynchronousProxy {
2352    pub fn new(channel: fidl::Channel) -> Self {
2353        Self { client: fidl::client::sync::Client::new(channel) }
2354    }
2355
2356    pub fn into_channel(self) -> fidl::Channel {
2357        self.client.into_channel()
2358    }
2359
2360    /// Waits until an event arrives and returns it. It is safe for other
2361    /// threads to make concurrent requests while waiting for an event.
2362    pub fn wait_for_event(
2363        &self,
2364        deadline: zx::MonotonicInstant,
2365    ) -> Result<CompositeEvent, fidl::Error> {
2366        CompositeEvent::decode(self.client.wait_for_event::<CompositeMarker>(deadline)?)
2367    }
2368
2369    /// Retrieves top level health state.
2370    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2371    pub fn r#get_health_state(
2372        &self,
2373        ___deadline: zx::MonotonicInstant,
2374    ) -> Result<HealthState, fidl::Error> {
2375        let _response = self.client.send_query::<
2376            fidl::encoding::EmptyPayload,
2377            HealthGetHealthStateResponse,
2378            CompositeMarker,
2379        >(
2380            (),
2381            0x4e146d6bca733a84,
2382            fidl::encoding::DynamicFlags::empty(),
2383            ___deadline,
2384        )?;
2385        Ok(_response.state)
2386    }
2387
2388    /// Connect to a `SignalProcessing` protocol.
2389    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2390    /// the maximum number of connections have already been created, for instance one, then the
2391    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2392    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2393    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2394    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2395    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2396    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2397    /// is intended to be composed, and hence the more verbose name allows differentiation and
2398    /// improved clarity.
2399    pub fn r#signal_processing_connect(
2400        &self,
2401        mut protocol: fidl::endpoints::ServerEnd<
2402            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2403        >,
2404    ) -> Result<(), fidl::Error> {
2405        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2406            (protocol,),
2407            0xa81907ce6066295,
2408            fidl::encoding::DynamicFlags::empty(),
2409        )
2410    }
2411
2412    /// Resets the hardware including all DAI interconnects and signal processing.
2413    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2414    ///
2415    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2416    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2417    /// any processing elements, and reconstruct any ring buffers.
2418    ///
2419    /// If the driver can't successfully reset the hardware, it will return an error and then close
2420    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2421    pub fn r#reset(
2422        &self,
2423        ___deadline: zx::MonotonicInstant,
2424    ) -> Result<CompositeResetResult, fidl::Error> {
2425        let _response = self.client.send_query::<
2426            fidl::encoding::EmptyPayload,
2427            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2428            CompositeMarker,
2429        >(
2430            (),
2431            0xac355fb98341996,
2432            fidl::encoding::DynamicFlags::FLEXIBLE,
2433            ___deadline,
2434        )?
2435        .into_result::<CompositeMarker>("reset")?;
2436        Ok(_response.map(|x| x))
2437    }
2438
2439    /// Retrieves top level static properties.
2440    pub fn r#get_properties(
2441        &self,
2442        ___deadline: zx::MonotonicInstant,
2443    ) -> Result<CompositeProperties, fidl::Error> {
2444        let _response = self.client.send_query::<
2445            fidl::encoding::EmptyPayload,
2446            fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>,
2447            CompositeMarker,
2448        >(
2449            (),
2450            0x31846fa0a459942b,
2451            fidl::encoding::DynamicFlags::FLEXIBLE,
2452            ___deadline,
2453        )?
2454        .into_result::<CompositeMarker>("get_properties")?;
2455        Ok(_response.properties)
2456    }
2457
2458    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2459    /// in the topology supported by this driver as returned by `GetElements` from
2460    /// fuchsia.hardware.audio.signalprocessing.
2461    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2462    /// client may retry at a later time.
2463    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2464    /// by `GetElements`.
2465    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2466    /// `RING_BUFFER`.
2467    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2468    /// the parameters in `SupportedFormats2` may be supported.
2469    /// The vector returned to the caller must contain at least one entry.
2470    pub fn r#get_ring_buffer_formats(
2471        &self,
2472        mut processing_element_id: u64,
2473        ___deadline: zx::MonotonicInstant,
2474    ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2475        let _response = self.client.send_query::<
2476            CompositeGetRingBufferFormatsRequest,
2477            fidl::encoding::FlexibleResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2478            CompositeMarker,
2479        >(
2480            (processing_element_id,),
2481            0x1d89b701b6816ac4,
2482            fidl::encoding::DynamicFlags::FLEXIBLE,
2483            ___deadline,
2484        )?
2485        .into_result::<CompositeMarker>("get_ring_buffer_formats")?;
2486        Ok(_response.map(|x| x.ring_buffer_formats))
2487    }
2488
2489    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2490    /// processing element specified by `processing_element_id`. The format is based on information
2491    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2492    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2493    /// audio buffer provided by the driver.
2494    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2495    /// by `GetElements`.
2496    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2497    /// `RING_BUFFER`.
2498    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2499    /// `format` is not supported.
2500    pub fn r#create_ring_buffer(
2501        &self,
2502        mut processing_element_id: u64,
2503        mut format: &Format2,
2504        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2505        ___deadline: zx::MonotonicInstant,
2506    ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2507        let _response = self.client.send_query::<
2508            CompositeCreateRingBufferRequest,
2509            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2510            CompositeMarker,
2511        >(
2512            (processing_element_id, format, ring_buffer,),
2513            0x28c5685f85262033,
2514            fidl::encoding::DynamicFlags::FLEXIBLE,
2515            ___deadline,
2516        )?
2517        .into_result::<CompositeMarker>("create_ring_buffer")?;
2518        Ok(_response.map(|x| x))
2519    }
2520
2521    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2522    /// in the topology supported by this driver as returned by `GetElements` from
2523    /// fuchsia.hardware.audio.signalprocessing.
2524    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2525    /// may retry at a later time.
2526    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2527    /// by `GetElements`.
2528    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2529    /// `DAI_INTERCONNECT`.
2530    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2531    /// the parameters in DaiSupportedFormats may be supported.
2532    /// The vector returned to the caller must contain at least one entry.
2533    pub fn r#get_dai_formats(
2534        &self,
2535        mut processing_element_id: u64,
2536        ___deadline: zx::MonotonicInstant,
2537    ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2538        let _response = self.client.send_query::<
2539            CompositeGetDaiFormatsRequest,
2540            fidl::encoding::FlexibleResultType<CompositeGetDaiFormatsResponse, DriverError>,
2541            CompositeMarker,
2542        >(
2543            (processing_element_id,),
2544            0x3cbeaed59c8f69b,
2545            fidl::encoding::DynamicFlags::FLEXIBLE,
2546            ___deadline,
2547        )?
2548        .into_result::<CompositeMarker>("get_dai_formats")?;
2549        Ok(_response.map(|x| x.dai_formats))
2550    }
2551
2552    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2553    /// processing element specified by `processing_element_id`. The format is based on information
2554    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2555    /// requirement.
2556    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2557    /// by `GetElements`.
2558    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2559    /// `DAI_INTERCONNECT`.
2560    pub fn r#set_dai_format(
2561        &self,
2562        mut processing_element_id: u64,
2563        mut format: &DaiFormat,
2564        ___deadline: zx::MonotonicInstant,
2565    ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2566        let _response = self.client.send_query::<
2567            CompositeSetDaiFormatRequest,
2568            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2569            CompositeMarker,
2570        >(
2571            (processing_element_id, format,),
2572            0x155acf5cc0dc8a84,
2573            fidl::encoding::DynamicFlags::FLEXIBLE,
2574            ___deadline,
2575        )?
2576        .into_result::<CompositeMarker>("set_dai_format")?;
2577        Ok(_response.map(|x| x))
2578    }
2579
2580    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2581    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2582    /// from fuchsia.hardware.audio.signalprocessing.
2583    ///
2584    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2585    /// client may retry this request at a later time.
2586    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2587    /// `GetElements`.
2588    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2589    /// `PACKET_STREAM`.
2590    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2591    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2592    /// combinations of the parameters in `SupportedFormats2` may be supported.
2593    /// The vector returned to the caller must contain at least one entry.
2594    pub fn r#get_packet_stream_formats(
2595        &self,
2596        mut processing_element_id: u64,
2597        ___deadline: zx::MonotonicInstant,
2598    ) -> Result<CompositeGetPacketStreamFormatsResult, fidl::Error> {
2599        let _response = self.client.send_query::<
2600            CompositeGetPacketStreamFormatsRequest,
2601            fidl::encoding::FlexibleResultType<CompositeGetPacketStreamFormatsResponse, DriverError>,
2602            CompositeMarker,
2603        >(
2604            (processing_element_id,),
2605            0x73cc47c6ad39bca7,
2606            fidl::encoding::DynamicFlags::FLEXIBLE,
2607            ___deadline,
2608        )?
2609        .into_result::<CompositeMarker>("get_packet_stream_formats")?;
2610        Ok(_response.map(|x| x.packet_stream_formats))
2611    }
2612
2613    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2614    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
2615    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
2616    /// the client, and any other requirement. The returned `packet_stream` channel is used to
2617    /// access and control the packet stream protocol served by the driver.
2618    ///
2619    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2620    /// `GetElements`.
2621    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2622    /// `PACKET_STREAM`.
2623    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2624    /// at this time, but it should be able to at some future time. This request can be retried.
2625    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2626    ///`format` is not supported.
2627    pub fn r#create_packet_stream(
2628        &self,
2629        mut processing_element_id: u64,
2630        mut format: &Format2,
2631        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
2632        ___deadline: zx::MonotonicInstant,
2633    ) -> Result<CompositeCreatePacketStreamResult, fidl::Error> {
2634        let _response = self.client.send_query::<
2635            CompositeCreatePacketStreamRequest,
2636            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2637            CompositeMarker,
2638        >(
2639            (processing_element_id, format, packet_stream_control,),
2640            0x50e8902b756c707c,
2641            fidl::encoding::DynamicFlags::FLEXIBLE,
2642            ___deadline,
2643        )?
2644        .into_result::<CompositeMarker>("create_packet_stream")?;
2645        Ok(_response.map(|x| x))
2646    }
2647}
2648
2649#[cfg(target_os = "fuchsia")]
2650impl From<CompositeSynchronousProxy> for zx::NullableHandle {
2651    fn from(value: CompositeSynchronousProxy) -> Self {
2652        value.into_channel().into()
2653    }
2654}
2655
2656#[cfg(target_os = "fuchsia")]
2657impl From<fidl::Channel> for CompositeSynchronousProxy {
2658    fn from(value: fidl::Channel) -> Self {
2659        Self::new(value)
2660    }
2661}
2662
2663#[cfg(target_os = "fuchsia")]
2664impl fidl::endpoints::FromClient for CompositeSynchronousProxy {
2665    type Protocol = CompositeMarker;
2666
2667    fn from_client(value: fidl::endpoints::ClientEnd<CompositeMarker>) -> Self {
2668        Self::new(value.into_channel())
2669    }
2670}
2671
2672#[derive(Debug, Clone)]
2673pub struct CompositeProxy {
2674    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2675}
2676
2677impl fidl::endpoints::Proxy for CompositeProxy {
2678    type Protocol = CompositeMarker;
2679
2680    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2681        Self::new(inner)
2682    }
2683
2684    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2685        self.client.into_channel().map_err(|client| Self { client })
2686    }
2687
2688    fn as_channel(&self) -> &::fidl::AsyncChannel {
2689        self.client.as_channel()
2690    }
2691}
2692
2693impl CompositeProxy {
2694    /// Create a new Proxy for fuchsia.hardware.audio/Composite.
2695    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2696        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2697        Self { client: fidl::client::Client::new(channel, protocol_name) }
2698    }
2699
2700    /// Get a Stream of events from the remote end of the protocol.
2701    ///
2702    /// # Panics
2703    ///
2704    /// Panics if the event stream was already taken.
2705    pub fn take_event_stream(&self) -> CompositeEventStream {
2706        CompositeEventStream { event_receiver: self.client.take_event_receiver() }
2707    }
2708
2709    /// Retrieves top level health state.
2710    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2711    pub fn r#get_health_state(
2712        &self,
2713    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
2714    {
2715        CompositeProxyInterface::r#get_health_state(self)
2716    }
2717
2718    /// Connect to a `SignalProcessing` protocol.
2719    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2720    /// the maximum number of connections have already been created, for instance one, then the
2721    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2722    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2723    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2724    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2725    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2726    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2727    /// is intended to be composed, and hence the more verbose name allows differentiation and
2728    /// improved clarity.
2729    pub fn r#signal_processing_connect(
2730        &self,
2731        mut protocol: fidl::endpoints::ServerEnd<
2732            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2733        >,
2734    ) -> Result<(), fidl::Error> {
2735        CompositeProxyInterface::r#signal_processing_connect(self, protocol)
2736    }
2737
2738    /// Resets the hardware including all DAI interconnects and signal processing.
2739    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2740    ///
2741    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2742    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2743    /// any processing elements, and reconstruct any ring buffers.
2744    ///
2745    /// If the driver can't successfully reset the hardware, it will return an error and then close
2746    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2747    pub fn r#reset(
2748        &self,
2749    ) -> fidl::client::QueryResponseFut<
2750        CompositeResetResult,
2751        fidl::encoding::DefaultFuchsiaResourceDialect,
2752    > {
2753        CompositeProxyInterface::r#reset(self)
2754    }
2755
2756    /// Retrieves top level static properties.
2757    pub fn r#get_properties(
2758        &self,
2759    ) -> fidl::client::QueryResponseFut<
2760        CompositeProperties,
2761        fidl::encoding::DefaultFuchsiaResourceDialect,
2762    > {
2763        CompositeProxyInterface::r#get_properties(self)
2764    }
2765
2766    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2767    /// in the topology supported by this driver as returned by `GetElements` from
2768    /// fuchsia.hardware.audio.signalprocessing.
2769    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2770    /// client may retry at a later time.
2771    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2772    /// by `GetElements`.
2773    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2774    /// `RING_BUFFER`.
2775    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2776    /// the parameters in `SupportedFormats2` may be supported.
2777    /// The vector returned to the caller must contain at least one entry.
2778    pub fn r#get_ring_buffer_formats(
2779        &self,
2780        mut processing_element_id: u64,
2781    ) -> fidl::client::QueryResponseFut<
2782        CompositeGetRingBufferFormatsResult,
2783        fidl::encoding::DefaultFuchsiaResourceDialect,
2784    > {
2785        CompositeProxyInterface::r#get_ring_buffer_formats(self, processing_element_id)
2786    }
2787
2788    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2789    /// processing element specified by `processing_element_id`. The format is based on information
2790    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2791    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2792    /// audio buffer provided by the driver.
2793    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2794    /// by `GetElements`.
2795    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2796    /// `RING_BUFFER`.
2797    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2798    /// `format` is not supported.
2799    pub fn r#create_ring_buffer(
2800        &self,
2801        mut processing_element_id: u64,
2802        mut format: &Format2,
2803        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2804    ) -> fidl::client::QueryResponseFut<
2805        CompositeCreateRingBufferResult,
2806        fidl::encoding::DefaultFuchsiaResourceDialect,
2807    > {
2808        CompositeProxyInterface::r#create_ring_buffer(
2809            self,
2810            processing_element_id,
2811            format,
2812            ring_buffer,
2813        )
2814    }
2815
2816    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2817    /// in the topology supported by this driver as returned by `GetElements` from
2818    /// fuchsia.hardware.audio.signalprocessing.
2819    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2820    /// may retry at a later time.
2821    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2822    /// by `GetElements`.
2823    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2824    /// `DAI_INTERCONNECT`.
2825    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2826    /// the parameters in DaiSupportedFormats may be supported.
2827    /// The vector returned to the caller must contain at least one entry.
2828    pub fn r#get_dai_formats(
2829        &self,
2830        mut processing_element_id: u64,
2831    ) -> fidl::client::QueryResponseFut<
2832        CompositeGetDaiFormatsResult,
2833        fidl::encoding::DefaultFuchsiaResourceDialect,
2834    > {
2835        CompositeProxyInterface::r#get_dai_formats(self, processing_element_id)
2836    }
2837
2838    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2839    /// processing element specified by `processing_element_id`. The format is based on information
2840    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2841    /// requirement.
2842    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2843    /// by `GetElements`.
2844    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2845    /// `DAI_INTERCONNECT`.
2846    pub fn r#set_dai_format(
2847        &self,
2848        mut processing_element_id: u64,
2849        mut format: &DaiFormat,
2850    ) -> fidl::client::QueryResponseFut<
2851        CompositeSetDaiFormatResult,
2852        fidl::encoding::DefaultFuchsiaResourceDialect,
2853    > {
2854        CompositeProxyInterface::r#set_dai_format(self, processing_element_id, format)
2855    }
2856
2857    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2858    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2859    /// from fuchsia.hardware.audio.signalprocessing.
2860    ///
2861    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2862    /// client may retry this request at a later time.
2863    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2864    /// `GetElements`.
2865    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2866    /// `PACKET_STREAM`.
2867    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2868    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2869    /// combinations of the parameters in `SupportedFormats2` may be supported.
2870    /// The vector returned to the caller must contain at least one entry.
2871    pub fn r#get_packet_stream_formats(
2872        &self,
2873        mut processing_element_id: u64,
2874    ) -> fidl::client::QueryResponseFut<
2875        CompositeGetPacketStreamFormatsResult,
2876        fidl::encoding::DefaultFuchsiaResourceDialect,
2877    > {
2878        CompositeProxyInterface::r#get_packet_stream_formats(self, processing_element_id)
2879    }
2880
2881    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2882    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
2883    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
2884    /// the client, and any other requirement. The returned `packet_stream` channel is used to
2885    /// access and control the packet stream protocol served by the driver.
2886    ///
2887    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2888    /// `GetElements`.
2889    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2890    /// `PACKET_STREAM`.
2891    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2892    /// at this time, but it should be able to at some future time. This request can be retried.
2893    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2894    ///`format` is not supported.
2895    pub fn r#create_packet_stream(
2896        &self,
2897        mut processing_element_id: u64,
2898        mut format: &Format2,
2899        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
2900    ) -> fidl::client::QueryResponseFut<
2901        CompositeCreatePacketStreamResult,
2902        fidl::encoding::DefaultFuchsiaResourceDialect,
2903    > {
2904        CompositeProxyInterface::r#create_packet_stream(
2905            self,
2906            processing_element_id,
2907            format,
2908            packet_stream_control,
2909        )
2910    }
2911}
2912
2913impl CompositeProxyInterface for CompositeProxy {
2914    type GetHealthStateResponseFut =
2915        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
2916    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
2917        fn _decode(
2918            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2919        ) -> Result<HealthState, fidl::Error> {
2920            let _response = fidl::client::decode_transaction_body::<
2921                HealthGetHealthStateResponse,
2922                fidl::encoding::DefaultFuchsiaResourceDialect,
2923                0x4e146d6bca733a84,
2924            >(_buf?)?;
2925            Ok(_response.state)
2926        }
2927        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
2928            (),
2929            0x4e146d6bca733a84,
2930            fidl::encoding::DynamicFlags::empty(),
2931            _decode,
2932        )
2933    }
2934
2935    fn r#signal_processing_connect(
2936        &self,
2937        mut protocol: fidl::endpoints::ServerEnd<
2938            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2939        >,
2940    ) -> Result<(), fidl::Error> {
2941        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2942            (protocol,),
2943            0xa81907ce6066295,
2944            fidl::encoding::DynamicFlags::empty(),
2945        )
2946    }
2947
2948    type ResetResponseFut = fidl::client::QueryResponseFut<
2949        CompositeResetResult,
2950        fidl::encoding::DefaultFuchsiaResourceDialect,
2951    >;
2952    fn r#reset(&self) -> Self::ResetResponseFut {
2953        fn _decode(
2954            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2955        ) -> Result<CompositeResetResult, fidl::Error> {
2956            let _response = fidl::client::decode_transaction_body::<
2957                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2958                fidl::encoding::DefaultFuchsiaResourceDialect,
2959                0xac355fb98341996,
2960            >(_buf?)?
2961            .into_result::<CompositeMarker>("reset")?;
2962            Ok(_response.map(|x| x))
2963        }
2964        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeResetResult>(
2965            (),
2966            0xac355fb98341996,
2967            fidl::encoding::DynamicFlags::FLEXIBLE,
2968            _decode,
2969        )
2970    }
2971
2972    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2973        CompositeProperties,
2974        fidl::encoding::DefaultFuchsiaResourceDialect,
2975    >;
2976    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2977        fn _decode(
2978            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2979        ) -> Result<CompositeProperties, fidl::Error> {
2980            let _response = fidl::client::decode_transaction_body::<
2981                fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>,
2982                fidl::encoding::DefaultFuchsiaResourceDialect,
2983                0x31846fa0a459942b,
2984            >(_buf?)?
2985            .into_result::<CompositeMarker>("get_properties")?;
2986            Ok(_response.properties)
2987        }
2988        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeProperties>(
2989            (),
2990            0x31846fa0a459942b,
2991            fidl::encoding::DynamicFlags::FLEXIBLE,
2992            _decode,
2993        )
2994    }
2995
2996    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
2997        CompositeGetRingBufferFormatsResult,
2998        fidl::encoding::DefaultFuchsiaResourceDialect,
2999    >;
3000    fn r#get_ring_buffer_formats(
3001        &self,
3002        mut processing_element_id: u64,
3003    ) -> Self::GetRingBufferFormatsResponseFut {
3004        fn _decode(
3005            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3006        ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
3007            let _response = fidl::client::decode_transaction_body::<
3008                fidl::encoding::FlexibleResultType<
3009                    CompositeGetRingBufferFormatsResponse,
3010                    DriverError,
3011                >,
3012                fidl::encoding::DefaultFuchsiaResourceDialect,
3013                0x1d89b701b6816ac4,
3014            >(_buf?)?
3015            .into_result::<CompositeMarker>("get_ring_buffer_formats")?;
3016            Ok(_response.map(|x| x.ring_buffer_formats))
3017        }
3018        self.client.send_query_and_decode::<
3019            CompositeGetRingBufferFormatsRequest,
3020            CompositeGetRingBufferFormatsResult,
3021        >(
3022            (processing_element_id,),
3023            0x1d89b701b6816ac4,
3024            fidl::encoding::DynamicFlags::FLEXIBLE,
3025            _decode,
3026        )
3027    }
3028
3029    type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
3030        CompositeCreateRingBufferResult,
3031        fidl::encoding::DefaultFuchsiaResourceDialect,
3032    >;
3033    fn r#create_ring_buffer(
3034        &self,
3035        mut processing_element_id: u64,
3036        mut format: &Format2,
3037        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3038    ) -> Self::CreateRingBufferResponseFut {
3039        fn _decode(
3040            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3041        ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
3042            let _response = fidl::client::decode_transaction_body::<
3043                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3044                fidl::encoding::DefaultFuchsiaResourceDialect,
3045                0x28c5685f85262033,
3046            >(_buf?)?
3047            .into_result::<CompositeMarker>("create_ring_buffer")?;
3048            Ok(_response.map(|x| x))
3049        }
3050        self.client.send_query_and_decode::<
3051            CompositeCreateRingBufferRequest,
3052            CompositeCreateRingBufferResult,
3053        >(
3054            (processing_element_id, format, ring_buffer,),
3055            0x28c5685f85262033,
3056            fidl::encoding::DynamicFlags::FLEXIBLE,
3057            _decode,
3058        )
3059    }
3060
3061    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
3062        CompositeGetDaiFormatsResult,
3063        fidl::encoding::DefaultFuchsiaResourceDialect,
3064    >;
3065    fn r#get_dai_formats(&self, mut processing_element_id: u64) -> Self::GetDaiFormatsResponseFut {
3066        fn _decode(
3067            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3068        ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
3069            let _response = fidl::client::decode_transaction_body::<
3070                fidl::encoding::FlexibleResultType<CompositeGetDaiFormatsResponse, DriverError>,
3071                fidl::encoding::DefaultFuchsiaResourceDialect,
3072                0x3cbeaed59c8f69b,
3073            >(_buf?)?
3074            .into_result::<CompositeMarker>("get_dai_formats")?;
3075            Ok(_response.map(|x| x.dai_formats))
3076        }
3077        self.client
3078            .send_query_and_decode::<CompositeGetDaiFormatsRequest, CompositeGetDaiFormatsResult>(
3079                (processing_element_id,),
3080                0x3cbeaed59c8f69b,
3081                fidl::encoding::DynamicFlags::FLEXIBLE,
3082                _decode,
3083            )
3084    }
3085
3086    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
3087        CompositeSetDaiFormatResult,
3088        fidl::encoding::DefaultFuchsiaResourceDialect,
3089    >;
3090    fn r#set_dai_format(
3091        &self,
3092        mut processing_element_id: u64,
3093        mut format: &DaiFormat,
3094    ) -> Self::SetDaiFormatResponseFut {
3095        fn _decode(
3096            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3097        ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
3098            let _response = fidl::client::decode_transaction_body::<
3099                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3100                fidl::encoding::DefaultFuchsiaResourceDialect,
3101                0x155acf5cc0dc8a84,
3102            >(_buf?)?
3103            .into_result::<CompositeMarker>("set_dai_format")?;
3104            Ok(_response.map(|x| x))
3105        }
3106        self.client
3107            .send_query_and_decode::<CompositeSetDaiFormatRequest, CompositeSetDaiFormatResult>(
3108                (processing_element_id, format),
3109                0x155acf5cc0dc8a84,
3110                fidl::encoding::DynamicFlags::FLEXIBLE,
3111                _decode,
3112            )
3113    }
3114
3115    type GetPacketStreamFormatsResponseFut = fidl::client::QueryResponseFut<
3116        CompositeGetPacketStreamFormatsResult,
3117        fidl::encoding::DefaultFuchsiaResourceDialect,
3118    >;
3119    fn r#get_packet_stream_formats(
3120        &self,
3121        mut processing_element_id: u64,
3122    ) -> Self::GetPacketStreamFormatsResponseFut {
3123        fn _decode(
3124            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3125        ) -> Result<CompositeGetPacketStreamFormatsResult, fidl::Error> {
3126            let _response = fidl::client::decode_transaction_body::<
3127                fidl::encoding::FlexibleResultType<
3128                    CompositeGetPacketStreamFormatsResponse,
3129                    DriverError,
3130                >,
3131                fidl::encoding::DefaultFuchsiaResourceDialect,
3132                0x73cc47c6ad39bca7,
3133            >(_buf?)?
3134            .into_result::<CompositeMarker>("get_packet_stream_formats")?;
3135            Ok(_response.map(|x| x.packet_stream_formats))
3136        }
3137        self.client.send_query_and_decode::<
3138            CompositeGetPacketStreamFormatsRequest,
3139            CompositeGetPacketStreamFormatsResult,
3140        >(
3141            (processing_element_id,),
3142            0x73cc47c6ad39bca7,
3143            fidl::encoding::DynamicFlags::FLEXIBLE,
3144            _decode,
3145        )
3146    }
3147
3148    type CreatePacketStreamResponseFut = fidl::client::QueryResponseFut<
3149        CompositeCreatePacketStreamResult,
3150        fidl::encoding::DefaultFuchsiaResourceDialect,
3151    >;
3152    fn r#create_packet_stream(
3153        &self,
3154        mut processing_element_id: u64,
3155        mut format: &Format2,
3156        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3157    ) -> Self::CreatePacketStreamResponseFut {
3158        fn _decode(
3159            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3160        ) -> Result<CompositeCreatePacketStreamResult, fidl::Error> {
3161            let _response = fidl::client::decode_transaction_body::<
3162                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3163                fidl::encoding::DefaultFuchsiaResourceDialect,
3164                0x50e8902b756c707c,
3165            >(_buf?)?
3166            .into_result::<CompositeMarker>("create_packet_stream")?;
3167            Ok(_response.map(|x| x))
3168        }
3169        self.client.send_query_and_decode::<
3170            CompositeCreatePacketStreamRequest,
3171            CompositeCreatePacketStreamResult,
3172        >(
3173            (processing_element_id, format, packet_stream_control,),
3174            0x50e8902b756c707c,
3175            fidl::encoding::DynamicFlags::FLEXIBLE,
3176            _decode,
3177        )
3178    }
3179}
3180
3181pub struct CompositeEventStream {
3182    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3183}
3184
3185impl std::marker::Unpin for CompositeEventStream {}
3186
3187impl futures::stream::FusedStream for CompositeEventStream {
3188    fn is_terminated(&self) -> bool {
3189        self.event_receiver.is_terminated()
3190    }
3191}
3192
3193impl futures::Stream for CompositeEventStream {
3194    type Item = Result<CompositeEvent, fidl::Error>;
3195
3196    fn poll_next(
3197        mut self: std::pin::Pin<&mut Self>,
3198        cx: &mut std::task::Context<'_>,
3199    ) -> std::task::Poll<Option<Self::Item>> {
3200        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3201            &mut self.event_receiver,
3202            cx
3203        )?) {
3204            Some(buf) => std::task::Poll::Ready(Some(CompositeEvent::decode(buf))),
3205            None => std::task::Poll::Ready(None),
3206        }
3207    }
3208}
3209
3210#[derive(Debug)]
3211pub enum CompositeEvent {
3212    #[non_exhaustive]
3213    _UnknownEvent {
3214        /// Ordinal of the event that was sent.
3215        ordinal: u64,
3216    },
3217}
3218
3219impl CompositeEvent {
3220    /// Decodes a message buffer as a [`CompositeEvent`].
3221    fn decode(
3222        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3223    ) -> Result<CompositeEvent, fidl::Error> {
3224        let (bytes, _handles) = buf.split_mut();
3225        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3226        debug_assert_eq!(tx_header.tx_id, 0);
3227        match tx_header.ordinal {
3228            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3229                Ok(CompositeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3230            }
3231            _ => Err(fidl::Error::UnknownOrdinal {
3232                ordinal: tx_header.ordinal,
3233                protocol_name: <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3234            }),
3235        }
3236    }
3237}
3238
3239/// A Stream of incoming requests for fuchsia.hardware.audio/Composite.
3240pub struct CompositeRequestStream {
3241    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3242    is_terminated: bool,
3243}
3244
3245impl std::marker::Unpin for CompositeRequestStream {}
3246
3247impl futures::stream::FusedStream for CompositeRequestStream {
3248    fn is_terminated(&self) -> bool {
3249        self.is_terminated
3250    }
3251}
3252
3253impl fidl::endpoints::RequestStream for CompositeRequestStream {
3254    type Protocol = CompositeMarker;
3255    type ControlHandle = CompositeControlHandle;
3256
3257    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3258        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3259    }
3260
3261    fn control_handle(&self) -> Self::ControlHandle {
3262        CompositeControlHandle { inner: self.inner.clone() }
3263    }
3264
3265    fn into_inner(
3266        self,
3267    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3268    {
3269        (self.inner, self.is_terminated)
3270    }
3271
3272    fn from_inner(
3273        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3274        is_terminated: bool,
3275    ) -> Self {
3276        Self { inner, is_terminated }
3277    }
3278}
3279
3280impl futures::Stream for CompositeRequestStream {
3281    type Item = Result<CompositeRequest, fidl::Error>;
3282
3283    fn poll_next(
3284        mut self: std::pin::Pin<&mut Self>,
3285        cx: &mut std::task::Context<'_>,
3286    ) -> std::task::Poll<Option<Self::Item>> {
3287        let this = &mut *self;
3288        if this.inner.check_shutdown(cx) {
3289            this.is_terminated = true;
3290            return std::task::Poll::Ready(None);
3291        }
3292        if this.is_terminated {
3293            panic!("polled CompositeRequestStream after completion");
3294        }
3295        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3296            |bytes, handles| {
3297                match this.inner.channel().read_etc(cx, bytes, handles) {
3298                    std::task::Poll::Ready(Ok(())) => {}
3299                    std::task::Poll::Pending => return std::task::Poll::Pending,
3300                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3301                        this.is_terminated = true;
3302                        return std::task::Poll::Ready(None);
3303                    }
3304                    std::task::Poll::Ready(Err(e)) => {
3305                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3306                            e.into(),
3307                        ))));
3308                    }
3309                }
3310
3311                // A message has been received from the channel
3312                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3313
3314                std::task::Poll::Ready(Some(match header.ordinal {
3315                    0x4e146d6bca733a84 => {
3316                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3317                        let mut req = fidl::new_empty!(
3318                            fidl::encoding::EmptyPayload,
3319                            fidl::encoding::DefaultFuchsiaResourceDialect
3320                        );
3321                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3322                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3323                        Ok(CompositeRequest::GetHealthState {
3324                            responder: CompositeGetHealthStateResponder {
3325                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3326                                tx_id: header.tx_id,
3327                            },
3328                        })
3329                    }
3330                    0xa81907ce6066295 => {
3331                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3332                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3333                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3334                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3335                        Ok(CompositeRequest::SignalProcessingConnect {
3336                            protocol: req.protocol,
3337
3338                            control_handle,
3339                        })
3340                    }
3341                    0xac355fb98341996 => {
3342                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3343                        let mut req = fidl::new_empty!(
3344                            fidl::encoding::EmptyPayload,
3345                            fidl::encoding::DefaultFuchsiaResourceDialect
3346                        );
3347                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3348                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3349                        Ok(CompositeRequest::Reset {
3350                            responder: CompositeResetResponder {
3351                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3352                                tx_id: header.tx_id,
3353                            },
3354                        })
3355                    }
3356                    0x31846fa0a459942b => {
3357                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3358                        let mut req = fidl::new_empty!(
3359                            fidl::encoding::EmptyPayload,
3360                            fidl::encoding::DefaultFuchsiaResourceDialect
3361                        );
3362                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3363                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3364                        Ok(CompositeRequest::GetProperties {
3365                            responder: CompositeGetPropertiesResponder {
3366                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3367                                tx_id: header.tx_id,
3368                            },
3369                        })
3370                    }
3371                    0x1d89b701b6816ac4 => {
3372                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3373                        let mut req = fidl::new_empty!(
3374                            CompositeGetRingBufferFormatsRequest,
3375                            fidl::encoding::DefaultFuchsiaResourceDialect
3376                        );
3377                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetRingBufferFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3378                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3379                        Ok(CompositeRequest::GetRingBufferFormats {
3380                            processing_element_id: req.processing_element_id,
3381
3382                            responder: CompositeGetRingBufferFormatsResponder {
3383                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3384                                tx_id: header.tx_id,
3385                            },
3386                        })
3387                    }
3388                    0x28c5685f85262033 => {
3389                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3390                        let mut req = fidl::new_empty!(
3391                            CompositeCreateRingBufferRequest,
3392                            fidl::encoding::DefaultFuchsiaResourceDialect
3393                        );
3394                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
3395                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3396                        Ok(CompositeRequest::CreateRingBuffer {
3397                            processing_element_id: req.processing_element_id,
3398                            format: req.format,
3399                            ring_buffer: req.ring_buffer,
3400
3401                            responder: CompositeCreateRingBufferResponder {
3402                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3403                                tx_id: header.tx_id,
3404                            },
3405                        })
3406                    }
3407                    0x3cbeaed59c8f69b => {
3408                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3409                        let mut req = fidl::new_empty!(
3410                            CompositeGetDaiFormatsRequest,
3411                            fidl::encoding::DefaultFuchsiaResourceDialect
3412                        );
3413                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetDaiFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3414                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3415                        Ok(CompositeRequest::GetDaiFormats {
3416                            processing_element_id: req.processing_element_id,
3417
3418                            responder: CompositeGetDaiFormatsResponder {
3419                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3420                                tx_id: header.tx_id,
3421                            },
3422                        })
3423                    }
3424                    0x155acf5cc0dc8a84 => {
3425                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3426                        let mut req = fidl::new_empty!(
3427                            CompositeSetDaiFormatRequest,
3428                            fidl::encoding::DefaultFuchsiaResourceDialect
3429                        );
3430                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
3431                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3432                        Ok(CompositeRequest::SetDaiFormat {
3433                            processing_element_id: req.processing_element_id,
3434                            format: req.format,
3435
3436                            responder: CompositeSetDaiFormatResponder {
3437                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3438                                tx_id: header.tx_id,
3439                            },
3440                        })
3441                    }
3442                    0x73cc47c6ad39bca7 => {
3443                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3444                        let mut req = fidl::new_empty!(
3445                            CompositeGetPacketStreamFormatsRequest,
3446                            fidl::encoding::DefaultFuchsiaResourceDialect
3447                        );
3448                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetPacketStreamFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3449                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3450                        Ok(CompositeRequest::GetPacketStreamFormats {
3451                            processing_element_id: req.processing_element_id,
3452
3453                            responder: CompositeGetPacketStreamFormatsResponder {
3454                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3455                                tx_id: header.tx_id,
3456                            },
3457                        })
3458                    }
3459                    0x50e8902b756c707c => {
3460                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3461                        let mut req = fidl::new_empty!(
3462                            CompositeCreatePacketStreamRequest,
3463                            fidl::encoding::DefaultFuchsiaResourceDialect
3464                        );
3465                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreatePacketStreamRequest>(&header, _body_bytes, handles, &mut req)?;
3466                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3467                        Ok(CompositeRequest::CreatePacketStream {
3468                            processing_element_id: req.processing_element_id,
3469                            format: req.format,
3470                            packet_stream_control: req.packet_stream_control,
3471
3472                            responder: CompositeCreatePacketStreamResponder {
3473                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3474                                tx_id: header.tx_id,
3475                            },
3476                        })
3477                    }
3478                    _ if header.tx_id == 0
3479                        && header
3480                            .dynamic_flags()
3481                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3482                    {
3483                        Ok(CompositeRequest::_UnknownMethod {
3484                            ordinal: header.ordinal,
3485                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
3486                            method_type: fidl::MethodType::OneWay,
3487                        })
3488                    }
3489                    _ if header
3490                        .dynamic_flags()
3491                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3492                    {
3493                        this.inner.send_framework_err(
3494                            fidl::encoding::FrameworkErr::UnknownMethod,
3495                            header.tx_id,
3496                            header.ordinal,
3497                            header.dynamic_flags(),
3498                            (bytes, handles),
3499                        )?;
3500                        Ok(CompositeRequest::_UnknownMethod {
3501                            ordinal: header.ordinal,
3502                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
3503                            method_type: fidl::MethodType::TwoWay,
3504                        })
3505                    }
3506                    _ => Err(fidl::Error::UnknownOrdinal {
3507                        ordinal: header.ordinal,
3508                        protocol_name:
3509                            <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3510                    }),
3511                }))
3512            },
3513        )
3514    }
3515}
3516
3517#[derive(Debug)]
3518pub enum CompositeRequest {
3519    /// Retrieves top level health state.
3520    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
3521    GetHealthState { responder: CompositeGetHealthStateResponder },
3522    /// Connect to a `SignalProcessing` protocol.
3523    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
3524    /// the maximum number of connections have already been created, for instance one, then the
3525    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
3526    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
3527    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
3528    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
3529    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
3530    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
3531    /// is intended to be composed, and hence the more verbose name allows differentiation and
3532    /// improved clarity.
3533    SignalProcessingConnect {
3534        protocol: fidl::endpoints::ServerEnd<
3535            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3536        >,
3537        control_handle: CompositeControlHandle,
3538    },
3539    /// Resets the hardware including all DAI interconnects and signal processing.
3540    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
3541    ///
3542    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
3543    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
3544    /// any processing elements, and reconstruct any ring buffers.
3545    ///
3546    /// If the driver can't successfully reset the hardware, it will return an error and then close
3547    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
3548    Reset { responder: CompositeResetResponder },
3549    /// Retrieves top level static properties.
3550    GetProperties { responder: CompositeGetPropertiesResponder },
3551    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
3552    /// in the topology supported by this driver as returned by `GetElements` from
3553    /// fuchsia.hardware.audio.signalprocessing.
3554    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
3555    /// client may retry at a later time.
3556    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3557    /// by `GetElements`.
3558    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3559    /// `RING_BUFFER`.
3560    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
3561    /// the parameters in `SupportedFormats2` may be supported.
3562    /// The vector returned to the caller must contain at least one entry.
3563    GetRingBufferFormats {
3564        processing_element_id: u64,
3565        responder: CompositeGetRingBufferFormatsResponder,
3566    },
3567    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
3568    /// processing element specified by `processing_element_id`. The format is based on information
3569    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
3570    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
3571    /// audio buffer provided by the driver.
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    /// `RING_BUFFER`.
3576    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
3577    /// `format` is not supported.
3578    CreateRingBuffer {
3579        processing_element_id: u64,
3580        format: Format2,
3581        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3582        responder: CompositeCreateRingBufferResponder,
3583    },
3584    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
3585    /// in the topology supported by this driver as returned by `GetElements` from
3586    /// fuchsia.hardware.audio.signalprocessing.
3587    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
3588    /// may retry at a later time.
3589    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3590    /// by `GetElements`.
3591    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3592    /// `DAI_INTERCONNECT`.
3593    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
3594    /// the parameters in DaiSupportedFormats may be supported.
3595    /// The vector returned to the caller must contain at least one entry.
3596    GetDaiFormats { processing_element_id: u64, responder: CompositeGetDaiFormatsResponder },
3597    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
3598    /// processing element specified by `processing_element_id`. The format is based on information
3599    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
3600    /// requirement.
3601    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3602    /// by `GetElements`.
3603    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3604    /// `DAI_INTERCONNECT`.
3605    SetDaiFormat {
3606        processing_element_id: u64,
3607        format: DaiFormat,
3608        responder: CompositeSetDaiFormatResponder,
3609    },
3610    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
3611    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
3612    /// from fuchsia.hardware.audio.signalprocessing.
3613    ///
3614    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
3615    /// client may retry this request at a later time.
3616    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
3617    /// `GetElements`.
3618    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3619    /// `PACKET_STREAM`.
3620    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
3621    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
3622    /// combinations of the parameters in `SupportedFormats2` may be supported.
3623    /// The vector returned to the caller must contain at least one entry.
3624    GetPacketStreamFormats {
3625        processing_element_id: u64,
3626        responder: CompositeGetPacketStreamFormatsResponder,
3627    },
3628    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
3629    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
3630    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
3631    /// the client, and any other requirement. The returned `packet_stream` channel is used to
3632    /// access and control the packet stream protocol served by the driver.
3633    ///
3634    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
3635    /// `GetElements`.
3636    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3637    /// `PACKET_STREAM`.
3638    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
3639    /// at this time, but it should be able to at some future time. This request can be retried.
3640    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
3641    ///`format` is not supported.
3642    CreatePacketStream {
3643        processing_element_id: u64,
3644        format: Format2,
3645        packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3646        responder: CompositeCreatePacketStreamResponder,
3647    },
3648    /// An interaction was received which does not match any known method.
3649    #[non_exhaustive]
3650    _UnknownMethod {
3651        /// Ordinal of the method that was called.
3652        ordinal: u64,
3653        control_handle: CompositeControlHandle,
3654        method_type: fidl::MethodType,
3655    },
3656}
3657
3658impl CompositeRequest {
3659    #[allow(irrefutable_let_patterns)]
3660    pub fn into_get_health_state(self) -> Option<(CompositeGetHealthStateResponder)> {
3661        if let CompositeRequest::GetHealthState { responder } = self {
3662            Some((responder))
3663        } else {
3664            None
3665        }
3666    }
3667
3668    #[allow(irrefutable_let_patterns)]
3669    pub fn into_signal_processing_connect(
3670        self,
3671    ) -> Option<(
3672        fidl::endpoints::ServerEnd<
3673            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3674        >,
3675        CompositeControlHandle,
3676    )> {
3677        if let CompositeRequest::SignalProcessingConnect { protocol, control_handle } = self {
3678            Some((protocol, control_handle))
3679        } else {
3680            None
3681        }
3682    }
3683
3684    #[allow(irrefutable_let_patterns)]
3685    pub fn into_reset(self) -> Option<(CompositeResetResponder)> {
3686        if let CompositeRequest::Reset { responder } = self { Some((responder)) } else { None }
3687    }
3688
3689    #[allow(irrefutable_let_patterns)]
3690    pub fn into_get_properties(self) -> Option<(CompositeGetPropertiesResponder)> {
3691        if let CompositeRequest::GetProperties { responder } = self {
3692            Some((responder))
3693        } else {
3694            None
3695        }
3696    }
3697
3698    #[allow(irrefutable_let_patterns)]
3699    pub fn into_get_ring_buffer_formats(
3700        self,
3701    ) -> Option<(u64, CompositeGetRingBufferFormatsResponder)> {
3702        if let CompositeRequest::GetRingBufferFormats { processing_element_id, responder } = self {
3703            Some((processing_element_id, responder))
3704        } else {
3705            None
3706        }
3707    }
3708
3709    #[allow(irrefutable_let_patterns)]
3710    pub fn into_create_ring_buffer(
3711        self,
3712    ) -> Option<(
3713        u64,
3714        Format2,
3715        fidl::endpoints::ServerEnd<RingBufferMarker>,
3716        CompositeCreateRingBufferResponder,
3717    )> {
3718        if let CompositeRequest::CreateRingBuffer {
3719            processing_element_id,
3720            format,
3721            ring_buffer,
3722            responder,
3723        } = self
3724        {
3725            Some((processing_element_id, format, ring_buffer, responder))
3726        } else {
3727            None
3728        }
3729    }
3730
3731    #[allow(irrefutable_let_patterns)]
3732    pub fn into_get_dai_formats(self) -> Option<(u64, CompositeGetDaiFormatsResponder)> {
3733        if let CompositeRequest::GetDaiFormats { processing_element_id, responder } = self {
3734            Some((processing_element_id, responder))
3735        } else {
3736            None
3737        }
3738    }
3739
3740    #[allow(irrefutable_let_patterns)]
3741    pub fn into_set_dai_format(self) -> Option<(u64, DaiFormat, CompositeSetDaiFormatResponder)> {
3742        if let CompositeRequest::SetDaiFormat { processing_element_id, format, responder } = self {
3743            Some((processing_element_id, format, responder))
3744        } else {
3745            None
3746        }
3747    }
3748
3749    #[allow(irrefutable_let_patterns)]
3750    pub fn into_get_packet_stream_formats(
3751        self,
3752    ) -> Option<(u64, CompositeGetPacketStreamFormatsResponder)> {
3753        if let CompositeRequest::GetPacketStreamFormats { processing_element_id, responder } = self
3754        {
3755            Some((processing_element_id, responder))
3756        } else {
3757            None
3758        }
3759    }
3760
3761    #[allow(irrefutable_let_patterns)]
3762    pub fn into_create_packet_stream(
3763        self,
3764    ) -> Option<(
3765        u64,
3766        Format2,
3767        fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3768        CompositeCreatePacketStreamResponder,
3769    )> {
3770        if let CompositeRequest::CreatePacketStream {
3771            processing_element_id,
3772            format,
3773            packet_stream_control,
3774            responder,
3775        } = self
3776        {
3777            Some((processing_element_id, format, packet_stream_control, responder))
3778        } else {
3779            None
3780        }
3781    }
3782
3783    /// Name of the method defined in FIDL
3784    pub fn method_name(&self) -> &'static str {
3785        match *self {
3786            CompositeRequest::GetHealthState { .. } => "get_health_state",
3787            CompositeRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
3788            CompositeRequest::Reset { .. } => "reset",
3789            CompositeRequest::GetProperties { .. } => "get_properties",
3790            CompositeRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
3791            CompositeRequest::CreateRingBuffer { .. } => "create_ring_buffer",
3792            CompositeRequest::GetDaiFormats { .. } => "get_dai_formats",
3793            CompositeRequest::SetDaiFormat { .. } => "set_dai_format",
3794            CompositeRequest::GetPacketStreamFormats { .. } => "get_packet_stream_formats",
3795            CompositeRequest::CreatePacketStream { .. } => "create_packet_stream",
3796            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3797                "unknown one-way method"
3798            }
3799            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3800                "unknown two-way method"
3801            }
3802        }
3803    }
3804}
3805
3806#[derive(Debug, Clone)]
3807pub struct CompositeControlHandle {
3808    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3809}
3810
3811impl fidl::endpoints::ControlHandle for CompositeControlHandle {
3812    fn shutdown(&self) {
3813        self.inner.shutdown()
3814    }
3815
3816    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3817        self.inner.shutdown_with_epitaph(status)
3818    }
3819
3820    fn is_closed(&self) -> bool {
3821        self.inner.channel().is_closed()
3822    }
3823    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3824        self.inner.channel().on_closed()
3825    }
3826
3827    #[cfg(target_os = "fuchsia")]
3828    fn signal_peer(
3829        &self,
3830        clear_mask: zx::Signals,
3831        set_mask: zx::Signals,
3832    ) -> Result<(), zx_status::Status> {
3833        use fidl::Peered;
3834        self.inner.channel().signal_peer(clear_mask, set_mask)
3835    }
3836}
3837
3838impl CompositeControlHandle {}
3839
3840#[must_use = "FIDL methods require a response to be sent"]
3841#[derive(Debug)]
3842pub struct CompositeGetHealthStateResponder {
3843    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3844    tx_id: u32,
3845}
3846
3847/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3848/// if the responder is dropped without sending a response, so that the client
3849/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3850impl std::ops::Drop for CompositeGetHealthStateResponder {
3851    fn drop(&mut self) {
3852        self.control_handle.shutdown();
3853        // Safety: drops once, never accessed again
3854        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3855    }
3856}
3857
3858impl fidl::endpoints::Responder for CompositeGetHealthStateResponder {
3859    type ControlHandle = CompositeControlHandle;
3860
3861    fn control_handle(&self) -> &CompositeControlHandle {
3862        &self.control_handle
3863    }
3864
3865    fn drop_without_shutdown(mut self) {
3866        // Safety: drops once, never accessed again due to mem::forget
3867        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3868        // Prevent Drop from running (which would shut down the channel)
3869        std::mem::forget(self);
3870    }
3871}
3872
3873impl CompositeGetHealthStateResponder {
3874    /// Sends a response to the FIDL transaction.
3875    ///
3876    /// Sets the channel to shutdown if an error occurs.
3877    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3878        let _result = self.send_raw(state);
3879        if _result.is_err() {
3880            self.control_handle.shutdown();
3881        }
3882        self.drop_without_shutdown();
3883        _result
3884    }
3885
3886    /// Similar to "send" but does not shutdown the channel if an error occurs.
3887    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3888        let _result = self.send_raw(state);
3889        self.drop_without_shutdown();
3890        _result
3891    }
3892
3893    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
3894        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
3895            (state,),
3896            self.tx_id,
3897            0x4e146d6bca733a84,
3898            fidl::encoding::DynamicFlags::empty(),
3899        )
3900    }
3901}
3902
3903#[must_use = "FIDL methods require a response to be sent"]
3904#[derive(Debug)]
3905pub struct CompositeResetResponder {
3906    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3907    tx_id: u32,
3908}
3909
3910/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3911/// if the responder is dropped without sending a response, so that the client
3912/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3913impl std::ops::Drop for CompositeResetResponder {
3914    fn drop(&mut self) {
3915        self.control_handle.shutdown();
3916        // Safety: drops once, never accessed again
3917        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3918    }
3919}
3920
3921impl fidl::endpoints::Responder for CompositeResetResponder {
3922    type ControlHandle = CompositeControlHandle;
3923
3924    fn control_handle(&self) -> &CompositeControlHandle {
3925        &self.control_handle
3926    }
3927
3928    fn drop_without_shutdown(mut self) {
3929        // Safety: drops once, never accessed again due to mem::forget
3930        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3931        // Prevent Drop from running (which would shut down the channel)
3932        std::mem::forget(self);
3933    }
3934}
3935
3936impl CompositeResetResponder {
3937    /// Sends a response to the FIDL transaction.
3938    ///
3939    /// Sets the channel to shutdown if an error occurs.
3940    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3941        let _result = self.send_raw(result);
3942        if _result.is_err() {
3943            self.control_handle.shutdown();
3944        }
3945        self.drop_without_shutdown();
3946        _result
3947    }
3948
3949    /// Similar to "send" but does not shutdown the channel if an error occurs.
3950    pub fn send_no_shutdown_on_err(
3951        self,
3952        mut result: Result<(), DriverError>,
3953    ) -> Result<(), fidl::Error> {
3954        let _result = self.send_raw(result);
3955        self.drop_without_shutdown();
3956        _result
3957    }
3958
3959    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3960        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3961            fidl::encoding::EmptyStruct,
3962            DriverError,
3963        >>(
3964            fidl::encoding::FlexibleResult::new(result),
3965            self.tx_id,
3966            0xac355fb98341996,
3967            fidl::encoding::DynamicFlags::FLEXIBLE,
3968        )
3969    }
3970}
3971
3972#[must_use = "FIDL methods require a response to be sent"]
3973#[derive(Debug)]
3974pub struct CompositeGetPropertiesResponder {
3975    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3976    tx_id: u32,
3977}
3978
3979/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3980/// if the responder is dropped without sending a response, so that the client
3981/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3982impl std::ops::Drop for CompositeGetPropertiesResponder {
3983    fn drop(&mut self) {
3984        self.control_handle.shutdown();
3985        // Safety: drops once, never accessed again
3986        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3987    }
3988}
3989
3990impl fidl::endpoints::Responder for CompositeGetPropertiesResponder {
3991    type ControlHandle = CompositeControlHandle;
3992
3993    fn control_handle(&self) -> &CompositeControlHandle {
3994        &self.control_handle
3995    }
3996
3997    fn drop_without_shutdown(mut self) {
3998        // Safety: drops once, never accessed again due to mem::forget
3999        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4000        // Prevent Drop from running (which would shut down the channel)
4001        std::mem::forget(self);
4002    }
4003}
4004
4005impl CompositeGetPropertiesResponder {
4006    /// Sends a response to the FIDL transaction.
4007    ///
4008    /// Sets the channel to shutdown if an error occurs.
4009    pub fn send(self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
4010        let _result = self.send_raw(properties);
4011        if _result.is_err() {
4012            self.control_handle.shutdown();
4013        }
4014        self.drop_without_shutdown();
4015        _result
4016    }
4017
4018    /// Similar to "send" but does not shutdown the channel if an error occurs.
4019    pub fn send_no_shutdown_on_err(
4020        self,
4021        mut properties: &CompositeProperties,
4022    ) -> Result<(), fidl::Error> {
4023        let _result = self.send_raw(properties);
4024        self.drop_without_shutdown();
4025        _result
4026    }
4027
4028    fn send_raw(&self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
4029        self.control_handle
4030            .inner
4031            .send::<fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>>(
4032                fidl::encoding::Flexible::new((properties,)),
4033                self.tx_id,
4034                0x31846fa0a459942b,
4035                fidl::encoding::DynamicFlags::FLEXIBLE,
4036            )
4037    }
4038}
4039
4040#[must_use = "FIDL methods require a response to be sent"]
4041#[derive(Debug)]
4042pub struct CompositeGetRingBufferFormatsResponder {
4043    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4044    tx_id: u32,
4045}
4046
4047/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4048/// if the responder is dropped without sending a response, so that the client
4049/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4050impl std::ops::Drop for CompositeGetRingBufferFormatsResponder {
4051    fn drop(&mut self) {
4052        self.control_handle.shutdown();
4053        // Safety: drops once, never accessed again
4054        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4055    }
4056}
4057
4058impl fidl::endpoints::Responder for CompositeGetRingBufferFormatsResponder {
4059    type ControlHandle = CompositeControlHandle;
4060
4061    fn control_handle(&self) -> &CompositeControlHandle {
4062        &self.control_handle
4063    }
4064
4065    fn drop_without_shutdown(mut self) {
4066        // Safety: drops once, never accessed again due to mem::forget
4067        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4068        // Prevent Drop from running (which would shut down the channel)
4069        std::mem::forget(self);
4070    }
4071}
4072
4073impl CompositeGetRingBufferFormatsResponder {
4074    /// Sends a response to the FIDL transaction.
4075    ///
4076    /// Sets the channel to shutdown if an error occurs.
4077    pub fn send(
4078        self,
4079        mut result: Result<&[SupportedFormats2], DriverError>,
4080    ) -> Result<(), fidl::Error> {
4081        let _result = self.send_raw(result);
4082        if _result.is_err() {
4083            self.control_handle.shutdown();
4084        }
4085        self.drop_without_shutdown();
4086        _result
4087    }
4088
4089    /// Similar to "send" but does not shutdown the channel if an error occurs.
4090    pub fn send_no_shutdown_on_err(
4091        self,
4092        mut result: Result<&[SupportedFormats2], DriverError>,
4093    ) -> Result<(), fidl::Error> {
4094        let _result = self.send_raw(result);
4095        self.drop_without_shutdown();
4096        _result
4097    }
4098
4099    fn send_raw(
4100        &self,
4101        mut result: Result<&[SupportedFormats2], DriverError>,
4102    ) -> Result<(), fidl::Error> {
4103        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4104            CompositeGetRingBufferFormatsResponse,
4105            DriverError,
4106        >>(
4107            fidl::encoding::FlexibleResult::new(
4108                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
4109            ),
4110            self.tx_id,
4111            0x1d89b701b6816ac4,
4112            fidl::encoding::DynamicFlags::FLEXIBLE,
4113        )
4114    }
4115}
4116
4117#[must_use = "FIDL methods require a response to be sent"]
4118#[derive(Debug)]
4119pub struct CompositeCreateRingBufferResponder {
4120    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4121    tx_id: u32,
4122}
4123
4124/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4125/// if the responder is dropped without sending a response, so that the client
4126/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4127impl std::ops::Drop for CompositeCreateRingBufferResponder {
4128    fn drop(&mut self) {
4129        self.control_handle.shutdown();
4130        // Safety: drops once, never accessed again
4131        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4132    }
4133}
4134
4135impl fidl::endpoints::Responder for CompositeCreateRingBufferResponder {
4136    type ControlHandle = CompositeControlHandle;
4137
4138    fn control_handle(&self) -> &CompositeControlHandle {
4139        &self.control_handle
4140    }
4141
4142    fn drop_without_shutdown(mut self) {
4143        // Safety: drops once, never accessed again due to mem::forget
4144        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4145        // Prevent Drop from running (which would shut down the channel)
4146        std::mem::forget(self);
4147    }
4148}
4149
4150impl CompositeCreateRingBufferResponder {
4151    /// Sends a response to the FIDL transaction.
4152    ///
4153    /// Sets the channel to shutdown if an error occurs.
4154    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4155        let _result = self.send_raw(result);
4156        if _result.is_err() {
4157            self.control_handle.shutdown();
4158        }
4159        self.drop_without_shutdown();
4160        _result
4161    }
4162
4163    /// Similar to "send" but does not shutdown the channel if an error occurs.
4164    pub fn send_no_shutdown_on_err(
4165        self,
4166        mut result: Result<(), DriverError>,
4167    ) -> Result<(), fidl::Error> {
4168        let _result = self.send_raw(result);
4169        self.drop_without_shutdown();
4170        _result
4171    }
4172
4173    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4174        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4175            fidl::encoding::EmptyStruct,
4176            DriverError,
4177        >>(
4178            fidl::encoding::FlexibleResult::new(result),
4179            self.tx_id,
4180            0x28c5685f85262033,
4181            fidl::encoding::DynamicFlags::FLEXIBLE,
4182        )
4183    }
4184}
4185
4186#[must_use = "FIDL methods require a response to be sent"]
4187#[derive(Debug)]
4188pub struct CompositeGetDaiFormatsResponder {
4189    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4190    tx_id: u32,
4191}
4192
4193/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4194/// if the responder is dropped without sending a response, so that the client
4195/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4196impl std::ops::Drop for CompositeGetDaiFormatsResponder {
4197    fn drop(&mut self) {
4198        self.control_handle.shutdown();
4199        // Safety: drops once, never accessed again
4200        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4201    }
4202}
4203
4204impl fidl::endpoints::Responder for CompositeGetDaiFormatsResponder {
4205    type ControlHandle = CompositeControlHandle;
4206
4207    fn control_handle(&self) -> &CompositeControlHandle {
4208        &self.control_handle
4209    }
4210
4211    fn drop_without_shutdown(mut self) {
4212        // Safety: drops once, never accessed again due to mem::forget
4213        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4214        // Prevent Drop from running (which would shut down the channel)
4215        std::mem::forget(self);
4216    }
4217}
4218
4219impl CompositeGetDaiFormatsResponder {
4220    /// Sends a response to the FIDL transaction.
4221    ///
4222    /// Sets the channel to shutdown if an error occurs.
4223    pub fn send(
4224        self,
4225        mut result: Result<&[DaiSupportedFormats], DriverError>,
4226    ) -> Result<(), fidl::Error> {
4227        let _result = self.send_raw(result);
4228        if _result.is_err() {
4229            self.control_handle.shutdown();
4230        }
4231        self.drop_without_shutdown();
4232        _result
4233    }
4234
4235    /// Similar to "send" but does not shutdown the channel if an error occurs.
4236    pub fn send_no_shutdown_on_err(
4237        self,
4238        mut result: Result<&[DaiSupportedFormats], DriverError>,
4239    ) -> Result<(), fidl::Error> {
4240        let _result = self.send_raw(result);
4241        self.drop_without_shutdown();
4242        _result
4243    }
4244
4245    fn send_raw(
4246        &self,
4247        mut result: Result<&[DaiSupportedFormats], DriverError>,
4248    ) -> Result<(), fidl::Error> {
4249        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4250            CompositeGetDaiFormatsResponse,
4251            DriverError,
4252        >>(
4253            fidl::encoding::FlexibleResult::new(result.map(|dai_formats| (dai_formats,))),
4254            self.tx_id,
4255            0x3cbeaed59c8f69b,
4256            fidl::encoding::DynamicFlags::FLEXIBLE,
4257        )
4258    }
4259}
4260
4261#[must_use = "FIDL methods require a response to be sent"]
4262#[derive(Debug)]
4263pub struct CompositeSetDaiFormatResponder {
4264    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4265    tx_id: u32,
4266}
4267
4268/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4269/// if the responder is dropped without sending a response, so that the client
4270/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4271impl std::ops::Drop for CompositeSetDaiFormatResponder {
4272    fn drop(&mut self) {
4273        self.control_handle.shutdown();
4274        // Safety: drops once, never accessed again
4275        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4276    }
4277}
4278
4279impl fidl::endpoints::Responder for CompositeSetDaiFormatResponder {
4280    type ControlHandle = CompositeControlHandle;
4281
4282    fn control_handle(&self) -> &CompositeControlHandle {
4283        &self.control_handle
4284    }
4285
4286    fn drop_without_shutdown(mut self) {
4287        // Safety: drops once, never accessed again due to mem::forget
4288        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4289        // Prevent Drop from running (which would shut down the channel)
4290        std::mem::forget(self);
4291    }
4292}
4293
4294impl CompositeSetDaiFormatResponder {
4295    /// Sends a response to the FIDL transaction.
4296    ///
4297    /// Sets the channel to shutdown if an error occurs.
4298    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4299        let _result = self.send_raw(result);
4300        if _result.is_err() {
4301            self.control_handle.shutdown();
4302        }
4303        self.drop_without_shutdown();
4304        _result
4305    }
4306
4307    /// Similar to "send" but does not shutdown the channel if an error occurs.
4308    pub fn send_no_shutdown_on_err(
4309        self,
4310        mut result: Result<(), DriverError>,
4311    ) -> Result<(), fidl::Error> {
4312        let _result = self.send_raw(result);
4313        self.drop_without_shutdown();
4314        _result
4315    }
4316
4317    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4318        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4319            fidl::encoding::EmptyStruct,
4320            DriverError,
4321        >>(
4322            fidl::encoding::FlexibleResult::new(result),
4323            self.tx_id,
4324            0x155acf5cc0dc8a84,
4325            fidl::encoding::DynamicFlags::FLEXIBLE,
4326        )
4327    }
4328}
4329
4330#[must_use = "FIDL methods require a response to be sent"]
4331#[derive(Debug)]
4332pub struct CompositeGetPacketStreamFormatsResponder {
4333    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4334    tx_id: u32,
4335}
4336
4337/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4338/// if the responder is dropped without sending a response, so that the client
4339/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4340impl std::ops::Drop for CompositeGetPacketStreamFormatsResponder {
4341    fn drop(&mut self) {
4342        self.control_handle.shutdown();
4343        // Safety: drops once, never accessed again
4344        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4345    }
4346}
4347
4348impl fidl::endpoints::Responder for CompositeGetPacketStreamFormatsResponder {
4349    type ControlHandle = CompositeControlHandle;
4350
4351    fn control_handle(&self) -> &CompositeControlHandle {
4352        &self.control_handle
4353    }
4354
4355    fn drop_without_shutdown(mut self) {
4356        // Safety: drops once, never accessed again due to mem::forget
4357        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4358        // Prevent Drop from running (which would shut down the channel)
4359        std::mem::forget(self);
4360    }
4361}
4362
4363impl CompositeGetPacketStreamFormatsResponder {
4364    /// Sends a response to the FIDL transaction.
4365    ///
4366    /// Sets the channel to shutdown if an error occurs.
4367    pub fn send(
4368        self,
4369        mut result: Result<&[SupportedFormats2], DriverError>,
4370    ) -> Result<(), fidl::Error> {
4371        let _result = self.send_raw(result);
4372        if _result.is_err() {
4373            self.control_handle.shutdown();
4374        }
4375        self.drop_without_shutdown();
4376        _result
4377    }
4378
4379    /// Similar to "send" but does not shutdown the channel if an error occurs.
4380    pub fn send_no_shutdown_on_err(
4381        self,
4382        mut result: Result<&[SupportedFormats2], DriverError>,
4383    ) -> Result<(), fidl::Error> {
4384        let _result = self.send_raw(result);
4385        self.drop_without_shutdown();
4386        _result
4387    }
4388
4389    fn send_raw(
4390        &self,
4391        mut result: Result<&[SupportedFormats2], DriverError>,
4392    ) -> Result<(), fidl::Error> {
4393        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4394            CompositeGetPacketStreamFormatsResponse,
4395            DriverError,
4396        >>(
4397            fidl::encoding::FlexibleResult::new(
4398                result.map(|packet_stream_formats| (packet_stream_formats,)),
4399            ),
4400            self.tx_id,
4401            0x73cc47c6ad39bca7,
4402            fidl::encoding::DynamicFlags::FLEXIBLE,
4403        )
4404    }
4405}
4406
4407#[must_use = "FIDL methods require a response to be sent"]
4408#[derive(Debug)]
4409pub struct CompositeCreatePacketStreamResponder {
4410    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4411    tx_id: u32,
4412}
4413
4414/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4415/// if the responder is dropped without sending a response, so that the client
4416/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4417impl std::ops::Drop for CompositeCreatePacketStreamResponder {
4418    fn drop(&mut self) {
4419        self.control_handle.shutdown();
4420        // Safety: drops once, never accessed again
4421        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4422    }
4423}
4424
4425impl fidl::endpoints::Responder for CompositeCreatePacketStreamResponder {
4426    type ControlHandle = CompositeControlHandle;
4427
4428    fn control_handle(&self) -> &CompositeControlHandle {
4429        &self.control_handle
4430    }
4431
4432    fn drop_without_shutdown(mut self) {
4433        // Safety: drops once, never accessed again due to mem::forget
4434        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4435        // Prevent Drop from running (which would shut down the channel)
4436        std::mem::forget(self);
4437    }
4438}
4439
4440impl CompositeCreatePacketStreamResponder {
4441    /// Sends a response to the FIDL transaction.
4442    ///
4443    /// Sets the channel to shutdown if an error occurs.
4444    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4445        let _result = self.send_raw(result);
4446        if _result.is_err() {
4447            self.control_handle.shutdown();
4448        }
4449        self.drop_without_shutdown();
4450        _result
4451    }
4452
4453    /// Similar to "send" but does not shutdown the channel if an error occurs.
4454    pub fn send_no_shutdown_on_err(
4455        self,
4456        mut result: Result<(), DriverError>,
4457    ) -> Result<(), fidl::Error> {
4458        let _result = self.send_raw(result);
4459        self.drop_without_shutdown();
4460        _result
4461    }
4462
4463    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4464        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4465            fidl::encoding::EmptyStruct,
4466            DriverError,
4467        >>(
4468            fidl::encoding::FlexibleResult::new(result),
4469            self.tx_id,
4470            0x50e8902b756c707c,
4471            fidl::encoding::DynamicFlags::FLEXIBLE,
4472        )
4473    }
4474}
4475
4476#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4477pub struct CompositeConnectorMarker;
4478
4479impl fidl::endpoints::ProtocolMarker for CompositeConnectorMarker {
4480    type Proxy = CompositeConnectorProxy;
4481    type RequestStream = CompositeConnectorRequestStream;
4482    #[cfg(target_os = "fuchsia")]
4483    type SynchronousProxy = CompositeConnectorSynchronousProxy;
4484
4485    const DEBUG_NAME: &'static str = "(anonymous) CompositeConnector";
4486}
4487
4488pub trait CompositeConnectorProxyInterface: Send + Sync {
4489    fn r#connect(
4490        &self,
4491        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4492    ) -> Result<(), fidl::Error>;
4493}
4494#[derive(Debug)]
4495#[cfg(target_os = "fuchsia")]
4496pub struct CompositeConnectorSynchronousProxy {
4497    client: fidl::client::sync::Client,
4498}
4499
4500#[cfg(target_os = "fuchsia")]
4501impl fidl::endpoints::SynchronousProxy for CompositeConnectorSynchronousProxy {
4502    type Proxy = CompositeConnectorProxy;
4503    type Protocol = CompositeConnectorMarker;
4504
4505    fn from_channel(inner: fidl::Channel) -> Self {
4506        Self::new(inner)
4507    }
4508
4509    fn into_channel(self) -> fidl::Channel {
4510        self.client.into_channel()
4511    }
4512
4513    fn as_channel(&self) -> &fidl::Channel {
4514        self.client.as_channel()
4515    }
4516}
4517
4518#[cfg(target_os = "fuchsia")]
4519impl CompositeConnectorSynchronousProxy {
4520    pub fn new(channel: fidl::Channel) -> Self {
4521        Self { client: fidl::client::sync::Client::new(channel) }
4522    }
4523
4524    pub fn into_channel(self) -> fidl::Channel {
4525        self.client.into_channel()
4526    }
4527
4528    /// Waits until an event arrives and returns it. It is safe for other
4529    /// threads to make concurrent requests while waiting for an event.
4530    pub fn wait_for_event(
4531        &self,
4532        deadline: zx::MonotonicInstant,
4533    ) -> Result<CompositeConnectorEvent, fidl::Error> {
4534        CompositeConnectorEvent::decode(
4535            self.client.wait_for_event::<CompositeConnectorMarker>(deadline)?,
4536        )
4537    }
4538
4539    /// Connect to a `Device` protocol.
4540    /// This method allows a component to serve FIDL outside the devhost's control.
4541    pub fn r#connect(
4542        &self,
4543        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4544    ) -> Result<(), fidl::Error> {
4545        self.client.send::<CompositeConnectorConnectRequest>(
4546            (composite_protocol,),
4547            0x7ee557529079e466,
4548            fidl::encoding::DynamicFlags::empty(),
4549        )
4550    }
4551}
4552
4553#[cfg(target_os = "fuchsia")]
4554impl From<CompositeConnectorSynchronousProxy> for zx::NullableHandle {
4555    fn from(value: CompositeConnectorSynchronousProxy) -> Self {
4556        value.into_channel().into()
4557    }
4558}
4559
4560#[cfg(target_os = "fuchsia")]
4561impl From<fidl::Channel> for CompositeConnectorSynchronousProxy {
4562    fn from(value: fidl::Channel) -> Self {
4563        Self::new(value)
4564    }
4565}
4566
4567#[cfg(target_os = "fuchsia")]
4568impl fidl::endpoints::FromClient for CompositeConnectorSynchronousProxy {
4569    type Protocol = CompositeConnectorMarker;
4570
4571    fn from_client(value: fidl::endpoints::ClientEnd<CompositeConnectorMarker>) -> Self {
4572        Self::new(value.into_channel())
4573    }
4574}
4575
4576#[derive(Debug, Clone)]
4577pub struct CompositeConnectorProxy {
4578    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4579}
4580
4581impl fidl::endpoints::Proxy for CompositeConnectorProxy {
4582    type Protocol = CompositeConnectorMarker;
4583
4584    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4585        Self::new(inner)
4586    }
4587
4588    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4589        self.client.into_channel().map_err(|client| Self { client })
4590    }
4591
4592    fn as_channel(&self) -> &::fidl::AsyncChannel {
4593        self.client.as_channel()
4594    }
4595}
4596
4597impl CompositeConnectorProxy {
4598    /// Create a new Proxy for fuchsia.hardware.audio/CompositeConnector.
4599    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4600        let protocol_name =
4601            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4602        Self { client: fidl::client::Client::new(channel, protocol_name) }
4603    }
4604
4605    /// Get a Stream of events from the remote end of the protocol.
4606    ///
4607    /// # Panics
4608    ///
4609    /// Panics if the event stream was already taken.
4610    pub fn take_event_stream(&self) -> CompositeConnectorEventStream {
4611        CompositeConnectorEventStream { event_receiver: self.client.take_event_receiver() }
4612    }
4613
4614    /// Connect to a `Device` protocol.
4615    /// This method allows a component to serve FIDL outside the devhost's control.
4616    pub fn r#connect(
4617        &self,
4618        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4619    ) -> Result<(), fidl::Error> {
4620        CompositeConnectorProxyInterface::r#connect(self, composite_protocol)
4621    }
4622}
4623
4624impl CompositeConnectorProxyInterface for CompositeConnectorProxy {
4625    fn r#connect(
4626        &self,
4627        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4628    ) -> Result<(), fidl::Error> {
4629        self.client.send::<CompositeConnectorConnectRequest>(
4630            (composite_protocol,),
4631            0x7ee557529079e466,
4632            fidl::encoding::DynamicFlags::empty(),
4633        )
4634    }
4635}
4636
4637pub struct CompositeConnectorEventStream {
4638    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4639}
4640
4641impl std::marker::Unpin for CompositeConnectorEventStream {}
4642
4643impl futures::stream::FusedStream for CompositeConnectorEventStream {
4644    fn is_terminated(&self) -> bool {
4645        self.event_receiver.is_terminated()
4646    }
4647}
4648
4649impl futures::Stream for CompositeConnectorEventStream {
4650    type Item = Result<CompositeConnectorEvent, fidl::Error>;
4651
4652    fn poll_next(
4653        mut self: std::pin::Pin<&mut Self>,
4654        cx: &mut std::task::Context<'_>,
4655    ) -> std::task::Poll<Option<Self::Item>> {
4656        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4657            &mut self.event_receiver,
4658            cx
4659        )?) {
4660            Some(buf) => std::task::Poll::Ready(Some(CompositeConnectorEvent::decode(buf))),
4661            None => std::task::Poll::Ready(None),
4662        }
4663    }
4664}
4665
4666#[derive(Debug)]
4667pub enum CompositeConnectorEvent {}
4668
4669impl CompositeConnectorEvent {
4670    /// Decodes a message buffer as a [`CompositeConnectorEvent`].
4671    fn decode(
4672        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4673    ) -> Result<CompositeConnectorEvent, fidl::Error> {
4674        let (bytes, _handles) = buf.split_mut();
4675        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4676        debug_assert_eq!(tx_header.tx_id, 0);
4677        match tx_header.ordinal {
4678            _ => Err(fidl::Error::UnknownOrdinal {
4679                ordinal: tx_header.ordinal,
4680                protocol_name:
4681                    <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4682            }),
4683        }
4684    }
4685}
4686
4687/// A Stream of incoming requests for fuchsia.hardware.audio/CompositeConnector.
4688pub struct CompositeConnectorRequestStream {
4689    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4690    is_terminated: bool,
4691}
4692
4693impl std::marker::Unpin for CompositeConnectorRequestStream {}
4694
4695impl futures::stream::FusedStream for CompositeConnectorRequestStream {
4696    fn is_terminated(&self) -> bool {
4697        self.is_terminated
4698    }
4699}
4700
4701impl fidl::endpoints::RequestStream for CompositeConnectorRequestStream {
4702    type Protocol = CompositeConnectorMarker;
4703    type ControlHandle = CompositeConnectorControlHandle;
4704
4705    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4706        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4707    }
4708
4709    fn control_handle(&self) -> Self::ControlHandle {
4710        CompositeConnectorControlHandle { inner: self.inner.clone() }
4711    }
4712
4713    fn into_inner(
4714        self,
4715    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4716    {
4717        (self.inner, self.is_terminated)
4718    }
4719
4720    fn from_inner(
4721        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4722        is_terminated: bool,
4723    ) -> Self {
4724        Self { inner, is_terminated }
4725    }
4726}
4727
4728impl futures::Stream for CompositeConnectorRequestStream {
4729    type Item = Result<CompositeConnectorRequest, fidl::Error>;
4730
4731    fn poll_next(
4732        mut self: std::pin::Pin<&mut Self>,
4733        cx: &mut std::task::Context<'_>,
4734    ) -> std::task::Poll<Option<Self::Item>> {
4735        let this = &mut *self;
4736        if this.inner.check_shutdown(cx) {
4737            this.is_terminated = true;
4738            return std::task::Poll::Ready(None);
4739        }
4740        if this.is_terminated {
4741            panic!("polled CompositeConnectorRequestStream after completion");
4742        }
4743        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4744            |bytes, handles| {
4745                match this.inner.channel().read_etc(cx, bytes, handles) {
4746                    std::task::Poll::Ready(Ok(())) => {}
4747                    std::task::Poll::Pending => return std::task::Poll::Pending,
4748                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4749                        this.is_terminated = true;
4750                        return std::task::Poll::Ready(None);
4751                    }
4752                    std::task::Poll::Ready(Err(e)) => {
4753                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4754                            e.into(),
4755                        ))));
4756                    }
4757                }
4758
4759                // A message has been received from the channel
4760                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4761
4762                std::task::Poll::Ready(Some(match header.ordinal {
4763                0x7ee557529079e466 => {
4764                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4765                    let mut req = fidl::new_empty!(CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4766                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4767                    let control_handle = CompositeConnectorControlHandle {
4768                        inner: this.inner.clone(),
4769                    };
4770                    Ok(CompositeConnectorRequest::Connect {composite_protocol: req.composite_protocol,
4771
4772                        control_handle,
4773                    })
4774                }
4775                _ => Err(fidl::Error::UnknownOrdinal {
4776                    ordinal: header.ordinal,
4777                    protocol_name: <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4778                }),
4779            }))
4780            },
4781        )
4782    }
4783}
4784
4785/// For an overview see
4786/// [Audio Composite Devices](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md).
4787#[derive(Debug)]
4788pub enum CompositeConnectorRequest {
4789    /// Connect to a `Device` protocol.
4790    /// This method allows a component to serve FIDL outside the devhost's control.
4791    Connect {
4792        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4793        control_handle: CompositeConnectorControlHandle,
4794    },
4795}
4796
4797impl CompositeConnectorRequest {
4798    #[allow(irrefutable_let_patterns)]
4799    pub fn into_connect(
4800        self,
4801    ) -> Option<(fidl::endpoints::ServerEnd<CompositeMarker>, CompositeConnectorControlHandle)>
4802    {
4803        if let CompositeConnectorRequest::Connect { composite_protocol, control_handle } = self {
4804            Some((composite_protocol, control_handle))
4805        } else {
4806            None
4807        }
4808    }
4809
4810    /// Name of the method defined in FIDL
4811    pub fn method_name(&self) -> &'static str {
4812        match *self {
4813            CompositeConnectorRequest::Connect { .. } => "connect",
4814        }
4815    }
4816}
4817
4818#[derive(Debug, Clone)]
4819pub struct CompositeConnectorControlHandle {
4820    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4821}
4822
4823impl fidl::endpoints::ControlHandle for CompositeConnectorControlHandle {
4824    fn shutdown(&self) {
4825        self.inner.shutdown()
4826    }
4827
4828    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4829        self.inner.shutdown_with_epitaph(status)
4830    }
4831
4832    fn is_closed(&self) -> bool {
4833        self.inner.channel().is_closed()
4834    }
4835    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4836        self.inner.channel().on_closed()
4837    }
4838
4839    #[cfg(target_os = "fuchsia")]
4840    fn signal_peer(
4841        &self,
4842        clear_mask: zx::Signals,
4843        set_mask: zx::Signals,
4844    ) -> Result<(), zx_status::Status> {
4845        use fidl::Peered;
4846        self.inner.channel().signal_peer(clear_mask, set_mask)
4847    }
4848}
4849
4850impl CompositeConnectorControlHandle {}
4851
4852#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4853pub struct DaiMarker;
4854
4855impl fidl::endpoints::ProtocolMarker for DaiMarker {
4856    type Proxy = DaiProxy;
4857    type RequestStream = DaiRequestStream;
4858    #[cfg(target_os = "fuchsia")]
4859    type SynchronousProxy = DaiSynchronousProxy;
4860
4861    const DEBUG_NAME: &'static str = "(anonymous) Dai";
4862}
4863pub type DaiGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
4864pub type DaiGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, i32>;
4865
4866pub trait DaiProxyInterface: Send + Sync {
4867    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
4868        + Send;
4869    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
4870    fn r#signal_processing_connect(
4871        &self,
4872        protocol: fidl::endpoints::ServerEnd<
4873            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4874        >,
4875    ) -> Result<(), fidl::Error>;
4876    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4877    fn r#reset(&self) -> Self::ResetResponseFut;
4878    type GetPropertiesResponseFut: std::future::Future<Output = Result<DaiProperties, fidl::Error>>
4879        + Send;
4880    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
4881    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<DaiGetDaiFormatsResult, fidl::Error>>
4882        + Send;
4883    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
4884    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<DaiGetRingBufferFormatsResult, fidl::Error>>
4885        + Send;
4886    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut;
4887    fn r#create_ring_buffer(
4888        &self,
4889        dai_format: &DaiFormat,
4890        ring_buffer_format: &Format,
4891        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4892    ) -> Result<(), fidl::Error>;
4893}
4894#[derive(Debug)]
4895#[cfg(target_os = "fuchsia")]
4896pub struct DaiSynchronousProxy {
4897    client: fidl::client::sync::Client,
4898}
4899
4900#[cfg(target_os = "fuchsia")]
4901impl fidl::endpoints::SynchronousProxy for DaiSynchronousProxy {
4902    type Proxy = DaiProxy;
4903    type Protocol = DaiMarker;
4904
4905    fn from_channel(inner: fidl::Channel) -> Self {
4906        Self::new(inner)
4907    }
4908
4909    fn into_channel(self) -> fidl::Channel {
4910        self.client.into_channel()
4911    }
4912
4913    fn as_channel(&self) -> &fidl::Channel {
4914        self.client.as_channel()
4915    }
4916}
4917
4918#[cfg(target_os = "fuchsia")]
4919impl DaiSynchronousProxy {
4920    pub fn new(channel: fidl::Channel) -> Self {
4921        Self { client: fidl::client::sync::Client::new(channel) }
4922    }
4923
4924    pub fn into_channel(self) -> fidl::Channel {
4925        self.client.into_channel()
4926    }
4927
4928    /// Waits until an event arrives and returns it. It is safe for other
4929    /// threads to make concurrent requests while waiting for an event.
4930    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<DaiEvent, fidl::Error> {
4931        DaiEvent::decode(self.client.wait_for_event::<DaiMarker>(deadline)?)
4932    }
4933
4934    /// Retrieves top level health state.
4935    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4936    pub fn r#get_health_state(
4937        &self,
4938        ___deadline: zx::MonotonicInstant,
4939    ) -> Result<HealthState, fidl::Error> {
4940        let _response = self
4941            .client
4942            .send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse, DaiMarker>(
4943                (),
4944                0x4e146d6bca733a84,
4945                fidl::encoding::DynamicFlags::empty(),
4946                ___deadline,
4947            )?;
4948        Ok(_response.state)
4949    }
4950
4951    /// Connect to a `SignalProcessing` protocol.
4952    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4953    /// the maximum number of connections have already been created, for instance one, then the
4954    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4955    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4956    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4957    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4958    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4959    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4960    /// is intended to be composed, and hence the more verbose name allows differentiation and
4961    /// improved clarity.
4962    pub fn r#signal_processing_connect(
4963        &self,
4964        mut protocol: fidl::endpoints::ServerEnd<
4965            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4966        >,
4967    ) -> Result<(), fidl::Error> {
4968        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4969            (protocol,),
4970            0xa81907ce6066295,
4971            fidl::encoding::DynamicFlags::empty(),
4972        )
4973    }
4974
4975    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4976    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4977    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4978    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4979    /// protocol channel and retry.
4980    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
4981        let _response = self
4982            .client
4983            .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload, DaiMarker>(
4984                (),
4985                0x69e5fa9fa2f78c14,
4986                fidl::encoding::DynamicFlags::empty(),
4987                ___deadline,
4988            )?;
4989        Ok(_response)
4990    }
4991
4992    /// Retrieves top level static properties.
4993    pub fn r#get_properties(
4994        &self,
4995        ___deadline: zx::MonotonicInstant,
4996    ) -> Result<DaiProperties, fidl::Error> {
4997        let _response = self
4998            .client
4999            .send_query::<fidl::encoding::EmptyPayload, DaiGetPropertiesResponse, DaiMarker>(
5000                (),
5001                0x2c25a1a66149510b,
5002                fidl::encoding::DynamicFlags::empty(),
5003                ___deadline,
5004            )?;
5005        Ok(_response.properties)
5006    }
5007
5008    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5009    /// may reply with an error status and the client may retry at a later time.
5010    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5011    /// the parameters in SupportedFormats may be supported.
5012    pub fn r#get_dai_formats(
5013        &self,
5014        ___deadline: zx::MonotonicInstant,
5015    ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
5016        let _response = self.client.send_query::<
5017            fidl::encoding::EmptyPayload,
5018            fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
5019            DaiMarker,
5020        >(
5021            (),
5022            0x1eb37b0cddf79d69,
5023            fidl::encoding::DynamicFlags::empty(),
5024            ___deadline,
5025        )?;
5026        Ok(_response.map(|x| x.dai_formats))
5027    }
5028
5029    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5030    /// may reply with an error status and the client may retry at a later time.
5031    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5032    /// the parameters in `SupportedFormats` may be supported.
5033    pub fn r#get_ring_buffer_formats(
5034        &self,
5035        ___deadline: zx::MonotonicInstant,
5036    ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
5037        let _response = self.client.send_query::<
5038            fidl::encoding::EmptyPayload,
5039            fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
5040            DaiMarker,
5041        >(
5042            (),
5043            0x760371081d8c92e4,
5044            fidl::encoding::DynamicFlags::empty(),
5045            ___deadline,
5046        )?;
5047        Ok(_response.map(|x| x.ring_buffer_formats))
5048    }
5049
5050    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5051    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5052    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5053    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5054    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5055    /// gracefully quiesce any on-going streaming operations in the process.
5056    pub fn r#create_ring_buffer(
5057        &self,
5058        mut dai_format: &DaiFormat,
5059        mut ring_buffer_format: &Format,
5060        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5061    ) -> Result<(), fidl::Error> {
5062        self.client.send::<DaiCreateRingBufferRequest>(
5063            (dai_format, ring_buffer_format, ring_buffer),
5064            0x5af9760589a75257,
5065            fidl::encoding::DynamicFlags::empty(),
5066        )
5067    }
5068}
5069
5070#[cfg(target_os = "fuchsia")]
5071impl From<DaiSynchronousProxy> for zx::NullableHandle {
5072    fn from(value: DaiSynchronousProxy) -> Self {
5073        value.into_channel().into()
5074    }
5075}
5076
5077#[cfg(target_os = "fuchsia")]
5078impl From<fidl::Channel> for DaiSynchronousProxy {
5079    fn from(value: fidl::Channel) -> Self {
5080        Self::new(value)
5081    }
5082}
5083
5084#[cfg(target_os = "fuchsia")]
5085impl fidl::endpoints::FromClient for DaiSynchronousProxy {
5086    type Protocol = DaiMarker;
5087
5088    fn from_client(value: fidl::endpoints::ClientEnd<DaiMarker>) -> Self {
5089        Self::new(value.into_channel())
5090    }
5091}
5092
5093#[derive(Debug, Clone)]
5094pub struct DaiProxy {
5095    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5096}
5097
5098impl fidl::endpoints::Proxy for DaiProxy {
5099    type Protocol = DaiMarker;
5100
5101    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5102        Self::new(inner)
5103    }
5104
5105    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5106        self.client.into_channel().map_err(|client| Self { client })
5107    }
5108
5109    fn as_channel(&self) -> &::fidl::AsyncChannel {
5110        self.client.as_channel()
5111    }
5112}
5113
5114impl DaiProxy {
5115    /// Create a new Proxy for fuchsia.hardware.audio/Dai.
5116    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5117        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5118        Self { client: fidl::client::Client::new(channel, protocol_name) }
5119    }
5120
5121    /// Get a Stream of events from the remote end of the protocol.
5122    ///
5123    /// # Panics
5124    ///
5125    /// Panics if the event stream was already taken.
5126    pub fn take_event_stream(&self) -> DaiEventStream {
5127        DaiEventStream { event_receiver: self.client.take_event_receiver() }
5128    }
5129
5130    /// Retrieves top level health state.
5131    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5132    pub fn r#get_health_state(
5133        &self,
5134    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
5135    {
5136        DaiProxyInterface::r#get_health_state(self)
5137    }
5138
5139    /// Connect to a `SignalProcessing` protocol.
5140    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
5141    /// the maximum number of connections have already been created, for instance one, then the
5142    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
5143    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
5144    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
5145    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
5146    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
5147    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
5148    /// is intended to be composed, and hence the more verbose name allows differentiation and
5149    /// improved clarity.
5150    pub fn r#signal_processing_connect(
5151        &self,
5152        mut protocol: fidl::endpoints::ServerEnd<
5153            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5154        >,
5155    ) -> Result<(), fidl::Error> {
5156        DaiProxyInterface::r#signal_processing_connect(self, protocol)
5157    }
5158
5159    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5160    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5161    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5162    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5163    /// protocol channel and retry.
5164    pub fn r#reset(
5165        &self,
5166    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5167        DaiProxyInterface::r#reset(self)
5168    }
5169
5170    /// Retrieves top level static properties.
5171    pub fn r#get_properties(
5172        &self,
5173    ) -> fidl::client::QueryResponseFut<DaiProperties, fidl::encoding::DefaultFuchsiaResourceDialect>
5174    {
5175        DaiProxyInterface::r#get_properties(self)
5176    }
5177
5178    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5179    /// may reply with an error status and the client may retry at a later time.
5180    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5181    /// the parameters in SupportedFormats may be supported.
5182    pub fn r#get_dai_formats(
5183        &self,
5184    ) -> fidl::client::QueryResponseFut<
5185        DaiGetDaiFormatsResult,
5186        fidl::encoding::DefaultFuchsiaResourceDialect,
5187    > {
5188        DaiProxyInterface::r#get_dai_formats(self)
5189    }
5190
5191    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5192    /// may reply with an error status and the client may retry at a later time.
5193    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5194    /// the parameters in `SupportedFormats` may be supported.
5195    pub fn r#get_ring_buffer_formats(
5196        &self,
5197    ) -> fidl::client::QueryResponseFut<
5198        DaiGetRingBufferFormatsResult,
5199        fidl::encoding::DefaultFuchsiaResourceDialect,
5200    > {
5201        DaiProxyInterface::r#get_ring_buffer_formats(self)
5202    }
5203
5204    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5205    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5206    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5207    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5208    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5209    /// gracefully quiesce any on-going streaming operations in the process.
5210    pub fn r#create_ring_buffer(
5211        &self,
5212        mut dai_format: &DaiFormat,
5213        mut ring_buffer_format: &Format,
5214        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5215    ) -> Result<(), fidl::Error> {
5216        DaiProxyInterface::r#create_ring_buffer(self, dai_format, ring_buffer_format, ring_buffer)
5217    }
5218}
5219
5220impl DaiProxyInterface for DaiProxy {
5221    type GetHealthStateResponseFut =
5222        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
5223    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
5224        fn _decode(
5225            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5226        ) -> Result<HealthState, fidl::Error> {
5227            let _response = fidl::client::decode_transaction_body::<
5228                HealthGetHealthStateResponse,
5229                fidl::encoding::DefaultFuchsiaResourceDialect,
5230                0x4e146d6bca733a84,
5231            >(_buf?)?;
5232            Ok(_response.state)
5233        }
5234        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
5235            (),
5236            0x4e146d6bca733a84,
5237            fidl::encoding::DynamicFlags::empty(),
5238            _decode,
5239        )
5240    }
5241
5242    fn r#signal_processing_connect(
5243        &self,
5244        mut protocol: fidl::endpoints::ServerEnd<
5245            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5246        >,
5247    ) -> Result<(), fidl::Error> {
5248        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
5249            (protocol,),
5250            0xa81907ce6066295,
5251            fidl::encoding::DynamicFlags::empty(),
5252        )
5253    }
5254
5255    type ResetResponseFut =
5256        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5257    fn r#reset(&self) -> Self::ResetResponseFut {
5258        fn _decode(
5259            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5260        ) -> Result<(), fidl::Error> {
5261            let _response = fidl::client::decode_transaction_body::<
5262                fidl::encoding::EmptyPayload,
5263                fidl::encoding::DefaultFuchsiaResourceDialect,
5264                0x69e5fa9fa2f78c14,
5265            >(_buf?)?;
5266            Ok(_response)
5267        }
5268        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
5269            (),
5270            0x69e5fa9fa2f78c14,
5271            fidl::encoding::DynamicFlags::empty(),
5272            _decode,
5273        )
5274    }
5275
5276    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
5277        DaiProperties,
5278        fidl::encoding::DefaultFuchsiaResourceDialect,
5279    >;
5280    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
5281        fn _decode(
5282            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5283        ) -> Result<DaiProperties, fidl::Error> {
5284            let _response = fidl::client::decode_transaction_body::<
5285                DaiGetPropertiesResponse,
5286                fidl::encoding::DefaultFuchsiaResourceDialect,
5287                0x2c25a1a66149510b,
5288            >(_buf?)?;
5289            Ok(_response.properties)
5290        }
5291        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiProperties>(
5292            (),
5293            0x2c25a1a66149510b,
5294            fidl::encoding::DynamicFlags::empty(),
5295            _decode,
5296        )
5297    }
5298
5299    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
5300        DaiGetDaiFormatsResult,
5301        fidl::encoding::DefaultFuchsiaResourceDialect,
5302    >;
5303    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
5304        fn _decode(
5305            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5306        ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
5307            let _response = fidl::client::decode_transaction_body::<
5308                fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
5309                fidl::encoding::DefaultFuchsiaResourceDialect,
5310                0x1eb37b0cddf79d69,
5311            >(_buf?)?;
5312            Ok(_response.map(|x| x.dai_formats))
5313        }
5314        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetDaiFormatsResult>(
5315            (),
5316            0x1eb37b0cddf79d69,
5317            fidl::encoding::DynamicFlags::empty(),
5318            _decode,
5319        )
5320    }
5321
5322    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
5323        DaiGetRingBufferFormatsResult,
5324        fidl::encoding::DefaultFuchsiaResourceDialect,
5325    >;
5326    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut {
5327        fn _decode(
5328            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5329        ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
5330            let _response = fidl::client::decode_transaction_body::<
5331                fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
5332                fidl::encoding::DefaultFuchsiaResourceDialect,
5333                0x760371081d8c92e4,
5334            >(_buf?)?;
5335            Ok(_response.map(|x| x.ring_buffer_formats))
5336        }
5337        self.client
5338            .send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetRingBufferFormatsResult>(
5339                (),
5340                0x760371081d8c92e4,
5341                fidl::encoding::DynamicFlags::empty(),
5342                _decode,
5343            )
5344    }
5345
5346    fn r#create_ring_buffer(
5347        &self,
5348        mut dai_format: &DaiFormat,
5349        mut ring_buffer_format: &Format,
5350        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5351    ) -> Result<(), fidl::Error> {
5352        self.client.send::<DaiCreateRingBufferRequest>(
5353            (dai_format, ring_buffer_format, ring_buffer),
5354            0x5af9760589a75257,
5355            fidl::encoding::DynamicFlags::empty(),
5356        )
5357    }
5358}
5359
5360pub struct DaiEventStream {
5361    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5362}
5363
5364impl std::marker::Unpin for DaiEventStream {}
5365
5366impl futures::stream::FusedStream for DaiEventStream {
5367    fn is_terminated(&self) -> bool {
5368        self.event_receiver.is_terminated()
5369    }
5370}
5371
5372impl futures::Stream for DaiEventStream {
5373    type Item = Result<DaiEvent, fidl::Error>;
5374
5375    fn poll_next(
5376        mut self: std::pin::Pin<&mut Self>,
5377        cx: &mut std::task::Context<'_>,
5378    ) -> std::task::Poll<Option<Self::Item>> {
5379        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5380            &mut self.event_receiver,
5381            cx
5382        )?) {
5383            Some(buf) => std::task::Poll::Ready(Some(DaiEvent::decode(buf))),
5384            None => std::task::Poll::Ready(None),
5385        }
5386    }
5387}
5388
5389#[derive(Debug)]
5390pub enum DaiEvent {}
5391
5392impl DaiEvent {
5393    /// Decodes a message buffer as a [`DaiEvent`].
5394    fn decode(
5395        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5396    ) -> Result<DaiEvent, fidl::Error> {
5397        let (bytes, _handles) = buf.split_mut();
5398        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5399        debug_assert_eq!(tx_header.tx_id, 0);
5400        match tx_header.ordinal {
5401            _ => Err(fidl::Error::UnknownOrdinal {
5402                ordinal: tx_header.ordinal,
5403                protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5404            }),
5405        }
5406    }
5407}
5408
5409/// A Stream of incoming requests for fuchsia.hardware.audio/Dai.
5410pub struct DaiRequestStream {
5411    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5412    is_terminated: bool,
5413}
5414
5415impl std::marker::Unpin for DaiRequestStream {}
5416
5417impl futures::stream::FusedStream for DaiRequestStream {
5418    fn is_terminated(&self) -> bool {
5419        self.is_terminated
5420    }
5421}
5422
5423impl fidl::endpoints::RequestStream for DaiRequestStream {
5424    type Protocol = DaiMarker;
5425    type ControlHandle = DaiControlHandle;
5426
5427    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5428        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5429    }
5430
5431    fn control_handle(&self) -> Self::ControlHandle {
5432        DaiControlHandle { inner: self.inner.clone() }
5433    }
5434
5435    fn into_inner(
5436        self,
5437    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5438    {
5439        (self.inner, self.is_terminated)
5440    }
5441
5442    fn from_inner(
5443        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5444        is_terminated: bool,
5445    ) -> Self {
5446        Self { inner, is_terminated }
5447    }
5448}
5449
5450impl futures::Stream for DaiRequestStream {
5451    type Item = Result<DaiRequest, fidl::Error>;
5452
5453    fn poll_next(
5454        mut self: std::pin::Pin<&mut Self>,
5455        cx: &mut std::task::Context<'_>,
5456    ) -> std::task::Poll<Option<Self::Item>> {
5457        let this = &mut *self;
5458        if this.inner.check_shutdown(cx) {
5459            this.is_terminated = true;
5460            return std::task::Poll::Ready(None);
5461        }
5462        if this.is_terminated {
5463            panic!("polled DaiRequestStream after completion");
5464        }
5465        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5466            |bytes, handles| {
5467                match this.inner.channel().read_etc(cx, bytes, handles) {
5468                    std::task::Poll::Ready(Ok(())) => {}
5469                    std::task::Poll::Pending => return std::task::Poll::Pending,
5470                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5471                        this.is_terminated = true;
5472                        return std::task::Poll::Ready(None);
5473                    }
5474                    std::task::Poll::Ready(Err(e)) => {
5475                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5476                            e.into(),
5477                        ))));
5478                    }
5479                }
5480
5481                // A message has been received from the channel
5482                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5483
5484                std::task::Poll::Ready(Some(match header.ordinal {
5485                    0x4e146d6bca733a84 => {
5486                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5487                        let mut req = fidl::new_empty!(
5488                            fidl::encoding::EmptyPayload,
5489                            fidl::encoding::DefaultFuchsiaResourceDialect
5490                        );
5491                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5492                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5493                        Ok(DaiRequest::GetHealthState {
5494                            responder: DaiGetHealthStateResponder {
5495                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5496                                tx_id: header.tx_id,
5497                            },
5498                        })
5499                    }
5500                    0xa81907ce6066295 => {
5501                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5502                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5503                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5504                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5505                        Ok(DaiRequest::SignalProcessingConnect {
5506                            protocol: req.protocol,
5507
5508                            control_handle,
5509                        })
5510                    }
5511                    0x69e5fa9fa2f78c14 => {
5512                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5513                        let mut req = fidl::new_empty!(
5514                            fidl::encoding::EmptyPayload,
5515                            fidl::encoding::DefaultFuchsiaResourceDialect
5516                        );
5517                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5518                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5519                        Ok(DaiRequest::Reset {
5520                            responder: DaiResetResponder {
5521                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5522                                tx_id: header.tx_id,
5523                            },
5524                        })
5525                    }
5526                    0x2c25a1a66149510b => {
5527                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5528                        let mut req = fidl::new_empty!(
5529                            fidl::encoding::EmptyPayload,
5530                            fidl::encoding::DefaultFuchsiaResourceDialect
5531                        );
5532                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5533                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5534                        Ok(DaiRequest::GetProperties {
5535                            responder: DaiGetPropertiesResponder {
5536                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5537                                tx_id: header.tx_id,
5538                            },
5539                        })
5540                    }
5541                    0x1eb37b0cddf79d69 => {
5542                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5543                        let mut req = fidl::new_empty!(
5544                            fidl::encoding::EmptyPayload,
5545                            fidl::encoding::DefaultFuchsiaResourceDialect
5546                        );
5547                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5548                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5549                        Ok(DaiRequest::GetDaiFormats {
5550                            responder: DaiGetDaiFormatsResponder {
5551                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5552                                tx_id: header.tx_id,
5553                            },
5554                        })
5555                    }
5556                    0x760371081d8c92e4 => {
5557                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5558                        let mut req = fidl::new_empty!(
5559                            fidl::encoding::EmptyPayload,
5560                            fidl::encoding::DefaultFuchsiaResourceDialect
5561                        );
5562                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5563                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5564                        Ok(DaiRequest::GetRingBufferFormats {
5565                            responder: DaiGetRingBufferFormatsResponder {
5566                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5567                                tx_id: header.tx_id,
5568                            },
5569                        })
5570                    }
5571                    0x5af9760589a75257 => {
5572                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5573                        let mut req = fidl::new_empty!(
5574                            DaiCreateRingBufferRequest,
5575                            fidl::encoding::DefaultFuchsiaResourceDialect
5576                        );
5577                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
5578                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5579                        Ok(DaiRequest::CreateRingBuffer {
5580                            dai_format: req.dai_format,
5581                            ring_buffer_format: req.ring_buffer_format,
5582                            ring_buffer: req.ring_buffer,
5583
5584                            control_handle,
5585                        })
5586                    }
5587                    _ => Err(fidl::Error::UnknownOrdinal {
5588                        ordinal: header.ordinal,
5589                        protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5590                    }),
5591                }))
5592            },
5593        )
5594    }
5595}
5596
5597/// For an overview see
5598/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_dai).
5599/// # Deprecation
5600///
5601/// Not supported anymore, instead use an
5602/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5603/// with one DAI and one Ring Buffer, see
5604/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5605#[derive(Debug)]
5606pub enum DaiRequest {
5607    /// Retrieves top level health state.
5608    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5609    GetHealthState { responder: DaiGetHealthStateResponder },
5610    /// Connect to a `SignalProcessing` protocol.
5611    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
5612    /// the maximum number of connections have already been created, for instance one, then the
5613    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
5614    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
5615    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
5616    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
5617    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
5618    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
5619    /// is intended to be composed, and hence the more verbose name allows differentiation and
5620    /// improved clarity.
5621    SignalProcessingConnect {
5622        protocol: fidl::endpoints::ServerEnd<
5623            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5624        >,
5625        control_handle: DaiControlHandle,
5626    },
5627    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5628    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5629    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5630    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5631    /// protocol channel and retry.
5632    Reset { responder: DaiResetResponder },
5633    /// Retrieves top level static properties.
5634    GetProperties { responder: DaiGetPropertiesResponder },
5635    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5636    /// may reply with an error status and the client may retry at a later time.
5637    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5638    /// the parameters in SupportedFormats may be supported.
5639    GetDaiFormats { responder: DaiGetDaiFormatsResponder },
5640    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5641    /// may reply with an error status and the client may retry at a later time.
5642    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5643    /// the parameters in `SupportedFormats` may be supported.
5644    GetRingBufferFormats { responder: DaiGetRingBufferFormatsResponder },
5645    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5646    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5647    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5648    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5649    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5650    /// gracefully quiesce any on-going streaming operations in the process.
5651    CreateRingBuffer {
5652        dai_format: DaiFormat,
5653        ring_buffer_format: Format,
5654        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5655        control_handle: DaiControlHandle,
5656    },
5657}
5658
5659impl DaiRequest {
5660    #[allow(irrefutable_let_patterns)]
5661    pub fn into_get_health_state(self) -> Option<(DaiGetHealthStateResponder)> {
5662        if let DaiRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
5663    }
5664
5665    #[allow(irrefutable_let_patterns)]
5666    pub fn into_signal_processing_connect(
5667        self,
5668    ) -> Option<(
5669        fidl::endpoints::ServerEnd<
5670            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5671        >,
5672        DaiControlHandle,
5673    )> {
5674        if let DaiRequest::SignalProcessingConnect { protocol, control_handle } = self {
5675            Some((protocol, control_handle))
5676        } else {
5677            None
5678        }
5679    }
5680
5681    #[allow(irrefutable_let_patterns)]
5682    pub fn into_reset(self) -> Option<(DaiResetResponder)> {
5683        if let DaiRequest::Reset { responder } = self { Some((responder)) } else { None }
5684    }
5685
5686    #[allow(irrefutable_let_patterns)]
5687    pub fn into_get_properties(self) -> Option<(DaiGetPropertiesResponder)> {
5688        if let DaiRequest::GetProperties { responder } = self { Some((responder)) } else { None }
5689    }
5690
5691    #[allow(irrefutable_let_patterns)]
5692    pub fn into_get_dai_formats(self) -> Option<(DaiGetDaiFormatsResponder)> {
5693        if let DaiRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
5694    }
5695
5696    #[allow(irrefutable_let_patterns)]
5697    pub fn into_get_ring_buffer_formats(self) -> Option<(DaiGetRingBufferFormatsResponder)> {
5698        if let DaiRequest::GetRingBufferFormats { responder } = self {
5699            Some((responder))
5700        } else {
5701            None
5702        }
5703    }
5704
5705    #[allow(irrefutable_let_patterns)]
5706    pub fn into_create_ring_buffer(
5707        self,
5708    ) -> Option<(DaiFormat, Format, fidl::endpoints::ServerEnd<RingBufferMarker>, DaiControlHandle)>
5709    {
5710        if let DaiRequest::CreateRingBuffer {
5711            dai_format,
5712            ring_buffer_format,
5713            ring_buffer,
5714            control_handle,
5715        } = self
5716        {
5717            Some((dai_format, ring_buffer_format, ring_buffer, control_handle))
5718        } else {
5719            None
5720        }
5721    }
5722
5723    /// Name of the method defined in FIDL
5724    pub fn method_name(&self) -> &'static str {
5725        match *self {
5726            DaiRequest::GetHealthState { .. } => "get_health_state",
5727            DaiRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
5728            DaiRequest::Reset { .. } => "reset",
5729            DaiRequest::GetProperties { .. } => "get_properties",
5730            DaiRequest::GetDaiFormats { .. } => "get_dai_formats",
5731            DaiRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
5732            DaiRequest::CreateRingBuffer { .. } => "create_ring_buffer",
5733        }
5734    }
5735}
5736
5737#[derive(Debug, Clone)]
5738pub struct DaiControlHandle {
5739    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5740}
5741
5742impl fidl::endpoints::ControlHandle for DaiControlHandle {
5743    fn shutdown(&self) {
5744        self.inner.shutdown()
5745    }
5746
5747    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5748        self.inner.shutdown_with_epitaph(status)
5749    }
5750
5751    fn is_closed(&self) -> bool {
5752        self.inner.channel().is_closed()
5753    }
5754    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5755        self.inner.channel().on_closed()
5756    }
5757
5758    #[cfg(target_os = "fuchsia")]
5759    fn signal_peer(
5760        &self,
5761        clear_mask: zx::Signals,
5762        set_mask: zx::Signals,
5763    ) -> Result<(), zx_status::Status> {
5764        use fidl::Peered;
5765        self.inner.channel().signal_peer(clear_mask, set_mask)
5766    }
5767}
5768
5769impl DaiControlHandle {}
5770
5771#[must_use = "FIDL methods require a response to be sent"]
5772#[derive(Debug)]
5773pub struct DaiGetHealthStateResponder {
5774    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5775    tx_id: u32,
5776}
5777
5778/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5779/// if the responder is dropped without sending a response, so that the client
5780/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5781impl std::ops::Drop for DaiGetHealthStateResponder {
5782    fn drop(&mut self) {
5783        self.control_handle.shutdown();
5784        // Safety: drops once, never accessed again
5785        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5786    }
5787}
5788
5789impl fidl::endpoints::Responder for DaiGetHealthStateResponder {
5790    type ControlHandle = DaiControlHandle;
5791
5792    fn control_handle(&self) -> &DaiControlHandle {
5793        &self.control_handle
5794    }
5795
5796    fn drop_without_shutdown(mut self) {
5797        // Safety: drops once, never accessed again due to mem::forget
5798        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5799        // Prevent Drop from running (which would shut down the channel)
5800        std::mem::forget(self);
5801    }
5802}
5803
5804impl DaiGetHealthStateResponder {
5805    /// Sends a response to the FIDL transaction.
5806    ///
5807    /// Sets the channel to shutdown if an error occurs.
5808    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5809        let _result = self.send_raw(state);
5810        if _result.is_err() {
5811            self.control_handle.shutdown();
5812        }
5813        self.drop_without_shutdown();
5814        _result
5815    }
5816
5817    /// Similar to "send" but does not shutdown the channel if an error occurs.
5818    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5819        let _result = self.send_raw(state);
5820        self.drop_without_shutdown();
5821        _result
5822    }
5823
5824    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
5825        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
5826            (state,),
5827            self.tx_id,
5828            0x4e146d6bca733a84,
5829            fidl::encoding::DynamicFlags::empty(),
5830        )
5831    }
5832}
5833
5834#[must_use = "FIDL methods require a response to be sent"]
5835#[derive(Debug)]
5836pub struct DaiResetResponder {
5837    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5838    tx_id: u32,
5839}
5840
5841/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5842/// if the responder is dropped without sending a response, so that the client
5843/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5844impl std::ops::Drop for DaiResetResponder {
5845    fn drop(&mut self) {
5846        self.control_handle.shutdown();
5847        // Safety: drops once, never accessed again
5848        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5849    }
5850}
5851
5852impl fidl::endpoints::Responder for DaiResetResponder {
5853    type ControlHandle = DaiControlHandle;
5854
5855    fn control_handle(&self) -> &DaiControlHandle {
5856        &self.control_handle
5857    }
5858
5859    fn drop_without_shutdown(mut self) {
5860        // Safety: drops once, never accessed again due to mem::forget
5861        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5862        // Prevent Drop from running (which would shut down the channel)
5863        std::mem::forget(self);
5864    }
5865}
5866
5867impl DaiResetResponder {
5868    /// Sends a response to the FIDL transaction.
5869    ///
5870    /// Sets the channel to shutdown if an error occurs.
5871    pub fn send(self) -> Result<(), fidl::Error> {
5872        let _result = self.send_raw();
5873        if _result.is_err() {
5874            self.control_handle.shutdown();
5875        }
5876        self.drop_without_shutdown();
5877        _result
5878    }
5879
5880    /// Similar to "send" but does not shutdown the channel if an error occurs.
5881    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5882        let _result = self.send_raw();
5883        self.drop_without_shutdown();
5884        _result
5885    }
5886
5887    fn send_raw(&self) -> Result<(), fidl::Error> {
5888        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5889            (),
5890            self.tx_id,
5891            0x69e5fa9fa2f78c14,
5892            fidl::encoding::DynamicFlags::empty(),
5893        )
5894    }
5895}
5896
5897#[must_use = "FIDL methods require a response to be sent"]
5898#[derive(Debug)]
5899pub struct DaiGetPropertiesResponder {
5900    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5901    tx_id: u32,
5902}
5903
5904/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5905/// if the responder is dropped without sending a response, so that the client
5906/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5907impl std::ops::Drop for DaiGetPropertiesResponder {
5908    fn drop(&mut self) {
5909        self.control_handle.shutdown();
5910        // Safety: drops once, never accessed again
5911        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5912    }
5913}
5914
5915impl fidl::endpoints::Responder for DaiGetPropertiesResponder {
5916    type ControlHandle = DaiControlHandle;
5917
5918    fn control_handle(&self) -> &DaiControlHandle {
5919        &self.control_handle
5920    }
5921
5922    fn drop_without_shutdown(mut self) {
5923        // Safety: drops once, never accessed again due to mem::forget
5924        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5925        // Prevent Drop from running (which would shut down the channel)
5926        std::mem::forget(self);
5927    }
5928}
5929
5930impl DaiGetPropertiesResponder {
5931    /// Sends a response to the FIDL transaction.
5932    ///
5933    /// Sets the channel to shutdown if an error occurs.
5934    pub fn send(self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5935        let _result = self.send_raw(properties);
5936        if _result.is_err() {
5937            self.control_handle.shutdown();
5938        }
5939        self.drop_without_shutdown();
5940        _result
5941    }
5942
5943    /// Similar to "send" but does not shutdown the channel if an error occurs.
5944    pub fn send_no_shutdown_on_err(
5945        self,
5946        mut properties: &DaiProperties,
5947    ) -> Result<(), fidl::Error> {
5948        let _result = self.send_raw(properties);
5949        self.drop_without_shutdown();
5950        _result
5951    }
5952
5953    fn send_raw(&self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5954        self.control_handle.inner.send::<DaiGetPropertiesResponse>(
5955            (properties,),
5956            self.tx_id,
5957            0x2c25a1a66149510b,
5958            fidl::encoding::DynamicFlags::empty(),
5959        )
5960    }
5961}
5962
5963#[must_use = "FIDL methods require a response to be sent"]
5964#[derive(Debug)]
5965pub struct DaiGetDaiFormatsResponder {
5966    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5967    tx_id: u32,
5968}
5969
5970/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5971/// if the responder is dropped without sending a response, so that the client
5972/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5973impl std::ops::Drop for DaiGetDaiFormatsResponder {
5974    fn drop(&mut self) {
5975        self.control_handle.shutdown();
5976        // Safety: drops once, never accessed again
5977        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5978    }
5979}
5980
5981impl fidl::endpoints::Responder for DaiGetDaiFormatsResponder {
5982    type ControlHandle = DaiControlHandle;
5983
5984    fn control_handle(&self) -> &DaiControlHandle {
5985        &self.control_handle
5986    }
5987
5988    fn drop_without_shutdown(mut self) {
5989        // Safety: drops once, never accessed again due to mem::forget
5990        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5991        // Prevent Drop from running (which would shut down the channel)
5992        std::mem::forget(self);
5993    }
5994}
5995
5996impl DaiGetDaiFormatsResponder {
5997    /// Sends a response to the FIDL transaction.
5998    ///
5999    /// Sets the channel to shutdown if an error occurs.
6000    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
6001        let _result = self.send_raw(result);
6002        if _result.is_err() {
6003            self.control_handle.shutdown();
6004        }
6005        self.drop_without_shutdown();
6006        _result
6007    }
6008
6009    /// Similar to "send" but does not shutdown the channel if an error occurs.
6010    pub fn send_no_shutdown_on_err(
6011        self,
6012        mut result: Result<&[DaiSupportedFormats], i32>,
6013    ) -> Result<(), fidl::Error> {
6014        let _result = self.send_raw(result);
6015        self.drop_without_shutdown();
6016        _result
6017    }
6018
6019    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
6020        self.control_handle.inner.send::<fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>>(
6021            result.map(|dai_formats| (dai_formats,)),
6022            self.tx_id,
6023            0x1eb37b0cddf79d69,
6024            fidl::encoding::DynamicFlags::empty(),
6025        )
6026    }
6027}
6028
6029#[must_use = "FIDL methods require a response to be sent"]
6030#[derive(Debug)]
6031pub struct DaiGetRingBufferFormatsResponder {
6032    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
6033    tx_id: u32,
6034}
6035
6036/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
6037/// if the responder is dropped without sending a response, so that the client
6038/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6039impl std::ops::Drop for DaiGetRingBufferFormatsResponder {
6040    fn drop(&mut self) {
6041        self.control_handle.shutdown();
6042        // Safety: drops once, never accessed again
6043        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6044    }
6045}
6046
6047impl fidl::endpoints::Responder for DaiGetRingBufferFormatsResponder {
6048    type ControlHandle = DaiControlHandle;
6049
6050    fn control_handle(&self) -> &DaiControlHandle {
6051        &self.control_handle
6052    }
6053
6054    fn drop_without_shutdown(mut self) {
6055        // Safety: drops once, never accessed again due to mem::forget
6056        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6057        // Prevent Drop from running (which would shut down the channel)
6058        std::mem::forget(self);
6059    }
6060}
6061
6062impl DaiGetRingBufferFormatsResponder {
6063    /// Sends a response to the FIDL transaction.
6064    ///
6065    /// Sets the channel to shutdown if an error occurs.
6066    pub fn send(self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
6067        let _result = self.send_raw(result);
6068        if _result.is_err() {
6069            self.control_handle.shutdown();
6070        }
6071        self.drop_without_shutdown();
6072        _result
6073    }
6074
6075    /// Similar to "send" but does not shutdown the channel if an error occurs.
6076    pub fn send_no_shutdown_on_err(
6077        self,
6078        mut result: Result<&[SupportedFormats], i32>,
6079    ) -> Result<(), fidl::Error> {
6080        let _result = self.send_raw(result);
6081        self.drop_without_shutdown();
6082        _result
6083    }
6084
6085    fn send_raw(&self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
6086        self.control_handle
6087            .inner
6088            .send::<fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>>(
6089                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
6090                self.tx_id,
6091                0x760371081d8c92e4,
6092                fidl::encoding::DynamicFlags::empty(),
6093            )
6094    }
6095}
6096
6097#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6098pub struct DaiConnectorMarker;
6099
6100impl fidl::endpoints::ProtocolMarker for DaiConnectorMarker {
6101    type Proxy = DaiConnectorProxy;
6102    type RequestStream = DaiConnectorRequestStream;
6103    #[cfg(target_os = "fuchsia")]
6104    type SynchronousProxy = DaiConnectorSynchronousProxy;
6105
6106    const DEBUG_NAME: &'static str = "(anonymous) DaiConnector";
6107}
6108
6109pub trait DaiConnectorProxyInterface: Send + Sync {
6110    fn r#connect(
6111        &self,
6112        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6113    ) -> Result<(), fidl::Error>;
6114}
6115#[derive(Debug)]
6116#[cfg(target_os = "fuchsia")]
6117pub struct DaiConnectorSynchronousProxy {
6118    client: fidl::client::sync::Client,
6119}
6120
6121#[cfg(target_os = "fuchsia")]
6122impl fidl::endpoints::SynchronousProxy for DaiConnectorSynchronousProxy {
6123    type Proxy = DaiConnectorProxy;
6124    type Protocol = DaiConnectorMarker;
6125
6126    fn from_channel(inner: fidl::Channel) -> Self {
6127        Self::new(inner)
6128    }
6129
6130    fn into_channel(self) -> fidl::Channel {
6131        self.client.into_channel()
6132    }
6133
6134    fn as_channel(&self) -> &fidl::Channel {
6135        self.client.as_channel()
6136    }
6137}
6138
6139#[cfg(target_os = "fuchsia")]
6140impl DaiConnectorSynchronousProxy {
6141    pub fn new(channel: fidl::Channel) -> Self {
6142        Self { client: fidl::client::sync::Client::new(channel) }
6143    }
6144
6145    pub fn into_channel(self) -> fidl::Channel {
6146        self.client.into_channel()
6147    }
6148
6149    /// Waits until an event arrives and returns it. It is safe for other
6150    /// threads to make concurrent requests while waiting for an event.
6151    pub fn wait_for_event(
6152        &self,
6153        deadline: zx::MonotonicInstant,
6154    ) -> Result<DaiConnectorEvent, fidl::Error> {
6155        DaiConnectorEvent::decode(self.client.wait_for_event::<DaiConnectorMarker>(deadline)?)
6156    }
6157
6158    /// This connects to a DAI protocol server.
6159    pub fn r#connect(
6160        &self,
6161        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6162    ) -> Result<(), fidl::Error> {
6163        self.client.send::<DaiConnectorConnectRequest>(
6164            (dai_protocol,),
6165            0x4e4db05c2eca1450,
6166            fidl::encoding::DynamicFlags::empty(),
6167        )
6168    }
6169}
6170
6171#[cfg(target_os = "fuchsia")]
6172impl From<DaiConnectorSynchronousProxy> for zx::NullableHandle {
6173    fn from(value: DaiConnectorSynchronousProxy) -> Self {
6174        value.into_channel().into()
6175    }
6176}
6177
6178#[cfg(target_os = "fuchsia")]
6179impl From<fidl::Channel> for DaiConnectorSynchronousProxy {
6180    fn from(value: fidl::Channel) -> Self {
6181        Self::new(value)
6182    }
6183}
6184
6185#[cfg(target_os = "fuchsia")]
6186impl fidl::endpoints::FromClient for DaiConnectorSynchronousProxy {
6187    type Protocol = DaiConnectorMarker;
6188
6189    fn from_client(value: fidl::endpoints::ClientEnd<DaiConnectorMarker>) -> Self {
6190        Self::new(value.into_channel())
6191    }
6192}
6193
6194#[derive(Debug, Clone)]
6195pub struct DaiConnectorProxy {
6196    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6197}
6198
6199impl fidl::endpoints::Proxy for DaiConnectorProxy {
6200    type Protocol = DaiConnectorMarker;
6201
6202    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6203        Self::new(inner)
6204    }
6205
6206    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6207        self.client.into_channel().map_err(|client| Self { client })
6208    }
6209
6210    fn as_channel(&self) -> &::fidl::AsyncChannel {
6211        self.client.as_channel()
6212    }
6213}
6214
6215impl DaiConnectorProxy {
6216    /// Create a new Proxy for fuchsia.hardware.audio/DaiConnector.
6217    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6218        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6219        Self { client: fidl::client::Client::new(channel, protocol_name) }
6220    }
6221
6222    /// Get a Stream of events from the remote end of the protocol.
6223    ///
6224    /// # Panics
6225    ///
6226    /// Panics if the event stream was already taken.
6227    pub fn take_event_stream(&self) -> DaiConnectorEventStream {
6228        DaiConnectorEventStream { event_receiver: self.client.take_event_receiver() }
6229    }
6230
6231    /// This connects to a DAI protocol server.
6232    pub fn r#connect(
6233        &self,
6234        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6235    ) -> Result<(), fidl::Error> {
6236        DaiConnectorProxyInterface::r#connect(self, dai_protocol)
6237    }
6238}
6239
6240impl DaiConnectorProxyInterface for DaiConnectorProxy {
6241    fn r#connect(
6242        &self,
6243        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6244    ) -> Result<(), fidl::Error> {
6245        self.client.send::<DaiConnectorConnectRequest>(
6246            (dai_protocol,),
6247            0x4e4db05c2eca1450,
6248            fidl::encoding::DynamicFlags::empty(),
6249        )
6250    }
6251}
6252
6253pub struct DaiConnectorEventStream {
6254    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6255}
6256
6257impl std::marker::Unpin for DaiConnectorEventStream {}
6258
6259impl futures::stream::FusedStream for DaiConnectorEventStream {
6260    fn is_terminated(&self) -> bool {
6261        self.event_receiver.is_terminated()
6262    }
6263}
6264
6265impl futures::Stream for DaiConnectorEventStream {
6266    type Item = Result<DaiConnectorEvent, fidl::Error>;
6267
6268    fn poll_next(
6269        mut self: std::pin::Pin<&mut Self>,
6270        cx: &mut std::task::Context<'_>,
6271    ) -> std::task::Poll<Option<Self::Item>> {
6272        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6273            &mut self.event_receiver,
6274            cx
6275        )?) {
6276            Some(buf) => std::task::Poll::Ready(Some(DaiConnectorEvent::decode(buf))),
6277            None => std::task::Poll::Ready(None),
6278        }
6279    }
6280}
6281
6282#[derive(Debug)]
6283pub enum DaiConnectorEvent {}
6284
6285impl DaiConnectorEvent {
6286    /// Decodes a message buffer as a [`DaiConnectorEvent`].
6287    fn decode(
6288        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6289    ) -> Result<DaiConnectorEvent, fidl::Error> {
6290        let (bytes, _handles) = buf.split_mut();
6291        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6292        debug_assert_eq!(tx_header.tx_id, 0);
6293        match tx_header.ordinal {
6294            _ => Err(fidl::Error::UnknownOrdinal {
6295                ordinal: tx_header.ordinal,
6296                protocol_name: <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6297            }),
6298        }
6299    }
6300}
6301
6302/// A Stream of incoming requests for fuchsia.hardware.audio/DaiConnector.
6303pub struct DaiConnectorRequestStream {
6304    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6305    is_terminated: bool,
6306}
6307
6308impl std::marker::Unpin for DaiConnectorRequestStream {}
6309
6310impl futures::stream::FusedStream for DaiConnectorRequestStream {
6311    fn is_terminated(&self) -> bool {
6312        self.is_terminated
6313    }
6314}
6315
6316impl fidl::endpoints::RequestStream for DaiConnectorRequestStream {
6317    type Protocol = DaiConnectorMarker;
6318    type ControlHandle = DaiConnectorControlHandle;
6319
6320    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6321        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6322    }
6323
6324    fn control_handle(&self) -> Self::ControlHandle {
6325        DaiConnectorControlHandle { inner: self.inner.clone() }
6326    }
6327
6328    fn into_inner(
6329        self,
6330    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6331    {
6332        (self.inner, self.is_terminated)
6333    }
6334
6335    fn from_inner(
6336        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6337        is_terminated: bool,
6338    ) -> Self {
6339        Self { inner, is_terminated }
6340    }
6341}
6342
6343impl futures::Stream for DaiConnectorRequestStream {
6344    type Item = Result<DaiConnectorRequest, fidl::Error>;
6345
6346    fn poll_next(
6347        mut self: std::pin::Pin<&mut Self>,
6348        cx: &mut std::task::Context<'_>,
6349    ) -> std::task::Poll<Option<Self::Item>> {
6350        let this = &mut *self;
6351        if this.inner.check_shutdown(cx) {
6352            this.is_terminated = true;
6353            return std::task::Poll::Ready(None);
6354        }
6355        if this.is_terminated {
6356            panic!("polled DaiConnectorRequestStream after completion");
6357        }
6358        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6359            |bytes, handles| {
6360                match this.inner.channel().read_etc(cx, bytes, handles) {
6361                    std::task::Poll::Ready(Ok(())) => {}
6362                    std::task::Poll::Pending => return std::task::Poll::Pending,
6363                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6364                        this.is_terminated = true;
6365                        return std::task::Poll::Ready(None);
6366                    }
6367                    std::task::Poll::Ready(Err(e)) => {
6368                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6369                            e.into(),
6370                        ))));
6371                    }
6372                }
6373
6374                // A message has been received from the channel
6375                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6376
6377                std::task::Poll::Ready(Some(match header.ordinal {
6378                    0x4e4db05c2eca1450 => {
6379                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6380                        let mut req = fidl::new_empty!(
6381                            DaiConnectorConnectRequest,
6382                            fidl::encoding::DefaultFuchsiaResourceDialect
6383                        );
6384                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
6385                        let control_handle =
6386                            DaiConnectorControlHandle { inner: this.inner.clone() };
6387                        Ok(DaiConnectorRequest::Connect {
6388                            dai_protocol: req.dai_protocol,
6389
6390                            control_handle,
6391                        })
6392                    }
6393                    _ => Err(fidl::Error::UnknownOrdinal {
6394                        ordinal: header.ordinal,
6395                        protocol_name:
6396                            <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6397                    }),
6398                }))
6399            },
6400        )
6401    }
6402}
6403
6404/// For an overview of the DAI protocols see
6405/// [Digital Audio Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_dai.md)
6406/// # Deprecation
6407///
6408/// Not supported anymore, instead use an
6409/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
6410/// with one DAI and one Ring Buffer, see
6411/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
6412#[derive(Debug)]
6413pub enum DaiConnectorRequest {
6414    /// This connects to a DAI protocol server.
6415    Connect {
6416        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6417        control_handle: DaiConnectorControlHandle,
6418    },
6419}
6420
6421impl DaiConnectorRequest {
6422    #[allow(irrefutable_let_patterns)]
6423    pub fn into_connect(
6424        self,
6425    ) -> Option<(fidl::endpoints::ServerEnd<DaiMarker>, DaiConnectorControlHandle)> {
6426        if let DaiConnectorRequest::Connect { dai_protocol, control_handle } = self {
6427            Some((dai_protocol, control_handle))
6428        } else {
6429            None
6430        }
6431    }
6432
6433    /// Name of the method defined in FIDL
6434    pub fn method_name(&self) -> &'static str {
6435        match *self {
6436            DaiConnectorRequest::Connect { .. } => "connect",
6437        }
6438    }
6439}
6440
6441#[derive(Debug, Clone)]
6442pub struct DaiConnectorControlHandle {
6443    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6444}
6445
6446impl fidl::endpoints::ControlHandle for DaiConnectorControlHandle {
6447    fn shutdown(&self) {
6448        self.inner.shutdown()
6449    }
6450
6451    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6452        self.inner.shutdown_with_epitaph(status)
6453    }
6454
6455    fn is_closed(&self) -> bool {
6456        self.inner.channel().is_closed()
6457    }
6458    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6459        self.inner.channel().on_closed()
6460    }
6461
6462    #[cfg(target_os = "fuchsia")]
6463    fn signal_peer(
6464        &self,
6465        clear_mask: zx::Signals,
6466        set_mask: zx::Signals,
6467    ) -> Result<(), zx_status::Status> {
6468        use fidl::Peered;
6469        self.inner.channel().signal_peer(clear_mask, set_mask)
6470    }
6471}
6472
6473impl DaiConnectorControlHandle {}
6474
6475#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6476pub struct HealthMarker;
6477
6478impl fidl::endpoints::ProtocolMarker for HealthMarker {
6479    type Proxy = HealthProxy;
6480    type RequestStream = HealthRequestStream;
6481    #[cfg(target_os = "fuchsia")]
6482    type SynchronousProxy = HealthSynchronousProxy;
6483
6484    const DEBUG_NAME: &'static str = "(anonymous) Health";
6485}
6486
6487pub trait HealthProxyInterface: Send + Sync {
6488    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
6489        + Send;
6490    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
6491}
6492#[derive(Debug)]
6493#[cfg(target_os = "fuchsia")]
6494pub struct HealthSynchronousProxy {
6495    client: fidl::client::sync::Client,
6496}
6497
6498#[cfg(target_os = "fuchsia")]
6499impl fidl::endpoints::SynchronousProxy for HealthSynchronousProxy {
6500    type Proxy = HealthProxy;
6501    type Protocol = HealthMarker;
6502
6503    fn from_channel(inner: fidl::Channel) -> Self {
6504        Self::new(inner)
6505    }
6506
6507    fn into_channel(self) -> fidl::Channel {
6508        self.client.into_channel()
6509    }
6510
6511    fn as_channel(&self) -> &fidl::Channel {
6512        self.client.as_channel()
6513    }
6514}
6515
6516#[cfg(target_os = "fuchsia")]
6517impl HealthSynchronousProxy {
6518    pub fn new(channel: fidl::Channel) -> Self {
6519        Self { client: fidl::client::sync::Client::new(channel) }
6520    }
6521
6522    pub fn into_channel(self) -> fidl::Channel {
6523        self.client.into_channel()
6524    }
6525
6526    /// Waits until an event arrives and returns it. It is safe for other
6527    /// threads to make concurrent requests while waiting for an event.
6528    pub fn wait_for_event(
6529        &self,
6530        deadline: zx::MonotonicInstant,
6531    ) -> Result<HealthEvent, fidl::Error> {
6532        HealthEvent::decode(self.client.wait_for_event::<HealthMarker>(deadline)?)
6533    }
6534
6535    /// Retrieves top level health state.
6536    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6537    pub fn r#get_health_state(
6538        &self,
6539        ___deadline: zx::MonotonicInstant,
6540    ) -> Result<HealthState, fidl::Error> {
6541        let _response = self
6542            .client
6543            .send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse, HealthMarker>(
6544                (),
6545                0x4e146d6bca733a84,
6546                fidl::encoding::DynamicFlags::empty(),
6547                ___deadline,
6548            )?;
6549        Ok(_response.state)
6550    }
6551}
6552
6553#[cfg(target_os = "fuchsia")]
6554impl From<HealthSynchronousProxy> for zx::NullableHandle {
6555    fn from(value: HealthSynchronousProxy) -> Self {
6556        value.into_channel().into()
6557    }
6558}
6559
6560#[cfg(target_os = "fuchsia")]
6561impl From<fidl::Channel> for HealthSynchronousProxy {
6562    fn from(value: fidl::Channel) -> Self {
6563        Self::new(value)
6564    }
6565}
6566
6567#[cfg(target_os = "fuchsia")]
6568impl fidl::endpoints::FromClient for HealthSynchronousProxy {
6569    type Protocol = HealthMarker;
6570
6571    fn from_client(value: fidl::endpoints::ClientEnd<HealthMarker>) -> Self {
6572        Self::new(value.into_channel())
6573    }
6574}
6575
6576#[derive(Debug, Clone)]
6577pub struct HealthProxy {
6578    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6579}
6580
6581impl fidl::endpoints::Proxy for HealthProxy {
6582    type Protocol = HealthMarker;
6583
6584    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6585        Self::new(inner)
6586    }
6587
6588    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6589        self.client.into_channel().map_err(|client| Self { client })
6590    }
6591
6592    fn as_channel(&self) -> &::fidl::AsyncChannel {
6593        self.client.as_channel()
6594    }
6595}
6596
6597impl HealthProxy {
6598    /// Create a new Proxy for fuchsia.hardware.audio/Health.
6599    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6600        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6601        Self { client: fidl::client::Client::new(channel, protocol_name) }
6602    }
6603
6604    /// Get a Stream of events from the remote end of the protocol.
6605    ///
6606    /// # Panics
6607    ///
6608    /// Panics if the event stream was already taken.
6609    pub fn take_event_stream(&self) -> HealthEventStream {
6610        HealthEventStream { event_receiver: self.client.take_event_receiver() }
6611    }
6612
6613    /// Retrieves top level health state.
6614    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6615    pub fn r#get_health_state(
6616        &self,
6617    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
6618    {
6619        HealthProxyInterface::r#get_health_state(self)
6620    }
6621}
6622
6623impl HealthProxyInterface for HealthProxy {
6624    type GetHealthStateResponseFut =
6625        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
6626    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
6627        fn _decode(
6628            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6629        ) -> Result<HealthState, fidl::Error> {
6630            let _response = fidl::client::decode_transaction_body::<
6631                HealthGetHealthStateResponse,
6632                fidl::encoding::DefaultFuchsiaResourceDialect,
6633                0x4e146d6bca733a84,
6634            >(_buf?)?;
6635            Ok(_response.state)
6636        }
6637        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
6638            (),
6639            0x4e146d6bca733a84,
6640            fidl::encoding::DynamicFlags::empty(),
6641            _decode,
6642        )
6643    }
6644}
6645
6646pub struct HealthEventStream {
6647    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6648}
6649
6650impl std::marker::Unpin for HealthEventStream {}
6651
6652impl futures::stream::FusedStream for HealthEventStream {
6653    fn is_terminated(&self) -> bool {
6654        self.event_receiver.is_terminated()
6655    }
6656}
6657
6658impl futures::Stream for HealthEventStream {
6659    type Item = Result<HealthEvent, fidl::Error>;
6660
6661    fn poll_next(
6662        mut self: std::pin::Pin<&mut Self>,
6663        cx: &mut std::task::Context<'_>,
6664    ) -> std::task::Poll<Option<Self::Item>> {
6665        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6666            &mut self.event_receiver,
6667            cx
6668        )?) {
6669            Some(buf) => std::task::Poll::Ready(Some(HealthEvent::decode(buf))),
6670            None => std::task::Poll::Ready(None),
6671        }
6672    }
6673}
6674
6675#[derive(Debug)]
6676pub enum HealthEvent {}
6677
6678impl HealthEvent {
6679    /// Decodes a message buffer as a [`HealthEvent`].
6680    fn decode(
6681        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6682    ) -> Result<HealthEvent, fidl::Error> {
6683        let (bytes, _handles) = buf.split_mut();
6684        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6685        debug_assert_eq!(tx_header.tx_id, 0);
6686        match tx_header.ordinal {
6687            _ => Err(fidl::Error::UnknownOrdinal {
6688                ordinal: tx_header.ordinal,
6689                protocol_name: <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6690            }),
6691        }
6692    }
6693}
6694
6695/// A Stream of incoming requests for fuchsia.hardware.audio/Health.
6696pub struct HealthRequestStream {
6697    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6698    is_terminated: bool,
6699}
6700
6701impl std::marker::Unpin for HealthRequestStream {}
6702
6703impl futures::stream::FusedStream for HealthRequestStream {
6704    fn is_terminated(&self) -> bool {
6705        self.is_terminated
6706    }
6707}
6708
6709impl fidl::endpoints::RequestStream for HealthRequestStream {
6710    type Protocol = HealthMarker;
6711    type ControlHandle = HealthControlHandle;
6712
6713    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6714        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6715    }
6716
6717    fn control_handle(&self) -> Self::ControlHandle {
6718        HealthControlHandle { inner: self.inner.clone() }
6719    }
6720
6721    fn into_inner(
6722        self,
6723    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6724    {
6725        (self.inner, self.is_terminated)
6726    }
6727
6728    fn from_inner(
6729        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6730        is_terminated: bool,
6731    ) -> Self {
6732        Self { inner, is_terminated }
6733    }
6734}
6735
6736impl futures::Stream for HealthRequestStream {
6737    type Item = Result<HealthRequest, fidl::Error>;
6738
6739    fn poll_next(
6740        mut self: std::pin::Pin<&mut Self>,
6741        cx: &mut std::task::Context<'_>,
6742    ) -> std::task::Poll<Option<Self::Item>> {
6743        let this = &mut *self;
6744        if this.inner.check_shutdown(cx) {
6745            this.is_terminated = true;
6746            return std::task::Poll::Ready(None);
6747        }
6748        if this.is_terminated {
6749            panic!("polled HealthRequestStream after completion");
6750        }
6751        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6752            |bytes, handles| {
6753                match this.inner.channel().read_etc(cx, bytes, handles) {
6754                    std::task::Poll::Ready(Ok(())) => {}
6755                    std::task::Poll::Pending => return std::task::Poll::Pending,
6756                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6757                        this.is_terminated = true;
6758                        return std::task::Poll::Ready(None);
6759                    }
6760                    std::task::Poll::Ready(Err(e)) => {
6761                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6762                            e.into(),
6763                        ))));
6764                    }
6765                }
6766
6767                // A message has been received from the channel
6768                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6769
6770                std::task::Poll::Ready(Some(match header.ordinal {
6771                    0x4e146d6bca733a84 => {
6772                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6773                        let mut req = fidl::new_empty!(
6774                            fidl::encoding::EmptyPayload,
6775                            fidl::encoding::DefaultFuchsiaResourceDialect
6776                        );
6777                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6778                        let control_handle = HealthControlHandle { inner: this.inner.clone() };
6779                        Ok(HealthRequest::GetHealthState {
6780                            responder: HealthGetHealthStateResponder {
6781                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6782                                tx_id: header.tx_id,
6783                            },
6784                        })
6785                    }
6786                    _ => Err(fidl::Error::UnknownOrdinal {
6787                        ordinal: header.ordinal,
6788                        protocol_name:
6789                            <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6790                    }),
6791                }))
6792            },
6793        )
6794    }
6795}
6796
6797#[derive(Debug)]
6798pub enum HealthRequest {
6799    /// Retrieves top level health state.
6800    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6801    GetHealthState { responder: HealthGetHealthStateResponder },
6802}
6803
6804impl HealthRequest {
6805    #[allow(irrefutable_let_patterns)]
6806    pub fn into_get_health_state(self) -> Option<(HealthGetHealthStateResponder)> {
6807        if let HealthRequest::GetHealthState { responder } = self {
6808            Some((responder))
6809        } else {
6810            None
6811        }
6812    }
6813
6814    /// Name of the method defined in FIDL
6815    pub fn method_name(&self) -> &'static str {
6816        match *self {
6817            HealthRequest::GetHealthState { .. } => "get_health_state",
6818        }
6819    }
6820}
6821
6822#[derive(Debug, Clone)]
6823pub struct HealthControlHandle {
6824    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6825}
6826
6827impl fidl::endpoints::ControlHandle for HealthControlHandle {
6828    fn shutdown(&self) {
6829        self.inner.shutdown()
6830    }
6831
6832    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6833        self.inner.shutdown_with_epitaph(status)
6834    }
6835
6836    fn is_closed(&self) -> bool {
6837        self.inner.channel().is_closed()
6838    }
6839    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6840        self.inner.channel().on_closed()
6841    }
6842
6843    #[cfg(target_os = "fuchsia")]
6844    fn signal_peer(
6845        &self,
6846        clear_mask: zx::Signals,
6847        set_mask: zx::Signals,
6848    ) -> Result<(), zx_status::Status> {
6849        use fidl::Peered;
6850        self.inner.channel().signal_peer(clear_mask, set_mask)
6851    }
6852}
6853
6854impl HealthControlHandle {}
6855
6856#[must_use = "FIDL methods require a response to be sent"]
6857#[derive(Debug)]
6858pub struct HealthGetHealthStateResponder {
6859    control_handle: std::mem::ManuallyDrop<HealthControlHandle>,
6860    tx_id: u32,
6861}
6862
6863/// Set the the channel to be shutdown (see [`HealthControlHandle::shutdown`])
6864/// if the responder is dropped without sending a response, so that the client
6865/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6866impl std::ops::Drop for HealthGetHealthStateResponder {
6867    fn drop(&mut self) {
6868        self.control_handle.shutdown();
6869        // Safety: drops once, never accessed again
6870        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6871    }
6872}
6873
6874impl fidl::endpoints::Responder for HealthGetHealthStateResponder {
6875    type ControlHandle = HealthControlHandle;
6876
6877    fn control_handle(&self) -> &HealthControlHandle {
6878        &self.control_handle
6879    }
6880
6881    fn drop_without_shutdown(mut self) {
6882        // Safety: drops once, never accessed again due to mem::forget
6883        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6884        // Prevent Drop from running (which would shut down the channel)
6885        std::mem::forget(self);
6886    }
6887}
6888
6889impl HealthGetHealthStateResponder {
6890    /// Sends a response to the FIDL transaction.
6891    ///
6892    /// Sets the channel to shutdown if an error occurs.
6893    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6894        let _result = self.send_raw(state);
6895        if _result.is_err() {
6896            self.control_handle.shutdown();
6897        }
6898        self.drop_without_shutdown();
6899        _result
6900    }
6901
6902    /// Similar to "send" but does not shutdown the channel if an error occurs.
6903    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6904        let _result = self.send_raw(state);
6905        self.drop_without_shutdown();
6906        _result
6907    }
6908
6909    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
6910        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
6911            (state,),
6912            self.tx_id,
6913            0x4e146d6bca733a84,
6914            fidl::encoding::DynamicFlags::empty(),
6915        )
6916    }
6917}
6918
6919#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6920pub struct PacketStreamControlMarker;
6921
6922impl fidl::endpoints::ProtocolMarker for PacketStreamControlMarker {
6923    type Proxy = PacketStreamControlProxy;
6924    type RequestStream = PacketStreamControlRequestStream;
6925    #[cfg(target_os = "fuchsia")]
6926    type SynchronousProxy = PacketStreamControlSynchronousProxy;
6927
6928    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamControl";
6929}
6930pub type PacketStreamControlAllocateVmosResult = Result<Vec<VmoInfo>, i32>;
6931pub type PacketStreamControlDeallocateVmosResult = Result<(), i32>;
6932pub type PacketStreamControlRegisterVmosResult = Result<(), i32>;
6933pub type PacketStreamControlUnregisterVmosResult = Result<(), i32>;
6934pub type PacketStreamControlGetPacketStreamSinkResult =
6935    Result<PacketStreamControlGetPacketStreamSinkResponse, i32>;
6936pub type PacketStreamControlSetPacketStreamSinkResult = Result<(), i32>;
6937pub type PacketStreamControlStartResult = Result<(), i32>;
6938pub type PacketStreamControlStopResult = Result<(), i32>;
6939
6940pub trait PacketStreamControlProxyInterface: Send + Sync {
6941    type GetPropertiesResponseFut: std::future::Future<Output = Result<PacketStreamProperties, fidl::Error>>
6942        + Send;
6943    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
6944    type AllocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlAllocateVmosResult, fidl::Error>>
6945        + Send;
6946    fn r#allocate_vmos(&self, payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut;
6947    type DeallocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlDeallocateVmosResult, fidl::Error>>
6948        + Send;
6949    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut;
6950    type RegisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlRegisterVmosResult, fidl::Error>>
6951        + Send;
6952    fn r#register_vmos(&self, payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut;
6953    type UnregisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlUnregisterVmosResult, fidl::Error>>
6954        + Send;
6955    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut;
6956    type GetPacketStreamSinkResponseFut: std::future::Future<
6957            Output = Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error>,
6958        > + Send;
6959    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut;
6960    type SetPacketStreamSinkResponseFut: std::future::Future<
6961            Output = Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error>,
6962        > + Send;
6963    fn r#set_packet_stream_sink(
6964        &self,
6965        payload: PacketStreamControlSetPacketStreamSinkRequest,
6966    ) -> Self::SetPacketStreamSinkResponseFut;
6967    type StartResponseFut: std::future::Future<Output = Result<PacketStreamControlStartResult, fidl::Error>>
6968        + Send;
6969    fn r#start(&self) -> Self::StartResponseFut;
6970    type StopResponseFut: std::future::Future<Output = Result<PacketStreamControlStopResult, fidl::Error>>
6971        + Send;
6972    fn r#stop(&self) -> Self::StopResponseFut;
6973}
6974#[derive(Debug)]
6975#[cfg(target_os = "fuchsia")]
6976pub struct PacketStreamControlSynchronousProxy {
6977    client: fidl::client::sync::Client,
6978}
6979
6980#[cfg(target_os = "fuchsia")]
6981impl fidl::endpoints::SynchronousProxy for PacketStreamControlSynchronousProxy {
6982    type Proxy = PacketStreamControlProxy;
6983    type Protocol = PacketStreamControlMarker;
6984
6985    fn from_channel(inner: fidl::Channel) -> Self {
6986        Self::new(inner)
6987    }
6988
6989    fn into_channel(self) -> fidl::Channel {
6990        self.client.into_channel()
6991    }
6992
6993    fn as_channel(&self) -> &fidl::Channel {
6994        self.client.as_channel()
6995    }
6996}
6997
6998#[cfg(target_os = "fuchsia")]
6999impl PacketStreamControlSynchronousProxy {
7000    pub fn new(channel: fidl::Channel) -> Self {
7001        Self { client: fidl::client::sync::Client::new(channel) }
7002    }
7003
7004    pub fn into_channel(self) -> fidl::Channel {
7005        self.client.into_channel()
7006    }
7007
7008    /// Waits until an event arrives and returns it. It is safe for other
7009    /// threads to make concurrent requests while waiting for an event.
7010    pub fn wait_for_event(
7011        &self,
7012        deadline: zx::MonotonicInstant,
7013    ) -> Result<PacketStreamControlEvent, fidl::Error> {
7014        PacketStreamControlEvent::decode(
7015            self.client.wait_for_event::<PacketStreamControlMarker>(deadline)?,
7016        )
7017    }
7018
7019    /// Accessor for top level static properties.
7020    pub fn r#get_properties(
7021        &self,
7022        ___deadline: zx::MonotonicInstant,
7023    ) -> Result<PacketStreamProperties, fidl::Error> {
7024        let _response = self.client.send_query::<
7025            fidl::encoding::EmptyPayload,
7026            fidl::encoding::FlexibleType<PacketStreamControlGetPropertiesResponse>,
7027            PacketStreamControlMarker,
7028        >(
7029            (),
7030            0x586cf4f0f8d2771f,
7031            fidl::encoding::DynamicFlags::FLEXIBLE,
7032            ___deadline,
7033        )?
7034        .into_result::<PacketStreamControlMarker>("get_properties")?;
7035        Ok(_response.properties)
7036    }
7037
7038    /// Request the driver to allocate VMOs for data transfer.
7039    /// Returns the allocated VMOs and their assigned IDs.
7040    ///
7041    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7042    /// If the packet stream is an output stream, then the handle must also include
7043    /// ZX_RIGHT_WRITE.
7044    ///
7045    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
7046    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
7047    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
7048    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
7049    /// reconfigure.
7050    pub fn r#allocate_vmos(
7051        &self,
7052        mut payload: &AllocateVmosConfig,
7053        ___deadline: zx::MonotonicInstant,
7054    ) -> Result<PacketStreamControlAllocateVmosResult, fidl::Error> {
7055        let _response = self.client.send_query::<
7056            AllocateVmosConfig,
7057            fidl::encoding::FlexibleResultType<PacketStreamControlAllocateVmosResponse, i32>,
7058            PacketStreamControlMarker,
7059        >(
7060            payload,
7061            0x7ff1473165ed344b,
7062            fidl::encoding::DynamicFlags::FLEXIBLE,
7063            ___deadline,
7064        )?
7065        .into_result::<PacketStreamControlMarker>("allocate_vmos")?;
7066        Ok(_response.map(|x| x.vmos))
7067    }
7068
7069    /// Releases all VMOs previously allocated via `AllocateVmos`.
7070    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7071    ///
7072    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
7073    /// not stopped.
7074    pub fn r#deallocate_vmos(
7075        &self,
7076        ___deadline: zx::MonotonicInstant,
7077    ) -> Result<PacketStreamControlDeallocateVmosResult, fidl::Error> {
7078        let _response = self.client.send_query::<
7079            fidl::encoding::EmptyPayload,
7080            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7081            PacketStreamControlMarker,
7082        >(
7083            (),
7084            0x4db5cc85a7b8405b,
7085            fidl::encoding::DynamicFlags::FLEXIBLE,
7086            ___deadline,
7087        )?
7088        .into_result::<PacketStreamControlMarker>("deallocate_vmos")?;
7089        Ok(_response.map(|x| x))
7090    }
7091
7092    /// Registers client-allocated VMOs with the driver.
7093    ///
7094    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7095    /// If the packet stream is an input stream, then the handle must also include
7096    /// ZX_RIGHT_WRITE.
7097    ///
7098    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
7099    /// or if duplicate `vmo_id`s are found.
7100    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
7101    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
7102    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
7103    /// reconfigure.
7104    pub fn r#register_vmos(
7105        &self,
7106        mut payload: RegisterVmosConfig,
7107        ___deadline: zx::MonotonicInstant,
7108    ) -> Result<PacketStreamControlRegisterVmosResult, fidl::Error> {
7109        let _response = self.client.send_query::<
7110            RegisterVmosConfig,
7111            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7112            PacketStreamControlMarker,
7113        >(
7114            &mut payload,
7115            0x29c3b656a1020bfd,
7116            fidl::encoding::DynamicFlags::FLEXIBLE,
7117            ___deadline,
7118        )?
7119        .into_result::<PacketStreamControlMarker>("register_vmos")?;
7120        Ok(_response.map(|x| x))
7121    }
7122
7123    /// Unregisters all VMOs previously registered via `RegisterVmos`.
7124    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7125    ///
7126    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
7127    /// not stopped.
7128    pub fn r#unregister_vmos(
7129        &self,
7130        ___deadline: zx::MonotonicInstant,
7131    ) -> Result<PacketStreamControlUnregisterVmosResult, fidl::Error> {
7132        let _response = self.client.send_query::<
7133            fidl::encoding::EmptyPayload,
7134            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7135            PacketStreamControlMarker,
7136        >(
7137            (),
7138            0x3e3b4dbfe26b6094,
7139            fidl::encoding::DynamicFlags::FLEXIBLE,
7140            ___deadline,
7141        )?
7142        .into_result::<PacketStreamControlMarker>("unregister_vmos")?;
7143        Ok(_response.map(|x| x))
7144    }
7145
7146    /// Connects to the data sink implemented by the driver.
7147    /// This is used for audio **Output** where the driver consumes data.
7148    ///
7149    /// Flow:
7150    /// 1. App writes audio data to a registered VMO.
7151    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
7152    ///    true).
7153    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
7154    /// 4. Driver consumes the data.
7155    ///
7156    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
7157    /// and any pending requests on that channel are discarded. The new channel replaces the old
7158    /// one.
7159    ///
7160    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
7161    /// not support this method.
7162    pub fn r#get_packet_stream_sink(
7163        &self,
7164        ___deadline: zx::MonotonicInstant,
7165    ) -> Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error> {
7166        let _response =
7167            self.client
7168                .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
7169                    PacketStreamControlGetPacketStreamSinkResponse,
7170                    i32,
7171                >, PacketStreamControlMarker>(
7172                    (),
7173                    0x7394726463ebbc6a,
7174                    fidl::encoding::DynamicFlags::FLEXIBLE,
7175                    ___deadline,
7176                )?
7177                .into_result::<PacketStreamControlMarker>("get_packet_stream_sink")?;
7178        Ok(_response.map(|x| x))
7179    }
7180
7181    /// Provides a data sink to the driver.
7182    /// This is used for audio **Input** where the driver produces data.
7183    ///
7184    /// Flow:
7185    /// 1. Driver writes audio data to a registered VMO.
7186    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
7187    /// 3. App receives `PutPacket`.
7188    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
7189    ///    true).
7190    /// 5. App reads the data.
7191    ///
7192    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
7193    /// channel. The new channel replaces the old one.
7194    ///
7195    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
7196    /// not support this method.
7197    pub fn r#set_packet_stream_sink(
7198        &self,
7199        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7200        ___deadline: zx::MonotonicInstant,
7201    ) -> Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error> {
7202        let _response = self.client.send_query::<
7203            PacketStreamControlSetPacketStreamSinkRequest,
7204            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7205            PacketStreamControlMarker,
7206        >(
7207            &mut payload,
7208            0xab88800e31dc0e4,
7209            fidl::encoding::DynamicFlags::FLEXIBLE,
7210            ___deadline,
7211        )?
7212        .into_result::<PacketStreamControlMarker>("set_packet_stream_sink")?;
7213        Ok(_response.map(|x| x))
7214    }
7215
7216    /// Start the packet-stream.
7217    ///
7218    /// Returns `ZX_ERR_BAD_STATE` if:
7219    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
7220    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
7221    ///   `INLINE` is supported.
7222    /// * The stream is already started.
7223    pub fn r#start(
7224        &self,
7225        ___deadline: zx::MonotonicInstant,
7226    ) -> Result<PacketStreamControlStartResult, fidl::Error> {
7227        let _response = self.client.send_query::<
7228            fidl::encoding::EmptyPayload,
7229            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7230            PacketStreamControlMarker,
7231        >(
7232            (),
7233            0x3a584b94d8a6bfd0,
7234            fidl::encoding::DynamicFlags::FLEXIBLE,
7235            ___deadline,
7236        )?
7237        .into_result::<PacketStreamControlMarker>("start")?;
7238        Ok(_response.map(|x| x))
7239    }
7240
7241    /// Stop the packet-stream.
7242    ///
7243    /// Once the response is received, the stream is halted.
7244    ///
7245    /// Behavior depends on the stream direction:
7246    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
7247    ///   requests will remain pending until `Start` is called again. Clients may call
7248    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
7249    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
7250    ///   calls will be made by the driver until `Start` is called again.
7251    ///
7252    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
7253    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
7254    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
7255    ///   complete successfully after `Stop` has returned.
7256    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
7257    ///   arrive at the client after `Stop` has returned.
7258    ///
7259    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
7260    pub fn r#stop(
7261        &self,
7262        ___deadline: zx::MonotonicInstant,
7263    ) -> Result<PacketStreamControlStopResult, fidl::Error> {
7264        let _response = self.client.send_query::<
7265            fidl::encoding::EmptyPayload,
7266            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7267            PacketStreamControlMarker,
7268        >(
7269            (),
7270            0x703e4fafcdd7ef32,
7271            fidl::encoding::DynamicFlags::FLEXIBLE,
7272            ___deadline,
7273        )?
7274        .into_result::<PacketStreamControlMarker>("stop")?;
7275        Ok(_response.map(|x| x))
7276    }
7277}
7278
7279#[cfg(target_os = "fuchsia")]
7280impl From<PacketStreamControlSynchronousProxy> for zx::NullableHandle {
7281    fn from(value: PacketStreamControlSynchronousProxy) -> Self {
7282        value.into_channel().into()
7283    }
7284}
7285
7286#[cfg(target_os = "fuchsia")]
7287impl From<fidl::Channel> for PacketStreamControlSynchronousProxy {
7288    fn from(value: fidl::Channel) -> Self {
7289        Self::new(value)
7290    }
7291}
7292
7293#[cfg(target_os = "fuchsia")]
7294impl fidl::endpoints::FromClient for PacketStreamControlSynchronousProxy {
7295    type Protocol = PacketStreamControlMarker;
7296
7297    fn from_client(value: fidl::endpoints::ClientEnd<PacketStreamControlMarker>) -> Self {
7298        Self::new(value.into_channel())
7299    }
7300}
7301
7302#[derive(Debug, Clone)]
7303pub struct PacketStreamControlProxy {
7304    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7305}
7306
7307impl fidl::endpoints::Proxy for PacketStreamControlProxy {
7308    type Protocol = PacketStreamControlMarker;
7309
7310    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7311        Self::new(inner)
7312    }
7313
7314    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7315        self.client.into_channel().map_err(|client| Self { client })
7316    }
7317
7318    fn as_channel(&self) -> &::fidl::AsyncChannel {
7319        self.client.as_channel()
7320    }
7321}
7322
7323impl PacketStreamControlProxy {
7324    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamControl.
7325    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7326        let protocol_name =
7327            <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7328        Self { client: fidl::client::Client::new(channel, protocol_name) }
7329    }
7330
7331    /// Get a Stream of events from the remote end of the protocol.
7332    ///
7333    /// # Panics
7334    ///
7335    /// Panics if the event stream was already taken.
7336    pub fn take_event_stream(&self) -> PacketStreamControlEventStream {
7337        PacketStreamControlEventStream { event_receiver: self.client.take_event_receiver() }
7338    }
7339
7340    /// Accessor for top level static properties.
7341    pub fn r#get_properties(
7342        &self,
7343    ) -> fidl::client::QueryResponseFut<
7344        PacketStreamProperties,
7345        fidl::encoding::DefaultFuchsiaResourceDialect,
7346    > {
7347        PacketStreamControlProxyInterface::r#get_properties(self)
7348    }
7349
7350    /// Request the driver to allocate VMOs for data transfer.
7351    /// Returns the allocated VMOs and their assigned IDs.
7352    ///
7353    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7354    /// If the packet stream is an output stream, then the handle must also include
7355    /// ZX_RIGHT_WRITE.
7356    ///
7357    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
7358    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
7359    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
7360    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
7361    /// reconfigure.
7362    pub fn r#allocate_vmos(
7363        &self,
7364        mut payload: &AllocateVmosConfig,
7365    ) -> fidl::client::QueryResponseFut<
7366        PacketStreamControlAllocateVmosResult,
7367        fidl::encoding::DefaultFuchsiaResourceDialect,
7368    > {
7369        PacketStreamControlProxyInterface::r#allocate_vmos(self, payload)
7370    }
7371
7372    /// Releases all VMOs previously allocated via `AllocateVmos`.
7373    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7374    ///
7375    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
7376    /// not stopped.
7377    pub fn r#deallocate_vmos(
7378        &self,
7379    ) -> fidl::client::QueryResponseFut<
7380        PacketStreamControlDeallocateVmosResult,
7381        fidl::encoding::DefaultFuchsiaResourceDialect,
7382    > {
7383        PacketStreamControlProxyInterface::r#deallocate_vmos(self)
7384    }
7385
7386    /// Registers client-allocated VMOs with the driver.
7387    ///
7388    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7389    /// If the packet stream is an input stream, then the handle must also include
7390    /// ZX_RIGHT_WRITE.
7391    ///
7392    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
7393    /// or if duplicate `vmo_id`s are found.
7394    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
7395    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
7396    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
7397    /// reconfigure.
7398    pub fn r#register_vmos(
7399        &self,
7400        mut payload: RegisterVmosConfig,
7401    ) -> fidl::client::QueryResponseFut<
7402        PacketStreamControlRegisterVmosResult,
7403        fidl::encoding::DefaultFuchsiaResourceDialect,
7404    > {
7405        PacketStreamControlProxyInterface::r#register_vmos(self, payload)
7406    }
7407
7408    /// Unregisters all VMOs previously registered via `RegisterVmos`.
7409    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7410    ///
7411    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
7412    /// not stopped.
7413    pub fn r#unregister_vmos(
7414        &self,
7415    ) -> fidl::client::QueryResponseFut<
7416        PacketStreamControlUnregisterVmosResult,
7417        fidl::encoding::DefaultFuchsiaResourceDialect,
7418    > {
7419        PacketStreamControlProxyInterface::r#unregister_vmos(self)
7420    }
7421
7422    /// Connects to the data sink implemented by the driver.
7423    /// This is used for audio **Output** where the driver consumes data.
7424    ///
7425    /// Flow:
7426    /// 1. App writes audio data to a registered VMO.
7427    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
7428    ///    true).
7429    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
7430    /// 4. Driver consumes the data.
7431    ///
7432    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
7433    /// and any pending requests on that channel are discarded. The new channel replaces the old
7434    /// one.
7435    ///
7436    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
7437    /// not support this method.
7438    pub fn r#get_packet_stream_sink(
7439        &self,
7440    ) -> fidl::client::QueryResponseFut<
7441        PacketStreamControlGetPacketStreamSinkResult,
7442        fidl::encoding::DefaultFuchsiaResourceDialect,
7443    > {
7444        PacketStreamControlProxyInterface::r#get_packet_stream_sink(self)
7445    }
7446
7447    /// Provides a data sink to the driver.
7448    /// This is used for audio **Input** where the driver produces data.
7449    ///
7450    /// Flow:
7451    /// 1. Driver writes audio data to a registered VMO.
7452    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
7453    /// 3. App receives `PutPacket`.
7454    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
7455    ///    true).
7456    /// 5. App reads the data.
7457    ///
7458    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
7459    /// channel. The new channel replaces the old one.
7460    ///
7461    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
7462    /// not support this method.
7463    pub fn r#set_packet_stream_sink(
7464        &self,
7465        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7466    ) -> fidl::client::QueryResponseFut<
7467        PacketStreamControlSetPacketStreamSinkResult,
7468        fidl::encoding::DefaultFuchsiaResourceDialect,
7469    > {
7470        PacketStreamControlProxyInterface::r#set_packet_stream_sink(self, payload)
7471    }
7472
7473    /// Start the packet-stream.
7474    ///
7475    /// Returns `ZX_ERR_BAD_STATE` if:
7476    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
7477    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
7478    ///   `INLINE` is supported.
7479    /// * The stream is already started.
7480    pub fn r#start(
7481        &self,
7482    ) -> fidl::client::QueryResponseFut<
7483        PacketStreamControlStartResult,
7484        fidl::encoding::DefaultFuchsiaResourceDialect,
7485    > {
7486        PacketStreamControlProxyInterface::r#start(self)
7487    }
7488
7489    /// Stop the packet-stream.
7490    ///
7491    /// Once the response is received, the stream is halted.
7492    ///
7493    /// Behavior depends on the stream direction:
7494    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
7495    ///   requests will remain pending until `Start` is called again. Clients may call
7496    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
7497    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
7498    ///   calls will be made by the driver until `Start` is called again.
7499    ///
7500    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
7501    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
7502    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
7503    ///   complete successfully after `Stop` has returned.
7504    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
7505    ///   arrive at the client after `Stop` has returned.
7506    ///
7507    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
7508    pub fn r#stop(
7509        &self,
7510    ) -> fidl::client::QueryResponseFut<
7511        PacketStreamControlStopResult,
7512        fidl::encoding::DefaultFuchsiaResourceDialect,
7513    > {
7514        PacketStreamControlProxyInterface::r#stop(self)
7515    }
7516}
7517
7518impl PacketStreamControlProxyInterface for PacketStreamControlProxy {
7519    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
7520        PacketStreamProperties,
7521        fidl::encoding::DefaultFuchsiaResourceDialect,
7522    >;
7523    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
7524        fn _decode(
7525            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7526        ) -> Result<PacketStreamProperties, fidl::Error> {
7527            let _response = fidl::client::decode_transaction_body::<
7528                fidl::encoding::FlexibleType<PacketStreamControlGetPropertiesResponse>,
7529                fidl::encoding::DefaultFuchsiaResourceDialect,
7530                0x586cf4f0f8d2771f,
7531            >(_buf?)?
7532            .into_result::<PacketStreamControlMarker>("get_properties")?;
7533            Ok(_response.properties)
7534        }
7535        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamProperties>(
7536            (),
7537            0x586cf4f0f8d2771f,
7538            fidl::encoding::DynamicFlags::FLEXIBLE,
7539            _decode,
7540        )
7541    }
7542
7543    type AllocateVmosResponseFut = fidl::client::QueryResponseFut<
7544        PacketStreamControlAllocateVmosResult,
7545        fidl::encoding::DefaultFuchsiaResourceDialect,
7546    >;
7547    fn r#allocate_vmos(&self, mut payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut {
7548        fn _decode(
7549            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7550        ) -> Result<PacketStreamControlAllocateVmosResult, fidl::Error> {
7551            let _response = fidl::client::decode_transaction_body::<
7552                fidl::encoding::FlexibleResultType<PacketStreamControlAllocateVmosResponse, i32>,
7553                fidl::encoding::DefaultFuchsiaResourceDialect,
7554                0x7ff1473165ed344b,
7555            >(_buf?)?
7556            .into_result::<PacketStreamControlMarker>("allocate_vmos")?;
7557            Ok(_response.map(|x| x.vmos))
7558        }
7559        self.client
7560            .send_query_and_decode::<AllocateVmosConfig, PacketStreamControlAllocateVmosResult>(
7561                payload,
7562                0x7ff1473165ed344b,
7563                fidl::encoding::DynamicFlags::FLEXIBLE,
7564                _decode,
7565            )
7566    }
7567
7568    type DeallocateVmosResponseFut = fidl::client::QueryResponseFut<
7569        PacketStreamControlDeallocateVmosResult,
7570        fidl::encoding::DefaultFuchsiaResourceDialect,
7571    >;
7572    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut {
7573        fn _decode(
7574            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7575        ) -> Result<PacketStreamControlDeallocateVmosResult, fidl::Error> {
7576            let _response = fidl::client::decode_transaction_body::<
7577                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7578                fidl::encoding::DefaultFuchsiaResourceDialect,
7579                0x4db5cc85a7b8405b,
7580            >(_buf?)?
7581            .into_result::<PacketStreamControlMarker>("deallocate_vmos")?;
7582            Ok(_response.map(|x| x))
7583        }
7584        self.client.send_query_and_decode::<
7585            fidl::encoding::EmptyPayload,
7586            PacketStreamControlDeallocateVmosResult,
7587        >(
7588            (),
7589            0x4db5cc85a7b8405b,
7590            fidl::encoding::DynamicFlags::FLEXIBLE,
7591            _decode,
7592        )
7593    }
7594
7595    type RegisterVmosResponseFut = fidl::client::QueryResponseFut<
7596        PacketStreamControlRegisterVmosResult,
7597        fidl::encoding::DefaultFuchsiaResourceDialect,
7598    >;
7599    fn r#register_vmos(&self, mut payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut {
7600        fn _decode(
7601            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7602        ) -> Result<PacketStreamControlRegisterVmosResult, fidl::Error> {
7603            let _response = fidl::client::decode_transaction_body::<
7604                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7605                fidl::encoding::DefaultFuchsiaResourceDialect,
7606                0x29c3b656a1020bfd,
7607            >(_buf?)?
7608            .into_result::<PacketStreamControlMarker>("register_vmos")?;
7609            Ok(_response.map(|x| x))
7610        }
7611        self.client
7612            .send_query_and_decode::<RegisterVmosConfig, PacketStreamControlRegisterVmosResult>(
7613                &mut payload,
7614                0x29c3b656a1020bfd,
7615                fidl::encoding::DynamicFlags::FLEXIBLE,
7616                _decode,
7617            )
7618    }
7619
7620    type UnregisterVmosResponseFut = fidl::client::QueryResponseFut<
7621        PacketStreamControlUnregisterVmosResult,
7622        fidl::encoding::DefaultFuchsiaResourceDialect,
7623    >;
7624    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut {
7625        fn _decode(
7626            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7627        ) -> Result<PacketStreamControlUnregisterVmosResult, fidl::Error> {
7628            let _response = fidl::client::decode_transaction_body::<
7629                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7630                fidl::encoding::DefaultFuchsiaResourceDialect,
7631                0x3e3b4dbfe26b6094,
7632            >(_buf?)?
7633            .into_result::<PacketStreamControlMarker>("unregister_vmos")?;
7634            Ok(_response.map(|x| x))
7635        }
7636        self.client.send_query_and_decode::<
7637            fidl::encoding::EmptyPayload,
7638            PacketStreamControlUnregisterVmosResult,
7639        >(
7640            (),
7641            0x3e3b4dbfe26b6094,
7642            fidl::encoding::DynamicFlags::FLEXIBLE,
7643            _decode,
7644        )
7645    }
7646
7647    type GetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
7648        PacketStreamControlGetPacketStreamSinkResult,
7649        fidl::encoding::DefaultFuchsiaResourceDialect,
7650    >;
7651    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut {
7652        fn _decode(
7653            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7654        ) -> Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error> {
7655            let _response = fidl::client::decode_transaction_body::<
7656                fidl::encoding::FlexibleResultType<
7657                    PacketStreamControlGetPacketStreamSinkResponse,
7658                    i32,
7659                >,
7660                fidl::encoding::DefaultFuchsiaResourceDialect,
7661                0x7394726463ebbc6a,
7662            >(_buf?)?
7663            .into_result::<PacketStreamControlMarker>("get_packet_stream_sink")?;
7664            Ok(_response.map(|x| x))
7665        }
7666        self.client.send_query_and_decode::<
7667            fidl::encoding::EmptyPayload,
7668            PacketStreamControlGetPacketStreamSinkResult,
7669        >(
7670            (),
7671            0x7394726463ebbc6a,
7672            fidl::encoding::DynamicFlags::FLEXIBLE,
7673            _decode,
7674        )
7675    }
7676
7677    type SetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
7678        PacketStreamControlSetPacketStreamSinkResult,
7679        fidl::encoding::DefaultFuchsiaResourceDialect,
7680    >;
7681    fn r#set_packet_stream_sink(
7682        &self,
7683        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7684    ) -> Self::SetPacketStreamSinkResponseFut {
7685        fn _decode(
7686            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7687        ) -> Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error> {
7688            let _response = fidl::client::decode_transaction_body::<
7689                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7690                fidl::encoding::DefaultFuchsiaResourceDialect,
7691                0xab88800e31dc0e4,
7692            >(_buf?)?
7693            .into_result::<PacketStreamControlMarker>("set_packet_stream_sink")?;
7694            Ok(_response.map(|x| x))
7695        }
7696        self.client.send_query_and_decode::<
7697            PacketStreamControlSetPacketStreamSinkRequest,
7698            PacketStreamControlSetPacketStreamSinkResult,
7699        >(
7700            &mut payload,
7701            0xab88800e31dc0e4,
7702            fidl::encoding::DynamicFlags::FLEXIBLE,
7703            _decode,
7704        )
7705    }
7706
7707    type StartResponseFut = fidl::client::QueryResponseFut<
7708        PacketStreamControlStartResult,
7709        fidl::encoding::DefaultFuchsiaResourceDialect,
7710    >;
7711    fn r#start(&self) -> Self::StartResponseFut {
7712        fn _decode(
7713            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7714        ) -> Result<PacketStreamControlStartResult, fidl::Error> {
7715            let _response = fidl::client::decode_transaction_body::<
7716                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7717                fidl::encoding::DefaultFuchsiaResourceDialect,
7718                0x3a584b94d8a6bfd0,
7719            >(_buf?)?
7720            .into_result::<PacketStreamControlMarker>("start")?;
7721            Ok(_response.map(|x| x))
7722        }
7723        self.client
7724            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStartResult>(
7725                (),
7726                0x3a584b94d8a6bfd0,
7727                fidl::encoding::DynamicFlags::FLEXIBLE,
7728                _decode,
7729            )
7730    }
7731
7732    type StopResponseFut = fidl::client::QueryResponseFut<
7733        PacketStreamControlStopResult,
7734        fidl::encoding::DefaultFuchsiaResourceDialect,
7735    >;
7736    fn r#stop(&self) -> Self::StopResponseFut {
7737        fn _decode(
7738            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7739        ) -> Result<PacketStreamControlStopResult, fidl::Error> {
7740            let _response = fidl::client::decode_transaction_body::<
7741                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7742                fidl::encoding::DefaultFuchsiaResourceDialect,
7743                0x703e4fafcdd7ef32,
7744            >(_buf?)?
7745            .into_result::<PacketStreamControlMarker>("stop")?;
7746            Ok(_response.map(|x| x))
7747        }
7748        self.client
7749            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStopResult>(
7750                (),
7751                0x703e4fafcdd7ef32,
7752                fidl::encoding::DynamicFlags::FLEXIBLE,
7753                _decode,
7754            )
7755    }
7756}
7757
7758pub struct PacketStreamControlEventStream {
7759    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7760}
7761
7762impl std::marker::Unpin for PacketStreamControlEventStream {}
7763
7764impl futures::stream::FusedStream for PacketStreamControlEventStream {
7765    fn is_terminated(&self) -> bool {
7766        self.event_receiver.is_terminated()
7767    }
7768}
7769
7770impl futures::Stream for PacketStreamControlEventStream {
7771    type Item = Result<PacketStreamControlEvent, fidl::Error>;
7772
7773    fn poll_next(
7774        mut self: std::pin::Pin<&mut Self>,
7775        cx: &mut std::task::Context<'_>,
7776    ) -> std::task::Poll<Option<Self::Item>> {
7777        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7778            &mut self.event_receiver,
7779            cx
7780        )?) {
7781            Some(buf) => std::task::Poll::Ready(Some(PacketStreamControlEvent::decode(buf))),
7782            None => std::task::Poll::Ready(None),
7783        }
7784    }
7785}
7786
7787#[derive(Debug)]
7788pub enum PacketStreamControlEvent {
7789    #[non_exhaustive]
7790    _UnknownEvent {
7791        /// Ordinal of the event that was sent.
7792        ordinal: u64,
7793    },
7794}
7795
7796impl PacketStreamControlEvent {
7797    /// Decodes a message buffer as a [`PacketStreamControlEvent`].
7798    fn decode(
7799        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7800    ) -> Result<PacketStreamControlEvent, fidl::Error> {
7801        let (bytes, _handles) = buf.split_mut();
7802        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7803        debug_assert_eq!(tx_header.tx_id, 0);
7804        match tx_header.ordinal {
7805            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7806                Ok(PacketStreamControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7807            }
7808            _ => Err(fidl::Error::UnknownOrdinal {
7809                ordinal: tx_header.ordinal,
7810                protocol_name:
7811                    <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7812            }),
7813        }
7814    }
7815}
7816
7817/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamControl.
7818pub struct PacketStreamControlRequestStream {
7819    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7820    is_terminated: bool,
7821}
7822
7823impl std::marker::Unpin for PacketStreamControlRequestStream {}
7824
7825impl futures::stream::FusedStream for PacketStreamControlRequestStream {
7826    fn is_terminated(&self) -> bool {
7827        self.is_terminated
7828    }
7829}
7830
7831impl fidl::endpoints::RequestStream for PacketStreamControlRequestStream {
7832    type Protocol = PacketStreamControlMarker;
7833    type ControlHandle = PacketStreamControlControlHandle;
7834
7835    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7836        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7837    }
7838
7839    fn control_handle(&self) -> Self::ControlHandle {
7840        PacketStreamControlControlHandle { inner: self.inner.clone() }
7841    }
7842
7843    fn into_inner(
7844        self,
7845    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7846    {
7847        (self.inner, self.is_terminated)
7848    }
7849
7850    fn from_inner(
7851        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7852        is_terminated: bool,
7853    ) -> Self {
7854        Self { inner, is_terminated }
7855    }
7856}
7857
7858impl futures::Stream for PacketStreamControlRequestStream {
7859    type Item = Result<PacketStreamControlRequest, fidl::Error>;
7860
7861    fn poll_next(
7862        mut self: std::pin::Pin<&mut Self>,
7863        cx: &mut std::task::Context<'_>,
7864    ) -> std::task::Poll<Option<Self::Item>> {
7865        let this = &mut *self;
7866        if this.inner.check_shutdown(cx) {
7867            this.is_terminated = true;
7868            return std::task::Poll::Ready(None);
7869        }
7870        if this.is_terminated {
7871            panic!("polled PacketStreamControlRequestStream after completion");
7872        }
7873        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7874            |bytes, handles| {
7875                match this.inner.channel().read_etc(cx, bytes, handles) {
7876                    std::task::Poll::Ready(Ok(())) => {}
7877                    std::task::Poll::Pending => return std::task::Poll::Pending,
7878                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7879                        this.is_terminated = true;
7880                        return std::task::Poll::Ready(None);
7881                    }
7882                    std::task::Poll::Ready(Err(e)) => {
7883                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7884                            e.into(),
7885                        ))));
7886                    }
7887                }
7888
7889                // A message has been received from the channel
7890                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7891
7892                std::task::Poll::Ready(Some(match header.ordinal {
7893                0x586cf4f0f8d2771f => {
7894                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7895                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7896                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7897                    let control_handle = PacketStreamControlControlHandle {
7898                        inner: this.inner.clone(),
7899                    };
7900                    Ok(PacketStreamControlRequest::GetProperties {
7901                        responder: PacketStreamControlGetPropertiesResponder {
7902                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7903                            tx_id: header.tx_id,
7904                        },
7905                    })
7906                }
7907                0x7ff1473165ed344b => {
7908                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7909                    let mut req = fidl::new_empty!(AllocateVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect);
7910                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocateVmosConfig>(&header, _body_bytes, handles, &mut req)?;
7911                    let control_handle = PacketStreamControlControlHandle {
7912                        inner: this.inner.clone(),
7913                    };
7914                    Ok(PacketStreamControlRequest::AllocateVmos {payload: req,
7915                        responder: PacketStreamControlAllocateVmosResponder {
7916                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7917                            tx_id: header.tx_id,
7918                        },
7919                    })
7920                }
7921                0x4db5cc85a7b8405b => {
7922                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7923                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7924                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7925                    let control_handle = PacketStreamControlControlHandle {
7926                        inner: this.inner.clone(),
7927                    };
7928                    Ok(PacketStreamControlRequest::DeallocateVmos {
7929                        responder: PacketStreamControlDeallocateVmosResponder {
7930                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7931                            tx_id: header.tx_id,
7932                        },
7933                    })
7934                }
7935                0x29c3b656a1020bfd => {
7936                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7937                    let mut req = fidl::new_empty!(RegisterVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect);
7938                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegisterVmosConfig>(&header, _body_bytes, handles, &mut req)?;
7939                    let control_handle = PacketStreamControlControlHandle {
7940                        inner: this.inner.clone(),
7941                    };
7942                    Ok(PacketStreamControlRequest::RegisterVmos {payload: req,
7943                        responder: PacketStreamControlRegisterVmosResponder {
7944                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7945                            tx_id: header.tx_id,
7946                        },
7947                    })
7948                }
7949                0x3e3b4dbfe26b6094 => {
7950                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7951                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7952                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7953                    let control_handle = PacketStreamControlControlHandle {
7954                        inner: this.inner.clone(),
7955                    };
7956                    Ok(PacketStreamControlRequest::UnregisterVmos {
7957                        responder: PacketStreamControlUnregisterVmosResponder {
7958                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7959                            tx_id: header.tx_id,
7960                        },
7961                    })
7962                }
7963                0x7394726463ebbc6a => {
7964                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7965                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7966                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7967                    let control_handle = PacketStreamControlControlHandle {
7968                        inner: this.inner.clone(),
7969                    };
7970                    Ok(PacketStreamControlRequest::GetPacketStreamSink {
7971                        responder: PacketStreamControlGetPacketStreamSinkResponder {
7972                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7973                            tx_id: header.tx_id,
7974                        },
7975                    })
7976                }
7977                0xab88800e31dc0e4 => {
7978                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7979                    let mut req = fidl::new_empty!(PacketStreamControlSetPacketStreamSinkRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7980                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PacketStreamControlSetPacketStreamSinkRequest>(&header, _body_bytes, handles, &mut req)?;
7981                    let control_handle = PacketStreamControlControlHandle {
7982                        inner: this.inner.clone(),
7983                    };
7984                    Ok(PacketStreamControlRequest::SetPacketStreamSink {payload: req,
7985                        responder: PacketStreamControlSetPacketStreamSinkResponder {
7986                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7987                            tx_id: header.tx_id,
7988                        },
7989                    })
7990                }
7991                0x3a584b94d8a6bfd0 => {
7992                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7993                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7994                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7995                    let control_handle = PacketStreamControlControlHandle {
7996                        inner: this.inner.clone(),
7997                    };
7998                    Ok(PacketStreamControlRequest::Start {
7999                        responder: PacketStreamControlStartResponder {
8000                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8001                            tx_id: header.tx_id,
8002                        },
8003                    })
8004                }
8005                0x703e4fafcdd7ef32 => {
8006                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8007                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8008                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8009                    let control_handle = PacketStreamControlControlHandle {
8010                        inner: this.inner.clone(),
8011                    };
8012                    Ok(PacketStreamControlRequest::Stop {
8013                        responder: PacketStreamControlStopResponder {
8014                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8015                            tx_id: header.tx_id,
8016                        },
8017                    })
8018                }
8019                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8020                    Ok(PacketStreamControlRequest::_UnknownMethod {
8021                        ordinal: header.ordinal,
8022                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
8023                        method_type: fidl::MethodType::OneWay,
8024                    })
8025                }
8026                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8027                    this.inner.send_framework_err(
8028                        fidl::encoding::FrameworkErr::UnknownMethod,
8029                        header.tx_id,
8030                        header.ordinal,
8031                        header.dynamic_flags(),
8032                        (bytes, handles),
8033                    )?;
8034                    Ok(PacketStreamControlRequest::_UnknownMethod {
8035                        ordinal: header.ordinal,
8036                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
8037                        method_type: fidl::MethodType::TwoWay,
8038                    })
8039                }
8040                _ => Err(fidl::Error::UnknownOrdinal {
8041                    ordinal: header.ordinal,
8042                    protocol_name: <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8043                }),
8044            }))
8045            },
8046        )
8047    }
8048}
8049
8050/// Control protocol for establishing and managing the packet stream.
8051#[derive(Debug)]
8052pub enum PacketStreamControlRequest {
8053    /// Accessor for top level static properties.
8054    GetProperties { responder: PacketStreamControlGetPropertiesResponder },
8055    /// Request the driver to allocate VMOs for data transfer.
8056    /// Returns the allocated VMOs and their assigned IDs.
8057    ///
8058    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8059    /// If the packet stream is an output stream, then the handle must also include
8060    /// ZX_RIGHT_WRITE.
8061    ///
8062    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
8063    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
8064    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
8065    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
8066    /// reconfigure.
8067    AllocateVmos {
8068        payload: AllocateVmosConfig,
8069        responder: PacketStreamControlAllocateVmosResponder,
8070    },
8071    /// Releases all VMOs previously allocated via `AllocateVmos`.
8072    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
8073    ///
8074    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
8075    /// not stopped.
8076    DeallocateVmos { responder: PacketStreamControlDeallocateVmosResponder },
8077    /// Registers client-allocated VMOs with the driver.
8078    ///
8079    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8080    /// If the packet stream is an input stream, then the handle must also include
8081    /// ZX_RIGHT_WRITE.
8082    ///
8083    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
8084    /// or if duplicate `vmo_id`s are found.
8085    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
8086    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
8087    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
8088    /// reconfigure.
8089    RegisterVmos {
8090        payload: RegisterVmosConfig,
8091        responder: PacketStreamControlRegisterVmosResponder,
8092    },
8093    /// Unregisters all VMOs previously registered via `RegisterVmos`.
8094    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
8095    ///
8096    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
8097    /// not stopped.
8098    UnregisterVmos { responder: PacketStreamControlUnregisterVmosResponder },
8099    /// Connects to the data sink implemented by the driver.
8100    /// This is used for audio **Output** where the driver consumes data.
8101    ///
8102    /// Flow:
8103    /// 1. App writes audio data to a registered VMO.
8104    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
8105    ///    true).
8106    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
8107    /// 4. Driver consumes the data.
8108    ///
8109    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
8110    /// and any pending requests on that channel are discarded. The new channel replaces the old
8111    /// one.
8112    ///
8113    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
8114    /// not support this method.
8115    GetPacketStreamSink { responder: PacketStreamControlGetPacketStreamSinkResponder },
8116    /// Provides a data sink to the driver.
8117    /// This is used for audio **Input** where the driver produces data.
8118    ///
8119    /// Flow:
8120    /// 1. Driver writes audio data to a registered VMO.
8121    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
8122    /// 3. App receives `PutPacket`.
8123    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
8124    ///    true).
8125    /// 5. App reads the data.
8126    ///
8127    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
8128    /// channel. The new channel replaces the old one.
8129    ///
8130    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
8131    /// not support this method.
8132    SetPacketStreamSink {
8133        payload: PacketStreamControlSetPacketStreamSinkRequest,
8134        responder: PacketStreamControlSetPacketStreamSinkResponder,
8135    },
8136    /// Start the packet-stream.
8137    ///
8138    /// Returns `ZX_ERR_BAD_STATE` if:
8139    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
8140    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
8141    ///   `INLINE` is supported.
8142    /// * The stream is already started.
8143    Start { responder: PacketStreamControlStartResponder },
8144    /// Stop the packet-stream.
8145    ///
8146    /// Once the response is received, the stream is halted.
8147    ///
8148    /// Behavior depends on the stream direction:
8149    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
8150    ///   requests will remain pending until `Start` is called again. Clients may call
8151    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
8152    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
8153    ///   calls will be made by the driver until `Start` is called again.
8154    ///
8155    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
8156    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
8157    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
8158    ///   complete successfully after `Stop` has returned.
8159    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
8160    ///   arrive at the client after `Stop` has returned.
8161    ///
8162    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
8163    Stop { responder: PacketStreamControlStopResponder },
8164    /// An interaction was received which does not match any known method.
8165    #[non_exhaustive]
8166    _UnknownMethod {
8167        /// Ordinal of the method that was called.
8168        ordinal: u64,
8169        control_handle: PacketStreamControlControlHandle,
8170        method_type: fidl::MethodType,
8171    },
8172}
8173
8174impl PacketStreamControlRequest {
8175    #[allow(irrefutable_let_patterns)]
8176    pub fn into_get_properties(self) -> Option<(PacketStreamControlGetPropertiesResponder)> {
8177        if let PacketStreamControlRequest::GetProperties { responder } = self {
8178            Some((responder))
8179        } else {
8180            None
8181        }
8182    }
8183
8184    #[allow(irrefutable_let_patterns)]
8185    pub fn into_allocate_vmos(
8186        self,
8187    ) -> Option<(AllocateVmosConfig, PacketStreamControlAllocateVmosResponder)> {
8188        if let PacketStreamControlRequest::AllocateVmos { payload, responder } = self {
8189            Some((payload, responder))
8190        } else {
8191            None
8192        }
8193    }
8194
8195    #[allow(irrefutable_let_patterns)]
8196    pub fn into_deallocate_vmos(self) -> Option<(PacketStreamControlDeallocateVmosResponder)> {
8197        if let PacketStreamControlRequest::DeallocateVmos { responder } = self {
8198            Some((responder))
8199        } else {
8200            None
8201        }
8202    }
8203
8204    #[allow(irrefutable_let_patterns)]
8205    pub fn into_register_vmos(
8206        self,
8207    ) -> Option<(RegisterVmosConfig, PacketStreamControlRegisterVmosResponder)> {
8208        if let PacketStreamControlRequest::RegisterVmos { payload, responder } = self {
8209            Some((payload, responder))
8210        } else {
8211            None
8212        }
8213    }
8214
8215    #[allow(irrefutable_let_patterns)]
8216    pub fn into_unregister_vmos(self) -> Option<(PacketStreamControlUnregisterVmosResponder)> {
8217        if let PacketStreamControlRequest::UnregisterVmos { responder } = self {
8218            Some((responder))
8219        } else {
8220            None
8221        }
8222    }
8223
8224    #[allow(irrefutable_let_patterns)]
8225    pub fn into_get_packet_stream_sink(
8226        self,
8227    ) -> Option<(PacketStreamControlGetPacketStreamSinkResponder)> {
8228        if let PacketStreamControlRequest::GetPacketStreamSink { responder } = self {
8229            Some((responder))
8230        } else {
8231            None
8232        }
8233    }
8234
8235    #[allow(irrefutable_let_patterns)]
8236    pub fn into_set_packet_stream_sink(
8237        self,
8238    ) -> Option<(
8239        PacketStreamControlSetPacketStreamSinkRequest,
8240        PacketStreamControlSetPacketStreamSinkResponder,
8241    )> {
8242        if let PacketStreamControlRequest::SetPacketStreamSink { payload, responder } = self {
8243            Some((payload, responder))
8244        } else {
8245            None
8246        }
8247    }
8248
8249    #[allow(irrefutable_let_patterns)]
8250    pub fn into_start(self) -> Option<(PacketStreamControlStartResponder)> {
8251        if let PacketStreamControlRequest::Start { responder } = self {
8252            Some((responder))
8253        } else {
8254            None
8255        }
8256    }
8257
8258    #[allow(irrefutable_let_patterns)]
8259    pub fn into_stop(self) -> Option<(PacketStreamControlStopResponder)> {
8260        if let PacketStreamControlRequest::Stop { responder } = self {
8261            Some((responder))
8262        } else {
8263            None
8264        }
8265    }
8266
8267    /// Name of the method defined in FIDL
8268    pub fn method_name(&self) -> &'static str {
8269        match *self {
8270            PacketStreamControlRequest::GetProperties { .. } => "get_properties",
8271            PacketStreamControlRequest::AllocateVmos { .. } => "allocate_vmos",
8272            PacketStreamControlRequest::DeallocateVmos { .. } => "deallocate_vmos",
8273            PacketStreamControlRequest::RegisterVmos { .. } => "register_vmos",
8274            PacketStreamControlRequest::UnregisterVmos { .. } => "unregister_vmos",
8275            PacketStreamControlRequest::GetPacketStreamSink { .. } => "get_packet_stream_sink",
8276            PacketStreamControlRequest::SetPacketStreamSink { .. } => "set_packet_stream_sink",
8277            PacketStreamControlRequest::Start { .. } => "start",
8278            PacketStreamControlRequest::Stop { .. } => "stop",
8279            PacketStreamControlRequest::_UnknownMethod {
8280                method_type: fidl::MethodType::OneWay,
8281                ..
8282            } => "unknown one-way method",
8283            PacketStreamControlRequest::_UnknownMethod {
8284                method_type: fidl::MethodType::TwoWay,
8285                ..
8286            } => "unknown two-way method",
8287        }
8288    }
8289}
8290
8291#[derive(Debug, Clone)]
8292pub struct PacketStreamControlControlHandle {
8293    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8294}
8295
8296impl fidl::endpoints::ControlHandle for PacketStreamControlControlHandle {
8297    fn shutdown(&self) {
8298        self.inner.shutdown()
8299    }
8300
8301    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8302        self.inner.shutdown_with_epitaph(status)
8303    }
8304
8305    fn is_closed(&self) -> bool {
8306        self.inner.channel().is_closed()
8307    }
8308    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8309        self.inner.channel().on_closed()
8310    }
8311
8312    #[cfg(target_os = "fuchsia")]
8313    fn signal_peer(
8314        &self,
8315        clear_mask: zx::Signals,
8316        set_mask: zx::Signals,
8317    ) -> Result<(), zx_status::Status> {
8318        use fidl::Peered;
8319        self.inner.channel().signal_peer(clear_mask, set_mask)
8320    }
8321}
8322
8323impl PacketStreamControlControlHandle {}
8324
8325#[must_use = "FIDL methods require a response to be sent"]
8326#[derive(Debug)]
8327pub struct PacketStreamControlGetPropertiesResponder {
8328    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8329    tx_id: u32,
8330}
8331
8332/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8333/// if the responder is dropped without sending a response, so that the client
8334/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8335impl std::ops::Drop for PacketStreamControlGetPropertiesResponder {
8336    fn drop(&mut self) {
8337        self.control_handle.shutdown();
8338        // Safety: drops once, never accessed again
8339        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8340    }
8341}
8342
8343impl fidl::endpoints::Responder for PacketStreamControlGetPropertiesResponder {
8344    type ControlHandle = PacketStreamControlControlHandle;
8345
8346    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8347        &self.control_handle
8348    }
8349
8350    fn drop_without_shutdown(mut self) {
8351        // Safety: drops once, never accessed again due to mem::forget
8352        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8353        // Prevent Drop from running (which would shut down the channel)
8354        std::mem::forget(self);
8355    }
8356}
8357
8358impl PacketStreamControlGetPropertiesResponder {
8359    /// Sends a response to the FIDL transaction.
8360    ///
8361    /// Sets the channel to shutdown if an error occurs.
8362    pub fn send(self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
8363        let _result = self.send_raw(properties);
8364        if _result.is_err() {
8365            self.control_handle.shutdown();
8366        }
8367        self.drop_without_shutdown();
8368        _result
8369    }
8370
8371    /// Similar to "send" but does not shutdown the channel if an error occurs.
8372    pub fn send_no_shutdown_on_err(
8373        self,
8374        mut properties: &PacketStreamProperties,
8375    ) -> Result<(), fidl::Error> {
8376        let _result = self.send_raw(properties);
8377        self.drop_without_shutdown();
8378        _result
8379    }
8380
8381    fn send_raw(&self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
8382        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
8383            PacketStreamControlGetPropertiesResponse,
8384        >>(
8385            fidl::encoding::Flexible::new((properties,)),
8386            self.tx_id,
8387            0x586cf4f0f8d2771f,
8388            fidl::encoding::DynamicFlags::FLEXIBLE,
8389        )
8390    }
8391}
8392
8393#[must_use = "FIDL methods require a response to be sent"]
8394#[derive(Debug)]
8395pub struct PacketStreamControlAllocateVmosResponder {
8396    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8397    tx_id: u32,
8398}
8399
8400/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8401/// if the responder is dropped without sending a response, so that the client
8402/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8403impl std::ops::Drop for PacketStreamControlAllocateVmosResponder {
8404    fn drop(&mut self) {
8405        self.control_handle.shutdown();
8406        // Safety: drops once, never accessed again
8407        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8408    }
8409}
8410
8411impl fidl::endpoints::Responder for PacketStreamControlAllocateVmosResponder {
8412    type ControlHandle = PacketStreamControlControlHandle;
8413
8414    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8415        &self.control_handle
8416    }
8417
8418    fn drop_without_shutdown(mut self) {
8419        // Safety: drops once, never accessed again due to mem::forget
8420        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8421        // Prevent Drop from running (which would shut down the channel)
8422        std::mem::forget(self);
8423    }
8424}
8425
8426impl PacketStreamControlAllocateVmosResponder {
8427    /// Sends a response to the FIDL transaction.
8428    ///
8429    /// Sets the channel to shutdown if an error occurs.
8430    pub fn send(self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
8431        let _result = self.send_raw(result);
8432        if _result.is_err() {
8433            self.control_handle.shutdown();
8434        }
8435        self.drop_without_shutdown();
8436        _result
8437    }
8438
8439    /// Similar to "send" but does not shutdown the channel if an error occurs.
8440    pub fn send_no_shutdown_on_err(
8441        self,
8442        mut result: Result<Vec<VmoInfo>, i32>,
8443    ) -> Result<(), fidl::Error> {
8444        let _result = self.send_raw(result);
8445        self.drop_without_shutdown();
8446        _result
8447    }
8448
8449    fn send_raw(&self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
8450        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8451            PacketStreamControlAllocateVmosResponse,
8452            i32,
8453        >>(
8454            fidl::encoding::FlexibleResult::new(
8455                result.as_mut().map_err(|e| *e).map(|vmos| (vmos.as_mut_slice(),)),
8456            ),
8457            self.tx_id,
8458            0x7ff1473165ed344b,
8459            fidl::encoding::DynamicFlags::FLEXIBLE,
8460        )
8461    }
8462}
8463
8464#[must_use = "FIDL methods require a response to be sent"]
8465#[derive(Debug)]
8466pub struct PacketStreamControlDeallocateVmosResponder {
8467    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8468    tx_id: u32,
8469}
8470
8471/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8472/// if the responder is dropped without sending a response, so that the client
8473/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8474impl std::ops::Drop for PacketStreamControlDeallocateVmosResponder {
8475    fn drop(&mut self) {
8476        self.control_handle.shutdown();
8477        // Safety: drops once, never accessed again
8478        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8479    }
8480}
8481
8482impl fidl::endpoints::Responder for PacketStreamControlDeallocateVmosResponder {
8483    type ControlHandle = PacketStreamControlControlHandle;
8484
8485    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8486        &self.control_handle
8487    }
8488
8489    fn drop_without_shutdown(mut self) {
8490        // Safety: drops once, never accessed again due to mem::forget
8491        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8492        // Prevent Drop from running (which would shut down the channel)
8493        std::mem::forget(self);
8494    }
8495}
8496
8497impl PacketStreamControlDeallocateVmosResponder {
8498    /// Sends a response to the FIDL transaction.
8499    ///
8500    /// Sets the channel to shutdown if an error occurs.
8501    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8502        let _result = self.send_raw(result);
8503        if _result.is_err() {
8504            self.control_handle.shutdown();
8505        }
8506        self.drop_without_shutdown();
8507        _result
8508    }
8509
8510    /// Similar to "send" but does not shutdown the channel if an error occurs.
8511    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8512        let _result = self.send_raw(result);
8513        self.drop_without_shutdown();
8514        _result
8515    }
8516
8517    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8518        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8519            fidl::encoding::EmptyStruct,
8520            i32,
8521        >>(
8522            fidl::encoding::FlexibleResult::new(result),
8523            self.tx_id,
8524            0x4db5cc85a7b8405b,
8525            fidl::encoding::DynamicFlags::FLEXIBLE,
8526        )
8527    }
8528}
8529
8530#[must_use = "FIDL methods require a response to be sent"]
8531#[derive(Debug)]
8532pub struct PacketStreamControlRegisterVmosResponder {
8533    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8534    tx_id: u32,
8535}
8536
8537/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8538/// if the responder is dropped without sending a response, so that the client
8539/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8540impl std::ops::Drop for PacketStreamControlRegisterVmosResponder {
8541    fn drop(&mut self) {
8542        self.control_handle.shutdown();
8543        // Safety: drops once, never accessed again
8544        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8545    }
8546}
8547
8548impl fidl::endpoints::Responder for PacketStreamControlRegisterVmosResponder {
8549    type ControlHandle = PacketStreamControlControlHandle;
8550
8551    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8552        &self.control_handle
8553    }
8554
8555    fn drop_without_shutdown(mut self) {
8556        // Safety: drops once, never accessed again due to mem::forget
8557        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8558        // Prevent Drop from running (which would shut down the channel)
8559        std::mem::forget(self);
8560    }
8561}
8562
8563impl PacketStreamControlRegisterVmosResponder {
8564    /// Sends a response to the FIDL transaction.
8565    ///
8566    /// Sets the channel to shutdown if an error occurs.
8567    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8568        let _result = self.send_raw(result);
8569        if _result.is_err() {
8570            self.control_handle.shutdown();
8571        }
8572        self.drop_without_shutdown();
8573        _result
8574    }
8575
8576    /// Similar to "send" but does not shutdown the channel if an error occurs.
8577    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8578        let _result = self.send_raw(result);
8579        self.drop_without_shutdown();
8580        _result
8581    }
8582
8583    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8584        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8585            fidl::encoding::EmptyStruct,
8586            i32,
8587        >>(
8588            fidl::encoding::FlexibleResult::new(result),
8589            self.tx_id,
8590            0x29c3b656a1020bfd,
8591            fidl::encoding::DynamicFlags::FLEXIBLE,
8592        )
8593    }
8594}
8595
8596#[must_use = "FIDL methods require a response to be sent"]
8597#[derive(Debug)]
8598pub struct PacketStreamControlUnregisterVmosResponder {
8599    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8600    tx_id: u32,
8601}
8602
8603/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8604/// if the responder is dropped without sending a response, so that the client
8605/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8606impl std::ops::Drop for PacketStreamControlUnregisterVmosResponder {
8607    fn drop(&mut self) {
8608        self.control_handle.shutdown();
8609        // Safety: drops once, never accessed again
8610        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8611    }
8612}
8613
8614impl fidl::endpoints::Responder for PacketStreamControlUnregisterVmosResponder {
8615    type ControlHandle = PacketStreamControlControlHandle;
8616
8617    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8618        &self.control_handle
8619    }
8620
8621    fn drop_without_shutdown(mut self) {
8622        // Safety: drops once, never accessed again due to mem::forget
8623        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8624        // Prevent Drop from running (which would shut down the channel)
8625        std::mem::forget(self);
8626    }
8627}
8628
8629impl PacketStreamControlUnregisterVmosResponder {
8630    /// Sends a response to the FIDL transaction.
8631    ///
8632    /// Sets the channel to shutdown if an error occurs.
8633    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8634        let _result = self.send_raw(result);
8635        if _result.is_err() {
8636            self.control_handle.shutdown();
8637        }
8638        self.drop_without_shutdown();
8639        _result
8640    }
8641
8642    /// Similar to "send" but does not shutdown the channel if an error occurs.
8643    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8644        let _result = self.send_raw(result);
8645        self.drop_without_shutdown();
8646        _result
8647    }
8648
8649    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8650        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8651            fidl::encoding::EmptyStruct,
8652            i32,
8653        >>(
8654            fidl::encoding::FlexibleResult::new(result),
8655            self.tx_id,
8656            0x3e3b4dbfe26b6094,
8657            fidl::encoding::DynamicFlags::FLEXIBLE,
8658        )
8659    }
8660}
8661
8662#[must_use = "FIDL methods require a response to be sent"]
8663#[derive(Debug)]
8664pub struct PacketStreamControlGetPacketStreamSinkResponder {
8665    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8666    tx_id: u32,
8667}
8668
8669/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8670/// if the responder is dropped without sending a response, so that the client
8671/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8672impl std::ops::Drop for PacketStreamControlGetPacketStreamSinkResponder {
8673    fn drop(&mut self) {
8674        self.control_handle.shutdown();
8675        // Safety: drops once, never accessed again
8676        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8677    }
8678}
8679
8680impl fidl::endpoints::Responder for PacketStreamControlGetPacketStreamSinkResponder {
8681    type ControlHandle = PacketStreamControlControlHandle;
8682
8683    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8684        &self.control_handle
8685    }
8686
8687    fn drop_without_shutdown(mut self) {
8688        // Safety: drops once, never accessed again due to mem::forget
8689        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8690        // Prevent Drop from running (which would shut down the channel)
8691        std::mem::forget(self);
8692    }
8693}
8694
8695impl PacketStreamControlGetPacketStreamSinkResponder {
8696    /// Sends a response to the FIDL transaction.
8697    ///
8698    /// Sets the channel to shutdown if an error occurs.
8699    pub fn send(
8700        self,
8701        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8702    ) -> Result<(), fidl::Error> {
8703        let _result = self.send_raw(result);
8704        if _result.is_err() {
8705            self.control_handle.shutdown();
8706        }
8707        self.drop_without_shutdown();
8708        _result
8709    }
8710
8711    /// Similar to "send" but does not shutdown the channel if an error occurs.
8712    pub fn send_no_shutdown_on_err(
8713        self,
8714        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8715    ) -> Result<(), fidl::Error> {
8716        let _result = self.send_raw(result);
8717        self.drop_without_shutdown();
8718        _result
8719    }
8720
8721    fn send_raw(
8722        &self,
8723        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8724    ) -> Result<(), fidl::Error> {
8725        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8726            PacketStreamControlGetPacketStreamSinkResponse,
8727            i32,
8728        >>(
8729            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
8730            self.tx_id,
8731            0x7394726463ebbc6a,
8732            fidl::encoding::DynamicFlags::FLEXIBLE,
8733        )
8734    }
8735}
8736
8737#[must_use = "FIDL methods require a response to be sent"]
8738#[derive(Debug)]
8739pub struct PacketStreamControlSetPacketStreamSinkResponder {
8740    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8741    tx_id: u32,
8742}
8743
8744/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8745/// if the responder is dropped without sending a response, so that the client
8746/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8747impl std::ops::Drop for PacketStreamControlSetPacketStreamSinkResponder {
8748    fn drop(&mut self) {
8749        self.control_handle.shutdown();
8750        // Safety: drops once, never accessed again
8751        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8752    }
8753}
8754
8755impl fidl::endpoints::Responder for PacketStreamControlSetPacketStreamSinkResponder {
8756    type ControlHandle = PacketStreamControlControlHandle;
8757
8758    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8759        &self.control_handle
8760    }
8761
8762    fn drop_without_shutdown(mut self) {
8763        // Safety: drops once, never accessed again due to mem::forget
8764        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8765        // Prevent Drop from running (which would shut down the channel)
8766        std::mem::forget(self);
8767    }
8768}
8769
8770impl PacketStreamControlSetPacketStreamSinkResponder {
8771    /// Sends a response to the FIDL transaction.
8772    ///
8773    /// Sets the channel to shutdown if an error occurs.
8774    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8775        let _result = self.send_raw(result);
8776        if _result.is_err() {
8777            self.control_handle.shutdown();
8778        }
8779        self.drop_without_shutdown();
8780        _result
8781    }
8782
8783    /// Similar to "send" but does not shutdown the channel if an error occurs.
8784    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8785        let _result = self.send_raw(result);
8786        self.drop_without_shutdown();
8787        _result
8788    }
8789
8790    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8791        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8792            fidl::encoding::EmptyStruct,
8793            i32,
8794        >>(
8795            fidl::encoding::FlexibleResult::new(result),
8796            self.tx_id,
8797            0xab88800e31dc0e4,
8798            fidl::encoding::DynamicFlags::FLEXIBLE,
8799        )
8800    }
8801}
8802
8803#[must_use = "FIDL methods require a response to be sent"]
8804#[derive(Debug)]
8805pub struct PacketStreamControlStartResponder {
8806    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8807    tx_id: u32,
8808}
8809
8810/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8811/// if the responder is dropped without sending a response, so that the client
8812/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8813impl std::ops::Drop for PacketStreamControlStartResponder {
8814    fn drop(&mut self) {
8815        self.control_handle.shutdown();
8816        // Safety: drops once, never accessed again
8817        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8818    }
8819}
8820
8821impl fidl::endpoints::Responder for PacketStreamControlStartResponder {
8822    type ControlHandle = PacketStreamControlControlHandle;
8823
8824    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8825        &self.control_handle
8826    }
8827
8828    fn drop_without_shutdown(mut self) {
8829        // Safety: drops once, never accessed again due to mem::forget
8830        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8831        // Prevent Drop from running (which would shut down the channel)
8832        std::mem::forget(self);
8833    }
8834}
8835
8836impl PacketStreamControlStartResponder {
8837    /// Sends a response to the FIDL transaction.
8838    ///
8839    /// Sets the channel to shutdown if an error occurs.
8840    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8841        let _result = self.send_raw(result);
8842        if _result.is_err() {
8843            self.control_handle.shutdown();
8844        }
8845        self.drop_without_shutdown();
8846        _result
8847    }
8848
8849    /// Similar to "send" but does not shutdown the channel if an error occurs.
8850    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8851        let _result = self.send_raw(result);
8852        self.drop_without_shutdown();
8853        _result
8854    }
8855
8856    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8857        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8858            fidl::encoding::EmptyStruct,
8859            i32,
8860        >>(
8861            fidl::encoding::FlexibleResult::new(result),
8862            self.tx_id,
8863            0x3a584b94d8a6bfd0,
8864            fidl::encoding::DynamicFlags::FLEXIBLE,
8865        )
8866    }
8867}
8868
8869#[must_use = "FIDL methods require a response to be sent"]
8870#[derive(Debug)]
8871pub struct PacketStreamControlStopResponder {
8872    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8873    tx_id: u32,
8874}
8875
8876/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8877/// if the responder is dropped without sending a response, so that the client
8878/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8879impl std::ops::Drop for PacketStreamControlStopResponder {
8880    fn drop(&mut self) {
8881        self.control_handle.shutdown();
8882        // Safety: drops once, never accessed again
8883        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8884    }
8885}
8886
8887impl fidl::endpoints::Responder for PacketStreamControlStopResponder {
8888    type ControlHandle = PacketStreamControlControlHandle;
8889
8890    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8891        &self.control_handle
8892    }
8893
8894    fn drop_without_shutdown(mut self) {
8895        // Safety: drops once, never accessed again due to mem::forget
8896        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8897        // Prevent Drop from running (which would shut down the channel)
8898        std::mem::forget(self);
8899    }
8900}
8901
8902impl PacketStreamControlStopResponder {
8903    /// Sends a response to the FIDL transaction.
8904    ///
8905    /// Sets the channel to shutdown if an error occurs.
8906    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8907        let _result = self.send_raw(result);
8908        if _result.is_err() {
8909            self.control_handle.shutdown();
8910        }
8911        self.drop_without_shutdown();
8912        _result
8913    }
8914
8915    /// Similar to "send" but does not shutdown the channel if an error occurs.
8916    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8917        let _result = self.send_raw(result);
8918        self.drop_without_shutdown();
8919        _result
8920    }
8921
8922    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8923        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8924            fidl::encoding::EmptyStruct,
8925            i32,
8926        >>(
8927            fidl::encoding::FlexibleResult::new(result),
8928            self.tx_id,
8929            0x703e4fafcdd7ef32,
8930            fidl::encoding::DynamicFlags::FLEXIBLE,
8931        )
8932    }
8933}
8934
8935#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8936pub struct PacketStreamSinkMarker;
8937
8938impl fidl::endpoints::ProtocolMarker for PacketStreamSinkMarker {
8939    type Proxy = PacketStreamSinkProxy;
8940    type RequestStream = PacketStreamSinkRequestStream;
8941    #[cfg(target_os = "fuchsia")]
8942    type SynchronousProxy = PacketStreamSinkSynchronousProxy;
8943
8944    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamSink";
8945}
8946pub type PacketStreamSinkPutPacketResult = Result<PacketStreamSinkPutPacketResponse, i32>;
8947pub type PacketStreamSinkFlushPacketsResult = Result<(), i32>;
8948
8949pub trait PacketStreamSinkProxyInterface: Send + Sync {
8950    type PutPacketResponseFut: std::future::Future<Output = Result<PacketStreamSinkPutPacketResult, fidl::Error>>
8951        + Send;
8952    fn r#put_packet(&self, payload: PacketStreamSinkPutPacketRequest)
8953    -> Self::PutPacketResponseFut;
8954    type FlushPacketsResponseFut: std::future::Future<Output = Result<PacketStreamSinkFlushPacketsResult, fidl::Error>>
8955        + Send;
8956    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut;
8957}
8958#[derive(Debug)]
8959#[cfg(target_os = "fuchsia")]
8960pub struct PacketStreamSinkSynchronousProxy {
8961    client: fidl::client::sync::Client,
8962}
8963
8964#[cfg(target_os = "fuchsia")]
8965impl fidl::endpoints::SynchronousProxy for PacketStreamSinkSynchronousProxy {
8966    type Proxy = PacketStreamSinkProxy;
8967    type Protocol = PacketStreamSinkMarker;
8968
8969    fn from_channel(inner: fidl::Channel) -> Self {
8970        Self::new(inner)
8971    }
8972
8973    fn into_channel(self) -> fidl::Channel {
8974        self.client.into_channel()
8975    }
8976
8977    fn as_channel(&self) -> &fidl::Channel {
8978        self.client.as_channel()
8979    }
8980}
8981
8982#[cfg(target_os = "fuchsia")]
8983impl PacketStreamSinkSynchronousProxy {
8984    pub fn new(channel: fidl::Channel) -> Self {
8985        Self { client: fidl::client::sync::Client::new(channel) }
8986    }
8987
8988    pub fn into_channel(self) -> fidl::Channel {
8989        self.client.into_channel()
8990    }
8991
8992    /// Waits until an event arrives and returns it. It is safe for other
8993    /// threads to make concurrent requests while waiting for an event.
8994    pub fn wait_for_event(
8995        &self,
8996        deadline: zx::MonotonicInstant,
8997    ) -> Result<PacketStreamSinkEvent, fidl::Error> {
8998        PacketStreamSinkEvent::decode(
8999            self.client.wait_for_event::<PacketStreamSinkMarker>(deadline)?,
9000        )
9001    }
9002
9003    /// Submits a packet to be processed by the server.
9004    ///
9005    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
9006    /// Packets are processed in the order they were submitted. This call
9007    /// blocks until the payload is processed. When this call returns, the
9008    /// buffer region is guaranteed to be available for reuse.
9009    ///
9010    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
9011    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
9012    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
9013    /// * The payload is missing.
9014    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
9015    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
9016    ///   `DRIVER_OWNED`.
9017    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
9018    ///
9019    /// Note: The server is not required to detect if a VMO region is currently in use by a
9020    /// previous pending packet. Clients are responsible for managing buffer usage.
9021    pub fn r#put_packet(
9022        &self,
9023        mut payload: PacketStreamSinkPutPacketRequest,
9024        ___deadline: zx::MonotonicInstant,
9025    ) -> Result<PacketStreamSinkPutPacketResult, fidl::Error> {
9026        let _response = self.client.send_query::<
9027            PacketStreamSinkPutPacketRequest,
9028            fidl::encoding::FlexibleResultType<PacketStreamSinkPutPacketResponse, i32>,
9029            PacketStreamSinkMarker,
9030        >(
9031            &mut payload,
9032            0x25a8e35efba81f2b,
9033            fidl::encoding::DynamicFlags::FLEXIBLE,
9034            ___deadline,
9035        )?
9036        .into_result::<PacketStreamSinkMarker>("put_packet")?;
9037        Ok(_response.map(|x| x))
9038    }
9039
9040    /// Flushes all packets currently pending without processing them.
9041    /// This call waits until all pending packets are completed or canceled.
9042    ///
9043    /// Note: A packet may be partially processed (e.g. if it contains multiple
9044    /// audio frames, or if the data does not align with encoded frame boundaries)
9045    /// before it is canceled.
9046    pub fn r#flush_packets(
9047        &self,
9048        ___deadline: zx::MonotonicInstant,
9049    ) -> Result<PacketStreamSinkFlushPacketsResult, fidl::Error> {
9050        let _response = self.client.send_query::<
9051            fidl::encoding::EmptyPayload,
9052            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
9053            PacketStreamSinkMarker,
9054        >(
9055            (),
9056            0x13f16ca37ede8a4,
9057            fidl::encoding::DynamicFlags::FLEXIBLE,
9058            ___deadline,
9059        )?
9060        .into_result::<PacketStreamSinkMarker>("flush_packets")?;
9061        Ok(_response.map(|x| x))
9062    }
9063}
9064
9065#[cfg(target_os = "fuchsia")]
9066impl From<PacketStreamSinkSynchronousProxy> for zx::NullableHandle {
9067    fn from(value: PacketStreamSinkSynchronousProxy) -> Self {
9068        value.into_channel().into()
9069    }
9070}
9071
9072#[cfg(target_os = "fuchsia")]
9073impl From<fidl::Channel> for PacketStreamSinkSynchronousProxy {
9074    fn from(value: fidl::Channel) -> Self {
9075        Self::new(value)
9076    }
9077}
9078
9079#[cfg(target_os = "fuchsia")]
9080impl fidl::endpoints::FromClient for PacketStreamSinkSynchronousProxy {
9081    type Protocol = PacketStreamSinkMarker;
9082
9083    fn from_client(value: fidl::endpoints::ClientEnd<PacketStreamSinkMarker>) -> Self {
9084        Self::new(value.into_channel())
9085    }
9086}
9087
9088#[derive(Debug, Clone)]
9089pub struct PacketStreamSinkProxy {
9090    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9091}
9092
9093impl fidl::endpoints::Proxy for PacketStreamSinkProxy {
9094    type Protocol = PacketStreamSinkMarker;
9095
9096    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9097        Self::new(inner)
9098    }
9099
9100    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9101        self.client.into_channel().map_err(|client| Self { client })
9102    }
9103
9104    fn as_channel(&self) -> &::fidl::AsyncChannel {
9105        self.client.as_channel()
9106    }
9107}
9108
9109impl PacketStreamSinkProxy {
9110    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamSink.
9111    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9112        let protocol_name = <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9113        Self { client: fidl::client::Client::new(channel, protocol_name) }
9114    }
9115
9116    /// Get a Stream of events from the remote end of the protocol.
9117    ///
9118    /// # Panics
9119    ///
9120    /// Panics if the event stream was already taken.
9121    pub fn take_event_stream(&self) -> PacketStreamSinkEventStream {
9122        PacketStreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
9123    }
9124
9125    /// Submits a packet to be processed by the server.
9126    ///
9127    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
9128    /// Packets are processed in the order they were submitted. This call
9129    /// blocks until the payload is processed. When this call returns, the
9130    /// buffer region is guaranteed to be available for reuse.
9131    ///
9132    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
9133    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
9134    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
9135    /// * The payload is missing.
9136    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
9137    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
9138    ///   `DRIVER_OWNED`.
9139    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
9140    ///
9141    /// Note: The server is not required to detect if a VMO region is currently in use by a
9142    /// previous pending packet. Clients are responsible for managing buffer usage.
9143    pub fn r#put_packet(
9144        &self,
9145        mut payload: PacketStreamSinkPutPacketRequest,
9146    ) -> fidl::client::QueryResponseFut<
9147        PacketStreamSinkPutPacketResult,
9148        fidl::encoding::DefaultFuchsiaResourceDialect,
9149    > {
9150        PacketStreamSinkProxyInterface::r#put_packet(self, payload)
9151    }
9152
9153    /// Flushes all packets currently pending without processing them.
9154    /// This call waits until all pending packets are completed or canceled.
9155    ///
9156    /// Note: A packet may be partially processed (e.g. if it contains multiple
9157    /// audio frames, or if the data does not align with encoded frame boundaries)
9158    /// before it is canceled.
9159    pub fn r#flush_packets(
9160        &self,
9161    ) -> fidl::client::QueryResponseFut<
9162        PacketStreamSinkFlushPacketsResult,
9163        fidl::encoding::DefaultFuchsiaResourceDialect,
9164    > {
9165        PacketStreamSinkProxyInterface::r#flush_packets(self)
9166    }
9167}
9168
9169impl PacketStreamSinkProxyInterface for PacketStreamSinkProxy {
9170    type PutPacketResponseFut = fidl::client::QueryResponseFut<
9171        PacketStreamSinkPutPacketResult,
9172        fidl::encoding::DefaultFuchsiaResourceDialect,
9173    >;
9174    fn r#put_packet(
9175        &self,
9176        mut payload: PacketStreamSinkPutPacketRequest,
9177    ) -> Self::PutPacketResponseFut {
9178        fn _decode(
9179            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9180        ) -> Result<PacketStreamSinkPutPacketResult, fidl::Error> {
9181            let _response = fidl::client::decode_transaction_body::<
9182                fidl::encoding::FlexibleResultType<PacketStreamSinkPutPacketResponse, i32>,
9183                fidl::encoding::DefaultFuchsiaResourceDialect,
9184                0x25a8e35efba81f2b,
9185            >(_buf?)?
9186            .into_result::<PacketStreamSinkMarker>("put_packet")?;
9187            Ok(_response.map(|x| x))
9188        }
9189        self.client.send_query_and_decode::<
9190            PacketStreamSinkPutPacketRequest,
9191            PacketStreamSinkPutPacketResult,
9192        >(
9193            &mut payload,
9194            0x25a8e35efba81f2b,
9195            fidl::encoding::DynamicFlags::FLEXIBLE,
9196            _decode,
9197        )
9198    }
9199
9200    type FlushPacketsResponseFut = fidl::client::QueryResponseFut<
9201        PacketStreamSinkFlushPacketsResult,
9202        fidl::encoding::DefaultFuchsiaResourceDialect,
9203    >;
9204    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut {
9205        fn _decode(
9206            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9207        ) -> Result<PacketStreamSinkFlushPacketsResult, fidl::Error> {
9208            let _response = fidl::client::decode_transaction_body::<
9209                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
9210                fidl::encoding::DefaultFuchsiaResourceDialect,
9211                0x13f16ca37ede8a4,
9212            >(_buf?)?
9213            .into_result::<PacketStreamSinkMarker>("flush_packets")?;
9214            Ok(_response.map(|x| x))
9215        }
9216        self.client.send_query_and_decode::<
9217            fidl::encoding::EmptyPayload,
9218            PacketStreamSinkFlushPacketsResult,
9219        >(
9220            (),
9221            0x13f16ca37ede8a4,
9222            fidl::encoding::DynamicFlags::FLEXIBLE,
9223            _decode,
9224        )
9225    }
9226}
9227
9228pub struct PacketStreamSinkEventStream {
9229    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9230}
9231
9232impl std::marker::Unpin for PacketStreamSinkEventStream {}
9233
9234impl futures::stream::FusedStream for PacketStreamSinkEventStream {
9235    fn is_terminated(&self) -> bool {
9236        self.event_receiver.is_terminated()
9237    }
9238}
9239
9240impl futures::Stream for PacketStreamSinkEventStream {
9241    type Item = Result<PacketStreamSinkEvent, fidl::Error>;
9242
9243    fn poll_next(
9244        mut self: std::pin::Pin<&mut Self>,
9245        cx: &mut std::task::Context<'_>,
9246    ) -> std::task::Poll<Option<Self::Item>> {
9247        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9248            &mut self.event_receiver,
9249            cx
9250        )?) {
9251            Some(buf) => std::task::Poll::Ready(Some(PacketStreamSinkEvent::decode(buf))),
9252            None => std::task::Poll::Ready(None),
9253        }
9254    }
9255}
9256
9257#[derive(Debug)]
9258pub enum PacketStreamSinkEvent {
9259    #[non_exhaustive]
9260    _UnknownEvent {
9261        /// Ordinal of the event that was sent.
9262        ordinal: u64,
9263    },
9264}
9265
9266impl PacketStreamSinkEvent {
9267    /// Decodes a message buffer as a [`PacketStreamSinkEvent`].
9268    fn decode(
9269        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9270    ) -> Result<PacketStreamSinkEvent, fidl::Error> {
9271        let (bytes, _handles) = buf.split_mut();
9272        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9273        debug_assert_eq!(tx_header.tx_id, 0);
9274        match tx_header.ordinal {
9275            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
9276                Ok(PacketStreamSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
9277            }
9278            _ => Err(fidl::Error::UnknownOrdinal {
9279                ordinal: tx_header.ordinal,
9280                protocol_name:
9281                    <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9282            }),
9283        }
9284    }
9285}
9286
9287/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamSink.
9288pub struct PacketStreamSinkRequestStream {
9289    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9290    is_terminated: bool,
9291}
9292
9293impl std::marker::Unpin for PacketStreamSinkRequestStream {}
9294
9295impl futures::stream::FusedStream for PacketStreamSinkRequestStream {
9296    fn is_terminated(&self) -> bool {
9297        self.is_terminated
9298    }
9299}
9300
9301impl fidl::endpoints::RequestStream for PacketStreamSinkRequestStream {
9302    type Protocol = PacketStreamSinkMarker;
9303    type ControlHandle = PacketStreamSinkControlHandle;
9304
9305    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9306        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9307    }
9308
9309    fn control_handle(&self) -> Self::ControlHandle {
9310        PacketStreamSinkControlHandle { inner: self.inner.clone() }
9311    }
9312
9313    fn into_inner(
9314        self,
9315    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9316    {
9317        (self.inner, self.is_terminated)
9318    }
9319
9320    fn from_inner(
9321        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9322        is_terminated: bool,
9323    ) -> Self {
9324        Self { inner, is_terminated }
9325    }
9326}
9327
9328impl futures::Stream for PacketStreamSinkRequestStream {
9329    type Item = Result<PacketStreamSinkRequest, fidl::Error>;
9330
9331    fn poll_next(
9332        mut self: std::pin::Pin<&mut Self>,
9333        cx: &mut std::task::Context<'_>,
9334    ) -> std::task::Poll<Option<Self::Item>> {
9335        let this = &mut *self;
9336        if this.inner.check_shutdown(cx) {
9337            this.is_terminated = true;
9338            return std::task::Poll::Ready(None);
9339        }
9340        if this.is_terminated {
9341            panic!("polled PacketStreamSinkRequestStream after completion");
9342        }
9343        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9344            |bytes, handles| {
9345                match this.inner.channel().read_etc(cx, bytes, handles) {
9346                    std::task::Poll::Ready(Ok(())) => {}
9347                    std::task::Poll::Pending => return std::task::Poll::Pending,
9348                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9349                        this.is_terminated = true;
9350                        return std::task::Poll::Ready(None);
9351                    }
9352                    std::task::Poll::Ready(Err(e)) => {
9353                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9354                            e.into(),
9355                        ))));
9356                    }
9357                }
9358
9359                // A message has been received from the channel
9360                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9361
9362                std::task::Poll::Ready(Some(match header.ordinal {
9363                    0x25a8e35efba81f2b => {
9364                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9365                        let mut req = fidl::new_empty!(
9366                            PacketStreamSinkPutPacketRequest,
9367                            fidl::encoding::DefaultFuchsiaResourceDialect
9368                        );
9369                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PacketStreamSinkPutPacketRequest>(&header, _body_bytes, handles, &mut req)?;
9370                        let control_handle =
9371                            PacketStreamSinkControlHandle { inner: this.inner.clone() };
9372                        Ok(PacketStreamSinkRequest::PutPacket {
9373                            payload: req,
9374                            responder: PacketStreamSinkPutPacketResponder {
9375                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9376                                tx_id: header.tx_id,
9377                            },
9378                        })
9379                    }
9380                    0x13f16ca37ede8a4 => {
9381                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9382                        let mut req = fidl::new_empty!(
9383                            fidl::encoding::EmptyPayload,
9384                            fidl::encoding::DefaultFuchsiaResourceDialect
9385                        );
9386                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9387                        let control_handle =
9388                            PacketStreamSinkControlHandle { inner: this.inner.clone() };
9389                        Ok(PacketStreamSinkRequest::FlushPackets {
9390                            responder: PacketStreamSinkFlushPacketsResponder {
9391                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9392                                tx_id: header.tx_id,
9393                            },
9394                        })
9395                    }
9396                    _ if header.tx_id == 0
9397                        && header
9398                            .dynamic_flags()
9399                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9400                    {
9401                        Ok(PacketStreamSinkRequest::_UnknownMethod {
9402                            ordinal: header.ordinal,
9403                            control_handle: PacketStreamSinkControlHandle {
9404                                inner: this.inner.clone(),
9405                            },
9406                            method_type: fidl::MethodType::OneWay,
9407                        })
9408                    }
9409                    _ if header
9410                        .dynamic_flags()
9411                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9412                    {
9413                        this.inner.send_framework_err(
9414                            fidl::encoding::FrameworkErr::UnknownMethod,
9415                            header.tx_id,
9416                            header.ordinal,
9417                            header.dynamic_flags(),
9418                            (bytes, handles),
9419                        )?;
9420                        Ok(PacketStreamSinkRequest::_UnknownMethod {
9421                            ordinal: header.ordinal,
9422                            control_handle: PacketStreamSinkControlHandle {
9423                                inner: this.inner.clone(),
9424                            },
9425                            method_type: fidl::MethodType::TwoWay,
9426                        })
9427                    }
9428                    _ => Err(fidl::Error::UnknownOrdinal {
9429                        ordinal: header.ordinal,
9430                        protocol_name:
9431                            <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9432                    }),
9433                }))
9434            },
9435        )
9436    }
9437}
9438
9439/// The protocol for streaming packet-based audio data.
9440/// This protocol functions as a data sink. The "server" of this protocol consumes packets,
9441/// and the "client" produces packets.
9442///
9443/// This protocol can be used in two directions:
9444/// 1. **Output (Client -> Driver)**: The Driver implements `PacketStreamSink`. The Client (App)
9445///    calls `PutPacket`.
9446/// 2. **Input (Driver -> Client)**: The Client (App) implements `PacketStreamSink`. The Driver
9447///    calls `PutPacket`.
9448#[derive(Debug)]
9449pub enum PacketStreamSinkRequest {
9450    /// Submits a packet to be processed by the server.
9451    ///
9452    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
9453    /// Packets are processed in the order they were submitted. This call
9454    /// blocks until the payload is processed. When this call returns, the
9455    /// buffer region is guaranteed to be available for reuse.
9456    ///
9457    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
9458    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
9459    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
9460    /// * The payload is missing.
9461    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
9462    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
9463    ///   `DRIVER_OWNED`.
9464    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
9465    ///
9466    /// Note: The server is not required to detect if a VMO region is currently in use by a
9467    /// previous pending packet. Clients are responsible for managing buffer usage.
9468    PutPacket {
9469        payload: PacketStreamSinkPutPacketRequest,
9470        responder: PacketStreamSinkPutPacketResponder,
9471    },
9472    /// Flushes all packets currently pending without processing them.
9473    /// This call waits until all pending packets are completed or canceled.
9474    ///
9475    /// Note: A packet may be partially processed (e.g. if it contains multiple
9476    /// audio frames, or if the data does not align with encoded frame boundaries)
9477    /// before it is canceled.
9478    FlushPackets { responder: PacketStreamSinkFlushPacketsResponder },
9479    /// An interaction was received which does not match any known method.
9480    #[non_exhaustive]
9481    _UnknownMethod {
9482        /// Ordinal of the method that was called.
9483        ordinal: u64,
9484        control_handle: PacketStreamSinkControlHandle,
9485        method_type: fidl::MethodType,
9486    },
9487}
9488
9489impl PacketStreamSinkRequest {
9490    #[allow(irrefutable_let_patterns)]
9491    pub fn into_put_packet(
9492        self,
9493    ) -> Option<(PacketStreamSinkPutPacketRequest, PacketStreamSinkPutPacketResponder)> {
9494        if let PacketStreamSinkRequest::PutPacket { payload, responder } = self {
9495            Some((payload, responder))
9496        } else {
9497            None
9498        }
9499    }
9500
9501    #[allow(irrefutable_let_patterns)]
9502    pub fn into_flush_packets(self) -> Option<(PacketStreamSinkFlushPacketsResponder)> {
9503        if let PacketStreamSinkRequest::FlushPackets { responder } = self {
9504            Some((responder))
9505        } else {
9506            None
9507        }
9508    }
9509
9510    /// Name of the method defined in FIDL
9511    pub fn method_name(&self) -> &'static str {
9512        match *self {
9513            PacketStreamSinkRequest::PutPacket { .. } => "put_packet",
9514            PacketStreamSinkRequest::FlushPackets { .. } => "flush_packets",
9515            PacketStreamSinkRequest::_UnknownMethod {
9516                method_type: fidl::MethodType::OneWay,
9517                ..
9518            } => "unknown one-way method",
9519            PacketStreamSinkRequest::_UnknownMethod {
9520                method_type: fidl::MethodType::TwoWay,
9521                ..
9522            } => "unknown two-way method",
9523        }
9524    }
9525}
9526
9527#[derive(Debug, Clone)]
9528pub struct PacketStreamSinkControlHandle {
9529    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9530}
9531
9532impl fidl::endpoints::ControlHandle for PacketStreamSinkControlHandle {
9533    fn shutdown(&self) {
9534        self.inner.shutdown()
9535    }
9536
9537    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9538        self.inner.shutdown_with_epitaph(status)
9539    }
9540
9541    fn is_closed(&self) -> bool {
9542        self.inner.channel().is_closed()
9543    }
9544    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9545        self.inner.channel().on_closed()
9546    }
9547
9548    #[cfg(target_os = "fuchsia")]
9549    fn signal_peer(
9550        &self,
9551        clear_mask: zx::Signals,
9552        set_mask: zx::Signals,
9553    ) -> Result<(), zx_status::Status> {
9554        use fidl::Peered;
9555        self.inner.channel().signal_peer(clear_mask, set_mask)
9556    }
9557}
9558
9559impl PacketStreamSinkControlHandle {}
9560
9561#[must_use = "FIDL methods require a response to be sent"]
9562#[derive(Debug)]
9563pub struct PacketStreamSinkPutPacketResponder {
9564    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
9565    tx_id: u32,
9566}
9567
9568/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
9569/// if the responder is dropped without sending a response, so that the client
9570/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9571impl std::ops::Drop for PacketStreamSinkPutPacketResponder {
9572    fn drop(&mut self) {
9573        self.control_handle.shutdown();
9574        // Safety: drops once, never accessed again
9575        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9576    }
9577}
9578
9579impl fidl::endpoints::Responder for PacketStreamSinkPutPacketResponder {
9580    type ControlHandle = PacketStreamSinkControlHandle;
9581
9582    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
9583        &self.control_handle
9584    }
9585
9586    fn drop_without_shutdown(mut self) {
9587        // Safety: drops once, never accessed again due to mem::forget
9588        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9589        // Prevent Drop from running (which would shut down the channel)
9590        std::mem::forget(self);
9591    }
9592}
9593
9594impl PacketStreamSinkPutPacketResponder {
9595    /// Sends a response to the FIDL transaction.
9596    ///
9597    /// Sets the channel to shutdown if an error occurs.
9598    pub fn send(
9599        self,
9600        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9601    ) -> Result<(), fidl::Error> {
9602        let _result = self.send_raw(result);
9603        if _result.is_err() {
9604            self.control_handle.shutdown();
9605        }
9606        self.drop_without_shutdown();
9607        _result
9608    }
9609
9610    /// Similar to "send" but does not shutdown the channel if an error occurs.
9611    pub fn send_no_shutdown_on_err(
9612        self,
9613        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9614    ) -> Result<(), fidl::Error> {
9615        let _result = self.send_raw(result);
9616        self.drop_without_shutdown();
9617        _result
9618    }
9619
9620    fn send_raw(
9621        &self,
9622        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9623    ) -> Result<(), fidl::Error> {
9624        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
9625            PacketStreamSinkPutPacketResponse,
9626            i32,
9627        >>(
9628            fidl::encoding::FlexibleResult::new(result),
9629            self.tx_id,
9630            0x25a8e35efba81f2b,
9631            fidl::encoding::DynamicFlags::FLEXIBLE,
9632        )
9633    }
9634}
9635
9636#[must_use = "FIDL methods require a response to be sent"]
9637#[derive(Debug)]
9638pub struct PacketStreamSinkFlushPacketsResponder {
9639    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
9640    tx_id: u32,
9641}
9642
9643/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
9644/// if the responder is dropped without sending a response, so that the client
9645/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9646impl std::ops::Drop for PacketStreamSinkFlushPacketsResponder {
9647    fn drop(&mut self) {
9648        self.control_handle.shutdown();
9649        // Safety: drops once, never accessed again
9650        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9651    }
9652}
9653
9654impl fidl::endpoints::Responder for PacketStreamSinkFlushPacketsResponder {
9655    type ControlHandle = PacketStreamSinkControlHandle;
9656
9657    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
9658        &self.control_handle
9659    }
9660
9661    fn drop_without_shutdown(mut self) {
9662        // Safety: drops once, never accessed again due to mem::forget
9663        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9664        // Prevent Drop from running (which would shut down the channel)
9665        std::mem::forget(self);
9666    }
9667}
9668
9669impl PacketStreamSinkFlushPacketsResponder {
9670    /// Sends a response to the FIDL transaction.
9671    ///
9672    /// Sets the channel to shutdown if an error occurs.
9673    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9674        let _result = self.send_raw(result);
9675        if _result.is_err() {
9676            self.control_handle.shutdown();
9677        }
9678        self.drop_without_shutdown();
9679        _result
9680    }
9681
9682    /// Similar to "send" but does not shutdown the channel if an error occurs.
9683    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9684        let _result = self.send_raw(result);
9685        self.drop_without_shutdown();
9686        _result
9687    }
9688
9689    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9690        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
9691            fidl::encoding::EmptyStruct,
9692            i32,
9693        >>(
9694            fidl::encoding::FlexibleResult::new(result),
9695            self.tx_id,
9696            0x13f16ca37ede8a4,
9697            fidl::encoding::DynamicFlags::FLEXIBLE,
9698        )
9699    }
9700}
9701
9702#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9703pub struct RingBufferMarker;
9704
9705impl fidl::endpoints::ProtocolMarker for RingBufferMarker {
9706    type Proxy = RingBufferProxy;
9707    type RequestStream = RingBufferRequestStream;
9708    #[cfg(target_os = "fuchsia")]
9709    type SynchronousProxy = RingBufferSynchronousProxy;
9710
9711    const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
9712}
9713pub type RingBufferGetVmoResult = Result<(u32, fidl::Vmo), GetVmoError>;
9714pub type RingBufferSetActiveChannelsResult = Result<i64, i32>;
9715
9716pub trait RingBufferProxyInterface: Send + Sync {
9717    type GetPropertiesResponseFut: std::future::Future<Output = Result<RingBufferProperties, fidl::Error>>
9718        + Send;
9719    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
9720    type WatchClockRecoveryPositionInfoResponseFut: std::future::Future<Output = Result<RingBufferPositionInfo, fidl::Error>>
9721        + Send;
9722    fn r#watch_clock_recovery_position_info(
9723        &self,
9724    ) -> Self::WatchClockRecoveryPositionInfoResponseFut;
9725    type GetVmoResponseFut: std::future::Future<Output = Result<RingBufferGetVmoResult, fidl::Error>>
9726        + Send;
9727    fn r#get_vmo(
9728        &self,
9729        min_frames: u32,
9730        clock_recovery_notifications_per_ring: u32,
9731    ) -> Self::GetVmoResponseFut;
9732    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
9733    fn r#start(&self) -> Self::StartResponseFut;
9734    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
9735    fn r#stop(&self) -> Self::StopResponseFut;
9736    type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
9737        + Send;
9738    fn r#set_active_channels(
9739        &self,
9740        active_channels_bitmask: u64,
9741    ) -> Self::SetActiveChannelsResponseFut;
9742    type WatchDelayInfoResponseFut: std::future::Future<Output = Result<DelayInfo, fidl::Error>>
9743        + Send;
9744    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
9745}
9746#[derive(Debug)]
9747#[cfg(target_os = "fuchsia")]
9748pub struct RingBufferSynchronousProxy {
9749    client: fidl::client::sync::Client,
9750}
9751
9752#[cfg(target_os = "fuchsia")]
9753impl fidl::endpoints::SynchronousProxy for RingBufferSynchronousProxy {
9754    type Proxy = RingBufferProxy;
9755    type Protocol = RingBufferMarker;
9756
9757    fn from_channel(inner: fidl::Channel) -> Self {
9758        Self::new(inner)
9759    }
9760
9761    fn into_channel(self) -> fidl::Channel {
9762        self.client.into_channel()
9763    }
9764
9765    fn as_channel(&self) -> &fidl::Channel {
9766        self.client.as_channel()
9767    }
9768}
9769
9770#[cfg(target_os = "fuchsia")]
9771impl RingBufferSynchronousProxy {
9772    pub fn new(channel: fidl::Channel) -> Self {
9773        Self { client: fidl::client::sync::Client::new(channel) }
9774    }
9775
9776    pub fn into_channel(self) -> fidl::Channel {
9777        self.client.into_channel()
9778    }
9779
9780    /// Waits until an event arrives and returns it. It is safe for other
9781    /// threads to make concurrent requests while waiting for an event.
9782    pub fn wait_for_event(
9783        &self,
9784        deadline: zx::MonotonicInstant,
9785    ) -> Result<RingBufferEvent, fidl::Error> {
9786        RingBufferEvent::decode(self.client.wait_for_event::<RingBufferMarker>(deadline)?)
9787    }
9788
9789    /// Accessor for top level static properties.
9790    pub fn r#get_properties(
9791        &self,
9792        ___deadline: zx::MonotonicInstant,
9793    ) -> Result<RingBufferProperties, fidl::Error> {
9794        let _response = self.client.send_query::<
9795            fidl::encoding::EmptyPayload,
9796            RingBufferGetPropertiesResponse,
9797            RingBufferMarker,
9798        >(
9799            (),
9800            0x12947f061a8fe1,
9801            fidl::encoding::DynamicFlags::empty(),
9802            ___deadline,
9803        )?;
9804        Ok(_response.properties)
9805    }
9806
9807    /// Gets the ring buffer current position via a hanging get.
9808    ///
9809    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
9810    /// `clock_recovery_notifications_per_ring` was specified.
9811    ///
9812    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
9813    /// not respond to subsequent client calls until the position information has changed from what
9814    /// was most recently provided to that client.
9815    ///
9816    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
9817    /// to the `Start` command.
9818    ///
9819    /// At the `start_time` returned by `Start`, position is always 0. From there, it
9820    /// progresses at the rate specified by the rate, sample format (and clock domain,
9821    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
9822    ///
9823    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
9824    /// estimated position to be used for clock recovery at most at
9825    /// `clock_recovery_notifications_per_ring` frequency.
9826    ///
9827    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
9828    /// increasing.
9829    ///
9830    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
9831    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
9832    pub fn r#watch_clock_recovery_position_info(
9833        &self,
9834        ___deadline: zx::MonotonicInstant,
9835    ) -> Result<RingBufferPositionInfo, fidl::Error> {
9836        let _response = self.client.send_query::<
9837            fidl::encoding::EmptyPayload,
9838            RingBufferWatchClockRecoveryPositionInfoResponse,
9839            RingBufferMarker,
9840        >(
9841            (),
9842            0x694d5b898a4167e5,
9843            fidl::encoding::DynamicFlags::empty(),
9844            ___deadline,
9845        )?;
9846        Ok(_response.position_info)
9847    }
9848
9849    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
9850    ///
9851    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
9852    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
9853    ///
9854    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
9855    /// that ring buffer contents can be transfered in and out, or else the call must be failed
9856    /// with GetVmoError.INVALID_ARGS.
9857    ///
9858    /// The driver may increase the ring buffer size beyond `min_frames` plus
9859    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
9860    /// alignment.
9861    ///
9862    /// Clients can treat the entire returned ring buffer as safe to access, except for the
9863    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
9864    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
9865    ///
9866    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
9867    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
9868    /// handle must also include ZX_RIGHT_WRITE.
9869    ///
9870    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
9871    /// `WatchClockRecoveryPositionInfo` client requests at most at
9872    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
9873    /// for clock recovery.
9874    pub fn r#get_vmo(
9875        &self,
9876        mut min_frames: u32,
9877        mut clock_recovery_notifications_per_ring: u32,
9878        ___deadline: zx::MonotonicInstant,
9879    ) -> Result<RingBufferGetVmoResult, fidl::Error> {
9880        let _response = self.client.send_query::<
9881            RingBufferGetVmoRequest,
9882            fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
9883            RingBufferMarker,
9884        >(
9885            (min_frames, clock_recovery_notifications_per_ring,),
9886            0x44c8f4f5680e853a,
9887            fidl::encoding::DynamicFlags::empty(),
9888            ___deadline,
9889        )?;
9890        Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
9891    }
9892
9893    /// Start the ring buffer.
9894    ///
9895    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
9896    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
9897    /// write from or to the ring buffer position 0, subject to the overall position and buffering
9898    /// behavior described in 'Ring buffer behavior' below.
9899    ///
9900    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
9901    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
9902    /// a second time before the first call has completed, then the channel must be closed with an
9903    /// error `ZX_ERR_BAD_STATE` returned.
9904    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
9905    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
9906        let _response = self
9907            .client
9908            .send_query::<fidl::encoding::EmptyPayload, RingBufferStartResponse, RingBufferMarker>(
9909                (),
9910                0x5dd780a769a8892d,
9911                fidl::encoding::DynamicFlags::empty(),
9912                ___deadline,
9913            )?;
9914        Ok(_response.start_time)
9915    }
9916
9917    /// Stop the ring buffer.
9918    ///
9919    /// Once this call's response is received, no further position notifications will be sent until
9920    /// `Start` is called again.
9921    ///
9922    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
9923    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
9924        let _response = self.client.send_query::<
9925            fidl::encoding::EmptyPayload,
9926            fidl::encoding::EmptyPayload,
9927            RingBufferMarker,
9928        >(
9929            (),
9930            0x49a73d9cf1d4e110,
9931            fidl::encoding::DynamicFlags::empty(),
9932            ___deadline,
9933        )?;
9934        Ok(_response)
9935    }
9936
9937    /// Sets which channels are active via a bitmask.
9938    ///
9939    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
9940    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
9941    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
9942    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
9943    /// turns on the hardware associated for all channels.
9944    ///
9945    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
9946    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
9947    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
9948    ///
9949    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
9950    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
9951    /// buffer's position advances (and position notifications sent as needed) regardless of the
9952    /// number of active channels, including if no channels are active. This means that the format
9953    /// in the ring buffer is not changed.
9954    ///
9955    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
9956    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
9957    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
9958    ///
9959    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
9960    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
9961    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
9962    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
9963    /// hardware configuration was completed. If the requested channel configuration is already
9964    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
9965    /// before the reply is sent. If called again with the same configuration, the reply must
9966    /// include the same `set_time` value as was previously returned.
9967    ///
9968    /// For input channels, it is not required that the driver zero-out inactive channels.
9969    ///
9970    /// If `SetActiveChannels` is called for a second time before the first call has completed,
9971    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
9972    pub fn r#set_active_channels(
9973        &self,
9974        mut active_channels_bitmask: u64,
9975        ___deadline: zx::MonotonicInstant,
9976    ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
9977        let _response = self.client.send_query::<
9978            RingBufferSetActiveChannelsRequest,
9979            fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
9980            RingBufferMarker,
9981        >(
9982            (active_channels_bitmask,),
9983            0x605464c1d384f309,
9984            fidl::encoding::DynamicFlags::empty(),
9985            ___deadline,
9986        )?;
9987        Ok(_response.map(|x| x.set_time))
9988    }
9989
9990    /// Get information about delays via a hanging get.
9991    ///
9992    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
9993    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
9994    /// changes from what was most recently reported.
9995    ///
9996    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
9997    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
9998    pub fn r#watch_delay_info(
9999        &self,
10000        ___deadline: zx::MonotonicInstant,
10001    ) -> Result<DelayInfo, fidl::Error> {
10002        let _response = self.client.send_query::<
10003            fidl::encoding::EmptyPayload,
10004            fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
10005            RingBufferMarker,
10006        >(
10007            (),
10008            0x6c1248db213fcf9f,
10009            fidl::encoding::DynamicFlags::FLEXIBLE,
10010            ___deadline,
10011        )?
10012        .into_result::<RingBufferMarker>("watch_delay_info")?;
10013        Ok(_response.delay_info)
10014    }
10015}
10016
10017#[cfg(target_os = "fuchsia")]
10018impl From<RingBufferSynchronousProxy> for zx::NullableHandle {
10019    fn from(value: RingBufferSynchronousProxy) -> Self {
10020        value.into_channel().into()
10021    }
10022}
10023
10024#[cfg(target_os = "fuchsia")]
10025impl From<fidl::Channel> for RingBufferSynchronousProxy {
10026    fn from(value: fidl::Channel) -> Self {
10027        Self::new(value)
10028    }
10029}
10030
10031#[cfg(target_os = "fuchsia")]
10032impl fidl::endpoints::FromClient for RingBufferSynchronousProxy {
10033    type Protocol = RingBufferMarker;
10034
10035    fn from_client(value: fidl::endpoints::ClientEnd<RingBufferMarker>) -> Self {
10036        Self::new(value.into_channel())
10037    }
10038}
10039
10040#[derive(Debug, Clone)]
10041pub struct RingBufferProxy {
10042    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10043}
10044
10045impl fidl::endpoints::Proxy for RingBufferProxy {
10046    type Protocol = RingBufferMarker;
10047
10048    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10049        Self::new(inner)
10050    }
10051
10052    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10053        self.client.into_channel().map_err(|client| Self { client })
10054    }
10055
10056    fn as_channel(&self) -> &::fidl::AsyncChannel {
10057        self.client.as_channel()
10058    }
10059}
10060
10061impl RingBufferProxy {
10062    /// Create a new Proxy for fuchsia.hardware.audio/RingBuffer.
10063    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10064        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10065        Self { client: fidl::client::Client::new(channel, protocol_name) }
10066    }
10067
10068    /// Get a Stream of events from the remote end of the protocol.
10069    ///
10070    /// # Panics
10071    ///
10072    /// Panics if the event stream was already taken.
10073    pub fn take_event_stream(&self) -> RingBufferEventStream {
10074        RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
10075    }
10076
10077    /// Accessor for top level static properties.
10078    pub fn r#get_properties(
10079        &self,
10080    ) -> fidl::client::QueryResponseFut<
10081        RingBufferProperties,
10082        fidl::encoding::DefaultFuchsiaResourceDialect,
10083    > {
10084        RingBufferProxyInterface::r#get_properties(self)
10085    }
10086
10087    /// Gets the ring buffer current position via a hanging get.
10088    ///
10089    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
10090    /// `clock_recovery_notifications_per_ring` was specified.
10091    ///
10092    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
10093    /// not respond to subsequent client calls until the position information has changed from what
10094    /// was most recently provided to that client.
10095    ///
10096    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
10097    /// to the `Start` command.
10098    ///
10099    /// At the `start_time` returned by `Start`, position is always 0. From there, it
10100    /// progresses at the rate specified by the rate, sample format (and clock domain,
10101    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
10102    ///
10103    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
10104    /// estimated position to be used for clock recovery at most at
10105    /// `clock_recovery_notifications_per_ring` frequency.
10106    ///
10107    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
10108    /// increasing.
10109    ///
10110    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
10111    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
10112    pub fn r#watch_clock_recovery_position_info(
10113        &self,
10114    ) -> fidl::client::QueryResponseFut<
10115        RingBufferPositionInfo,
10116        fidl::encoding::DefaultFuchsiaResourceDialect,
10117    > {
10118        RingBufferProxyInterface::r#watch_clock_recovery_position_info(self)
10119    }
10120
10121    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
10122    ///
10123    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
10124    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
10125    ///
10126    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
10127    /// that ring buffer contents can be transfered in and out, or else the call must be failed
10128    /// with GetVmoError.INVALID_ARGS.
10129    ///
10130    /// The driver may increase the ring buffer size beyond `min_frames` plus
10131    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
10132    /// alignment.
10133    ///
10134    /// Clients can treat the entire returned ring buffer as safe to access, except for the
10135    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
10136    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
10137    ///
10138    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
10139    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
10140    /// handle must also include ZX_RIGHT_WRITE.
10141    ///
10142    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
10143    /// `WatchClockRecoveryPositionInfo` client requests at most at
10144    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
10145    /// for clock recovery.
10146    pub fn r#get_vmo(
10147        &self,
10148        mut min_frames: u32,
10149        mut clock_recovery_notifications_per_ring: u32,
10150    ) -> fidl::client::QueryResponseFut<
10151        RingBufferGetVmoResult,
10152        fidl::encoding::DefaultFuchsiaResourceDialect,
10153    > {
10154        RingBufferProxyInterface::r#get_vmo(self, min_frames, clock_recovery_notifications_per_ring)
10155    }
10156
10157    /// Start the ring buffer.
10158    ///
10159    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
10160    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
10161    /// write from or to the ring buffer position 0, subject to the overall position and buffering
10162    /// behavior described in 'Ring buffer behavior' below.
10163    ///
10164    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10165    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
10166    /// a second time before the first call has completed, then the channel must be closed with an
10167    /// error `ZX_ERR_BAD_STATE` returned.
10168    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
10169    pub fn r#start(
10170        &self,
10171    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
10172        RingBufferProxyInterface::r#start(self)
10173    }
10174
10175    /// Stop the ring buffer.
10176    ///
10177    /// Once this call's response is received, no further position notifications will be sent until
10178    /// `Start` is called again.
10179    ///
10180    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10181    pub fn r#stop(
10182        &self,
10183    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
10184        RingBufferProxyInterface::r#stop(self)
10185    }
10186
10187    /// Sets which channels are active via a bitmask.
10188    ///
10189    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
10190    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
10191    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
10192    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
10193    /// turns on the hardware associated for all channels.
10194    ///
10195    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
10196    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
10197    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
10198    ///
10199    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
10200    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
10201    /// buffer's position advances (and position notifications sent as needed) regardless of the
10202    /// number of active channels, including if no channels are active. This means that the format
10203    /// in the ring buffer is not changed.
10204    ///
10205    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
10206    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
10207    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
10208    ///
10209    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
10210    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
10211    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
10212    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
10213    /// hardware configuration was completed. If the requested channel configuration is already
10214    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
10215    /// before the reply is sent. If called again with the same configuration, the reply must
10216    /// include the same `set_time` value as was previously returned.
10217    ///
10218    /// For input channels, it is not required that the driver zero-out inactive channels.
10219    ///
10220    /// If `SetActiveChannels` is called for a second time before the first call has completed,
10221    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10222    pub fn r#set_active_channels(
10223        &self,
10224        mut active_channels_bitmask: u64,
10225    ) -> fidl::client::QueryResponseFut<
10226        RingBufferSetActiveChannelsResult,
10227        fidl::encoding::DefaultFuchsiaResourceDialect,
10228    > {
10229        RingBufferProxyInterface::r#set_active_channels(self, active_channels_bitmask)
10230    }
10231
10232    /// Get information about delays via a hanging get.
10233    ///
10234    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
10235    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
10236    /// changes from what was most recently reported.
10237    ///
10238    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
10239    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10240    pub fn r#watch_delay_info(
10241        &self,
10242    ) -> fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
10243    {
10244        RingBufferProxyInterface::r#watch_delay_info(self)
10245    }
10246}
10247
10248impl RingBufferProxyInterface for RingBufferProxy {
10249    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
10250        RingBufferProperties,
10251        fidl::encoding::DefaultFuchsiaResourceDialect,
10252    >;
10253    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
10254        fn _decode(
10255            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10256        ) -> Result<RingBufferProperties, fidl::Error> {
10257            let _response = fidl::client::decode_transaction_body::<
10258                RingBufferGetPropertiesResponse,
10259                fidl::encoding::DefaultFuchsiaResourceDialect,
10260                0x12947f061a8fe1,
10261            >(_buf?)?;
10262            Ok(_response.properties)
10263        }
10264        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferProperties>(
10265            (),
10266            0x12947f061a8fe1,
10267            fidl::encoding::DynamicFlags::empty(),
10268            _decode,
10269        )
10270    }
10271
10272    type WatchClockRecoveryPositionInfoResponseFut = fidl::client::QueryResponseFut<
10273        RingBufferPositionInfo,
10274        fidl::encoding::DefaultFuchsiaResourceDialect,
10275    >;
10276    fn r#watch_clock_recovery_position_info(
10277        &self,
10278    ) -> Self::WatchClockRecoveryPositionInfoResponseFut {
10279        fn _decode(
10280            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10281        ) -> Result<RingBufferPositionInfo, fidl::Error> {
10282            let _response = fidl::client::decode_transaction_body::<
10283                RingBufferWatchClockRecoveryPositionInfoResponse,
10284                fidl::encoding::DefaultFuchsiaResourceDialect,
10285                0x694d5b898a4167e5,
10286            >(_buf?)?;
10287            Ok(_response.position_info)
10288        }
10289        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferPositionInfo>(
10290            (),
10291            0x694d5b898a4167e5,
10292            fidl::encoding::DynamicFlags::empty(),
10293            _decode,
10294        )
10295    }
10296
10297    type GetVmoResponseFut = fidl::client::QueryResponseFut<
10298        RingBufferGetVmoResult,
10299        fidl::encoding::DefaultFuchsiaResourceDialect,
10300    >;
10301    fn r#get_vmo(
10302        &self,
10303        mut min_frames: u32,
10304        mut clock_recovery_notifications_per_ring: u32,
10305    ) -> Self::GetVmoResponseFut {
10306        fn _decode(
10307            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10308        ) -> Result<RingBufferGetVmoResult, fidl::Error> {
10309            let _response = fidl::client::decode_transaction_body::<
10310                fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
10311                fidl::encoding::DefaultFuchsiaResourceDialect,
10312                0x44c8f4f5680e853a,
10313            >(_buf?)?;
10314            Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
10315        }
10316        self.client.send_query_and_decode::<RingBufferGetVmoRequest, RingBufferGetVmoResult>(
10317            (min_frames, clock_recovery_notifications_per_ring),
10318            0x44c8f4f5680e853a,
10319            fidl::encoding::DynamicFlags::empty(),
10320            _decode,
10321        )
10322    }
10323
10324    type StartResponseFut =
10325        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
10326    fn r#start(&self) -> Self::StartResponseFut {
10327        fn _decode(
10328            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10329        ) -> Result<i64, fidl::Error> {
10330            let _response = fidl::client::decode_transaction_body::<
10331                RingBufferStartResponse,
10332                fidl::encoding::DefaultFuchsiaResourceDialect,
10333                0x5dd780a769a8892d,
10334            >(_buf?)?;
10335            Ok(_response.start_time)
10336        }
10337        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
10338            (),
10339            0x5dd780a769a8892d,
10340            fidl::encoding::DynamicFlags::empty(),
10341            _decode,
10342        )
10343    }
10344
10345    type StopResponseFut =
10346        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
10347    fn r#stop(&self) -> Self::StopResponseFut {
10348        fn _decode(
10349            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10350        ) -> Result<(), fidl::Error> {
10351            let _response = fidl::client::decode_transaction_body::<
10352                fidl::encoding::EmptyPayload,
10353                fidl::encoding::DefaultFuchsiaResourceDialect,
10354                0x49a73d9cf1d4e110,
10355            >(_buf?)?;
10356            Ok(_response)
10357        }
10358        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
10359            (),
10360            0x49a73d9cf1d4e110,
10361            fidl::encoding::DynamicFlags::empty(),
10362            _decode,
10363        )
10364    }
10365
10366    type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
10367        RingBufferSetActiveChannelsResult,
10368        fidl::encoding::DefaultFuchsiaResourceDialect,
10369    >;
10370    fn r#set_active_channels(
10371        &self,
10372        mut active_channels_bitmask: u64,
10373    ) -> Self::SetActiveChannelsResponseFut {
10374        fn _decode(
10375            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10376        ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
10377            let _response = fidl::client::decode_transaction_body::<
10378                fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
10379                fidl::encoding::DefaultFuchsiaResourceDialect,
10380                0x605464c1d384f309,
10381            >(_buf?)?;
10382            Ok(_response.map(|x| x.set_time))
10383        }
10384        self.client.send_query_and_decode::<
10385            RingBufferSetActiveChannelsRequest,
10386            RingBufferSetActiveChannelsResult,
10387        >(
10388            (active_channels_bitmask,),
10389            0x605464c1d384f309,
10390            fidl::encoding::DynamicFlags::empty(),
10391            _decode,
10392        )
10393    }
10394
10395    type WatchDelayInfoResponseFut =
10396        fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
10397    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
10398        fn _decode(
10399            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10400        ) -> Result<DelayInfo, fidl::Error> {
10401            let _response = fidl::client::decode_transaction_body::<
10402                fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
10403                fidl::encoding::DefaultFuchsiaResourceDialect,
10404                0x6c1248db213fcf9f,
10405            >(_buf?)?
10406            .into_result::<RingBufferMarker>("watch_delay_info")?;
10407            Ok(_response.delay_info)
10408        }
10409        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelayInfo>(
10410            (),
10411            0x6c1248db213fcf9f,
10412            fidl::encoding::DynamicFlags::FLEXIBLE,
10413            _decode,
10414        )
10415    }
10416}
10417
10418pub struct RingBufferEventStream {
10419    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10420}
10421
10422impl std::marker::Unpin for RingBufferEventStream {}
10423
10424impl futures::stream::FusedStream for RingBufferEventStream {
10425    fn is_terminated(&self) -> bool {
10426        self.event_receiver.is_terminated()
10427    }
10428}
10429
10430impl futures::Stream for RingBufferEventStream {
10431    type Item = Result<RingBufferEvent, fidl::Error>;
10432
10433    fn poll_next(
10434        mut self: std::pin::Pin<&mut Self>,
10435        cx: &mut std::task::Context<'_>,
10436    ) -> std::task::Poll<Option<Self::Item>> {
10437        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10438            &mut self.event_receiver,
10439            cx
10440        )?) {
10441            Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
10442            None => std::task::Poll::Ready(None),
10443        }
10444    }
10445}
10446
10447#[derive(Debug)]
10448pub enum RingBufferEvent {
10449    #[non_exhaustive]
10450    _UnknownEvent {
10451        /// Ordinal of the event that was sent.
10452        ordinal: u64,
10453    },
10454}
10455
10456impl RingBufferEvent {
10457    /// Decodes a message buffer as a [`RingBufferEvent`].
10458    fn decode(
10459        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10460    ) -> Result<RingBufferEvent, fidl::Error> {
10461        let (bytes, _handles) = buf.split_mut();
10462        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10463        debug_assert_eq!(tx_header.tx_id, 0);
10464        match tx_header.ordinal {
10465            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
10466                Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
10467            }
10468            _ => Err(fidl::Error::UnknownOrdinal {
10469                ordinal: tx_header.ordinal,
10470                protocol_name: <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10471            }),
10472        }
10473    }
10474}
10475
10476/// A Stream of incoming requests for fuchsia.hardware.audio/RingBuffer.
10477pub struct RingBufferRequestStream {
10478    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10479    is_terminated: bool,
10480}
10481
10482impl std::marker::Unpin for RingBufferRequestStream {}
10483
10484impl futures::stream::FusedStream for RingBufferRequestStream {
10485    fn is_terminated(&self) -> bool {
10486        self.is_terminated
10487    }
10488}
10489
10490impl fidl::endpoints::RequestStream for RingBufferRequestStream {
10491    type Protocol = RingBufferMarker;
10492    type ControlHandle = RingBufferControlHandle;
10493
10494    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10495        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10496    }
10497
10498    fn control_handle(&self) -> Self::ControlHandle {
10499        RingBufferControlHandle { inner: self.inner.clone() }
10500    }
10501
10502    fn into_inner(
10503        self,
10504    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10505    {
10506        (self.inner, self.is_terminated)
10507    }
10508
10509    fn from_inner(
10510        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10511        is_terminated: bool,
10512    ) -> Self {
10513        Self { inner, is_terminated }
10514    }
10515}
10516
10517impl futures::Stream for RingBufferRequestStream {
10518    type Item = Result<RingBufferRequest, fidl::Error>;
10519
10520    fn poll_next(
10521        mut self: std::pin::Pin<&mut Self>,
10522        cx: &mut std::task::Context<'_>,
10523    ) -> std::task::Poll<Option<Self::Item>> {
10524        let this = &mut *self;
10525        if this.inner.check_shutdown(cx) {
10526            this.is_terminated = true;
10527            return std::task::Poll::Ready(None);
10528        }
10529        if this.is_terminated {
10530            panic!("polled RingBufferRequestStream after completion");
10531        }
10532        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10533            |bytes, handles| {
10534                match this.inner.channel().read_etc(cx, bytes, handles) {
10535                    std::task::Poll::Ready(Ok(())) => {}
10536                    std::task::Poll::Pending => return std::task::Poll::Pending,
10537                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10538                        this.is_terminated = true;
10539                        return std::task::Poll::Ready(None);
10540                    }
10541                    std::task::Poll::Ready(Err(e)) => {
10542                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10543                            e.into(),
10544                        ))));
10545                    }
10546                }
10547
10548                // A message has been received from the channel
10549                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10550
10551                std::task::Poll::Ready(Some(match header.ordinal {
10552                    0x12947f061a8fe1 => {
10553                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10554                        let mut req = fidl::new_empty!(
10555                            fidl::encoding::EmptyPayload,
10556                            fidl::encoding::DefaultFuchsiaResourceDialect
10557                        );
10558                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10559                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10560                        Ok(RingBufferRequest::GetProperties {
10561                            responder: RingBufferGetPropertiesResponder {
10562                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10563                                tx_id: header.tx_id,
10564                            },
10565                        })
10566                    }
10567                    0x694d5b898a4167e5 => {
10568                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10569                        let mut req = fidl::new_empty!(
10570                            fidl::encoding::EmptyPayload,
10571                            fidl::encoding::DefaultFuchsiaResourceDialect
10572                        );
10573                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10574                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10575                        Ok(RingBufferRequest::WatchClockRecoveryPositionInfo {
10576                            responder: RingBufferWatchClockRecoveryPositionInfoResponder {
10577                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10578                                tx_id: header.tx_id,
10579                            },
10580                        })
10581                    }
10582                    0x44c8f4f5680e853a => {
10583                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10584                        let mut req = fidl::new_empty!(
10585                            RingBufferGetVmoRequest,
10586                            fidl::encoding::DefaultFuchsiaResourceDialect
10587                        );
10588                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
10589                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10590                        Ok(RingBufferRequest::GetVmo {
10591                            min_frames: req.min_frames,
10592                            clock_recovery_notifications_per_ring: req
10593                                .clock_recovery_notifications_per_ring,
10594
10595                            responder: RingBufferGetVmoResponder {
10596                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10597                                tx_id: header.tx_id,
10598                            },
10599                        })
10600                    }
10601                    0x5dd780a769a8892d => {
10602                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10603                        let mut req = fidl::new_empty!(
10604                            fidl::encoding::EmptyPayload,
10605                            fidl::encoding::DefaultFuchsiaResourceDialect
10606                        );
10607                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10608                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10609                        Ok(RingBufferRequest::Start {
10610                            responder: RingBufferStartResponder {
10611                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10612                                tx_id: header.tx_id,
10613                            },
10614                        })
10615                    }
10616                    0x49a73d9cf1d4e110 => {
10617                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10618                        let mut req = fidl::new_empty!(
10619                            fidl::encoding::EmptyPayload,
10620                            fidl::encoding::DefaultFuchsiaResourceDialect
10621                        );
10622                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10623                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10624                        Ok(RingBufferRequest::Stop {
10625                            responder: RingBufferStopResponder {
10626                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10627                                tx_id: header.tx_id,
10628                            },
10629                        })
10630                    }
10631                    0x605464c1d384f309 => {
10632                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10633                        let mut req = fidl::new_empty!(
10634                            RingBufferSetActiveChannelsRequest,
10635                            fidl::encoding::DefaultFuchsiaResourceDialect
10636                        );
10637                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
10638                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10639                        Ok(RingBufferRequest::SetActiveChannels {
10640                            active_channels_bitmask: req.active_channels_bitmask,
10641
10642                            responder: RingBufferSetActiveChannelsResponder {
10643                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10644                                tx_id: header.tx_id,
10645                            },
10646                        })
10647                    }
10648                    0x6c1248db213fcf9f => {
10649                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10650                        let mut req = fidl::new_empty!(
10651                            fidl::encoding::EmptyPayload,
10652                            fidl::encoding::DefaultFuchsiaResourceDialect
10653                        );
10654                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10655                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10656                        Ok(RingBufferRequest::WatchDelayInfo {
10657                            responder: RingBufferWatchDelayInfoResponder {
10658                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10659                                tx_id: header.tx_id,
10660                            },
10661                        })
10662                    }
10663                    _ if header.tx_id == 0
10664                        && header
10665                            .dynamic_flags()
10666                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
10667                    {
10668                        Ok(RingBufferRequest::_UnknownMethod {
10669                            ordinal: header.ordinal,
10670                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
10671                            method_type: fidl::MethodType::OneWay,
10672                        })
10673                    }
10674                    _ if header
10675                        .dynamic_flags()
10676                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
10677                    {
10678                        this.inner.send_framework_err(
10679                            fidl::encoding::FrameworkErr::UnknownMethod,
10680                            header.tx_id,
10681                            header.ordinal,
10682                            header.dynamic_flags(),
10683                            (bytes, handles),
10684                        )?;
10685                        Ok(RingBufferRequest::_UnknownMethod {
10686                            ordinal: header.ordinal,
10687                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
10688                            method_type: fidl::MethodType::TwoWay,
10689                        })
10690                    }
10691                    _ => Err(fidl::Error::UnknownOrdinal {
10692                        ordinal: header.ordinal,
10693                        protocol_name:
10694                            <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10695                    }),
10696                }))
10697            },
10698        )
10699    }
10700}
10701
10702/// Ring buffers are used to convey audio between parties (usually in different processes), allowing
10703/// concurrent, asynchronous data access without requiring locks. This pattern works because both
10704/// parties share an understanding of which buffer areas are safe to access, and how those areas
10705/// change over time.
10706///
10707/// For in-depth description of the responsibilities for both _producers_ and _consumers_,
10708/// before the ring buffer is started as well as while it is active, please see
10709/// [Ring Buffer Behavior](https://fuchsia.dev/fuchsia-src/development/audio/ring_buffer.md).
10710#[derive(Debug)]
10711pub enum RingBufferRequest {
10712    /// Accessor for top level static properties.
10713    GetProperties { responder: RingBufferGetPropertiesResponder },
10714    /// Gets the ring buffer current position via a hanging get.
10715    ///
10716    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
10717    /// `clock_recovery_notifications_per_ring` was specified.
10718    ///
10719    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
10720    /// not respond to subsequent client calls until the position information has changed from what
10721    /// was most recently provided to that client.
10722    ///
10723    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
10724    /// to the `Start` command.
10725    ///
10726    /// At the `start_time` returned by `Start`, position is always 0. From there, it
10727    /// progresses at the rate specified by the rate, sample format (and clock domain,
10728    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
10729    ///
10730    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
10731    /// estimated position to be used for clock recovery at most at
10732    /// `clock_recovery_notifications_per_ring` frequency.
10733    ///
10734    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
10735    /// increasing.
10736    ///
10737    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
10738    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
10739    WatchClockRecoveryPositionInfo { responder: RingBufferWatchClockRecoveryPositionInfoResponder },
10740    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
10741    ///
10742    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
10743    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
10744    ///
10745    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
10746    /// that ring buffer contents can be transfered in and out, or else the call must be failed
10747    /// with GetVmoError.INVALID_ARGS.
10748    ///
10749    /// The driver may increase the ring buffer size beyond `min_frames` plus
10750    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
10751    /// alignment.
10752    ///
10753    /// Clients can treat the entire returned ring buffer as safe to access, except for the
10754    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
10755    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
10756    ///
10757    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
10758    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
10759    /// handle must also include ZX_RIGHT_WRITE.
10760    ///
10761    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
10762    /// `WatchClockRecoveryPositionInfo` client requests at most at
10763    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
10764    /// for clock recovery.
10765    GetVmo {
10766        min_frames: u32,
10767        clock_recovery_notifications_per_ring: u32,
10768        responder: RingBufferGetVmoResponder,
10769    },
10770    /// Start the ring buffer.
10771    ///
10772    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
10773    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
10774    /// write from or to the ring buffer position 0, subject to the overall position and buffering
10775    /// behavior described in 'Ring buffer behavior' below.
10776    ///
10777    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10778    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
10779    /// a second time before the first call has completed, then the channel must be closed with an
10780    /// error `ZX_ERR_BAD_STATE` returned.
10781    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
10782    Start { responder: RingBufferStartResponder },
10783    /// Stop the ring buffer.
10784    ///
10785    /// Once this call's response is received, no further position notifications will be sent until
10786    /// `Start` is called again.
10787    ///
10788    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10789    Stop { responder: RingBufferStopResponder },
10790    /// Sets which channels are active via a bitmask.
10791    ///
10792    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
10793    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
10794    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
10795    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
10796    /// turns on the hardware associated for all channels.
10797    ///
10798    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
10799    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
10800    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
10801    ///
10802    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
10803    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
10804    /// buffer's position advances (and position notifications sent as needed) regardless of the
10805    /// number of active channels, including if no channels are active. This means that the format
10806    /// in the ring buffer is not changed.
10807    ///
10808    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
10809    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
10810    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
10811    ///
10812    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
10813    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
10814    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
10815    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
10816    /// hardware configuration was completed. If the requested channel configuration is already
10817    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
10818    /// before the reply is sent. If called again with the same configuration, the reply must
10819    /// include the same `set_time` value as was previously returned.
10820    ///
10821    /// For input channels, it is not required that the driver zero-out inactive channels.
10822    ///
10823    /// If `SetActiveChannels` is called for a second time before the first call has completed,
10824    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10825    SetActiveChannels {
10826        active_channels_bitmask: u64,
10827        responder: RingBufferSetActiveChannelsResponder,
10828    },
10829    /// Get information about delays via a hanging get.
10830    ///
10831    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
10832    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
10833    /// changes from what was most recently reported.
10834    ///
10835    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
10836    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10837    WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
10838    /// An interaction was received which does not match any known method.
10839    #[non_exhaustive]
10840    _UnknownMethod {
10841        /// Ordinal of the method that was called.
10842        ordinal: u64,
10843        control_handle: RingBufferControlHandle,
10844        method_type: fidl::MethodType,
10845    },
10846}
10847
10848impl RingBufferRequest {
10849    #[allow(irrefutable_let_patterns)]
10850    pub fn into_get_properties(self) -> Option<(RingBufferGetPropertiesResponder)> {
10851        if let RingBufferRequest::GetProperties { responder } = self {
10852            Some((responder))
10853        } else {
10854            None
10855        }
10856    }
10857
10858    #[allow(irrefutable_let_patterns)]
10859    pub fn into_watch_clock_recovery_position_info(
10860        self,
10861    ) -> Option<(RingBufferWatchClockRecoveryPositionInfoResponder)> {
10862        if let RingBufferRequest::WatchClockRecoveryPositionInfo { responder } = self {
10863            Some((responder))
10864        } else {
10865            None
10866        }
10867    }
10868
10869    #[allow(irrefutable_let_patterns)]
10870    pub fn into_get_vmo(self) -> Option<(u32, u32, RingBufferGetVmoResponder)> {
10871        if let RingBufferRequest::GetVmo {
10872            min_frames,
10873            clock_recovery_notifications_per_ring,
10874            responder,
10875        } = self
10876        {
10877            Some((min_frames, clock_recovery_notifications_per_ring, responder))
10878        } else {
10879            None
10880        }
10881    }
10882
10883    #[allow(irrefutable_let_patterns)]
10884    pub fn into_start(self) -> Option<(RingBufferStartResponder)> {
10885        if let RingBufferRequest::Start { responder } = self { Some((responder)) } else { None }
10886    }
10887
10888    #[allow(irrefutable_let_patterns)]
10889    pub fn into_stop(self) -> Option<(RingBufferStopResponder)> {
10890        if let RingBufferRequest::Stop { responder } = self { Some((responder)) } else { None }
10891    }
10892
10893    #[allow(irrefutable_let_patterns)]
10894    pub fn into_set_active_channels(self) -> Option<(u64, RingBufferSetActiveChannelsResponder)> {
10895        if let RingBufferRequest::SetActiveChannels { active_channels_bitmask, responder } = self {
10896            Some((active_channels_bitmask, responder))
10897        } else {
10898            None
10899        }
10900    }
10901
10902    #[allow(irrefutable_let_patterns)]
10903    pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
10904        if let RingBufferRequest::WatchDelayInfo { responder } = self {
10905            Some((responder))
10906        } else {
10907            None
10908        }
10909    }
10910
10911    /// Name of the method defined in FIDL
10912    pub fn method_name(&self) -> &'static str {
10913        match *self {
10914            RingBufferRequest::GetProperties { .. } => "get_properties",
10915            RingBufferRequest::WatchClockRecoveryPositionInfo { .. } => {
10916                "watch_clock_recovery_position_info"
10917            }
10918            RingBufferRequest::GetVmo { .. } => "get_vmo",
10919            RingBufferRequest::Start { .. } => "start",
10920            RingBufferRequest::Stop { .. } => "stop",
10921            RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
10922            RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
10923            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
10924                "unknown one-way method"
10925            }
10926            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
10927                "unknown two-way method"
10928            }
10929        }
10930    }
10931}
10932
10933#[derive(Debug, Clone)]
10934pub struct RingBufferControlHandle {
10935    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10936}
10937
10938impl fidl::endpoints::ControlHandle for RingBufferControlHandle {
10939    fn shutdown(&self) {
10940        self.inner.shutdown()
10941    }
10942
10943    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10944        self.inner.shutdown_with_epitaph(status)
10945    }
10946
10947    fn is_closed(&self) -> bool {
10948        self.inner.channel().is_closed()
10949    }
10950    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10951        self.inner.channel().on_closed()
10952    }
10953
10954    #[cfg(target_os = "fuchsia")]
10955    fn signal_peer(
10956        &self,
10957        clear_mask: zx::Signals,
10958        set_mask: zx::Signals,
10959    ) -> Result<(), zx_status::Status> {
10960        use fidl::Peered;
10961        self.inner.channel().signal_peer(clear_mask, set_mask)
10962    }
10963}
10964
10965impl RingBufferControlHandle {}
10966
10967#[must_use = "FIDL methods require a response to be sent"]
10968#[derive(Debug)]
10969pub struct RingBufferGetPropertiesResponder {
10970    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
10971    tx_id: u32,
10972}
10973
10974/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
10975/// if the responder is dropped without sending a response, so that the client
10976/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10977impl std::ops::Drop for RingBufferGetPropertiesResponder {
10978    fn drop(&mut self) {
10979        self.control_handle.shutdown();
10980        // Safety: drops once, never accessed again
10981        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10982    }
10983}
10984
10985impl fidl::endpoints::Responder for RingBufferGetPropertiesResponder {
10986    type ControlHandle = RingBufferControlHandle;
10987
10988    fn control_handle(&self) -> &RingBufferControlHandle {
10989        &self.control_handle
10990    }
10991
10992    fn drop_without_shutdown(mut self) {
10993        // Safety: drops once, never accessed again due to mem::forget
10994        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10995        // Prevent Drop from running (which would shut down the channel)
10996        std::mem::forget(self);
10997    }
10998}
10999
11000impl RingBufferGetPropertiesResponder {
11001    /// Sends a response to the FIDL transaction.
11002    ///
11003    /// Sets the channel to shutdown if an error occurs.
11004    pub fn send(self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
11005        let _result = self.send_raw(properties);
11006        if _result.is_err() {
11007            self.control_handle.shutdown();
11008        }
11009        self.drop_without_shutdown();
11010        _result
11011    }
11012
11013    /// Similar to "send" but does not shutdown the channel if an error occurs.
11014    pub fn send_no_shutdown_on_err(
11015        self,
11016        mut properties: &RingBufferProperties,
11017    ) -> Result<(), fidl::Error> {
11018        let _result = self.send_raw(properties);
11019        self.drop_without_shutdown();
11020        _result
11021    }
11022
11023    fn send_raw(&self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
11024        self.control_handle.inner.send::<RingBufferGetPropertiesResponse>(
11025            (properties,),
11026            self.tx_id,
11027            0x12947f061a8fe1,
11028            fidl::encoding::DynamicFlags::empty(),
11029        )
11030    }
11031}
11032
11033#[must_use = "FIDL methods require a response to be sent"]
11034#[derive(Debug)]
11035pub struct RingBufferWatchClockRecoveryPositionInfoResponder {
11036    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11037    tx_id: u32,
11038}
11039
11040/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11041/// if the responder is dropped without sending a response, so that the client
11042/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11043impl std::ops::Drop for RingBufferWatchClockRecoveryPositionInfoResponder {
11044    fn drop(&mut self) {
11045        self.control_handle.shutdown();
11046        // Safety: drops once, never accessed again
11047        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11048    }
11049}
11050
11051impl fidl::endpoints::Responder for RingBufferWatchClockRecoveryPositionInfoResponder {
11052    type ControlHandle = RingBufferControlHandle;
11053
11054    fn control_handle(&self) -> &RingBufferControlHandle {
11055        &self.control_handle
11056    }
11057
11058    fn drop_without_shutdown(mut self) {
11059        // Safety: drops once, never accessed again due to mem::forget
11060        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11061        // Prevent Drop from running (which would shut down the channel)
11062        std::mem::forget(self);
11063    }
11064}
11065
11066impl RingBufferWatchClockRecoveryPositionInfoResponder {
11067    /// Sends a response to the FIDL transaction.
11068    ///
11069    /// Sets the channel to shutdown if an error occurs.
11070    pub fn send(self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
11071        let _result = self.send_raw(position_info);
11072        if _result.is_err() {
11073            self.control_handle.shutdown();
11074        }
11075        self.drop_without_shutdown();
11076        _result
11077    }
11078
11079    /// Similar to "send" but does not shutdown the channel if an error occurs.
11080    pub fn send_no_shutdown_on_err(
11081        self,
11082        mut position_info: &RingBufferPositionInfo,
11083    ) -> Result<(), fidl::Error> {
11084        let _result = self.send_raw(position_info);
11085        self.drop_without_shutdown();
11086        _result
11087    }
11088
11089    fn send_raw(&self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
11090        self.control_handle.inner.send::<RingBufferWatchClockRecoveryPositionInfoResponse>(
11091            (position_info,),
11092            self.tx_id,
11093            0x694d5b898a4167e5,
11094            fidl::encoding::DynamicFlags::empty(),
11095        )
11096    }
11097}
11098
11099#[must_use = "FIDL methods require a response to be sent"]
11100#[derive(Debug)]
11101pub struct RingBufferGetVmoResponder {
11102    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11103    tx_id: u32,
11104}
11105
11106/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11107/// if the responder is dropped without sending a response, so that the client
11108/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11109impl std::ops::Drop for RingBufferGetVmoResponder {
11110    fn drop(&mut self) {
11111        self.control_handle.shutdown();
11112        // Safety: drops once, never accessed again
11113        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11114    }
11115}
11116
11117impl fidl::endpoints::Responder for RingBufferGetVmoResponder {
11118    type ControlHandle = RingBufferControlHandle;
11119
11120    fn control_handle(&self) -> &RingBufferControlHandle {
11121        &self.control_handle
11122    }
11123
11124    fn drop_without_shutdown(mut self) {
11125        // Safety: drops once, never accessed again due to mem::forget
11126        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11127        // Prevent Drop from running (which would shut down the channel)
11128        std::mem::forget(self);
11129    }
11130}
11131
11132impl RingBufferGetVmoResponder {
11133    /// Sends a response to the FIDL transaction.
11134    ///
11135    /// Sets the channel to shutdown if an error occurs.
11136    pub fn send(
11137        self,
11138        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11139    ) -> Result<(), fidl::Error> {
11140        let _result = self.send_raw(result);
11141        if _result.is_err() {
11142            self.control_handle.shutdown();
11143        }
11144        self.drop_without_shutdown();
11145        _result
11146    }
11147
11148    /// Similar to "send" but does not shutdown the channel if an error occurs.
11149    pub fn send_no_shutdown_on_err(
11150        self,
11151        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11152    ) -> Result<(), fidl::Error> {
11153        let _result = self.send_raw(result);
11154        self.drop_without_shutdown();
11155        _result
11156    }
11157
11158    fn send_raw(
11159        &self,
11160        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11161    ) -> Result<(), fidl::Error> {
11162        self.control_handle
11163            .inner
11164            .send::<fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>>(
11165                result,
11166                self.tx_id,
11167                0x44c8f4f5680e853a,
11168                fidl::encoding::DynamicFlags::empty(),
11169            )
11170    }
11171}
11172
11173#[must_use = "FIDL methods require a response to be sent"]
11174#[derive(Debug)]
11175pub struct RingBufferStartResponder {
11176    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11177    tx_id: u32,
11178}
11179
11180/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11181/// if the responder is dropped without sending a response, so that the client
11182/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11183impl std::ops::Drop for RingBufferStartResponder {
11184    fn drop(&mut self) {
11185        self.control_handle.shutdown();
11186        // Safety: drops once, never accessed again
11187        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11188    }
11189}
11190
11191impl fidl::endpoints::Responder for RingBufferStartResponder {
11192    type ControlHandle = RingBufferControlHandle;
11193
11194    fn control_handle(&self) -> &RingBufferControlHandle {
11195        &self.control_handle
11196    }
11197
11198    fn drop_without_shutdown(mut self) {
11199        // Safety: drops once, never accessed again due to mem::forget
11200        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11201        // Prevent Drop from running (which would shut down the channel)
11202        std::mem::forget(self);
11203    }
11204}
11205
11206impl RingBufferStartResponder {
11207    /// Sends a response to the FIDL transaction.
11208    ///
11209    /// Sets the channel to shutdown if an error occurs.
11210    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
11211        let _result = self.send_raw(start_time);
11212        if _result.is_err() {
11213            self.control_handle.shutdown();
11214        }
11215        self.drop_without_shutdown();
11216        _result
11217    }
11218
11219    /// Similar to "send" but does not shutdown the channel if an error occurs.
11220    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
11221        let _result = self.send_raw(start_time);
11222        self.drop_without_shutdown();
11223        _result
11224    }
11225
11226    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
11227        self.control_handle.inner.send::<RingBufferStartResponse>(
11228            (start_time,),
11229            self.tx_id,
11230            0x5dd780a769a8892d,
11231            fidl::encoding::DynamicFlags::empty(),
11232        )
11233    }
11234}
11235
11236#[must_use = "FIDL methods require a response to be sent"]
11237#[derive(Debug)]
11238pub struct RingBufferStopResponder {
11239    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11240    tx_id: u32,
11241}
11242
11243/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11244/// if the responder is dropped without sending a response, so that the client
11245/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11246impl std::ops::Drop for RingBufferStopResponder {
11247    fn drop(&mut self) {
11248        self.control_handle.shutdown();
11249        // Safety: drops once, never accessed again
11250        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11251    }
11252}
11253
11254impl fidl::endpoints::Responder for RingBufferStopResponder {
11255    type ControlHandle = RingBufferControlHandle;
11256
11257    fn control_handle(&self) -> &RingBufferControlHandle {
11258        &self.control_handle
11259    }
11260
11261    fn drop_without_shutdown(mut self) {
11262        // Safety: drops once, never accessed again due to mem::forget
11263        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11264        // Prevent Drop from running (which would shut down the channel)
11265        std::mem::forget(self);
11266    }
11267}
11268
11269impl RingBufferStopResponder {
11270    /// Sends a response to the FIDL transaction.
11271    ///
11272    /// Sets the channel to shutdown if an error occurs.
11273    pub fn send(self) -> Result<(), fidl::Error> {
11274        let _result = self.send_raw();
11275        if _result.is_err() {
11276            self.control_handle.shutdown();
11277        }
11278        self.drop_without_shutdown();
11279        _result
11280    }
11281
11282    /// Similar to "send" but does not shutdown the channel if an error occurs.
11283    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11284        let _result = self.send_raw();
11285        self.drop_without_shutdown();
11286        _result
11287    }
11288
11289    fn send_raw(&self) -> Result<(), fidl::Error> {
11290        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11291            (),
11292            self.tx_id,
11293            0x49a73d9cf1d4e110,
11294            fidl::encoding::DynamicFlags::empty(),
11295        )
11296    }
11297}
11298
11299#[must_use = "FIDL methods require a response to be sent"]
11300#[derive(Debug)]
11301pub struct RingBufferSetActiveChannelsResponder {
11302    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11303    tx_id: u32,
11304}
11305
11306/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11307/// if the responder is dropped without sending a response, so that the client
11308/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11309impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
11310    fn drop(&mut self) {
11311        self.control_handle.shutdown();
11312        // Safety: drops once, never accessed again
11313        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11314    }
11315}
11316
11317impl fidl::endpoints::Responder for RingBufferSetActiveChannelsResponder {
11318    type ControlHandle = RingBufferControlHandle;
11319
11320    fn control_handle(&self) -> &RingBufferControlHandle {
11321        &self.control_handle
11322    }
11323
11324    fn drop_without_shutdown(mut self) {
11325        // Safety: drops once, never accessed again due to mem::forget
11326        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11327        // Prevent Drop from running (which would shut down the channel)
11328        std::mem::forget(self);
11329    }
11330}
11331
11332impl RingBufferSetActiveChannelsResponder {
11333    /// Sends a response to the FIDL transaction.
11334    ///
11335    /// Sets the channel to shutdown if an error occurs.
11336    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11337        let _result = self.send_raw(result);
11338        if _result.is_err() {
11339            self.control_handle.shutdown();
11340        }
11341        self.drop_without_shutdown();
11342        _result
11343    }
11344
11345    /// Similar to "send" but does not shutdown the channel if an error occurs.
11346    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11347        let _result = self.send_raw(result);
11348        self.drop_without_shutdown();
11349        _result
11350    }
11351
11352    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11353        self.control_handle.inner.send::<fidl::encoding::ResultType<
11354            RingBufferSetActiveChannelsResponse,
11355            i32,
11356        >>(
11357            result.map(|set_time| (set_time,)),
11358            self.tx_id,
11359            0x605464c1d384f309,
11360            fidl::encoding::DynamicFlags::empty(),
11361        )
11362    }
11363}
11364
11365#[must_use = "FIDL methods require a response to be sent"]
11366#[derive(Debug)]
11367pub struct RingBufferWatchDelayInfoResponder {
11368    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11369    tx_id: u32,
11370}
11371
11372/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11373/// if the responder is dropped without sending a response, so that the client
11374/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11375impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
11376    fn drop(&mut self) {
11377        self.control_handle.shutdown();
11378        // Safety: drops once, never accessed again
11379        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11380    }
11381}
11382
11383impl fidl::endpoints::Responder for RingBufferWatchDelayInfoResponder {
11384    type ControlHandle = RingBufferControlHandle;
11385
11386    fn control_handle(&self) -> &RingBufferControlHandle {
11387        &self.control_handle
11388    }
11389
11390    fn drop_without_shutdown(mut self) {
11391        // Safety: drops once, never accessed again due to mem::forget
11392        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11393        // Prevent Drop from running (which would shut down the channel)
11394        std::mem::forget(self);
11395    }
11396}
11397
11398impl RingBufferWatchDelayInfoResponder {
11399    /// Sends a response to the FIDL transaction.
11400    ///
11401    /// Sets the channel to shutdown if an error occurs.
11402    pub fn send(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11403        let _result = self.send_raw(delay_info);
11404        if _result.is_err() {
11405            self.control_handle.shutdown();
11406        }
11407        self.drop_without_shutdown();
11408        _result
11409    }
11410
11411    /// Similar to "send" but does not shutdown the channel if an error occurs.
11412    pub fn send_no_shutdown_on_err(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11413        let _result = self.send_raw(delay_info);
11414        self.drop_without_shutdown();
11415        _result
11416    }
11417
11418    fn send_raw(&self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11419        self.control_handle
11420            .inner
11421            .send::<fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>>(
11422                fidl::encoding::Flexible::new((delay_info,)),
11423                self.tx_id,
11424                0x6c1248db213fcf9f,
11425                fidl::encoding::DynamicFlags::FLEXIBLE,
11426            )
11427    }
11428}
11429
11430#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11431pub struct StreamConfigMarker;
11432
11433impl fidl::endpoints::ProtocolMarker for StreamConfigMarker {
11434    type Proxy = StreamConfigProxy;
11435    type RequestStream = StreamConfigRequestStream;
11436    #[cfg(target_os = "fuchsia")]
11437    type SynchronousProxy = StreamConfigSynchronousProxy;
11438
11439    const DEBUG_NAME: &'static str = "(anonymous) StreamConfig";
11440}
11441
11442pub trait StreamConfigProxyInterface: Send + Sync {
11443    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
11444        + Send;
11445    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
11446    fn r#signal_processing_connect(
11447        &self,
11448        protocol: fidl::endpoints::ServerEnd<
11449            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11450        >,
11451    ) -> Result<(), fidl::Error>;
11452    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
11453        + Send;
11454    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
11455    type GetSupportedFormatsResponseFut: std::future::Future<Output = Result<Vec<SupportedFormats>, fidl::Error>>
11456        + Send;
11457    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut;
11458    fn r#create_ring_buffer(
11459        &self,
11460        format: &Format,
11461        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11462    ) -> Result<(), fidl::Error>;
11463    type WatchGainStateResponseFut: std::future::Future<Output = Result<GainState, fidl::Error>>
11464        + Send;
11465    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut;
11466    fn r#set_gain(&self, target_state: &GainState) -> Result<(), fidl::Error>;
11467    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
11468        + Send;
11469    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
11470}
11471#[derive(Debug)]
11472#[cfg(target_os = "fuchsia")]
11473pub struct StreamConfigSynchronousProxy {
11474    client: fidl::client::sync::Client,
11475}
11476
11477#[cfg(target_os = "fuchsia")]
11478impl fidl::endpoints::SynchronousProxy for StreamConfigSynchronousProxy {
11479    type Proxy = StreamConfigProxy;
11480    type Protocol = StreamConfigMarker;
11481
11482    fn from_channel(inner: fidl::Channel) -> Self {
11483        Self::new(inner)
11484    }
11485
11486    fn into_channel(self) -> fidl::Channel {
11487        self.client.into_channel()
11488    }
11489
11490    fn as_channel(&self) -> &fidl::Channel {
11491        self.client.as_channel()
11492    }
11493}
11494
11495#[cfg(target_os = "fuchsia")]
11496impl StreamConfigSynchronousProxy {
11497    pub fn new(channel: fidl::Channel) -> Self {
11498        Self { client: fidl::client::sync::Client::new(channel) }
11499    }
11500
11501    pub fn into_channel(self) -> fidl::Channel {
11502        self.client.into_channel()
11503    }
11504
11505    /// Waits until an event arrives and returns it. It is safe for other
11506    /// threads to make concurrent requests while waiting for an event.
11507    pub fn wait_for_event(
11508        &self,
11509        deadline: zx::MonotonicInstant,
11510    ) -> Result<StreamConfigEvent, fidl::Error> {
11511        StreamConfigEvent::decode(self.client.wait_for_event::<StreamConfigMarker>(deadline)?)
11512    }
11513
11514    /// Retrieves top level health state.
11515    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
11516    pub fn r#get_health_state(
11517        &self,
11518        ___deadline: zx::MonotonicInstant,
11519    ) -> Result<HealthState, fidl::Error> {
11520        let _response = self.client.send_query::<
11521            fidl::encoding::EmptyPayload,
11522            HealthGetHealthStateResponse,
11523            StreamConfigMarker,
11524        >(
11525            (),
11526            0x4e146d6bca733a84,
11527            fidl::encoding::DynamicFlags::empty(),
11528            ___deadline,
11529        )?;
11530        Ok(_response.state)
11531    }
11532
11533    /// Connect to a `SignalProcessing` protocol.
11534    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
11535    /// the maximum number of connections have already been created, for instance one, then the
11536    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
11537    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
11538    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
11539    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
11540    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
11541    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
11542    /// is intended to be composed, and hence the more verbose name allows differentiation and
11543    /// improved clarity.
11544    pub fn r#signal_processing_connect(
11545        &self,
11546        mut protocol: fidl::endpoints::ServerEnd<
11547            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11548        >,
11549    ) -> Result<(), fidl::Error> {
11550        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
11551            (protocol,),
11552            0xa81907ce6066295,
11553            fidl::encoding::DynamicFlags::empty(),
11554        )
11555    }
11556
11557    /// Retrieves top level static properties.
11558    pub fn r#get_properties(
11559        &self,
11560        ___deadline: zx::MonotonicInstant,
11561    ) -> Result<StreamProperties, fidl::Error> {
11562        let _response = self.client.send_query::<
11563            fidl::encoding::EmptyPayload,
11564            StreamConfigGetPropertiesResponse,
11565            StreamConfigMarker,
11566        >(
11567            (),
11568            0x7d89c02f3e2d3c01,
11569            fidl::encoding::DynamicFlags::empty(),
11570            ___deadline,
11571        )?;
11572        Ok(_response.properties)
11573    }
11574
11575    /// Gets formats supported by a given driver. When not all combinations supported by the
11576    /// driver can be described with one `SupportedFormats`, the driver returns more than one
11577    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
11578    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
11579    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
11580    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
11581    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
11582    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
11583    /// <<16bits,32bits>,<48KHz,96KHz>>.
11584    pub fn r#get_supported_formats(
11585        &self,
11586        ___deadline: zx::MonotonicInstant,
11587    ) -> Result<Vec<SupportedFormats>, fidl::Error> {
11588        let _response = self.client.send_query::<
11589            fidl::encoding::EmptyPayload,
11590            StreamConfigGetSupportedFormatsResponse,
11591            StreamConfigMarker,
11592        >(
11593            (),
11594            0x448efa7850cafe7e,
11595            fidl::encoding::DynamicFlags::empty(),
11596            ___deadline,
11597        )?;
11598        Ok(_response.supported_formats)
11599    }
11600
11601    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
11602    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
11603    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
11604    /// ring buffer channel had been established and was still active, the driver must close that
11605    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
11606    /// operations in the process.
11607    pub fn r#create_ring_buffer(
11608        &self,
11609        mut format: &Format,
11610        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11611    ) -> Result<(), fidl::Error> {
11612        self.client.send::<StreamConfigCreateRingBufferRequest>(
11613            (format, ring_buffer),
11614            0x2afb19dd13faa1ba,
11615            fidl::encoding::DynamicFlags::empty(),
11616        )
11617    }
11618
11619    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
11620    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
11621    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
11622    /// from what was most recently reported.
11623    /// If `WatchGainState` is called for a second time before the first call has completed, then
11624    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11625    pub fn r#watch_gain_state(
11626        &self,
11627        ___deadline: zx::MonotonicInstant,
11628    ) -> Result<GainState, fidl::Error> {
11629        let _response = self.client.send_query::<
11630            fidl::encoding::EmptyPayload,
11631            StreamConfigWatchGainStateResponse,
11632            StreamConfigMarker,
11633        >(
11634            (),
11635            0x4772506136ab65c1,
11636            fidl::encoding::DynamicFlags::empty(),
11637            ___deadline,
11638        )?;
11639        Ok(_response.gain_state)
11640    }
11641
11642    /// Client update of the gain state.
11643    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
11644        self.client.send::<StreamConfigSetGainRequest>(
11645            (target_state,),
11646            0x3943b41498c6a384,
11647            fidl::encoding::DynamicFlags::empty(),
11648        )
11649    }
11650
11651    /// Get the plug detect state via a hanging get. The driver will reply to the first
11652    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
11653    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
11654    /// If `WatchPlugState` is called for a second time before the first call has completed, then
11655    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11656    pub fn r#watch_plug_state(
11657        &self,
11658        ___deadline: zx::MonotonicInstant,
11659    ) -> Result<PlugState, fidl::Error> {
11660        let _response = self.client.send_query::<
11661            fidl::encoding::EmptyPayload,
11662            StreamConfigWatchPlugStateResponse,
11663            StreamConfigMarker,
11664        >(
11665            (),
11666            0x497345a6f048b2a6,
11667            fidl::encoding::DynamicFlags::empty(),
11668            ___deadline,
11669        )?;
11670        Ok(_response.plug_state)
11671    }
11672}
11673
11674#[cfg(target_os = "fuchsia")]
11675impl From<StreamConfigSynchronousProxy> for zx::NullableHandle {
11676    fn from(value: StreamConfigSynchronousProxy) -> Self {
11677        value.into_channel().into()
11678    }
11679}
11680
11681#[cfg(target_os = "fuchsia")]
11682impl From<fidl::Channel> for StreamConfigSynchronousProxy {
11683    fn from(value: fidl::Channel) -> Self {
11684        Self::new(value)
11685    }
11686}
11687
11688#[cfg(target_os = "fuchsia")]
11689impl fidl::endpoints::FromClient for StreamConfigSynchronousProxy {
11690    type Protocol = StreamConfigMarker;
11691
11692    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigMarker>) -> Self {
11693        Self::new(value.into_channel())
11694    }
11695}
11696
11697#[derive(Debug, Clone)]
11698pub struct StreamConfigProxy {
11699    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11700}
11701
11702impl fidl::endpoints::Proxy for StreamConfigProxy {
11703    type Protocol = StreamConfigMarker;
11704
11705    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11706        Self::new(inner)
11707    }
11708
11709    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11710        self.client.into_channel().map_err(|client| Self { client })
11711    }
11712
11713    fn as_channel(&self) -> &::fidl::AsyncChannel {
11714        self.client.as_channel()
11715    }
11716}
11717
11718impl StreamConfigProxy {
11719    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfig.
11720    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11721        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11722        Self { client: fidl::client::Client::new(channel, protocol_name) }
11723    }
11724
11725    /// Get a Stream of events from the remote end of the protocol.
11726    ///
11727    /// # Panics
11728    ///
11729    /// Panics if the event stream was already taken.
11730    pub fn take_event_stream(&self) -> StreamConfigEventStream {
11731        StreamConfigEventStream { event_receiver: self.client.take_event_receiver() }
11732    }
11733
11734    /// Retrieves top level health state.
11735    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
11736    pub fn r#get_health_state(
11737        &self,
11738    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
11739    {
11740        StreamConfigProxyInterface::r#get_health_state(self)
11741    }
11742
11743    /// Connect to a `SignalProcessing` protocol.
11744    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
11745    /// the maximum number of connections have already been created, for instance one, then the
11746    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
11747    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
11748    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
11749    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
11750    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
11751    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
11752    /// is intended to be composed, and hence the more verbose name allows differentiation and
11753    /// improved clarity.
11754    pub fn r#signal_processing_connect(
11755        &self,
11756        mut protocol: fidl::endpoints::ServerEnd<
11757            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11758        >,
11759    ) -> Result<(), fidl::Error> {
11760        StreamConfigProxyInterface::r#signal_processing_connect(self, protocol)
11761    }
11762
11763    /// Retrieves top level static properties.
11764    pub fn r#get_properties(
11765        &self,
11766    ) -> fidl::client::QueryResponseFut<
11767        StreamProperties,
11768        fidl::encoding::DefaultFuchsiaResourceDialect,
11769    > {
11770        StreamConfigProxyInterface::r#get_properties(self)
11771    }
11772
11773    /// Gets formats supported by a given driver. When not all combinations supported by the
11774    /// driver can be described with one `SupportedFormats`, the driver returns more than one
11775    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
11776    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
11777    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
11778    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
11779    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
11780    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
11781    /// <<16bits,32bits>,<48KHz,96KHz>>.
11782    pub fn r#get_supported_formats(
11783        &self,
11784    ) -> fidl::client::QueryResponseFut<
11785        Vec<SupportedFormats>,
11786        fidl::encoding::DefaultFuchsiaResourceDialect,
11787    > {
11788        StreamConfigProxyInterface::r#get_supported_formats(self)
11789    }
11790
11791    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
11792    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
11793    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
11794    /// ring buffer channel had been established and was still active, the driver must close that
11795    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
11796    /// operations in the process.
11797    pub fn r#create_ring_buffer(
11798        &self,
11799        mut format: &Format,
11800        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11801    ) -> Result<(), fidl::Error> {
11802        StreamConfigProxyInterface::r#create_ring_buffer(self, format, ring_buffer)
11803    }
11804
11805    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
11806    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
11807    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
11808    /// from what was most recently reported.
11809    /// If `WatchGainState` is called for a second time before the first call has completed, then
11810    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11811    pub fn r#watch_gain_state(
11812        &self,
11813    ) -> fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>
11814    {
11815        StreamConfigProxyInterface::r#watch_gain_state(self)
11816    }
11817
11818    /// Client update of the gain state.
11819    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
11820        StreamConfigProxyInterface::r#set_gain(self, target_state)
11821    }
11822
11823    /// Get the plug detect state via a hanging get. The driver will reply to the first
11824    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
11825    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
11826    /// If `WatchPlugState` is called for a second time before the first call has completed, then
11827    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11828    pub fn r#watch_plug_state(
11829        &self,
11830    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
11831    {
11832        StreamConfigProxyInterface::r#watch_plug_state(self)
11833    }
11834}
11835
11836impl StreamConfigProxyInterface for StreamConfigProxy {
11837    type GetHealthStateResponseFut =
11838        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
11839    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
11840        fn _decode(
11841            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11842        ) -> Result<HealthState, fidl::Error> {
11843            let _response = fidl::client::decode_transaction_body::<
11844                HealthGetHealthStateResponse,
11845                fidl::encoding::DefaultFuchsiaResourceDialect,
11846                0x4e146d6bca733a84,
11847            >(_buf?)?;
11848            Ok(_response.state)
11849        }
11850        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
11851            (),
11852            0x4e146d6bca733a84,
11853            fidl::encoding::DynamicFlags::empty(),
11854            _decode,
11855        )
11856    }
11857
11858    fn r#signal_processing_connect(
11859        &self,
11860        mut protocol: fidl::endpoints::ServerEnd<
11861            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11862        >,
11863    ) -> Result<(), fidl::Error> {
11864        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
11865            (protocol,),
11866            0xa81907ce6066295,
11867            fidl::encoding::DynamicFlags::empty(),
11868        )
11869    }
11870
11871    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
11872        StreamProperties,
11873        fidl::encoding::DefaultFuchsiaResourceDialect,
11874    >;
11875    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
11876        fn _decode(
11877            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11878        ) -> Result<StreamProperties, fidl::Error> {
11879            let _response = fidl::client::decode_transaction_body::<
11880                StreamConfigGetPropertiesResponse,
11881                fidl::encoding::DefaultFuchsiaResourceDialect,
11882                0x7d89c02f3e2d3c01,
11883            >(_buf?)?;
11884            Ok(_response.properties)
11885        }
11886        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
11887            (),
11888            0x7d89c02f3e2d3c01,
11889            fidl::encoding::DynamicFlags::empty(),
11890            _decode,
11891        )
11892    }
11893
11894    type GetSupportedFormatsResponseFut = fidl::client::QueryResponseFut<
11895        Vec<SupportedFormats>,
11896        fidl::encoding::DefaultFuchsiaResourceDialect,
11897    >;
11898    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut {
11899        fn _decode(
11900            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11901        ) -> Result<Vec<SupportedFormats>, fidl::Error> {
11902            let _response = fidl::client::decode_transaction_body::<
11903                StreamConfigGetSupportedFormatsResponse,
11904                fidl::encoding::DefaultFuchsiaResourceDialect,
11905                0x448efa7850cafe7e,
11906            >(_buf?)?;
11907            Ok(_response.supported_formats)
11908        }
11909        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<SupportedFormats>>(
11910            (),
11911            0x448efa7850cafe7e,
11912            fidl::encoding::DynamicFlags::empty(),
11913            _decode,
11914        )
11915    }
11916
11917    fn r#create_ring_buffer(
11918        &self,
11919        mut format: &Format,
11920        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11921    ) -> Result<(), fidl::Error> {
11922        self.client.send::<StreamConfigCreateRingBufferRequest>(
11923            (format, ring_buffer),
11924            0x2afb19dd13faa1ba,
11925            fidl::encoding::DynamicFlags::empty(),
11926        )
11927    }
11928
11929    type WatchGainStateResponseFut =
11930        fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>;
11931    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut {
11932        fn _decode(
11933            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11934        ) -> Result<GainState, fidl::Error> {
11935            let _response = fidl::client::decode_transaction_body::<
11936                StreamConfigWatchGainStateResponse,
11937                fidl::encoding::DefaultFuchsiaResourceDialect,
11938                0x4772506136ab65c1,
11939            >(_buf?)?;
11940            Ok(_response.gain_state)
11941        }
11942        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GainState>(
11943            (),
11944            0x4772506136ab65c1,
11945            fidl::encoding::DynamicFlags::empty(),
11946            _decode,
11947        )
11948    }
11949
11950    fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
11951        self.client.send::<StreamConfigSetGainRequest>(
11952            (target_state,),
11953            0x3943b41498c6a384,
11954            fidl::encoding::DynamicFlags::empty(),
11955        )
11956    }
11957
11958    type WatchPlugStateResponseFut =
11959        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
11960    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
11961        fn _decode(
11962            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11963        ) -> Result<PlugState, fidl::Error> {
11964            let _response = fidl::client::decode_transaction_body::<
11965                StreamConfigWatchPlugStateResponse,
11966                fidl::encoding::DefaultFuchsiaResourceDialect,
11967                0x497345a6f048b2a6,
11968            >(_buf?)?;
11969            Ok(_response.plug_state)
11970        }
11971        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
11972            (),
11973            0x497345a6f048b2a6,
11974            fidl::encoding::DynamicFlags::empty(),
11975            _decode,
11976        )
11977    }
11978}
11979
11980pub struct StreamConfigEventStream {
11981    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11982}
11983
11984impl std::marker::Unpin for StreamConfigEventStream {}
11985
11986impl futures::stream::FusedStream for StreamConfigEventStream {
11987    fn is_terminated(&self) -> bool {
11988        self.event_receiver.is_terminated()
11989    }
11990}
11991
11992impl futures::Stream for StreamConfigEventStream {
11993    type Item = Result<StreamConfigEvent, fidl::Error>;
11994
11995    fn poll_next(
11996        mut self: std::pin::Pin<&mut Self>,
11997        cx: &mut std::task::Context<'_>,
11998    ) -> std::task::Poll<Option<Self::Item>> {
11999        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12000            &mut self.event_receiver,
12001            cx
12002        )?) {
12003            Some(buf) => std::task::Poll::Ready(Some(StreamConfigEvent::decode(buf))),
12004            None => std::task::Poll::Ready(None),
12005        }
12006    }
12007}
12008
12009#[derive(Debug)]
12010pub enum StreamConfigEvent {}
12011
12012impl StreamConfigEvent {
12013    /// Decodes a message buffer as a [`StreamConfigEvent`].
12014    fn decode(
12015        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12016    ) -> Result<StreamConfigEvent, fidl::Error> {
12017        let (bytes, _handles) = buf.split_mut();
12018        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12019        debug_assert_eq!(tx_header.tx_id, 0);
12020        match tx_header.ordinal {
12021            _ => Err(fidl::Error::UnknownOrdinal {
12022                ordinal: tx_header.ordinal,
12023                protocol_name: <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12024            }),
12025        }
12026    }
12027}
12028
12029/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfig.
12030pub struct StreamConfigRequestStream {
12031    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12032    is_terminated: bool,
12033}
12034
12035impl std::marker::Unpin for StreamConfigRequestStream {}
12036
12037impl futures::stream::FusedStream for StreamConfigRequestStream {
12038    fn is_terminated(&self) -> bool {
12039        self.is_terminated
12040    }
12041}
12042
12043impl fidl::endpoints::RequestStream for StreamConfigRequestStream {
12044    type Protocol = StreamConfigMarker;
12045    type ControlHandle = StreamConfigControlHandle;
12046
12047    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12048        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12049    }
12050
12051    fn control_handle(&self) -> Self::ControlHandle {
12052        StreamConfigControlHandle { inner: self.inner.clone() }
12053    }
12054
12055    fn into_inner(
12056        self,
12057    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12058    {
12059        (self.inner, self.is_terminated)
12060    }
12061
12062    fn from_inner(
12063        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12064        is_terminated: bool,
12065    ) -> Self {
12066        Self { inner, is_terminated }
12067    }
12068}
12069
12070impl futures::Stream for StreamConfigRequestStream {
12071    type Item = Result<StreamConfigRequest, fidl::Error>;
12072
12073    fn poll_next(
12074        mut self: std::pin::Pin<&mut Self>,
12075        cx: &mut std::task::Context<'_>,
12076    ) -> std::task::Poll<Option<Self::Item>> {
12077        let this = &mut *self;
12078        if this.inner.check_shutdown(cx) {
12079            this.is_terminated = true;
12080            return std::task::Poll::Ready(None);
12081        }
12082        if this.is_terminated {
12083            panic!("polled StreamConfigRequestStream after completion");
12084        }
12085        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12086            |bytes, handles| {
12087                match this.inner.channel().read_etc(cx, bytes, handles) {
12088                    std::task::Poll::Ready(Ok(())) => {}
12089                    std::task::Poll::Pending => return std::task::Poll::Pending,
12090                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12091                        this.is_terminated = true;
12092                        return std::task::Poll::Ready(None);
12093                    }
12094                    std::task::Poll::Ready(Err(e)) => {
12095                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12096                            e.into(),
12097                        ))));
12098                    }
12099                }
12100
12101                // A message has been received from the channel
12102                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12103
12104                std::task::Poll::Ready(Some(match header.ordinal {
12105                    0x4e146d6bca733a84 => {
12106                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12107                        let mut req = fidl::new_empty!(
12108                            fidl::encoding::EmptyPayload,
12109                            fidl::encoding::DefaultFuchsiaResourceDialect
12110                        );
12111                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12112                        let control_handle =
12113                            StreamConfigControlHandle { inner: this.inner.clone() };
12114                        Ok(StreamConfigRequest::GetHealthState {
12115                            responder: StreamConfigGetHealthStateResponder {
12116                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12117                                tx_id: header.tx_id,
12118                            },
12119                        })
12120                    }
12121                    0xa81907ce6066295 => {
12122                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12123                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12124                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
12125                        let control_handle =
12126                            StreamConfigControlHandle { inner: this.inner.clone() };
12127                        Ok(StreamConfigRequest::SignalProcessingConnect {
12128                            protocol: req.protocol,
12129
12130                            control_handle,
12131                        })
12132                    }
12133                    0x7d89c02f3e2d3c01 => {
12134                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12135                        let mut req = fidl::new_empty!(
12136                            fidl::encoding::EmptyPayload,
12137                            fidl::encoding::DefaultFuchsiaResourceDialect
12138                        );
12139                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12140                        let control_handle =
12141                            StreamConfigControlHandle { inner: this.inner.clone() };
12142                        Ok(StreamConfigRequest::GetProperties {
12143                            responder: StreamConfigGetPropertiesResponder {
12144                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12145                                tx_id: header.tx_id,
12146                            },
12147                        })
12148                    }
12149                    0x448efa7850cafe7e => {
12150                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12151                        let mut req = fidl::new_empty!(
12152                            fidl::encoding::EmptyPayload,
12153                            fidl::encoding::DefaultFuchsiaResourceDialect
12154                        );
12155                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12156                        let control_handle =
12157                            StreamConfigControlHandle { inner: this.inner.clone() };
12158                        Ok(StreamConfigRequest::GetSupportedFormats {
12159                            responder: StreamConfigGetSupportedFormatsResponder {
12160                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12161                                tx_id: header.tx_id,
12162                            },
12163                        })
12164                    }
12165                    0x2afb19dd13faa1ba => {
12166                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12167                        let mut req = fidl::new_empty!(
12168                            StreamConfigCreateRingBufferRequest,
12169                            fidl::encoding::DefaultFuchsiaResourceDialect
12170                        );
12171                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
12172                        let control_handle =
12173                            StreamConfigControlHandle { inner: this.inner.clone() };
12174                        Ok(StreamConfigRequest::CreateRingBuffer {
12175                            format: req.format,
12176                            ring_buffer: req.ring_buffer,
12177
12178                            control_handle,
12179                        })
12180                    }
12181                    0x4772506136ab65c1 => {
12182                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12183                        let mut req = fidl::new_empty!(
12184                            fidl::encoding::EmptyPayload,
12185                            fidl::encoding::DefaultFuchsiaResourceDialect
12186                        );
12187                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12188                        let control_handle =
12189                            StreamConfigControlHandle { inner: this.inner.clone() };
12190                        Ok(StreamConfigRequest::WatchGainState {
12191                            responder: StreamConfigWatchGainStateResponder {
12192                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12193                                tx_id: header.tx_id,
12194                            },
12195                        })
12196                    }
12197                    0x3943b41498c6a384 => {
12198                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12199                        let mut req = fidl::new_empty!(
12200                            StreamConfigSetGainRequest,
12201                            fidl::encoding::DefaultFuchsiaResourceDialect
12202                        );
12203                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
12204                        let control_handle =
12205                            StreamConfigControlHandle { inner: this.inner.clone() };
12206                        Ok(StreamConfigRequest::SetGain {
12207                            target_state: req.target_state,
12208
12209                            control_handle,
12210                        })
12211                    }
12212                    0x497345a6f048b2a6 => {
12213                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12214                        let mut req = fidl::new_empty!(
12215                            fidl::encoding::EmptyPayload,
12216                            fidl::encoding::DefaultFuchsiaResourceDialect
12217                        );
12218                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12219                        let control_handle =
12220                            StreamConfigControlHandle { inner: this.inner.clone() };
12221                        Ok(StreamConfigRequest::WatchPlugState {
12222                            responder: StreamConfigWatchPlugStateResponder {
12223                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12224                                tx_id: header.tx_id,
12225                            },
12226                        })
12227                    }
12228                    _ => Err(fidl::Error::UnknownOrdinal {
12229                        ordinal: header.ordinal,
12230                        protocol_name:
12231                            <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12232                    }),
12233                }))
12234            },
12235        )
12236    }
12237}
12238
12239/// For an overview see
12240/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming)
12241/// # Deprecation
12242///
12243/// Not supported anymore, instead use an
12244/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
12245/// with one Ring Buffer, see
12246/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
12247#[derive(Debug)]
12248pub enum StreamConfigRequest {
12249    /// Retrieves top level health state.
12250    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
12251    GetHealthState { responder: StreamConfigGetHealthStateResponder },
12252    /// Connect to a `SignalProcessing` protocol.
12253    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
12254    /// the maximum number of connections have already been created, for instance one, then the
12255    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
12256    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
12257    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
12258    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
12259    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
12260    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
12261    /// is intended to be composed, and hence the more verbose name allows differentiation and
12262    /// improved clarity.
12263    SignalProcessingConnect {
12264        protocol: fidl::endpoints::ServerEnd<
12265            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
12266        >,
12267        control_handle: StreamConfigControlHandle,
12268    },
12269    /// Retrieves top level static properties.
12270    GetProperties { responder: StreamConfigGetPropertiesResponder },
12271    /// Gets formats supported by a given driver. When not all combinations supported by the
12272    /// driver can be described with one `SupportedFormats`, the driver returns more than one
12273    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
12274    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
12275    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
12276    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
12277    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
12278    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
12279    /// <<16bits,32bits>,<48KHz,96KHz>>.
12280    GetSupportedFormats { responder: StreamConfigGetSupportedFormatsResponder },
12281    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
12282    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
12283    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
12284    /// ring buffer channel had been established and was still active, the driver must close that
12285    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
12286    /// operations in the process.
12287    CreateRingBuffer {
12288        format: Format,
12289        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
12290        control_handle: StreamConfigControlHandle,
12291    },
12292    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
12293    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
12294    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
12295    /// from what was most recently reported.
12296    /// If `WatchGainState` is called for a second time before the first call has completed, then
12297    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
12298    WatchGainState { responder: StreamConfigWatchGainStateResponder },
12299    /// Client update of the gain state.
12300    SetGain { target_state: GainState, control_handle: StreamConfigControlHandle },
12301    /// Get the plug detect state via a hanging get. The driver will reply to the first
12302    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
12303    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
12304    /// If `WatchPlugState` is called for a second time before the first call has completed, then
12305    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
12306    WatchPlugState { responder: StreamConfigWatchPlugStateResponder },
12307}
12308
12309impl StreamConfigRequest {
12310    #[allow(irrefutable_let_patterns)]
12311    pub fn into_get_health_state(self) -> Option<(StreamConfigGetHealthStateResponder)> {
12312        if let StreamConfigRequest::GetHealthState { responder } = self {
12313            Some((responder))
12314        } else {
12315            None
12316        }
12317    }
12318
12319    #[allow(irrefutable_let_patterns)]
12320    pub fn into_signal_processing_connect(
12321        self,
12322    ) -> Option<(
12323        fidl::endpoints::ServerEnd<
12324            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
12325        >,
12326        StreamConfigControlHandle,
12327    )> {
12328        if let StreamConfigRequest::SignalProcessingConnect { protocol, control_handle } = self {
12329            Some((protocol, control_handle))
12330        } else {
12331            None
12332        }
12333    }
12334
12335    #[allow(irrefutable_let_patterns)]
12336    pub fn into_get_properties(self) -> Option<(StreamConfigGetPropertiesResponder)> {
12337        if let StreamConfigRequest::GetProperties { responder } = self {
12338            Some((responder))
12339        } else {
12340            None
12341        }
12342    }
12343
12344    #[allow(irrefutable_let_patterns)]
12345    pub fn into_get_supported_formats(self) -> Option<(StreamConfigGetSupportedFormatsResponder)> {
12346        if let StreamConfigRequest::GetSupportedFormats { responder } = self {
12347            Some((responder))
12348        } else {
12349            None
12350        }
12351    }
12352
12353    #[allow(irrefutable_let_patterns)]
12354    pub fn into_create_ring_buffer(
12355        self,
12356    ) -> Option<(Format, fidl::endpoints::ServerEnd<RingBufferMarker>, StreamConfigControlHandle)>
12357    {
12358        if let StreamConfigRequest::CreateRingBuffer { format, ring_buffer, control_handle } = self
12359        {
12360            Some((format, ring_buffer, control_handle))
12361        } else {
12362            None
12363        }
12364    }
12365
12366    #[allow(irrefutable_let_patterns)]
12367    pub fn into_watch_gain_state(self) -> Option<(StreamConfigWatchGainStateResponder)> {
12368        if let StreamConfigRequest::WatchGainState { responder } = self {
12369            Some((responder))
12370        } else {
12371            None
12372        }
12373    }
12374
12375    #[allow(irrefutable_let_patterns)]
12376    pub fn into_set_gain(self) -> Option<(GainState, StreamConfigControlHandle)> {
12377        if let StreamConfigRequest::SetGain { target_state, control_handle } = self {
12378            Some((target_state, control_handle))
12379        } else {
12380            None
12381        }
12382    }
12383
12384    #[allow(irrefutable_let_patterns)]
12385    pub fn into_watch_plug_state(self) -> Option<(StreamConfigWatchPlugStateResponder)> {
12386        if let StreamConfigRequest::WatchPlugState { responder } = self {
12387            Some((responder))
12388        } else {
12389            None
12390        }
12391    }
12392
12393    /// Name of the method defined in FIDL
12394    pub fn method_name(&self) -> &'static str {
12395        match *self {
12396            StreamConfigRequest::GetHealthState { .. } => "get_health_state",
12397            StreamConfigRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
12398            StreamConfigRequest::GetProperties { .. } => "get_properties",
12399            StreamConfigRequest::GetSupportedFormats { .. } => "get_supported_formats",
12400            StreamConfigRequest::CreateRingBuffer { .. } => "create_ring_buffer",
12401            StreamConfigRequest::WatchGainState { .. } => "watch_gain_state",
12402            StreamConfigRequest::SetGain { .. } => "set_gain",
12403            StreamConfigRequest::WatchPlugState { .. } => "watch_plug_state",
12404        }
12405    }
12406}
12407
12408#[derive(Debug, Clone)]
12409pub struct StreamConfigControlHandle {
12410    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12411}
12412
12413impl fidl::endpoints::ControlHandle for StreamConfigControlHandle {
12414    fn shutdown(&self) {
12415        self.inner.shutdown()
12416    }
12417
12418    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
12419        self.inner.shutdown_with_epitaph(status)
12420    }
12421
12422    fn is_closed(&self) -> bool {
12423        self.inner.channel().is_closed()
12424    }
12425    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12426        self.inner.channel().on_closed()
12427    }
12428
12429    #[cfg(target_os = "fuchsia")]
12430    fn signal_peer(
12431        &self,
12432        clear_mask: zx::Signals,
12433        set_mask: zx::Signals,
12434    ) -> Result<(), zx_status::Status> {
12435        use fidl::Peered;
12436        self.inner.channel().signal_peer(clear_mask, set_mask)
12437    }
12438}
12439
12440impl StreamConfigControlHandle {}
12441
12442#[must_use = "FIDL methods require a response to be sent"]
12443#[derive(Debug)]
12444pub struct StreamConfigGetHealthStateResponder {
12445    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12446    tx_id: u32,
12447}
12448
12449/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12450/// if the responder is dropped without sending a response, so that the client
12451/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12452impl std::ops::Drop for StreamConfigGetHealthStateResponder {
12453    fn drop(&mut self) {
12454        self.control_handle.shutdown();
12455        // Safety: drops once, never accessed again
12456        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12457    }
12458}
12459
12460impl fidl::endpoints::Responder for StreamConfigGetHealthStateResponder {
12461    type ControlHandle = StreamConfigControlHandle;
12462
12463    fn control_handle(&self) -> &StreamConfigControlHandle {
12464        &self.control_handle
12465    }
12466
12467    fn drop_without_shutdown(mut self) {
12468        // Safety: drops once, never accessed again due to mem::forget
12469        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12470        // Prevent Drop from running (which would shut down the channel)
12471        std::mem::forget(self);
12472    }
12473}
12474
12475impl StreamConfigGetHealthStateResponder {
12476    /// Sends a response to the FIDL transaction.
12477    ///
12478    /// Sets the channel to shutdown if an error occurs.
12479    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
12480        let _result = self.send_raw(state);
12481        if _result.is_err() {
12482            self.control_handle.shutdown();
12483        }
12484        self.drop_without_shutdown();
12485        _result
12486    }
12487
12488    /// Similar to "send" but does not shutdown the channel if an error occurs.
12489    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
12490        let _result = self.send_raw(state);
12491        self.drop_without_shutdown();
12492        _result
12493    }
12494
12495    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
12496        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
12497            (state,),
12498            self.tx_id,
12499            0x4e146d6bca733a84,
12500            fidl::encoding::DynamicFlags::empty(),
12501        )
12502    }
12503}
12504
12505#[must_use = "FIDL methods require a response to be sent"]
12506#[derive(Debug)]
12507pub struct StreamConfigGetPropertiesResponder {
12508    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12509    tx_id: u32,
12510}
12511
12512/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12513/// if the responder is dropped without sending a response, so that the client
12514/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12515impl std::ops::Drop for StreamConfigGetPropertiesResponder {
12516    fn drop(&mut self) {
12517        self.control_handle.shutdown();
12518        // Safety: drops once, never accessed again
12519        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12520    }
12521}
12522
12523impl fidl::endpoints::Responder for StreamConfigGetPropertiesResponder {
12524    type ControlHandle = StreamConfigControlHandle;
12525
12526    fn control_handle(&self) -> &StreamConfigControlHandle {
12527        &self.control_handle
12528    }
12529
12530    fn drop_without_shutdown(mut self) {
12531        // Safety: drops once, never accessed again due to mem::forget
12532        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12533        // Prevent Drop from running (which would shut down the channel)
12534        std::mem::forget(self);
12535    }
12536}
12537
12538impl StreamConfigGetPropertiesResponder {
12539    /// Sends a response to the FIDL transaction.
12540    ///
12541    /// Sets the channel to shutdown if an error occurs.
12542    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
12543        let _result = self.send_raw(properties);
12544        if _result.is_err() {
12545            self.control_handle.shutdown();
12546        }
12547        self.drop_without_shutdown();
12548        _result
12549    }
12550
12551    /// Similar to "send" but does not shutdown the channel if an error occurs.
12552    pub fn send_no_shutdown_on_err(
12553        self,
12554        mut properties: &StreamProperties,
12555    ) -> Result<(), fidl::Error> {
12556        let _result = self.send_raw(properties);
12557        self.drop_without_shutdown();
12558        _result
12559    }
12560
12561    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
12562        self.control_handle.inner.send::<StreamConfigGetPropertiesResponse>(
12563            (properties,),
12564            self.tx_id,
12565            0x7d89c02f3e2d3c01,
12566            fidl::encoding::DynamicFlags::empty(),
12567        )
12568    }
12569}
12570
12571#[must_use = "FIDL methods require a response to be sent"]
12572#[derive(Debug)]
12573pub struct StreamConfigGetSupportedFormatsResponder {
12574    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12575    tx_id: u32,
12576}
12577
12578/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12579/// if the responder is dropped without sending a response, so that the client
12580/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12581impl std::ops::Drop for StreamConfigGetSupportedFormatsResponder {
12582    fn drop(&mut self) {
12583        self.control_handle.shutdown();
12584        // Safety: drops once, never accessed again
12585        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12586    }
12587}
12588
12589impl fidl::endpoints::Responder for StreamConfigGetSupportedFormatsResponder {
12590    type ControlHandle = StreamConfigControlHandle;
12591
12592    fn control_handle(&self) -> &StreamConfigControlHandle {
12593        &self.control_handle
12594    }
12595
12596    fn drop_without_shutdown(mut self) {
12597        // Safety: drops once, never accessed again due to mem::forget
12598        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12599        // Prevent Drop from running (which would shut down the channel)
12600        std::mem::forget(self);
12601    }
12602}
12603
12604impl StreamConfigGetSupportedFormatsResponder {
12605    /// Sends a response to the FIDL transaction.
12606    ///
12607    /// Sets the channel to shutdown if an error occurs.
12608    pub fn send(self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
12609        let _result = self.send_raw(supported_formats);
12610        if _result.is_err() {
12611            self.control_handle.shutdown();
12612        }
12613        self.drop_without_shutdown();
12614        _result
12615    }
12616
12617    /// Similar to "send" but does not shutdown the channel if an error occurs.
12618    pub fn send_no_shutdown_on_err(
12619        self,
12620        mut supported_formats: &[SupportedFormats],
12621    ) -> Result<(), fidl::Error> {
12622        let _result = self.send_raw(supported_formats);
12623        self.drop_without_shutdown();
12624        _result
12625    }
12626
12627    fn send_raw(&self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
12628        self.control_handle.inner.send::<StreamConfigGetSupportedFormatsResponse>(
12629            (supported_formats,),
12630            self.tx_id,
12631            0x448efa7850cafe7e,
12632            fidl::encoding::DynamicFlags::empty(),
12633        )
12634    }
12635}
12636
12637#[must_use = "FIDL methods require a response to be sent"]
12638#[derive(Debug)]
12639pub struct StreamConfigWatchGainStateResponder {
12640    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12641    tx_id: u32,
12642}
12643
12644/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12645/// if the responder is dropped without sending a response, so that the client
12646/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12647impl std::ops::Drop for StreamConfigWatchGainStateResponder {
12648    fn drop(&mut self) {
12649        self.control_handle.shutdown();
12650        // Safety: drops once, never accessed again
12651        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12652    }
12653}
12654
12655impl fidl::endpoints::Responder for StreamConfigWatchGainStateResponder {
12656    type ControlHandle = StreamConfigControlHandle;
12657
12658    fn control_handle(&self) -> &StreamConfigControlHandle {
12659        &self.control_handle
12660    }
12661
12662    fn drop_without_shutdown(mut self) {
12663        // Safety: drops once, never accessed again due to mem::forget
12664        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12665        // Prevent Drop from running (which would shut down the channel)
12666        std::mem::forget(self);
12667    }
12668}
12669
12670impl StreamConfigWatchGainStateResponder {
12671    /// Sends a response to the FIDL transaction.
12672    ///
12673    /// Sets the channel to shutdown if an error occurs.
12674    pub fn send(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12675        let _result = self.send_raw(gain_state);
12676        if _result.is_err() {
12677            self.control_handle.shutdown();
12678        }
12679        self.drop_without_shutdown();
12680        _result
12681    }
12682
12683    /// Similar to "send" but does not shutdown the channel if an error occurs.
12684    pub fn send_no_shutdown_on_err(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12685        let _result = self.send_raw(gain_state);
12686        self.drop_without_shutdown();
12687        _result
12688    }
12689
12690    fn send_raw(&self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12691        self.control_handle.inner.send::<StreamConfigWatchGainStateResponse>(
12692            (gain_state,),
12693            self.tx_id,
12694            0x4772506136ab65c1,
12695            fidl::encoding::DynamicFlags::empty(),
12696        )
12697    }
12698}
12699
12700#[must_use = "FIDL methods require a response to be sent"]
12701#[derive(Debug)]
12702pub struct StreamConfigWatchPlugStateResponder {
12703    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12704    tx_id: u32,
12705}
12706
12707/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12708/// if the responder is dropped without sending a response, so that the client
12709/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12710impl std::ops::Drop for StreamConfigWatchPlugStateResponder {
12711    fn drop(&mut self) {
12712        self.control_handle.shutdown();
12713        // Safety: drops once, never accessed again
12714        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12715    }
12716}
12717
12718impl fidl::endpoints::Responder for StreamConfigWatchPlugStateResponder {
12719    type ControlHandle = StreamConfigControlHandle;
12720
12721    fn control_handle(&self) -> &StreamConfigControlHandle {
12722        &self.control_handle
12723    }
12724
12725    fn drop_without_shutdown(mut self) {
12726        // Safety: drops once, never accessed again due to mem::forget
12727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12728        // Prevent Drop from running (which would shut down the channel)
12729        std::mem::forget(self);
12730    }
12731}
12732
12733impl StreamConfigWatchPlugStateResponder {
12734    /// Sends a response to the FIDL transaction.
12735    ///
12736    /// Sets the channel to shutdown if an error occurs.
12737    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12738        let _result = self.send_raw(plug_state);
12739        if _result.is_err() {
12740            self.control_handle.shutdown();
12741        }
12742        self.drop_without_shutdown();
12743        _result
12744    }
12745
12746    /// Similar to "send" but does not shutdown the channel if an error occurs.
12747    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12748        let _result = self.send_raw(plug_state);
12749        self.drop_without_shutdown();
12750        _result
12751    }
12752
12753    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12754        self.control_handle.inner.send::<StreamConfigWatchPlugStateResponse>(
12755            (plug_state,),
12756            self.tx_id,
12757            0x497345a6f048b2a6,
12758            fidl::encoding::DynamicFlags::empty(),
12759        )
12760    }
12761}
12762
12763#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
12764pub struct StreamConfigConnectorMarker;
12765
12766impl fidl::endpoints::ProtocolMarker for StreamConfigConnectorMarker {
12767    type Proxy = StreamConfigConnectorProxy;
12768    type RequestStream = StreamConfigConnectorRequestStream;
12769    #[cfg(target_os = "fuchsia")]
12770    type SynchronousProxy = StreamConfigConnectorSynchronousProxy;
12771
12772    const DEBUG_NAME: &'static str = "(anonymous) StreamConfigConnector";
12773}
12774
12775pub trait StreamConfigConnectorProxyInterface: Send + Sync {
12776    fn r#connect(
12777        &self,
12778        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12779    ) -> Result<(), fidl::Error>;
12780}
12781#[derive(Debug)]
12782#[cfg(target_os = "fuchsia")]
12783pub struct StreamConfigConnectorSynchronousProxy {
12784    client: fidl::client::sync::Client,
12785}
12786
12787#[cfg(target_os = "fuchsia")]
12788impl fidl::endpoints::SynchronousProxy for StreamConfigConnectorSynchronousProxy {
12789    type Proxy = StreamConfigConnectorProxy;
12790    type Protocol = StreamConfigConnectorMarker;
12791
12792    fn from_channel(inner: fidl::Channel) -> Self {
12793        Self::new(inner)
12794    }
12795
12796    fn into_channel(self) -> fidl::Channel {
12797        self.client.into_channel()
12798    }
12799
12800    fn as_channel(&self) -> &fidl::Channel {
12801        self.client.as_channel()
12802    }
12803}
12804
12805#[cfg(target_os = "fuchsia")]
12806impl StreamConfigConnectorSynchronousProxy {
12807    pub fn new(channel: fidl::Channel) -> Self {
12808        Self { client: fidl::client::sync::Client::new(channel) }
12809    }
12810
12811    pub fn into_channel(self) -> fidl::Channel {
12812        self.client.into_channel()
12813    }
12814
12815    /// Waits until an event arrives and returns it. It is safe for other
12816    /// threads to make concurrent requests while waiting for an event.
12817    pub fn wait_for_event(
12818        &self,
12819        deadline: zx::MonotonicInstant,
12820    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
12821        StreamConfigConnectorEvent::decode(
12822            self.client.wait_for_event::<StreamConfigConnectorMarker>(deadline)?,
12823        )
12824    }
12825
12826    /// Connect to a `StreamConfig` protocol.
12827    /// This method allows a component to serve FIDL outside the devhost's control.
12828    pub fn r#connect(
12829        &self,
12830        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12831    ) -> Result<(), fidl::Error> {
12832        self.client.send::<StreamConfigConnectorConnectRequest>(
12833            (protocol,),
12834            0x22051ff3021eafec,
12835            fidl::encoding::DynamicFlags::empty(),
12836        )
12837    }
12838}
12839
12840#[cfg(target_os = "fuchsia")]
12841impl From<StreamConfigConnectorSynchronousProxy> for zx::NullableHandle {
12842    fn from(value: StreamConfigConnectorSynchronousProxy) -> Self {
12843        value.into_channel().into()
12844    }
12845}
12846
12847#[cfg(target_os = "fuchsia")]
12848impl From<fidl::Channel> for StreamConfigConnectorSynchronousProxy {
12849    fn from(value: fidl::Channel) -> Self {
12850        Self::new(value)
12851    }
12852}
12853
12854#[cfg(target_os = "fuchsia")]
12855impl fidl::endpoints::FromClient for StreamConfigConnectorSynchronousProxy {
12856    type Protocol = StreamConfigConnectorMarker;
12857
12858    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigConnectorMarker>) -> Self {
12859        Self::new(value.into_channel())
12860    }
12861}
12862
12863#[derive(Debug, Clone)]
12864pub struct StreamConfigConnectorProxy {
12865    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
12866}
12867
12868impl fidl::endpoints::Proxy for StreamConfigConnectorProxy {
12869    type Protocol = StreamConfigConnectorMarker;
12870
12871    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
12872        Self::new(inner)
12873    }
12874
12875    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
12876        self.client.into_channel().map_err(|client| Self { client })
12877    }
12878
12879    fn as_channel(&self) -> &::fidl::AsyncChannel {
12880        self.client.as_channel()
12881    }
12882}
12883
12884impl StreamConfigConnectorProxy {
12885    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfigConnector.
12886    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
12887        let protocol_name =
12888            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12889        Self { client: fidl::client::Client::new(channel, protocol_name) }
12890    }
12891
12892    /// Get a Stream of events from the remote end of the protocol.
12893    ///
12894    /// # Panics
12895    ///
12896    /// Panics if the event stream was already taken.
12897    pub fn take_event_stream(&self) -> StreamConfigConnectorEventStream {
12898        StreamConfigConnectorEventStream { event_receiver: self.client.take_event_receiver() }
12899    }
12900
12901    /// Connect to a `StreamConfig` protocol.
12902    /// This method allows a component to serve FIDL outside the devhost's control.
12903    pub fn r#connect(
12904        &self,
12905        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12906    ) -> Result<(), fidl::Error> {
12907        StreamConfigConnectorProxyInterface::r#connect(self, protocol)
12908    }
12909}
12910
12911impl StreamConfigConnectorProxyInterface for StreamConfigConnectorProxy {
12912    fn r#connect(
12913        &self,
12914        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12915    ) -> Result<(), fidl::Error> {
12916        self.client.send::<StreamConfigConnectorConnectRequest>(
12917            (protocol,),
12918            0x22051ff3021eafec,
12919            fidl::encoding::DynamicFlags::empty(),
12920        )
12921    }
12922}
12923
12924pub struct StreamConfigConnectorEventStream {
12925    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12926}
12927
12928impl std::marker::Unpin for StreamConfigConnectorEventStream {}
12929
12930impl futures::stream::FusedStream for StreamConfigConnectorEventStream {
12931    fn is_terminated(&self) -> bool {
12932        self.event_receiver.is_terminated()
12933    }
12934}
12935
12936impl futures::Stream for StreamConfigConnectorEventStream {
12937    type Item = Result<StreamConfigConnectorEvent, fidl::Error>;
12938
12939    fn poll_next(
12940        mut self: std::pin::Pin<&mut Self>,
12941        cx: &mut std::task::Context<'_>,
12942    ) -> std::task::Poll<Option<Self::Item>> {
12943        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12944            &mut self.event_receiver,
12945            cx
12946        )?) {
12947            Some(buf) => std::task::Poll::Ready(Some(StreamConfigConnectorEvent::decode(buf))),
12948            None => std::task::Poll::Ready(None),
12949        }
12950    }
12951}
12952
12953#[derive(Debug)]
12954pub enum StreamConfigConnectorEvent {}
12955
12956impl StreamConfigConnectorEvent {
12957    /// Decodes a message buffer as a [`StreamConfigConnectorEvent`].
12958    fn decode(
12959        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12960    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
12961        let (bytes, _handles) = buf.split_mut();
12962        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12963        debug_assert_eq!(tx_header.tx_id, 0);
12964        match tx_header.ordinal {
12965            _ => Err(fidl::Error::UnknownOrdinal {
12966                ordinal: tx_header.ordinal,
12967                protocol_name:
12968                    <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12969            }),
12970        }
12971    }
12972}
12973
12974/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfigConnector.
12975pub struct StreamConfigConnectorRequestStream {
12976    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12977    is_terminated: bool,
12978}
12979
12980impl std::marker::Unpin for StreamConfigConnectorRequestStream {}
12981
12982impl futures::stream::FusedStream for StreamConfigConnectorRequestStream {
12983    fn is_terminated(&self) -> bool {
12984        self.is_terminated
12985    }
12986}
12987
12988impl fidl::endpoints::RequestStream for StreamConfigConnectorRequestStream {
12989    type Protocol = StreamConfigConnectorMarker;
12990    type ControlHandle = StreamConfigConnectorControlHandle;
12991
12992    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12993        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12994    }
12995
12996    fn control_handle(&self) -> Self::ControlHandle {
12997        StreamConfigConnectorControlHandle { inner: self.inner.clone() }
12998    }
12999
13000    fn into_inner(
13001        self,
13002    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
13003    {
13004        (self.inner, self.is_terminated)
13005    }
13006
13007    fn from_inner(
13008        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13009        is_terminated: bool,
13010    ) -> Self {
13011        Self { inner, is_terminated }
13012    }
13013}
13014
13015impl futures::Stream for StreamConfigConnectorRequestStream {
13016    type Item = Result<StreamConfigConnectorRequest, fidl::Error>;
13017
13018    fn poll_next(
13019        mut self: std::pin::Pin<&mut Self>,
13020        cx: &mut std::task::Context<'_>,
13021    ) -> std::task::Poll<Option<Self::Item>> {
13022        let this = &mut *self;
13023        if this.inner.check_shutdown(cx) {
13024            this.is_terminated = true;
13025            return std::task::Poll::Ready(None);
13026        }
13027        if this.is_terminated {
13028            panic!("polled StreamConfigConnectorRequestStream after completion");
13029        }
13030        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
13031            |bytes, handles| {
13032                match this.inner.channel().read_etc(cx, bytes, handles) {
13033                    std::task::Poll::Ready(Ok(())) => {}
13034                    std::task::Poll::Pending => return std::task::Poll::Pending,
13035                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
13036                        this.is_terminated = true;
13037                        return std::task::Poll::Ready(None);
13038                    }
13039                    std::task::Poll::Ready(Err(e)) => {
13040                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
13041                            e.into(),
13042                        ))));
13043                    }
13044                }
13045
13046                // A message has been received from the channel
13047                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
13048
13049                std::task::Poll::Ready(Some(match header.ordinal {
13050                0x22051ff3021eafec => {
13051                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
13052                    let mut req = fidl::new_empty!(StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
13053                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
13054                    let control_handle = StreamConfigConnectorControlHandle {
13055                        inner: this.inner.clone(),
13056                    };
13057                    Ok(StreamConfigConnectorRequest::Connect {protocol: req.protocol,
13058
13059                        control_handle,
13060                    })
13061                }
13062                _ => Err(fidl::Error::UnknownOrdinal {
13063                    ordinal: header.ordinal,
13064                    protocol_name: <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13065                }),
13066            }))
13067            },
13068        )
13069    }
13070}
13071
13072/// For an overview see
13073/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming).
13074/// # Deprecation
13075///
13076/// Not supported anymore, instead use an
13077/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13078/// with one Ring Buffer, see
13079/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13080#[derive(Debug)]
13081pub enum StreamConfigConnectorRequest {
13082    /// Connect to a `StreamConfig` protocol.
13083    /// This method allows a component to serve FIDL outside the devhost's control.
13084    Connect {
13085        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
13086        control_handle: StreamConfigConnectorControlHandle,
13087    },
13088}
13089
13090impl StreamConfigConnectorRequest {
13091    #[allow(irrefutable_let_patterns)]
13092    pub fn into_connect(
13093        self,
13094    ) -> Option<(fidl::endpoints::ServerEnd<StreamConfigMarker>, StreamConfigConnectorControlHandle)>
13095    {
13096        if let StreamConfigConnectorRequest::Connect { protocol, control_handle } = self {
13097            Some((protocol, control_handle))
13098        } else {
13099            None
13100        }
13101    }
13102
13103    /// Name of the method defined in FIDL
13104    pub fn method_name(&self) -> &'static str {
13105        match *self {
13106            StreamConfigConnectorRequest::Connect { .. } => "connect",
13107        }
13108    }
13109}
13110
13111#[derive(Debug, Clone)]
13112pub struct StreamConfigConnectorControlHandle {
13113    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13114}
13115
13116impl fidl::endpoints::ControlHandle for StreamConfigConnectorControlHandle {
13117    fn shutdown(&self) {
13118        self.inner.shutdown()
13119    }
13120
13121    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
13122        self.inner.shutdown_with_epitaph(status)
13123    }
13124
13125    fn is_closed(&self) -> bool {
13126        self.inner.channel().is_closed()
13127    }
13128    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
13129        self.inner.channel().on_closed()
13130    }
13131
13132    #[cfg(target_os = "fuchsia")]
13133    fn signal_peer(
13134        &self,
13135        clear_mask: zx::Signals,
13136        set_mask: zx::Signals,
13137    ) -> Result<(), zx_status::Status> {
13138        use fidl::Peered;
13139        self.inner.channel().signal_peer(clear_mask, set_mask)
13140    }
13141}
13142
13143impl StreamConfigConnectorControlHandle {}
13144
13145#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13146pub struct CodecConnectorServiceMarker;
13147
13148#[cfg(target_os = "fuchsia")]
13149impl fidl::endpoints::ServiceMarker for CodecConnectorServiceMarker {
13150    type Proxy = CodecConnectorServiceProxy;
13151    type Request = CodecConnectorServiceRequest;
13152    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecConnectorService";
13153}
13154
13155/// A request for one of the member protocols of CodecConnectorService.
13156///
13157/// # Deprecation
13158///
13159/// Not supported anymore, instead use an
13160/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13161/// with one DAI and no Ring Buffer, see
13162/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13163#[cfg(target_os = "fuchsia")]
13164pub enum CodecConnectorServiceRequest {
13165    CodecConnector(CodecConnectorRequestStream),
13166}
13167
13168#[cfg(target_os = "fuchsia")]
13169impl fidl::endpoints::ServiceRequest for CodecConnectorServiceRequest {
13170    type Service = CodecConnectorServiceMarker;
13171
13172    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13173        match name {
13174            "codec_connector" => Self::CodecConnector(
13175                <CodecConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13176                    _channel,
13177                ),
13178            ),
13179            _ => panic!("no such member protocol name for service CodecConnectorService"),
13180        }
13181    }
13182
13183    fn member_names() -> &'static [&'static str] {
13184        &["codec_connector"]
13185    }
13186}
13187/// # Deprecation
13188///
13189/// Not supported anymore, instead use an
13190/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13191/// with one DAI and no Ring Buffer, see
13192/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13193#[cfg(target_os = "fuchsia")]
13194pub struct CodecConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13195
13196#[cfg(target_os = "fuchsia")]
13197impl fidl::endpoints::ServiceProxy for CodecConnectorServiceProxy {
13198    type Service = CodecConnectorServiceMarker;
13199
13200    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13201        Self(opener)
13202    }
13203}
13204
13205#[cfg(target_os = "fuchsia")]
13206impl CodecConnectorServiceProxy {
13207    pub fn connect_to_codec_connector(&self) -> Result<CodecConnectorProxy, fidl::Error> {
13208        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecConnectorMarker>();
13209        self.connect_channel_to_codec_connector(server_end)?;
13210        Ok(proxy)
13211    }
13212
13213    /// Like `connect_to_codec_connector`, but returns a sync proxy.
13214    /// See [`Self::connect_to_codec_connector`] for more details.
13215    pub fn connect_to_codec_connector_sync(
13216        &self,
13217    ) -> Result<CodecConnectorSynchronousProxy, fidl::Error> {
13218        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecConnectorMarker>();
13219        self.connect_channel_to_codec_connector(server_end)?;
13220        Ok(proxy)
13221    }
13222
13223    /// Like `connect_to_codec_connector`, but accepts a server end.
13224    /// See [`Self::connect_to_codec_connector`] for more details.
13225    pub fn connect_channel_to_codec_connector(
13226        &self,
13227        server_end: fidl::endpoints::ServerEnd<CodecConnectorMarker>,
13228    ) -> Result<(), fidl::Error> {
13229        self.0.open_member("codec_connector", server_end.into_channel())
13230    }
13231
13232    pub fn instance_name(&self) -> &str {
13233        self.0.instance_name()
13234    }
13235}
13236
13237#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13238pub struct CodecServiceMarker;
13239
13240#[cfg(target_os = "fuchsia")]
13241impl fidl::endpoints::ServiceMarker for CodecServiceMarker {
13242    type Proxy = CodecServiceProxy;
13243    type Request = CodecServiceRequest;
13244    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecService";
13245}
13246
13247/// A request for one of the member protocols of CodecService.
13248///
13249/// # Deprecation
13250///
13251/// Not supported anymore, instead use an
13252/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13253/// with one DAI and no Ring Buffer, see
13254/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13255#[cfg(target_os = "fuchsia")]
13256pub enum CodecServiceRequest {
13257    Codec(CodecRequestStream),
13258}
13259
13260#[cfg(target_os = "fuchsia")]
13261impl fidl::endpoints::ServiceRequest for CodecServiceRequest {
13262    type Service = CodecServiceMarker;
13263
13264    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13265        match name {
13266            "codec" => Self::Codec(
13267                <CodecRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13268            ),
13269            _ => panic!("no such member protocol name for service CodecService"),
13270        }
13271    }
13272
13273    fn member_names() -> &'static [&'static str] {
13274        &["codec"]
13275    }
13276}
13277/// # Deprecation
13278///
13279/// Not supported anymore, instead use an
13280/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13281/// with one DAI and no Ring Buffer, see
13282/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13283#[cfg(target_os = "fuchsia")]
13284pub struct CodecServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13285
13286#[cfg(target_os = "fuchsia")]
13287impl fidl::endpoints::ServiceProxy for CodecServiceProxy {
13288    type Service = CodecServiceMarker;
13289
13290    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13291        Self(opener)
13292    }
13293}
13294
13295#[cfg(target_os = "fuchsia")]
13296impl CodecServiceProxy {
13297    pub fn connect_to_codec(&self) -> Result<CodecProxy, fidl::Error> {
13298        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecMarker>();
13299        self.connect_channel_to_codec(server_end)?;
13300        Ok(proxy)
13301    }
13302
13303    /// Like `connect_to_codec`, but returns a sync proxy.
13304    /// See [`Self::connect_to_codec`] for more details.
13305    pub fn connect_to_codec_sync(&self) -> Result<CodecSynchronousProxy, fidl::Error> {
13306        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecMarker>();
13307        self.connect_channel_to_codec(server_end)?;
13308        Ok(proxy)
13309    }
13310
13311    /// Like `connect_to_codec`, but accepts a server end.
13312    /// See [`Self::connect_to_codec`] for more details.
13313    pub fn connect_channel_to_codec(
13314        &self,
13315        server_end: fidl::endpoints::ServerEnd<CodecMarker>,
13316    ) -> Result<(), fidl::Error> {
13317        self.0.open_member("codec", server_end.into_channel())
13318    }
13319
13320    pub fn instance_name(&self) -> &str {
13321        self.0.instance_name()
13322    }
13323}
13324
13325#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13326pub struct CompositeConnectorServiceMarker;
13327
13328#[cfg(target_os = "fuchsia")]
13329impl fidl::endpoints::ServiceMarker for CompositeConnectorServiceMarker {
13330    type Proxy = CompositeConnectorServiceProxy;
13331    type Request = CompositeConnectorServiceRequest;
13332    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CompositeConnectorService";
13333}
13334
13335/// A request for one of the member protocols of CompositeConnectorService.
13336///
13337#[cfg(target_os = "fuchsia")]
13338pub enum CompositeConnectorServiceRequest {
13339    CompositeConnector(CompositeConnectorRequestStream),
13340}
13341
13342#[cfg(target_os = "fuchsia")]
13343impl fidl::endpoints::ServiceRequest for CompositeConnectorServiceRequest {
13344    type Service = CompositeConnectorServiceMarker;
13345
13346    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13347        match name {
13348            "composite_connector" => Self::CompositeConnector(
13349                <CompositeConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13350                    _channel,
13351                ),
13352            ),
13353            _ => panic!("no such member protocol name for service CompositeConnectorService"),
13354        }
13355    }
13356
13357    fn member_names() -> &'static [&'static str] {
13358        &["composite_connector"]
13359    }
13360}
13361#[cfg(target_os = "fuchsia")]
13362pub struct CompositeConnectorServiceProxy(
13363    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13364);
13365
13366#[cfg(target_os = "fuchsia")]
13367impl fidl::endpoints::ServiceProxy for CompositeConnectorServiceProxy {
13368    type Service = CompositeConnectorServiceMarker;
13369
13370    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13371        Self(opener)
13372    }
13373}
13374
13375#[cfg(target_os = "fuchsia")]
13376impl CompositeConnectorServiceProxy {
13377    pub fn connect_to_composite_connector(&self) -> Result<CompositeConnectorProxy, fidl::Error> {
13378        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeConnectorMarker>();
13379        self.connect_channel_to_composite_connector(server_end)?;
13380        Ok(proxy)
13381    }
13382
13383    /// Like `connect_to_composite_connector`, but returns a sync proxy.
13384    /// See [`Self::connect_to_composite_connector`] for more details.
13385    pub fn connect_to_composite_connector_sync(
13386        &self,
13387    ) -> Result<CompositeConnectorSynchronousProxy, fidl::Error> {
13388        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeConnectorMarker>();
13389        self.connect_channel_to_composite_connector(server_end)?;
13390        Ok(proxy)
13391    }
13392
13393    /// Like `connect_to_composite_connector`, but accepts a server end.
13394    /// See [`Self::connect_to_composite_connector`] for more details.
13395    pub fn connect_channel_to_composite_connector(
13396        &self,
13397        server_end: fidl::endpoints::ServerEnd<CompositeConnectorMarker>,
13398    ) -> Result<(), fidl::Error> {
13399        self.0.open_member("composite_connector", server_end.into_channel())
13400    }
13401
13402    pub fn instance_name(&self) -> &str {
13403        self.0.instance_name()
13404    }
13405}
13406
13407#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13408pub struct DaiConnectorServiceMarker;
13409
13410#[cfg(target_os = "fuchsia")]
13411impl fidl::endpoints::ServiceMarker for DaiConnectorServiceMarker {
13412    type Proxy = DaiConnectorServiceProxy;
13413    type Request = DaiConnectorServiceRequest;
13414    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiConnectorService";
13415}
13416
13417/// A request for one of the member protocols of DaiConnectorService.
13418///
13419/// # Deprecation
13420///
13421/// Not supported anymore, instead use an
13422/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13423/// with one DAI and one Ring Buffer, see
13424/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13425#[cfg(target_os = "fuchsia")]
13426pub enum DaiConnectorServiceRequest {
13427    DaiConnector(DaiConnectorRequestStream),
13428}
13429
13430#[cfg(target_os = "fuchsia")]
13431impl fidl::endpoints::ServiceRequest for DaiConnectorServiceRequest {
13432    type Service = DaiConnectorServiceMarker;
13433
13434    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13435        match name {
13436            "dai_connector" => Self::DaiConnector(
13437                <DaiConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13438                    _channel,
13439                ),
13440            ),
13441            _ => panic!("no such member protocol name for service DaiConnectorService"),
13442        }
13443    }
13444
13445    fn member_names() -> &'static [&'static str] {
13446        &["dai_connector"]
13447    }
13448}
13449/// # Deprecation
13450///
13451/// Not supported anymore, instead use an
13452/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13453/// with one DAI and one Ring Buffer, see
13454/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13455#[cfg(target_os = "fuchsia")]
13456pub struct DaiConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13457
13458#[cfg(target_os = "fuchsia")]
13459impl fidl::endpoints::ServiceProxy for DaiConnectorServiceProxy {
13460    type Service = DaiConnectorServiceMarker;
13461
13462    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13463        Self(opener)
13464    }
13465}
13466
13467#[cfg(target_os = "fuchsia")]
13468impl DaiConnectorServiceProxy {
13469    pub fn connect_to_dai_connector(&self) -> Result<DaiConnectorProxy, fidl::Error> {
13470        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiConnectorMarker>();
13471        self.connect_channel_to_dai_connector(server_end)?;
13472        Ok(proxy)
13473    }
13474
13475    /// Like `connect_to_dai_connector`, but returns a sync proxy.
13476    /// See [`Self::connect_to_dai_connector`] for more details.
13477    pub fn connect_to_dai_connector_sync(
13478        &self,
13479    ) -> Result<DaiConnectorSynchronousProxy, fidl::Error> {
13480        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiConnectorMarker>();
13481        self.connect_channel_to_dai_connector(server_end)?;
13482        Ok(proxy)
13483    }
13484
13485    /// Like `connect_to_dai_connector`, but accepts a server end.
13486    /// See [`Self::connect_to_dai_connector`] for more details.
13487    pub fn connect_channel_to_dai_connector(
13488        &self,
13489        server_end: fidl::endpoints::ServerEnd<DaiConnectorMarker>,
13490    ) -> Result<(), fidl::Error> {
13491        self.0.open_member("dai_connector", server_end.into_channel())
13492    }
13493
13494    pub fn instance_name(&self) -> &str {
13495        self.0.instance_name()
13496    }
13497}
13498
13499#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13500pub struct DaiServiceMarker;
13501
13502#[cfg(target_os = "fuchsia")]
13503impl fidl::endpoints::ServiceMarker for DaiServiceMarker {
13504    type Proxy = DaiServiceProxy;
13505    type Request = DaiServiceRequest;
13506    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiService";
13507}
13508
13509/// A request for one of the member protocols of DaiService.
13510///
13511/// # Deprecation
13512///
13513/// Not supported anymore, instead use an
13514/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13515/// with one DAI and one Ring Buffer, see
13516/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13517#[cfg(target_os = "fuchsia")]
13518pub enum DaiServiceRequest {
13519    Dai(DaiRequestStream),
13520}
13521
13522#[cfg(target_os = "fuchsia")]
13523impl fidl::endpoints::ServiceRequest for DaiServiceRequest {
13524    type Service = DaiServiceMarker;
13525
13526    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13527        match name {
13528            "dai" => Self::Dai(<DaiRequestStream as fidl::endpoints::RequestStream>::from_channel(
13529                _channel,
13530            )),
13531            _ => panic!("no such member protocol name for service DaiService"),
13532        }
13533    }
13534
13535    fn member_names() -> &'static [&'static str] {
13536        &["dai"]
13537    }
13538}
13539/// # Deprecation
13540///
13541/// Not supported anymore, instead use an
13542/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13543/// with one DAI and one Ring Buffer, see
13544/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13545#[cfg(target_os = "fuchsia")]
13546pub struct DaiServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13547
13548#[cfg(target_os = "fuchsia")]
13549impl fidl::endpoints::ServiceProxy for DaiServiceProxy {
13550    type Service = DaiServiceMarker;
13551
13552    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13553        Self(opener)
13554    }
13555}
13556
13557#[cfg(target_os = "fuchsia")]
13558impl DaiServiceProxy {
13559    pub fn connect_to_dai(&self) -> Result<DaiProxy, fidl::Error> {
13560        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiMarker>();
13561        self.connect_channel_to_dai(server_end)?;
13562        Ok(proxy)
13563    }
13564
13565    /// Like `connect_to_dai`, but returns a sync proxy.
13566    /// See [`Self::connect_to_dai`] for more details.
13567    pub fn connect_to_dai_sync(&self) -> Result<DaiSynchronousProxy, fidl::Error> {
13568        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiMarker>();
13569        self.connect_channel_to_dai(server_end)?;
13570        Ok(proxy)
13571    }
13572
13573    /// Like `connect_to_dai`, but accepts a server end.
13574    /// See [`Self::connect_to_dai`] for more details.
13575    pub fn connect_channel_to_dai(
13576        &self,
13577        server_end: fidl::endpoints::ServerEnd<DaiMarker>,
13578    ) -> Result<(), fidl::Error> {
13579        self.0.open_member("dai", server_end.into_channel())
13580    }
13581
13582    pub fn instance_name(&self) -> &str {
13583        self.0.instance_name()
13584    }
13585}
13586
13587#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13588pub struct DeviceServiceMarker;
13589
13590#[cfg(target_os = "fuchsia")]
13591impl fidl::endpoints::ServiceMarker for DeviceServiceMarker {
13592    type Proxy = DeviceServiceProxy;
13593    type Request = DeviceServiceRequest;
13594    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DeviceService";
13595}
13596
13597/// A request for one of the member protocols of DeviceService.
13598///
13599#[cfg(target_os = "fuchsia")]
13600pub enum DeviceServiceRequest {
13601    Device(CompositeRequestStream),
13602}
13603
13604#[cfg(target_os = "fuchsia")]
13605impl fidl::endpoints::ServiceRequest for DeviceServiceRequest {
13606    type Service = DeviceServiceMarker;
13607
13608    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13609        match name {
13610            "device" => Self::Device(
13611                <CompositeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13612            ),
13613            _ => panic!("no such member protocol name for service DeviceService"),
13614        }
13615    }
13616
13617    fn member_names() -> &'static [&'static str] {
13618        &["device"]
13619    }
13620}
13621#[cfg(target_os = "fuchsia")]
13622pub struct DeviceServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13623
13624#[cfg(target_os = "fuchsia")]
13625impl fidl::endpoints::ServiceProxy for DeviceServiceProxy {
13626    type Service = DeviceServiceMarker;
13627
13628    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13629        Self(opener)
13630    }
13631}
13632
13633#[cfg(target_os = "fuchsia")]
13634impl DeviceServiceProxy {
13635    pub fn connect_to_device(&self) -> Result<CompositeProxy, fidl::Error> {
13636        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeMarker>();
13637        self.connect_channel_to_device(server_end)?;
13638        Ok(proxy)
13639    }
13640
13641    /// Like `connect_to_device`, but returns a sync proxy.
13642    /// See [`Self::connect_to_device`] for more details.
13643    pub fn connect_to_device_sync(&self) -> Result<CompositeSynchronousProxy, fidl::Error> {
13644        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeMarker>();
13645        self.connect_channel_to_device(server_end)?;
13646        Ok(proxy)
13647    }
13648
13649    /// Like `connect_to_device`, but accepts a server end.
13650    /// See [`Self::connect_to_device`] for more details.
13651    pub fn connect_channel_to_device(
13652        &self,
13653        server_end: fidl::endpoints::ServerEnd<CompositeMarker>,
13654    ) -> Result<(), fidl::Error> {
13655        self.0.open_member("device", server_end.into_channel())
13656    }
13657
13658    pub fn instance_name(&self) -> &str {
13659        self.0.instance_name()
13660    }
13661}
13662
13663#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13664pub struct StreamConfigConnectorInputServiceMarker;
13665
13666#[cfg(target_os = "fuchsia")]
13667impl fidl::endpoints::ServiceMarker for StreamConfigConnectorInputServiceMarker {
13668    type Proxy = StreamConfigConnectorInputServiceProxy;
13669    type Request = StreamConfigConnectorInputServiceRequest;
13670    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorInputService";
13671}
13672
13673/// A request for one of the member protocols of StreamConfigConnectorInputService.
13674///
13675#[cfg(target_os = "fuchsia")]
13676pub enum StreamConfigConnectorInputServiceRequest {
13677    StreamConfigConnector(StreamConfigConnectorRequestStream),
13678}
13679
13680#[cfg(target_os = "fuchsia")]
13681impl fidl::endpoints::ServiceRequest for StreamConfigConnectorInputServiceRequest {
13682    type Service = StreamConfigConnectorInputServiceMarker;
13683
13684    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13685        match name {
13686            "stream_config_connector" => Self::StreamConfigConnector(
13687                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13688            ),
13689            _ => panic!("no such member protocol name for service StreamConfigConnectorInputService"),
13690        }
13691    }
13692
13693    fn member_names() -> &'static [&'static str] {
13694        &["stream_config_connector"]
13695    }
13696}
13697#[cfg(target_os = "fuchsia")]
13698pub struct StreamConfigConnectorInputServiceProxy(
13699    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13700);
13701
13702#[cfg(target_os = "fuchsia")]
13703impl fidl::endpoints::ServiceProxy for StreamConfigConnectorInputServiceProxy {
13704    type Service = StreamConfigConnectorInputServiceMarker;
13705
13706    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13707        Self(opener)
13708    }
13709}
13710
13711#[cfg(target_os = "fuchsia")]
13712impl StreamConfigConnectorInputServiceProxy {
13713    pub fn connect_to_stream_config_connector(
13714        &self,
13715    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13716        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13717        self.connect_channel_to_stream_config_connector(server_end)?;
13718        Ok(proxy)
13719    }
13720
13721    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13722    /// See [`Self::connect_to_stream_config_connector`] for more details.
13723    pub fn connect_to_stream_config_connector_sync(
13724        &self,
13725    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13726        let (proxy, server_end) =
13727            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13728        self.connect_channel_to_stream_config_connector(server_end)?;
13729        Ok(proxy)
13730    }
13731
13732    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13733    /// See [`Self::connect_to_stream_config_connector`] for more details.
13734    pub fn connect_channel_to_stream_config_connector(
13735        &self,
13736        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13737    ) -> Result<(), fidl::Error> {
13738        self.0.open_member("stream_config_connector", server_end.into_channel())
13739    }
13740
13741    pub fn instance_name(&self) -> &str {
13742        self.0.instance_name()
13743    }
13744}
13745
13746#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13747pub struct StreamConfigConnectorOutputServiceMarker;
13748
13749#[cfg(target_os = "fuchsia")]
13750impl fidl::endpoints::ServiceMarker for StreamConfigConnectorOutputServiceMarker {
13751    type Proxy = StreamConfigConnectorOutputServiceProxy;
13752    type Request = StreamConfigConnectorOutputServiceRequest;
13753    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorOutputService";
13754}
13755
13756/// A request for one of the member protocols of StreamConfigConnectorOutputService.
13757///
13758#[cfg(target_os = "fuchsia")]
13759pub enum StreamConfigConnectorOutputServiceRequest {
13760    StreamConfigConnector(StreamConfigConnectorRequestStream),
13761}
13762
13763#[cfg(target_os = "fuchsia")]
13764impl fidl::endpoints::ServiceRequest for StreamConfigConnectorOutputServiceRequest {
13765    type Service = StreamConfigConnectorOutputServiceMarker;
13766
13767    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13768        match name {
13769            "stream_config_connector" => Self::StreamConfigConnector(
13770                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13771            ),
13772            _ => panic!("no such member protocol name for service StreamConfigConnectorOutputService"),
13773        }
13774    }
13775
13776    fn member_names() -> &'static [&'static str] {
13777        &["stream_config_connector"]
13778    }
13779}
13780#[cfg(target_os = "fuchsia")]
13781pub struct StreamConfigConnectorOutputServiceProxy(
13782    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13783);
13784
13785#[cfg(target_os = "fuchsia")]
13786impl fidl::endpoints::ServiceProxy for StreamConfigConnectorOutputServiceProxy {
13787    type Service = StreamConfigConnectorOutputServiceMarker;
13788
13789    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13790        Self(opener)
13791    }
13792}
13793
13794#[cfg(target_os = "fuchsia")]
13795impl StreamConfigConnectorOutputServiceProxy {
13796    pub fn connect_to_stream_config_connector(
13797        &self,
13798    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13799        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13800        self.connect_channel_to_stream_config_connector(server_end)?;
13801        Ok(proxy)
13802    }
13803
13804    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13805    /// See [`Self::connect_to_stream_config_connector`] for more details.
13806    pub fn connect_to_stream_config_connector_sync(
13807        &self,
13808    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13809        let (proxy, server_end) =
13810            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13811        self.connect_channel_to_stream_config_connector(server_end)?;
13812        Ok(proxy)
13813    }
13814
13815    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13816    /// See [`Self::connect_to_stream_config_connector`] for more details.
13817    pub fn connect_channel_to_stream_config_connector(
13818        &self,
13819        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13820    ) -> Result<(), fidl::Error> {
13821        self.0.open_member("stream_config_connector", server_end.into_channel())
13822    }
13823
13824    pub fn instance_name(&self) -> &str {
13825        self.0.instance_name()
13826    }
13827}
13828
13829#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13830pub struct StreamConfigConnectorServiceMarker;
13831
13832#[cfg(target_os = "fuchsia")]
13833impl fidl::endpoints::ServiceMarker for StreamConfigConnectorServiceMarker {
13834    type Proxy = StreamConfigConnectorServiceProxy;
13835    type Request = StreamConfigConnectorServiceRequest;
13836    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorService";
13837}
13838
13839/// A request for one of the member protocols of StreamConfigConnectorService.
13840///
13841/// # Deprecation
13842///
13843/// Not supported anymore, instead use an
13844/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13845/// with one Ring Buffer, see
13846/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13847#[cfg(target_os = "fuchsia")]
13848pub enum StreamConfigConnectorServiceRequest {
13849    StreamConfigConnector(StreamConfigConnectorRequestStream),
13850}
13851
13852#[cfg(target_os = "fuchsia")]
13853impl fidl::endpoints::ServiceRequest for StreamConfigConnectorServiceRequest {
13854    type Service = StreamConfigConnectorServiceMarker;
13855
13856    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13857        match name {
13858            "stream_config_connector" => Self::StreamConfigConnector(
13859                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13860            ),
13861            _ => panic!("no such member protocol name for service StreamConfigConnectorService"),
13862        }
13863    }
13864
13865    fn member_names() -> &'static [&'static str] {
13866        &["stream_config_connector"]
13867    }
13868}
13869/// # Deprecation
13870///
13871/// Not supported anymore, instead use an
13872/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13873/// with one Ring Buffer, see
13874/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13875#[cfg(target_os = "fuchsia")]
13876pub struct StreamConfigConnectorServiceProxy(
13877    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13878);
13879
13880#[cfg(target_os = "fuchsia")]
13881impl fidl::endpoints::ServiceProxy for StreamConfigConnectorServiceProxy {
13882    type Service = StreamConfigConnectorServiceMarker;
13883
13884    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13885        Self(opener)
13886    }
13887}
13888
13889#[cfg(target_os = "fuchsia")]
13890impl StreamConfigConnectorServiceProxy {
13891    pub fn connect_to_stream_config_connector(
13892        &self,
13893    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13894        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13895        self.connect_channel_to_stream_config_connector(server_end)?;
13896        Ok(proxy)
13897    }
13898
13899    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13900    /// See [`Self::connect_to_stream_config_connector`] for more details.
13901    pub fn connect_to_stream_config_connector_sync(
13902        &self,
13903    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13904        let (proxy, server_end) =
13905            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13906        self.connect_channel_to_stream_config_connector(server_end)?;
13907        Ok(proxy)
13908    }
13909
13910    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13911    /// See [`Self::connect_to_stream_config_connector`] for more details.
13912    pub fn connect_channel_to_stream_config_connector(
13913        &self,
13914        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13915    ) -> Result<(), fidl::Error> {
13916        self.0.open_member("stream_config_connector", server_end.into_channel())
13917    }
13918
13919    pub fn instance_name(&self) -> &str {
13920        self.0.instance_name()
13921    }
13922}
13923
13924#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13925pub struct StreamConfigServiceMarker;
13926
13927#[cfg(target_os = "fuchsia")]
13928impl fidl::endpoints::ServiceMarker for StreamConfigServiceMarker {
13929    type Proxy = StreamConfigServiceProxy;
13930    type Request = StreamConfigServiceRequest;
13931    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigService";
13932}
13933
13934/// A request for one of the member protocols of StreamConfigService.
13935///
13936/// # Deprecation
13937///
13938/// Not supported anymore, instead use an
13939/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13940/// with one Ring Buffer, see
13941/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13942#[cfg(target_os = "fuchsia")]
13943pub enum StreamConfigServiceRequest {
13944    StreamConfig(StreamConfigRequestStream),
13945}
13946
13947#[cfg(target_os = "fuchsia")]
13948impl fidl::endpoints::ServiceRequest for StreamConfigServiceRequest {
13949    type Service = StreamConfigServiceMarker;
13950
13951    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13952        match name {
13953            "stream_config" => Self::StreamConfig(
13954                <StreamConfigRequestStream as fidl::endpoints::RequestStream>::from_channel(
13955                    _channel,
13956                ),
13957            ),
13958            _ => panic!("no such member protocol name for service StreamConfigService"),
13959        }
13960    }
13961
13962    fn member_names() -> &'static [&'static str] {
13963        &["stream_config"]
13964    }
13965}
13966/// # Deprecation
13967///
13968/// Not supported anymore, instead use an
13969/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13970/// with one Ring Buffer, see
13971/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13972#[cfg(target_os = "fuchsia")]
13973pub struct StreamConfigServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13974
13975#[cfg(target_os = "fuchsia")]
13976impl fidl::endpoints::ServiceProxy for StreamConfigServiceProxy {
13977    type Service = StreamConfigServiceMarker;
13978
13979    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13980        Self(opener)
13981    }
13982}
13983
13984#[cfg(target_os = "fuchsia")]
13985impl StreamConfigServiceProxy {
13986    pub fn connect_to_stream_config(&self) -> Result<StreamConfigProxy, fidl::Error> {
13987        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigMarker>();
13988        self.connect_channel_to_stream_config(server_end)?;
13989        Ok(proxy)
13990    }
13991
13992    /// Like `connect_to_stream_config`, but returns a sync proxy.
13993    /// See [`Self::connect_to_stream_config`] for more details.
13994    pub fn connect_to_stream_config_sync(
13995        &self,
13996    ) -> Result<StreamConfigSynchronousProxy, fidl::Error> {
13997        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<StreamConfigMarker>();
13998        self.connect_channel_to_stream_config(server_end)?;
13999        Ok(proxy)
14000    }
14001
14002    /// Like `connect_to_stream_config`, but accepts a server end.
14003    /// See [`Self::connect_to_stream_config`] for more details.
14004    pub fn connect_channel_to_stream_config(
14005        &self,
14006        server_end: fidl::endpoints::ServerEnd<StreamConfigMarker>,
14007    ) -> Result<(), fidl::Error> {
14008        self.0.open_member("stream_config", server_end.into_channel())
14009    }
14010
14011    pub fn instance_name(&self) -> &str {
14012        self.0.instance_name()
14013    }
14014}
14015
14016mod internal {
14017    use super::*;
14018
14019    impl fidl::encoding::ResourceTypeMarker for CodecConnectorConnectRequest {
14020        type Borrowed<'a> = &'a mut Self;
14021        fn take_or_borrow<'a>(
14022            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14023        ) -> Self::Borrowed<'a> {
14024            value
14025        }
14026    }
14027
14028    unsafe impl fidl::encoding::TypeMarker for CodecConnectorConnectRequest {
14029        type Owned = Self;
14030
14031        #[inline(always)]
14032        fn inline_align(_context: fidl::encoding::Context) -> usize {
14033            4
14034        }
14035
14036        #[inline(always)]
14037        fn inline_size(_context: fidl::encoding::Context) -> usize {
14038            4
14039        }
14040    }
14041
14042    unsafe impl
14043        fidl::encoding::Encode<
14044            CodecConnectorConnectRequest,
14045            fidl::encoding::DefaultFuchsiaResourceDialect,
14046        > for &mut CodecConnectorConnectRequest
14047    {
14048        #[inline]
14049        unsafe fn encode(
14050            self,
14051            encoder: &mut fidl::encoding::Encoder<
14052                '_,
14053                fidl::encoding::DefaultFuchsiaResourceDialect,
14054            >,
14055            offset: usize,
14056            _depth: fidl::encoding::Depth,
14057        ) -> fidl::Result<()> {
14058            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
14059            // Delegate to tuple encoding.
14060            fidl::encoding::Encode::<CodecConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14061                (
14062                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.codec_protocol),
14063                ),
14064                encoder, offset, _depth
14065            )
14066        }
14067    }
14068    unsafe impl<
14069        T0: fidl::encoding::Encode<
14070                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14071                fidl::encoding::DefaultFuchsiaResourceDialect,
14072            >,
14073    >
14074        fidl::encoding::Encode<
14075            CodecConnectorConnectRequest,
14076            fidl::encoding::DefaultFuchsiaResourceDialect,
14077        > for (T0,)
14078    {
14079        #[inline]
14080        unsafe fn encode(
14081            self,
14082            encoder: &mut fidl::encoding::Encoder<
14083                '_,
14084                fidl::encoding::DefaultFuchsiaResourceDialect,
14085            >,
14086            offset: usize,
14087            depth: fidl::encoding::Depth,
14088        ) -> fidl::Result<()> {
14089            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
14090            // Zero out padding regions. There's no need to apply masks
14091            // because the unmasked parts will be overwritten by fields.
14092            // Write the fields.
14093            self.0.encode(encoder, offset + 0, depth)?;
14094            Ok(())
14095        }
14096    }
14097
14098    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14099        for CodecConnectorConnectRequest
14100    {
14101        #[inline(always)]
14102        fn new_empty() -> Self {
14103            Self {
14104                codec_protocol: fidl::new_empty!(
14105                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14106                    fidl::encoding::DefaultFuchsiaResourceDialect
14107                ),
14108            }
14109        }
14110
14111        #[inline]
14112        unsafe fn decode(
14113            &mut self,
14114            decoder: &mut fidl::encoding::Decoder<
14115                '_,
14116                fidl::encoding::DefaultFuchsiaResourceDialect,
14117            >,
14118            offset: usize,
14119            _depth: fidl::encoding::Depth,
14120        ) -> fidl::Result<()> {
14121            decoder.debug_check_bounds::<Self>(offset);
14122            // Verify that padding bytes are zero.
14123            fidl::decode!(
14124                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14125                fidl::encoding::DefaultFuchsiaResourceDialect,
14126                &mut self.codec_protocol,
14127                decoder,
14128                offset + 0,
14129                _depth
14130            )?;
14131            Ok(())
14132        }
14133    }
14134
14135    impl fidl::encoding::ResourceTypeMarker for CompositeConnectorConnectRequest {
14136        type Borrowed<'a> = &'a mut Self;
14137        fn take_or_borrow<'a>(
14138            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14139        ) -> Self::Borrowed<'a> {
14140            value
14141        }
14142    }
14143
14144    unsafe impl fidl::encoding::TypeMarker for CompositeConnectorConnectRequest {
14145        type Owned = Self;
14146
14147        #[inline(always)]
14148        fn inline_align(_context: fidl::encoding::Context) -> usize {
14149            4
14150        }
14151
14152        #[inline(always)]
14153        fn inline_size(_context: fidl::encoding::Context) -> usize {
14154            4
14155        }
14156    }
14157
14158    unsafe impl
14159        fidl::encoding::Encode<
14160            CompositeConnectorConnectRequest,
14161            fidl::encoding::DefaultFuchsiaResourceDialect,
14162        > for &mut CompositeConnectorConnectRequest
14163    {
14164        #[inline]
14165        unsafe fn encode(
14166            self,
14167            encoder: &mut fidl::encoding::Encoder<
14168                '_,
14169                fidl::encoding::DefaultFuchsiaResourceDialect,
14170            >,
14171            offset: usize,
14172            _depth: fidl::encoding::Depth,
14173        ) -> fidl::Result<()> {
14174            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
14175            // Delegate to tuple encoding.
14176            fidl::encoding::Encode::<CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14177                (
14178                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.composite_protocol),
14179                ),
14180                encoder, offset, _depth
14181            )
14182        }
14183    }
14184    unsafe impl<
14185        T0: fidl::encoding::Encode<
14186                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14187                fidl::encoding::DefaultFuchsiaResourceDialect,
14188            >,
14189    >
14190        fidl::encoding::Encode<
14191            CompositeConnectorConnectRequest,
14192            fidl::encoding::DefaultFuchsiaResourceDialect,
14193        > for (T0,)
14194    {
14195        #[inline]
14196        unsafe fn encode(
14197            self,
14198            encoder: &mut fidl::encoding::Encoder<
14199                '_,
14200                fidl::encoding::DefaultFuchsiaResourceDialect,
14201            >,
14202            offset: usize,
14203            depth: fidl::encoding::Depth,
14204        ) -> fidl::Result<()> {
14205            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
14206            // Zero out padding regions. There's no need to apply masks
14207            // because the unmasked parts will be overwritten by fields.
14208            // Write the fields.
14209            self.0.encode(encoder, offset + 0, depth)?;
14210            Ok(())
14211        }
14212    }
14213
14214    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14215        for CompositeConnectorConnectRequest
14216    {
14217        #[inline(always)]
14218        fn new_empty() -> Self {
14219            Self {
14220                composite_protocol: fidl::new_empty!(
14221                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14222                    fidl::encoding::DefaultFuchsiaResourceDialect
14223                ),
14224            }
14225        }
14226
14227        #[inline]
14228        unsafe fn decode(
14229            &mut self,
14230            decoder: &mut fidl::encoding::Decoder<
14231                '_,
14232                fidl::encoding::DefaultFuchsiaResourceDialect,
14233            >,
14234            offset: usize,
14235            _depth: fidl::encoding::Depth,
14236        ) -> fidl::Result<()> {
14237            decoder.debug_check_bounds::<Self>(offset);
14238            // Verify that padding bytes are zero.
14239            fidl::decode!(
14240                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14241                fidl::encoding::DefaultFuchsiaResourceDialect,
14242                &mut self.composite_protocol,
14243                decoder,
14244                offset + 0,
14245                _depth
14246            )?;
14247            Ok(())
14248        }
14249    }
14250
14251    impl fidl::encoding::ResourceTypeMarker for CompositeCreatePacketStreamRequest {
14252        type Borrowed<'a> = &'a mut Self;
14253        fn take_or_borrow<'a>(
14254            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14255        ) -> Self::Borrowed<'a> {
14256            value
14257        }
14258    }
14259
14260    unsafe impl fidl::encoding::TypeMarker for CompositeCreatePacketStreamRequest {
14261        type Owned = Self;
14262
14263        #[inline(always)]
14264        fn inline_align(_context: fidl::encoding::Context) -> usize {
14265            8
14266        }
14267
14268        #[inline(always)]
14269        fn inline_size(_context: fidl::encoding::Context) -> usize {
14270            32
14271        }
14272    }
14273
14274    unsafe impl
14275        fidl::encoding::Encode<
14276            CompositeCreatePacketStreamRequest,
14277            fidl::encoding::DefaultFuchsiaResourceDialect,
14278        > for &mut CompositeCreatePacketStreamRequest
14279    {
14280        #[inline]
14281        unsafe fn encode(
14282            self,
14283            encoder: &mut fidl::encoding::Encoder<
14284                '_,
14285                fidl::encoding::DefaultFuchsiaResourceDialect,
14286            >,
14287            offset: usize,
14288            _depth: fidl::encoding::Depth,
14289        ) -> fidl::Result<()> {
14290            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
14291            // Delegate to tuple encoding.
14292            fidl::encoding::Encode::<CompositeCreatePacketStreamRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14293                (
14294                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
14295                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
14296                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.packet_stream_control),
14297                ),
14298                encoder, offset, _depth
14299            )
14300        }
14301    }
14302    unsafe impl<
14303        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
14304        T1: fidl::encoding::Encode<Format2, fidl::encoding::DefaultFuchsiaResourceDialect>,
14305        T2: fidl::encoding::Encode<
14306                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14307                fidl::encoding::DefaultFuchsiaResourceDialect,
14308            >,
14309    >
14310        fidl::encoding::Encode<
14311            CompositeCreatePacketStreamRequest,
14312            fidl::encoding::DefaultFuchsiaResourceDialect,
14313        > for (T0, T1, T2)
14314    {
14315        #[inline]
14316        unsafe fn encode(
14317            self,
14318            encoder: &mut fidl::encoding::Encoder<
14319                '_,
14320                fidl::encoding::DefaultFuchsiaResourceDialect,
14321            >,
14322            offset: usize,
14323            depth: fidl::encoding::Depth,
14324        ) -> fidl::Result<()> {
14325            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
14326            // Zero out padding regions. There's no need to apply masks
14327            // because the unmasked parts will be overwritten by fields.
14328            unsafe {
14329                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
14330                (ptr as *mut u64).write_unaligned(0);
14331            }
14332            // Write the fields.
14333            self.0.encode(encoder, offset + 0, depth)?;
14334            self.1.encode(encoder, offset + 8, depth)?;
14335            self.2.encode(encoder, offset + 24, depth)?;
14336            Ok(())
14337        }
14338    }
14339
14340    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14341        for CompositeCreatePacketStreamRequest
14342    {
14343        #[inline(always)]
14344        fn new_empty() -> Self {
14345            Self {
14346                processing_element_id: fidl::new_empty!(
14347                    u64,
14348                    fidl::encoding::DefaultFuchsiaResourceDialect
14349                ),
14350                format: fidl::new_empty!(Format2, fidl::encoding::DefaultFuchsiaResourceDialect),
14351                packet_stream_control: fidl::new_empty!(
14352                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14353                    fidl::encoding::DefaultFuchsiaResourceDialect
14354                ),
14355            }
14356        }
14357
14358        #[inline]
14359        unsafe fn decode(
14360            &mut self,
14361            decoder: &mut fidl::encoding::Decoder<
14362                '_,
14363                fidl::encoding::DefaultFuchsiaResourceDialect,
14364            >,
14365            offset: usize,
14366            _depth: fidl::encoding::Depth,
14367        ) -> fidl::Result<()> {
14368            decoder.debug_check_bounds::<Self>(offset);
14369            // Verify that padding bytes are zero.
14370            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
14371            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14372            let mask = 0xffffffff00000000u64;
14373            let maskedval = padval & mask;
14374            if maskedval != 0 {
14375                return Err(fidl::Error::NonZeroPadding {
14376                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
14377                });
14378            }
14379            fidl::decode!(
14380                u64,
14381                fidl::encoding::DefaultFuchsiaResourceDialect,
14382                &mut self.processing_element_id,
14383                decoder,
14384                offset + 0,
14385                _depth
14386            )?;
14387            fidl::decode!(
14388                Format2,
14389                fidl::encoding::DefaultFuchsiaResourceDialect,
14390                &mut self.format,
14391                decoder,
14392                offset + 8,
14393                _depth
14394            )?;
14395            fidl::decode!(
14396                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14397                fidl::encoding::DefaultFuchsiaResourceDialect,
14398                &mut self.packet_stream_control,
14399                decoder,
14400                offset + 24,
14401                _depth
14402            )?;
14403            Ok(())
14404        }
14405    }
14406
14407    impl fidl::encoding::ResourceTypeMarker for CompositeCreateRingBufferRequest {
14408        type Borrowed<'a> = &'a mut Self;
14409        fn take_or_borrow<'a>(
14410            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14411        ) -> Self::Borrowed<'a> {
14412            value
14413        }
14414    }
14415
14416    unsafe impl fidl::encoding::TypeMarker for CompositeCreateRingBufferRequest {
14417        type Owned = Self;
14418
14419        #[inline(always)]
14420        fn inline_align(_context: fidl::encoding::Context) -> usize {
14421            8
14422        }
14423
14424        #[inline(always)]
14425        fn inline_size(_context: fidl::encoding::Context) -> usize {
14426            32
14427        }
14428    }
14429
14430    unsafe impl
14431        fidl::encoding::Encode<
14432            CompositeCreateRingBufferRequest,
14433            fidl::encoding::DefaultFuchsiaResourceDialect,
14434        > for &mut CompositeCreateRingBufferRequest
14435    {
14436        #[inline]
14437        unsafe fn encode(
14438            self,
14439            encoder: &mut fidl::encoding::Encoder<
14440                '_,
14441                fidl::encoding::DefaultFuchsiaResourceDialect,
14442            >,
14443            offset: usize,
14444            _depth: fidl::encoding::Depth,
14445        ) -> fidl::Result<()> {
14446            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
14447            // Delegate to tuple encoding.
14448            fidl::encoding::Encode::<CompositeCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14449                (
14450                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
14451                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
14452                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
14453                ),
14454                encoder, offset, _depth
14455            )
14456        }
14457    }
14458    unsafe impl<
14459        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
14460        T1: fidl::encoding::Encode<Format2, fidl::encoding::DefaultFuchsiaResourceDialect>,
14461        T2: fidl::encoding::Encode<
14462                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14463                fidl::encoding::DefaultFuchsiaResourceDialect,
14464            >,
14465    >
14466        fidl::encoding::Encode<
14467            CompositeCreateRingBufferRequest,
14468            fidl::encoding::DefaultFuchsiaResourceDialect,
14469        > for (T0, T1, T2)
14470    {
14471        #[inline]
14472        unsafe fn encode(
14473            self,
14474            encoder: &mut fidl::encoding::Encoder<
14475                '_,
14476                fidl::encoding::DefaultFuchsiaResourceDialect,
14477            >,
14478            offset: usize,
14479            depth: fidl::encoding::Depth,
14480        ) -> fidl::Result<()> {
14481            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
14482            // Zero out padding regions. There's no need to apply masks
14483            // because the unmasked parts will be overwritten by fields.
14484            unsafe {
14485                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
14486                (ptr as *mut u64).write_unaligned(0);
14487            }
14488            // Write the fields.
14489            self.0.encode(encoder, offset + 0, depth)?;
14490            self.1.encode(encoder, offset + 8, depth)?;
14491            self.2.encode(encoder, offset + 24, depth)?;
14492            Ok(())
14493        }
14494    }
14495
14496    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14497        for CompositeCreateRingBufferRequest
14498    {
14499        #[inline(always)]
14500        fn new_empty() -> Self {
14501            Self {
14502                processing_element_id: fidl::new_empty!(
14503                    u64,
14504                    fidl::encoding::DefaultFuchsiaResourceDialect
14505                ),
14506                format: fidl::new_empty!(Format2, fidl::encoding::DefaultFuchsiaResourceDialect),
14507                ring_buffer: fidl::new_empty!(
14508                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14509                    fidl::encoding::DefaultFuchsiaResourceDialect
14510                ),
14511            }
14512        }
14513
14514        #[inline]
14515        unsafe fn decode(
14516            &mut self,
14517            decoder: &mut fidl::encoding::Decoder<
14518                '_,
14519                fidl::encoding::DefaultFuchsiaResourceDialect,
14520            >,
14521            offset: usize,
14522            _depth: fidl::encoding::Depth,
14523        ) -> fidl::Result<()> {
14524            decoder.debug_check_bounds::<Self>(offset);
14525            // Verify that padding bytes are zero.
14526            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
14527            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14528            let mask = 0xffffffff00000000u64;
14529            let maskedval = padval & mask;
14530            if maskedval != 0 {
14531                return Err(fidl::Error::NonZeroPadding {
14532                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
14533                });
14534            }
14535            fidl::decode!(
14536                u64,
14537                fidl::encoding::DefaultFuchsiaResourceDialect,
14538                &mut self.processing_element_id,
14539                decoder,
14540                offset + 0,
14541                _depth
14542            )?;
14543            fidl::decode!(
14544                Format2,
14545                fidl::encoding::DefaultFuchsiaResourceDialect,
14546                &mut self.format,
14547                decoder,
14548                offset + 8,
14549                _depth
14550            )?;
14551            fidl::decode!(
14552                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14553                fidl::encoding::DefaultFuchsiaResourceDialect,
14554                &mut self.ring_buffer,
14555                decoder,
14556                offset + 24,
14557                _depth
14558            )?;
14559            Ok(())
14560        }
14561    }
14562
14563    impl fidl::encoding::ResourceTypeMarker for DaiConnectorConnectRequest {
14564        type Borrowed<'a> = &'a mut Self;
14565        fn take_or_borrow<'a>(
14566            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14567        ) -> Self::Borrowed<'a> {
14568            value
14569        }
14570    }
14571
14572    unsafe impl fidl::encoding::TypeMarker for DaiConnectorConnectRequest {
14573        type Owned = Self;
14574
14575        #[inline(always)]
14576        fn inline_align(_context: fidl::encoding::Context) -> usize {
14577            4
14578        }
14579
14580        #[inline(always)]
14581        fn inline_size(_context: fidl::encoding::Context) -> usize {
14582            4
14583        }
14584    }
14585
14586    unsafe impl
14587        fidl::encoding::Encode<
14588            DaiConnectorConnectRequest,
14589            fidl::encoding::DefaultFuchsiaResourceDialect,
14590        > for &mut DaiConnectorConnectRequest
14591    {
14592        #[inline]
14593        unsafe fn encode(
14594            self,
14595            encoder: &mut fidl::encoding::Encoder<
14596                '_,
14597                fidl::encoding::DefaultFuchsiaResourceDialect,
14598            >,
14599            offset: usize,
14600            _depth: fidl::encoding::Depth,
14601        ) -> fidl::Result<()> {
14602            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
14603            // Delegate to tuple encoding.
14604            fidl::encoding::Encode::<DaiConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14605                (
14606                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dai_protocol),
14607                ),
14608                encoder, offset, _depth
14609            )
14610        }
14611    }
14612    unsafe impl<
14613        T0: fidl::encoding::Encode<
14614                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14615                fidl::encoding::DefaultFuchsiaResourceDialect,
14616            >,
14617    >
14618        fidl::encoding::Encode<
14619            DaiConnectorConnectRequest,
14620            fidl::encoding::DefaultFuchsiaResourceDialect,
14621        > for (T0,)
14622    {
14623        #[inline]
14624        unsafe fn encode(
14625            self,
14626            encoder: &mut fidl::encoding::Encoder<
14627                '_,
14628                fidl::encoding::DefaultFuchsiaResourceDialect,
14629            >,
14630            offset: usize,
14631            depth: fidl::encoding::Depth,
14632        ) -> fidl::Result<()> {
14633            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
14634            // Zero out padding regions. There's no need to apply masks
14635            // because the unmasked parts will be overwritten by fields.
14636            // Write the fields.
14637            self.0.encode(encoder, offset + 0, depth)?;
14638            Ok(())
14639        }
14640    }
14641
14642    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14643        for DaiConnectorConnectRequest
14644    {
14645        #[inline(always)]
14646        fn new_empty() -> Self {
14647            Self {
14648                dai_protocol: fidl::new_empty!(
14649                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14650                    fidl::encoding::DefaultFuchsiaResourceDialect
14651                ),
14652            }
14653        }
14654
14655        #[inline]
14656        unsafe fn decode(
14657            &mut self,
14658            decoder: &mut fidl::encoding::Decoder<
14659                '_,
14660                fidl::encoding::DefaultFuchsiaResourceDialect,
14661            >,
14662            offset: usize,
14663            _depth: fidl::encoding::Depth,
14664        ) -> fidl::Result<()> {
14665            decoder.debug_check_bounds::<Self>(offset);
14666            // Verify that padding bytes are zero.
14667            fidl::decode!(
14668                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14669                fidl::encoding::DefaultFuchsiaResourceDialect,
14670                &mut self.dai_protocol,
14671                decoder,
14672                offset + 0,
14673                _depth
14674            )?;
14675            Ok(())
14676        }
14677    }
14678
14679    impl fidl::encoding::ResourceTypeMarker for DaiCreateRingBufferRequest {
14680        type Borrowed<'a> = &'a mut Self;
14681        fn take_or_borrow<'a>(
14682            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14683        ) -> Self::Borrowed<'a> {
14684            value
14685        }
14686    }
14687
14688    unsafe impl fidl::encoding::TypeMarker for DaiCreateRingBufferRequest {
14689        type Owned = Self;
14690
14691        #[inline(always)]
14692        fn inline_align(_context: fidl::encoding::Context) -> usize {
14693            8
14694        }
14695
14696        #[inline(always)]
14697        fn inline_size(_context: fidl::encoding::Context) -> usize {
14698            72
14699        }
14700    }
14701
14702    unsafe impl
14703        fidl::encoding::Encode<
14704            DaiCreateRingBufferRequest,
14705            fidl::encoding::DefaultFuchsiaResourceDialect,
14706        > for &mut DaiCreateRingBufferRequest
14707    {
14708        #[inline]
14709        unsafe fn encode(
14710            self,
14711            encoder: &mut fidl::encoding::Encoder<
14712                '_,
14713                fidl::encoding::DefaultFuchsiaResourceDialect,
14714            >,
14715            offset: usize,
14716            _depth: fidl::encoding::Depth,
14717        ) -> fidl::Result<()> {
14718            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
14719            // Delegate to tuple encoding.
14720            fidl::encoding::Encode::<DaiCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14721                (
14722                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_format),
14723                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_format),
14724                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
14725                ),
14726                encoder, offset, _depth
14727            )
14728        }
14729    }
14730    unsafe impl<
14731        T0: fidl::encoding::Encode<DaiFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
14732        T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
14733        T2: fidl::encoding::Encode<
14734                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14735                fidl::encoding::DefaultFuchsiaResourceDialect,
14736            >,
14737    >
14738        fidl::encoding::Encode<
14739            DaiCreateRingBufferRequest,
14740            fidl::encoding::DefaultFuchsiaResourceDialect,
14741        > for (T0, T1, T2)
14742    {
14743        #[inline]
14744        unsafe fn encode(
14745            self,
14746            encoder: &mut fidl::encoding::Encoder<
14747                '_,
14748                fidl::encoding::DefaultFuchsiaResourceDialect,
14749            >,
14750            offset: usize,
14751            depth: fidl::encoding::Depth,
14752        ) -> fidl::Result<()> {
14753            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
14754            // Zero out padding regions. There's no need to apply masks
14755            // because the unmasked parts will be overwritten by fields.
14756            unsafe {
14757                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
14758                (ptr as *mut u64).write_unaligned(0);
14759            }
14760            // Write the fields.
14761            self.0.encode(encoder, offset + 0, depth)?;
14762            self.1.encode(encoder, offset + 48, depth)?;
14763            self.2.encode(encoder, offset + 64, depth)?;
14764            Ok(())
14765        }
14766    }
14767
14768    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14769        for DaiCreateRingBufferRequest
14770    {
14771        #[inline(always)]
14772        fn new_empty() -> Self {
14773            Self {
14774                dai_format: fidl::new_empty!(
14775                    DaiFormat,
14776                    fidl::encoding::DefaultFuchsiaResourceDialect
14777                ),
14778                ring_buffer_format: fidl::new_empty!(
14779                    Format,
14780                    fidl::encoding::DefaultFuchsiaResourceDialect
14781                ),
14782                ring_buffer: fidl::new_empty!(
14783                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14784                    fidl::encoding::DefaultFuchsiaResourceDialect
14785                ),
14786            }
14787        }
14788
14789        #[inline]
14790        unsafe fn decode(
14791            &mut self,
14792            decoder: &mut fidl::encoding::Decoder<
14793                '_,
14794                fidl::encoding::DefaultFuchsiaResourceDialect,
14795            >,
14796            offset: usize,
14797            _depth: fidl::encoding::Depth,
14798        ) -> fidl::Result<()> {
14799            decoder.debug_check_bounds::<Self>(offset);
14800            // Verify that padding bytes are zero.
14801            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
14802            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14803            let mask = 0xffffffff00000000u64;
14804            let maskedval = padval & mask;
14805            if maskedval != 0 {
14806                return Err(fidl::Error::NonZeroPadding {
14807                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
14808                });
14809            }
14810            fidl::decode!(
14811                DaiFormat,
14812                fidl::encoding::DefaultFuchsiaResourceDialect,
14813                &mut self.dai_format,
14814                decoder,
14815                offset + 0,
14816                _depth
14817            )?;
14818            fidl::decode!(
14819                Format,
14820                fidl::encoding::DefaultFuchsiaResourceDialect,
14821                &mut self.ring_buffer_format,
14822                decoder,
14823                offset + 48,
14824                _depth
14825            )?;
14826            fidl::decode!(
14827                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14828                fidl::encoding::DefaultFuchsiaResourceDialect,
14829                &mut self.ring_buffer,
14830                decoder,
14831                offset + 64,
14832                _depth
14833            )?;
14834            Ok(())
14835        }
14836    }
14837
14838    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlAllocateVmosResponse {
14839        type Borrowed<'a> = &'a mut Self;
14840        fn take_or_borrow<'a>(
14841            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14842        ) -> Self::Borrowed<'a> {
14843            value
14844        }
14845    }
14846
14847    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlAllocateVmosResponse {
14848        type Owned = Self;
14849
14850        #[inline(always)]
14851        fn inline_align(_context: fidl::encoding::Context) -> usize {
14852            8
14853        }
14854
14855        #[inline(always)]
14856        fn inline_size(_context: fidl::encoding::Context) -> usize {
14857            16
14858        }
14859    }
14860
14861    unsafe impl
14862        fidl::encoding::Encode<
14863            PacketStreamControlAllocateVmosResponse,
14864            fidl::encoding::DefaultFuchsiaResourceDialect,
14865        > for &mut PacketStreamControlAllocateVmosResponse
14866    {
14867        #[inline]
14868        unsafe fn encode(
14869            self,
14870            encoder: &mut fidl::encoding::Encoder<
14871                '_,
14872                fidl::encoding::DefaultFuchsiaResourceDialect,
14873            >,
14874            offset: usize,
14875            _depth: fidl::encoding::Depth,
14876        ) -> fidl::Result<()> {
14877            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
14878            // Delegate to tuple encoding.
14879            fidl::encoding::Encode::<PacketStreamControlAllocateVmosResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14880                (
14881                    <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmos),
14882                ),
14883                encoder, offset, _depth
14884            )
14885        }
14886    }
14887    unsafe impl<
14888        T0: fidl::encoding::Encode<
14889                fidl::encoding::Vector<VmoInfo, 256>,
14890                fidl::encoding::DefaultFuchsiaResourceDialect,
14891            >,
14892    >
14893        fidl::encoding::Encode<
14894            PacketStreamControlAllocateVmosResponse,
14895            fidl::encoding::DefaultFuchsiaResourceDialect,
14896        > for (T0,)
14897    {
14898        #[inline]
14899        unsafe fn encode(
14900            self,
14901            encoder: &mut fidl::encoding::Encoder<
14902                '_,
14903                fidl::encoding::DefaultFuchsiaResourceDialect,
14904            >,
14905            offset: usize,
14906            depth: fidl::encoding::Depth,
14907        ) -> fidl::Result<()> {
14908            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
14909            // Zero out padding regions. There's no need to apply masks
14910            // because the unmasked parts will be overwritten by fields.
14911            // Write the fields.
14912            self.0.encode(encoder, offset + 0, depth)?;
14913            Ok(())
14914        }
14915    }
14916
14917    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14918        for PacketStreamControlAllocateVmosResponse
14919    {
14920        #[inline(always)]
14921        fn new_empty() -> Self {
14922            Self {
14923                vmos: fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect),
14924            }
14925        }
14926
14927        #[inline]
14928        unsafe fn decode(
14929            &mut self,
14930            decoder: &mut fidl::encoding::Decoder<
14931                '_,
14932                fidl::encoding::DefaultFuchsiaResourceDialect,
14933            >,
14934            offset: usize,
14935            _depth: fidl::encoding::Depth,
14936        ) -> fidl::Result<()> {
14937            decoder.debug_check_bounds::<Self>(offset);
14938            // Verify that padding bytes are zero.
14939            fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmos, decoder, offset + 0, _depth)?;
14940            Ok(())
14941        }
14942    }
14943
14944    impl fidl::encoding::ResourceTypeMarker for RingBufferGetVmoResponse {
14945        type Borrowed<'a> = &'a mut Self;
14946        fn take_or_borrow<'a>(
14947            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14948        ) -> Self::Borrowed<'a> {
14949            value
14950        }
14951    }
14952
14953    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoResponse {
14954        type Owned = Self;
14955
14956        #[inline(always)]
14957        fn inline_align(_context: fidl::encoding::Context) -> usize {
14958            4
14959        }
14960
14961        #[inline(always)]
14962        fn inline_size(_context: fidl::encoding::Context) -> usize {
14963            8
14964        }
14965    }
14966
14967    unsafe impl
14968        fidl::encoding::Encode<
14969            RingBufferGetVmoResponse,
14970            fidl::encoding::DefaultFuchsiaResourceDialect,
14971        > for &mut RingBufferGetVmoResponse
14972    {
14973        #[inline]
14974        unsafe fn encode(
14975            self,
14976            encoder: &mut fidl::encoding::Encoder<
14977                '_,
14978                fidl::encoding::DefaultFuchsiaResourceDialect,
14979            >,
14980            offset: usize,
14981            _depth: fidl::encoding::Depth,
14982        ) -> fidl::Result<()> {
14983            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
14984            // Delegate to tuple encoding.
14985            fidl::encoding::Encode::<
14986                RingBufferGetVmoResponse,
14987                fidl::encoding::DefaultFuchsiaResourceDialect,
14988            >::encode(
14989                (
14990                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_frames),
14991                    <fidl::encoding::HandleType<
14992                        fidl::Vmo,
14993                        { fidl::ObjectType::VMO.into_raw() },
14994                        2147483648,
14995                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14996                        &mut self.ring_buffer
14997                    ),
14998                ),
14999                encoder,
15000                offset,
15001                _depth,
15002            )
15003        }
15004    }
15005    unsafe impl<
15006        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
15007        T1: fidl::encoding::Encode<
15008                fidl::encoding::HandleType<
15009                    fidl::Vmo,
15010                    { fidl::ObjectType::VMO.into_raw() },
15011                    2147483648,
15012                >,
15013                fidl::encoding::DefaultFuchsiaResourceDialect,
15014            >,
15015    >
15016        fidl::encoding::Encode<
15017            RingBufferGetVmoResponse,
15018            fidl::encoding::DefaultFuchsiaResourceDialect,
15019        > for (T0, T1)
15020    {
15021        #[inline]
15022        unsafe fn encode(
15023            self,
15024            encoder: &mut fidl::encoding::Encoder<
15025                '_,
15026                fidl::encoding::DefaultFuchsiaResourceDialect,
15027            >,
15028            offset: usize,
15029            depth: fidl::encoding::Depth,
15030        ) -> fidl::Result<()> {
15031            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
15032            // Zero out padding regions. There's no need to apply masks
15033            // because the unmasked parts will be overwritten by fields.
15034            // Write the fields.
15035            self.0.encode(encoder, offset + 0, depth)?;
15036            self.1.encode(encoder, offset + 4, depth)?;
15037            Ok(())
15038        }
15039    }
15040
15041    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15042        for RingBufferGetVmoResponse
15043    {
15044        #[inline(always)]
15045        fn new_empty() -> Self {
15046            Self {
15047                num_frames: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
15048                ring_buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
15049            }
15050        }
15051
15052        #[inline]
15053        unsafe fn decode(
15054            &mut self,
15055            decoder: &mut fidl::encoding::Decoder<
15056                '_,
15057                fidl::encoding::DefaultFuchsiaResourceDialect,
15058            >,
15059            offset: usize,
15060            _depth: fidl::encoding::Depth,
15061        ) -> fidl::Result<()> {
15062            decoder.debug_check_bounds::<Self>(offset);
15063            // Verify that padding bytes are zero.
15064            fidl::decode!(
15065                u32,
15066                fidl::encoding::DefaultFuchsiaResourceDialect,
15067                &mut self.num_frames,
15068                decoder,
15069                offset + 0,
15070                _depth
15071            )?;
15072            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.ring_buffer, decoder, offset + 4, _depth)?;
15073            Ok(())
15074        }
15075    }
15076
15077    impl fidl::encoding::ResourceTypeMarker for StreamConfigConnectorConnectRequest {
15078        type Borrowed<'a> = &'a mut Self;
15079        fn take_or_borrow<'a>(
15080            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15081        ) -> Self::Borrowed<'a> {
15082            value
15083        }
15084    }
15085
15086    unsafe impl fidl::encoding::TypeMarker for StreamConfigConnectorConnectRequest {
15087        type Owned = Self;
15088
15089        #[inline(always)]
15090        fn inline_align(_context: fidl::encoding::Context) -> usize {
15091            4
15092        }
15093
15094        #[inline(always)]
15095        fn inline_size(_context: fidl::encoding::Context) -> usize {
15096            4
15097        }
15098    }
15099
15100    unsafe impl
15101        fidl::encoding::Encode<
15102            StreamConfigConnectorConnectRequest,
15103            fidl::encoding::DefaultFuchsiaResourceDialect,
15104        > for &mut StreamConfigConnectorConnectRequest
15105    {
15106        #[inline]
15107        unsafe fn encode(
15108            self,
15109            encoder: &mut fidl::encoding::Encoder<
15110                '_,
15111                fidl::encoding::DefaultFuchsiaResourceDialect,
15112            >,
15113            offset: usize,
15114            _depth: fidl::encoding::Depth,
15115        ) -> fidl::Result<()> {
15116            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
15117            // Delegate to tuple encoding.
15118            fidl::encoding::Encode::<StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15119                (
15120                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
15121                ),
15122                encoder, offset, _depth
15123            )
15124        }
15125    }
15126    unsafe impl<
15127        T0: fidl::encoding::Encode<
15128                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15129                fidl::encoding::DefaultFuchsiaResourceDialect,
15130            >,
15131    >
15132        fidl::encoding::Encode<
15133            StreamConfigConnectorConnectRequest,
15134            fidl::encoding::DefaultFuchsiaResourceDialect,
15135        > for (T0,)
15136    {
15137        #[inline]
15138        unsafe fn encode(
15139            self,
15140            encoder: &mut fidl::encoding::Encoder<
15141                '_,
15142                fidl::encoding::DefaultFuchsiaResourceDialect,
15143            >,
15144            offset: usize,
15145            depth: fidl::encoding::Depth,
15146        ) -> fidl::Result<()> {
15147            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
15148            // Zero out padding regions. There's no need to apply masks
15149            // because the unmasked parts will be overwritten by fields.
15150            // Write the fields.
15151            self.0.encode(encoder, offset + 0, depth)?;
15152            Ok(())
15153        }
15154    }
15155
15156    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15157        for StreamConfigConnectorConnectRequest
15158    {
15159        #[inline(always)]
15160        fn new_empty() -> Self {
15161            Self {
15162                protocol: fidl::new_empty!(
15163                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15164                    fidl::encoding::DefaultFuchsiaResourceDialect
15165                ),
15166            }
15167        }
15168
15169        #[inline]
15170        unsafe fn decode(
15171            &mut self,
15172            decoder: &mut fidl::encoding::Decoder<
15173                '_,
15174                fidl::encoding::DefaultFuchsiaResourceDialect,
15175            >,
15176            offset: usize,
15177            _depth: fidl::encoding::Depth,
15178        ) -> fidl::Result<()> {
15179            decoder.debug_check_bounds::<Self>(offset);
15180            // Verify that padding bytes are zero.
15181            fidl::decode!(
15182                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15183                fidl::encoding::DefaultFuchsiaResourceDialect,
15184                &mut self.protocol,
15185                decoder,
15186                offset + 0,
15187                _depth
15188            )?;
15189            Ok(())
15190        }
15191    }
15192
15193    impl fidl::encoding::ResourceTypeMarker for StreamConfigCreateRingBufferRequest {
15194        type Borrowed<'a> = &'a mut Self;
15195        fn take_or_borrow<'a>(
15196            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15197        ) -> Self::Borrowed<'a> {
15198            value
15199        }
15200    }
15201
15202    unsafe impl fidl::encoding::TypeMarker for StreamConfigCreateRingBufferRequest {
15203        type Owned = Self;
15204
15205        #[inline(always)]
15206        fn inline_align(_context: fidl::encoding::Context) -> usize {
15207            8
15208        }
15209
15210        #[inline(always)]
15211        fn inline_size(_context: fidl::encoding::Context) -> usize {
15212            24
15213        }
15214    }
15215
15216    unsafe impl
15217        fidl::encoding::Encode<
15218            StreamConfigCreateRingBufferRequest,
15219            fidl::encoding::DefaultFuchsiaResourceDialect,
15220        > for &mut StreamConfigCreateRingBufferRequest
15221    {
15222        #[inline]
15223        unsafe fn encode(
15224            self,
15225            encoder: &mut fidl::encoding::Encoder<
15226                '_,
15227                fidl::encoding::DefaultFuchsiaResourceDialect,
15228            >,
15229            offset: usize,
15230            _depth: fidl::encoding::Depth,
15231        ) -> fidl::Result<()> {
15232            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
15233            // Delegate to tuple encoding.
15234            fidl::encoding::Encode::<StreamConfigCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15235                (
15236                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
15237                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
15238                ),
15239                encoder, offset, _depth
15240            )
15241        }
15242    }
15243    unsafe impl<
15244        T0: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
15245        T1: fidl::encoding::Encode<
15246                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15247                fidl::encoding::DefaultFuchsiaResourceDialect,
15248            >,
15249    >
15250        fidl::encoding::Encode<
15251            StreamConfigCreateRingBufferRequest,
15252            fidl::encoding::DefaultFuchsiaResourceDialect,
15253        > for (T0, T1)
15254    {
15255        #[inline]
15256        unsafe fn encode(
15257            self,
15258            encoder: &mut fidl::encoding::Encoder<
15259                '_,
15260                fidl::encoding::DefaultFuchsiaResourceDialect,
15261            >,
15262            offset: usize,
15263            depth: fidl::encoding::Depth,
15264        ) -> fidl::Result<()> {
15265            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
15266            // Zero out padding regions. There's no need to apply masks
15267            // because the unmasked parts will be overwritten by fields.
15268            unsafe {
15269                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
15270                (ptr as *mut u64).write_unaligned(0);
15271            }
15272            // Write the fields.
15273            self.0.encode(encoder, offset + 0, depth)?;
15274            self.1.encode(encoder, offset + 16, depth)?;
15275            Ok(())
15276        }
15277    }
15278
15279    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15280        for StreamConfigCreateRingBufferRequest
15281    {
15282        #[inline(always)]
15283        fn new_empty() -> Self {
15284            Self {
15285                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
15286                ring_buffer: fidl::new_empty!(
15287                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15288                    fidl::encoding::DefaultFuchsiaResourceDialect
15289                ),
15290            }
15291        }
15292
15293        #[inline]
15294        unsafe fn decode(
15295            &mut self,
15296            decoder: &mut fidl::encoding::Decoder<
15297                '_,
15298                fidl::encoding::DefaultFuchsiaResourceDialect,
15299            >,
15300            offset: usize,
15301            _depth: fidl::encoding::Depth,
15302        ) -> fidl::Result<()> {
15303            decoder.debug_check_bounds::<Self>(offset);
15304            // Verify that padding bytes are zero.
15305            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
15306            let padval = unsafe { (ptr as *const u64).read_unaligned() };
15307            let mask = 0xffffffff00000000u64;
15308            let maskedval = padval & mask;
15309            if maskedval != 0 {
15310                return Err(fidl::Error::NonZeroPadding {
15311                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
15312                });
15313            }
15314            fidl::decode!(
15315                Format,
15316                fidl::encoding::DefaultFuchsiaResourceDialect,
15317                &mut self.format,
15318                decoder,
15319                offset + 0,
15320                _depth
15321            )?;
15322            fidl::decode!(
15323                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15324                fidl::encoding::DefaultFuchsiaResourceDialect,
15325                &mut self.ring_buffer,
15326                decoder,
15327                offset + 16,
15328                _depth
15329            )?;
15330            Ok(())
15331        }
15332    }
15333
15334    impl PacketStreamControlSetPacketStreamSinkRequest {
15335        #[inline(always)]
15336        fn max_ordinal_present(&self) -> u64 {
15337            if let Some(_) = self.stream {
15338                return 1;
15339            }
15340            0
15341        }
15342    }
15343
15344    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
15345        type Borrowed<'a> = &'a mut Self;
15346        fn take_or_borrow<'a>(
15347            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15348        ) -> Self::Borrowed<'a> {
15349            value
15350        }
15351    }
15352
15353    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
15354        type Owned = Self;
15355
15356        #[inline(always)]
15357        fn inline_align(_context: fidl::encoding::Context) -> usize {
15358            8
15359        }
15360
15361        #[inline(always)]
15362        fn inline_size(_context: fidl::encoding::Context) -> usize {
15363            16
15364        }
15365    }
15366
15367    unsafe impl
15368        fidl::encoding::Encode<
15369            PacketStreamControlSetPacketStreamSinkRequest,
15370            fidl::encoding::DefaultFuchsiaResourceDialect,
15371        > for &mut PacketStreamControlSetPacketStreamSinkRequest
15372    {
15373        unsafe fn encode(
15374            self,
15375            encoder: &mut fidl::encoding::Encoder<
15376                '_,
15377                fidl::encoding::DefaultFuchsiaResourceDialect,
15378            >,
15379            offset: usize,
15380            mut depth: fidl::encoding::Depth,
15381        ) -> fidl::Result<()> {
15382            encoder.debug_check_bounds::<PacketStreamControlSetPacketStreamSinkRequest>(offset);
15383            // Vector header
15384            let max_ordinal: u64 = self.max_ordinal_present();
15385            encoder.write_num(max_ordinal, offset);
15386            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15387            // Calling encoder.out_of_line_offset(0) is not allowed.
15388            if max_ordinal == 0 {
15389                return Ok(());
15390            }
15391            depth.increment()?;
15392            let envelope_size = 8;
15393            let bytes_len = max_ordinal as usize * envelope_size;
15394            #[allow(unused_variables)]
15395            let offset = encoder.out_of_line_offset(bytes_len);
15396            let mut _prev_end_offset: usize = 0;
15397            if 1 > max_ordinal {
15398                return Ok(());
15399            }
15400
15401            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15402            // are envelope_size bytes.
15403            let cur_offset: usize = (1 - 1) * envelope_size;
15404
15405            // Zero reserved fields.
15406            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15407
15408            // Safety:
15409            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15410            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15411            //   envelope_size bytes, there is always sufficient room.
15412            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15413            self.stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15414            encoder, offset + cur_offset, depth
15415        )?;
15416
15417            _prev_end_offset = cur_offset + envelope_size;
15418
15419            Ok(())
15420        }
15421    }
15422
15423    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15424        for PacketStreamControlSetPacketStreamSinkRequest
15425    {
15426        #[inline(always)]
15427        fn new_empty() -> Self {
15428            Self::default()
15429        }
15430
15431        unsafe fn decode(
15432            &mut self,
15433            decoder: &mut fidl::encoding::Decoder<
15434                '_,
15435                fidl::encoding::DefaultFuchsiaResourceDialect,
15436            >,
15437            offset: usize,
15438            mut depth: fidl::encoding::Depth,
15439        ) -> fidl::Result<()> {
15440            decoder.debug_check_bounds::<Self>(offset);
15441            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15442                None => return Err(fidl::Error::NotNullable),
15443                Some(len) => len,
15444            };
15445            // Calling decoder.out_of_line_offset(0) is not allowed.
15446            if len == 0 {
15447                return Ok(());
15448            };
15449            depth.increment()?;
15450            let envelope_size = 8;
15451            let bytes_len = len * envelope_size;
15452            let offset = decoder.out_of_line_offset(bytes_len)?;
15453            // Decode the envelope for each type.
15454            let mut _next_ordinal_to_read = 0;
15455            let mut next_offset = offset;
15456            let end_offset = offset + bytes_len;
15457            _next_ordinal_to_read += 1;
15458            if next_offset >= end_offset {
15459                return Ok(());
15460            }
15461
15462            // Decode unknown envelopes for gaps in ordinals.
15463            while _next_ordinal_to_read < 1 {
15464                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15465                _next_ordinal_to_read += 1;
15466                next_offset += envelope_size;
15467            }
15468
15469            let next_out_of_line = decoder.next_out_of_line();
15470            let handles_before = decoder.remaining_handles();
15471            if let Some((inlined, num_bytes, num_handles)) =
15472                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15473            {
15474                let member_inline_size = <fidl::encoding::Endpoint<
15475                    fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15476                > as fidl::encoding::TypeMarker>::inline_size(
15477                    decoder.context
15478                );
15479                if inlined != (member_inline_size <= 4) {
15480                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15481                }
15482                let inner_offset;
15483                let mut inner_depth = depth.clone();
15484                if inlined {
15485                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15486                    inner_offset = next_offset;
15487                } else {
15488                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15489                    inner_depth.increment()?;
15490                }
15491                let val_ref = self.stream.get_or_insert_with(|| {
15492                    fidl::new_empty!(
15493                        fidl::encoding::Endpoint<
15494                            fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15495                        >,
15496                        fidl::encoding::DefaultFuchsiaResourceDialect
15497                    )
15498                });
15499                fidl::decode!(
15500                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>,
15501                    fidl::encoding::DefaultFuchsiaResourceDialect,
15502                    val_ref,
15503                    decoder,
15504                    inner_offset,
15505                    inner_depth
15506                )?;
15507                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15508                {
15509                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15510                }
15511                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15512                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15513                }
15514            }
15515
15516            next_offset += envelope_size;
15517
15518            // Decode the remaining unknown envelopes.
15519            while next_offset < end_offset {
15520                _next_ordinal_to_read += 1;
15521                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15522                next_offset += envelope_size;
15523            }
15524
15525            Ok(())
15526        }
15527    }
15528
15529    impl PacketStreamControlGetPacketStreamSinkResponse {
15530        #[inline(always)]
15531        fn max_ordinal_present(&self) -> u64 {
15532            if let Some(_) = self.stream {
15533                return 1;
15534            }
15535            0
15536        }
15537    }
15538
15539    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
15540        type Borrowed<'a> = &'a mut Self;
15541        fn take_or_borrow<'a>(
15542            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15543        ) -> Self::Borrowed<'a> {
15544            value
15545        }
15546    }
15547
15548    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
15549        type Owned = Self;
15550
15551        #[inline(always)]
15552        fn inline_align(_context: fidl::encoding::Context) -> usize {
15553            8
15554        }
15555
15556        #[inline(always)]
15557        fn inline_size(_context: fidl::encoding::Context) -> usize {
15558            16
15559        }
15560    }
15561
15562    unsafe impl
15563        fidl::encoding::Encode<
15564            PacketStreamControlGetPacketStreamSinkResponse,
15565            fidl::encoding::DefaultFuchsiaResourceDialect,
15566        > for &mut PacketStreamControlGetPacketStreamSinkResponse
15567    {
15568        unsafe fn encode(
15569            self,
15570            encoder: &mut fidl::encoding::Encoder<
15571                '_,
15572                fidl::encoding::DefaultFuchsiaResourceDialect,
15573            >,
15574            offset: usize,
15575            mut depth: fidl::encoding::Depth,
15576        ) -> fidl::Result<()> {
15577            encoder.debug_check_bounds::<PacketStreamControlGetPacketStreamSinkResponse>(offset);
15578            // Vector header
15579            let max_ordinal: u64 = self.max_ordinal_present();
15580            encoder.write_num(max_ordinal, offset);
15581            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15582            // Calling encoder.out_of_line_offset(0) is not allowed.
15583            if max_ordinal == 0 {
15584                return Ok(());
15585            }
15586            depth.increment()?;
15587            let envelope_size = 8;
15588            let bytes_len = max_ordinal as usize * envelope_size;
15589            #[allow(unused_variables)]
15590            let offset = encoder.out_of_line_offset(bytes_len);
15591            let mut _prev_end_offset: usize = 0;
15592            if 1 > max_ordinal {
15593                return Ok(());
15594            }
15595
15596            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15597            // are envelope_size bytes.
15598            let cur_offset: usize = (1 - 1) * envelope_size;
15599
15600            // Zero reserved fields.
15601            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15602
15603            // Safety:
15604            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15605            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15606            //   envelope_size bytes, there is always sufficient room.
15607            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15608            self.stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15609            encoder, offset + cur_offset, depth
15610        )?;
15611
15612            _prev_end_offset = cur_offset + envelope_size;
15613
15614            Ok(())
15615        }
15616    }
15617
15618    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15619        for PacketStreamControlGetPacketStreamSinkResponse
15620    {
15621        #[inline(always)]
15622        fn new_empty() -> Self {
15623            Self::default()
15624        }
15625
15626        unsafe fn decode(
15627            &mut self,
15628            decoder: &mut fidl::encoding::Decoder<
15629                '_,
15630                fidl::encoding::DefaultFuchsiaResourceDialect,
15631            >,
15632            offset: usize,
15633            mut depth: fidl::encoding::Depth,
15634        ) -> fidl::Result<()> {
15635            decoder.debug_check_bounds::<Self>(offset);
15636            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15637                None => return Err(fidl::Error::NotNullable),
15638                Some(len) => len,
15639            };
15640            // Calling decoder.out_of_line_offset(0) is not allowed.
15641            if len == 0 {
15642                return Ok(());
15643            };
15644            depth.increment()?;
15645            let envelope_size = 8;
15646            let bytes_len = len * envelope_size;
15647            let offset = decoder.out_of_line_offset(bytes_len)?;
15648            // Decode the envelope for each type.
15649            let mut _next_ordinal_to_read = 0;
15650            let mut next_offset = offset;
15651            let end_offset = offset + bytes_len;
15652            _next_ordinal_to_read += 1;
15653            if next_offset >= end_offset {
15654                return Ok(());
15655            }
15656
15657            // Decode unknown envelopes for gaps in ordinals.
15658            while _next_ordinal_to_read < 1 {
15659                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15660                _next_ordinal_to_read += 1;
15661                next_offset += envelope_size;
15662            }
15663
15664            let next_out_of_line = decoder.next_out_of_line();
15665            let handles_before = decoder.remaining_handles();
15666            if let Some((inlined, num_bytes, num_handles)) =
15667                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15668            {
15669                let member_inline_size = <fidl::encoding::Endpoint<
15670                    fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15671                > as fidl::encoding::TypeMarker>::inline_size(
15672                    decoder.context
15673                );
15674                if inlined != (member_inline_size <= 4) {
15675                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15676                }
15677                let inner_offset;
15678                let mut inner_depth = depth.clone();
15679                if inlined {
15680                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15681                    inner_offset = next_offset;
15682                } else {
15683                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15684                    inner_depth.increment()?;
15685                }
15686                let val_ref = self.stream.get_or_insert_with(|| {
15687                    fidl::new_empty!(
15688                        fidl::encoding::Endpoint<
15689                            fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15690                        >,
15691                        fidl::encoding::DefaultFuchsiaResourceDialect
15692                    )
15693                });
15694                fidl::decode!(
15695                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>,
15696                    fidl::encoding::DefaultFuchsiaResourceDialect,
15697                    val_ref,
15698                    decoder,
15699                    inner_offset,
15700                    inner_depth
15701                )?;
15702                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15703                {
15704                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15705                }
15706                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15707                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15708                }
15709            }
15710
15711            next_offset += envelope_size;
15712
15713            // Decode the remaining unknown envelopes.
15714            while next_offset < end_offset {
15715                _next_ordinal_to_read += 1;
15716                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15717                next_offset += envelope_size;
15718            }
15719
15720            Ok(())
15721        }
15722    }
15723
15724    impl PacketStreamSinkPutPacketRequest {
15725        #[inline(always)]
15726        fn max_ordinal_present(&self) -> u64 {
15727            if let Some(_) = self.payload {
15728                return 1;
15729            }
15730            0
15731        }
15732    }
15733
15734    impl fidl::encoding::ResourceTypeMarker for PacketStreamSinkPutPacketRequest {
15735        type Borrowed<'a> = &'a mut Self;
15736        fn take_or_borrow<'a>(
15737            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15738        ) -> Self::Borrowed<'a> {
15739            value
15740        }
15741    }
15742
15743    unsafe impl fidl::encoding::TypeMarker for PacketStreamSinkPutPacketRequest {
15744        type Owned = Self;
15745
15746        #[inline(always)]
15747        fn inline_align(_context: fidl::encoding::Context) -> usize {
15748            8
15749        }
15750
15751        #[inline(always)]
15752        fn inline_size(_context: fidl::encoding::Context) -> usize {
15753            16
15754        }
15755    }
15756
15757    unsafe impl
15758        fidl::encoding::Encode<
15759            PacketStreamSinkPutPacketRequest,
15760            fidl::encoding::DefaultFuchsiaResourceDialect,
15761        > for &mut PacketStreamSinkPutPacketRequest
15762    {
15763        unsafe fn encode(
15764            self,
15765            encoder: &mut fidl::encoding::Encoder<
15766                '_,
15767                fidl::encoding::DefaultFuchsiaResourceDialect,
15768            >,
15769            offset: usize,
15770            mut depth: fidl::encoding::Depth,
15771        ) -> fidl::Result<()> {
15772            encoder.debug_check_bounds::<PacketStreamSinkPutPacketRequest>(offset);
15773            // Vector header
15774            let max_ordinal: u64 = self.max_ordinal_present();
15775            encoder.write_num(max_ordinal, offset);
15776            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15777            // Calling encoder.out_of_line_offset(0) is not allowed.
15778            if max_ordinal == 0 {
15779                return Ok(());
15780            }
15781            depth.increment()?;
15782            let envelope_size = 8;
15783            let bytes_len = max_ordinal as usize * envelope_size;
15784            #[allow(unused_variables)]
15785            let offset = encoder.out_of_line_offset(bytes_len);
15786            let mut _prev_end_offset: usize = 0;
15787            if 1 > max_ordinal {
15788                return Ok(());
15789            }
15790
15791            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15792            // are envelope_size bytes.
15793            let cur_offset: usize = (1 - 1) * envelope_size;
15794
15795            // Zero reserved fields.
15796            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15797
15798            // Safety:
15799            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15800            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15801            //   envelope_size bytes, there is always sufficient room.
15802            fidl::encoding::encode_in_envelope_optional::<
15803                DataTransfer,
15804                fidl::encoding::DefaultFuchsiaResourceDialect,
15805            >(
15806                self.payload
15807                    .as_mut()
15808                    .map(<DataTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15809                encoder,
15810                offset + cur_offset,
15811                depth,
15812            )?;
15813
15814            _prev_end_offset = cur_offset + envelope_size;
15815
15816            Ok(())
15817        }
15818    }
15819
15820    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15821        for PacketStreamSinkPutPacketRequest
15822    {
15823        #[inline(always)]
15824        fn new_empty() -> Self {
15825            Self::default()
15826        }
15827
15828        unsafe fn decode(
15829            &mut self,
15830            decoder: &mut fidl::encoding::Decoder<
15831                '_,
15832                fidl::encoding::DefaultFuchsiaResourceDialect,
15833            >,
15834            offset: usize,
15835            mut depth: fidl::encoding::Depth,
15836        ) -> fidl::Result<()> {
15837            decoder.debug_check_bounds::<Self>(offset);
15838            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15839                None => return Err(fidl::Error::NotNullable),
15840                Some(len) => len,
15841            };
15842            // Calling decoder.out_of_line_offset(0) is not allowed.
15843            if len == 0 {
15844                return Ok(());
15845            };
15846            depth.increment()?;
15847            let envelope_size = 8;
15848            let bytes_len = len * envelope_size;
15849            let offset = decoder.out_of_line_offset(bytes_len)?;
15850            // Decode the envelope for each type.
15851            let mut _next_ordinal_to_read = 0;
15852            let mut next_offset = offset;
15853            let end_offset = offset + bytes_len;
15854            _next_ordinal_to_read += 1;
15855            if next_offset >= end_offset {
15856                return Ok(());
15857            }
15858
15859            // Decode unknown envelopes for gaps in ordinals.
15860            while _next_ordinal_to_read < 1 {
15861                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15862                _next_ordinal_to_read += 1;
15863                next_offset += envelope_size;
15864            }
15865
15866            let next_out_of_line = decoder.next_out_of_line();
15867            let handles_before = decoder.remaining_handles();
15868            if let Some((inlined, num_bytes, num_handles)) =
15869                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15870            {
15871                let member_inline_size =
15872                    <DataTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15873                if inlined != (member_inline_size <= 4) {
15874                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15875                }
15876                let inner_offset;
15877                let mut inner_depth = depth.clone();
15878                if inlined {
15879                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15880                    inner_offset = next_offset;
15881                } else {
15882                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15883                    inner_depth.increment()?;
15884                }
15885                let val_ref = self.payload.get_or_insert_with(|| {
15886                    fidl::new_empty!(DataTransfer, fidl::encoding::DefaultFuchsiaResourceDialect)
15887                });
15888                fidl::decode!(
15889                    DataTransfer,
15890                    fidl::encoding::DefaultFuchsiaResourceDialect,
15891                    val_ref,
15892                    decoder,
15893                    inner_offset,
15894                    inner_depth
15895                )?;
15896                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15897                {
15898                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15899                }
15900                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15901                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15902                }
15903            }
15904
15905            next_offset += envelope_size;
15906
15907            // Decode the remaining unknown envelopes.
15908            while next_offset < end_offset {
15909                _next_ordinal_to_read += 1;
15910                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15911                next_offset += envelope_size;
15912            }
15913
15914            Ok(())
15915        }
15916    }
15917
15918    impl RegisterVmosConfig {
15919        #[inline(always)]
15920        fn max_ordinal_present(&self) -> u64 {
15921            if let Some(_) = self.vmo_infos {
15922                return 1;
15923            }
15924            0
15925        }
15926    }
15927
15928    impl fidl::encoding::ResourceTypeMarker for RegisterVmosConfig {
15929        type Borrowed<'a> = &'a mut Self;
15930        fn take_or_borrow<'a>(
15931            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15932        ) -> Self::Borrowed<'a> {
15933            value
15934        }
15935    }
15936
15937    unsafe impl fidl::encoding::TypeMarker for RegisterVmosConfig {
15938        type Owned = Self;
15939
15940        #[inline(always)]
15941        fn inline_align(_context: fidl::encoding::Context) -> usize {
15942            8
15943        }
15944
15945        #[inline(always)]
15946        fn inline_size(_context: fidl::encoding::Context) -> usize {
15947            16
15948        }
15949    }
15950
15951    unsafe impl
15952        fidl::encoding::Encode<RegisterVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
15953        for &mut RegisterVmosConfig
15954    {
15955        unsafe fn encode(
15956            self,
15957            encoder: &mut fidl::encoding::Encoder<
15958                '_,
15959                fidl::encoding::DefaultFuchsiaResourceDialect,
15960            >,
15961            offset: usize,
15962            mut depth: fidl::encoding::Depth,
15963        ) -> fidl::Result<()> {
15964            encoder.debug_check_bounds::<RegisterVmosConfig>(offset);
15965            // Vector header
15966            let max_ordinal: u64 = self.max_ordinal_present();
15967            encoder.write_num(max_ordinal, offset);
15968            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15969            // Calling encoder.out_of_line_offset(0) is not allowed.
15970            if max_ordinal == 0 {
15971                return Ok(());
15972            }
15973            depth.increment()?;
15974            let envelope_size = 8;
15975            let bytes_len = max_ordinal as usize * envelope_size;
15976            #[allow(unused_variables)]
15977            let offset = encoder.out_of_line_offset(bytes_len);
15978            let mut _prev_end_offset: usize = 0;
15979            if 1 > max_ordinal {
15980                return Ok(());
15981            }
15982
15983            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15984            // are envelope_size bytes.
15985            let cur_offset: usize = (1 - 1) * envelope_size;
15986
15987            // Zero reserved fields.
15988            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15989
15990            // Safety:
15991            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15992            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15993            //   envelope_size bytes, there is always sufficient room.
15994            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15995            self.vmo_infos.as_mut().map(<fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15996            encoder, offset + cur_offset, depth
15997        )?;
15998
15999            _prev_end_offset = cur_offset + envelope_size;
16000
16001            Ok(())
16002        }
16003    }
16004
16005    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16006        for RegisterVmosConfig
16007    {
16008        #[inline(always)]
16009        fn new_empty() -> Self {
16010            Self::default()
16011        }
16012
16013        unsafe fn decode(
16014            &mut self,
16015            decoder: &mut fidl::encoding::Decoder<
16016                '_,
16017                fidl::encoding::DefaultFuchsiaResourceDialect,
16018            >,
16019            offset: usize,
16020            mut depth: fidl::encoding::Depth,
16021        ) -> fidl::Result<()> {
16022            decoder.debug_check_bounds::<Self>(offset);
16023            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16024                None => return Err(fidl::Error::NotNullable),
16025                Some(len) => len,
16026            };
16027            // Calling decoder.out_of_line_offset(0) is not allowed.
16028            if len == 0 {
16029                return Ok(());
16030            };
16031            depth.increment()?;
16032            let envelope_size = 8;
16033            let bytes_len = len * envelope_size;
16034            let offset = decoder.out_of_line_offset(bytes_len)?;
16035            // Decode the envelope for each type.
16036            let mut _next_ordinal_to_read = 0;
16037            let mut next_offset = offset;
16038            let end_offset = offset + bytes_len;
16039            _next_ordinal_to_read += 1;
16040            if next_offset >= end_offset {
16041                return Ok(());
16042            }
16043
16044            // Decode unknown envelopes for gaps in ordinals.
16045            while _next_ordinal_to_read < 1 {
16046                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16047                _next_ordinal_to_read += 1;
16048                next_offset += envelope_size;
16049            }
16050
16051            let next_out_of_line = decoder.next_out_of_line();
16052            let handles_before = decoder.remaining_handles();
16053            if let Some((inlined, num_bytes, num_handles)) =
16054                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16055            {
16056                let member_inline_size = <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16057                if inlined != (member_inline_size <= 4) {
16058                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16059                }
16060                let inner_offset;
16061                let mut inner_depth = depth.clone();
16062                if inlined {
16063                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16064                    inner_offset = next_offset;
16065                } else {
16066                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16067                    inner_depth.increment()?;
16068                }
16069                let val_ref =
16070                self.vmo_infos.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect));
16071                fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
16072                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16073                {
16074                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16075                }
16076                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16077                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16078                }
16079            }
16080
16081            next_offset += envelope_size;
16082
16083            // Decode the remaining unknown envelopes.
16084            while next_offset < end_offset {
16085                _next_ordinal_to_read += 1;
16086                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16087                next_offset += envelope_size;
16088            }
16089
16090            Ok(())
16091        }
16092    }
16093
16094    impl VmoInfo {
16095        #[inline(always)]
16096        fn max_ordinal_present(&self) -> u64 {
16097            if let Some(_) = self.vmo {
16098                return 2;
16099            }
16100            if let Some(_) = self.id {
16101                return 1;
16102            }
16103            0
16104        }
16105    }
16106
16107    impl fidl::encoding::ResourceTypeMarker for VmoInfo {
16108        type Borrowed<'a> = &'a mut Self;
16109        fn take_or_borrow<'a>(
16110            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16111        ) -> Self::Borrowed<'a> {
16112            value
16113        }
16114    }
16115
16116    unsafe impl fidl::encoding::TypeMarker for VmoInfo {
16117        type Owned = Self;
16118
16119        #[inline(always)]
16120        fn inline_align(_context: fidl::encoding::Context) -> usize {
16121            8
16122        }
16123
16124        #[inline(always)]
16125        fn inline_size(_context: fidl::encoding::Context) -> usize {
16126            16
16127        }
16128    }
16129
16130    unsafe impl fidl::encoding::Encode<VmoInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
16131        for &mut VmoInfo
16132    {
16133        unsafe fn encode(
16134            self,
16135            encoder: &mut fidl::encoding::Encoder<
16136                '_,
16137                fidl::encoding::DefaultFuchsiaResourceDialect,
16138            >,
16139            offset: usize,
16140            mut depth: fidl::encoding::Depth,
16141        ) -> fidl::Result<()> {
16142            encoder.debug_check_bounds::<VmoInfo>(offset);
16143            // Vector header
16144            let max_ordinal: u64 = self.max_ordinal_present();
16145            encoder.write_num(max_ordinal, offset);
16146            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16147            // Calling encoder.out_of_line_offset(0) is not allowed.
16148            if max_ordinal == 0 {
16149                return Ok(());
16150            }
16151            depth.increment()?;
16152            let envelope_size = 8;
16153            let bytes_len = max_ordinal as usize * envelope_size;
16154            #[allow(unused_variables)]
16155            let offset = encoder.out_of_line_offset(bytes_len);
16156            let mut _prev_end_offset: usize = 0;
16157            if 1 > max_ordinal {
16158                return Ok(());
16159            }
16160
16161            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16162            // are envelope_size bytes.
16163            let cur_offset: usize = (1 - 1) * envelope_size;
16164
16165            // Zero reserved fields.
16166            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16167
16168            // Safety:
16169            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16170            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16171            //   envelope_size bytes, there is always sufficient room.
16172            fidl::encoding::encode_in_envelope_optional::<
16173                u64,
16174                fidl::encoding::DefaultFuchsiaResourceDialect,
16175            >(
16176                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16177                encoder,
16178                offset + cur_offset,
16179                depth,
16180            )?;
16181
16182            _prev_end_offset = cur_offset + envelope_size;
16183            if 2 > max_ordinal {
16184                return Ok(());
16185            }
16186
16187            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16188            // are envelope_size bytes.
16189            let cur_offset: usize = (2 - 1) * envelope_size;
16190
16191            // Zero reserved fields.
16192            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16193
16194            // Safety:
16195            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16196            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16197            //   envelope_size bytes, there is always sufficient room.
16198            fidl::encoding::encode_in_envelope_optional::<
16199                fidl::encoding::HandleType<
16200                    fidl::Vmo,
16201                    { fidl::ObjectType::VMO.into_raw() },
16202                    2147483648,
16203                >,
16204                fidl::encoding::DefaultFuchsiaResourceDialect,
16205            >(
16206                self.vmo.as_mut().map(
16207                    <fidl::encoding::HandleType<
16208                        fidl::Vmo,
16209                        { fidl::ObjectType::VMO.into_raw() },
16210                        2147483648,
16211                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16212                ),
16213                encoder,
16214                offset + cur_offset,
16215                depth,
16216            )?;
16217
16218            _prev_end_offset = cur_offset + envelope_size;
16219
16220            Ok(())
16221        }
16222    }
16223
16224    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for VmoInfo {
16225        #[inline(always)]
16226        fn new_empty() -> Self {
16227            Self::default()
16228        }
16229
16230        unsafe fn decode(
16231            &mut self,
16232            decoder: &mut fidl::encoding::Decoder<
16233                '_,
16234                fidl::encoding::DefaultFuchsiaResourceDialect,
16235            >,
16236            offset: usize,
16237            mut depth: fidl::encoding::Depth,
16238        ) -> fidl::Result<()> {
16239            decoder.debug_check_bounds::<Self>(offset);
16240            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16241                None => return Err(fidl::Error::NotNullable),
16242                Some(len) => len,
16243            };
16244            // Calling decoder.out_of_line_offset(0) is not allowed.
16245            if len == 0 {
16246                return Ok(());
16247            };
16248            depth.increment()?;
16249            let envelope_size = 8;
16250            let bytes_len = len * envelope_size;
16251            let offset = decoder.out_of_line_offset(bytes_len)?;
16252            // Decode the envelope for each type.
16253            let mut _next_ordinal_to_read = 0;
16254            let mut next_offset = offset;
16255            let end_offset = offset + bytes_len;
16256            _next_ordinal_to_read += 1;
16257            if next_offset >= end_offset {
16258                return Ok(());
16259            }
16260
16261            // Decode unknown envelopes for gaps in ordinals.
16262            while _next_ordinal_to_read < 1 {
16263                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16264                _next_ordinal_to_read += 1;
16265                next_offset += envelope_size;
16266            }
16267
16268            let next_out_of_line = decoder.next_out_of_line();
16269            let handles_before = decoder.remaining_handles();
16270            if let Some((inlined, num_bytes, num_handles)) =
16271                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16272            {
16273                let member_inline_size =
16274                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16275                if inlined != (member_inline_size <= 4) {
16276                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16277                }
16278                let inner_offset;
16279                let mut inner_depth = depth.clone();
16280                if inlined {
16281                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16282                    inner_offset = next_offset;
16283                } else {
16284                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16285                    inner_depth.increment()?;
16286                }
16287                let val_ref = self.id.get_or_insert_with(|| {
16288                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16289                });
16290                fidl::decode!(
16291                    u64,
16292                    fidl::encoding::DefaultFuchsiaResourceDialect,
16293                    val_ref,
16294                    decoder,
16295                    inner_offset,
16296                    inner_depth
16297                )?;
16298                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16299                {
16300                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16301                }
16302                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16303                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16304                }
16305            }
16306
16307            next_offset += envelope_size;
16308            _next_ordinal_to_read += 1;
16309            if next_offset >= end_offset {
16310                return Ok(());
16311            }
16312
16313            // Decode unknown envelopes for gaps in ordinals.
16314            while _next_ordinal_to_read < 2 {
16315                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16316                _next_ordinal_to_read += 1;
16317                next_offset += envelope_size;
16318            }
16319
16320            let next_out_of_line = decoder.next_out_of_line();
16321            let handles_before = decoder.remaining_handles();
16322            if let Some((inlined, num_bytes, num_handles)) =
16323                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16324            {
16325                let member_inline_size = <fidl::encoding::HandleType<
16326                    fidl::Vmo,
16327                    { fidl::ObjectType::VMO.into_raw() },
16328                    2147483648,
16329                > as fidl::encoding::TypeMarker>::inline_size(
16330                    decoder.context
16331                );
16332                if inlined != (member_inline_size <= 4) {
16333                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16334                }
16335                let inner_offset;
16336                let mut inner_depth = depth.clone();
16337                if inlined {
16338                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16339                    inner_offset = next_offset;
16340                } else {
16341                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16342                    inner_depth.increment()?;
16343                }
16344                let val_ref =
16345                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
16346                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
16347                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16348                {
16349                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16350                }
16351                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16352                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16353                }
16354            }
16355
16356            next_offset += envelope_size;
16357
16358            // Decode the remaining unknown envelopes.
16359            while next_offset < end_offset {
16360                _next_ordinal_to_read += 1;
16361                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16362                next_offset += envelope_size;
16363            }
16364
16365            Ok(())
16366        }
16367    }
16368
16369    impl VmoTransfer {
16370        #[inline(always)]
16371        fn max_ordinal_present(&self) -> u64 {
16372            if let Some(_) = self.payload_size {
16373                return 3;
16374            }
16375            if let Some(_) = self.vmo_offset {
16376                return 2;
16377            }
16378            if let Some(_) = self.vmo_id {
16379                return 1;
16380            }
16381            0
16382        }
16383    }
16384
16385    impl fidl::encoding::ResourceTypeMarker for VmoTransfer {
16386        type Borrowed<'a> = &'a mut Self;
16387        fn take_or_borrow<'a>(
16388            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16389        ) -> Self::Borrowed<'a> {
16390            value
16391        }
16392    }
16393
16394    unsafe impl fidl::encoding::TypeMarker for VmoTransfer {
16395        type Owned = Self;
16396
16397        #[inline(always)]
16398        fn inline_align(_context: fidl::encoding::Context) -> usize {
16399            8
16400        }
16401
16402        #[inline(always)]
16403        fn inline_size(_context: fidl::encoding::Context) -> usize {
16404            16
16405        }
16406    }
16407
16408    unsafe impl fidl::encoding::Encode<VmoTransfer, fidl::encoding::DefaultFuchsiaResourceDialect>
16409        for &mut VmoTransfer
16410    {
16411        unsafe fn encode(
16412            self,
16413            encoder: &mut fidl::encoding::Encoder<
16414                '_,
16415                fidl::encoding::DefaultFuchsiaResourceDialect,
16416            >,
16417            offset: usize,
16418            mut depth: fidl::encoding::Depth,
16419        ) -> fidl::Result<()> {
16420            encoder.debug_check_bounds::<VmoTransfer>(offset);
16421            // Vector header
16422            let max_ordinal: u64 = self.max_ordinal_present();
16423            encoder.write_num(max_ordinal, offset);
16424            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16425            // Calling encoder.out_of_line_offset(0) is not allowed.
16426            if max_ordinal == 0 {
16427                return Ok(());
16428            }
16429            depth.increment()?;
16430            let envelope_size = 8;
16431            let bytes_len = max_ordinal as usize * envelope_size;
16432            #[allow(unused_variables)]
16433            let offset = encoder.out_of_line_offset(bytes_len);
16434            let mut _prev_end_offset: usize = 0;
16435            if 1 > max_ordinal {
16436                return Ok(());
16437            }
16438
16439            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16440            // are envelope_size bytes.
16441            let cur_offset: usize = (1 - 1) * envelope_size;
16442
16443            // Zero reserved fields.
16444            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16445
16446            // Safety:
16447            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16448            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16449            //   envelope_size bytes, there is always sufficient room.
16450            fidl::encoding::encode_in_envelope_optional::<
16451                u64,
16452                fidl::encoding::DefaultFuchsiaResourceDialect,
16453            >(
16454                self.vmo_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16455                encoder,
16456                offset + cur_offset,
16457                depth,
16458            )?;
16459
16460            _prev_end_offset = cur_offset + envelope_size;
16461            if 2 > max_ordinal {
16462                return Ok(());
16463            }
16464
16465            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16466            // are envelope_size bytes.
16467            let cur_offset: usize = (2 - 1) * envelope_size;
16468
16469            // Zero reserved fields.
16470            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16471
16472            // Safety:
16473            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16474            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16475            //   envelope_size bytes, there is always sufficient room.
16476            fidl::encoding::encode_in_envelope_optional::<
16477                u64,
16478                fidl::encoding::DefaultFuchsiaResourceDialect,
16479            >(
16480                self.vmo_offset.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16481                encoder,
16482                offset + cur_offset,
16483                depth,
16484            )?;
16485
16486            _prev_end_offset = cur_offset + envelope_size;
16487            if 3 > max_ordinal {
16488                return Ok(());
16489            }
16490
16491            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16492            // are envelope_size bytes.
16493            let cur_offset: usize = (3 - 1) * envelope_size;
16494
16495            // Zero reserved fields.
16496            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16497
16498            // Safety:
16499            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16500            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16501            //   envelope_size bytes, there is always sufficient room.
16502            fidl::encoding::encode_in_envelope_optional::<
16503                u64,
16504                fidl::encoding::DefaultFuchsiaResourceDialect,
16505            >(
16506                self.payload_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16507                encoder,
16508                offset + cur_offset,
16509                depth,
16510            )?;
16511
16512            _prev_end_offset = cur_offset + envelope_size;
16513
16514            Ok(())
16515        }
16516    }
16517
16518    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for VmoTransfer {
16519        #[inline(always)]
16520        fn new_empty() -> Self {
16521            Self::default()
16522        }
16523
16524        unsafe fn decode(
16525            &mut self,
16526            decoder: &mut fidl::encoding::Decoder<
16527                '_,
16528                fidl::encoding::DefaultFuchsiaResourceDialect,
16529            >,
16530            offset: usize,
16531            mut depth: fidl::encoding::Depth,
16532        ) -> fidl::Result<()> {
16533            decoder.debug_check_bounds::<Self>(offset);
16534            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16535                None => return Err(fidl::Error::NotNullable),
16536                Some(len) => len,
16537            };
16538            // Calling decoder.out_of_line_offset(0) is not allowed.
16539            if len == 0 {
16540                return Ok(());
16541            };
16542            depth.increment()?;
16543            let envelope_size = 8;
16544            let bytes_len = len * envelope_size;
16545            let offset = decoder.out_of_line_offset(bytes_len)?;
16546            // Decode the envelope for each type.
16547            let mut _next_ordinal_to_read = 0;
16548            let mut next_offset = offset;
16549            let end_offset = offset + bytes_len;
16550            _next_ordinal_to_read += 1;
16551            if next_offset >= end_offset {
16552                return Ok(());
16553            }
16554
16555            // Decode unknown envelopes for gaps in ordinals.
16556            while _next_ordinal_to_read < 1 {
16557                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16558                _next_ordinal_to_read += 1;
16559                next_offset += envelope_size;
16560            }
16561
16562            let next_out_of_line = decoder.next_out_of_line();
16563            let handles_before = decoder.remaining_handles();
16564            if let Some((inlined, num_bytes, num_handles)) =
16565                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16566            {
16567                let member_inline_size =
16568                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16569                if inlined != (member_inline_size <= 4) {
16570                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16571                }
16572                let inner_offset;
16573                let mut inner_depth = depth.clone();
16574                if inlined {
16575                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16576                    inner_offset = next_offset;
16577                } else {
16578                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16579                    inner_depth.increment()?;
16580                }
16581                let val_ref = self.vmo_id.get_or_insert_with(|| {
16582                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16583                });
16584                fidl::decode!(
16585                    u64,
16586                    fidl::encoding::DefaultFuchsiaResourceDialect,
16587                    val_ref,
16588                    decoder,
16589                    inner_offset,
16590                    inner_depth
16591                )?;
16592                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16593                {
16594                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16595                }
16596                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16597                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16598                }
16599            }
16600
16601            next_offset += envelope_size;
16602            _next_ordinal_to_read += 1;
16603            if next_offset >= end_offset {
16604                return Ok(());
16605            }
16606
16607            // Decode unknown envelopes for gaps in ordinals.
16608            while _next_ordinal_to_read < 2 {
16609                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16610                _next_ordinal_to_read += 1;
16611                next_offset += envelope_size;
16612            }
16613
16614            let next_out_of_line = decoder.next_out_of_line();
16615            let handles_before = decoder.remaining_handles();
16616            if let Some((inlined, num_bytes, num_handles)) =
16617                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16618            {
16619                let member_inline_size =
16620                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16621                if inlined != (member_inline_size <= 4) {
16622                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16623                }
16624                let inner_offset;
16625                let mut inner_depth = depth.clone();
16626                if inlined {
16627                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16628                    inner_offset = next_offset;
16629                } else {
16630                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16631                    inner_depth.increment()?;
16632                }
16633                let val_ref = self.vmo_offset.get_or_insert_with(|| {
16634                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16635                });
16636                fidl::decode!(
16637                    u64,
16638                    fidl::encoding::DefaultFuchsiaResourceDialect,
16639                    val_ref,
16640                    decoder,
16641                    inner_offset,
16642                    inner_depth
16643                )?;
16644                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16645                {
16646                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16647                }
16648                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16649                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16650                }
16651            }
16652
16653            next_offset += envelope_size;
16654            _next_ordinal_to_read += 1;
16655            if next_offset >= end_offset {
16656                return Ok(());
16657            }
16658
16659            // Decode unknown envelopes for gaps in ordinals.
16660            while _next_ordinal_to_read < 3 {
16661                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16662                _next_ordinal_to_read += 1;
16663                next_offset += envelope_size;
16664            }
16665
16666            let next_out_of_line = decoder.next_out_of_line();
16667            let handles_before = decoder.remaining_handles();
16668            if let Some((inlined, num_bytes, num_handles)) =
16669                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16670            {
16671                let member_inline_size =
16672                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16673                if inlined != (member_inline_size <= 4) {
16674                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16675                }
16676                let inner_offset;
16677                let mut inner_depth = depth.clone();
16678                if inlined {
16679                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16680                    inner_offset = next_offset;
16681                } else {
16682                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16683                    inner_depth.increment()?;
16684                }
16685                let val_ref = self.payload_size.get_or_insert_with(|| {
16686                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16687                });
16688                fidl::decode!(
16689                    u64,
16690                    fidl::encoding::DefaultFuchsiaResourceDialect,
16691                    val_ref,
16692                    decoder,
16693                    inner_offset,
16694                    inner_depth
16695                )?;
16696                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16697                {
16698                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16699                }
16700                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16701                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16702                }
16703            }
16704
16705            next_offset += envelope_size;
16706
16707            // Decode the remaining unknown envelopes.
16708            while next_offset < end_offset {
16709                _next_ordinal_to_read += 1;
16710                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16711                next_offset += envelope_size;
16712            }
16713
16714            Ok(())
16715        }
16716    }
16717
16718    impl fidl::encoding::ResourceTypeMarker for DataTransfer {
16719        type Borrowed<'a> = &'a mut Self;
16720        fn take_or_borrow<'a>(
16721            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16722        ) -> Self::Borrowed<'a> {
16723            value
16724        }
16725    }
16726
16727    unsafe impl fidl::encoding::TypeMarker for DataTransfer {
16728        type Owned = Self;
16729
16730        #[inline(always)]
16731        fn inline_align(_context: fidl::encoding::Context) -> usize {
16732            8
16733        }
16734
16735        #[inline(always)]
16736        fn inline_size(_context: fidl::encoding::Context) -> usize {
16737            16
16738        }
16739    }
16740
16741    unsafe impl fidl::encoding::Encode<DataTransfer, fidl::encoding::DefaultFuchsiaResourceDialect>
16742        for &mut DataTransfer
16743    {
16744        #[inline]
16745        unsafe fn encode(
16746            self,
16747            encoder: &mut fidl::encoding::Encoder<
16748                '_,
16749                fidl::encoding::DefaultFuchsiaResourceDialect,
16750            >,
16751            offset: usize,
16752            _depth: fidl::encoding::Depth,
16753        ) -> fidl::Result<()> {
16754            encoder.debug_check_bounds::<DataTransfer>(offset);
16755            encoder.write_num::<u64>(self.ordinal(), offset);
16756            match self {
16757                DataTransfer::VmoTransfer(ref mut val) => fidl::encoding::encode_in_envelope::<
16758                    VmoTransfer,
16759                    fidl::encoding::DefaultFuchsiaResourceDialect,
16760                >(
16761                    <VmoTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
16762                    encoder,
16763                    offset + 8,
16764                    _depth,
16765                ),
16766                DataTransfer::InlineData(ref val) => fidl::encoding::encode_in_envelope::<
16767                    fidl::encoding::Vector<u8, 8192>,
16768                    fidl::encoding::DefaultFuchsiaResourceDialect,
16769                >(
16770                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
16771                        val,
16772                    ),
16773                    encoder,
16774                    offset + 8,
16775                    _depth,
16776                ),
16777                DataTransfer::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
16778            }
16779        }
16780    }
16781
16782    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DataTransfer {
16783        #[inline(always)]
16784        fn new_empty() -> Self {
16785            Self::__SourceBreaking { unknown_ordinal: 0 }
16786        }
16787
16788        #[inline]
16789        unsafe fn decode(
16790            &mut self,
16791            decoder: &mut fidl::encoding::Decoder<
16792                '_,
16793                fidl::encoding::DefaultFuchsiaResourceDialect,
16794            >,
16795            offset: usize,
16796            mut depth: fidl::encoding::Depth,
16797        ) -> fidl::Result<()> {
16798            decoder.debug_check_bounds::<Self>(offset);
16799            #[allow(unused_variables)]
16800            let next_out_of_line = decoder.next_out_of_line();
16801            let handles_before = decoder.remaining_handles();
16802            let (ordinal, inlined, num_bytes, num_handles) =
16803                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
16804
16805            let member_inline_size = match ordinal {
16806                1 => <VmoTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context),
16807                2 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
16808                    decoder.context,
16809                ),
16810                0 => return Err(fidl::Error::UnknownUnionTag),
16811                _ => num_bytes as usize,
16812            };
16813
16814            if inlined != (member_inline_size <= 4) {
16815                return Err(fidl::Error::InvalidInlineBitInEnvelope);
16816            }
16817            let _inner_offset;
16818            if inlined {
16819                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
16820                _inner_offset = offset + 8;
16821            } else {
16822                depth.increment()?;
16823                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16824            }
16825            match ordinal {
16826                1 => {
16827                    #[allow(irrefutable_let_patterns)]
16828                    if let DataTransfer::VmoTransfer(_) = self {
16829                        // Do nothing, read the value into the object
16830                    } else {
16831                        // Initialize `self` to the right variant
16832                        *self = DataTransfer::VmoTransfer(fidl::new_empty!(
16833                            VmoTransfer,
16834                            fidl::encoding::DefaultFuchsiaResourceDialect
16835                        ));
16836                    }
16837                    #[allow(irrefutable_let_patterns)]
16838                    if let DataTransfer::VmoTransfer(ref mut val) = self {
16839                        fidl::decode!(
16840                            VmoTransfer,
16841                            fidl::encoding::DefaultFuchsiaResourceDialect,
16842                            val,
16843                            decoder,
16844                            _inner_offset,
16845                            depth
16846                        )?;
16847                    } else {
16848                        unreachable!()
16849                    }
16850                }
16851                2 => {
16852                    #[allow(irrefutable_let_patterns)]
16853                    if let DataTransfer::InlineData(_) = self {
16854                        // Do nothing, read the value into the object
16855                    } else {
16856                        // Initialize `self` to the right variant
16857                        *self = DataTransfer::InlineData(
16858                            fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect),
16859                        );
16860                    }
16861                    #[allow(irrefutable_let_patterns)]
16862                    if let DataTransfer::InlineData(ref mut val) = self {
16863                        fidl::decode!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
16864                    } else {
16865                        unreachable!()
16866                    }
16867                }
16868                #[allow(deprecated)]
16869                ordinal => {
16870                    for _ in 0..num_handles {
16871                        decoder.drop_next_handle()?;
16872                    }
16873                    *self = DataTransfer::__SourceBreaking { unknown_ordinal: ordinal };
16874                }
16875            }
16876            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
16877                return Err(fidl::Error::InvalidNumBytesInEnvelope);
16878            }
16879            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16880                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16881            }
16882            Ok(())
16883        }
16884    }
16885}