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 CodecControlHandle {
1322    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1323        self.inner.shutdown_with_epitaph(status.into())
1324    }
1325}
1326
1327impl fidl::endpoints::ControlHandle for CodecControlHandle {
1328    fn shutdown(&self) {
1329        self.inner.shutdown()
1330    }
1331
1332    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1333        self.inner.shutdown_with_epitaph(status)
1334    }
1335
1336    fn is_closed(&self) -> bool {
1337        self.inner.channel().is_closed()
1338    }
1339    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1340        self.inner.channel().on_closed()
1341    }
1342
1343    #[cfg(target_os = "fuchsia")]
1344    fn signal_peer(
1345        &self,
1346        clear_mask: zx::Signals,
1347        set_mask: zx::Signals,
1348    ) -> Result<(), zx_status::Status> {
1349        use fidl::Peered;
1350        self.inner.channel().signal_peer(clear_mask, set_mask)
1351    }
1352}
1353
1354impl CodecControlHandle {}
1355
1356#[must_use = "FIDL methods require a response to be sent"]
1357#[derive(Debug)]
1358pub struct CodecGetHealthStateResponder {
1359    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1360    tx_id: u32,
1361}
1362
1363/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1364/// if the responder is dropped without sending a response, so that the client
1365/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1366impl std::ops::Drop for CodecGetHealthStateResponder {
1367    fn drop(&mut self) {
1368        self.control_handle.shutdown();
1369        // Safety: drops once, never accessed again
1370        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1371    }
1372}
1373
1374impl fidl::endpoints::Responder for CodecGetHealthStateResponder {
1375    type ControlHandle = CodecControlHandle;
1376
1377    fn control_handle(&self) -> &CodecControlHandle {
1378        &self.control_handle
1379    }
1380
1381    fn drop_without_shutdown(mut self) {
1382        // Safety: drops once, never accessed again due to mem::forget
1383        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1384        // Prevent Drop from running (which would shut down the channel)
1385        std::mem::forget(self);
1386    }
1387}
1388
1389impl CodecGetHealthStateResponder {
1390    /// Sends a response to the FIDL transaction.
1391    ///
1392    /// Sets the channel to shutdown if an error occurs.
1393    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1394        let _result = self.send_raw(state);
1395        if _result.is_err() {
1396            self.control_handle.shutdown();
1397        }
1398        self.drop_without_shutdown();
1399        _result
1400    }
1401
1402    /// Similar to "send" but does not shutdown the channel if an error occurs.
1403    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1404        let _result = self.send_raw(state);
1405        self.drop_without_shutdown();
1406        _result
1407    }
1408
1409    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
1410        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
1411            (state,),
1412            self.tx_id,
1413            0x4e146d6bca733a84,
1414            fidl::encoding::DynamicFlags::empty(),
1415        )
1416    }
1417}
1418
1419#[must_use = "FIDL methods require a response to be sent"]
1420#[derive(Debug)]
1421pub struct CodecResetResponder {
1422    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1423    tx_id: u32,
1424}
1425
1426/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1427/// if the responder is dropped without sending a response, so that the client
1428/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1429impl std::ops::Drop for CodecResetResponder {
1430    fn drop(&mut self) {
1431        self.control_handle.shutdown();
1432        // Safety: drops once, never accessed again
1433        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1434    }
1435}
1436
1437impl fidl::endpoints::Responder for CodecResetResponder {
1438    type ControlHandle = CodecControlHandle;
1439
1440    fn control_handle(&self) -> &CodecControlHandle {
1441        &self.control_handle
1442    }
1443
1444    fn drop_without_shutdown(mut self) {
1445        // Safety: drops once, never accessed again due to mem::forget
1446        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1447        // Prevent Drop from running (which would shut down the channel)
1448        std::mem::forget(self);
1449    }
1450}
1451
1452impl CodecResetResponder {
1453    /// Sends a response to the FIDL transaction.
1454    ///
1455    /// Sets the channel to shutdown if an error occurs.
1456    pub fn send(self) -> Result<(), fidl::Error> {
1457        let _result = self.send_raw();
1458        if _result.is_err() {
1459            self.control_handle.shutdown();
1460        }
1461        self.drop_without_shutdown();
1462        _result
1463    }
1464
1465    /// Similar to "send" but does not shutdown the channel if an error occurs.
1466    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1467        let _result = self.send_raw();
1468        self.drop_without_shutdown();
1469        _result
1470    }
1471
1472    fn send_raw(&self) -> Result<(), fidl::Error> {
1473        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1474            (),
1475            self.tx_id,
1476            0x50757ae579a7bd6b,
1477            fidl::encoding::DynamicFlags::empty(),
1478        )
1479    }
1480}
1481
1482#[must_use = "FIDL methods require a response to be sent"]
1483#[derive(Debug)]
1484pub struct CodecGetPropertiesResponder {
1485    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1486    tx_id: u32,
1487}
1488
1489/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1490/// if the responder is dropped without sending a response, so that the client
1491/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1492impl std::ops::Drop for CodecGetPropertiesResponder {
1493    fn drop(&mut self) {
1494        self.control_handle.shutdown();
1495        // Safety: drops once, never accessed again
1496        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1497    }
1498}
1499
1500impl fidl::endpoints::Responder for CodecGetPropertiesResponder {
1501    type ControlHandle = CodecControlHandle;
1502
1503    fn control_handle(&self) -> &CodecControlHandle {
1504        &self.control_handle
1505    }
1506
1507    fn drop_without_shutdown(mut self) {
1508        // Safety: drops once, never accessed again due to mem::forget
1509        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1510        // Prevent Drop from running (which would shut down the channel)
1511        std::mem::forget(self);
1512    }
1513}
1514
1515impl CodecGetPropertiesResponder {
1516    /// Sends a response to the FIDL transaction.
1517    ///
1518    /// Sets the channel to shutdown if an error occurs.
1519    pub fn send(self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1520        let _result = self.send_raw(properties);
1521        if _result.is_err() {
1522            self.control_handle.shutdown();
1523        }
1524        self.drop_without_shutdown();
1525        _result
1526    }
1527
1528    /// Similar to "send" but does not shutdown the channel if an error occurs.
1529    pub fn send_no_shutdown_on_err(
1530        self,
1531        mut properties: &CodecProperties,
1532    ) -> Result<(), fidl::Error> {
1533        let _result = self.send_raw(properties);
1534        self.drop_without_shutdown();
1535        _result
1536    }
1537
1538    fn send_raw(&self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1539        self.control_handle.inner.send::<CodecGetPropertiesResponse>(
1540            (properties,),
1541            self.tx_id,
1542            0x7a0d138a6a1d9d90,
1543            fidl::encoding::DynamicFlags::empty(),
1544        )
1545    }
1546}
1547
1548#[must_use = "FIDL methods require a response to be sent"]
1549#[derive(Debug)]
1550pub struct CodecStopResponder {
1551    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1552    tx_id: u32,
1553}
1554
1555/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1556/// if the responder is dropped without sending a response, so that the client
1557/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1558impl std::ops::Drop for CodecStopResponder {
1559    fn drop(&mut self) {
1560        self.control_handle.shutdown();
1561        // Safety: drops once, never accessed again
1562        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1563    }
1564}
1565
1566impl fidl::endpoints::Responder for CodecStopResponder {
1567    type ControlHandle = CodecControlHandle;
1568
1569    fn control_handle(&self) -> &CodecControlHandle {
1570        &self.control_handle
1571    }
1572
1573    fn drop_without_shutdown(mut self) {
1574        // Safety: drops once, never accessed again due to mem::forget
1575        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1576        // Prevent Drop from running (which would shut down the channel)
1577        std::mem::forget(self);
1578    }
1579}
1580
1581impl CodecStopResponder {
1582    /// Sends a response to the FIDL transaction.
1583    ///
1584    /// Sets the channel to shutdown if an error occurs.
1585    pub fn send(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1586        let _result = self.send_raw(stop_time);
1587        if _result.is_err() {
1588            self.control_handle.shutdown();
1589        }
1590        self.drop_without_shutdown();
1591        _result
1592    }
1593
1594    /// Similar to "send" but does not shutdown the channel if an error occurs.
1595    pub fn send_no_shutdown_on_err(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1596        let _result = self.send_raw(stop_time);
1597        self.drop_without_shutdown();
1598        _result
1599    }
1600
1601    fn send_raw(&self, mut stop_time: i64) -> Result<(), fidl::Error> {
1602        self.control_handle.inner.send::<CodecStopResponse>(
1603            (stop_time,),
1604            self.tx_id,
1605            0x5c2e380df1332dbd,
1606            fidl::encoding::DynamicFlags::empty(),
1607        )
1608    }
1609}
1610
1611#[must_use = "FIDL methods require a response to be sent"]
1612#[derive(Debug)]
1613pub struct CodecStartResponder {
1614    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1615    tx_id: u32,
1616}
1617
1618/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1619/// if the responder is dropped without sending a response, so that the client
1620/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1621impl std::ops::Drop for CodecStartResponder {
1622    fn drop(&mut self) {
1623        self.control_handle.shutdown();
1624        // Safety: drops once, never accessed again
1625        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1626    }
1627}
1628
1629impl fidl::endpoints::Responder for CodecStartResponder {
1630    type ControlHandle = CodecControlHandle;
1631
1632    fn control_handle(&self) -> &CodecControlHandle {
1633        &self.control_handle
1634    }
1635
1636    fn drop_without_shutdown(mut self) {
1637        // Safety: drops once, never accessed again due to mem::forget
1638        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1639        // Prevent Drop from running (which would shut down the channel)
1640        std::mem::forget(self);
1641    }
1642}
1643
1644impl CodecStartResponder {
1645    /// Sends a response to the FIDL transaction.
1646    ///
1647    /// Sets the channel to shutdown if an error occurs.
1648    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
1649        let _result = self.send_raw(start_time);
1650        if _result.is_err() {
1651            self.control_handle.shutdown();
1652        }
1653        self.drop_without_shutdown();
1654        _result
1655    }
1656
1657    /// Similar to "send" but does not shutdown the channel if an error occurs.
1658    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
1659        let _result = self.send_raw(start_time);
1660        self.drop_without_shutdown();
1661        _result
1662    }
1663
1664    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
1665        self.control_handle.inner.send::<CodecStartResponse>(
1666            (start_time,),
1667            self.tx_id,
1668            0x329cdacb286ab00,
1669            fidl::encoding::DynamicFlags::empty(),
1670        )
1671    }
1672}
1673
1674#[must_use = "FIDL methods require a response to be sent"]
1675#[derive(Debug)]
1676pub struct CodecGetDaiFormatsResponder {
1677    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1678    tx_id: u32,
1679}
1680
1681/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1682/// if the responder is dropped without sending a response, so that the client
1683/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1684impl std::ops::Drop for CodecGetDaiFormatsResponder {
1685    fn drop(&mut self) {
1686        self.control_handle.shutdown();
1687        // Safety: drops once, never accessed again
1688        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1689    }
1690}
1691
1692impl fidl::endpoints::Responder for CodecGetDaiFormatsResponder {
1693    type ControlHandle = CodecControlHandle;
1694
1695    fn control_handle(&self) -> &CodecControlHandle {
1696        &self.control_handle
1697    }
1698
1699    fn drop_without_shutdown(mut self) {
1700        // Safety: drops once, never accessed again due to mem::forget
1701        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1702        // Prevent Drop from running (which would shut down the channel)
1703        std::mem::forget(self);
1704    }
1705}
1706
1707impl CodecGetDaiFormatsResponder {
1708    /// Sends a response to the FIDL transaction.
1709    ///
1710    /// Sets the channel to shutdown if an error occurs.
1711    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1712        let _result = self.send_raw(result);
1713        if _result.is_err() {
1714            self.control_handle.shutdown();
1715        }
1716        self.drop_without_shutdown();
1717        _result
1718    }
1719
1720    /// Similar to "send" but does not shutdown the channel if an error occurs.
1721    pub fn send_no_shutdown_on_err(
1722        self,
1723        mut result: Result<&[DaiSupportedFormats], i32>,
1724    ) -> Result<(), fidl::Error> {
1725        let _result = self.send_raw(result);
1726        self.drop_without_shutdown();
1727        _result
1728    }
1729
1730    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1731        self.control_handle
1732            .inner
1733            .send::<fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>>(
1734                result.map(|formats| (formats,)),
1735                self.tx_id,
1736                0xf8bbc46b4ba6a52,
1737                fidl::encoding::DynamicFlags::empty(),
1738            )
1739    }
1740}
1741
1742#[must_use = "FIDL methods require a response to be sent"]
1743#[derive(Debug)]
1744pub struct CodecSetDaiFormatResponder {
1745    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1746    tx_id: u32,
1747}
1748
1749/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1750/// if the responder is dropped without sending a response, so that the client
1751/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1752impl std::ops::Drop for CodecSetDaiFormatResponder {
1753    fn drop(&mut self) {
1754        self.control_handle.shutdown();
1755        // Safety: drops once, never accessed again
1756        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1757    }
1758}
1759
1760impl fidl::endpoints::Responder for CodecSetDaiFormatResponder {
1761    type ControlHandle = CodecControlHandle;
1762
1763    fn control_handle(&self) -> &CodecControlHandle {
1764        &self.control_handle
1765    }
1766
1767    fn drop_without_shutdown(mut self) {
1768        // Safety: drops once, never accessed again due to mem::forget
1769        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1770        // Prevent Drop from running (which would shut down the channel)
1771        std::mem::forget(self);
1772    }
1773}
1774
1775impl CodecSetDaiFormatResponder {
1776    /// Sends a response to the FIDL transaction.
1777    ///
1778    /// Sets the channel to shutdown if an error occurs.
1779    pub fn send(self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1780        let _result = self.send_raw(result);
1781        if _result.is_err() {
1782            self.control_handle.shutdown();
1783        }
1784        self.drop_without_shutdown();
1785        _result
1786    }
1787
1788    /// Similar to "send" but does not shutdown the channel if an error occurs.
1789    pub fn send_no_shutdown_on_err(
1790        self,
1791        mut result: Result<&CodecFormatInfo, i32>,
1792    ) -> Result<(), fidl::Error> {
1793        let _result = self.send_raw(result);
1794        self.drop_without_shutdown();
1795        _result
1796    }
1797
1798    fn send_raw(&self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1799        self.control_handle
1800            .inner
1801            .send::<fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>>(
1802                result.map(|state| (state,)),
1803                self.tx_id,
1804                0x2f829df9e5a7a1ea,
1805                fidl::encoding::DynamicFlags::empty(),
1806            )
1807    }
1808}
1809
1810#[must_use = "FIDL methods require a response to be sent"]
1811#[derive(Debug)]
1812pub struct CodecWatchPlugStateResponder {
1813    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1814    tx_id: u32,
1815}
1816
1817/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1818/// if the responder is dropped without sending a response, so that the client
1819/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1820impl std::ops::Drop for CodecWatchPlugStateResponder {
1821    fn drop(&mut self) {
1822        self.control_handle.shutdown();
1823        // Safety: drops once, never accessed again
1824        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1825    }
1826}
1827
1828impl fidl::endpoints::Responder for CodecWatchPlugStateResponder {
1829    type ControlHandle = CodecControlHandle;
1830
1831    fn control_handle(&self) -> &CodecControlHandle {
1832        &self.control_handle
1833    }
1834
1835    fn drop_without_shutdown(mut self) {
1836        // Safety: drops once, never accessed again due to mem::forget
1837        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1838        // Prevent Drop from running (which would shut down the channel)
1839        std::mem::forget(self);
1840    }
1841}
1842
1843impl CodecWatchPlugStateResponder {
1844    /// Sends a response to the FIDL transaction.
1845    ///
1846    /// Sets the channel to shutdown if an error occurs.
1847    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1848        let _result = self.send_raw(plug_state);
1849        if _result.is_err() {
1850            self.control_handle.shutdown();
1851        }
1852        self.drop_without_shutdown();
1853        _result
1854    }
1855
1856    /// Similar to "send" but does not shutdown the channel if an error occurs.
1857    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1858        let _result = self.send_raw(plug_state);
1859        self.drop_without_shutdown();
1860        _result
1861    }
1862
1863    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1864        self.control_handle.inner.send::<CodecWatchPlugStateResponse>(
1865            (plug_state,),
1866            self.tx_id,
1867            0x182b87f935ca7326,
1868            fidl::encoding::DynamicFlags::empty(),
1869        )
1870    }
1871}
1872
1873#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1874pub struct CodecConnectorMarker;
1875
1876impl fidl::endpoints::ProtocolMarker for CodecConnectorMarker {
1877    type Proxy = CodecConnectorProxy;
1878    type RequestStream = CodecConnectorRequestStream;
1879    #[cfg(target_os = "fuchsia")]
1880    type SynchronousProxy = CodecConnectorSynchronousProxy;
1881
1882    const DEBUG_NAME: &'static str = "(anonymous) CodecConnector";
1883}
1884
1885pub trait CodecConnectorProxyInterface: Send + Sync {
1886    fn r#connect(
1887        &self,
1888        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1889    ) -> Result<(), fidl::Error>;
1890}
1891#[derive(Debug)]
1892#[cfg(target_os = "fuchsia")]
1893pub struct CodecConnectorSynchronousProxy {
1894    client: fidl::client::sync::Client,
1895}
1896
1897#[cfg(target_os = "fuchsia")]
1898impl fidl::endpoints::SynchronousProxy for CodecConnectorSynchronousProxy {
1899    type Proxy = CodecConnectorProxy;
1900    type Protocol = CodecConnectorMarker;
1901
1902    fn from_channel(inner: fidl::Channel) -> Self {
1903        Self::new(inner)
1904    }
1905
1906    fn into_channel(self) -> fidl::Channel {
1907        self.client.into_channel()
1908    }
1909
1910    fn as_channel(&self) -> &fidl::Channel {
1911        self.client.as_channel()
1912    }
1913}
1914
1915#[cfg(target_os = "fuchsia")]
1916impl CodecConnectorSynchronousProxy {
1917    pub fn new(channel: fidl::Channel) -> Self {
1918        Self { client: fidl::client::sync::Client::new(channel) }
1919    }
1920
1921    pub fn into_channel(self) -> fidl::Channel {
1922        self.client.into_channel()
1923    }
1924
1925    /// Waits until an event arrives and returns it. It is safe for other
1926    /// threads to make concurrent requests while waiting for an event.
1927    pub fn wait_for_event(
1928        &self,
1929        deadline: zx::MonotonicInstant,
1930    ) -> Result<CodecConnectorEvent, fidl::Error> {
1931        CodecConnectorEvent::decode(self.client.wait_for_event::<CodecConnectorMarker>(deadline)?)
1932    }
1933
1934    /// Connect to a Codec protocol server.
1935    /// This indirection into the Codec protocol allows us to support independent codec client
1936    /// connections.
1937    pub fn r#connect(
1938        &self,
1939        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1940    ) -> Result<(), fidl::Error> {
1941        self.client.send::<CodecConnectorConnectRequest>(
1942            (codec_protocol,),
1943            0x1413f551544026c9,
1944            fidl::encoding::DynamicFlags::empty(),
1945        )
1946    }
1947}
1948
1949#[cfg(target_os = "fuchsia")]
1950impl From<CodecConnectorSynchronousProxy> for zx::NullableHandle {
1951    fn from(value: CodecConnectorSynchronousProxy) -> Self {
1952        value.into_channel().into()
1953    }
1954}
1955
1956#[cfg(target_os = "fuchsia")]
1957impl From<fidl::Channel> for CodecConnectorSynchronousProxy {
1958    fn from(value: fidl::Channel) -> Self {
1959        Self::new(value)
1960    }
1961}
1962
1963#[cfg(target_os = "fuchsia")]
1964impl fidl::endpoints::FromClient for CodecConnectorSynchronousProxy {
1965    type Protocol = CodecConnectorMarker;
1966
1967    fn from_client(value: fidl::endpoints::ClientEnd<CodecConnectorMarker>) -> Self {
1968        Self::new(value.into_channel())
1969    }
1970}
1971
1972#[derive(Debug, Clone)]
1973pub struct CodecConnectorProxy {
1974    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1975}
1976
1977impl fidl::endpoints::Proxy for CodecConnectorProxy {
1978    type Protocol = CodecConnectorMarker;
1979
1980    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1981        Self::new(inner)
1982    }
1983
1984    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1985        self.client.into_channel().map_err(|client| Self { client })
1986    }
1987
1988    fn as_channel(&self) -> &::fidl::AsyncChannel {
1989        self.client.as_channel()
1990    }
1991}
1992
1993impl CodecConnectorProxy {
1994    /// Create a new Proxy for fuchsia.hardware.audio/CodecConnector.
1995    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1996        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1997        Self { client: fidl::client::Client::new(channel, protocol_name) }
1998    }
1999
2000    /// Get a Stream of events from the remote end of the protocol.
2001    ///
2002    /// # Panics
2003    ///
2004    /// Panics if the event stream was already taken.
2005    pub fn take_event_stream(&self) -> CodecConnectorEventStream {
2006        CodecConnectorEventStream { event_receiver: self.client.take_event_receiver() }
2007    }
2008
2009    /// Connect to a Codec protocol server.
2010    /// This indirection into the Codec protocol allows us to support independent codec client
2011    /// connections.
2012    pub fn r#connect(
2013        &self,
2014        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2015    ) -> Result<(), fidl::Error> {
2016        CodecConnectorProxyInterface::r#connect(self, codec_protocol)
2017    }
2018}
2019
2020impl CodecConnectorProxyInterface for CodecConnectorProxy {
2021    fn r#connect(
2022        &self,
2023        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2024    ) -> Result<(), fidl::Error> {
2025        self.client.send::<CodecConnectorConnectRequest>(
2026            (codec_protocol,),
2027            0x1413f551544026c9,
2028            fidl::encoding::DynamicFlags::empty(),
2029        )
2030    }
2031}
2032
2033pub struct CodecConnectorEventStream {
2034    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2035}
2036
2037impl std::marker::Unpin for CodecConnectorEventStream {}
2038
2039impl futures::stream::FusedStream for CodecConnectorEventStream {
2040    fn is_terminated(&self) -> bool {
2041        self.event_receiver.is_terminated()
2042    }
2043}
2044
2045impl futures::Stream for CodecConnectorEventStream {
2046    type Item = Result<CodecConnectorEvent, fidl::Error>;
2047
2048    fn poll_next(
2049        mut self: std::pin::Pin<&mut Self>,
2050        cx: &mut std::task::Context<'_>,
2051    ) -> std::task::Poll<Option<Self::Item>> {
2052        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2053            &mut self.event_receiver,
2054            cx
2055        )?) {
2056            Some(buf) => std::task::Poll::Ready(Some(CodecConnectorEvent::decode(buf))),
2057            None => std::task::Poll::Ready(None),
2058        }
2059    }
2060}
2061
2062#[derive(Debug)]
2063pub enum CodecConnectorEvent {}
2064
2065impl CodecConnectorEvent {
2066    /// Decodes a message buffer as a [`CodecConnectorEvent`].
2067    fn decode(
2068        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2069    ) -> Result<CodecConnectorEvent, fidl::Error> {
2070        let (bytes, _handles) = buf.split_mut();
2071        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2072        debug_assert_eq!(tx_header.tx_id, 0);
2073        match tx_header.ordinal {
2074            _ => Err(fidl::Error::UnknownOrdinal {
2075                ordinal: tx_header.ordinal,
2076                protocol_name:
2077                    <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2078            }),
2079        }
2080    }
2081}
2082
2083/// A Stream of incoming requests for fuchsia.hardware.audio/CodecConnector.
2084pub struct CodecConnectorRequestStream {
2085    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2086    is_terminated: bool,
2087}
2088
2089impl std::marker::Unpin for CodecConnectorRequestStream {}
2090
2091impl futures::stream::FusedStream for CodecConnectorRequestStream {
2092    fn is_terminated(&self) -> bool {
2093        self.is_terminated
2094    }
2095}
2096
2097impl fidl::endpoints::RequestStream for CodecConnectorRequestStream {
2098    type Protocol = CodecConnectorMarker;
2099    type ControlHandle = CodecConnectorControlHandle;
2100
2101    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2102        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2103    }
2104
2105    fn control_handle(&self) -> Self::ControlHandle {
2106        CodecConnectorControlHandle { inner: self.inner.clone() }
2107    }
2108
2109    fn into_inner(
2110        self,
2111    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2112    {
2113        (self.inner, self.is_terminated)
2114    }
2115
2116    fn from_inner(
2117        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2118        is_terminated: bool,
2119    ) -> Self {
2120        Self { inner, is_terminated }
2121    }
2122}
2123
2124impl futures::Stream for CodecConnectorRequestStream {
2125    type Item = Result<CodecConnectorRequest, fidl::Error>;
2126
2127    fn poll_next(
2128        mut self: std::pin::Pin<&mut Self>,
2129        cx: &mut std::task::Context<'_>,
2130    ) -> std::task::Poll<Option<Self::Item>> {
2131        let this = &mut *self;
2132        if this.inner.check_shutdown(cx) {
2133            this.is_terminated = true;
2134            return std::task::Poll::Ready(None);
2135        }
2136        if this.is_terminated {
2137            panic!("polled CodecConnectorRequestStream after completion");
2138        }
2139        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2140            |bytes, handles| {
2141                match this.inner.channel().read_etc(cx, bytes, handles) {
2142                    std::task::Poll::Ready(Ok(())) => {}
2143                    std::task::Poll::Pending => return std::task::Poll::Pending,
2144                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2145                        this.is_terminated = true;
2146                        return std::task::Poll::Ready(None);
2147                    }
2148                    std::task::Poll::Ready(Err(e)) => {
2149                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2150                            e.into(),
2151                        ))));
2152                    }
2153                }
2154
2155                // A message has been received from the channel
2156                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2157
2158                std::task::Poll::Ready(Some(match header.ordinal {
2159                    0x1413f551544026c9 => {
2160                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2161                        let mut req = fidl::new_empty!(
2162                            CodecConnectorConnectRequest,
2163                            fidl::encoding::DefaultFuchsiaResourceDialect
2164                        );
2165                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2166                        let control_handle =
2167                            CodecConnectorControlHandle { inner: this.inner.clone() };
2168                        Ok(CodecConnectorRequest::Connect {
2169                            codec_protocol: req.codec_protocol,
2170
2171                            control_handle,
2172                        })
2173                    }
2174                    _ => Err(fidl::Error::UnknownOrdinal {
2175                        ordinal: header.ordinal,
2176                        protocol_name:
2177                            <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2178                    }),
2179                }))
2180            },
2181        )
2182    }
2183}
2184
2185/// For an overview of the Codec protocols see
2186/// [Codec Interface](//docs/development/audio/drivers/codec.md)
2187/// # Deprecation
2188///
2189/// Not supported anymore, instead use an
2190/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
2191/// with one DAI and no Ring Buffer, see
2192/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
2193#[derive(Debug)]
2194pub enum CodecConnectorRequest {
2195    /// Connect to a Codec protocol server.
2196    /// This indirection into the Codec protocol allows us to support independent codec client
2197    /// connections.
2198    Connect {
2199        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2200        control_handle: CodecConnectorControlHandle,
2201    },
2202}
2203
2204impl CodecConnectorRequest {
2205    #[allow(irrefutable_let_patterns)]
2206    pub fn into_connect(
2207        self,
2208    ) -> Option<(fidl::endpoints::ServerEnd<CodecMarker>, CodecConnectorControlHandle)> {
2209        if let CodecConnectorRequest::Connect { codec_protocol, control_handle } = self {
2210            Some((codec_protocol, control_handle))
2211        } else {
2212            None
2213        }
2214    }
2215
2216    /// Name of the method defined in FIDL
2217    pub fn method_name(&self) -> &'static str {
2218        match *self {
2219            CodecConnectorRequest::Connect { .. } => "connect",
2220        }
2221    }
2222}
2223
2224#[derive(Debug, Clone)]
2225pub struct CodecConnectorControlHandle {
2226    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2227}
2228
2229impl CodecConnectorControlHandle {
2230    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2231        self.inner.shutdown_with_epitaph(status.into())
2232    }
2233}
2234
2235impl fidl::endpoints::ControlHandle for CodecConnectorControlHandle {
2236    fn shutdown(&self) {
2237        self.inner.shutdown()
2238    }
2239
2240    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2241        self.inner.shutdown_with_epitaph(status)
2242    }
2243
2244    fn is_closed(&self) -> bool {
2245        self.inner.channel().is_closed()
2246    }
2247    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2248        self.inner.channel().on_closed()
2249    }
2250
2251    #[cfg(target_os = "fuchsia")]
2252    fn signal_peer(
2253        &self,
2254        clear_mask: zx::Signals,
2255        set_mask: zx::Signals,
2256    ) -> Result<(), zx_status::Status> {
2257        use fidl::Peered;
2258        self.inner.channel().signal_peer(clear_mask, set_mask)
2259    }
2260}
2261
2262impl CodecConnectorControlHandle {}
2263
2264#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2265pub struct CompositeMarker;
2266
2267impl fidl::endpoints::ProtocolMarker for CompositeMarker {
2268    type Proxy = CompositeProxy;
2269    type RequestStream = CompositeRequestStream;
2270    #[cfg(target_os = "fuchsia")]
2271    type SynchronousProxy = CompositeSynchronousProxy;
2272
2273    const DEBUG_NAME: &'static str = "(anonymous) Composite";
2274}
2275pub type CompositeResetResult = Result<(), DriverError>;
2276pub type CompositeGetRingBufferFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
2277pub type CompositeCreateRingBufferResult = Result<(), DriverError>;
2278pub type CompositeGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, DriverError>;
2279pub type CompositeSetDaiFormatResult = Result<(), DriverError>;
2280pub type CompositeGetPacketStreamFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
2281pub type CompositeCreatePacketStreamResult = Result<(), DriverError>;
2282
2283pub trait CompositeProxyInterface: Send + Sync {
2284    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
2285        + Send;
2286    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
2287    fn r#signal_processing_connect(
2288        &self,
2289        protocol: fidl::endpoints::ServerEnd<
2290            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2291        >,
2292    ) -> Result<(), fidl::Error>;
2293    type ResetResponseFut: std::future::Future<Output = Result<CompositeResetResult, fidl::Error>>
2294        + Send;
2295    fn r#reset(&self) -> Self::ResetResponseFut;
2296    type GetPropertiesResponseFut: std::future::Future<Output = Result<CompositeProperties, fidl::Error>>
2297        + Send;
2298    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
2299    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<CompositeGetRingBufferFormatsResult, fidl::Error>>
2300        + Send;
2301    fn r#get_ring_buffer_formats(
2302        &self,
2303        processing_element_id: u64,
2304    ) -> Self::GetRingBufferFormatsResponseFut;
2305    type CreateRingBufferResponseFut: std::future::Future<Output = Result<CompositeCreateRingBufferResult, fidl::Error>>
2306        + Send;
2307    fn r#create_ring_buffer(
2308        &self,
2309        processing_element_id: u64,
2310        format: &Format2,
2311        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2312    ) -> Self::CreateRingBufferResponseFut;
2313    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CompositeGetDaiFormatsResult, fidl::Error>>
2314        + Send;
2315    fn r#get_dai_formats(&self, processing_element_id: u64) -> Self::GetDaiFormatsResponseFut;
2316    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CompositeSetDaiFormatResult, fidl::Error>>
2317        + Send;
2318    fn r#set_dai_format(
2319        &self,
2320        processing_element_id: u64,
2321        format: &DaiFormat,
2322    ) -> Self::SetDaiFormatResponseFut;
2323    type GetPacketStreamFormatsResponseFut: std::future::Future<Output = Result<CompositeGetPacketStreamFormatsResult, fidl::Error>>
2324        + Send;
2325    fn r#get_packet_stream_formats(
2326        &self,
2327        processing_element_id: u64,
2328    ) -> Self::GetPacketStreamFormatsResponseFut;
2329    type CreatePacketStreamResponseFut: std::future::Future<Output = Result<CompositeCreatePacketStreamResult, fidl::Error>>
2330        + Send;
2331    fn r#create_packet_stream(
2332        &self,
2333        processing_element_id: u64,
2334        format: &Format2,
2335        packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
2336    ) -> Self::CreatePacketStreamResponseFut;
2337}
2338#[derive(Debug)]
2339#[cfg(target_os = "fuchsia")]
2340pub struct CompositeSynchronousProxy {
2341    client: fidl::client::sync::Client,
2342}
2343
2344#[cfg(target_os = "fuchsia")]
2345impl fidl::endpoints::SynchronousProxy for CompositeSynchronousProxy {
2346    type Proxy = CompositeProxy;
2347    type Protocol = CompositeMarker;
2348
2349    fn from_channel(inner: fidl::Channel) -> Self {
2350        Self::new(inner)
2351    }
2352
2353    fn into_channel(self) -> fidl::Channel {
2354        self.client.into_channel()
2355    }
2356
2357    fn as_channel(&self) -> &fidl::Channel {
2358        self.client.as_channel()
2359    }
2360}
2361
2362#[cfg(target_os = "fuchsia")]
2363impl CompositeSynchronousProxy {
2364    pub fn new(channel: fidl::Channel) -> Self {
2365        Self { client: fidl::client::sync::Client::new(channel) }
2366    }
2367
2368    pub fn into_channel(self) -> fidl::Channel {
2369        self.client.into_channel()
2370    }
2371
2372    /// Waits until an event arrives and returns it. It is safe for other
2373    /// threads to make concurrent requests while waiting for an event.
2374    pub fn wait_for_event(
2375        &self,
2376        deadline: zx::MonotonicInstant,
2377    ) -> Result<CompositeEvent, fidl::Error> {
2378        CompositeEvent::decode(self.client.wait_for_event::<CompositeMarker>(deadline)?)
2379    }
2380
2381    /// Retrieves top level health state.
2382    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2383    pub fn r#get_health_state(
2384        &self,
2385        ___deadline: zx::MonotonicInstant,
2386    ) -> Result<HealthState, fidl::Error> {
2387        let _response = self.client.send_query::<
2388            fidl::encoding::EmptyPayload,
2389            HealthGetHealthStateResponse,
2390            CompositeMarker,
2391        >(
2392            (),
2393            0x4e146d6bca733a84,
2394            fidl::encoding::DynamicFlags::empty(),
2395            ___deadline,
2396        )?;
2397        Ok(_response.state)
2398    }
2399
2400    /// Connect to a `SignalProcessing` protocol.
2401    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2402    /// the maximum number of connections have already been created, for instance one, then the
2403    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2404    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2405    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2406    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2407    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2408    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2409    /// is intended to be composed, and hence the more verbose name allows differentiation and
2410    /// improved clarity.
2411    pub fn r#signal_processing_connect(
2412        &self,
2413        mut protocol: fidl::endpoints::ServerEnd<
2414            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2415        >,
2416    ) -> Result<(), fidl::Error> {
2417        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2418            (protocol,),
2419            0xa81907ce6066295,
2420            fidl::encoding::DynamicFlags::empty(),
2421        )
2422    }
2423
2424    /// Resets the hardware including all DAI interconnects and signal processing.
2425    /// As a result, all channels obtained by `CreateRingBuffer` or `CreatePacketStream` will be
2426    /// closed.
2427    ///
2428    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2429    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2430    /// any processing elements, and reconstruct any ring buffers and packet streams.
2431    ///
2432    /// If the driver can't successfully reset the hardware, it will return an error and then close
2433    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2434    pub fn r#reset(
2435        &self,
2436        ___deadline: zx::MonotonicInstant,
2437    ) -> Result<CompositeResetResult, fidl::Error> {
2438        let _response = self.client.send_query::<
2439            fidl::encoding::EmptyPayload,
2440            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2441            CompositeMarker,
2442        >(
2443            (),
2444            0xac355fb98341996,
2445            fidl::encoding::DynamicFlags::FLEXIBLE,
2446            ___deadline,
2447        )?
2448        .into_result::<CompositeMarker>("reset")?;
2449        Ok(_response.map(|x| x))
2450    }
2451
2452    /// Retrieves top level static properties.
2453    pub fn r#get_properties(
2454        &self,
2455        ___deadline: zx::MonotonicInstant,
2456    ) -> Result<CompositeProperties, fidl::Error> {
2457        let _response = self.client.send_query::<
2458            fidl::encoding::EmptyPayload,
2459            fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>,
2460            CompositeMarker,
2461        >(
2462            (),
2463            0x31846fa0a459942b,
2464            fidl::encoding::DynamicFlags::FLEXIBLE,
2465            ___deadline,
2466        )?
2467        .into_result::<CompositeMarker>("get_properties")?;
2468        Ok(_response.properties)
2469    }
2470
2471    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2472    /// in the topology supported by this driver as returned by `GetElements` from
2473    /// fuchsia.hardware.audio.signalprocessing.
2474    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2475    /// client may retry at a later time.
2476    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2477    /// by `GetElements`.
2478    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2479    /// `RING_BUFFER`.
2480    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2481    /// the parameters in `SupportedFormats2` may be supported.
2482    /// The vector returned to the caller must contain at least one entry.
2483    pub fn r#get_ring_buffer_formats(
2484        &self,
2485        mut processing_element_id: u64,
2486        ___deadline: zx::MonotonicInstant,
2487    ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2488        let _response = self.client.send_query::<
2489            CompositeGetRingBufferFormatsRequest,
2490            fidl::encoding::FlexibleResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2491            CompositeMarker,
2492        >(
2493            (processing_element_id,),
2494            0x1d89b701b6816ac4,
2495            fidl::encoding::DynamicFlags::FLEXIBLE,
2496            ___deadline,
2497        )?
2498        .into_result::<CompositeMarker>("get_ring_buffer_formats")?;
2499        Ok(_response.map(|x| x.ring_buffer_formats))
2500    }
2501
2502    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2503    /// processing element specified by `processing_element_id`. The format is based on information
2504    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2505    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2506    /// audio buffer provided by the driver.
2507    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2508    /// by `GetElements`.
2509    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2510    /// `RING_BUFFER`.
2511    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2512    /// `format` is not supported.
2513    pub fn r#create_ring_buffer(
2514        &self,
2515        mut processing_element_id: u64,
2516        mut format: &Format2,
2517        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2518        ___deadline: zx::MonotonicInstant,
2519    ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2520        let _response = self.client.send_query::<
2521            CompositeCreateRingBufferRequest,
2522            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2523            CompositeMarker,
2524        >(
2525            (processing_element_id, format, ring_buffer,),
2526            0x28c5685f85262033,
2527            fidl::encoding::DynamicFlags::FLEXIBLE,
2528            ___deadline,
2529        )?
2530        .into_result::<CompositeMarker>("create_ring_buffer")?;
2531        Ok(_response.map(|x| x))
2532    }
2533
2534    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2535    /// in the topology supported by this driver as returned by `GetElements` from
2536    /// fuchsia.hardware.audio.signalprocessing.
2537    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2538    /// may retry at a later time.
2539    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2540    /// by `GetElements`.
2541    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2542    /// `DAI_INTERCONNECT`.
2543    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2544    /// the parameters in DaiSupportedFormats may be supported.
2545    /// The vector returned to the caller must contain at least one entry.
2546    pub fn r#get_dai_formats(
2547        &self,
2548        mut processing_element_id: u64,
2549        ___deadline: zx::MonotonicInstant,
2550    ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2551        let _response = self.client.send_query::<
2552            CompositeGetDaiFormatsRequest,
2553            fidl::encoding::FlexibleResultType<CompositeGetDaiFormatsResponse, DriverError>,
2554            CompositeMarker,
2555        >(
2556            (processing_element_id,),
2557            0x3cbeaed59c8f69b,
2558            fidl::encoding::DynamicFlags::FLEXIBLE,
2559            ___deadline,
2560        )?
2561        .into_result::<CompositeMarker>("get_dai_formats")?;
2562        Ok(_response.map(|x| x.dai_formats))
2563    }
2564
2565    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2566    /// processing element specified by `processing_element_id`. The format is based on information
2567    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2568    /// requirement.
2569    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2570    /// by `GetElements`.
2571    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2572    /// `DAI_INTERCONNECT`.
2573    pub fn r#set_dai_format(
2574        &self,
2575        mut processing_element_id: u64,
2576        mut format: &DaiFormat,
2577        ___deadline: zx::MonotonicInstant,
2578    ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2579        let _response = self.client.send_query::<
2580            CompositeSetDaiFormatRequest,
2581            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2582            CompositeMarker,
2583        >(
2584            (processing_element_id, format,),
2585            0x155acf5cc0dc8a84,
2586            fidl::encoding::DynamicFlags::FLEXIBLE,
2587            ___deadline,
2588        )?
2589        .into_result::<CompositeMarker>("set_dai_format")?;
2590        Ok(_response.map(|x| x))
2591    }
2592
2593    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2594    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2595    /// from fuchsia.hardware.audio.signalprocessing.
2596    ///
2597    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2598    /// client may retry this request at a later time.
2599    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2600    /// `GetElements`.
2601    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2602    /// `PACKET_STREAM`.
2603    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2604    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2605    /// combinations of the parameters in `SupportedFormats2` may be supported.
2606    /// The vector returned to the caller must contain at least one entry.
2607    pub fn r#get_packet_stream_formats(
2608        &self,
2609        mut processing_element_id: u64,
2610        ___deadline: zx::MonotonicInstant,
2611    ) -> Result<CompositeGetPacketStreamFormatsResult, fidl::Error> {
2612        let _response = self.client.send_query::<
2613            CompositeGetPacketStreamFormatsRequest,
2614            fidl::encoding::FlexibleResultType<CompositeGetPacketStreamFormatsResponse, DriverError>,
2615            CompositeMarker,
2616        >(
2617            (processing_element_id,),
2618            0x73cc47c6ad39bca7,
2619            fidl::encoding::DynamicFlags::FLEXIBLE,
2620            ___deadline,
2621        )?
2622        .into_result::<CompositeMarker>("get_packet_stream_formats")?;
2623        Ok(_response.map(|x| x.packet_stream_formats))
2624    }
2625
2626    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2627    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is
2628    /// based on information that the driver provides in `GetPacketStreamFormats`, what is
2629    /// supported by the client, and any other requirement. The returned `packet_stream_control`
2630    /// channel is used to access and control the packet stream protocol served by the driver.
2631    ///
2632    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2633    /// `GetElements`.
2634    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2635    /// `PACKET_STREAM`.
2636    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2637    /// at this time, but it should be able to at some future time. This request can be retried.
2638    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2639    /// `format` is not supported.
2640    pub fn r#create_packet_stream(
2641        &self,
2642        mut processing_element_id: u64,
2643        mut format: &Format2,
2644        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
2645        ___deadline: zx::MonotonicInstant,
2646    ) -> Result<CompositeCreatePacketStreamResult, fidl::Error> {
2647        let _response = self.client.send_query::<
2648            CompositeCreatePacketStreamRequest,
2649            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2650            CompositeMarker,
2651        >(
2652            (processing_element_id, format, packet_stream_control,),
2653            0x50e8902b756c707c,
2654            fidl::encoding::DynamicFlags::FLEXIBLE,
2655            ___deadline,
2656        )?
2657        .into_result::<CompositeMarker>("create_packet_stream")?;
2658        Ok(_response.map(|x| x))
2659    }
2660}
2661
2662#[cfg(target_os = "fuchsia")]
2663impl From<CompositeSynchronousProxy> for zx::NullableHandle {
2664    fn from(value: CompositeSynchronousProxy) -> Self {
2665        value.into_channel().into()
2666    }
2667}
2668
2669#[cfg(target_os = "fuchsia")]
2670impl From<fidl::Channel> for CompositeSynchronousProxy {
2671    fn from(value: fidl::Channel) -> Self {
2672        Self::new(value)
2673    }
2674}
2675
2676#[cfg(target_os = "fuchsia")]
2677impl fidl::endpoints::FromClient for CompositeSynchronousProxy {
2678    type Protocol = CompositeMarker;
2679
2680    fn from_client(value: fidl::endpoints::ClientEnd<CompositeMarker>) -> Self {
2681        Self::new(value.into_channel())
2682    }
2683}
2684
2685#[derive(Debug, Clone)]
2686pub struct CompositeProxy {
2687    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2688}
2689
2690impl fidl::endpoints::Proxy for CompositeProxy {
2691    type Protocol = CompositeMarker;
2692
2693    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2694        Self::new(inner)
2695    }
2696
2697    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2698        self.client.into_channel().map_err(|client| Self { client })
2699    }
2700
2701    fn as_channel(&self) -> &::fidl::AsyncChannel {
2702        self.client.as_channel()
2703    }
2704}
2705
2706impl CompositeProxy {
2707    /// Create a new Proxy for fuchsia.hardware.audio/Composite.
2708    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2709        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2710        Self { client: fidl::client::Client::new(channel, protocol_name) }
2711    }
2712
2713    /// Get a Stream of events from the remote end of the protocol.
2714    ///
2715    /// # Panics
2716    ///
2717    /// Panics if the event stream was already taken.
2718    pub fn take_event_stream(&self) -> CompositeEventStream {
2719        CompositeEventStream { event_receiver: self.client.take_event_receiver() }
2720    }
2721
2722    /// Retrieves top level health state.
2723    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2724    pub fn r#get_health_state(
2725        &self,
2726    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
2727    {
2728        CompositeProxyInterface::r#get_health_state(self)
2729    }
2730
2731    /// Connect to a `SignalProcessing` protocol.
2732    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2733    /// the maximum number of connections have already been created, for instance one, then the
2734    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2735    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2736    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2737    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2738    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2739    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2740    /// is intended to be composed, and hence the more verbose name allows differentiation and
2741    /// improved clarity.
2742    pub fn r#signal_processing_connect(
2743        &self,
2744        mut protocol: fidl::endpoints::ServerEnd<
2745            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2746        >,
2747    ) -> Result<(), fidl::Error> {
2748        CompositeProxyInterface::r#signal_processing_connect(self, protocol)
2749    }
2750
2751    /// Resets the hardware including all DAI interconnects and signal processing.
2752    /// As a result, all channels obtained by `CreateRingBuffer` or `CreatePacketStream` will be
2753    /// closed.
2754    ///
2755    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2756    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2757    /// any processing elements, and reconstruct any ring buffers and packet streams.
2758    ///
2759    /// If the driver can't successfully reset the hardware, it will return an error and then close
2760    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2761    pub fn r#reset(
2762        &self,
2763    ) -> fidl::client::QueryResponseFut<
2764        CompositeResetResult,
2765        fidl::encoding::DefaultFuchsiaResourceDialect,
2766    > {
2767        CompositeProxyInterface::r#reset(self)
2768    }
2769
2770    /// Retrieves top level static properties.
2771    pub fn r#get_properties(
2772        &self,
2773    ) -> fidl::client::QueryResponseFut<
2774        CompositeProperties,
2775        fidl::encoding::DefaultFuchsiaResourceDialect,
2776    > {
2777        CompositeProxyInterface::r#get_properties(self)
2778    }
2779
2780    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2781    /// in the topology supported by this driver as returned by `GetElements` from
2782    /// fuchsia.hardware.audio.signalprocessing.
2783    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2784    /// client may retry at a later time.
2785    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2786    /// by `GetElements`.
2787    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2788    /// `RING_BUFFER`.
2789    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2790    /// the parameters in `SupportedFormats2` may be supported.
2791    /// The vector returned to the caller must contain at least one entry.
2792    pub fn r#get_ring_buffer_formats(
2793        &self,
2794        mut processing_element_id: u64,
2795    ) -> fidl::client::QueryResponseFut<
2796        CompositeGetRingBufferFormatsResult,
2797        fidl::encoding::DefaultFuchsiaResourceDialect,
2798    > {
2799        CompositeProxyInterface::r#get_ring_buffer_formats(self, processing_element_id)
2800    }
2801
2802    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2803    /// processing element specified by `processing_element_id`. The format is based on information
2804    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2805    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2806    /// audio buffer provided by the driver.
2807    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2808    /// by `GetElements`.
2809    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2810    /// `RING_BUFFER`.
2811    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2812    /// `format` is not supported.
2813    pub fn r#create_ring_buffer(
2814        &self,
2815        mut processing_element_id: u64,
2816        mut format: &Format2,
2817        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2818    ) -> fidl::client::QueryResponseFut<
2819        CompositeCreateRingBufferResult,
2820        fidl::encoding::DefaultFuchsiaResourceDialect,
2821    > {
2822        CompositeProxyInterface::r#create_ring_buffer(
2823            self,
2824            processing_element_id,
2825            format,
2826            ring_buffer,
2827        )
2828    }
2829
2830    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2831    /// in the topology supported by this driver as returned by `GetElements` from
2832    /// fuchsia.hardware.audio.signalprocessing.
2833    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2834    /// may retry at a later time.
2835    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2836    /// by `GetElements`.
2837    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2838    /// `DAI_INTERCONNECT`.
2839    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2840    /// the parameters in DaiSupportedFormats may be supported.
2841    /// The vector returned to the caller must contain at least one entry.
2842    pub fn r#get_dai_formats(
2843        &self,
2844        mut processing_element_id: u64,
2845    ) -> fidl::client::QueryResponseFut<
2846        CompositeGetDaiFormatsResult,
2847        fidl::encoding::DefaultFuchsiaResourceDialect,
2848    > {
2849        CompositeProxyInterface::r#get_dai_formats(self, processing_element_id)
2850    }
2851
2852    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2853    /// processing element specified by `processing_element_id`. The format is based on information
2854    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2855    /// requirement.
2856    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2857    /// by `GetElements`.
2858    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2859    /// `DAI_INTERCONNECT`.
2860    pub fn r#set_dai_format(
2861        &self,
2862        mut processing_element_id: u64,
2863        mut format: &DaiFormat,
2864    ) -> fidl::client::QueryResponseFut<
2865        CompositeSetDaiFormatResult,
2866        fidl::encoding::DefaultFuchsiaResourceDialect,
2867    > {
2868        CompositeProxyInterface::r#set_dai_format(self, processing_element_id, format)
2869    }
2870
2871    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2872    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2873    /// from fuchsia.hardware.audio.signalprocessing.
2874    ///
2875    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2876    /// client may retry this request at a later time.
2877    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2878    /// `GetElements`.
2879    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2880    /// `PACKET_STREAM`.
2881    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2882    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2883    /// combinations of the parameters in `SupportedFormats2` may be supported.
2884    /// The vector returned to the caller must contain at least one entry.
2885    pub fn r#get_packet_stream_formats(
2886        &self,
2887        mut processing_element_id: u64,
2888    ) -> fidl::client::QueryResponseFut<
2889        CompositeGetPacketStreamFormatsResult,
2890        fidl::encoding::DefaultFuchsiaResourceDialect,
2891    > {
2892        CompositeProxyInterface::r#get_packet_stream_formats(self, processing_element_id)
2893    }
2894
2895    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2896    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is
2897    /// based on information that the driver provides in `GetPacketStreamFormats`, what is
2898    /// supported by the client, and any other requirement. The returned `packet_stream_control`
2899    /// channel is used to access and control the packet stream protocol served by the driver.
2900    ///
2901    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2902    /// `GetElements`.
2903    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2904    /// `PACKET_STREAM`.
2905    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2906    /// at this time, but it should be able to at some future time. This request can be retried.
2907    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2908    /// `format` is not supported.
2909    pub fn r#create_packet_stream(
2910        &self,
2911        mut processing_element_id: u64,
2912        mut format: &Format2,
2913        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
2914    ) -> fidl::client::QueryResponseFut<
2915        CompositeCreatePacketStreamResult,
2916        fidl::encoding::DefaultFuchsiaResourceDialect,
2917    > {
2918        CompositeProxyInterface::r#create_packet_stream(
2919            self,
2920            processing_element_id,
2921            format,
2922            packet_stream_control,
2923        )
2924    }
2925}
2926
2927impl CompositeProxyInterface for CompositeProxy {
2928    type GetHealthStateResponseFut =
2929        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
2930    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
2931        fn _decode(
2932            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2933        ) -> Result<HealthState, fidl::Error> {
2934            let _response = fidl::client::decode_transaction_body::<
2935                HealthGetHealthStateResponse,
2936                fidl::encoding::DefaultFuchsiaResourceDialect,
2937                0x4e146d6bca733a84,
2938            >(_buf?)?;
2939            Ok(_response.state)
2940        }
2941        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
2942            (),
2943            0x4e146d6bca733a84,
2944            fidl::encoding::DynamicFlags::empty(),
2945            _decode,
2946        )
2947    }
2948
2949    fn r#signal_processing_connect(
2950        &self,
2951        mut protocol: fidl::endpoints::ServerEnd<
2952            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2953        >,
2954    ) -> Result<(), fidl::Error> {
2955        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2956            (protocol,),
2957            0xa81907ce6066295,
2958            fidl::encoding::DynamicFlags::empty(),
2959        )
2960    }
2961
2962    type ResetResponseFut = fidl::client::QueryResponseFut<
2963        CompositeResetResult,
2964        fidl::encoding::DefaultFuchsiaResourceDialect,
2965    >;
2966    fn r#reset(&self) -> Self::ResetResponseFut {
2967        fn _decode(
2968            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2969        ) -> Result<CompositeResetResult, fidl::Error> {
2970            let _response = fidl::client::decode_transaction_body::<
2971                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2972                fidl::encoding::DefaultFuchsiaResourceDialect,
2973                0xac355fb98341996,
2974            >(_buf?)?
2975            .into_result::<CompositeMarker>("reset")?;
2976            Ok(_response.map(|x| x))
2977        }
2978        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeResetResult>(
2979            (),
2980            0xac355fb98341996,
2981            fidl::encoding::DynamicFlags::FLEXIBLE,
2982            _decode,
2983        )
2984    }
2985
2986    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2987        CompositeProperties,
2988        fidl::encoding::DefaultFuchsiaResourceDialect,
2989    >;
2990    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2991        fn _decode(
2992            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2993        ) -> Result<CompositeProperties, fidl::Error> {
2994            let _response = fidl::client::decode_transaction_body::<
2995                fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>,
2996                fidl::encoding::DefaultFuchsiaResourceDialect,
2997                0x31846fa0a459942b,
2998            >(_buf?)?
2999            .into_result::<CompositeMarker>("get_properties")?;
3000            Ok(_response.properties)
3001        }
3002        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeProperties>(
3003            (),
3004            0x31846fa0a459942b,
3005            fidl::encoding::DynamicFlags::FLEXIBLE,
3006            _decode,
3007        )
3008    }
3009
3010    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
3011        CompositeGetRingBufferFormatsResult,
3012        fidl::encoding::DefaultFuchsiaResourceDialect,
3013    >;
3014    fn r#get_ring_buffer_formats(
3015        &self,
3016        mut processing_element_id: u64,
3017    ) -> Self::GetRingBufferFormatsResponseFut {
3018        fn _decode(
3019            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3020        ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
3021            let _response = fidl::client::decode_transaction_body::<
3022                fidl::encoding::FlexibleResultType<
3023                    CompositeGetRingBufferFormatsResponse,
3024                    DriverError,
3025                >,
3026                fidl::encoding::DefaultFuchsiaResourceDialect,
3027                0x1d89b701b6816ac4,
3028            >(_buf?)?
3029            .into_result::<CompositeMarker>("get_ring_buffer_formats")?;
3030            Ok(_response.map(|x| x.ring_buffer_formats))
3031        }
3032        self.client.send_query_and_decode::<
3033            CompositeGetRingBufferFormatsRequest,
3034            CompositeGetRingBufferFormatsResult,
3035        >(
3036            (processing_element_id,),
3037            0x1d89b701b6816ac4,
3038            fidl::encoding::DynamicFlags::FLEXIBLE,
3039            _decode,
3040        )
3041    }
3042
3043    type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
3044        CompositeCreateRingBufferResult,
3045        fidl::encoding::DefaultFuchsiaResourceDialect,
3046    >;
3047    fn r#create_ring_buffer(
3048        &self,
3049        mut processing_element_id: u64,
3050        mut format: &Format2,
3051        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3052    ) -> Self::CreateRingBufferResponseFut {
3053        fn _decode(
3054            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3055        ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
3056            let _response = fidl::client::decode_transaction_body::<
3057                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3058                fidl::encoding::DefaultFuchsiaResourceDialect,
3059                0x28c5685f85262033,
3060            >(_buf?)?
3061            .into_result::<CompositeMarker>("create_ring_buffer")?;
3062            Ok(_response.map(|x| x))
3063        }
3064        self.client.send_query_and_decode::<
3065            CompositeCreateRingBufferRequest,
3066            CompositeCreateRingBufferResult,
3067        >(
3068            (processing_element_id, format, ring_buffer,),
3069            0x28c5685f85262033,
3070            fidl::encoding::DynamicFlags::FLEXIBLE,
3071            _decode,
3072        )
3073    }
3074
3075    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
3076        CompositeGetDaiFormatsResult,
3077        fidl::encoding::DefaultFuchsiaResourceDialect,
3078    >;
3079    fn r#get_dai_formats(&self, mut processing_element_id: u64) -> Self::GetDaiFormatsResponseFut {
3080        fn _decode(
3081            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3082        ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
3083            let _response = fidl::client::decode_transaction_body::<
3084                fidl::encoding::FlexibleResultType<CompositeGetDaiFormatsResponse, DriverError>,
3085                fidl::encoding::DefaultFuchsiaResourceDialect,
3086                0x3cbeaed59c8f69b,
3087            >(_buf?)?
3088            .into_result::<CompositeMarker>("get_dai_formats")?;
3089            Ok(_response.map(|x| x.dai_formats))
3090        }
3091        self.client
3092            .send_query_and_decode::<CompositeGetDaiFormatsRequest, CompositeGetDaiFormatsResult>(
3093                (processing_element_id,),
3094                0x3cbeaed59c8f69b,
3095                fidl::encoding::DynamicFlags::FLEXIBLE,
3096                _decode,
3097            )
3098    }
3099
3100    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
3101        CompositeSetDaiFormatResult,
3102        fidl::encoding::DefaultFuchsiaResourceDialect,
3103    >;
3104    fn r#set_dai_format(
3105        &self,
3106        mut processing_element_id: u64,
3107        mut format: &DaiFormat,
3108    ) -> Self::SetDaiFormatResponseFut {
3109        fn _decode(
3110            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3111        ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
3112            let _response = fidl::client::decode_transaction_body::<
3113                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3114                fidl::encoding::DefaultFuchsiaResourceDialect,
3115                0x155acf5cc0dc8a84,
3116            >(_buf?)?
3117            .into_result::<CompositeMarker>("set_dai_format")?;
3118            Ok(_response.map(|x| x))
3119        }
3120        self.client
3121            .send_query_and_decode::<CompositeSetDaiFormatRequest, CompositeSetDaiFormatResult>(
3122                (processing_element_id, format),
3123                0x155acf5cc0dc8a84,
3124                fidl::encoding::DynamicFlags::FLEXIBLE,
3125                _decode,
3126            )
3127    }
3128
3129    type GetPacketStreamFormatsResponseFut = fidl::client::QueryResponseFut<
3130        CompositeGetPacketStreamFormatsResult,
3131        fidl::encoding::DefaultFuchsiaResourceDialect,
3132    >;
3133    fn r#get_packet_stream_formats(
3134        &self,
3135        mut processing_element_id: u64,
3136    ) -> Self::GetPacketStreamFormatsResponseFut {
3137        fn _decode(
3138            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3139        ) -> Result<CompositeGetPacketStreamFormatsResult, fidl::Error> {
3140            let _response = fidl::client::decode_transaction_body::<
3141                fidl::encoding::FlexibleResultType<
3142                    CompositeGetPacketStreamFormatsResponse,
3143                    DriverError,
3144                >,
3145                fidl::encoding::DefaultFuchsiaResourceDialect,
3146                0x73cc47c6ad39bca7,
3147            >(_buf?)?
3148            .into_result::<CompositeMarker>("get_packet_stream_formats")?;
3149            Ok(_response.map(|x| x.packet_stream_formats))
3150        }
3151        self.client.send_query_and_decode::<
3152            CompositeGetPacketStreamFormatsRequest,
3153            CompositeGetPacketStreamFormatsResult,
3154        >(
3155            (processing_element_id,),
3156            0x73cc47c6ad39bca7,
3157            fidl::encoding::DynamicFlags::FLEXIBLE,
3158            _decode,
3159        )
3160    }
3161
3162    type CreatePacketStreamResponseFut = fidl::client::QueryResponseFut<
3163        CompositeCreatePacketStreamResult,
3164        fidl::encoding::DefaultFuchsiaResourceDialect,
3165    >;
3166    fn r#create_packet_stream(
3167        &self,
3168        mut processing_element_id: u64,
3169        mut format: &Format2,
3170        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3171    ) -> Self::CreatePacketStreamResponseFut {
3172        fn _decode(
3173            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3174        ) -> Result<CompositeCreatePacketStreamResult, fidl::Error> {
3175            let _response = fidl::client::decode_transaction_body::<
3176                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3177                fidl::encoding::DefaultFuchsiaResourceDialect,
3178                0x50e8902b756c707c,
3179            >(_buf?)?
3180            .into_result::<CompositeMarker>("create_packet_stream")?;
3181            Ok(_response.map(|x| x))
3182        }
3183        self.client.send_query_and_decode::<
3184            CompositeCreatePacketStreamRequest,
3185            CompositeCreatePacketStreamResult,
3186        >(
3187            (processing_element_id, format, packet_stream_control,),
3188            0x50e8902b756c707c,
3189            fidl::encoding::DynamicFlags::FLEXIBLE,
3190            _decode,
3191        )
3192    }
3193}
3194
3195pub struct CompositeEventStream {
3196    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3197}
3198
3199impl std::marker::Unpin for CompositeEventStream {}
3200
3201impl futures::stream::FusedStream for CompositeEventStream {
3202    fn is_terminated(&self) -> bool {
3203        self.event_receiver.is_terminated()
3204    }
3205}
3206
3207impl futures::Stream for CompositeEventStream {
3208    type Item = Result<CompositeEvent, fidl::Error>;
3209
3210    fn poll_next(
3211        mut self: std::pin::Pin<&mut Self>,
3212        cx: &mut std::task::Context<'_>,
3213    ) -> std::task::Poll<Option<Self::Item>> {
3214        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3215            &mut self.event_receiver,
3216            cx
3217        )?) {
3218            Some(buf) => std::task::Poll::Ready(Some(CompositeEvent::decode(buf))),
3219            None => std::task::Poll::Ready(None),
3220        }
3221    }
3222}
3223
3224#[derive(Debug)]
3225pub enum CompositeEvent {
3226    #[non_exhaustive]
3227    _UnknownEvent {
3228        /// Ordinal of the event that was sent.
3229        ordinal: u64,
3230    },
3231}
3232
3233impl CompositeEvent {
3234    /// Decodes a message buffer as a [`CompositeEvent`].
3235    fn decode(
3236        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3237    ) -> Result<CompositeEvent, fidl::Error> {
3238        let (bytes, _handles) = buf.split_mut();
3239        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3240        debug_assert_eq!(tx_header.tx_id, 0);
3241        match tx_header.ordinal {
3242            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3243                Ok(CompositeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3244            }
3245            _ => Err(fidl::Error::UnknownOrdinal {
3246                ordinal: tx_header.ordinal,
3247                protocol_name: <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3248            }),
3249        }
3250    }
3251}
3252
3253/// A Stream of incoming requests for fuchsia.hardware.audio/Composite.
3254pub struct CompositeRequestStream {
3255    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3256    is_terminated: bool,
3257}
3258
3259impl std::marker::Unpin for CompositeRequestStream {}
3260
3261impl futures::stream::FusedStream for CompositeRequestStream {
3262    fn is_terminated(&self) -> bool {
3263        self.is_terminated
3264    }
3265}
3266
3267impl fidl::endpoints::RequestStream for CompositeRequestStream {
3268    type Protocol = CompositeMarker;
3269    type ControlHandle = CompositeControlHandle;
3270
3271    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3272        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3273    }
3274
3275    fn control_handle(&self) -> Self::ControlHandle {
3276        CompositeControlHandle { inner: self.inner.clone() }
3277    }
3278
3279    fn into_inner(
3280        self,
3281    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3282    {
3283        (self.inner, self.is_terminated)
3284    }
3285
3286    fn from_inner(
3287        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3288        is_terminated: bool,
3289    ) -> Self {
3290        Self { inner, is_terminated }
3291    }
3292}
3293
3294impl futures::Stream for CompositeRequestStream {
3295    type Item = Result<CompositeRequest, fidl::Error>;
3296
3297    fn poll_next(
3298        mut self: std::pin::Pin<&mut Self>,
3299        cx: &mut std::task::Context<'_>,
3300    ) -> std::task::Poll<Option<Self::Item>> {
3301        let this = &mut *self;
3302        if this.inner.check_shutdown(cx) {
3303            this.is_terminated = true;
3304            return std::task::Poll::Ready(None);
3305        }
3306        if this.is_terminated {
3307            panic!("polled CompositeRequestStream after completion");
3308        }
3309        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3310            |bytes, handles| {
3311                match this.inner.channel().read_etc(cx, bytes, handles) {
3312                    std::task::Poll::Ready(Ok(())) => {}
3313                    std::task::Poll::Pending => return std::task::Poll::Pending,
3314                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3315                        this.is_terminated = true;
3316                        return std::task::Poll::Ready(None);
3317                    }
3318                    std::task::Poll::Ready(Err(e)) => {
3319                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3320                            e.into(),
3321                        ))));
3322                    }
3323                }
3324
3325                // A message has been received from the channel
3326                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3327
3328                std::task::Poll::Ready(Some(match header.ordinal {
3329                    0x4e146d6bca733a84 => {
3330                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3331                        let mut req = fidl::new_empty!(
3332                            fidl::encoding::EmptyPayload,
3333                            fidl::encoding::DefaultFuchsiaResourceDialect
3334                        );
3335                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3336                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3337                        Ok(CompositeRequest::GetHealthState {
3338                            responder: CompositeGetHealthStateResponder {
3339                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3340                                tx_id: header.tx_id,
3341                            },
3342                        })
3343                    }
3344                    0xa81907ce6066295 => {
3345                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3346                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3347                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3348                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3349                        Ok(CompositeRequest::SignalProcessingConnect {
3350                            protocol: req.protocol,
3351
3352                            control_handle,
3353                        })
3354                    }
3355                    0xac355fb98341996 => {
3356                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3357                        let mut req = fidl::new_empty!(
3358                            fidl::encoding::EmptyPayload,
3359                            fidl::encoding::DefaultFuchsiaResourceDialect
3360                        );
3361                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3362                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3363                        Ok(CompositeRequest::Reset {
3364                            responder: CompositeResetResponder {
3365                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3366                                tx_id: header.tx_id,
3367                            },
3368                        })
3369                    }
3370                    0x31846fa0a459942b => {
3371                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3372                        let mut req = fidl::new_empty!(
3373                            fidl::encoding::EmptyPayload,
3374                            fidl::encoding::DefaultFuchsiaResourceDialect
3375                        );
3376                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3377                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3378                        Ok(CompositeRequest::GetProperties {
3379                            responder: CompositeGetPropertiesResponder {
3380                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3381                                tx_id: header.tx_id,
3382                            },
3383                        })
3384                    }
3385                    0x1d89b701b6816ac4 => {
3386                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3387                        let mut req = fidl::new_empty!(
3388                            CompositeGetRingBufferFormatsRequest,
3389                            fidl::encoding::DefaultFuchsiaResourceDialect
3390                        );
3391                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetRingBufferFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3392                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3393                        Ok(CompositeRequest::GetRingBufferFormats {
3394                            processing_element_id: req.processing_element_id,
3395
3396                            responder: CompositeGetRingBufferFormatsResponder {
3397                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3398                                tx_id: header.tx_id,
3399                            },
3400                        })
3401                    }
3402                    0x28c5685f85262033 => {
3403                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3404                        let mut req = fidl::new_empty!(
3405                            CompositeCreateRingBufferRequest,
3406                            fidl::encoding::DefaultFuchsiaResourceDialect
3407                        );
3408                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
3409                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3410                        Ok(CompositeRequest::CreateRingBuffer {
3411                            processing_element_id: req.processing_element_id,
3412                            format: req.format,
3413                            ring_buffer: req.ring_buffer,
3414
3415                            responder: CompositeCreateRingBufferResponder {
3416                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3417                                tx_id: header.tx_id,
3418                            },
3419                        })
3420                    }
3421                    0x3cbeaed59c8f69b => {
3422                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3423                        let mut req = fidl::new_empty!(
3424                            CompositeGetDaiFormatsRequest,
3425                            fidl::encoding::DefaultFuchsiaResourceDialect
3426                        );
3427                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetDaiFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3428                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3429                        Ok(CompositeRequest::GetDaiFormats {
3430                            processing_element_id: req.processing_element_id,
3431
3432                            responder: CompositeGetDaiFormatsResponder {
3433                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3434                                tx_id: header.tx_id,
3435                            },
3436                        })
3437                    }
3438                    0x155acf5cc0dc8a84 => {
3439                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3440                        let mut req = fidl::new_empty!(
3441                            CompositeSetDaiFormatRequest,
3442                            fidl::encoding::DefaultFuchsiaResourceDialect
3443                        );
3444                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
3445                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3446                        Ok(CompositeRequest::SetDaiFormat {
3447                            processing_element_id: req.processing_element_id,
3448                            format: req.format,
3449
3450                            responder: CompositeSetDaiFormatResponder {
3451                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3452                                tx_id: header.tx_id,
3453                            },
3454                        })
3455                    }
3456                    0x73cc47c6ad39bca7 => {
3457                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3458                        let mut req = fidl::new_empty!(
3459                            CompositeGetPacketStreamFormatsRequest,
3460                            fidl::encoding::DefaultFuchsiaResourceDialect
3461                        );
3462                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetPacketStreamFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3463                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3464                        Ok(CompositeRequest::GetPacketStreamFormats {
3465                            processing_element_id: req.processing_element_id,
3466
3467                            responder: CompositeGetPacketStreamFormatsResponder {
3468                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3469                                tx_id: header.tx_id,
3470                            },
3471                        })
3472                    }
3473                    0x50e8902b756c707c => {
3474                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3475                        let mut req = fidl::new_empty!(
3476                            CompositeCreatePacketStreamRequest,
3477                            fidl::encoding::DefaultFuchsiaResourceDialect
3478                        );
3479                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreatePacketStreamRequest>(&header, _body_bytes, handles, &mut req)?;
3480                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3481                        Ok(CompositeRequest::CreatePacketStream {
3482                            processing_element_id: req.processing_element_id,
3483                            format: req.format,
3484                            packet_stream_control: req.packet_stream_control,
3485
3486                            responder: CompositeCreatePacketStreamResponder {
3487                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3488                                tx_id: header.tx_id,
3489                            },
3490                        })
3491                    }
3492                    _ if header.tx_id == 0
3493                        && header
3494                            .dynamic_flags()
3495                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3496                    {
3497                        Ok(CompositeRequest::_UnknownMethod {
3498                            ordinal: header.ordinal,
3499                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
3500                            method_type: fidl::MethodType::OneWay,
3501                        })
3502                    }
3503                    _ if header
3504                        .dynamic_flags()
3505                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3506                    {
3507                        this.inner.send_framework_err(
3508                            fidl::encoding::FrameworkErr::UnknownMethod,
3509                            header.tx_id,
3510                            header.ordinal,
3511                            header.dynamic_flags(),
3512                            (bytes, handles),
3513                        )?;
3514                        Ok(CompositeRequest::_UnknownMethod {
3515                            ordinal: header.ordinal,
3516                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
3517                            method_type: fidl::MethodType::TwoWay,
3518                        })
3519                    }
3520                    _ => Err(fidl::Error::UnknownOrdinal {
3521                        ordinal: header.ordinal,
3522                        protocol_name:
3523                            <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3524                    }),
3525                }))
3526            },
3527        )
3528    }
3529}
3530
3531#[derive(Debug)]
3532pub enum CompositeRequest {
3533    /// Retrieves top level health state.
3534    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
3535    GetHealthState { responder: CompositeGetHealthStateResponder },
3536    /// Connect to a `SignalProcessing` protocol.
3537    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
3538    /// the maximum number of connections have already been created, for instance one, then the
3539    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
3540    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
3541    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
3542    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
3543    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
3544    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
3545    /// is intended to be composed, and hence the more verbose name allows differentiation and
3546    /// improved clarity.
3547    SignalProcessingConnect {
3548        protocol: fidl::endpoints::ServerEnd<
3549            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3550        >,
3551        control_handle: CompositeControlHandle,
3552    },
3553    /// Resets the hardware including all DAI interconnects and signal processing.
3554    /// As a result, all channels obtained by `CreateRingBuffer` or `CreatePacketStream` will be
3555    /// closed.
3556    ///
3557    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
3558    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
3559    /// any processing elements, and reconstruct any ring buffers and packet streams.
3560    ///
3561    /// If the driver can't successfully reset the hardware, it will return an error and then close
3562    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
3563    Reset { responder: CompositeResetResponder },
3564    /// Retrieves top level static properties.
3565    GetProperties { responder: CompositeGetPropertiesResponder },
3566    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
3567    /// in the topology supported by this driver as returned by `GetElements` from
3568    /// fuchsia.hardware.audio.signalprocessing.
3569    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
3570    /// client may retry at a later time.
3571    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3572    /// by `GetElements`.
3573    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3574    /// `RING_BUFFER`.
3575    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
3576    /// the parameters in `SupportedFormats2` may be supported.
3577    /// The vector returned to the caller must contain at least one entry.
3578    GetRingBufferFormats {
3579        processing_element_id: u64,
3580        responder: CompositeGetRingBufferFormatsResponder,
3581    },
3582    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
3583    /// processing element specified by `processing_element_id`. The format is based on information
3584    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
3585    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
3586    /// audio buffer provided by the driver.
3587    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3588    /// by `GetElements`.
3589    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3590    /// `RING_BUFFER`.
3591    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
3592    /// `format` is not supported.
3593    CreateRingBuffer {
3594        processing_element_id: u64,
3595        format: Format2,
3596        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3597        responder: CompositeCreateRingBufferResponder,
3598    },
3599    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
3600    /// in the topology supported by this driver as returned by `GetElements` from
3601    /// fuchsia.hardware.audio.signalprocessing.
3602    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
3603    /// may retry at a later time.
3604    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3605    /// by `GetElements`.
3606    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3607    /// `DAI_INTERCONNECT`.
3608    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
3609    /// the parameters in DaiSupportedFormats may be supported.
3610    /// The vector returned to the caller must contain at least one entry.
3611    GetDaiFormats { processing_element_id: u64, responder: CompositeGetDaiFormatsResponder },
3612    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
3613    /// processing element specified by `processing_element_id`. The format is based on information
3614    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
3615    /// requirement.
3616    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3617    /// by `GetElements`.
3618    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3619    /// `DAI_INTERCONNECT`.
3620    SetDaiFormat {
3621        processing_element_id: u64,
3622        format: DaiFormat,
3623        responder: CompositeSetDaiFormatResponder,
3624    },
3625    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
3626    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
3627    /// from fuchsia.hardware.audio.signalprocessing.
3628    ///
3629    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
3630    /// client may retry this request at a later time.
3631    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
3632    /// `GetElements`.
3633    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3634    /// `PACKET_STREAM`.
3635    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
3636    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
3637    /// combinations of the parameters in `SupportedFormats2` may be supported.
3638    /// The vector returned to the caller must contain at least one entry.
3639    GetPacketStreamFormats {
3640        processing_element_id: u64,
3641        responder: CompositeGetPacketStreamFormatsResponder,
3642    },
3643    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
3644    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is
3645    /// based on information that the driver provides in `GetPacketStreamFormats`, what is
3646    /// supported by the client, and any other requirement. The returned `packet_stream_control`
3647    /// channel is used to access and control the packet stream protocol served by the driver.
3648    ///
3649    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
3650    /// `GetElements`.
3651    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3652    /// `PACKET_STREAM`.
3653    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
3654    /// at this time, but it should be able to at some future time. This request can be retried.
3655    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
3656    /// `format` is not supported.
3657    CreatePacketStream {
3658        processing_element_id: u64,
3659        format: Format2,
3660        packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3661        responder: CompositeCreatePacketStreamResponder,
3662    },
3663    /// An interaction was received which does not match any known method.
3664    #[non_exhaustive]
3665    _UnknownMethod {
3666        /// Ordinal of the method that was called.
3667        ordinal: u64,
3668        control_handle: CompositeControlHandle,
3669        method_type: fidl::MethodType,
3670    },
3671}
3672
3673impl CompositeRequest {
3674    #[allow(irrefutable_let_patterns)]
3675    pub fn into_get_health_state(self) -> Option<(CompositeGetHealthStateResponder)> {
3676        if let CompositeRequest::GetHealthState { responder } = self {
3677            Some((responder))
3678        } else {
3679            None
3680        }
3681    }
3682
3683    #[allow(irrefutable_let_patterns)]
3684    pub fn into_signal_processing_connect(
3685        self,
3686    ) -> Option<(
3687        fidl::endpoints::ServerEnd<
3688            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3689        >,
3690        CompositeControlHandle,
3691    )> {
3692        if let CompositeRequest::SignalProcessingConnect { protocol, control_handle } = self {
3693            Some((protocol, control_handle))
3694        } else {
3695            None
3696        }
3697    }
3698
3699    #[allow(irrefutable_let_patterns)]
3700    pub fn into_reset(self) -> Option<(CompositeResetResponder)> {
3701        if let CompositeRequest::Reset { responder } = self { Some((responder)) } else { None }
3702    }
3703
3704    #[allow(irrefutable_let_patterns)]
3705    pub fn into_get_properties(self) -> Option<(CompositeGetPropertiesResponder)> {
3706        if let CompositeRequest::GetProperties { responder } = self {
3707            Some((responder))
3708        } else {
3709            None
3710        }
3711    }
3712
3713    #[allow(irrefutable_let_patterns)]
3714    pub fn into_get_ring_buffer_formats(
3715        self,
3716    ) -> Option<(u64, CompositeGetRingBufferFormatsResponder)> {
3717        if let CompositeRequest::GetRingBufferFormats { processing_element_id, responder } = self {
3718            Some((processing_element_id, responder))
3719        } else {
3720            None
3721        }
3722    }
3723
3724    #[allow(irrefutable_let_patterns)]
3725    pub fn into_create_ring_buffer(
3726        self,
3727    ) -> Option<(
3728        u64,
3729        Format2,
3730        fidl::endpoints::ServerEnd<RingBufferMarker>,
3731        CompositeCreateRingBufferResponder,
3732    )> {
3733        if let CompositeRequest::CreateRingBuffer {
3734            processing_element_id,
3735            format,
3736            ring_buffer,
3737            responder,
3738        } = self
3739        {
3740            Some((processing_element_id, format, ring_buffer, responder))
3741        } else {
3742            None
3743        }
3744    }
3745
3746    #[allow(irrefutable_let_patterns)]
3747    pub fn into_get_dai_formats(self) -> Option<(u64, CompositeGetDaiFormatsResponder)> {
3748        if let CompositeRequest::GetDaiFormats { processing_element_id, responder } = self {
3749            Some((processing_element_id, responder))
3750        } else {
3751            None
3752        }
3753    }
3754
3755    #[allow(irrefutable_let_patterns)]
3756    pub fn into_set_dai_format(self) -> Option<(u64, DaiFormat, CompositeSetDaiFormatResponder)> {
3757        if let CompositeRequest::SetDaiFormat { processing_element_id, format, responder } = self {
3758            Some((processing_element_id, format, responder))
3759        } else {
3760            None
3761        }
3762    }
3763
3764    #[allow(irrefutable_let_patterns)]
3765    pub fn into_get_packet_stream_formats(
3766        self,
3767    ) -> Option<(u64, CompositeGetPacketStreamFormatsResponder)> {
3768        if let CompositeRequest::GetPacketStreamFormats { processing_element_id, responder } = self
3769        {
3770            Some((processing_element_id, responder))
3771        } else {
3772            None
3773        }
3774    }
3775
3776    #[allow(irrefutable_let_patterns)]
3777    pub fn into_create_packet_stream(
3778        self,
3779    ) -> Option<(
3780        u64,
3781        Format2,
3782        fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3783        CompositeCreatePacketStreamResponder,
3784    )> {
3785        if let CompositeRequest::CreatePacketStream {
3786            processing_element_id,
3787            format,
3788            packet_stream_control,
3789            responder,
3790        } = self
3791        {
3792            Some((processing_element_id, format, packet_stream_control, responder))
3793        } else {
3794            None
3795        }
3796    }
3797
3798    /// Name of the method defined in FIDL
3799    pub fn method_name(&self) -> &'static str {
3800        match *self {
3801            CompositeRequest::GetHealthState { .. } => "get_health_state",
3802            CompositeRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
3803            CompositeRequest::Reset { .. } => "reset",
3804            CompositeRequest::GetProperties { .. } => "get_properties",
3805            CompositeRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
3806            CompositeRequest::CreateRingBuffer { .. } => "create_ring_buffer",
3807            CompositeRequest::GetDaiFormats { .. } => "get_dai_formats",
3808            CompositeRequest::SetDaiFormat { .. } => "set_dai_format",
3809            CompositeRequest::GetPacketStreamFormats { .. } => "get_packet_stream_formats",
3810            CompositeRequest::CreatePacketStream { .. } => "create_packet_stream",
3811            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3812                "unknown one-way method"
3813            }
3814            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3815                "unknown two-way method"
3816            }
3817        }
3818    }
3819}
3820
3821#[derive(Debug, Clone)]
3822pub struct CompositeControlHandle {
3823    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3824}
3825
3826impl CompositeControlHandle {
3827    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3828        self.inner.shutdown_with_epitaph(status.into())
3829    }
3830}
3831
3832impl fidl::endpoints::ControlHandle for CompositeControlHandle {
3833    fn shutdown(&self) {
3834        self.inner.shutdown()
3835    }
3836
3837    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3838        self.inner.shutdown_with_epitaph(status)
3839    }
3840
3841    fn is_closed(&self) -> bool {
3842        self.inner.channel().is_closed()
3843    }
3844    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3845        self.inner.channel().on_closed()
3846    }
3847
3848    #[cfg(target_os = "fuchsia")]
3849    fn signal_peer(
3850        &self,
3851        clear_mask: zx::Signals,
3852        set_mask: zx::Signals,
3853    ) -> Result<(), zx_status::Status> {
3854        use fidl::Peered;
3855        self.inner.channel().signal_peer(clear_mask, set_mask)
3856    }
3857}
3858
3859impl CompositeControlHandle {}
3860
3861#[must_use = "FIDL methods require a response to be sent"]
3862#[derive(Debug)]
3863pub struct CompositeGetHealthStateResponder {
3864    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3865    tx_id: u32,
3866}
3867
3868/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3869/// if the responder is dropped without sending a response, so that the client
3870/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3871impl std::ops::Drop for CompositeGetHealthStateResponder {
3872    fn drop(&mut self) {
3873        self.control_handle.shutdown();
3874        // Safety: drops once, never accessed again
3875        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3876    }
3877}
3878
3879impl fidl::endpoints::Responder for CompositeGetHealthStateResponder {
3880    type ControlHandle = CompositeControlHandle;
3881
3882    fn control_handle(&self) -> &CompositeControlHandle {
3883        &self.control_handle
3884    }
3885
3886    fn drop_without_shutdown(mut self) {
3887        // Safety: drops once, never accessed again due to mem::forget
3888        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3889        // Prevent Drop from running (which would shut down the channel)
3890        std::mem::forget(self);
3891    }
3892}
3893
3894impl CompositeGetHealthStateResponder {
3895    /// Sends a response to the FIDL transaction.
3896    ///
3897    /// Sets the channel to shutdown if an error occurs.
3898    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3899        let _result = self.send_raw(state);
3900        if _result.is_err() {
3901            self.control_handle.shutdown();
3902        }
3903        self.drop_without_shutdown();
3904        _result
3905    }
3906
3907    /// Similar to "send" but does not shutdown the channel if an error occurs.
3908    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3909        let _result = self.send_raw(state);
3910        self.drop_without_shutdown();
3911        _result
3912    }
3913
3914    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
3915        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
3916            (state,),
3917            self.tx_id,
3918            0x4e146d6bca733a84,
3919            fidl::encoding::DynamicFlags::empty(),
3920        )
3921    }
3922}
3923
3924#[must_use = "FIDL methods require a response to be sent"]
3925#[derive(Debug)]
3926pub struct CompositeResetResponder {
3927    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3928    tx_id: u32,
3929}
3930
3931/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3932/// if the responder is dropped without sending a response, so that the client
3933/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3934impl std::ops::Drop for CompositeResetResponder {
3935    fn drop(&mut self) {
3936        self.control_handle.shutdown();
3937        // Safety: drops once, never accessed again
3938        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3939    }
3940}
3941
3942impl fidl::endpoints::Responder for CompositeResetResponder {
3943    type ControlHandle = CompositeControlHandle;
3944
3945    fn control_handle(&self) -> &CompositeControlHandle {
3946        &self.control_handle
3947    }
3948
3949    fn drop_without_shutdown(mut self) {
3950        // Safety: drops once, never accessed again due to mem::forget
3951        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3952        // Prevent Drop from running (which would shut down the channel)
3953        std::mem::forget(self);
3954    }
3955}
3956
3957impl CompositeResetResponder {
3958    /// Sends a response to the FIDL transaction.
3959    ///
3960    /// Sets the channel to shutdown if an error occurs.
3961    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3962        let _result = self.send_raw(result);
3963        if _result.is_err() {
3964            self.control_handle.shutdown();
3965        }
3966        self.drop_without_shutdown();
3967        _result
3968    }
3969
3970    /// Similar to "send" but does not shutdown the channel if an error occurs.
3971    pub fn send_no_shutdown_on_err(
3972        self,
3973        mut result: Result<(), DriverError>,
3974    ) -> Result<(), fidl::Error> {
3975        let _result = self.send_raw(result);
3976        self.drop_without_shutdown();
3977        _result
3978    }
3979
3980    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3981        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3982            fidl::encoding::EmptyStruct,
3983            DriverError,
3984        >>(
3985            fidl::encoding::FlexibleResult::new(result),
3986            self.tx_id,
3987            0xac355fb98341996,
3988            fidl::encoding::DynamicFlags::FLEXIBLE,
3989        )
3990    }
3991}
3992
3993#[must_use = "FIDL methods require a response to be sent"]
3994#[derive(Debug)]
3995pub struct CompositeGetPropertiesResponder {
3996    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3997    tx_id: u32,
3998}
3999
4000/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4001/// if the responder is dropped without sending a response, so that the client
4002/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4003impl std::ops::Drop for CompositeGetPropertiesResponder {
4004    fn drop(&mut self) {
4005        self.control_handle.shutdown();
4006        // Safety: drops once, never accessed again
4007        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4008    }
4009}
4010
4011impl fidl::endpoints::Responder for CompositeGetPropertiesResponder {
4012    type ControlHandle = CompositeControlHandle;
4013
4014    fn control_handle(&self) -> &CompositeControlHandle {
4015        &self.control_handle
4016    }
4017
4018    fn drop_without_shutdown(mut self) {
4019        // Safety: drops once, never accessed again due to mem::forget
4020        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4021        // Prevent Drop from running (which would shut down the channel)
4022        std::mem::forget(self);
4023    }
4024}
4025
4026impl CompositeGetPropertiesResponder {
4027    /// Sends a response to the FIDL transaction.
4028    ///
4029    /// Sets the channel to shutdown if an error occurs.
4030    pub fn send(self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
4031        let _result = self.send_raw(properties);
4032        if _result.is_err() {
4033            self.control_handle.shutdown();
4034        }
4035        self.drop_without_shutdown();
4036        _result
4037    }
4038
4039    /// Similar to "send" but does not shutdown the channel if an error occurs.
4040    pub fn send_no_shutdown_on_err(
4041        self,
4042        mut properties: &CompositeProperties,
4043    ) -> Result<(), fidl::Error> {
4044        let _result = self.send_raw(properties);
4045        self.drop_without_shutdown();
4046        _result
4047    }
4048
4049    fn send_raw(&self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
4050        self.control_handle
4051            .inner
4052            .send::<fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>>(
4053                fidl::encoding::Flexible::new((properties,)),
4054                self.tx_id,
4055                0x31846fa0a459942b,
4056                fidl::encoding::DynamicFlags::FLEXIBLE,
4057            )
4058    }
4059}
4060
4061#[must_use = "FIDL methods require a response to be sent"]
4062#[derive(Debug)]
4063pub struct CompositeGetRingBufferFormatsResponder {
4064    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4065    tx_id: u32,
4066}
4067
4068/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4069/// if the responder is dropped without sending a response, so that the client
4070/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4071impl std::ops::Drop for CompositeGetRingBufferFormatsResponder {
4072    fn drop(&mut self) {
4073        self.control_handle.shutdown();
4074        // Safety: drops once, never accessed again
4075        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4076    }
4077}
4078
4079impl fidl::endpoints::Responder for CompositeGetRingBufferFormatsResponder {
4080    type ControlHandle = CompositeControlHandle;
4081
4082    fn control_handle(&self) -> &CompositeControlHandle {
4083        &self.control_handle
4084    }
4085
4086    fn drop_without_shutdown(mut self) {
4087        // Safety: drops once, never accessed again due to mem::forget
4088        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4089        // Prevent Drop from running (which would shut down the channel)
4090        std::mem::forget(self);
4091    }
4092}
4093
4094impl CompositeGetRingBufferFormatsResponder {
4095    /// Sends a response to the FIDL transaction.
4096    ///
4097    /// Sets the channel to shutdown if an error occurs.
4098    pub fn send(
4099        self,
4100        mut result: Result<&[SupportedFormats2], DriverError>,
4101    ) -> Result<(), fidl::Error> {
4102        let _result = self.send_raw(result);
4103        if _result.is_err() {
4104            self.control_handle.shutdown();
4105        }
4106        self.drop_without_shutdown();
4107        _result
4108    }
4109
4110    /// Similar to "send" but does not shutdown the channel if an error occurs.
4111    pub fn send_no_shutdown_on_err(
4112        self,
4113        mut result: Result<&[SupportedFormats2], DriverError>,
4114    ) -> Result<(), fidl::Error> {
4115        let _result = self.send_raw(result);
4116        self.drop_without_shutdown();
4117        _result
4118    }
4119
4120    fn send_raw(
4121        &self,
4122        mut result: Result<&[SupportedFormats2], DriverError>,
4123    ) -> Result<(), fidl::Error> {
4124        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4125            CompositeGetRingBufferFormatsResponse,
4126            DriverError,
4127        >>(
4128            fidl::encoding::FlexibleResult::new(
4129                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
4130            ),
4131            self.tx_id,
4132            0x1d89b701b6816ac4,
4133            fidl::encoding::DynamicFlags::FLEXIBLE,
4134        )
4135    }
4136}
4137
4138#[must_use = "FIDL methods require a response to be sent"]
4139#[derive(Debug)]
4140pub struct CompositeCreateRingBufferResponder {
4141    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4142    tx_id: u32,
4143}
4144
4145/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4146/// if the responder is dropped without sending a response, so that the client
4147/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4148impl std::ops::Drop for CompositeCreateRingBufferResponder {
4149    fn drop(&mut self) {
4150        self.control_handle.shutdown();
4151        // Safety: drops once, never accessed again
4152        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4153    }
4154}
4155
4156impl fidl::endpoints::Responder for CompositeCreateRingBufferResponder {
4157    type ControlHandle = CompositeControlHandle;
4158
4159    fn control_handle(&self) -> &CompositeControlHandle {
4160        &self.control_handle
4161    }
4162
4163    fn drop_without_shutdown(mut self) {
4164        // Safety: drops once, never accessed again due to mem::forget
4165        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4166        // Prevent Drop from running (which would shut down the channel)
4167        std::mem::forget(self);
4168    }
4169}
4170
4171impl CompositeCreateRingBufferResponder {
4172    /// Sends a response to the FIDL transaction.
4173    ///
4174    /// Sets the channel to shutdown if an error occurs.
4175    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4176        let _result = self.send_raw(result);
4177        if _result.is_err() {
4178            self.control_handle.shutdown();
4179        }
4180        self.drop_without_shutdown();
4181        _result
4182    }
4183
4184    /// Similar to "send" but does not shutdown the channel if an error occurs.
4185    pub fn send_no_shutdown_on_err(
4186        self,
4187        mut result: Result<(), DriverError>,
4188    ) -> Result<(), fidl::Error> {
4189        let _result = self.send_raw(result);
4190        self.drop_without_shutdown();
4191        _result
4192    }
4193
4194    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4195        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4196            fidl::encoding::EmptyStruct,
4197            DriverError,
4198        >>(
4199            fidl::encoding::FlexibleResult::new(result),
4200            self.tx_id,
4201            0x28c5685f85262033,
4202            fidl::encoding::DynamicFlags::FLEXIBLE,
4203        )
4204    }
4205}
4206
4207#[must_use = "FIDL methods require a response to be sent"]
4208#[derive(Debug)]
4209pub struct CompositeGetDaiFormatsResponder {
4210    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4211    tx_id: u32,
4212}
4213
4214/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4215/// if the responder is dropped without sending a response, so that the client
4216/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4217impl std::ops::Drop for CompositeGetDaiFormatsResponder {
4218    fn drop(&mut self) {
4219        self.control_handle.shutdown();
4220        // Safety: drops once, never accessed again
4221        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4222    }
4223}
4224
4225impl fidl::endpoints::Responder for CompositeGetDaiFormatsResponder {
4226    type ControlHandle = CompositeControlHandle;
4227
4228    fn control_handle(&self) -> &CompositeControlHandle {
4229        &self.control_handle
4230    }
4231
4232    fn drop_without_shutdown(mut self) {
4233        // Safety: drops once, never accessed again due to mem::forget
4234        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4235        // Prevent Drop from running (which would shut down the channel)
4236        std::mem::forget(self);
4237    }
4238}
4239
4240impl CompositeGetDaiFormatsResponder {
4241    /// Sends a response to the FIDL transaction.
4242    ///
4243    /// Sets the channel to shutdown if an error occurs.
4244    pub fn send(
4245        self,
4246        mut result: Result<&[DaiSupportedFormats], DriverError>,
4247    ) -> Result<(), fidl::Error> {
4248        let _result = self.send_raw(result);
4249        if _result.is_err() {
4250            self.control_handle.shutdown();
4251        }
4252        self.drop_without_shutdown();
4253        _result
4254    }
4255
4256    /// Similar to "send" but does not shutdown the channel if an error occurs.
4257    pub fn send_no_shutdown_on_err(
4258        self,
4259        mut result: Result<&[DaiSupportedFormats], DriverError>,
4260    ) -> Result<(), fidl::Error> {
4261        let _result = self.send_raw(result);
4262        self.drop_without_shutdown();
4263        _result
4264    }
4265
4266    fn send_raw(
4267        &self,
4268        mut result: Result<&[DaiSupportedFormats], DriverError>,
4269    ) -> Result<(), fidl::Error> {
4270        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4271            CompositeGetDaiFormatsResponse,
4272            DriverError,
4273        >>(
4274            fidl::encoding::FlexibleResult::new(result.map(|dai_formats| (dai_formats,))),
4275            self.tx_id,
4276            0x3cbeaed59c8f69b,
4277            fidl::encoding::DynamicFlags::FLEXIBLE,
4278        )
4279    }
4280}
4281
4282#[must_use = "FIDL methods require a response to be sent"]
4283#[derive(Debug)]
4284pub struct CompositeSetDaiFormatResponder {
4285    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4286    tx_id: u32,
4287}
4288
4289/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4290/// if the responder is dropped without sending a response, so that the client
4291/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4292impl std::ops::Drop for CompositeSetDaiFormatResponder {
4293    fn drop(&mut self) {
4294        self.control_handle.shutdown();
4295        // Safety: drops once, never accessed again
4296        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4297    }
4298}
4299
4300impl fidl::endpoints::Responder for CompositeSetDaiFormatResponder {
4301    type ControlHandle = CompositeControlHandle;
4302
4303    fn control_handle(&self) -> &CompositeControlHandle {
4304        &self.control_handle
4305    }
4306
4307    fn drop_without_shutdown(mut self) {
4308        // Safety: drops once, never accessed again due to mem::forget
4309        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4310        // Prevent Drop from running (which would shut down the channel)
4311        std::mem::forget(self);
4312    }
4313}
4314
4315impl CompositeSetDaiFormatResponder {
4316    /// Sends a response to the FIDL transaction.
4317    ///
4318    /// Sets the channel to shutdown if an error occurs.
4319    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4320        let _result = self.send_raw(result);
4321        if _result.is_err() {
4322            self.control_handle.shutdown();
4323        }
4324        self.drop_without_shutdown();
4325        _result
4326    }
4327
4328    /// Similar to "send" but does not shutdown the channel if an error occurs.
4329    pub fn send_no_shutdown_on_err(
4330        self,
4331        mut result: Result<(), DriverError>,
4332    ) -> Result<(), fidl::Error> {
4333        let _result = self.send_raw(result);
4334        self.drop_without_shutdown();
4335        _result
4336    }
4337
4338    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4339        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4340            fidl::encoding::EmptyStruct,
4341            DriverError,
4342        >>(
4343            fidl::encoding::FlexibleResult::new(result),
4344            self.tx_id,
4345            0x155acf5cc0dc8a84,
4346            fidl::encoding::DynamicFlags::FLEXIBLE,
4347        )
4348    }
4349}
4350
4351#[must_use = "FIDL methods require a response to be sent"]
4352#[derive(Debug)]
4353pub struct CompositeGetPacketStreamFormatsResponder {
4354    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4355    tx_id: u32,
4356}
4357
4358/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4359/// if the responder is dropped without sending a response, so that the client
4360/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4361impl std::ops::Drop for CompositeGetPacketStreamFormatsResponder {
4362    fn drop(&mut self) {
4363        self.control_handle.shutdown();
4364        // Safety: drops once, never accessed again
4365        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4366    }
4367}
4368
4369impl fidl::endpoints::Responder for CompositeGetPacketStreamFormatsResponder {
4370    type ControlHandle = CompositeControlHandle;
4371
4372    fn control_handle(&self) -> &CompositeControlHandle {
4373        &self.control_handle
4374    }
4375
4376    fn drop_without_shutdown(mut self) {
4377        // Safety: drops once, never accessed again due to mem::forget
4378        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4379        // Prevent Drop from running (which would shut down the channel)
4380        std::mem::forget(self);
4381    }
4382}
4383
4384impl CompositeGetPacketStreamFormatsResponder {
4385    /// Sends a response to the FIDL transaction.
4386    ///
4387    /// Sets the channel to shutdown if an error occurs.
4388    pub fn send(
4389        self,
4390        mut result: Result<&[SupportedFormats2], DriverError>,
4391    ) -> Result<(), fidl::Error> {
4392        let _result = self.send_raw(result);
4393        if _result.is_err() {
4394            self.control_handle.shutdown();
4395        }
4396        self.drop_without_shutdown();
4397        _result
4398    }
4399
4400    /// Similar to "send" but does not shutdown the channel if an error occurs.
4401    pub fn send_no_shutdown_on_err(
4402        self,
4403        mut result: Result<&[SupportedFormats2], DriverError>,
4404    ) -> Result<(), fidl::Error> {
4405        let _result = self.send_raw(result);
4406        self.drop_without_shutdown();
4407        _result
4408    }
4409
4410    fn send_raw(
4411        &self,
4412        mut result: Result<&[SupportedFormats2], DriverError>,
4413    ) -> Result<(), fidl::Error> {
4414        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4415            CompositeGetPacketStreamFormatsResponse,
4416            DriverError,
4417        >>(
4418            fidl::encoding::FlexibleResult::new(
4419                result.map(|packet_stream_formats| (packet_stream_formats,)),
4420            ),
4421            self.tx_id,
4422            0x73cc47c6ad39bca7,
4423            fidl::encoding::DynamicFlags::FLEXIBLE,
4424        )
4425    }
4426}
4427
4428#[must_use = "FIDL methods require a response to be sent"]
4429#[derive(Debug)]
4430pub struct CompositeCreatePacketStreamResponder {
4431    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4432    tx_id: u32,
4433}
4434
4435/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4436/// if the responder is dropped without sending a response, so that the client
4437/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4438impl std::ops::Drop for CompositeCreatePacketStreamResponder {
4439    fn drop(&mut self) {
4440        self.control_handle.shutdown();
4441        // Safety: drops once, never accessed again
4442        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4443    }
4444}
4445
4446impl fidl::endpoints::Responder for CompositeCreatePacketStreamResponder {
4447    type ControlHandle = CompositeControlHandle;
4448
4449    fn control_handle(&self) -> &CompositeControlHandle {
4450        &self.control_handle
4451    }
4452
4453    fn drop_without_shutdown(mut self) {
4454        // Safety: drops once, never accessed again due to mem::forget
4455        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4456        // Prevent Drop from running (which would shut down the channel)
4457        std::mem::forget(self);
4458    }
4459}
4460
4461impl CompositeCreatePacketStreamResponder {
4462    /// Sends a response to the FIDL transaction.
4463    ///
4464    /// Sets the channel to shutdown if an error occurs.
4465    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4466        let _result = self.send_raw(result);
4467        if _result.is_err() {
4468            self.control_handle.shutdown();
4469        }
4470        self.drop_without_shutdown();
4471        _result
4472    }
4473
4474    /// Similar to "send" but does not shutdown the channel if an error occurs.
4475    pub fn send_no_shutdown_on_err(
4476        self,
4477        mut result: Result<(), DriverError>,
4478    ) -> Result<(), fidl::Error> {
4479        let _result = self.send_raw(result);
4480        self.drop_without_shutdown();
4481        _result
4482    }
4483
4484    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4485        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4486            fidl::encoding::EmptyStruct,
4487            DriverError,
4488        >>(
4489            fidl::encoding::FlexibleResult::new(result),
4490            self.tx_id,
4491            0x50e8902b756c707c,
4492            fidl::encoding::DynamicFlags::FLEXIBLE,
4493        )
4494    }
4495}
4496
4497#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4498pub struct CompositeConnectorMarker;
4499
4500impl fidl::endpoints::ProtocolMarker for CompositeConnectorMarker {
4501    type Proxy = CompositeConnectorProxy;
4502    type RequestStream = CompositeConnectorRequestStream;
4503    #[cfg(target_os = "fuchsia")]
4504    type SynchronousProxy = CompositeConnectorSynchronousProxy;
4505
4506    const DEBUG_NAME: &'static str = "(anonymous) CompositeConnector";
4507}
4508
4509pub trait CompositeConnectorProxyInterface: Send + Sync {
4510    fn r#connect(
4511        &self,
4512        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4513    ) -> Result<(), fidl::Error>;
4514}
4515#[derive(Debug)]
4516#[cfg(target_os = "fuchsia")]
4517pub struct CompositeConnectorSynchronousProxy {
4518    client: fidl::client::sync::Client,
4519}
4520
4521#[cfg(target_os = "fuchsia")]
4522impl fidl::endpoints::SynchronousProxy for CompositeConnectorSynchronousProxy {
4523    type Proxy = CompositeConnectorProxy;
4524    type Protocol = CompositeConnectorMarker;
4525
4526    fn from_channel(inner: fidl::Channel) -> Self {
4527        Self::new(inner)
4528    }
4529
4530    fn into_channel(self) -> fidl::Channel {
4531        self.client.into_channel()
4532    }
4533
4534    fn as_channel(&self) -> &fidl::Channel {
4535        self.client.as_channel()
4536    }
4537}
4538
4539#[cfg(target_os = "fuchsia")]
4540impl CompositeConnectorSynchronousProxy {
4541    pub fn new(channel: fidl::Channel) -> Self {
4542        Self { client: fidl::client::sync::Client::new(channel) }
4543    }
4544
4545    pub fn into_channel(self) -> fidl::Channel {
4546        self.client.into_channel()
4547    }
4548
4549    /// Waits until an event arrives and returns it. It is safe for other
4550    /// threads to make concurrent requests while waiting for an event.
4551    pub fn wait_for_event(
4552        &self,
4553        deadline: zx::MonotonicInstant,
4554    ) -> Result<CompositeConnectorEvent, fidl::Error> {
4555        CompositeConnectorEvent::decode(
4556            self.client.wait_for_event::<CompositeConnectorMarker>(deadline)?,
4557        )
4558    }
4559
4560    /// Connect to a `Composite` protocol.
4561    /// This method allows a component to serve FIDL outside the devhost's control.
4562    pub fn r#connect(
4563        &self,
4564        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4565    ) -> Result<(), fidl::Error> {
4566        self.client.send::<CompositeConnectorConnectRequest>(
4567            (composite_protocol,),
4568            0x7ee557529079e466,
4569            fidl::encoding::DynamicFlags::empty(),
4570        )
4571    }
4572}
4573
4574#[cfg(target_os = "fuchsia")]
4575impl From<CompositeConnectorSynchronousProxy> for zx::NullableHandle {
4576    fn from(value: CompositeConnectorSynchronousProxy) -> Self {
4577        value.into_channel().into()
4578    }
4579}
4580
4581#[cfg(target_os = "fuchsia")]
4582impl From<fidl::Channel> for CompositeConnectorSynchronousProxy {
4583    fn from(value: fidl::Channel) -> Self {
4584        Self::new(value)
4585    }
4586}
4587
4588#[cfg(target_os = "fuchsia")]
4589impl fidl::endpoints::FromClient for CompositeConnectorSynchronousProxy {
4590    type Protocol = CompositeConnectorMarker;
4591
4592    fn from_client(value: fidl::endpoints::ClientEnd<CompositeConnectorMarker>) -> Self {
4593        Self::new(value.into_channel())
4594    }
4595}
4596
4597#[derive(Debug, Clone)]
4598pub struct CompositeConnectorProxy {
4599    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4600}
4601
4602impl fidl::endpoints::Proxy for CompositeConnectorProxy {
4603    type Protocol = CompositeConnectorMarker;
4604
4605    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4606        Self::new(inner)
4607    }
4608
4609    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4610        self.client.into_channel().map_err(|client| Self { client })
4611    }
4612
4613    fn as_channel(&self) -> &::fidl::AsyncChannel {
4614        self.client.as_channel()
4615    }
4616}
4617
4618impl CompositeConnectorProxy {
4619    /// Create a new Proxy for fuchsia.hardware.audio/CompositeConnector.
4620    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4621        let protocol_name =
4622            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4623        Self { client: fidl::client::Client::new(channel, protocol_name) }
4624    }
4625
4626    /// Get a Stream of events from the remote end of the protocol.
4627    ///
4628    /// # Panics
4629    ///
4630    /// Panics if the event stream was already taken.
4631    pub fn take_event_stream(&self) -> CompositeConnectorEventStream {
4632        CompositeConnectorEventStream { event_receiver: self.client.take_event_receiver() }
4633    }
4634
4635    /// Connect to a `Composite` protocol.
4636    /// This method allows a component to serve FIDL outside the devhost's control.
4637    pub fn r#connect(
4638        &self,
4639        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4640    ) -> Result<(), fidl::Error> {
4641        CompositeConnectorProxyInterface::r#connect(self, composite_protocol)
4642    }
4643}
4644
4645impl CompositeConnectorProxyInterface for CompositeConnectorProxy {
4646    fn r#connect(
4647        &self,
4648        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4649    ) -> Result<(), fidl::Error> {
4650        self.client.send::<CompositeConnectorConnectRequest>(
4651            (composite_protocol,),
4652            0x7ee557529079e466,
4653            fidl::encoding::DynamicFlags::empty(),
4654        )
4655    }
4656}
4657
4658pub struct CompositeConnectorEventStream {
4659    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4660}
4661
4662impl std::marker::Unpin for CompositeConnectorEventStream {}
4663
4664impl futures::stream::FusedStream for CompositeConnectorEventStream {
4665    fn is_terminated(&self) -> bool {
4666        self.event_receiver.is_terminated()
4667    }
4668}
4669
4670impl futures::Stream for CompositeConnectorEventStream {
4671    type Item = Result<CompositeConnectorEvent, fidl::Error>;
4672
4673    fn poll_next(
4674        mut self: std::pin::Pin<&mut Self>,
4675        cx: &mut std::task::Context<'_>,
4676    ) -> std::task::Poll<Option<Self::Item>> {
4677        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4678            &mut self.event_receiver,
4679            cx
4680        )?) {
4681            Some(buf) => std::task::Poll::Ready(Some(CompositeConnectorEvent::decode(buf))),
4682            None => std::task::Poll::Ready(None),
4683        }
4684    }
4685}
4686
4687#[derive(Debug)]
4688pub enum CompositeConnectorEvent {}
4689
4690impl CompositeConnectorEvent {
4691    /// Decodes a message buffer as a [`CompositeConnectorEvent`].
4692    fn decode(
4693        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4694    ) -> Result<CompositeConnectorEvent, fidl::Error> {
4695        let (bytes, _handles) = buf.split_mut();
4696        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4697        debug_assert_eq!(tx_header.tx_id, 0);
4698        match tx_header.ordinal {
4699            _ => Err(fidl::Error::UnknownOrdinal {
4700                ordinal: tx_header.ordinal,
4701                protocol_name:
4702                    <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4703            }),
4704        }
4705    }
4706}
4707
4708/// A Stream of incoming requests for fuchsia.hardware.audio/CompositeConnector.
4709pub struct CompositeConnectorRequestStream {
4710    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4711    is_terminated: bool,
4712}
4713
4714impl std::marker::Unpin for CompositeConnectorRequestStream {}
4715
4716impl futures::stream::FusedStream for CompositeConnectorRequestStream {
4717    fn is_terminated(&self) -> bool {
4718        self.is_terminated
4719    }
4720}
4721
4722impl fidl::endpoints::RequestStream for CompositeConnectorRequestStream {
4723    type Protocol = CompositeConnectorMarker;
4724    type ControlHandle = CompositeConnectorControlHandle;
4725
4726    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4727        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4728    }
4729
4730    fn control_handle(&self) -> Self::ControlHandle {
4731        CompositeConnectorControlHandle { inner: self.inner.clone() }
4732    }
4733
4734    fn into_inner(
4735        self,
4736    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4737    {
4738        (self.inner, self.is_terminated)
4739    }
4740
4741    fn from_inner(
4742        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4743        is_terminated: bool,
4744    ) -> Self {
4745        Self { inner, is_terminated }
4746    }
4747}
4748
4749impl futures::Stream for CompositeConnectorRequestStream {
4750    type Item = Result<CompositeConnectorRequest, fidl::Error>;
4751
4752    fn poll_next(
4753        mut self: std::pin::Pin<&mut Self>,
4754        cx: &mut std::task::Context<'_>,
4755    ) -> std::task::Poll<Option<Self::Item>> {
4756        let this = &mut *self;
4757        if this.inner.check_shutdown(cx) {
4758            this.is_terminated = true;
4759            return std::task::Poll::Ready(None);
4760        }
4761        if this.is_terminated {
4762            panic!("polled CompositeConnectorRequestStream after completion");
4763        }
4764        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4765            |bytes, handles| {
4766                match this.inner.channel().read_etc(cx, bytes, handles) {
4767                    std::task::Poll::Ready(Ok(())) => {}
4768                    std::task::Poll::Pending => return std::task::Poll::Pending,
4769                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4770                        this.is_terminated = true;
4771                        return std::task::Poll::Ready(None);
4772                    }
4773                    std::task::Poll::Ready(Err(e)) => {
4774                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4775                            e.into(),
4776                        ))));
4777                    }
4778                }
4779
4780                // A message has been received from the channel
4781                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4782
4783                std::task::Poll::Ready(Some(match header.ordinal {
4784                0x7ee557529079e466 => {
4785                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4786                    let mut req = fidl::new_empty!(CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4787                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4788                    let control_handle = CompositeConnectorControlHandle {
4789                        inner: this.inner.clone(),
4790                    };
4791                    Ok(CompositeConnectorRequest::Connect {composite_protocol: req.composite_protocol,
4792
4793                        control_handle,
4794                    })
4795                }
4796                _ => Err(fidl::Error::UnknownOrdinal {
4797                    ordinal: header.ordinal,
4798                    protocol_name: <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4799                }),
4800            }))
4801            },
4802        )
4803    }
4804}
4805
4806/// For an overview see
4807/// [Audio Composite Devices](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md).
4808#[derive(Debug)]
4809pub enum CompositeConnectorRequest {
4810    /// Connect to a `Composite` protocol.
4811    /// This method allows a component to serve FIDL outside the devhost's control.
4812    Connect {
4813        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4814        control_handle: CompositeConnectorControlHandle,
4815    },
4816}
4817
4818impl CompositeConnectorRequest {
4819    #[allow(irrefutable_let_patterns)]
4820    pub fn into_connect(
4821        self,
4822    ) -> Option<(fidl::endpoints::ServerEnd<CompositeMarker>, CompositeConnectorControlHandle)>
4823    {
4824        if let CompositeConnectorRequest::Connect { composite_protocol, control_handle } = self {
4825            Some((composite_protocol, control_handle))
4826        } else {
4827            None
4828        }
4829    }
4830
4831    /// Name of the method defined in FIDL
4832    pub fn method_name(&self) -> &'static str {
4833        match *self {
4834            CompositeConnectorRequest::Connect { .. } => "connect",
4835        }
4836    }
4837}
4838
4839#[derive(Debug, Clone)]
4840pub struct CompositeConnectorControlHandle {
4841    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4842}
4843
4844impl CompositeConnectorControlHandle {
4845    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4846        self.inner.shutdown_with_epitaph(status.into())
4847    }
4848}
4849
4850impl fidl::endpoints::ControlHandle for CompositeConnectorControlHandle {
4851    fn shutdown(&self) {
4852        self.inner.shutdown()
4853    }
4854
4855    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4856        self.inner.shutdown_with_epitaph(status)
4857    }
4858
4859    fn is_closed(&self) -> bool {
4860        self.inner.channel().is_closed()
4861    }
4862    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4863        self.inner.channel().on_closed()
4864    }
4865
4866    #[cfg(target_os = "fuchsia")]
4867    fn signal_peer(
4868        &self,
4869        clear_mask: zx::Signals,
4870        set_mask: zx::Signals,
4871    ) -> Result<(), zx_status::Status> {
4872        use fidl::Peered;
4873        self.inner.channel().signal_peer(clear_mask, set_mask)
4874    }
4875}
4876
4877impl CompositeConnectorControlHandle {}
4878
4879#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4880pub struct DaiMarker;
4881
4882impl fidl::endpoints::ProtocolMarker for DaiMarker {
4883    type Proxy = DaiProxy;
4884    type RequestStream = DaiRequestStream;
4885    #[cfg(target_os = "fuchsia")]
4886    type SynchronousProxy = DaiSynchronousProxy;
4887
4888    const DEBUG_NAME: &'static str = "(anonymous) Dai";
4889}
4890pub type DaiGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
4891pub type DaiGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, i32>;
4892
4893pub trait DaiProxyInterface: Send + Sync {
4894    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
4895        + Send;
4896    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
4897    fn r#signal_processing_connect(
4898        &self,
4899        protocol: fidl::endpoints::ServerEnd<
4900            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4901        >,
4902    ) -> Result<(), fidl::Error>;
4903    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4904    fn r#reset(&self) -> Self::ResetResponseFut;
4905    type GetPropertiesResponseFut: std::future::Future<Output = Result<DaiProperties, fidl::Error>>
4906        + Send;
4907    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
4908    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<DaiGetDaiFormatsResult, fidl::Error>>
4909        + Send;
4910    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
4911    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<DaiGetRingBufferFormatsResult, fidl::Error>>
4912        + Send;
4913    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut;
4914    fn r#create_ring_buffer(
4915        &self,
4916        dai_format: &DaiFormat,
4917        ring_buffer_format: &Format,
4918        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4919    ) -> Result<(), fidl::Error>;
4920}
4921#[derive(Debug)]
4922#[cfg(target_os = "fuchsia")]
4923pub struct DaiSynchronousProxy {
4924    client: fidl::client::sync::Client,
4925}
4926
4927#[cfg(target_os = "fuchsia")]
4928impl fidl::endpoints::SynchronousProxy for DaiSynchronousProxy {
4929    type Proxy = DaiProxy;
4930    type Protocol = DaiMarker;
4931
4932    fn from_channel(inner: fidl::Channel) -> Self {
4933        Self::new(inner)
4934    }
4935
4936    fn into_channel(self) -> fidl::Channel {
4937        self.client.into_channel()
4938    }
4939
4940    fn as_channel(&self) -> &fidl::Channel {
4941        self.client.as_channel()
4942    }
4943}
4944
4945#[cfg(target_os = "fuchsia")]
4946impl DaiSynchronousProxy {
4947    pub fn new(channel: fidl::Channel) -> Self {
4948        Self { client: fidl::client::sync::Client::new(channel) }
4949    }
4950
4951    pub fn into_channel(self) -> fidl::Channel {
4952        self.client.into_channel()
4953    }
4954
4955    /// Waits until an event arrives and returns it. It is safe for other
4956    /// threads to make concurrent requests while waiting for an event.
4957    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<DaiEvent, fidl::Error> {
4958        DaiEvent::decode(self.client.wait_for_event::<DaiMarker>(deadline)?)
4959    }
4960
4961    /// Retrieves top level health state.
4962    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4963    pub fn r#get_health_state(
4964        &self,
4965        ___deadline: zx::MonotonicInstant,
4966    ) -> Result<HealthState, fidl::Error> {
4967        let _response = self
4968            .client
4969            .send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse, DaiMarker>(
4970                (),
4971                0x4e146d6bca733a84,
4972                fidl::encoding::DynamicFlags::empty(),
4973                ___deadline,
4974            )?;
4975        Ok(_response.state)
4976    }
4977
4978    /// Connect to a `SignalProcessing` protocol.
4979    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4980    /// the maximum number of connections have already been created, for instance one, then the
4981    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4982    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4983    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4984    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4985    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4986    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4987    /// is intended to be composed, and hence the more verbose name allows differentiation and
4988    /// improved clarity.
4989    pub fn r#signal_processing_connect(
4990        &self,
4991        mut protocol: fidl::endpoints::ServerEnd<
4992            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4993        >,
4994    ) -> Result<(), fidl::Error> {
4995        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4996            (protocol,),
4997            0xa81907ce6066295,
4998            fidl::encoding::DynamicFlags::empty(),
4999        )
5000    }
5001
5002    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5003    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5004    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5005    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5006    /// protocol channel and retry.
5007    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
5008        let _response = self
5009            .client
5010            .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload, DaiMarker>(
5011                (),
5012                0x69e5fa9fa2f78c14,
5013                fidl::encoding::DynamicFlags::empty(),
5014                ___deadline,
5015            )?;
5016        Ok(_response)
5017    }
5018
5019    /// Retrieves top level static properties.
5020    pub fn r#get_properties(
5021        &self,
5022        ___deadline: zx::MonotonicInstant,
5023    ) -> Result<DaiProperties, fidl::Error> {
5024        let _response = self
5025            .client
5026            .send_query::<fidl::encoding::EmptyPayload, DaiGetPropertiesResponse, DaiMarker>(
5027                (),
5028                0x2c25a1a66149510b,
5029                fidl::encoding::DynamicFlags::empty(),
5030                ___deadline,
5031            )?;
5032        Ok(_response.properties)
5033    }
5034
5035    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5036    /// may reply with an error status and the client may retry at a later time.
5037    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5038    /// the parameters in SupportedFormats may be supported.
5039    pub fn r#get_dai_formats(
5040        &self,
5041        ___deadline: zx::MonotonicInstant,
5042    ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
5043        let _response = self.client.send_query::<
5044            fidl::encoding::EmptyPayload,
5045            fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
5046            DaiMarker,
5047        >(
5048            (),
5049            0x1eb37b0cddf79d69,
5050            fidl::encoding::DynamicFlags::empty(),
5051            ___deadline,
5052        )?;
5053        Ok(_response.map(|x| x.dai_formats))
5054    }
5055
5056    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5057    /// may reply with an error status and the client may retry at a later time.
5058    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5059    /// the parameters in `SupportedFormats` may be supported.
5060    pub fn r#get_ring_buffer_formats(
5061        &self,
5062        ___deadline: zx::MonotonicInstant,
5063    ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
5064        let _response = self.client.send_query::<
5065            fidl::encoding::EmptyPayload,
5066            fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
5067            DaiMarker,
5068        >(
5069            (),
5070            0x760371081d8c92e4,
5071            fidl::encoding::DynamicFlags::empty(),
5072            ___deadline,
5073        )?;
5074        Ok(_response.map(|x| x.ring_buffer_formats))
5075    }
5076
5077    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5078    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5079    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5080    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5081    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5082    /// gracefully quiesce any on-going streaming operations in the process.
5083    pub fn r#create_ring_buffer(
5084        &self,
5085        mut dai_format: &DaiFormat,
5086        mut ring_buffer_format: &Format,
5087        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5088    ) -> Result<(), fidl::Error> {
5089        self.client.send::<DaiCreateRingBufferRequest>(
5090            (dai_format, ring_buffer_format, ring_buffer),
5091            0x5af9760589a75257,
5092            fidl::encoding::DynamicFlags::empty(),
5093        )
5094    }
5095}
5096
5097#[cfg(target_os = "fuchsia")]
5098impl From<DaiSynchronousProxy> for zx::NullableHandle {
5099    fn from(value: DaiSynchronousProxy) -> Self {
5100        value.into_channel().into()
5101    }
5102}
5103
5104#[cfg(target_os = "fuchsia")]
5105impl From<fidl::Channel> for DaiSynchronousProxy {
5106    fn from(value: fidl::Channel) -> Self {
5107        Self::new(value)
5108    }
5109}
5110
5111#[cfg(target_os = "fuchsia")]
5112impl fidl::endpoints::FromClient for DaiSynchronousProxy {
5113    type Protocol = DaiMarker;
5114
5115    fn from_client(value: fidl::endpoints::ClientEnd<DaiMarker>) -> Self {
5116        Self::new(value.into_channel())
5117    }
5118}
5119
5120#[derive(Debug, Clone)]
5121pub struct DaiProxy {
5122    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5123}
5124
5125impl fidl::endpoints::Proxy for DaiProxy {
5126    type Protocol = DaiMarker;
5127
5128    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5129        Self::new(inner)
5130    }
5131
5132    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5133        self.client.into_channel().map_err(|client| Self { client })
5134    }
5135
5136    fn as_channel(&self) -> &::fidl::AsyncChannel {
5137        self.client.as_channel()
5138    }
5139}
5140
5141impl DaiProxy {
5142    /// Create a new Proxy for fuchsia.hardware.audio/Dai.
5143    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5144        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5145        Self { client: fidl::client::Client::new(channel, protocol_name) }
5146    }
5147
5148    /// Get a Stream of events from the remote end of the protocol.
5149    ///
5150    /// # Panics
5151    ///
5152    /// Panics if the event stream was already taken.
5153    pub fn take_event_stream(&self) -> DaiEventStream {
5154        DaiEventStream { event_receiver: self.client.take_event_receiver() }
5155    }
5156
5157    /// Retrieves top level health state.
5158    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5159    pub fn r#get_health_state(
5160        &self,
5161    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
5162    {
5163        DaiProxyInterface::r#get_health_state(self)
5164    }
5165
5166    /// Connect to a `SignalProcessing` protocol.
5167    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
5168    /// the maximum number of connections have already been created, for instance one, then the
5169    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
5170    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
5171    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
5172    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
5173    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
5174    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
5175    /// is intended to be composed, and hence the more verbose name allows differentiation and
5176    /// improved clarity.
5177    pub fn r#signal_processing_connect(
5178        &self,
5179        mut protocol: fidl::endpoints::ServerEnd<
5180            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5181        >,
5182    ) -> Result<(), fidl::Error> {
5183        DaiProxyInterface::r#signal_processing_connect(self, protocol)
5184    }
5185
5186    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5187    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5188    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5189    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5190    /// protocol channel and retry.
5191    pub fn r#reset(
5192        &self,
5193    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5194        DaiProxyInterface::r#reset(self)
5195    }
5196
5197    /// Retrieves top level static properties.
5198    pub fn r#get_properties(
5199        &self,
5200    ) -> fidl::client::QueryResponseFut<DaiProperties, fidl::encoding::DefaultFuchsiaResourceDialect>
5201    {
5202        DaiProxyInterface::r#get_properties(self)
5203    }
5204
5205    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5206    /// may reply with an error status and the client may retry at a later time.
5207    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5208    /// the parameters in SupportedFormats may be supported.
5209    pub fn r#get_dai_formats(
5210        &self,
5211    ) -> fidl::client::QueryResponseFut<
5212        DaiGetDaiFormatsResult,
5213        fidl::encoding::DefaultFuchsiaResourceDialect,
5214    > {
5215        DaiProxyInterface::r#get_dai_formats(self)
5216    }
5217
5218    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5219    /// may reply with an error status and the client may retry at a later time.
5220    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5221    /// the parameters in `SupportedFormats` may be supported.
5222    pub fn r#get_ring_buffer_formats(
5223        &self,
5224    ) -> fidl::client::QueryResponseFut<
5225        DaiGetRingBufferFormatsResult,
5226        fidl::encoding::DefaultFuchsiaResourceDialect,
5227    > {
5228        DaiProxyInterface::r#get_ring_buffer_formats(self)
5229    }
5230
5231    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5232    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5233    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5234    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5235    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5236    /// gracefully quiesce any on-going streaming operations in the process.
5237    pub fn r#create_ring_buffer(
5238        &self,
5239        mut dai_format: &DaiFormat,
5240        mut ring_buffer_format: &Format,
5241        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5242    ) -> Result<(), fidl::Error> {
5243        DaiProxyInterface::r#create_ring_buffer(self, dai_format, ring_buffer_format, ring_buffer)
5244    }
5245}
5246
5247impl DaiProxyInterface for DaiProxy {
5248    type GetHealthStateResponseFut =
5249        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
5250    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
5251        fn _decode(
5252            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5253        ) -> Result<HealthState, fidl::Error> {
5254            let _response = fidl::client::decode_transaction_body::<
5255                HealthGetHealthStateResponse,
5256                fidl::encoding::DefaultFuchsiaResourceDialect,
5257                0x4e146d6bca733a84,
5258            >(_buf?)?;
5259            Ok(_response.state)
5260        }
5261        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
5262            (),
5263            0x4e146d6bca733a84,
5264            fidl::encoding::DynamicFlags::empty(),
5265            _decode,
5266        )
5267    }
5268
5269    fn r#signal_processing_connect(
5270        &self,
5271        mut protocol: fidl::endpoints::ServerEnd<
5272            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5273        >,
5274    ) -> Result<(), fidl::Error> {
5275        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
5276            (protocol,),
5277            0xa81907ce6066295,
5278            fidl::encoding::DynamicFlags::empty(),
5279        )
5280    }
5281
5282    type ResetResponseFut =
5283        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5284    fn r#reset(&self) -> Self::ResetResponseFut {
5285        fn _decode(
5286            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5287        ) -> Result<(), fidl::Error> {
5288            let _response = fidl::client::decode_transaction_body::<
5289                fidl::encoding::EmptyPayload,
5290                fidl::encoding::DefaultFuchsiaResourceDialect,
5291                0x69e5fa9fa2f78c14,
5292            >(_buf?)?;
5293            Ok(_response)
5294        }
5295        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
5296            (),
5297            0x69e5fa9fa2f78c14,
5298            fidl::encoding::DynamicFlags::empty(),
5299            _decode,
5300        )
5301    }
5302
5303    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
5304        DaiProperties,
5305        fidl::encoding::DefaultFuchsiaResourceDialect,
5306    >;
5307    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
5308        fn _decode(
5309            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5310        ) -> Result<DaiProperties, fidl::Error> {
5311            let _response = fidl::client::decode_transaction_body::<
5312                DaiGetPropertiesResponse,
5313                fidl::encoding::DefaultFuchsiaResourceDialect,
5314                0x2c25a1a66149510b,
5315            >(_buf?)?;
5316            Ok(_response.properties)
5317        }
5318        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiProperties>(
5319            (),
5320            0x2c25a1a66149510b,
5321            fidl::encoding::DynamicFlags::empty(),
5322            _decode,
5323        )
5324    }
5325
5326    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
5327        DaiGetDaiFormatsResult,
5328        fidl::encoding::DefaultFuchsiaResourceDialect,
5329    >;
5330    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
5331        fn _decode(
5332            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5333        ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
5334            let _response = fidl::client::decode_transaction_body::<
5335                fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
5336                fidl::encoding::DefaultFuchsiaResourceDialect,
5337                0x1eb37b0cddf79d69,
5338            >(_buf?)?;
5339            Ok(_response.map(|x| x.dai_formats))
5340        }
5341        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetDaiFormatsResult>(
5342            (),
5343            0x1eb37b0cddf79d69,
5344            fidl::encoding::DynamicFlags::empty(),
5345            _decode,
5346        )
5347    }
5348
5349    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
5350        DaiGetRingBufferFormatsResult,
5351        fidl::encoding::DefaultFuchsiaResourceDialect,
5352    >;
5353    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut {
5354        fn _decode(
5355            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5356        ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
5357            let _response = fidl::client::decode_transaction_body::<
5358                fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
5359                fidl::encoding::DefaultFuchsiaResourceDialect,
5360                0x760371081d8c92e4,
5361            >(_buf?)?;
5362            Ok(_response.map(|x| x.ring_buffer_formats))
5363        }
5364        self.client
5365            .send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetRingBufferFormatsResult>(
5366                (),
5367                0x760371081d8c92e4,
5368                fidl::encoding::DynamicFlags::empty(),
5369                _decode,
5370            )
5371    }
5372
5373    fn r#create_ring_buffer(
5374        &self,
5375        mut dai_format: &DaiFormat,
5376        mut ring_buffer_format: &Format,
5377        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5378    ) -> Result<(), fidl::Error> {
5379        self.client.send::<DaiCreateRingBufferRequest>(
5380            (dai_format, ring_buffer_format, ring_buffer),
5381            0x5af9760589a75257,
5382            fidl::encoding::DynamicFlags::empty(),
5383        )
5384    }
5385}
5386
5387pub struct DaiEventStream {
5388    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5389}
5390
5391impl std::marker::Unpin for DaiEventStream {}
5392
5393impl futures::stream::FusedStream for DaiEventStream {
5394    fn is_terminated(&self) -> bool {
5395        self.event_receiver.is_terminated()
5396    }
5397}
5398
5399impl futures::Stream for DaiEventStream {
5400    type Item = Result<DaiEvent, fidl::Error>;
5401
5402    fn poll_next(
5403        mut self: std::pin::Pin<&mut Self>,
5404        cx: &mut std::task::Context<'_>,
5405    ) -> std::task::Poll<Option<Self::Item>> {
5406        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5407            &mut self.event_receiver,
5408            cx
5409        )?) {
5410            Some(buf) => std::task::Poll::Ready(Some(DaiEvent::decode(buf))),
5411            None => std::task::Poll::Ready(None),
5412        }
5413    }
5414}
5415
5416#[derive(Debug)]
5417pub enum DaiEvent {}
5418
5419impl DaiEvent {
5420    /// Decodes a message buffer as a [`DaiEvent`].
5421    fn decode(
5422        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5423    ) -> Result<DaiEvent, fidl::Error> {
5424        let (bytes, _handles) = buf.split_mut();
5425        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5426        debug_assert_eq!(tx_header.tx_id, 0);
5427        match tx_header.ordinal {
5428            _ => Err(fidl::Error::UnknownOrdinal {
5429                ordinal: tx_header.ordinal,
5430                protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5431            }),
5432        }
5433    }
5434}
5435
5436/// A Stream of incoming requests for fuchsia.hardware.audio/Dai.
5437pub struct DaiRequestStream {
5438    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5439    is_terminated: bool,
5440}
5441
5442impl std::marker::Unpin for DaiRequestStream {}
5443
5444impl futures::stream::FusedStream for DaiRequestStream {
5445    fn is_terminated(&self) -> bool {
5446        self.is_terminated
5447    }
5448}
5449
5450impl fidl::endpoints::RequestStream for DaiRequestStream {
5451    type Protocol = DaiMarker;
5452    type ControlHandle = DaiControlHandle;
5453
5454    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5455        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5456    }
5457
5458    fn control_handle(&self) -> Self::ControlHandle {
5459        DaiControlHandle { inner: self.inner.clone() }
5460    }
5461
5462    fn into_inner(
5463        self,
5464    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5465    {
5466        (self.inner, self.is_terminated)
5467    }
5468
5469    fn from_inner(
5470        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5471        is_terminated: bool,
5472    ) -> Self {
5473        Self { inner, is_terminated }
5474    }
5475}
5476
5477impl futures::Stream for DaiRequestStream {
5478    type Item = Result<DaiRequest, fidl::Error>;
5479
5480    fn poll_next(
5481        mut self: std::pin::Pin<&mut Self>,
5482        cx: &mut std::task::Context<'_>,
5483    ) -> std::task::Poll<Option<Self::Item>> {
5484        let this = &mut *self;
5485        if this.inner.check_shutdown(cx) {
5486            this.is_terminated = true;
5487            return std::task::Poll::Ready(None);
5488        }
5489        if this.is_terminated {
5490            panic!("polled DaiRequestStream after completion");
5491        }
5492        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5493            |bytes, handles| {
5494                match this.inner.channel().read_etc(cx, bytes, handles) {
5495                    std::task::Poll::Ready(Ok(())) => {}
5496                    std::task::Poll::Pending => return std::task::Poll::Pending,
5497                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5498                        this.is_terminated = true;
5499                        return std::task::Poll::Ready(None);
5500                    }
5501                    std::task::Poll::Ready(Err(e)) => {
5502                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5503                            e.into(),
5504                        ))));
5505                    }
5506                }
5507
5508                // A message has been received from the channel
5509                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5510
5511                std::task::Poll::Ready(Some(match header.ordinal {
5512                    0x4e146d6bca733a84 => {
5513                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5514                        let mut req = fidl::new_empty!(
5515                            fidl::encoding::EmptyPayload,
5516                            fidl::encoding::DefaultFuchsiaResourceDialect
5517                        );
5518                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5519                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5520                        Ok(DaiRequest::GetHealthState {
5521                            responder: DaiGetHealthStateResponder {
5522                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5523                                tx_id: header.tx_id,
5524                            },
5525                        })
5526                    }
5527                    0xa81907ce6066295 => {
5528                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5529                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5530                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5531                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5532                        Ok(DaiRequest::SignalProcessingConnect {
5533                            protocol: req.protocol,
5534
5535                            control_handle,
5536                        })
5537                    }
5538                    0x69e5fa9fa2f78c14 => {
5539                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5540                        let mut req = fidl::new_empty!(
5541                            fidl::encoding::EmptyPayload,
5542                            fidl::encoding::DefaultFuchsiaResourceDialect
5543                        );
5544                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5545                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5546                        Ok(DaiRequest::Reset {
5547                            responder: DaiResetResponder {
5548                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5549                                tx_id: header.tx_id,
5550                            },
5551                        })
5552                    }
5553                    0x2c25a1a66149510b => {
5554                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5555                        let mut req = fidl::new_empty!(
5556                            fidl::encoding::EmptyPayload,
5557                            fidl::encoding::DefaultFuchsiaResourceDialect
5558                        );
5559                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5560                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5561                        Ok(DaiRequest::GetProperties {
5562                            responder: DaiGetPropertiesResponder {
5563                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5564                                tx_id: header.tx_id,
5565                            },
5566                        })
5567                    }
5568                    0x1eb37b0cddf79d69 => {
5569                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5570                        let mut req = fidl::new_empty!(
5571                            fidl::encoding::EmptyPayload,
5572                            fidl::encoding::DefaultFuchsiaResourceDialect
5573                        );
5574                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5575                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5576                        Ok(DaiRequest::GetDaiFormats {
5577                            responder: DaiGetDaiFormatsResponder {
5578                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5579                                tx_id: header.tx_id,
5580                            },
5581                        })
5582                    }
5583                    0x760371081d8c92e4 => {
5584                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5585                        let mut req = fidl::new_empty!(
5586                            fidl::encoding::EmptyPayload,
5587                            fidl::encoding::DefaultFuchsiaResourceDialect
5588                        );
5589                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5590                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5591                        Ok(DaiRequest::GetRingBufferFormats {
5592                            responder: DaiGetRingBufferFormatsResponder {
5593                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5594                                tx_id: header.tx_id,
5595                            },
5596                        })
5597                    }
5598                    0x5af9760589a75257 => {
5599                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5600                        let mut req = fidl::new_empty!(
5601                            DaiCreateRingBufferRequest,
5602                            fidl::encoding::DefaultFuchsiaResourceDialect
5603                        );
5604                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
5605                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5606                        Ok(DaiRequest::CreateRingBuffer {
5607                            dai_format: req.dai_format,
5608                            ring_buffer_format: req.ring_buffer_format,
5609                            ring_buffer: req.ring_buffer,
5610
5611                            control_handle,
5612                        })
5613                    }
5614                    _ => Err(fidl::Error::UnknownOrdinal {
5615                        ordinal: header.ordinal,
5616                        protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5617                    }),
5618                }))
5619            },
5620        )
5621    }
5622}
5623
5624/// For an overview see
5625/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/development/audio/drivers/dai).
5626/// # Deprecation
5627///
5628/// Not supported anymore, instead use an
5629/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5630/// with one DAI and one Ring Buffer, see
5631/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5632#[derive(Debug)]
5633pub enum DaiRequest {
5634    /// Retrieves top level health state.
5635    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5636    GetHealthState { responder: DaiGetHealthStateResponder },
5637    /// Connect to a `SignalProcessing` protocol.
5638    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
5639    /// the maximum number of connections have already been created, for instance one, then the
5640    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
5641    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
5642    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
5643    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
5644    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
5645    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
5646    /// is intended to be composed, and hence the more verbose name allows differentiation and
5647    /// improved clarity.
5648    SignalProcessingConnect {
5649        protocol: fidl::endpoints::ServerEnd<
5650            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5651        >,
5652        control_handle: DaiControlHandle,
5653    },
5654    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5655    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5656    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5657    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5658    /// protocol channel and retry.
5659    Reset { responder: DaiResetResponder },
5660    /// Retrieves top level static properties.
5661    GetProperties { responder: DaiGetPropertiesResponder },
5662    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5663    /// may reply with an error status and the client may retry at a later time.
5664    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5665    /// the parameters in SupportedFormats may be supported.
5666    GetDaiFormats { responder: DaiGetDaiFormatsResponder },
5667    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5668    /// may reply with an error status and the client may retry at a later time.
5669    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5670    /// the parameters in `SupportedFormats` may be supported.
5671    GetRingBufferFormats { responder: DaiGetRingBufferFormatsResponder },
5672    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5673    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5674    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5675    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5676    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5677    /// gracefully quiesce any on-going streaming operations in the process.
5678    CreateRingBuffer {
5679        dai_format: DaiFormat,
5680        ring_buffer_format: Format,
5681        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5682        control_handle: DaiControlHandle,
5683    },
5684}
5685
5686impl DaiRequest {
5687    #[allow(irrefutable_let_patterns)]
5688    pub fn into_get_health_state(self) -> Option<(DaiGetHealthStateResponder)> {
5689        if let DaiRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
5690    }
5691
5692    #[allow(irrefutable_let_patterns)]
5693    pub fn into_signal_processing_connect(
5694        self,
5695    ) -> Option<(
5696        fidl::endpoints::ServerEnd<
5697            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5698        >,
5699        DaiControlHandle,
5700    )> {
5701        if let DaiRequest::SignalProcessingConnect { protocol, control_handle } = self {
5702            Some((protocol, control_handle))
5703        } else {
5704            None
5705        }
5706    }
5707
5708    #[allow(irrefutable_let_patterns)]
5709    pub fn into_reset(self) -> Option<(DaiResetResponder)> {
5710        if let DaiRequest::Reset { responder } = self { Some((responder)) } else { None }
5711    }
5712
5713    #[allow(irrefutable_let_patterns)]
5714    pub fn into_get_properties(self) -> Option<(DaiGetPropertiesResponder)> {
5715        if let DaiRequest::GetProperties { responder } = self { Some((responder)) } else { None }
5716    }
5717
5718    #[allow(irrefutable_let_patterns)]
5719    pub fn into_get_dai_formats(self) -> Option<(DaiGetDaiFormatsResponder)> {
5720        if let DaiRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
5721    }
5722
5723    #[allow(irrefutable_let_patterns)]
5724    pub fn into_get_ring_buffer_formats(self) -> Option<(DaiGetRingBufferFormatsResponder)> {
5725        if let DaiRequest::GetRingBufferFormats { responder } = self {
5726            Some((responder))
5727        } else {
5728            None
5729        }
5730    }
5731
5732    #[allow(irrefutable_let_patterns)]
5733    pub fn into_create_ring_buffer(
5734        self,
5735    ) -> Option<(DaiFormat, Format, fidl::endpoints::ServerEnd<RingBufferMarker>, DaiControlHandle)>
5736    {
5737        if let DaiRequest::CreateRingBuffer {
5738            dai_format,
5739            ring_buffer_format,
5740            ring_buffer,
5741            control_handle,
5742        } = self
5743        {
5744            Some((dai_format, ring_buffer_format, ring_buffer, control_handle))
5745        } else {
5746            None
5747        }
5748    }
5749
5750    /// Name of the method defined in FIDL
5751    pub fn method_name(&self) -> &'static str {
5752        match *self {
5753            DaiRequest::GetHealthState { .. } => "get_health_state",
5754            DaiRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
5755            DaiRequest::Reset { .. } => "reset",
5756            DaiRequest::GetProperties { .. } => "get_properties",
5757            DaiRequest::GetDaiFormats { .. } => "get_dai_formats",
5758            DaiRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
5759            DaiRequest::CreateRingBuffer { .. } => "create_ring_buffer",
5760        }
5761    }
5762}
5763
5764#[derive(Debug, Clone)]
5765pub struct DaiControlHandle {
5766    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5767}
5768
5769impl DaiControlHandle {
5770    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5771        self.inner.shutdown_with_epitaph(status.into())
5772    }
5773}
5774
5775impl fidl::endpoints::ControlHandle for DaiControlHandle {
5776    fn shutdown(&self) {
5777        self.inner.shutdown()
5778    }
5779
5780    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5781        self.inner.shutdown_with_epitaph(status)
5782    }
5783
5784    fn is_closed(&self) -> bool {
5785        self.inner.channel().is_closed()
5786    }
5787    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5788        self.inner.channel().on_closed()
5789    }
5790
5791    #[cfg(target_os = "fuchsia")]
5792    fn signal_peer(
5793        &self,
5794        clear_mask: zx::Signals,
5795        set_mask: zx::Signals,
5796    ) -> Result<(), zx_status::Status> {
5797        use fidl::Peered;
5798        self.inner.channel().signal_peer(clear_mask, set_mask)
5799    }
5800}
5801
5802impl DaiControlHandle {}
5803
5804#[must_use = "FIDL methods require a response to be sent"]
5805#[derive(Debug)]
5806pub struct DaiGetHealthStateResponder {
5807    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5808    tx_id: u32,
5809}
5810
5811/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5812/// if the responder is dropped without sending a response, so that the client
5813/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5814impl std::ops::Drop for DaiGetHealthStateResponder {
5815    fn drop(&mut self) {
5816        self.control_handle.shutdown();
5817        // Safety: drops once, never accessed again
5818        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5819    }
5820}
5821
5822impl fidl::endpoints::Responder for DaiGetHealthStateResponder {
5823    type ControlHandle = DaiControlHandle;
5824
5825    fn control_handle(&self) -> &DaiControlHandle {
5826        &self.control_handle
5827    }
5828
5829    fn drop_without_shutdown(mut self) {
5830        // Safety: drops once, never accessed again due to mem::forget
5831        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5832        // Prevent Drop from running (which would shut down the channel)
5833        std::mem::forget(self);
5834    }
5835}
5836
5837impl DaiGetHealthStateResponder {
5838    /// Sends a response to the FIDL transaction.
5839    ///
5840    /// Sets the channel to shutdown if an error occurs.
5841    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5842        let _result = self.send_raw(state);
5843        if _result.is_err() {
5844            self.control_handle.shutdown();
5845        }
5846        self.drop_without_shutdown();
5847        _result
5848    }
5849
5850    /// Similar to "send" but does not shutdown the channel if an error occurs.
5851    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5852        let _result = self.send_raw(state);
5853        self.drop_without_shutdown();
5854        _result
5855    }
5856
5857    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
5858        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
5859            (state,),
5860            self.tx_id,
5861            0x4e146d6bca733a84,
5862            fidl::encoding::DynamicFlags::empty(),
5863        )
5864    }
5865}
5866
5867#[must_use = "FIDL methods require a response to be sent"]
5868#[derive(Debug)]
5869pub struct DaiResetResponder {
5870    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5871    tx_id: u32,
5872}
5873
5874/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5875/// if the responder is dropped without sending a response, so that the client
5876/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5877impl std::ops::Drop for DaiResetResponder {
5878    fn drop(&mut self) {
5879        self.control_handle.shutdown();
5880        // Safety: drops once, never accessed again
5881        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5882    }
5883}
5884
5885impl fidl::endpoints::Responder for DaiResetResponder {
5886    type ControlHandle = DaiControlHandle;
5887
5888    fn control_handle(&self) -> &DaiControlHandle {
5889        &self.control_handle
5890    }
5891
5892    fn drop_without_shutdown(mut self) {
5893        // Safety: drops once, never accessed again due to mem::forget
5894        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5895        // Prevent Drop from running (which would shut down the channel)
5896        std::mem::forget(self);
5897    }
5898}
5899
5900impl DaiResetResponder {
5901    /// Sends a response to the FIDL transaction.
5902    ///
5903    /// Sets the channel to shutdown if an error occurs.
5904    pub fn send(self) -> Result<(), fidl::Error> {
5905        let _result = self.send_raw();
5906        if _result.is_err() {
5907            self.control_handle.shutdown();
5908        }
5909        self.drop_without_shutdown();
5910        _result
5911    }
5912
5913    /// Similar to "send" but does not shutdown the channel if an error occurs.
5914    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5915        let _result = self.send_raw();
5916        self.drop_without_shutdown();
5917        _result
5918    }
5919
5920    fn send_raw(&self) -> Result<(), fidl::Error> {
5921        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5922            (),
5923            self.tx_id,
5924            0x69e5fa9fa2f78c14,
5925            fidl::encoding::DynamicFlags::empty(),
5926        )
5927    }
5928}
5929
5930#[must_use = "FIDL methods require a response to be sent"]
5931#[derive(Debug)]
5932pub struct DaiGetPropertiesResponder {
5933    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5934    tx_id: u32,
5935}
5936
5937/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5938/// if the responder is dropped without sending a response, so that the client
5939/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5940impl std::ops::Drop for DaiGetPropertiesResponder {
5941    fn drop(&mut self) {
5942        self.control_handle.shutdown();
5943        // Safety: drops once, never accessed again
5944        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5945    }
5946}
5947
5948impl fidl::endpoints::Responder for DaiGetPropertiesResponder {
5949    type ControlHandle = DaiControlHandle;
5950
5951    fn control_handle(&self) -> &DaiControlHandle {
5952        &self.control_handle
5953    }
5954
5955    fn drop_without_shutdown(mut self) {
5956        // Safety: drops once, never accessed again due to mem::forget
5957        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5958        // Prevent Drop from running (which would shut down the channel)
5959        std::mem::forget(self);
5960    }
5961}
5962
5963impl DaiGetPropertiesResponder {
5964    /// Sends a response to the FIDL transaction.
5965    ///
5966    /// Sets the channel to shutdown if an error occurs.
5967    pub fn send(self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5968        let _result = self.send_raw(properties);
5969        if _result.is_err() {
5970            self.control_handle.shutdown();
5971        }
5972        self.drop_without_shutdown();
5973        _result
5974    }
5975
5976    /// Similar to "send" but does not shutdown the channel if an error occurs.
5977    pub fn send_no_shutdown_on_err(
5978        self,
5979        mut properties: &DaiProperties,
5980    ) -> Result<(), fidl::Error> {
5981        let _result = self.send_raw(properties);
5982        self.drop_without_shutdown();
5983        _result
5984    }
5985
5986    fn send_raw(&self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5987        self.control_handle.inner.send::<DaiGetPropertiesResponse>(
5988            (properties,),
5989            self.tx_id,
5990            0x2c25a1a66149510b,
5991            fidl::encoding::DynamicFlags::empty(),
5992        )
5993    }
5994}
5995
5996#[must_use = "FIDL methods require a response to be sent"]
5997#[derive(Debug)]
5998pub struct DaiGetDaiFormatsResponder {
5999    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
6000    tx_id: u32,
6001}
6002
6003/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
6004/// if the responder is dropped without sending a response, so that the client
6005/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6006impl std::ops::Drop for DaiGetDaiFormatsResponder {
6007    fn drop(&mut self) {
6008        self.control_handle.shutdown();
6009        // Safety: drops once, never accessed again
6010        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6011    }
6012}
6013
6014impl fidl::endpoints::Responder for DaiGetDaiFormatsResponder {
6015    type ControlHandle = DaiControlHandle;
6016
6017    fn control_handle(&self) -> &DaiControlHandle {
6018        &self.control_handle
6019    }
6020
6021    fn drop_without_shutdown(mut self) {
6022        // Safety: drops once, never accessed again due to mem::forget
6023        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6024        // Prevent Drop from running (which would shut down the channel)
6025        std::mem::forget(self);
6026    }
6027}
6028
6029impl DaiGetDaiFormatsResponder {
6030    /// Sends a response to the FIDL transaction.
6031    ///
6032    /// Sets the channel to shutdown if an error occurs.
6033    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
6034        let _result = self.send_raw(result);
6035        if _result.is_err() {
6036            self.control_handle.shutdown();
6037        }
6038        self.drop_without_shutdown();
6039        _result
6040    }
6041
6042    /// Similar to "send" but does not shutdown the channel if an error occurs.
6043    pub fn send_no_shutdown_on_err(
6044        self,
6045        mut result: Result<&[DaiSupportedFormats], i32>,
6046    ) -> Result<(), fidl::Error> {
6047        let _result = self.send_raw(result);
6048        self.drop_without_shutdown();
6049        _result
6050    }
6051
6052    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
6053        self.control_handle.inner.send::<fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>>(
6054            result.map(|dai_formats| (dai_formats,)),
6055            self.tx_id,
6056            0x1eb37b0cddf79d69,
6057            fidl::encoding::DynamicFlags::empty(),
6058        )
6059    }
6060}
6061
6062#[must_use = "FIDL methods require a response to be sent"]
6063#[derive(Debug)]
6064pub struct DaiGetRingBufferFormatsResponder {
6065    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
6066    tx_id: u32,
6067}
6068
6069/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
6070/// if the responder is dropped without sending a response, so that the client
6071/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6072impl std::ops::Drop for DaiGetRingBufferFormatsResponder {
6073    fn drop(&mut self) {
6074        self.control_handle.shutdown();
6075        // Safety: drops once, never accessed again
6076        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6077    }
6078}
6079
6080impl fidl::endpoints::Responder for DaiGetRingBufferFormatsResponder {
6081    type ControlHandle = DaiControlHandle;
6082
6083    fn control_handle(&self) -> &DaiControlHandle {
6084        &self.control_handle
6085    }
6086
6087    fn drop_without_shutdown(mut self) {
6088        // Safety: drops once, never accessed again due to mem::forget
6089        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6090        // Prevent Drop from running (which would shut down the channel)
6091        std::mem::forget(self);
6092    }
6093}
6094
6095impl DaiGetRingBufferFormatsResponder {
6096    /// Sends a response to the FIDL transaction.
6097    ///
6098    /// Sets the channel to shutdown if an error occurs.
6099    pub fn send(self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
6100        let _result = self.send_raw(result);
6101        if _result.is_err() {
6102            self.control_handle.shutdown();
6103        }
6104        self.drop_without_shutdown();
6105        _result
6106    }
6107
6108    /// Similar to "send" but does not shutdown the channel if an error occurs.
6109    pub fn send_no_shutdown_on_err(
6110        self,
6111        mut result: Result<&[SupportedFormats], i32>,
6112    ) -> Result<(), fidl::Error> {
6113        let _result = self.send_raw(result);
6114        self.drop_without_shutdown();
6115        _result
6116    }
6117
6118    fn send_raw(&self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
6119        self.control_handle
6120            .inner
6121            .send::<fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>>(
6122                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
6123                self.tx_id,
6124                0x760371081d8c92e4,
6125                fidl::encoding::DynamicFlags::empty(),
6126            )
6127    }
6128}
6129
6130#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6131pub struct DaiConnectorMarker;
6132
6133impl fidl::endpoints::ProtocolMarker for DaiConnectorMarker {
6134    type Proxy = DaiConnectorProxy;
6135    type RequestStream = DaiConnectorRequestStream;
6136    #[cfg(target_os = "fuchsia")]
6137    type SynchronousProxy = DaiConnectorSynchronousProxy;
6138
6139    const DEBUG_NAME: &'static str = "(anonymous) DaiConnector";
6140}
6141
6142pub trait DaiConnectorProxyInterface: Send + Sync {
6143    fn r#connect(
6144        &self,
6145        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6146    ) -> Result<(), fidl::Error>;
6147}
6148#[derive(Debug)]
6149#[cfg(target_os = "fuchsia")]
6150pub struct DaiConnectorSynchronousProxy {
6151    client: fidl::client::sync::Client,
6152}
6153
6154#[cfg(target_os = "fuchsia")]
6155impl fidl::endpoints::SynchronousProxy for DaiConnectorSynchronousProxy {
6156    type Proxy = DaiConnectorProxy;
6157    type Protocol = DaiConnectorMarker;
6158
6159    fn from_channel(inner: fidl::Channel) -> Self {
6160        Self::new(inner)
6161    }
6162
6163    fn into_channel(self) -> fidl::Channel {
6164        self.client.into_channel()
6165    }
6166
6167    fn as_channel(&self) -> &fidl::Channel {
6168        self.client.as_channel()
6169    }
6170}
6171
6172#[cfg(target_os = "fuchsia")]
6173impl DaiConnectorSynchronousProxy {
6174    pub fn new(channel: fidl::Channel) -> Self {
6175        Self { client: fidl::client::sync::Client::new(channel) }
6176    }
6177
6178    pub fn into_channel(self) -> fidl::Channel {
6179        self.client.into_channel()
6180    }
6181
6182    /// Waits until an event arrives and returns it. It is safe for other
6183    /// threads to make concurrent requests while waiting for an event.
6184    pub fn wait_for_event(
6185        &self,
6186        deadline: zx::MonotonicInstant,
6187    ) -> Result<DaiConnectorEvent, fidl::Error> {
6188        DaiConnectorEvent::decode(self.client.wait_for_event::<DaiConnectorMarker>(deadline)?)
6189    }
6190
6191    /// This connects to a DAI protocol server.
6192    pub fn r#connect(
6193        &self,
6194        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6195    ) -> Result<(), fidl::Error> {
6196        self.client.send::<DaiConnectorConnectRequest>(
6197            (dai_protocol,),
6198            0x4e4db05c2eca1450,
6199            fidl::encoding::DynamicFlags::empty(),
6200        )
6201    }
6202}
6203
6204#[cfg(target_os = "fuchsia")]
6205impl From<DaiConnectorSynchronousProxy> for zx::NullableHandle {
6206    fn from(value: DaiConnectorSynchronousProxy) -> Self {
6207        value.into_channel().into()
6208    }
6209}
6210
6211#[cfg(target_os = "fuchsia")]
6212impl From<fidl::Channel> for DaiConnectorSynchronousProxy {
6213    fn from(value: fidl::Channel) -> Self {
6214        Self::new(value)
6215    }
6216}
6217
6218#[cfg(target_os = "fuchsia")]
6219impl fidl::endpoints::FromClient for DaiConnectorSynchronousProxy {
6220    type Protocol = DaiConnectorMarker;
6221
6222    fn from_client(value: fidl::endpoints::ClientEnd<DaiConnectorMarker>) -> Self {
6223        Self::new(value.into_channel())
6224    }
6225}
6226
6227#[derive(Debug, Clone)]
6228pub struct DaiConnectorProxy {
6229    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6230}
6231
6232impl fidl::endpoints::Proxy for DaiConnectorProxy {
6233    type Protocol = DaiConnectorMarker;
6234
6235    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6236        Self::new(inner)
6237    }
6238
6239    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6240        self.client.into_channel().map_err(|client| Self { client })
6241    }
6242
6243    fn as_channel(&self) -> &::fidl::AsyncChannel {
6244        self.client.as_channel()
6245    }
6246}
6247
6248impl DaiConnectorProxy {
6249    /// Create a new Proxy for fuchsia.hardware.audio/DaiConnector.
6250    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6251        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6252        Self { client: fidl::client::Client::new(channel, protocol_name) }
6253    }
6254
6255    /// Get a Stream of events from the remote end of the protocol.
6256    ///
6257    /// # Panics
6258    ///
6259    /// Panics if the event stream was already taken.
6260    pub fn take_event_stream(&self) -> DaiConnectorEventStream {
6261        DaiConnectorEventStream { event_receiver: self.client.take_event_receiver() }
6262    }
6263
6264    /// This connects to a DAI protocol server.
6265    pub fn r#connect(
6266        &self,
6267        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6268    ) -> Result<(), fidl::Error> {
6269        DaiConnectorProxyInterface::r#connect(self, dai_protocol)
6270    }
6271}
6272
6273impl DaiConnectorProxyInterface for DaiConnectorProxy {
6274    fn r#connect(
6275        &self,
6276        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6277    ) -> Result<(), fidl::Error> {
6278        self.client.send::<DaiConnectorConnectRequest>(
6279            (dai_protocol,),
6280            0x4e4db05c2eca1450,
6281            fidl::encoding::DynamicFlags::empty(),
6282        )
6283    }
6284}
6285
6286pub struct DaiConnectorEventStream {
6287    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6288}
6289
6290impl std::marker::Unpin for DaiConnectorEventStream {}
6291
6292impl futures::stream::FusedStream for DaiConnectorEventStream {
6293    fn is_terminated(&self) -> bool {
6294        self.event_receiver.is_terminated()
6295    }
6296}
6297
6298impl futures::Stream for DaiConnectorEventStream {
6299    type Item = Result<DaiConnectorEvent, fidl::Error>;
6300
6301    fn poll_next(
6302        mut self: std::pin::Pin<&mut Self>,
6303        cx: &mut std::task::Context<'_>,
6304    ) -> std::task::Poll<Option<Self::Item>> {
6305        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6306            &mut self.event_receiver,
6307            cx
6308        )?) {
6309            Some(buf) => std::task::Poll::Ready(Some(DaiConnectorEvent::decode(buf))),
6310            None => std::task::Poll::Ready(None),
6311        }
6312    }
6313}
6314
6315#[derive(Debug)]
6316pub enum DaiConnectorEvent {}
6317
6318impl DaiConnectorEvent {
6319    /// Decodes a message buffer as a [`DaiConnectorEvent`].
6320    fn decode(
6321        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6322    ) -> Result<DaiConnectorEvent, fidl::Error> {
6323        let (bytes, _handles) = buf.split_mut();
6324        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6325        debug_assert_eq!(tx_header.tx_id, 0);
6326        match tx_header.ordinal {
6327            _ => Err(fidl::Error::UnknownOrdinal {
6328                ordinal: tx_header.ordinal,
6329                protocol_name: <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6330            }),
6331        }
6332    }
6333}
6334
6335/// A Stream of incoming requests for fuchsia.hardware.audio/DaiConnector.
6336pub struct DaiConnectorRequestStream {
6337    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6338    is_terminated: bool,
6339}
6340
6341impl std::marker::Unpin for DaiConnectorRequestStream {}
6342
6343impl futures::stream::FusedStream for DaiConnectorRequestStream {
6344    fn is_terminated(&self) -> bool {
6345        self.is_terminated
6346    }
6347}
6348
6349impl fidl::endpoints::RequestStream for DaiConnectorRequestStream {
6350    type Protocol = DaiConnectorMarker;
6351    type ControlHandle = DaiConnectorControlHandle;
6352
6353    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6354        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6355    }
6356
6357    fn control_handle(&self) -> Self::ControlHandle {
6358        DaiConnectorControlHandle { inner: self.inner.clone() }
6359    }
6360
6361    fn into_inner(
6362        self,
6363    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6364    {
6365        (self.inner, self.is_terminated)
6366    }
6367
6368    fn from_inner(
6369        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6370        is_terminated: bool,
6371    ) -> Self {
6372        Self { inner, is_terminated }
6373    }
6374}
6375
6376impl futures::Stream for DaiConnectorRequestStream {
6377    type Item = Result<DaiConnectorRequest, fidl::Error>;
6378
6379    fn poll_next(
6380        mut self: std::pin::Pin<&mut Self>,
6381        cx: &mut std::task::Context<'_>,
6382    ) -> std::task::Poll<Option<Self::Item>> {
6383        let this = &mut *self;
6384        if this.inner.check_shutdown(cx) {
6385            this.is_terminated = true;
6386            return std::task::Poll::Ready(None);
6387        }
6388        if this.is_terminated {
6389            panic!("polled DaiConnectorRequestStream after completion");
6390        }
6391        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6392            |bytes, handles| {
6393                match this.inner.channel().read_etc(cx, bytes, handles) {
6394                    std::task::Poll::Ready(Ok(())) => {}
6395                    std::task::Poll::Pending => return std::task::Poll::Pending,
6396                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6397                        this.is_terminated = true;
6398                        return std::task::Poll::Ready(None);
6399                    }
6400                    std::task::Poll::Ready(Err(e)) => {
6401                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6402                            e.into(),
6403                        ))));
6404                    }
6405                }
6406
6407                // A message has been received from the channel
6408                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6409
6410                std::task::Poll::Ready(Some(match header.ordinal {
6411                    0x4e4db05c2eca1450 => {
6412                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6413                        let mut req = fidl::new_empty!(
6414                            DaiConnectorConnectRequest,
6415                            fidl::encoding::DefaultFuchsiaResourceDialect
6416                        );
6417                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
6418                        let control_handle =
6419                            DaiConnectorControlHandle { inner: this.inner.clone() };
6420                        Ok(DaiConnectorRequest::Connect {
6421                            dai_protocol: req.dai_protocol,
6422
6423                            control_handle,
6424                        })
6425                    }
6426                    _ => Err(fidl::Error::UnknownOrdinal {
6427                        ordinal: header.ordinal,
6428                        protocol_name:
6429                            <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6430                    }),
6431                }))
6432            },
6433        )
6434    }
6435}
6436
6437/// For an overview of the DAI protocols see
6438/// [Digital Audio Interface](//docs/development/audio/drivers/dai.md)
6439/// # Deprecation
6440///
6441/// Not supported anymore, instead use an
6442/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
6443/// with one DAI and one Ring Buffer, see
6444/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
6445#[derive(Debug)]
6446pub enum DaiConnectorRequest {
6447    /// This connects to a DAI protocol server.
6448    Connect {
6449        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6450        control_handle: DaiConnectorControlHandle,
6451    },
6452}
6453
6454impl DaiConnectorRequest {
6455    #[allow(irrefutable_let_patterns)]
6456    pub fn into_connect(
6457        self,
6458    ) -> Option<(fidl::endpoints::ServerEnd<DaiMarker>, DaiConnectorControlHandle)> {
6459        if let DaiConnectorRequest::Connect { dai_protocol, control_handle } = self {
6460            Some((dai_protocol, control_handle))
6461        } else {
6462            None
6463        }
6464    }
6465
6466    /// Name of the method defined in FIDL
6467    pub fn method_name(&self) -> &'static str {
6468        match *self {
6469            DaiConnectorRequest::Connect { .. } => "connect",
6470        }
6471    }
6472}
6473
6474#[derive(Debug, Clone)]
6475pub struct DaiConnectorControlHandle {
6476    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6477}
6478
6479impl DaiConnectorControlHandle {
6480    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6481        self.inner.shutdown_with_epitaph(status.into())
6482    }
6483}
6484
6485impl fidl::endpoints::ControlHandle for DaiConnectorControlHandle {
6486    fn shutdown(&self) {
6487        self.inner.shutdown()
6488    }
6489
6490    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6491        self.inner.shutdown_with_epitaph(status)
6492    }
6493
6494    fn is_closed(&self) -> bool {
6495        self.inner.channel().is_closed()
6496    }
6497    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6498        self.inner.channel().on_closed()
6499    }
6500
6501    #[cfg(target_os = "fuchsia")]
6502    fn signal_peer(
6503        &self,
6504        clear_mask: zx::Signals,
6505        set_mask: zx::Signals,
6506    ) -> Result<(), zx_status::Status> {
6507        use fidl::Peered;
6508        self.inner.channel().signal_peer(clear_mask, set_mask)
6509    }
6510}
6511
6512impl DaiConnectorControlHandle {}
6513
6514#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6515pub struct HealthMarker;
6516
6517impl fidl::endpoints::ProtocolMarker for HealthMarker {
6518    type Proxy = HealthProxy;
6519    type RequestStream = HealthRequestStream;
6520    #[cfg(target_os = "fuchsia")]
6521    type SynchronousProxy = HealthSynchronousProxy;
6522
6523    const DEBUG_NAME: &'static str = "(anonymous) Health";
6524}
6525
6526pub trait HealthProxyInterface: Send + Sync {
6527    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
6528        + Send;
6529    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
6530}
6531#[derive(Debug)]
6532#[cfg(target_os = "fuchsia")]
6533pub struct HealthSynchronousProxy {
6534    client: fidl::client::sync::Client,
6535}
6536
6537#[cfg(target_os = "fuchsia")]
6538impl fidl::endpoints::SynchronousProxy for HealthSynchronousProxy {
6539    type Proxy = HealthProxy;
6540    type Protocol = HealthMarker;
6541
6542    fn from_channel(inner: fidl::Channel) -> Self {
6543        Self::new(inner)
6544    }
6545
6546    fn into_channel(self) -> fidl::Channel {
6547        self.client.into_channel()
6548    }
6549
6550    fn as_channel(&self) -> &fidl::Channel {
6551        self.client.as_channel()
6552    }
6553}
6554
6555#[cfg(target_os = "fuchsia")]
6556impl HealthSynchronousProxy {
6557    pub fn new(channel: fidl::Channel) -> Self {
6558        Self { client: fidl::client::sync::Client::new(channel) }
6559    }
6560
6561    pub fn into_channel(self) -> fidl::Channel {
6562        self.client.into_channel()
6563    }
6564
6565    /// Waits until an event arrives and returns it. It is safe for other
6566    /// threads to make concurrent requests while waiting for an event.
6567    pub fn wait_for_event(
6568        &self,
6569        deadline: zx::MonotonicInstant,
6570    ) -> Result<HealthEvent, fidl::Error> {
6571        HealthEvent::decode(self.client.wait_for_event::<HealthMarker>(deadline)?)
6572    }
6573
6574    /// Retrieves top level health state.
6575    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6576    pub fn r#get_health_state(
6577        &self,
6578        ___deadline: zx::MonotonicInstant,
6579    ) -> Result<HealthState, fidl::Error> {
6580        let _response = self
6581            .client
6582            .send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse, HealthMarker>(
6583                (),
6584                0x4e146d6bca733a84,
6585                fidl::encoding::DynamicFlags::empty(),
6586                ___deadline,
6587            )?;
6588        Ok(_response.state)
6589    }
6590}
6591
6592#[cfg(target_os = "fuchsia")]
6593impl From<HealthSynchronousProxy> for zx::NullableHandle {
6594    fn from(value: HealthSynchronousProxy) -> Self {
6595        value.into_channel().into()
6596    }
6597}
6598
6599#[cfg(target_os = "fuchsia")]
6600impl From<fidl::Channel> for HealthSynchronousProxy {
6601    fn from(value: fidl::Channel) -> Self {
6602        Self::new(value)
6603    }
6604}
6605
6606#[cfg(target_os = "fuchsia")]
6607impl fidl::endpoints::FromClient for HealthSynchronousProxy {
6608    type Protocol = HealthMarker;
6609
6610    fn from_client(value: fidl::endpoints::ClientEnd<HealthMarker>) -> Self {
6611        Self::new(value.into_channel())
6612    }
6613}
6614
6615#[derive(Debug, Clone)]
6616pub struct HealthProxy {
6617    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6618}
6619
6620impl fidl::endpoints::Proxy for HealthProxy {
6621    type Protocol = HealthMarker;
6622
6623    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6624        Self::new(inner)
6625    }
6626
6627    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6628        self.client.into_channel().map_err(|client| Self { client })
6629    }
6630
6631    fn as_channel(&self) -> &::fidl::AsyncChannel {
6632        self.client.as_channel()
6633    }
6634}
6635
6636impl HealthProxy {
6637    /// Create a new Proxy for fuchsia.hardware.audio/Health.
6638    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6639        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6640        Self { client: fidl::client::Client::new(channel, protocol_name) }
6641    }
6642
6643    /// Get a Stream of events from the remote end of the protocol.
6644    ///
6645    /// # Panics
6646    ///
6647    /// Panics if the event stream was already taken.
6648    pub fn take_event_stream(&self) -> HealthEventStream {
6649        HealthEventStream { event_receiver: self.client.take_event_receiver() }
6650    }
6651
6652    /// Retrieves top level health state.
6653    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6654    pub fn r#get_health_state(
6655        &self,
6656    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
6657    {
6658        HealthProxyInterface::r#get_health_state(self)
6659    }
6660}
6661
6662impl HealthProxyInterface for HealthProxy {
6663    type GetHealthStateResponseFut =
6664        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
6665    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
6666        fn _decode(
6667            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6668        ) -> Result<HealthState, fidl::Error> {
6669            let _response = fidl::client::decode_transaction_body::<
6670                HealthGetHealthStateResponse,
6671                fidl::encoding::DefaultFuchsiaResourceDialect,
6672                0x4e146d6bca733a84,
6673            >(_buf?)?;
6674            Ok(_response.state)
6675        }
6676        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
6677            (),
6678            0x4e146d6bca733a84,
6679            fidl::encoding::DynamicFlags::empty(),
6680            _decode,
6681        )
6682    }
6683}
6684
6685pub struct HealthEventStream {
6686    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6687}
6688
6689impl std::marker::Unpin for HealthEventStream {}
6690
6691impl futures::stream::FusedStream for HealthEventStream {
6692    fn is_terminated(&self) -> bool {
6693        self.event_receiver.is_terminated()
6694    }
6695}
6696
6697impl futures::Stream for HealthEventStream {
6698    type Item = Result<HealthEvent, fidl::Error>;
6699
6700    fn poll_next(
6701        mut self: std::pin::Pin<&mut Self>,
6702        cx: &mut std::task::Context<'_>,
6703    ) -> std::task::Poll<Option<Self::Item>> {
6704        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6705            &mut self.event_receiver,
6706            cx
6707        )?) {
6708            Some(buf) => std::task::Poll::Ready(Some(HealthEvent::decode(buf))),
6709            None => std::task::Poll::Ready(None),
6710        }
6711    }
6712}
6713
6714#[derive(Debug)]
6715pub enum HealthEvent {}
6716
6717impl HealthEvent {
6718    /// Decodes a message buffer as a [`HealthEvent`].
6719    fn decode(
6720        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6721    ) -> Result<HealthEvent, fidl::Error> {
6722        let (bytes, _handles) = buf.split_mut();
6723        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6724        debug_assert_eq!(tx_header.tx_id, 0);
6725        match tx_header.ordinal {
6726            _ => Err(fidl::Error::UnknownOrdinal {
6727                ordinal: tx_header.ordinal,
6728                protocol_name: <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6729            }),
6730        }
6731    }
6732}
6733
6734/// A Stream of incoming requests for fuchsia.hardware.audio/Health.
6735pub struct HealthRequestStream {
6736    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6737    is_terminated: bool,
6738}
6739
6740impl std::marker::Unpin for HealthRequestStream {}
6741
6742impl futures::stream::FusedStream for HealthRequestStream {
6743    fn is_terminated(&self) -> bool {
6744        self.is_terminated
6745    }
6746}
6747
6748impl fidl::endpoints::RequestStream for HealthRequestStream {
6749    type Protocol = HealthMarker;
6750    type ControlHandle = HealthControlHandle;
6751
6752    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6753        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6754    }
6755
6756    fn control_handle(&self) -> Self::ControlHandle {
6757        HealthControlHandle { inner: self.inner.clone() }
6758    }
6759
6760    fn into_inner(
6761        self,
6762    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6763    {
6764        (self.inner, self.is_terminated)
6765    }
6766
6767    fn from_inner(
6768        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6769        is_terminated: bool,
6770    ) -> Self {
6771        Self { inner, is_terminated }
6772    }
6773}
6774
6775impl futures::Stream for HealthRequestStream {
6776    type Item = Result<HealthRequest, fidl::Error>;
6777
6778    fn poll_next(
6779        mut self: std::pin::Pin<&mut Self>,
6780        cx: &mut std::task::Context<'_>,
6781    ) -> std::task::Poll<Option<Self::Item>> {
6782        let this = &mut *self;
6783        if this.inner.check_shutdown(cx) {
6784            this.is_terminated = true;
6785            return std::task::Poll::Ready(None);
6786        }
6787        if this.is_terminated {
6788            panic!("polled HealthRequestStream after completion");
6789        }
6790        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6791            |bytes, handles| {
6792                match this.inner.channel().read_etc(cx, bytes, handles) {
6793                    std::task::Poll::Ready(Ok(())) => {}
6794                    std::task::Poll::Pending => return std::task::Poll::Pending,
6795                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6796                        this.is_terminated = true;
6797                        return std::task::Poll::Ready(None);
6798                    }
6799                    std::task::Poll::Ready(Err(e)) => {
6800                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6801                            e.into(),
6802                        ))));
6803                    }
6804                }
6805
6806                // A message has been received from the channel
6807                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6808
6809                std::task::Poll::Ready(Some(match header.ordinal {
6810                    0x4e146d6bca733a84 => {
6811                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6812                        let mut req = fidl::new_empty!(
6813                            fidl::encoding::EmptyPayload,
6814                            fidl::encoding::DefaultFuchsiaResourceDialect
6815                        );
6816                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6817                        let control_handle = HealthControlHandle { inner: this.inner.clone() };
6818                        Ok(HealthRequest::GetHealthState {
6819                            responder: HealthGetHealthStateResponder {
6820                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6821                                tx_id: header.tx_id,
6822                            },
6823                        })
6824                    }
6825                    _ => Err(fidl::Error::UnknownOrdinal {
6826                        ordinal: header.ordinal,
6827                        protocol_name:
6828                            <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6829                    }),
6830                }))
6831            },
6832        )
6833    }
6834}
6835
6836#[derive(Debug)]
6837pub enum HealthRequest {
6838    /// Retrieves top level health state.
6839    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6840    GetHealthState { responder: HealthGetHealthStateResponder },
6841}
6842
6843impl HealthRequest {
6844    #[allow(irrefutable_let_patterns)]
6845    pub fn into_get_health_state(self) -> Option<(HealthGetHealthStateResponder)> {
6846        if let HealthRequest::GetHealthState { responder } = self {
6847            Some((responder))
6848        } else {
6849            None
6850        }
6851    }
6852
6853    /// Name of the method defined in FIDL
6854    pub fn method_name(&self) -> &'static str {
6855        match *self {
6856            HealthRequest::GetHealthState { .. } => "get_health_state",
6857        }
6858    }
6859}
6860
6861#[derive(Debug, Clone)]
6862pub struct HealthControlHandle {
6863    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6864}
6865
6866impl HealthControlHandle {
6867    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6868        self.inner.shutdown_with_epitaph(status.into())
6869    }
6870}
6871
6872impl fidl::endpoints::ControlHandle for HealthControlHandle {
6873    fn shutdown(&self) {
6874        self.inner.shutdown()
6875    }
6876
6877    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6878        self.inner.shutdown_with_epitaph(status)
6879    }
6880
6881    fn is_closed(&self) -> bool {
6882        self.inner.channel().is_closed()
6883    }
6884    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6885        self.inner.channel().on_closed()
6886    }
6887
6888    #[cfg(target_os = "fuchsia")]
6889    fn signal_peer(
6890        &self,
6891        clear_mask: zx::Signals,
6892        set_mask: zx::Signals,
6893    ) -> Result<(), zx_status::Status> {
6894        use fidl::Peered;
6895        self.inner.channel().signal_peer(clear_mask, set_mask)
6896    }
6897}
6898
6899impl HealthControlHandle {}
6900
6901#[must_use = "FIDL methods require a response to be sent"]
6902#[derive(Debug)]
6903pub struct HealthGetHealthStateResponder {
6904    control_handle: std::mem::ManuallyDrop<HealthControlHandle>,
6905    tx_id: u32,
6906}
6907
6908/// Set the the channel to be shutdown (see [`HealthControlHandle::shutdown`])
6909/// if the responder is dropped without sending a response, so that the client
6910/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6911impl std::ops::Drop for HealthGetHealthStateResponder {
6912    fn drop(&mut self) {
6913        self.control_handle.shutdown();
6914        // Safety: drops once, never accessed again
6915        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6916    }
6917}
6918
6919impl fidl::endpoints::Responder for HealthGetHealthStateResponder {
6920    type ControlHandle = HealthControlHandle;
6921
6922    fn control_handle(&self) -> &HealthControlHandle {
6923        &self.control_handle
6924    }
6925
6926    fn drop_without_shutdown(mut self) {
6927        // Safety: drops once, never accessed again due to mem::forget
6928        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6929        // Prevent Drop from running (which would shut down the channel)
6930        std::mem::forget(self);
6931    }
6932}
6933
6934impl HealthGetHealthStateResponder {
6935    /// Sends a response to the FIDL transaction.
6936    ///
6937    /// Sets the channel to shutdown if an error occurs.
6938    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6939        let _result = self.send_raw(state);
6940        if _result.is_err() {
6941            self.control_handle.shutdown();
6942        }
6943        self.drop_without_shutdown();
6944        _result
6945    }
6946
6947    /// Similar to "send" but does not shutdown the channel if an error occurs.
6948    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6949        let _result = self.send_raw(state);
6950        self.drop_without_shutdown();
6951        _result
6952    }
6953
6954    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
6955        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
6956            (state,),
6957            self.tx_id,
6958            0x4e146d6bca733a84,
6959            fidl::encoding::DynamicFlags::empty(),
6960        )
6961    }
6962}
6963
6964#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6965pub struct PacketStreamControlMarker;
6966
6967impl fidl::endpoints::ProtocolMarker for PacketStreamControlMarker {
6968    type Proxy = PacketStreamControlProxy;
6969    type RequestStream = PacketStreamControlRequestStream;
6970    #[cfg(target_os = "fuchsia")]
6971    type SynchronousProxy = PacketStreamControlSynchronousProxy;
6972
6973    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamControl";
6974}
6975pub type PacketStreamControlAllocateVmosResult = Result<Vec<VmoInfo>, i32>;
6976pub type PacketStreamControlDeallocateVmosResult = Result<(), i32>;
6977pub type PacketStreamControlRegisterVmosResult = Result<(), i32>;
6978pub type PacketStreamControlUnregisterVmosResult = Result<(), i32>;
6979pub type PacketStreamControlGetPacketStreamSinkResult =
6980    Result<PacketStreamControlGetPacketStreamSinkResponse, i32>;
6981pub type PacketStreamControlSetPacketStreamSinkResult = Result<(), i32>;
6982pub type PacketStreamControlStartResult = Result<(), i32>;
6983pub type PacketStreamControlStopResult = Result<(), i32>;
6984
6985pub trait PacketStreamControlProxyInterface: Send + Sync {
6986    type GetPropertiesResponseFut: std::future::Future<Output = Result<PacketStreamProperties, fidl::Error>>
6987        + Send;
6988    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
6989    type AllocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlAllocateVmosResult, fidl::Error>>
6990        + Send;
6991    fn r#allocate_vmos(&self, payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut;
6992    type DeallocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlDeallocateVmosResult, fidl::Error>>
6993        + Send;
6994    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut;
6995    type RegisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlRegisterVmosResult, fidl::Error>>
6996        + Send;
6997    fn r#register_vmos(&self, payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut;
6998    type UnregisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlUnregisterVmosResult, fidl::Error>>
6999        + Send;
7000    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut;
7001    type GetPacketStreamSinkResponseFut: std::future::Future<
7002            Output = Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error>,
7003        > + Send;
7004    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut;
7005    type SetPacketStreamSinkResponseFut: std::future::Future<
7006            Output = Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error>,
7007        > + Send;
7008    fn r#set_packet_stream_sink(
7009        &self,
7010        payload: PacketStreamControlSetPacketStreamSinkRequest,
7011    ) -> Self::SetPacketStreamSinkResponseFut;
7012    type StartResponseFut: std::future::Future<Output = Result<PacketStreamControlStartResult, fidl::Error>>
7013        + Send;
7014    fn r#start(&self) -> Self::StartResponseFut;
7015    type StopResponseFut: std::future::Future<Output = Result<PacketStreamControlStopResult, fidl::Error>>
7016        + Send;
7017    fn r#stop(&self) -> Self::StopResponseFut;
7018}
7019#[derive(Debug)]
7020#[cfg(target_os = "fuchsia")]
7021pub struct PacketStreamControlSynchronousProxy {
7022    client: fidl::client::sync::Client,
7023}
7024
7025#[cfg(target_os = "fuchsia")]
7026impl fidl::endpoints::SynchronousProxy for PacketStreamControlSynchronousProxy {
7027    type Proxy = PacketStreamControlProxy;
7028    type Protocol = PacketStreamControlMarker;
7029
7030    fn from_channel(inner: fidl::Channel) -> Self {
7031        Self::new(inner)
7032    }
7033
7034    fn into_channel(self) -> fidl::Channel {
7035        self.client.into_channel()
7036    }
7037
7038    fn as_channel(&self) -> &fidl::Channel {
7039        self.client.as_channel()
7040    }
7041}
7042
7043#[cfg(target_os = "fuchsia")]
7044impl PacketStreamControlSynchronousProxy {
7045    pub fn new(channel: fidl::Channel) -> Self {
7046        Self { client: fidl::client::sync::Client::new(channel) }
7047    }
7048
7049    pub fn into_channel(self) -> fidl::Channel {
7050        self.client.into_channel()
7051    }
7052
7053    /// Waits until an event arrives and returns it. It is safe for other
7054    /// threads to make concurrent requests while waiting for an event.
7055    pub fn wait_for_event(
7056        &self,
7057        deadline: zx::MonotonicInstant,
7058    ) -> Result<PacketStreamControlEvent, fidl::Error> {
7059        PacketStreamControlEvent::decode(
7060            self.client.wait_for_event::<PacketStreamControlMarker>(deadline)?,
7061        )
7062    }
7063
7064    /// Accessor for top level static properties.
7065    pub fn r#get_properties(
7066        &self,
7067        ___deadline: zx::MonotonicInstant,
7068    ) -> Result<PacketStreamProperties, fidl::Error> {
7069        let _response = self.client.send_query::<
7070            fidl::encoding::EmptyPayload,
7071            fidl::encoding::FlexibleType<PacketStreamControlGetPropertiesResponse>,
7072            PacketStreamControlMarker,
7073        >(
7074            (),
7075            0x586cf4f0f8d2771f,
7076            fidl::encoding::DynamicFlags::FLEXIBLE,
7077            ___deadline,
7078        )?
7079        .into_result::<PacketStreamControlMarker>("get_properties")?;
7080        Ok(_response.properties)
7081    }
7082
7083    /// Request the driver to allocate VMOs for data transfer.
7084    /// Returns the allocated VMOs and their assigned IDs.
7085    ///
7086    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7087    /// If the packet stream is an output stream, then the handle must also include
7088    /// ZX_RIGHT_WRITE.
7089    ///
7090    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
7091    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
7092    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
7093    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
7094    /// reconfigure.
7095    pub fn r#allocate_vmos(
7096        &self,
7097        mut payload: &AllocateVmosConfig,
7098        ___deadline: zx::MonotonicInstant,
7099    ) -> Result<PacketStreamControlAllocateVmosResult, fidl::Error> {
7100        let _response = self.client.send_query::<
7101            AllocateVmosConfig,
7102            fidl::encoding::FlexibleResultType<PacketStreamControlAllocateVmosResponse, i32>,
7103            PacketStreamControlMarker,
7104        >(
7105            payload,
7106            0x7ff1473165ed344b,
7107            fidl::encoding::DynamicFlags::FLEXIBLE,
7108            ___deadline,
7109        )?
7110        .into_result::<PacketStreamControlMarker>("allocate_vmos")?;
7111        Ok(_response.map(|x| x.vmos))
7112    }
7113
7114    /// Releases all VMOs previously allocated via `AllocateVmos`.
7115    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7116    ///
7117    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
7118    /// not stopped.
7119    pub fn r#deallocate_vmos(
7120        &self,
7121        ___deadline: zx::MonotonicInstant,
7122    ) -> Result<PacketStreamControlDeallocateVmosResult, fidl::Error> {
7123        let _response = self.client.send_query::<
7124            fidl::encoding::EmptyPayload,
7125            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7126            PacketStreamControlMarker,
7127        >(
7128            (),
7129            0x4db5cc85a7b8405b,
7130            fidl::encoding::DynamicFlags::FLEXIBLE,
7131            ___deadline,
7132        )?
7133        .into_result::<PacketStreamControlMarker>("deallocate_vmos")?;
7134        Ok(_response.map(|x| x))
7135    }
7136
7137    /// Registers client-allocated VMOs with the driver.
7138    ///
7139    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7140    /// If the packet stream is an input stream, then the handle must also include
7141    /// ZX_RIGHT_WRITE.
7142    ///
7143    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
7144    /// or if duplicate `vmo_id`s are found.
7145    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
7146    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
7147    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
7148    /// reconfigure.
7149    pub fn r#register_vmos(
7150        &self,
7151        mut payload: RegisterVmosConfig,
7152        ___deadline: zx::MonotonicInstant,
7153    ) -> Result<PacketStreamControlRegisterVmosResult, fidl::Error> {
7154        let _response = self.client.send_query::<
7155            RegisterVmosConfig,
7156            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7157            PacketStreamControlMarker,
7158        >(
7159            &mut payload,
7160            0x29c3b656a1020bfd,
7161            fidl::encoding::DynamicFlags::FLEXIBLE,
7162            ___deadline,
7163        )?
7164        .into_result::<PacketStreamControlMarker>("register_vmos")?;
7165        Ok(_response.map(|x| x))
7166    }
7167
7168    /// Unregisters all VMOs previously registered via `RegisterVmos`.
7169    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7170    ///
7171    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
7172    /// not stopped.
7173    pub fn r#unregister_vmos(
7174        &self,
7175        ___deadline: zx::MonotonicInstant,
7176    ) -> Result<PacketStreamControlUnregisterVmosResult, fidl::Error> {
7177        let _response = self.client.send_query::<
7178            fidl::encoding::EmptyPayload,
7179            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7180            PacketStreamControlMarker,
7181        >(
7182            (),
7183            0x3e3b4dbfe26b6094,
7184            fidl::encoding::DynamicFlags::FLEXIBLE,
7185            ___deadline,
7186        )?
7187        .into_result::<PacketStreamControlMarker>("unregister_vmos")?;
7188        Ok(_response.map(|x| x))
7189    }
7190
7191    /// Connects to the data sink implemented by the driver.
7192    /// This is used for audio **Output** where the driver consumes data.
7193    ///
7194    /// Flow:
7195    /// 1. App writes audio data to a registered VMO.
7196    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
7197    ///    true).
7198    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
7199    /// 4. Driver consumes the data.
7200    ///
7201    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
7202    /// and any pending requests on that channel are discarded. The new channel replaces the old
7203    /// one.
7204    ///
7205    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
7206    /// not support this method.
7207    pub fn r#get_packet_stream_sink(
7208        &self,
7209        ___deadline: zx::MonotonicInstant,
7210    ) -> Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error> {
7211        let _response =
7212            self.client
7213                .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
7214                    PacketStreamControlGetPacketStreamSinkResponse,
7215                    i32,
7216                >, PacketStreamControlMarker>(
7217                    (),
7218                    0x7394726463ebbc6a,
7219                    fidl::encoding::DynamicFlags::FLEXIBLE,
7220                    ___deadline,
7221                )?
7222                .into_result::<PacketStreamControlMarker>("get_packet_stream_sink")?;
7223        Ok(_response.map(|x| x))
7224    }
7225
7226    /// Provides a data sink to the driver.
7227    /// This is used for audio **Input** where the driver produces data.
7228    ///
7229    /// Flow:
7230    /// 1. Driver writes audio data to a registered VMO.
7231    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
7232    /// 3. App receives `PutPacket`.
7233    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
7234    ///    true).
7235    /// 5. App reads the data.
7236    ///
7237    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
7238    /// channel. The new channel replaces the old one.
7239    ///
7240    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
7241    /// not support this method.
7242    pub fn r#set_packet_stream_sink(
7243        &self,
7244        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7245        ___deadline: zx::MonotonicInstant,
7246    ) -> Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error> {
7247        let _response = self.client.send_query::<
7248            PacketStreamControlSetPacketStreamSinkRequest,
7249            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7250            PacketStreamControlMarker,
7251        >(
7252            &mut payload,
7253            0xab88800e31dc0e4,
7254            fidl::encoding::DynamicFlags::FLEXIBLE,
7255            ___deadline,
7256        )?
7257        .into_result::<PacketStreamControlMarker>("set_packet_stream_sink")?;
7258        Ok(_response.map(|x| x))
7259    }
7260
7261    /// Start the packet-stream.
7262    ///
7263    /// Returns `ZX_ERR_BAD_STATE` if:
7264    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
7265    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
7266    ///   `INLINE` is supported.
7267    /// * The stream is already started.
7268    pub fn r#start(
7269        &self,
7270        ___deadline: zx::MonotonicInstant,
7271    ) -> Result<PacketStreamControlStartResult, fidl::Error> {
7272        let _response = self.client.send_query::<
7273            fidl::encoding::EmptyPayload,
7274            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7275            PacketStreamControlMarker,
7276        >(
7277            (),
7278            0x3a584b94d8a6bfd0,
7279            fidl::encoding::DynamicFlags::FLEXIBLE,
7280            ___deadline,
7281        )?
7282        .into_result::<PacketStreamControlMarker>("start")?;
7283        Ok(_response.map(|x| x))
7284    }
7285
7286    /// Stop the packet-stream.
7287    ///
7288    /// Once the response is received, the stream is halted.
7289    ///
7290    /// Behavior depends on the stream direction:
7291    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
7292    ///   requests will remain pending until `Start` is called again. Clients may call
7293    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
7294    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
7295    ///   calls will be made by the driver until `Start` is called again.
7296    ///
7297    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
7298    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
7299    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
7300    ///   complete successfully after `Stop` has returned.
7301    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
7302    ///   arrive at the client after `Stop` has returned.
7303    ///
7304    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
7305    pub fn r#stop(
7306        &self,
7307        ___deadline: zx::MonotonicInstant,
7308    ) -> Result<PacketStreamControlStopResult, fidl::Error> {
7309        let _response = self.client.send_query::<
7310            fidl::encoding::EmptyPayload,
7311            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7312            PacketStreamControlMarker,
7313        >(
7314            (),
7315            0x703e4fafcdd7ef32,
7316            fidl::encoding::DynamicFlags::FLEXIBLE,
7317            ___deadline,
7318        )?
7319        .into_result::<PacketStreamControlMarker>("stop")?;
7320        Ok(_response.map(|x| x))
7321    }
7322}
7323
7324#[cfg(target_os = "fuchsia")]
7325impl From<PacketStreamControlSynchronousProxy> for zx::NullableHandle {
7326    fn from(value: PacketStreamControlSynchronousProxy) -> Self {
7327        value.into_channel().into()
7328    }
7329}
7330
7331#[cfg(target_os = "fuchsia")]
7332impl From<fidl::Channel> for PacketStreamControlSynchronousProxy {
7333    fn from(value: fidl::Channel) -> Self {
7334        Self::new(value)
7335    }
7336}
7337
7338#[cfg(target_os = "fuchsia")]
7339impl fidl::endpoints::FromClient for PacketStreamControlSynchronousProxy {
7340    type Protocol = PacketStreamControlMarker;
7341
7342    fn from_client(value: fidl::endpoints::ClientEnd<PacketStreamControlMarker>) -> Self {
7343        Self::new(value.into_channel())
7344    }
7345}
7346
7347#[derive(Debug, Clone)]
7348pub struct PacketStreamControlProxy {
7349    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7350}
7351
7352impl fidl::endpoints::Proxy for PacketStreamControlProxy {
7353    type Protocol = PacketStreamControlMarker;
7354
7355    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7356        Self::new(inner)
7357    }
7358
7359    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7360        self.client.into_channel().map_err(|client| Self { client })
7361    }
7362
7363    fn as_channel(&self) -> &::fidl::AsyncChannel {
7364        self.client.as_channel()
7365    }
7366}
7367
7368impl PacketStreamControlProxy {
7369    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamControl.
7370    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7371        let protocol_name =
7372            <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7373        Self { client: fidl::client::Client::new(channel, protocol_name) }
7374    }
7375
7376    /// Get a Stream of events from the remote end of the protocol.
7377    ///
7378    /// # Panics
7379    ///
7380    /// Panics if the event stream was already taken.
7381    pub fn take_event_stream(&self) -> PacketStreamControlEventStream {
7382        PacketStreamControlEventStream { event_receiver: self.client.take_event_receiver() }
7383    }
7384
7385    /// Accessor for top level static properties.
7386    pub fn r#get_properties(
7387        &self,
7388    ) -> fidl::client::QueryResponseFut<
7389        PacketStreamProperties,
7390        fidl::encoding::DefaultFuchsiaResourceDialect,
7391    > {
7392        PacketStreamControlProxyInterface::r#get_properties(self)
7393    }
7394
7395    /// Request the driver to allocate VMOs for data transfer.
7396    /// Returns the allocated VMOs and their assigned IDs.
7397    ///
7398    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7399    /// If the packet stream is an output stream, then the handle must also include
7400    /// ZX_RIGHT_WRITE.
7401    ///
7402    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
7403    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
7404    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
7405    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
7406    /// reconfigure.
7407    pub fn r#allocate_vmos(
7408        &self,
7409        mut payload: &AllocateVmosConfig,
7410    ) -> fidl::client::QueryResponseFut<
7411        PacketStreamControlAllocateVmosResult,
7412        fidl::encoding::DefaultFuchsiaResourceDialect,
7413    > {
7414        PacketStreamControlProxyInterface::r#allocate_vmos(self, payload)
7415    }
7416
7417    /// Releases all VMOs previously allocated via `AllocateVmos`.
7418    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7419    ///
7420    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
7421    /// not stopped.
7422    pub fn r#deallocate_vmos(
7423        &self,
7424    ) -> fidl::client::QueryResponseFut<
7425        PacketStreamControlDeallocateVmosResult,
7426        fidl::encoding::DefaultFuchsiaResourceDialect,
7427    > {
7428        PacketStreamControlProxyInterface::r#deallocate_vmos(self)
7429    }
7430
7431    /// Registers client-allocated VMOs with the driver.
7432    ///
7433    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7434    /// If the packet stream is an input stream, then the handle must also include
7435    /// ZX_RIGHT_WRITE.
7436    ///
7437    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
7438    /// or if duplicate `vmo_id`s are found.
7439    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
7440    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
7441    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
7442    /// reconfigure.
7443    pub fn r#register_vmos(
7444        &self,
7445        mut payload: RegisterVmosConfig,
7446    ) -> fidl::client::QueryResponseFut<
7447        PacketStreamControlRegisterVmosResult,
7448        fidl::encoding::DefaultFuchsiaResourceDialect,
7449    > {
7450        PacketStreamControlProxyInterface::r#register_vmos(self, payload)
7451    }
7452
7453    /// Unregisters all VMOs previously registered via `RegisterVmos`.
7454    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7455    ///
7456    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
7457    /// not stopped.
7458    pub fn r#unregister_vmos(
7459        &self,
7460    ) -> fidl::client::QueryResponseFut<
7461        PacketStreamControlUnregisterVmosResult,
7462        fidl::encoding::DefaultFuchsiaResourceDialect,
7463    > {
7464        PacketStreamControlProxyInterface::r#unregister_vmos(self)
7465    }
7466
7467    /// Connects to the data sink implemented by the driver.
7468    /// This is used for audio **Output** where the driver consumes data.
7469    ///
7470    /// Flow:
7471    /// 1. App writes audio data to a registered VMO.
7472    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
7473    ///    true).
7474    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
7475    /// 4. Driver consumes the data.
7476    ///
7477    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
7478    /// and any pending requests on that channel are discarded. The new channel replaces the old
7479    /// one.
7480    ///
7481    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
7482    /// not support this method.
7483    pub fn r#get_packet_stream_sink(
7484        &self,
7485    ) -> fidl::client::QueryResponseFut<
7486        PacketStreamControlGetPacketStreamSinkResult,
7487        fidl::encoding::DefaultFuchsiaResourceDialect,
7488    > {
7489        PacketStreamControlProxyInterface::r#get_packet_stream_sink(self)
7490    }
7491
7492    /// Provides a data sink to the driver.
7493    /// This is used for audio **Input** where the driver produces data.
7494    ///
7495    /// Flow:
7496    /// 1. Driver writes audio data to a registered VMO.
7497    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
7498    /// 3. App receives `PutPacket`.
7499    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
7500    ///    true).
7501    /// 5. App reads the data.
7502    ///
7503    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
7504    /// channel. The new channel replaces the old one.
7505    ///
7506    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
7507    /// not support this method.
7508    pub fn r#set_packet_stream_sink(
7509        &self,
7510        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7511    ) -> fidl::client::QueryResponseFut<
7512        PacketStreamControlSetPacketStreamSinkResult,
7513        fidl::encoding::DefaultFuchsiaResourceDialect,
7514    > {
7515        PacketStreamControlProxyInterface::r#set_packet_stream_sink(self, payload)
7516    }
7517
7518    /// Start the packet-stream.
7519    ///
7520    /// Returns `ZX_ERR_BAD_STATE` if:
7521    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
7522    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
7523    ///   `INLINE` is supported.
7524    /// * The stream is already started.
7525    pub fn r#start(
7526        &self,
7527    ) -> fidl::client::QueryResponseFut<
7528        PacketStreamControlStartResult,
7529        fidl::encoding::DefaultFuchsiaResourceDialect,
7530    > {
7531        PacketStreamControlProxyInterface::r#start(self)
7532    }
7533
7534    /// Stop the packet-stream.
7535    ///
7536    /// Once the response is received, the stream is halted.
7537    ///
7538    /// Behavior depends on the stream direction:
7539    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
7540    ///   requests will remain pending until `Start` is called again. Clients may call
7541    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
7542    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
7543    ///   calls will be made by the driver until `Start` is called again.
7544    ///
7545    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
7546    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
7547    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
7548    ///   complete successfully after `Stop` has returned.
7549    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
7550    ///   arrive at the client after `Stop` has returned.
7551    ///
7552    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
7553    pub fn r#stop(
7554        &self,
7555    ) -> fidl::client::QueryResponseFut<
7556        PacketStreamControlStopResult,
7557        fidl::encoding::DefaultFuchsiaResourceDialect,
7558    > {
7559        PacketStreamControlProxyInterface::r#stop(self)
7560    }
7561}
7562
7563impl PacketStreamControlProxyInterface for PacketStreamControlProxy {
7564    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
7565        PacketStreamProperties,
7566        fidl::encoding::DefaultFuchsiaResourceDialect,
7567    >;
7568    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
7569        fn _decode(
7570            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7571        ) -> Result<PacketStreamProperties, fidl::Error> {
7572            let _response = fidl::client::decode_transaction_body::<
7573                fidl::encoding::FlexibleType<PacketStreamControlGetPropertiesResponse>,
7574                fidl::encoding::DefaultFuchsiaResourceDialect,
7575                0x586cf4f0f8d2771f,
7576            >(_buf?)?
7577            .into_result::<PacketStreamControlMarker>("get_properties")?;
7578            Ok(_response.properties)
7579        }
7580        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamProperties>(
7581            (),
7582            0x586cf4f0f8d2771f,
7583            fidl::encoding::DynamicFlags::FLEXIBLE,
7584            _decode,
7585        )
7586    }
7587
7588    type AllocateVmosResponseFut = fidl::client::QueryResponseFut<
7589        PacketStreamControlAllocateVmosResult,
7590        fidl::encoding::DefaultFuchsiaResourceDialect,
7591    >;
7592    fn r#allocate_vmos(&self, mut payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut {
7593        fn _decode(
7594            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7595        ) -> Result<PacketStreamControlAllocateVmosResult, fidl::Error> {
7596            let _response = fidl::client::decode_transaction_body::<
7597                fidl::encoding::FlexibleResultType<PacketStreamControlAllocateVmosResponse, i32>,
7598                fidl::encoding::DefaultFuchsiaResourceDialect,
7599                0x7ff1473165ed344b,
7600            >(_buf?)?
7601            .into_result::<PacketStreamControlMarker>("allocate_vmos")?;
7602            Ok(_response.map(|x| x.vmos))
7603        }
7604        self.client
7605            .send_query_and_decode::<AllocateVmosConfig, PacketStreamControlAllocateVmosResult>(
7606                payload,
7607                0x7ff1473165ed344b,
7608                fidl::encoding::DynamicFlags::FLEXIBLE,
7609                _decode,
7610            )
7611    }
7612
7613    type DeallocateVmosResponseFut = fidl::client::QueryResponseFut<
7614        PacketStreamControlDeallocateVmosResult,
7615        fidl::encoding::DefaultFuchsiaResourceDialect,
7616    >;
7617    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut {
7618        fn _decode(
7619            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7620        ) -> Result<PacketStreamControlDeallocateVmosResult, fidl::Error> {
7621            let _response = fidl::client::decode_transaction_body::<
7622                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7623                fidl::encoding::DefaultFuchsiaResourceDialect,
7624                0x4db5cc85a7b8405b,
7625            >(_buf?)?
7626            .into_result::<PacketStreamControlMarker>("deallocate_vmos")?;
7627            Ok(_response.map(|x| x))
7628        }
7629        self.client.send_query_and_decode::<
7630            fidl::encoding::EmptyPayload,
7631            PacketStreamControlDeallocateVmosResult,
7632        >(
7633            (),
7634            0x4db5cc85a7b8405b,
7635            fidl::encoding::DynamicFlags::FLEXIBLE,
7636            _decode,
7637        )
7638    }
7639
7640    type RegisterVmosResponseFut = fidl::client::QueryResponseFut<
7641        PacketStreamControlRegisterVmosResult,
7642        fidl::encoding::DefaultFuchsiaResourceDialect,
7643    >;
7644    fn r#register_vmos(&self, mut payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut {
7645        fn _decode(
7646            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7647        ) -> Result<PacketStreamControlRegisterVmosResult, fidl::Error> {
7648            let _response = fidl::client::decode_transaction_body::<
7649                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7650                fidl::encoding::DefaultFuchsiaResourceDialect,
7651                0x29c3b656a1020bfd,
7652            >(_buf?)?
7653            .into_result::<PacketStreamControlMarker>("register_vmos")?;
7654            Ok(_response.map(|x| x))
7655        }
7656        self.client
7657            .send_query_and_decode::<RegisterVmosConfig, PacketStreamControlRegisterVmosResult>(
7658                &mut payload,
7659                0x29c3b656a1020bfd,
7660                fidl::encoding::DynamicFlags::FLEXIBLE,
7661                _decode,
7662            )
7663    }
7664
7665    type UnregisterVmosResponseFut = fidl::client::QueryResponseFut<
7666        PacketStreamControlUnregisterVmosResult,
7667        fidl::encoding::DefaultFuchsiaResourceDialect,
7668    >;
7669    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut {
7670        fn _decode(
7671            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7672        ) -> Result<PacketStreamControlUnregisterVmosResult, fidl::Error> {
7673            let _response = fidl::client::decode_transaction_body::<
7674                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7675                fidl::encoding::DefaultFuchsiaResourceDialect,
7676                0x3e3b4dbfe26b6094,
7677            >(_buf?)?
7678            .into_result::<PacketStreamControlMarker>("unregister_vmos")?;
7679            Ok(_response.map(|x| x))
7680        }
7681        self.client.send_query_and_decode::<
7682            fidl::encoding::EmptyPayload,
7683            PacketStreamControlUnregisterVmosResult,
7684        >(
7685            (),
7686            0x3e3b4dbfe26b6094,
7687            fidl::encoding::DynamicFlags::FLEXIBLE,
7688            _decode,
7689        )
7690    }
7691
7692    type GetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
7693        PacketStreamControlGetPacketStreamSinkResult,
7694        fidl::encoding::DefaultFuchsiaResourceDialect,
7695    >;
7696    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut {
7697        fn _decode(
7698            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7699        ) -> Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error> {
7700            let _response = fidl::client::decode_transaction_body::<
7701                fidl::encoding::FlexibleResultType<
7702                    PacketStreamControlGetPacketStreamSinkResponse,
7703                    i32,
7704                >,
7705                fidl::encoding::DefaultFuchsiaResourceDialect,
7706                0x7394726463ebbc6a,
7707            >(_buf?)?
7708            .into_result::<PacketStreamControlMarker>("get_packet_stream_sink")?;
7709            Ok(_response.map(|x| x))
7710        }
7711        self.client.send_query_and_decode::<
7712            fidl::encoding::EmptyPayload,
7713            PacketStreamControlGetPacketStreamSinkResult,
7714        >(
7715            (),
7716            0x7394726463ebbc6a,
7717            fidl::encoding::DynamicFlags::FLEXIBLE,
7718            _decode,
7719        )
7720    }
7721
7722    type SetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
7723        PacketStreamControlSetPacketStreamSinkResult,
7724        fidl::encoding::DefaultFuchsiaResourceDialect,
7725    >;
7726    fn r#set_packet_stream_sink(
7727        &self,
7728        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7729    ) -> Self::SetPacketStreamSinkResponseFut {
7730        fn _decode(
7731            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7732        ) -> Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error> {
7733            let _response = fidl::client::decode_transaction_body::<
7734                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7735                fidl::encoding::DefaultFuchsiaResourceDialect,
7736                0xab88800e31dc0e4,
7737            >(_buf?)?
7738            .into_result::<PacketStreamControlMarker>("set_packet_stream_sink")?;
7739            Ok(_response.map(|x| x))
7740        }
7741        self.client.send_query_and_decode::<
7742            PacketStreamControlSetPacketStreamSinkRequest,
7743            PacketStreamControlSetPacketStreamSinkResult,
7744        >(
7745            &mut payload,
7746            0xab88800e31dc0e4,
7747            fidl::encoding::DynamicFlags::FLEXIBLE,
7748            _decode,
7749        )
7750    }
7751
7752    type StartResponseFut = fidl::client::QueryResponseFut<
7753        PacketStreamControlStartResult,
7754        fidl::encoding::DefaultFuchsiaResourceDialect,
7755    >;
7756    fn r#start(&self) -> Self::StartResponseFut {
7757        fn _decode(
7758            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7759        ) -> Result<PacketStreamControlStartResult, fidl::Error> {
7760            let _response = fidl::client::decode_transaction_body::<
7761                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7762                fidl::encoding::DefaultFuchsiaResourceDialect,
7763                0x3a584b94d8a6bfd0,
7764            >(_buf?)?
7765            .into_result::<PacketStreamControlMarker>("start")?;
7766            Ok(_response.map(|x| x))
7767        }
7768        self.client
7769            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStartResult>(
7770                (),
7771                0x3a584b94d8a6bfd0,
7772                fidl::encoding::DynamicFlags::FLEXIBLE,
7773                _decode,
7774            )
7775    }
7776
7777    type StopResponseFut = fidl::client::QueryResponseFut<
7778        PacketStreamControlStopResult,
7779        fidl::encoding::DefaultFuchsiaResourceDialect,
7780    >;
7781    fn r#stop(&self) -> Self::StopResponseFut {
7782        fn _decode(
7783            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7784        ) -> Result<PacketStreamControlStopResult, fidl::Error> {
7785            let _response = fidl::client::decode_transaction_body::<
7786                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7787                fidl::encoding::DefaultFuchsiaResourceDialect,
7788                0x703e4fafcdd7ef32,
7789            >(_buf?)?
7790            .into_result::<PacketStreamControlMarker>("stop")?;
7791            Ok(_response.map(|x| x))
7792        }
7793        self.client
7794            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStopResult>(
7795                (),
7796                0x703e4fafcdd7ef32,
7797                fidl::encoding::DynamicFlags::FLEXIBLE,
7798                _decode,
7799            )
7800    }
7801}
7802
7803pub struct PacketStreamControlEventStream {
7804    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7805}
7806
7807impl std::marker::Unpin for PacketStreamControlEventStream {}
7808
7809impl futures::stream::FusedStream for PacketStreamControlEventStream {
7810    fn is_terminated(&self) -> bool {
7811        self.event_receiver.is_terminated()
7812    }
7813}
7814
7815impl futures::Stream for PacketStreamControlEventStream {
7816    type Item = Result<PacketStreamControlEvent, fidl::Error>;
7817
7818    fn poll_next(
7819        mut self: std::pin::Pin<&mut Self>,
7820        cx: &mut std::task::Context<'_>,
7821    ) -> std::task::Poll<Option<Self::Item>> {
7822        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7823            &mut self.event_receiver,
7824            cx
7825        )?) {
7826            Some(buf) => std::task::Poll::Ready(Some(PacketStreamControlEvent::decode(buf))),
7827            None => std::task::Poll::Ready(None),
7828        }
7829    }
7830}
7831
7832#[derive(Debug)]
7833pub enum PacketStreamControlEvent {
7834    #[non_exhaustive]
7835    _UnknownEvent {
7836        /// Ordinal of the event that was sent.
7837        ordinal: u64,
7838    },
7839}
7840
7841impl PacketStreamControlEvent {
7842    /// Decodes a message buffer as a [`PacketStreamControlEvent`].
7843    fn decode(
7844        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7845    ) -> Result<PacketStreamControlEvent, fidl::Error> {
7846        let (bytes, _handles) = buf.split_mut();
7847        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7848        debug_assert_eq!(tx_header.tx_id, 0);
7849        match tx_header.ordinal {
7850            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7851                Ok(PacketStreamControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7852            }
7853            _ => Err(fidl::Error::UnknownOrdinal {
7854                ordinal: tx_header.ordinal,
7855                protocol_name:
7856                    <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7857            }),
7858        }
7859    }
7860}
7861
7862/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamControl.
7863pub struct PacketStreamControlRequestStream {
7864    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7865    is_terminated: bool,
7866}
7867
7868impl std::marker::Unpin for PacketStreamControlRequestStream {}
7869
7870impl futures::stream::FusedStream for PacketStreamControlRequestStream {
7871    fn is_terminated(&self) -> bool {
7872        self.is_terminated
7873    }
7874}
7875
7876impl fidl::endpoints::RequestStream for PacketStreamControlRequestStream {
7877    type Protocol = PacketStreamControlMarker;
7878    type ControlHandle = PacketStreamControlControlHandle;
7879
7880    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7881        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7882    }
7883
7884    fn control_handle(&self) -> Self::ControlHandle {
7885        PacketStreamControlControlHandle { inner: self.inner.clone() }
7886    }
7887
7888    fn into_inner(
7889        self,
7890    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7891    {
7892        (self.inner, self.is_terminated)
7893    }
7894
7895    fn from_inner(
7896        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7897        is_terminated: bool,
7898    ) -> Self {
7899        Self { inner, is_terminated }
7900    }
7901}
7902
7903impl futures::Stream for PacketStreamControlRequestStream {
7904    type Item = Result<PacketStreamControlRequest, fidl::Error>;
7905
7906    fn poll_next(
7907        mut self: std::pin::Pin<&mut Self>,
7908        cx: &mut std::task::Context<'_>,
7909    ) -> std::task::Poll<Option<Self::Item>> {
7910        let this = &mut *self;
7911        if this.inner.check_shutdown(cx) {
7912            this.is_terminated = true;
7913            return std::task::Poll::Ready(None);
7914        }
7915        if this.is_terminated {
7916            panic!("polled PacketStreamControlRequestStream after completion");
7917        }
7918        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7919            |bytes, handles| {
7920                match this.inner.channel().read_etc(cx, bytes, handles) {
7921                    std::task::Poll::Ready(Ok(())) => {}
7922                    std::task::Poll::Pending => return std::task::Poll::Pending,
7923                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7924                        this.is_terminated = true;
7925                        return std::task::Poll::Ready(None);
7926                    }
7927                    std::task::Poll::Ready(Err(e)) => {
7928                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7929                            e.into(),
7930                        ))));
7931                    }
7932                }
7933
7934                // A message has been received from the channel
7935                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7936
7937                std::task::Poll::Ready(Some(match header.ordinal {
7938                0x586cf4f0f8d2771f => {
7939                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7940                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7941                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7942                    let control_handle = PacketStreamControlControlHandle {
7943                        inner: this.inner.clone(),
7944                    };
7945                    Ok(PacketStreamControlRequest::GetProperties {
7946                        responder: PacketStreamControlGetPropertiesResponder {
7947                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7948                            tx_id: header.tx_id,
7949                        },
7950                    })
7951                }
7952                0x7ff1473165ed344b => {
7953                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7954                    let mut req = fidl::new_empty!(AllocateVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect);
7955                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocateVmosConfig>(&header, _body_bytes, handles, &mut req)?;
7956                    let control_handle = PacketStreamControlControlHandle {
7957                        inner: this.inner.clone(),
7958                    };
7959                    Ok(PacketStreamControlRequest::AllocateVmos {payload: req,
7960                        responder: PacketStreamControlAllocateVmosResponder {
7961                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7962                            tx_id: header.tx_id,
7963                        },
7964                    })
7965                }
7966                0x4db5cc85a7b8405b => {
7967                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7968                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7969                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7970                    let control_handle = PacketStreamControlControlHandle {
7971                        inner: this.inner.clone(),
7972                    };
7973                    Ok(PacketStreamControlRequest::DeallocateVmos {
7974                        responder: PacketStreamControlDeallocateVmosResponder {
7975                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7976                            tx_id: header.tx_id,
7977                        },
7978                    })
7979                }
7980                0x29c3b656a1020bfd => {
7981                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7982                    let mut req = fidl::new_empty!(RegisterVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect);
7983                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegisterVmosConfig>(&header, _body_bytes, handles, &mut req)?;
7984                    let control_handle = PacketStreamControlControlHandle {
7985                        inner: this.inner.clone(),
7986                    };
7987                    Ok(PacketStreamControlRequest::RegisterVmos {payload: req,
7988                        responder: PacketStreamControlRegisterVmosResponder {
7989                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7990                            tx_id: header.tx_id,
7991                        },
7992                    })
7993                }
7994                0x3e3b4dbfe26b6094 => {
7995                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7996                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7997                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7998                    let control_handle = PacketStreamControlControlHandle {
7999                        inner: this.inner.clone(),
8000                    };
8001                    Ok(PacketStreamControlRequest::UnregisterVmos {
8002                        responder: PacketStreamControlUnregisterVmosResponder {
8003                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8004                            tx_id: header.tx_id,
8005                        },
8006                    })
8007                }
8008                0x7394726463ebbc6a => {
8009                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8010                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8011                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8012                    let control_handle = PacketStreamControlControlHandle {
8013                        inner: this.inner.clone(),
8014                    };
8015                    Ok(PacketStreamControlRequest::GetPacketStreamSink {
8016                        responder: PacketStreamControlGetPacketStreamSinkResponder {
8017                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8018                            tx_id: header.tx_id,
8019                        },
8020                    })
8021                }
8022                0xab88800e31dc0e4 => {
8023                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8024                    let mut req = fidl::new_empty!(PacketStreamControlSetPacketStreamSinkRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8025                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PacketStreamControlSetPacketStreamSinkRequest>(&header, _body_bytes, handles, &mut req)?;
8026                    let control_handle = PacketStreamControlControlHandle {
8027                        inner: this.inner.clone(),
8028                    };
8029                    Ok(PacketStreamControlRequest::SetPacketStreamSink {payload: req,
8030                        responder: PacketStreamControlSetPacketStreamSinkResponder {
8031                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8032                            tx_id: header.tx_id,
8033                        },
8034                    })
8035                }
8036                0x3a584b94d8a6bfd0 => {
8037                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8038                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8039                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8040                    let control_handle = PacketStreamControlControlHandle {
8041                        inner: this.inner.clone(),
8042                    };
8043                    Ok(PacketStreamControlRequest::Start {
8044                        responder: PacketStreamControlStartResponder {
8045                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8046                            tx_id: header.tx_id,
8047                        },
8048                    })
8049                }
8050                0x703e4fafcdd7ef32 => {
8051                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8052                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8053                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8054                    let control_handle = PacketStreamControlControlHandle {
8055                        inner: this.inner.clone(),
8056                    };
8057                    Ok(PacketStreamControlRequest::Stop {
8058                        responder: PacketStreamControlStopResponder {
8059                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8060                            tx_id: header.tx_id,
8061                        },
8062                    })
8063                }
8064                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8065                    Ok(PacketStreamControlRequest::_UnknownMethod {
8066                        ordinal: header.ordinal,
8067                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
8068                        method_type: fidl::MethodType::OneWay,
8069                    })
8070                }
8071                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8072                    this.inner.send_framework_err(
8073                        fidl::encoding::FrameworkErr::UnknownMethod,
8074                        header.tx_id,
8075                        header.ordinal,
8076                        header.dynamic_flags(),
8077                        (bytes, handles),
8078                    )?;
8079                    Ok(PacketStreamControlRequest::_UnknownMethod {
8080                        ordinal: header.ordinal,
8081                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
8082                        method_type: fidl::MethodType::TwoWay,
8083                    })
8084                }
8085                _ => Err(fidl::Error::UnknownOrdinal {
8086                    ordinal: header.ordinal,
8087                    protocol_name: <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8088                }),
8089            }))
8090            },
8091        )
8092    }
8093}
8094
8095/// Control protocol for establishing and managing the packet stream.
8096#[derive(Debug)]
8097pub enum PacketStreamControlRequest {
8098    /// Accessor for top level static properties.
8099    GetProperties { responder: PacketStreamControlGetPropertiesResponder },
8100    /// Request the driver to allocate VMOs for data transfer.
8101    /// Returns the allocated VMOs and their assigned IDs.
8102    ///
8103    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8104    /// If the packet stream is an output stream, then the handle must also include
8105    /// ZX_RIGHT_WRITE.
8106    ///
8107    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
8108    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
8109    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
8110    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
8111    /// reconfigure.
8112    AllocateVmos {
8113        payload: AllocateVmosConfig,
8114        responder: PacketStreamControlAllocateVmosResponder,
8115    },
8116    /// Releases all VMOs previously allocated via `AllocateVmos`.
8117    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
8118    ///
8119    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
8120    /// not stopped.
8121    DeallocateVmos { responder: PacketStreamControlDeallocateVmosResponder },
8122    /// Registers client-allocated VMOs with the driver.
8123    ///
8124    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8125    /// If the packet stream is an input stream, then the handle must also include
8126    /// ZX_RIGHT_WRITE.
8127    ///
8128    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
8129    /// or if duplicate `vmo_id`s are found.
8130    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
8131    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
8132    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
8133    /// reconfigure.
8134    RegisterVmos {
8135        payload: RegisterVmosConfig,
8136        responder: PacketStreamControlRegisterVmosResponder,
8137    },
8138    /// Unregisters all VMOs previously registered via `RegisterVmos`.
8139    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
8140    ///
8141    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
8142    /// not stopped.
8143    UnregisterVmos { responder: PacketStreamControlUnregisterVmosResponder },
8144    /// Connects to the data sink implemented by the driver.
8145    /// This is used for audio **Output** where the driver consumes data.
8146    ///
8147    /// Flow:
8148    /// 1. App writes audio data to a registered VMO.
8149    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
8150    ///    true).
8151    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
8152    /// 4. Driver consumes the data.
8153    ///
8154    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
8155    /// and any pending requests on that channel are discarded. The new channel replaces the old
8156    /// one.
8157    ///
8158    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
8159    /// not support this method.
8160    GetPacketStreamSink { responder: PacketStreamControlGetPacketStreamSinkResponder },
8161    /// Provides a data sink to the driver.
8162    /// This is used for audio **Input** where the driver produces data.
8163    ///
8164    /// Flow:
8165    /// 1. Driver writes audio data to a registered VMO.
8166    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
8167    /// 3. App receives `PutPacket`.
8168    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
8169    ///    true).
8170    /// 5. App reads the data.
8171    ///
8172    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
8173    /// channel. The new channel replaces the old one.
8174    ///
8175    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
8176    /// not support this method.
8177    SetPacketStreamSink {
8178        payload: PacketStreamControlSetPacketStreamSinkRequest,
8179        responder: PacketStreamControlSetPacketStreamSinkResponder,
8180    },
8181    /// Start the packet-stream.
8182    ///
8183    /// Returns `ZX_ERR_BAD_STATE` if:
8184    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
8185    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
8186    ///   `INLINE` is supported.
8187    /// * The stream is already started.
8188    Start { responder: PacketStreamControlStartResponder },
8189    /// Stop the packet-stream.
8190    ///
8191    /// Once the response is received, the stream is halted.
8192    ///
8193    /// Behavior depends on the stream direction:
8194    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
8195    ///   requests will remain pending until `Start` is called again. Clients may call
8196    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
8197    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
8198    ///   calls will be made by the driver until `Start` is called again.
8199    ///
8200    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
8201    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
8202    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
8203    ///   complete successfully after `Stop` has returned.
8204    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
8205    ///   arrive at the client after `Stop` has returned.
8206    ///
8207    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
8208    Stop { responder: PacketStreamControlStopResponder },
8209    /// An interaction was received which does not match any known method.
8210    #[non_exhaustive]
8211    _UnknownMethod {
8212        /// Ordinal of the method that was called.
8213        ordinal: u64,
8214        control_handle: PacketStreamControlControlHandle,
8215        method_type: fidl::MethodType,
8216    },
8217}
8218
8219impl PacketStreamControlRequest {
8220    #[allow(irrefutable_let_patterns)]
8221    pub fn into_get_properties(self) -> Option<(PacketStreamControlGetPropertiesResponder)> {
8222        if let PacketStreamControlRequest::GetProperties { responder } = self {
8223            Some((responder))
8224        } else {
8225            None
8226        }
8227    }
8228
8229    #[allow(irrefutable_let_patterns)]
8230    pub fn into_allocate_vmos(
8231        self,
8232    ) -> Option<(AllocateVmosConfig, PacketStreamControlAllocateVmosResponder)> {
8233        if let PacketStreamControlRequest::AllocateVmos { payload, responder } = self {
8234            Some((payload, responder))
8235        } else {
8236            None
8237        }
8238    }
8239
8240    #[allow(irrefutable_let_patterns)]
8241    pub fn into_deallocate_vmos(self) -> Option<(PacketStreamControlDeallocateVmosResponder)> {
8242        if let PacketStreamControlRequest::DeallocateVmos { responder } = self {
8243            Some((responder))
8244        } else {
8245            None
8246        }
8247    }
8248
8249    #[allow(irrefutable_let_patterns)]
8250    pub fn into_register_vmos(
8251        self,
8252    ) -> Option<(RegisterVmosConfig, PacketStreamControlRegisterVmosResponder)> {
8253        if let PacketStreamControlRequest::RegisterVmos { payload, responder } = self {
8254            Some((payload, responder))
8255        } else {
8256            None
8257        }
8258    }
8259
8260    #[allow(irrefutable_let_patterns)]
8261    pub fn into_unregister_vmos(self) -> Option<(PacketStreamControlUnregisterVmosResponder)> {
8262        if let PacketStreamControlRequest::UnregisterVmos { responder } = self {
8263            Some((responder))
8264        } else {
8265            None
8266        }
8267    }
8268
8269    #[allow(irrefutable_let_patterns)]
8270    pub fn into_get_packet_stream_sink(
8271        self,
8272    ) -> Option<(PacketStreamControlGetPacketStreamSinkResponder)> {
8273        if let PacketStreamControlRequest::GetPacketStreamSink { responder } = self {
8274            Some((responder))
8275        } else {
8276            None
8277        }
8278    }
8279
8280    #[allow(irrefutable_let_patterns)]
8281    pub fn into_set_packet_stream_sink(
8282        self,
8283    ) -> Option<(
8284        PacketStreamControlSetPacketStreamSinkRequest,
8285        PacketStreamControlSetPacketStreamSinkResponder,
8286    )> {
8287        if let PacketStreamControlRequest::SetPacketStreamSink { payload, responder } = self {
8288            Some((payload, responder))
8289        } else {
8290            None
8291        }
8292    }
8293
8294    #[allow(irrefutable_let_patterns)]
8295    pub fn into_start(self) -> Option<(PacketStreamControlStartResponder)> {
8296        if let PacketStreamControlRequest::Start { responder } = self {
8297            Some((responder))
8298        } else {
8299            None
8300        }
8301    }
8302
8303    #[allow(irrefutable_let_patterns)]
8304    pub fn into_stop(self) -> Option<(PacketStreamControlStopResponder)> {
8305        if let PacketStreamControlRequest::Stop { responder } = self {
8306            Some((responder))
8307        } else {
8308            None
8309        }
8310    }
8311
8312    /// Name of the method defined in FIDL
8313    pub fn method_name(&self) -> &'static str {
8314        match *self {
8315            PacketStreamControlRequest::GetProperties { .. } => "get_properties",
8316            PacketStreamControlRequest::AllocateVmos { .. } => "allocate_vmos",
8317            PacketStreamControlRequest::DeallocateVmos { .. } => "deallocate_vmos",
8318            PacketStreamControlRequest::RegisterVmos { .. } => "register_vmos",
8319            PacketStreamControlRequest::UnregisterVmos { .. } => "unregister_vmos",
8320            PacketStreamControlRequest::GetPacketStreamSink { .. } => "get_packet_stream_sink",
8321            PacketStreamControlRequest::SetPacketStreamSink { .. } => "set_packet_stream_sink",
8322            PacketStreamControlRequest::Start { .. } => "start",
8323            PacketStreamControlRequest::Stop { .. } => "stop",
8324            PacketStreamControlRequest::_UnknownMethod {
8325                method_type: fidl::MethodType::OneWay,
8326                ..
8327            } => "unknown one-way method",
8328            PacketStreamControlRequest::_UnknownMethod {
8329                method_type: fidl::MethodType::TwoWay,
8330                ..
8331            } => "unknown two-way method",
8332        }
8333    }
8334}
8335
8336#[derive(Debug, Clone)]
8337pub struct PacketStreamControlControlHandle {
8338    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8339}
8340
8341impl PacketStreamControlControlHandle {
8342    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8343        self.inner.shutdown_with_epitaph(status.into())
8344    }
8345}
8346
8347impl fidl::endpoints::ControlHandle for PacketStreamControlControlHandle {
8348    fn shutdown(&self) {
8349        self.inner.shutdown()
8350    }
8351
8352    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8353        self.inner.shutdown_with_epitaph(status)
8354    }
8355
8356    fn is_closed(&self) -> bool {
8357        self.inner.channel().is_closed()
8358    }
8359    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8360        self.inner.channel().on_closed()
8361    }
8362
8363    #[cfg(target_os = "fuchsia")]
8364    fn signal_peer(
8365        &self,
8366        clear_mask: zx::Signals,
8367        set_mask: zx::Signals,
8368    ) -> Result<(), zx_status::Status> {
8369        use fidl::Peered;
8370        self.inner.channel().signal_peer(clear_mask, set_mask)
8371    }
8372}
8373
8374impl PacketStreamControlControlHandle {}
8375
8376#[must_use = "FIDL methods require a response to be sent"]
8377#[derive(Debug)]
8378pub struct PacketStreamControlGetPropertiesResponder {
8379    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8380    tx_id: u32,
8381}
8382
8383/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8384/// if the responder is dropped without sending a response, so that the client
8385/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8386impl std::ops::Drop for PacketStreamControlGetPropertiesResponder {
8387    fn drop(&mut self) {
8388        self.control_handle.shutdown();
8389        // Safety: drops once, never accessed again
8390        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8391    }
8392}
8393
8394impl fidl::endpoints::Responder for PacketStreamControlGetPropertiesResponder {
8395    type ControlHandle = PacketStreamControlControlHandle;
8396
8397    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8398        &self.control_handle
8399    }
8400
8401    fn drop_without_shutdown(mut self) {
8402        // Safety: drops once, never accessed again due to mem::forget
8403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8404        // Prevent Drop from running (which would shut down the channel)
8405        std::mem::forget(self);
8406    }
8407}
8408
8409impl PacketStreamControlGetPropertiesResponder {
8410    /// Sends a response to the FIDL transaction.
8411    ///
8412    /// Sets the channel to shutdown if an error occurs.
8413    pub fn send(self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
8414        let _result = self.send_raw(properties);
8415        if _result.is_err() {
8416            self.control_handle.shutdown();
8417        }
8418        self.drop_without_shutdown();
8419        _result
8420    }
8421
8422    /// Similar to "send" but does not shutdown the channel if an error occurs.
8423    pub fn send_no_shutdown_on_err(
8424        self,
8425        mut properties: &PacketStreamProperties,
8426    ) -> Result<(), fidl::Error> {
8427        let _result = self.send_raw(properties);
8428        self.drop_without_shutdown();
8429        _result
8430    }
8431
8432    fn send_raw(&self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
8433        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
8434            PacketStreamControlGetPropertiesResponse,
8435        >>(
8436            fidl::encoding::Flexible::new((properties,)),
8437            self.tx_id,
8438            0x586cf4f0f8d2771f,
8439            fidl::encoding::DynamicFlags::FLEXIBLE,
8440        )
8441    }
8442}
8443
8444#[must_use = "FIDL methods require a response to be sent"]
8445#[derive(Debug)]
8446pub struct PacketStreamControlAllocateVmosResponder {
8447    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8448    tx_id: u32,
8449}
8450
8451/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8452/// if the responder is dropped without sending a response, so that the client
8453/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8454impl std::ops::Drop for PacketStreamControlAllocateVmosResponder {
8455    fn drop(&mut self) {
8456        self.control_handle.shutdown();
8457        // Safety: drops once, never accessed again
8458        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8459    }
8460}
8461
8462impl fidl::endpoints::Responder for PacketStreamControlAllocateVmosResponder {
8463    type ControlHandle = PacketStreamControlControlHandle;
8464
8465    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8466        &self.control_handle
8467    }
8468
8469    fn drop_without_shutdown(mut self) {
8470        // Safety: drops once, never accessed again due to mem::forget
8471        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8472        // Prevent Drop from running (which would shut down the channel)
8473        std::mem::forget(self);
8474    }
8475}
8476
8477impl PacketStreamControlAllocateVmosResponder {
8478    /// Sends a response to the FIDL transaction.
8479    ///
8480    /// Sets the channel to shutdown if an error occurs.
8481    pub fn send(self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
8482        let _result = self.send_raw(result);
8483        if _result.is_err() {
8484            self.control_handle.shutdown();
8485        }
8486        self.drop_without_shutdown();
8487        _result
8488    }
8489
8490    /// Similar to "send" but does not shutdown the channel if an error occurs.
8491    pub fn send_no_shutdown_on_err(
8492        self,
8493        mut result: Result<Vec<VmoInfo>, i32>,
8494    ) -> Result<(), fidl::Error> {
8495        let _result = self.send_raw(result);
8496        self.drop_without_shutdown();
8497        _result
8498    }
8499
8500    fn send_raw(&self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
8501        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8502            PacketStreamControlAllocateVmosResponse,
8503            i32,
8504        >>(
8505            fidl::encoding::FlexibleResult::new(
8506                result.as_mut().map_err(|e| *e).map(|vmos| (vmos.as_mut_slice(),)),
8507            ),
8508            self.tx_id,
8509            0x7ff1473165ed344b,
8510            fidl::encoding::DynamicFlags::FLEXIBLE,
8511        )
8512    }
8513}
8514
8515#[must_use = "FIDL methods require a response to be sent"]
8516#[derive(Debug)]
8517pub struct PacketStreamControlDeallocateVmosResponder {
8518    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8519    tx_id: u32,
8520}
8521
8522/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8523/// if the responder is dropped without sending a response, so that the client
8524/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8525impl std::ops::Drop for PacketStreamControlDeallocateVmosResponder {
8526    fn drop(&mut self) {
8527        self.control_handle.shutdown();
8528        // Safety: drops once, never accessed again
8529        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8530    }
8531}
8532
8533impl fidl::endpoints::Responder for PacketStreamControlDeallocateVmosResponder {
8534    type ControlHandle = PacketStreamControlControlHandle;
8535
8536    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8537        &self.control_handle
8538    }
8539
8540    fn drop_without_shutdown(mut self) {
8541        // Safety: drops once, never accessed again due to mem::forget
8542        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8543        // Prevent Drop from running (which would shut down the channel)
8544        std::mem::forget(self);
8545    }
8546}
8547
8548impl PacketStreamControlDeallocateVmosResponder {
8549    /// Sends a response to the FIDL transaction.
8550    ///
8551    /// Sets the channel to shutdown if an error occurs.
8552    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8553        let _result = self.send_raw(result);
8554        if _result.is_err() {
8555            self.control_handle.shutdown();
8556        }
8557        self.drop_without_shutdown();
8558        _result
8559    }
8560
8561    /// Similar to "send" but does not shutdown the channel if an error occurs.
8562    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8563        let _result = self.send_raw(result);
8564        self.drop_without_shutdown();
8565        _result
8566    }
8567
8568    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8569        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8570            fidl::encoding::EmptyStruct,
8571            i32,
8572        >>(
8573            fidl::encoding::FlexibleResult::new(result),
8574            self.tx_id,
8575            0x4db5cc85a7b8405b,
8576            fidl::encoding::DynamicFlags::FLEXIBLE,
8577        )
8578    }
8579}
8580
8581#[must_use = "FIDL methods require a response to be sent"]
8582#[derive(Debug)]
8583pub struct PacketStreamControlRegisterVmosResponder {
8584    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8585    tx_id: u32,
8586}
8587
8588/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8589/// if the responder is dropped without sending a response, so that the client
8590/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8591impl std::ops::Drop for PacketStreamControlRegisterVmosResponder {
8592    fn drop(&mut self) {
8593        self.control_handle.shutdown();
8594        // Safety: drops once, never accessed again
8595        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8596    }
8597}
8598
8599impl fidl::endpoints::Responder for PacketStreamControlRegisterVmosResponder {
8600    type ControlHandle = PacketStreamControlControlHandle;
8601
8602    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8603        &self.control_handle
8604    }
8605
8606    fn drop_without_shutdown(mut self) {
8607        // Safety: drops once, never accessed again due to mem::forget
8608        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8609        // Prevent Drop from running (which would shut down the channel)
8610        std::mem::forget(self);
8611    }
8612}
8613
8614impl PacketStreamControlRegisterVmosResponder {
8615    /// Sends a response to the FIDL transaction.
8616    ///
8617    /// Sets the channel to shutdown if an error occurs.
8618    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8619        let _result = self.send_raw(result);
8620        if _result.is_err() {
8621            self.control_handle.shutdown();
8622        }
8623        self.drop_without_shutdown();
8624        _result
8625    }
8626
8627    /// Similar to "send" but does not shutdown the channel if an error occurs.
8628    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8629        let _result = self.send_raw(result);
8630        self.drop_without_shutdown();
8631        _result
8632    }
8633
8634    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8635        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8636            fidl::encoding::EmptyStruct,
8637            i32,
8638        >>(
8639            fidl::encoding::FlexibleResult::new(result),
8640            self.tx_id,
8641            0x29c3b656a1020bfd,
8642            fidl::encoding::DynamicFlags::FLEXIBLE,
8643        )
8644    }
8645}
8646
8647#[must_use = "FIDL methods require a response to be sent"]
8648#[derive(Debug)]
8649pub struct PacketStreamControlUnregisterVmosResponder {
8650    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8651    tx_id: u32,
8652}
8653
8654/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8655/// if the responder is dropped without sending a response, so that the client
8656/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8657impl std::ops::Drop for PacketStreamControlUnregisterVmosResponder {
8658    fn drop(&mut self) {
8659        self.control_handle.shutdown();
8660        // Safety: drops once, never accessed again
8661        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8662    }
8663}
8664
8665impl fidl::endpoints::Responder for PacketStreamControlUnregisterVmosResponder {
8666    type ControlHandle = PacketStreamControlControlHandle;
8667
8668    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8669        &self.control_handle
8670    }
8671
8672    fn drop_without_shutdown(mut self) {
8673        // Safety: drops once, never accessed again due to mem::forget
8674        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8675        // Prevent Drop from running (which would shut down the channel)
8676        std::mem::forget(self);
8677    }
8678}
8679
8680impl PacketStreamControlUnregisterVmosResponder {
8681    /// Sends a response to the FIDL transaction.
8682    ///
8683    /// Sets the channel to shutdown if an error occurs.
8684    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8685        let _result = self.send_raw(result);
8686        if _result.is_err() {
8687            self.control_handle.shutdown();
8688        }
8689        self.drop_without_shutdown();
8690        _result
8691    }
8692
8693    /// Similar to "send" but does not shutdown the channel if an error occurs.
8694    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8695        let _result = self.send_raw(result);
8696        self.drop_without_shutdown();
8697        _result
8698    }
8699
8700    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8701        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8702            fidl::encoding::EmptyStruct,
8703            i32,
8704        >>(
8705            fidl::encoding::FlexibleResult::new(result),
8706            self.tx_id,
8707            0x3e3b4dbfe26b6094,
8708            fidl::encoding::DynamicFlags::FLEXIBLE,
8709        )
8710    }
8711}
8712
8713#[must_use = "FIDL methods require a response to be sent"]
8714#[derive(Debug)]
8715pub struct PacketStreamControlGetPacketStreamSinkResponder {
8716    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8717    tx_id: u32,
8718}
8719
8720/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8721/// if the responder is dropped without sending a response, so that the client
8722/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8723impl std::ops::Drop for PacketStreamControlGetPacketStreamSinkResponder {
8724    fn drop(&mut self) {
8725        self.control_handle.shutdown();
8726        // Safety: drops once, never accessed again
8727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8728    }
8729}
8730
8731impl fidl::endpoints::Responder for PacketStreamControlGetPacketStreamSinkResponder {
8732    type ControlHandle = PacketStreamControlControlHandle;
8733
8734    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8735        &self.control_handle
8736    }
8737
8738    fn drop_without_shutdown(mut self) {
8739        // Safety: drops once, never accessed again due to mem::forget
8740        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8741        // Prevent Drop from running (which would shut down the channel)
8742        std::mem::forget(self);
8743    }
8744}
8745
8746impl PacketStreamControlGetPacketStreamSinkResponder {
8747    /// Sends a response to the FIDL transaction.
8748    ///
8749    /// Sets the channel to shutdown if an error occurs.
8750    pub fn send(
8751        self,
8752        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8753    ) -> Result<(), fidl::Error> {
8754        let _result = self.send_raw(result);
8755        if _result.is_err() {
8756            self.control_handle.shutdown();
8757        }
8758        self.drop_without_shutdown();
8759        _result
8760    }
8761
8762    /// Similar to "send" but does not shutdown the channel if an error occurs.
8763    pub fn send_no_shutdown_on_err(
8764        self,
8765        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8766    ) -> Result<(), fidl::Error> {
8767        let _result = self.send_raw(result);
8768        self.drop_without_shutdown();
8769        _result
8770    }
8771
8772    fn send_raw(
8773        &self,
8774        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8775    ) -> Result<(), fidl::Error> {
8776        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8777            PacketStreamControlGetPacketStreamSinkResponse,
8778            i32,
8779        >>(
8780            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
8781            self.tx_id,
8782            0x7394726463ebbc6a,
8783            fidl::encoding::DynamicFlags::FLEXIBLE,
8784        )
8785    }
8786}
8787
8788#[must_use = "FIDL methods require a response to be sent"]
8789#[derive(Debug)]
8790pub struct PacketStreamControlSetPacketStreamSinkResponder {
8791    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8792    tx_id: u32,
8793}
8794
8795/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8796/// if the responder is dropped without sending a response, so that the client
8797/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8798impl std::ops::Drop for PacketStreamControlSetPacketStreamSinkResponder {
8799    fn drop(&mut self) {
8800        self.control_handle.shutdown();
8801        // Safety: drops once, never accessed again
8802        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8803    }
8804}
8805
8806impl fidl::endpoints::Responder for PacketStreamControlSetPacketStreamSinkResponder {
8807    type ControlHandle = PacketStreamControlControlHandle;
8808
8809    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8810        &self.control_handle
8811    }
8812
8813    fn drop_without_shutdown(mut self) {
8814        // Safety: drops once, never accessed again due to mem::forget
8815        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8816        // Prevent Drop from running (which would shut down the channel)
8817        std::mem::forget(self);
8818    }
8819}
8820
8821impl PacketStreamControlSetPacketStreamSinkResponder {
8822    /// Sends a response to the FIDL transaction.
8823    ///
8824    /// Sets the channel to shutdown if an error occurs.
8825    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8826        let _result = self.send_raw(result);
8827        if _result.is_err() {
8828            self.control_handle.shutdown();
8829        }
8830        self.drop_without_shutdown();
8831        _result
8832    }
8833
8834    /// Similar to "send" but does not shutdown the channel if an error occurs.
8835    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8836        let _result = self.send_raw(result);
8837        self.drop_without_shutdown();
8838        _result
8839    }
8840
8841    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8842        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8843            fidl::encoding::EmptyStruct,
8844            i32,
8845        >>(
8846            fidl::encoding::FlexibleResult::new(result),
8847            self.tx_id,
8848            0xab88800e31dc0e4,
8849            fidl::encoding::DynamicFlags::FLEXIBLE,
8850        )
8851    }
8852}
8853
8854#[must_use = "FIDL methods require a response to be sent"]
8855#[derive(Debug)]
8856pub struct PacketStreamControlStartResponder {
8857    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8858    tx_id: u32,
8859}
8860
8861/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8862/// if the responder is dropped without sending a response, so that the client
8863/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8864impl std::ops::Drop for PacketStreamControlStartResponder {
8865    fn drop(&mut self) {
8866        self.control_handle.shutdown();
8867        // Safety: drops once, never accessed again
8868        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8869    }
8870}
8871
8872impl fidl::endpoints::Responder for PacketStreamControlStartResponder {
8873    type ControlHandle = PacketStreamControlControlHandle;
8874
8875    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8876        &self.control_handle
8877    }
8878
8879    fn drop_without_shutdown(mut self) {
8880        // Safety: drops once, never accessed again due to mem::forget
8881        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8882        // Prevent Drop from running (which would shut down the channel)
8883        std::mem::forget(self);
8884    }
8885}
8886
8887impl PacketStreamControlStartResponder {
8888    /// Sends a response to the FIDL transaction.
8889    ///
8890    /// Sets the channel to shutdown if an error occurs.
8891    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8892        let _result = self.send_raw(result);
8893        if _result.is_err() {
8894            self.control_handle.shutdown();
8895        }
8896        self.drop_without_shutdown();
8897        _result
8898    }
8899
8900    /// Similar to "send" but does not shutdown the channel if an error occurs.
8901    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8902        let _result = self.send_raw(result);
8903        self.drop_without_shutdown();
8904        _result
8905    }
8906
8907    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8908        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8909            fidl::encoding::EmptyStruct,
8910            i32,
8911        >>(
8912            fidl::encoding::FlexibleResult::new(result),
8913            self.tx_id,
8914            0x3a584b94d8a6bfd0,
8915            fidl::encoding::DynamicFlags::FLEXIBLE,
8916        )
8917    }
8918}
8919
8920#[must_use = "FIDL methods require a response to be sent"]
8921#[derive(Debug)]
8922pub struct PacketStreamControlStopResponder {
8923    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8924    tx_id: u32,
8925}
8926
8927/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8928/// if the responder is dropped without sending a response, so that the client
8929/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8930impl std::ops::Drop for PacketStreamControlStopResponder {
8931    fn drop(&mut self) {
8932        self.control_handle.shutdown();
8933        // Safety: drops once, never accessed again
8934        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8935    }
8936}
8937
8938impl fidl::endpoints::Responder for PacketStreamControlStopResponder {
8939    type ControlHandle = PacketStreamControlControlHandle;
8940
8941    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8942        &self.control_handle
8943    }
8944
8945    fn drop_without_shutdown(mut self) {
8946        // Safety: drops once, never accessed again due to mem::forget
8947        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8948        // Prevent Drop from running (which would shut down the channel)
8949        std::mem::forget(self);
8950    }
8951}
8952
8953impl PacketStreamControlStopResponder {
8954    /// Sends a response to the FIDL transaction.
8955    ///
8956    /// Sets the channel to shutdown if an error occurs.
8957    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8958        let _result = self.send_raw(result);
8959        if _result.is_err() {
8960            self.control_handle.shutdown();
8961        }
8962        self.drop_without_shutdown();
8963        _result
8964    }
8965
8966    /// Similar to "send" but does not shutdown the channel if an error occurs.
8967    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8968        let _result = self.send_raw(result);
8969        self.drop_without_shutdown();
8970        _result
8971    }
8972
8973    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8974        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8975            fidl::encoding::EmptyStruct,
8976            i32,
8977        >>(
8978            fidl::encoding::FlexibleResult::new(result),
8979            self.tx_id,
8980            0x703e4fafcdd7ef32,
8981            fidl::encoding::DynamicFlags::FLEXIBLE,
8982        )
8983    }
8984}
8985
8986#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8987pub struct PacketStreamSinkMarker;
8988
8989impl fidl::endpoints::ProtocolMarker for PacketStreamSinkMarker {
8990    type Proxy = PacketStreamSinkProxy;
8991    type RequestStream = PacketStreamSinkRequestStream;
8992    #[cfg(target_os = "fuchsia")]
8993    type SynchronousProxy = PacketStreamSinkSynchronousProxy;
8994
8995    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamSink";
8996}
8997pub type PacketStreamSinkPutPacketResult = Result<PacketStreamSinkPutPacketResponse, i32>;
8998pub type PacketStreamSinkFlushPacketsResult = Result<(), i32>;
8999
9000pub trait PacketStreamSinkProxyInterface: Send + Sync {
9001    type PutPacketResponseFut: std::future::Future<Output = Result<PacketStreamSinkPutPacketResult, fidl::Error>>
9002        + Send;
9003    fn r#put_packet(&self, payload: PacketStreamSinkPutPacketRequest)
9004    -> Self::PutPacketResponseFut;
9005    type FlushPacketsResponseFut: std::future::Future<Output = Result<PacketStreamSinkFlushPacketsResult, fidl::Error>>
9006        + Send;
9007    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut;
9008}
9009#[derive(Debug)]
9010#[cfg(target_os = "fuchsia")]
9011pub struct PacketStreamSinkSynchronousProxy {
9012    client: fidl::client::sync::Client,
9013}
9014
9015#[cfg(target_os = "fuchsia")]
9016impl fidl::endpoints::SynchronousProxy for PacketStreamSinkSynchronousProxy {
9017    type Proxy = PacketStreamSinkProxy;
9018    type Protocol = PacketStreamSinkMarker;
9019
9020    fn from_channel(inner: fidl::Channel) -> Self {
9021        Self::new(inner)
9022    }
9023
9024    fn into_channel(self) -> fidl::Channel {
9025        self.client.into_channel()
9026    }
9027
9028    fn as_channel(&self) -> &fidl::Channel {
9029        self.client.as_channel()
9030    }
9031}
9032
9033#[cfg(target_os = "fuchsia")]
9034impl PacketStreamSinkSynchronousProxy {
9035    pub fn new(channel: fidl::Channel) -> Self {
9036        Self { client: fidl::client::sync::Client::new(channel) }
9037    }
9038
9039    pub fn into_channel(self) -> fidl::Channel {
9040        self.client.into_channel()
9041    }
9042
9043    /// Waits until an event arrives and returns it. It is safe for other
9044    /// threads to make concurrent requests while waiting for an event.
9045    pub fn wait_for_event(
9046        &self,
9047        deadline: zx::MonotonicInstant,
9048    ) -> Result<PacketStreamSinkEvent, fidl::Error> {
9049        PacketStreamSinkEvent::decode(
9050            self.client.wait_for_event::<PacketStreamSinkMarker>(deadline)?,
9051        )
9052    }
9053
9054    /// Submits a packet to be processed by the server.
9055    ///
9056    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
9057    /// Packets are processed in the order they were submitted. This call
9058    /// blocks until the payload is processed. When this call returns, the
9059    /// buffer region is guaranteed to be available for reuse.
9060    ///
9061    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
9062    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
9063    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
9064    /// * The payload is missing.
9065    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
9066    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
9067    ///   `DRIVER_OWNED`.
9068    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
9069    ///
9070    /// Note: The server is not required to detect if a VMO region is currently in use by a
9071    /// previous pending packet. Clients are responsible for managing buffer usage.
9072    pub fn r#put_packet(
9073        &self,
9074        mut payload: PacketStreamSinkPutPacketRequest,
9075        ___deadline: zx::MonotonicInstant,
9076    ) -> Result<PacketStreamSinkPutPacketResult, fidl::Error> {
9077        let _response = self.client.send_query::<
9078            PacketStreamSinkPutPacketRequest,
9079            fidl::encoding::FlexibleResultType<PacketStreamSinkPutPacketResponse, i32>,
9080            PacketStreamSinkMarker,
9081        >(
9082            &mut payload,
9083            0x25a8e35efba81f2b,
9084            fidl::encoding::DynamicFlags::FLEXIBLE,
9085            ___deadline,
9086        )?
9087        .into_result::<PacketStreamSinkMarker>("put_packet")?;
9088        Ok(_response.map(|x| x))
9089    }
9090
9091    /// Flushes all packets currently pending without processing them.
9092    /// This call waits until all pending packets are completed or canceled.
9093    ///
9094    /// Note: A packet may be partially processed (e.g. if it contains multiple
9095    /// audio frames, or if the data does not align with encoded frame boundaries)
9096    /// before it is canceled.
9097    pub fn r#flush_packets(
9098        &self,
9099        ___deadline: zx::MonotonicInstant,
9100    ) -> Result<PacketStreamSinkFlushPacketsResult, fidl::Error> {
9101        let _response = self.client.send_query::<
9102            fidl::encoding::EmptyPayload,
9103            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
9104            PacketStreamSinkMarker,
9105        >(
9106            (),
9107            0x13f16ca37ede8a4,
9108            fidl::encoding::DynamicFlags::FLEXIBLE,
9109            ___deadline,
9110        )?
9111        .into_result::<PacketStreamSinkMarker>("flush_packets")?;
9112        Ok(_response.map(|x| x))
9113    }
9114}
9115
9116#[cfg(target_os = "fuchsia")]
9117impl From<PacketStreamSinkSynchronousProxy> for zx::NullableHandle {
9118    fn from(value: PacketStreamSinkSynchronousProxy) -> Self {
9119        value.into_channel().into()
9120    }
9121}
9122
9123#[cfg(target_os = "fuchsia")]
9124impl From<fidl::Channel> for PacketStreamSinkSynchronousProxy {
9125    fn from(value: fidl::Channel) -> Self {
9126        Self::new(value)
9127    }
9128}
9129
9130#[cfg(target_os = "fuchsia")]
9131impl fidl::endpoints::FromClient for PacketStreamSinkSynchronousProxy {
9132    type Protocol = PacketStreamSinkMarker;
9133
9134    fn from_client(value: fidl::endpoints::ClientEnd<PacketStreamSinkMarker>) -> Self {
9135        Self::new(value.into_channel())
9136    }
9137}
9138
9139#[derive(Debug, Clone)]
9140pub struct PacketStreamSinkProxy {
9141    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9142}
9143
9144impl fidl::endpoints::Proxy for PacketStreamSinkProxy {
9145    type Protocol = PacketStreamSinkMarker;
9146
9147    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9148        Self::new(inner)
9149    }
9150
9151    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9152        self.client.into_channel().map_err(|client| Self { client })
9153    }
9154
9155    fn as_channel(&self) -> &::fidl::AsyncChannel {
9156        self.client.as_channel()
9157    }
9158}
9159
9160impl PacketStreamSinkProxy {
9161    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamSink.
9162    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9163        let protocol_name = <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9164        Self { client: fidl::client::Client::new(channel, protocol_name) }
9165    }
9166
9167    /// Get a Stream of events from the remote end of the protocol.
9168    ///
9169    /// # Panics
9170    ///
9171    /// Panics if the event stream was already taken.
9172    pub fn take_event_stream(&self) -> PacketStreamSinkEventStream {
9173        PacketStreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
9174    }
9175
9176    /// Submits a packet to be processed by the server.
9177    ///
9178    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
9179    /// Packets are processed in the order they were submitted. This call
9180    /// blocks until the payload is processed. When this call returns, the
9181    /// buffer region is guaranteed to be available for reuse.
9182    ///
9183    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
9184    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
9185    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
9186    /// * The payload is missing.
9187    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
9188    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
9189    ///   `DRIVER_OWNED`.
9190    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
9191    ///
9192    /// Note: The server is not required to detect if a VMO region is currently in use by a
9193    /// previous pending packet. Clients are responsible for managing buffer usage.
9194    pub fn r#put_packet(
9195        &self,
9196        mut payload: PacketStreamSinkPutPacketRequest,
9197    ) -> fidl::client::QueryResponseFut<
9198        PacketStreamSinkPutPacketResult,
9199        fidl::encoding::DefaultFuchsiaResourceDialect,
9200    > {
9201        PacketStreamSinkProxyInterface::r#put_packet(self, payload)
9202    }
9203
9204    /// Flushes all packets currently pending without processing them.
9205    /// This call waits until all pending packets are completed or canceled.
9206    ///
9207    /// Note: A packet may be partially processed (e.g. if it contains multiple
9208    /// audio frames, or if the data does not align with encoded frame boundaries)
9209    /// before it is canceled.
9210    pub fn r#flush_packets(
9211        &self,
9212    ) -> fidl::client::QueryResponseFut<
9213        PacketStreamSinkFlushPacketsResult,
9214        fidl::encoding::DefaultFuchsiaResourceDialect,
9215    > {
9216        PacketStreamSinkProxyInterface::r#flush_packets(self)
9217    }
9218}
9219
9220impl PacketStreamSinkProxyInterface for PacketStreamSinkProxy {
9221    type PutPacketResponseFut = fidl::client::QueryResponseFut<
9222        PacketStreamSinkPutPacketResult,
9223        fidl::encoding::DefaultFuchsiaResourceDialect,
9224    >;
9225    fn r#put_packet(
9226        &self,
9227        mut payload: PacketStreamSinkPutPacketRequest,
9228    ) -> Self::PutPacketResponseFut {
9229        fn _decode(
9230            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9231        ) -> Result<PacketStreamSinkPutPacketResult, fidl::Error> {
9232            let _response = fidl::client::decode_transaction_body::<
9233                fidl::encoding::FlexibleResultType<PacketStreamSinkPutPacketResponse, i32>,
9234                fidl::encoding::DefaultFuchsiaResourceDialect,
9235                0x25a8e35efba81f2b,
9236            >(_buf?)?
9237            .into_result::<PacketStreamSinkMarker>("put_packet")?;
9238            Ok(_response.map(|x| x))
9239        }
9240        self.client.send_query_and_decode::<
9241            PacketStreamSinkPutPacketRequest,
9242            PacketStreamSinkPutPacketResult,
9243        >(
9244            &mut payload,
9245            0x25a8e35efba81f2b,
9246            fidl::encoding::DynamicFlags::FLEXIBLE,
9247            _decode,
9248        )
9249    }
9250
9251    type FlushPacketsResponseFut = fidl::client::QueryResponseFut<
9252        PacketStreamSinkFlushPacketsResult,
9253        fidl::encoding::DefaultFuchsiaResourceDialect,
9254    >;
9255    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut {
9256        fn _decode(
9257            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9258        ) -> Result<PacketStreamSinkFlushPacketsResult, fidl::Error> {
9259            let _response = fidl::client::decode_transaction_body::<
9260                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
9261                fidl::encoding::DefaultFuchsiaResourceDialect,
9262                0x13f16ca37ede8a4,
9263            >(_buf?)?
9264            .into_result::<PacketStreamSinkMarker>("flush_packets")?;
9265            Ok(_response.map(|x| x))
9266        }
9267        self.client.send_query_and_decode::<
9268            fidl::encoding::EmptyPayload,
9269            PacketStreamSinkFlushPacketsResult,
9270        >(
9271            (),
9272            0x13f16ca37ede8a4,
9273            fidl::encoding::DynamicFlags::FLEXIBLE,
9274            _decode,
9275        )
9276    }
9277}
9278
9279pub struct PacketStreamSinkEventStream {
9280    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9281}
9282
9283impl std::marker::Unpin for PacketStreamSinkEventStream {}
9284
9285impl futures::stream::FusedStream for PacketStreamSinkEventStream {
9286    fn is_terminated(&self) -> bool {
9287        self.event_receiver.is_terminated()
9288    }
9289}
9290
9291impl futures::Stream for PacketStreamSinkEventStream {
9292    type Item = Result<PacketStreamSinkEvent, fidl::Error>;
9293
9294    fn poll_next(
9295        mut self: std::pin::Pin<&mut Self>,
9296        cx: &mut std::task::Context<'_>,
9297    ) -> std::task::Poll<Option<Self::Item>> {
9298        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9299            &mut self.event_receiver,
9300            cx
9301        )?) {
9302            Some(buf) => std::task::Poll::Ready(Some(PacketStreamSinkEvent::decode(buf))),
9303            None => std::task::Poll::Ready(None),
9304        }
9305    }
9306}
9307
9308#[derive(Debug)]
9309pub enum PacketStreamSinkEvent {
9310    #[non_exhaustive]
9311    _UnknownEvent {
9312        /// Ordinal of the event that was sent.
9313        ordinal: u64,
9314    },
9315}
9316
9317impl PacketStreamSinkEvent {
9318    /// Decodes a message buffer as a [`PacketStreamSinkEvent`].
9319    fn decode(
9320        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9321    ) -> Result<PacketStreamSinkEvent, fidl::Error> {
9322        let (bytes, _handles) = buf.split_mut();
9323        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9324        debug_assert_eq!(tx_header.tx_id, 0);
9325        match tx_header.ordinal {
9326            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
9327                Ok(PacketStreamSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
9328            }
9329            _ => Err(fidl::Error::UnknownOrdinal {
9330                ordinal: tx_header.ordinal,
9331                protocol_name:
9332                    <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9333            }),
9334        }
9335    }
9336}
9337
9338/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamSink.
9339pub struct PacketStreamSinkRequestStream {
9340    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9341    is_terminated: bool,
9342}
9343
9344impl std::marker::Unpin for PacketStreamSinkRequestStream {}
9345
9346impl futures::stream::FusedStream for PacketStreamSinkRequestStream {
9347    fn is_terminated(&self) -> bool {
9348        self.is_terminated
9349    }
9350}
9351
9352impl fidl::endpoints::RequestStream for PacketStreamSinkRequestStream {
9353    type Protocol = PacketStreamSinkMarker;
9354    type ControlHandle = PacketStreamSinkControlHandle;
9355
9356    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9357        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9358    }
9359
9360    fn control_handle(&self) -> Self::ControlHandle {
9361        PacketStreamSinkControlHandle { inner: self.inner.clone() }
9362    }
9363
9364    fn into_inner(
9365        self,
9366    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9367    {
9368        (self.inner, self.is_terminated)
9369    }
9370
9371    fn from_inner(
9372        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9373        is_terminated: bool,
9374    ) -> Self {
9375        Self { inner, is_terminated }
9376    }
9377}
9378
9379impl futures::Stream for PacketStreamSinkRequestStream {
9380    type Item = Result<PacketStreamSinkRequest, fidl::Error>;
9381
9382    fn poll_next(
9383        mut self: std::pin::Pin<&mut Self>,
9384        cx: &mut std::task::Context<'_>,
9385    ) -> std::task::Poll<Option<Self::Item>> {
9386        let this = &mut *self;
9387        if this.inner.check_shutdown(cx) {
9388            this.is_terminated = true;
9389            return std::task::Poll::Ready(None);
9390        }
9391        if this.is_terminated {
9392            panic!("polled PacketStreamSinkRequestStream after completion");
9393        }
9394        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9395            |bytes, handles| {
9396                match this.inner.channel().read_etc(cx, bytes, handles) {
9397                    std::task::Poll::Ready(Ok(())) => {}
9398                    std::task::Poll::Pending => return std::task::Poll::Pending,
9399                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9400                        this.is_terminated = true;
9401                        return std::task::Poll::Ready(None);
9402                    }
9403                    std::task::Poll::Ready(Err(e)) => {
9404                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9405                            e.into(),
9406                        ))));
9407                    }
9408                }
9409
9410                // A message has been received from the channel
9411                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9412
9413                std::task::Poll::Ready(Some(match header.ordinal {
9414                    0x25a8e35efba81f2b => {
9415                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9416                        let mut req = fidl::new_empty!(
9417                            PacketStreamSinkPutPacketRequest,
9418                            fidl::encoding::DefaultFuchsiaResourceDialect
9419                        );
9420                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PacketStreamSinkPutPacketRequest>(&header, _body_bytes, handles, &mut req)?;
9421                        let control_handle =
9422                            PacketStreamSinkControlHandle { inner: this.inner.clone() };
9423                        Ok(PacketStreamSinkRequest::PutPacket {
9424                            payload: req,
9425                            responder: PacketStreamSinkPutPacketResponder {
9426                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9427                                tx_id: header.tx_id,
9428                            },
9429                        })
9430                    }
9431                    0x13f16ca37ede8a4 => {
9432                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9433                        let mut req = fidl::new_empty!(
9434                            fidl::encoding::EmptyPayload,
9435                            fidl::encoding::DefaultFuchsiaResourceDialect
9436                        );
9437                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9438                        let control_handle =
9439                            PacketStreamSinkControlHandle { inner: this.inner.clone() };
9440                        Ok(PacketStreamSinkRequest::FlushPackets {
9441                            responder: PacketStreamSinkFlushPacketsResponder {
9442                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9443                                tx_id: header.tx_id,
9444                            },
9445                        })
9446                    }
9447                    _ if header.tx_id == 0
9448                        && header
9449                            .dynamic_flags()
9450                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9451                    {
9452                        Ok(PacketStreamSinkRequest::_UnknownMethod {
9453                            ordinal: header.ordinal,
9454                            control_handle: PacketStreamSinkControlHandle {
9455                                inner: this.inner.clone(),
9456                            },
9457                            method_type: fidl::MethodType::OneWay,
9458                        })
9459                    }
9460                    _ if header
9461                        .dynamic_flags()
9462                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9463                    {
9464                        this.inner.send_framework_err(
9465                            fidl::encoding::FrameworkErr::UnknownMethod,
9466                            header.tx_id,
9467                            header.ordinal,
9468                            header.dynamic_flags(),
9469                            (bytes, handles),
9470                        )?;
9471                        Ok(PacketStreamSinkRequest::_UnknownMethod {
9472                            ordinal: header.ordinal,
9473                            control_handle: PacketStreamSinkControlHandle {
9474                                inner: this.inner.clone(),
9475                            },
9476                            method_type: fidl::MethodType::TwoWay,
9477                        })
9478                    }
9479                    _ => Err(fidl::Error::UnknownOrdinal {
9480                        ordinal: header.ordinal,
9481                        protocol_name:
9482                            <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9483                    }),
9484                }))
9485            },
9486        )
9487    }
9488}
9489
9490/// The protocol for streaming packet-based audio data.
9491/// This protocol functions as a data sink. The "server" of this protocol consumes packets,
9492/// and the "client" produces packets.
9493///
9494/// This protocol can be used in two directions:
9495/// 1. **Output (Client -> Driver)**: The Driver implements `PacketStreamSink`. The Client (App)
9496///    calls `PutPacket`.
9497/// 2. **Input (Driver -> Client)**: The Client (App) implements `PacketStreamSink`. The Driver
9498///    calls `PutPacket`.
9499#[derive(Debug)]
9500pub enum PacketStreamSinkRequest {
9501    /// Submits a packet to be processed by the server.
9502    ///
9503    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
9504    /// Packets are processed in the order they were submitted. This call
9505    /// blocks until the payload is processed. When this call returns, the
9506    /// buffer region is guaranteed to be available for reuse.
9507    ///
9508    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
9509    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
9510    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
9511    /// * The payload is missing.
9512    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
9513    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
9514    ///   `DRIVER_OWNED`.
9515    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
9516    ///
9517    /// Note: The server is not required to detect if a VMO region is currently in use by a
9518    /// previous pending packet. Clients are responsible for managing buffer usage.
9519    PutPacket {
9520        payload: PacketStreamSinkPutPacketRequest,
9521        responder: PacketStreamSinkPutPacketResponder,
9522    },
9523    /// Flushes all packets currently pending without processing them.
9524    /// This call waits until all pending packets are completed or canceled.
9525    ///
9526    /// Note: A packet may be partially processed (e.g. if it contains multiple
9527    /// audio frames, or if the data does not align with encoded frame boundaries)
9528    /// before it is canceled.
9529    FlushPackets { responder: PacketStreamSinkFlushPacketsResponder },
9530    /// An interaction was received which does not match any known method.
9531    #[non_exhaustive]
9532    _UnknownMethod {
9533        /// Ordinal of the method that was called.
9534        ordinal: u64,
9535        control_handle: PacketStreamSinkControlHandle,
9536        method_type: fidl::MethodType,
9537    },
9538}
9539
9540impl PacketStreamSinkRequest {
9541    #[allow(irrefutable_let_patterns)]
9542    pub fn into_put_packet(
9543        self,
9544    ) -> Option<(PacketStreamSinkPutPacketRequest, PacketStreamSinkPutPacketResponder)> {
9545        if let PacketStreamSinkRequest::PutPacket { payload, responder } = self {
9546            Some((payload, responder))
9547        } else {
9548            None
9549        }
9550    }
9551
9552    #[allow(irrefutable_let_patterns)]
9553    pub fn into_flush_packets(self) -> Option<(PacketStreamSinkFlushPacketsResponder)> {
9554        if let PacketStreamSinkRequest::FlushPackets { responder } = self {
9555            Some((responder))
9556        } else {
9557            None
9558        }
9559    }
9560
9561    /// Name of the method defined in FIDL
9562    pub fn method_name(&self) -> &'static str {
9563        match *self {
9564            PacketStreamSinkRequest::PutPacket { .. } => "put_packet",
9565            PacketStreamSinkRequest::FlushPackets { .. } => "flush_packets",
9566            PacketStreamSinkRequest::_UnknownMethod {
9567                method_type: fidl::MethodType::OneWay,
9568                ..
9569            } => "unknown one-way method",
9570            PacketStreamSinkRequest::_UnknownMethod {
9571                method_type: fidl::MethodType::TwoWay,
9572                ..
9573            } => "unknown two-way method",
9574        }
9575    }
9576}
9577
9578#[derive(Debug, Clone)]
9579pub struct PacketStreamSinkControlHandle {
9580    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9581}
9582
9583impl PacketStreamSinkControlHandle {
9584    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9585        self.inner.shutdown_with_epitaph(status.into())
9586    }
9587}
9588
9589impl fidl::endpoints::ControlHandle for PacketStreamSinkControlHandle {
9590    fn shutdown(&self) {
9591        self.inner.shutdown()
9592    }
9593
9594    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9595        self.inner.shutdown_with_epitaph(status)
9596    }
9597
9598    fn is_closed(&self) -> bool {
9599        self.inner.channel().is_closed()
9600    }
9601    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9602        self.inner.channel().on_closed()
9603    }
9604
9605    #[cfg(target_os = "fuchsia")]
9606    fn signal_peer(
9607        &self,
9608        clear_mask: zx::Signals,
9609        set_mask: zx::Signals,
9610    ) -> Result<(), zx_status::Status> {
9611        use fidl::Peered;
9612        self.inner.channel().signal_peer(clear_mask, set_mask)
9613    }
9614}
9615
9616impl PacketStreamSinkControlHandle {}
9617
9618#[must_use = "FIDL methods require a response to be sent"]
9619#[derive(Debug)]
9620pub struct PacketStreamSinkPutPacketResponder {
9621    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
9622    tx_id: u32,
9623}
9624
9625/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
9626/// if the responder is dropped without sending a response, so that the client
9627/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9628impl std::ops::Drop for PacketStreamSinkPutPacketResponder {
9629    fn drop(&mut self) {
9630        self.control_handle.shutdown();
9631        // Safety: drops once, never accessed again
9632        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9633    }
9634}
9635
9636impl fidl::endpoints::Responder for PacketStreamSinkPutPacketResponder {
9637    type ControlHandle = PacketStreamSinkControlHandle;
9638
9639    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
9640        &self.control_handle
9641    }
9642
9643    fn drop_without_shutdown(mut self) {
9644        // Safety: drops once, never accessed again due to mem::forget
9645        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9646        // Prevent Drop from running (which would shut down the channel)
9647        std::mem::forget(self);
9648    }
9649}
9650
9651impl PacketStreamSinkPutPacketResponder {
9652    /// Sends a response to the FIDL transaction.
9653    ///
9654    /// Sets the channel to shutdown if an error occurs.
9655    pub fn send(
9656        self,
9657        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9658    ) -> Result<(), fidl::Error> {
9659        let _result = self.send_raw(result);
9660        if _result.is_err() {
9661            self.control_handle.shutdown();
9662        }
9663        self.drop_without_shutdown();
9664        _result
9665    }
9666
9667    /// Similar to "send" but does not shutdown the channel if an error occurs.
9668    pub fn send_no_shutdown_on_err(
9669        self,
9670        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9671    ) -> Result<(), fidl::Error> {
9672        let _result = self.send_raw(result);
9673        self.drop_without_shutdown();
9674        _result
9675    }
9676
9677    fn send_raw(
9678        &self,
9679        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9680    ) -> Result<(), fidl::Error> {
9681        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
9682            PacketStreamSinkPutPacketResponse,
9683            i32,
9684        >>(
9685            fidl::encoding::FlexibleResult::new(result),
9686            self.tx_id,
9687            0x25a8e35efba81f2b,
9688            fidl::encoding::DynamicFlags::FLEXIBLE,
9689        )
9690    }
9691}
9692
9693#[must_use = "FIDL methods require a response to be sent"]
9694#[derive(Debug)]
9695pub struct PacketStreamSinkFlushPacketsResponder {
9696    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
9697    tx_id: u32,
9698}
9699
9700/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
9701/// if the responder is dropped without sending a response, so that the client
9702/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9703impl std::ops::Drop for PacketStreamSinkFlushPacketsResponder {
9704    fn drop(&mut self) {
9705        self.control_handle.shutdown();
9706        // Safety: drops once, never accessed again
9707        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9708    }
9709}
9710
9711impl fidl::endpoints::Responder for PacketStreamSinkFlushPacketsResponder {
9712    type ControlHandle = PacketStreamSinkControlHandle;
9713
9714    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
9715        &self.control_handle
9716    }
9717
9718    fn drop_without_shutdown(mut self) {
9719        // Safety: drops once, never accessed again due to mem::forget
9720        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9721        // Prevent Drop from running (which would shut down the channel)
9722        std::mem::forget(self);
9723    }
9724}
9725
9726impl PacketStreamSinkFlushPacketsResponder {
9727    /// Sends a response to the FIDL transaction.
9728    ///
9729    /// Sets the channel to shutdown if an error occurs.
9730    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9731        let _result = self.send_raw(result);
9732        if _result.is_err() {
9733            self.control_handle.shutdown();
9734        }
9735        self.drop_without_shutdown();
9736        _result
9737    }
9738
9739    /// Similar to "send" but does not shutdown the channel if an error occurs.
9740    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9741        let _result = self.send_raw(result);
9742        self.drop_without_shutdown();
9743        _result
9744    }
9745
9746    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9747        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
9748            fidl::encoding::EmptyStruct,
9749            i32,
9750        >>(
9751            fidl::encoding::FlexibleResult::new(result),
9752            self.tx_id,
9753            0x13f16ca37ede8a4,
9754            fidl::encoding::DynamicFlags::FLEXIBLE,
9755        )
9756    }
9757}
9758
9759#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9760pub struct RingBufferMarker;
9761
9762impl fidl::endpoints::ProtocolMarker for RingBufferMarker {
9763    type Proxy = RingBufferProxy;
9764    type RequestStream = RingBufferRequestStream;
9765    #[cfg(target_os = "fuchsia")]
9766    type SynchronousProxy = RingBufferSynchronousProxy;
9767
9768    const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
9769}
9770pub type RingBufferGetVmoResult = Result<(u32, fidl::Vmo), GetVmoError>;
9771pub type RingBufferSetActiveChannelsResult = Result<i64, i32>;
9772
9773pub trait RingBufferProxyInterface: Send + Sync {
9774    type GetPropertiesResponseFut: std::future::Future<Output = Result<RingBufferProperties, fidl::Error>>
9775        + Send;
9776    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
9777    type WatchClockRecoveryPositionInfoResponseFut: std::future::Future<Output = Result<RingBufferPositionInfo, fidl::Error>>
9778        + Send;
9779    fn r#watch_clock_recovery_position_info(
9780        &self,
9781    ) -> Self::WatchClockRecoveryPositionInfoResponseFut;
9782    type GetVmoResponseFut: std::future::Future<Output = Result<RingBufferGetVmoResult, fidl::Error>>
9783        + Send;
9784    fn r#get_vmo(
9785        &self,
9786        min_frames: u32,
9787        clock_recovery_notifications_per_ring: u32,
9788    ) -> Self::GetVmoResponseFut;
9789    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
9790    fn r#start(&self) -> Self::StartResponseFut;
9791    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
9792    fn r#stop(&self) -> Self::StopResponseFut;
9793    type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
9794        + Send;
9795    fn r#set_active_channels(
9796        &self,
9797        active_channels_bitmask: u64,
9798    ) -> Self::SetActiveChannelsResponseFut;
9799    type WatchDelayInfoResponseFut: std::future::Future<Output = Result<DelayInfo, fidl::Error>>
9800        + Send;
9801    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
9802}
9803#[derive(Debug)]
9804#[cfg(target_os = "fuchsia")]
9805pub struct RingBufferSynchronousProxy {
9806    client: fidl::client::sync::Client,
9807}
9808
9809#[cfg(target_os = "fuchsia")]
9810impl fidl::endpoints::SynchronousProxy for RingBufferSynchronousProxy {
9811    type Proxy = RingBufferProxy;
9812    type Protocol = RingBufferMarker;
9813
9814    fn from_channel(inner: fidl::Channel) -> Self {
9815        Self::new(inner)
9816    }
9817
9818    fn into_channel(self) -> fidl::Channel {
9819        self.client.into_channel()
9820    }
9821
9822    fn as_channel(&self) -> &fidl::Channel {
9823        self.client.as_channel()
9824    }
9825}
9826
9827#[cfg(target_os = "fuchsia")]
9828impl RingBufferSynchronousProxy {
9829    pub fn new(channel: fidl::Channel) -> Self {
9830        Self { client: fidl::client::sync::Client::new(channel) }
9831    }
9832
9833    pub fn into_channel(self) -> fidl::Channel {
9834        self.client.into_channel()
9835    }
9836
9837    /// Waits until an event arrives and returns it. It is safe for other
9838    /// threads to make concurrent requests while waiting for an event.
9839    pub fn wait_for_event(
9840        &self,
9841        deadline: zx::MonotonicInstant,
9842    ) -> Result<RingBufferEvent, fidl::Error> {
9843        RingBufferEvent::decode(self.client.wait_for_event::<RingBufferMarker>(deadline)?)
9844    }
9845
9846    /// Accessor for top level static properties.
9847    pub fn r#get_properties(
9848        &self,
9849        ___deadline: zx::MonotonicInstant,
9850    ) -> Result<RingBufferProperties, fidl::Error> {
9851        let _response = self.client.send_query::<
9852            fidl::encoding::EmptyPayload,
9853            RingBufferGetPropertiesResponse,
9854            RingBufferMarker,
9855        >(
9856            (),
9857            0x12947f061a8fe1,
9858            fidl::encoding::DynamicFlags::empty(),
9859            ___deadline,
9860        )?;
9861        Ok(_response.properties)
9862    }
9863
9864    /// Gets the ring buffer current position via a hanging get.
9865    ///
9866    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
9867    /// `clock_recovery_notifications_per_ring` was specified.
9868    ///
9869    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
9870    /// not respond to subsequent client calls until the position information has changed from what
9871    /// was most recently provided to that client.
9872    ///
9873    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
9874    /// to the `Start` command.
9875    ///
9876    /// At the `start_time` returned by `Start`, position is always 0. From there, it
9877    /// progresses at the rate specified by the rate, sample format (and clock domain,
9878    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
9879    ///
9880    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
9881    /// estimated position to be used for clock recovery at most at
9882    /// `clock_recovery_notifications_per_ring` frequency.
9883    ///
9884    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
9885    /// increasing.
9886    ///
9887    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
9888    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
9889    pub fn r#watch_clock_recovery_position_info(
9890        &self,
9891        ___deadline: zx::MonotonicInstant,
9892    ) -> Result<RingBufferPositionInfo, fidl::Error> {
9893        let _response = self.client.send_query::<
9894            fidl::encoding::EmptyPayload,
9895            RingBufferWatchClockRecoveryPositionInfoResponse,
9896            RingBufferMarker,
9897        >(
9898            (),
9899            0x694d5b898a4167e5,
9900            fidl::encoding::DynamicFlags::empty(),
9901            ___deadline,
9902        )?;
9903        Ok(_response.position_info)
9904    }
9905
9906    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
9907    ///
9908    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
9909    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
9910    ///
9911    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
9912    /// that ring buffer contents can be transfered in and out, or else the call must be failed
9913    /// with GetVmoError.INVALID_ARGS.
9914    ///
9915    /// The driver may increase the ring buffer size beyond `min_frames` plus
9916    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
9917    /// alignment.
9918    ///
9919    /// Clients can treat the entire returned ring buffer as safe to access, except for the
9920    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
9921    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
9922    ///
9923    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
9924    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
9925    /// handle must also include ZX_RIGHT_WRITE.
9926    ///
9927    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
9928    /// `WatchClockRecoveryPositionInfo` client requests at most at
9929    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
9930    /// for clock recovery.
9931    pub fn r#get_vmo(
9932        &self,
9933        mut min_frames: u32,
9934        mut clock_recovery_notifications_per_ring: u32,
9935        ___deadline: zx::MonotonicInstant,
9936    ) -> Result<RingBufferGetVmoResult, fidl::Error> {
9937        let _response = self.client.send_query::<
9938            RingBufferGetVmoRequest,
9939            fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
9940            RingBufferMarker,
9941        >(
9942            (min_frames, clock_recovery_notifications_per_ring,),
9943            0x44c8f4f5680e853a,
9944            fidl::encoding::DynamicFlags::empty(),
9945            ___deadline,
9946        )?;
9947        Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
9948    }
9949
9950    /// Start the ring buffer.
9951    ///
9952    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
9953    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
9954    /// write from or to the ring buffer position 0, subject to the overall position and buffering
9955    /// behavior described in 'Ring buffer behavior' below.
9956    ///
9957    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
9958    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
9959    /// a second time before the first call has completed, then the channel must be closed with an
9960    /// error `ZX_ERR_BAD_STATE` returned.
9961    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
9962    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
9963        let _response = self
9964            .client
9965            .send_query::<fidl::encoding::EmptyPayload, RingBufferStartResponse, RingBufferMarker>(
9966                (),
9967                0x5dd780a769a8892d,
9968                fidl::encoding::DynamicFlags::empty(),
9969                ___deadline,
9970            )?;
9971        Ok(_response.start_time)
9972    }
9973
9974    /// Stop the ring buffer.
9975    ///
9976    /// Once this call's response is received, no further position notifications will be sent until
9977    /// `Start` is called again.
9978    ///
9979    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
9980    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
9981        let _response = self.client.send_query::<
9982            fidl::encoding::EmptyPayload,
9983            fidl::encoding::EmptyPayload,
9984            RingBufferMarker,
9985        >(
9986            (),
9987            0x49a73d9cf1d4e110,
9988            fidl::encoding::DynamicFlags::empty(),
9989            ___deadline,
9990        )?;
9991        Ok(_response)
9992    }
9993
9994    /// Sets which channels are active via a bitmask.
9995    ///
9996    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
9997    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
9998    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
9999    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
10000    /// turns on the hardware associated for all channels.
10001    ///
10002    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
10003    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
10004    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
10005    ///
10006    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
10007    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
10008    /// buffer's position advances (and position notifications sent as needed) regardless of the
10009    /// number of active channels, including if no channels are active. This means that the format
10010    /// in the ring buffer is not changed.
10011    ///
10012    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
10013    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
10014    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
10015    ///
10016    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
10017    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
10018    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
10019    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
10020    /// hardware configuration was completed. If the requested channel configuration is already
10021    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
10022    /// before the reply is sent. If called again with the same configuration, the reply must
10023    /// include the same `set_time` value as was previously returned.
10024    ///
10025    /// For input channels, it is not required that the driver zero-out inactive channels.
10026    ///
10027    /// If `SetActiveChannels` is called for a second time before the first call has completed,
10028    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10029    pub fn r#set_active_channels(
10030        &self,
10031        mut active_channels_bitmask: u64,
10032        ___deadline: zx::MonotonicInstant,
10033    ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
10034        let _response = self.client.send_query::<
10035            RingBufferSetActiveChannelsRequest,
10036            fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
10037            RingBufferMarker,
10038        >(
10039            (active_channels_bitmask,),
10040            0x605464c1d384f309,
10041            fidl::encoding::DynamicFlags::empty(),
10042            ___deadline,
10043        )?;
10044        Ok(_response.map(|x| x.set_time))
10045    }
10046
10047    /// Get information about delays via a hanging get.
10048    ///
10049    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
10050    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
10051    /// changes from what was most recently reported.
10052    ///
10053    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
10054    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10055    pub fn r#watch_delay_info(
10056        &self,
10057        ___deadline: zx::MonotonicInstant,
10058    ) -> Result<DelayInfo, fidl::Error> {
10059        let _response = self.client.send_query::<
10060            fidl::encoding::EmptyPayload,
10061            fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
10062            RingBufferMarker,
10063        >(
10064            (),
10065            0x6c1248db213fcf9f,
10066            fidl::encoding::DynamicFlags::FLEXIBLE,
10067            ___deadline,
10068        )?
10069        .into_result::<RingBufferMarker>("watch_delay_info")?;
10070        Ok(_response.delay_info)
10071    }
10072}
10073
10074#[cfg(target_os = "fuchsia")]
10075impl From<RingBufferSynchronousProxy> for zx::NullableHandle {
10076    fn from(value: RingBufferSynchronousProxy) -> Self {
10077        value.into_channel().into()
10078    }
10079}
10080
10081#[cfg(target_os = "fuchsia")]
10082impl From<fidl::Channel> for RingBufferSynchronousProxy {
10083    fn from(value: fidl::Channel) -> Self {
10084        Self::new(value)
10085    }
10086}
10087
10088#[cfg(target_os = "fuchsia")]
10089impl fidl::endpoints::FromClient for RingBufferSynchronousProxy {
10090    type Protocol = RingBufferMarker;
10091
10092    fn from_client(value: fidl::endpoints::ClientEnd<RingBufferMarker>) -> Self {
10093        Self::new(value.into_channel())
10094    }
10095}
10096
10097#[derive(Debug, Clone)]
10098pub struct RingBufferProxy {
10099    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10100}
10101
10102impl fidl::endpoints::Proxy for RingBufferProxy {
10103    type Protocol = RingBufferMarker;
10104
10105    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10106        Self::new(inner)
10107    }
10108
10109    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10110        self.client.into_channel().map_err(|client| Self { client })
10111    }
10112
10113    fn as_channel(&self) -> &::fidl::AsyncChannel {
10114        self.client.as_channel()
10115    }
10116}
10117
10118impl RingBufferProxy {
10119    /// Create a new Proxy for fuchsia.hardware.audio/RingBuffer.
10120    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10121        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10122        Self { client: fidl::client::Client::new(channel, protocol_name) }
10123    }
10124
10125    /// Get a Stream of events from the remote end of the protocol.
10126    ///
10127    /// # Panics
10128    ///
10129    /// Panics if the event stream was already taken.
10130    pub fn take_event_stream(&self) -> RingBufferEventStream {
10131        RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
10132    }
10133
10134    /// Accessor for top level static properties.
10135    pub fn r#get_properties(
10136        &self,
10137    ) -> fidl::client::QueryResponseFut<
10138        RingBufferProperties,
10139        fidl::encoding::DefaultFuchsiaResourceDialect,
10140    > {
10141        RingBufferProxyInterface::r#get_properties(self)
10142    }
10143
10144    /// Gets the ring buffer current position via a hanging get.
10145    ///
10146    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
10147    /// `clock_recovery_notifications_per_ring` was specified.
10148    ///
10149    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
10150    /// not respond to subsequent client calls until the position information has changed from what
10151    /// was most recently provided to that client.
10152    ///
10153    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
10154    /// to the `Start` command.
10155    ///
10156    /// At the `start_time` returned by `Start`, position is always 0. From there, it
10157    /// progresses at the rate specified by the rate, sample format (and clock domain,
10158    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
10159    ///
10160    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
10161    /// estimated position to be used for clock recovery at most at
10162    /// `clock_recovery_notifications_per_ring` frequency.
10163    ///
10164    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
10165    /// increasing.
10166    ///
10167    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
10168    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
10169    pub fn r#watch_clock_recovery_position_info(
10170        &self,
10171    ) -> fidl::client::QueryResponseFut<
10172        RingBufferPositionInfo,
10173        fidl::encoding::DefaultFuchsiaResourceDialect,
10174    > {
10175        RingBufferProxyInterface::r#watch_clock_recovery_position_info(self)
10176    }
10177
10178    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
10179    ///
10180    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
10181    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
10182    ///
10183    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
10184    /// that ring buffer contents can be transfered in and out, or else the call must be failed
10185    /// with GetVmoError.INVALID_ARGS.
10186    ///
10187    /// The driver may increase the ring buffer size beyond `min_frames` plus
10188    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
10189    /// alignment.
10190    ///
10191    /// Clients can treat the entire returned ring buffer as safe to access, except for the
10192    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
10193    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
10194    ///
10195    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
10196    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
10197    /// handle must also include ZX_RIGHT_WRITE.
10198    ///
10199    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
10200    /// `WatchClockRecoveryPositionInfo` client requests at most at
10201    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
10202    /// for clock recovery.
10203    pub fn r#get_vmo(
10204        &self,
10205        mut min_frames: u32,
10206        mut clock_recovery_notifications_per_ring: u32,
10207    ) -> fidl::client::QueryResponseFut<
10208        RingBufferGetVmoResult,
10209        fidl::encoding::DefaultFuchsiaResourceDialect,
10210    > {
10211        RingBufferProxyInterface::r#get_vmo(self, min_frames, clock_recovery_notifications_per_ring)
10212    }
10213
10214    /// Start the ring buffer.
10215    ///
10216    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
10217    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
10218    /// write from or to the ring buffer position 0, subject to the overall position and buffering
10219    /// behavior described in 'Ring buffer behavior' below.
10220    ///
10221    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10222    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
10223    /// a second time before the first call has completed, then the channel must be closed with an
10224    /// error `ZX_ERR_BAD_STATE` returned.
10225    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
10226    pub fn r#start(
10227        &self,
10228    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
10229        RingBufferProxyInterface::r#start(self)
10230    }
10231
10232    /// Stop the ring buffer.
10233    ///
10234    /// Once this call's response is received, no further position notifications will be sent until
10235    /// `Start` is called again.
10236    ///
10237    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10238    pub fn r#stop(
10239        &self,
10240    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
10241        RingBufferProxyInterface::r#stop(self)
10242    }
10243
10244    /// Sets which channels are active via a bitmask.
10245    ///
10246    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
10247    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
10248    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
10249    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
10250    /// turns on the hardware associated for all channels.
10251    ///
10252    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
10253    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
10254    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
10255    ///
10256    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
10257    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
10258    /// buffer's position advances (and position notifications sent as needed) regardless of the
10259    /// number of active channels, including if no channels are active. This means that the format
10260    /// in the ring buffer is not changed.
10261    ///
10262    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
10263    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
10264    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
10265    ///
10266    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
10267    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
10268    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
10269    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
10270    /// hardware configuration was completed. If the requested channel configuration is already
10271    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
10272    /// before the reply is sent. If called again with the same configuration, the reply must
10273    /// include the same `set_time` value as was previously returned.
10274    ///
10275    /// For input channels, it is not required that the driver zero-out inactive channels.
10276    ///
10277    /// If `SetActiveChannels` is called for a second time before the first call has completed,
10278    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10279    pub fn r#set_active_channels(
10280        &self,
10281        mut active_channels_bitmask: u64,
10282    ) -> fidl::client::QueryResponseFut<
10283        RingBufferSetActiveChannelsResult,
10284        fidl::encoding::DefaultFuchsiaResourceDialect,
10285    > {
10286        RingBufferProxyInterface::r#set_active_channels(self, active_channels_bitmask)
10287    }
10288
10289    /// Get information about delays via a hanging get.
10290    ///
10291    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
10292    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
10293    /// changes from what was most recently reported.
10294    ///
10295    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
10296    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10297    pub fn r#watch_delay_info(
10298        &self,
10299    ) -> fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
10300    {
10301        RingBufferProxyInterface::r#watch_delay_info(self)
10302    }
10303}
10304
10305impl RingBufferProxyInterface for RingBufferProxy {
10306    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
10307        RingBufferProperties,
10308        fidl::encoding::DefaultFuchsiaResourceDialect,
10309    >;
10310    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
10311        fn _decode(
10312            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10313        ) -> Result<RingBufferProperties, fidl::Error> {
10314            let _response = fidl::client::decode_transaction_body::<
10315                RingBufferGetPropertiesResponse,
10316                fidl::encoding::DefaultFuchsiaResourceDialect,
10317                0x12947f061a8fe1,
10318            >(_buf?)?;
10319            Ok(_response.properties)
10320        }
10321        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferProperties>(
10322            (),
10323            0x12947f061a8fe1,
10324            fidl::encoding::DynamicFlags::empty(),
10325            _decode,
10326        )
10327    }
10328
10329    type WatchClockRecoveryPositionInfoResponseFut = fidl::client::QueryResponseFut<
10330        RingBufferPositionInfo,
10331        fidl::encoding::DefaultFuchsiaResourceDialect,
10332    >;
10333    fn r#watch_clock_recovery_position_info(
10334        &self,
10335    ) -> Self::WatchClockRecoveryPositionInfoResponseFut {
10336        fn _decode(
10337            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10338        ) -> Result<RingBufferPositionInfo, fidl::Error> {
10339            let _response = fidl::client::decode_transaction_body::<
10340                RingBufferWatchClockRecoveryPositionInfoResponse,
10341                fidl::encoding::DefaultFuchsiaResourceDialect,
10342                0x694d5b898a4167e5,
10343            >(_buf?)?;
10344            Ok(_response.position_info)
10345        }
10346        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferPositionInfo>(
10347            (),
10348            0x694d5b898a4167e5,
10349            fidl::encoding::DynamicFlags::empty(),
10350            _decode,
10351        )
10352    }
10353
10354    type GetVmoResponseFut = fidl::client::QueryResponseFut<
10355        RingBufferGetVmoResult,
10356        fidl::encoding::DefaultFuchsiaResourceDialect,
10357    >;
10358    fn r#get_vmo(
10359        &self,
10360        mut min_frames: u32,
10361        mut clock_recovery_notifications_per_ring: u32,
10362    ) -> Self::GetVmoResponseFut {
10363        fn _decode(
10364            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10365        ) -> Result<RingBufferGetVmoResult, fidl::Error> {
10366            let _response = fidl::client::decode_transaction_body::<
10367                fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
10368                fidl::encoding::DefaultFuchsiaResourceDialect,
10369                0x44c8f4f5680e853a,
10370            >(_buf?)?;
10371            Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
10372        }
10373        self.client.send_query_and_decode::<RingBufferGetVmoRequest, RingBufferGetVmoResult>(
10374            (min_frames, clock_recovery_notifications_per_ring),
10375            0x44c8f4f5680e853a,
10376            fidl::encoding::DynamicFlags::empty(),
10377            _decode,
10378        )
10379    }
10380
10381    type StartResponseFut =
10382        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
10383    fn r#start(&self) -> Self::StartResponseFut {
10384        fn _decode(
10385            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10386        ) -> Result<i64, fidl::Error> {
10387            let _response = fidl::client::decode_transaction_body::<
10388                RingBufferStartResponse,
10389                fidl::encoding::DefaultFuchsiaResourceDialect,
10390                0x5dd780a769a8892d,
10391            >(_buf?)?;
10392            Ok(_response.start_time)
10393        }
10394        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
10395            (),
10396            0x5dd780a769a8892d,
10397            fidl::encoding::DynamicFlags::empty(),
10398            _decode,
10399        )
10400    }
10401
10402    type StopResponseFut =
10403        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
10404    fn r#stop(&self) -> Self::StopResponseFut {
10405        fn _decode(
10406            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10407        ) -> Result<(), fidl::Error> {
10408            let _response = fidl::client::decode_transaction_body::<
10409                fidl::encoding::EmptyPayload,
10410                fidl::encoding::DefaultFuchsiaResourceDialect,
10411                0x49a73d9cf1d4e110,
10412            >(_buf?)?;
10413            Ok(_response)
10414        }
10415        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
10416            (),
10417            0x49a73d9cf1d4e110,
10418            fidl::encoding::DynamicFlags::empty(),
10419            _decode,
10420        )
10421    }
10422
10423    type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
10424        RingBufferSetActiveChannelsResult,
10425        fidl::encoding::DefaultFuchsiaResourceDialect,
10426    >;
10427    fn r#set_active_channels(
10428        &self,
10429        mut active_channels_bitmask: u64,
10430    ) -> Self::SetActiveChannelsResponseFut {
10431        fn _decode(
10432            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10433        ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
10434            let _response = fidl::client::decode_transaction_body::<
10435                fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
10436                fidl::encoding::DefaultFuchsiaResourceDialect,
10437                0x605464c1d384f309,
10438            >(_buf?)?;
10439            Ok(_response.map(|x| x.set_time))
10440        }
10441        self.client.send_query_and_decode::<
10442            RingBufferSetActiveChannelsRequest,
10443            RingBufferSetActiveChannelsResult,
10444        >(
10445            (active_channels_bitmask,),
10446            0x605464c1d384f309,
10447            fidl::encoding::DynamicFlags::empty(),
10448            _decode,
10449        )
10450    }
10451
10452    type WatchDelayInfoResponseFut =
10453        fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
10454    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
10455        fn _decode(
10456            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10457        ) -> Result<DelayInfo, fidl::Error> {
10458            let _response = fidl::client::decode_transaction_body::<
10459                fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
10460                fidl::encoding::DefaultFuchsiaResourceDialect,
10461                0x6c1248db213fcf9f,
10462            >(_buf?)?
10463            .into_result::<RingBufferMarker>("watch_delay_info")?;
10464            Ok(_response.delay_info)
10465        }
10466        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelayInfo>(
10467            (),
10468            0x6c1248db213fcf9f,
10469            fidl::encoding::DynamicFlags::FLEXIBLE,
10470            _decode,
10471        )
10472    }
10473}
10474
10475pub struct RingBufferEventStream {
10476    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10477}
10478
10479impl std::marker::Unpin for RingBufferEventStream {}
10480
10481impl futures::stream::FusedStream for RingBufferEventStream {
10482    fn is_terminated(&self) -> bool {
10483        self.event_receiver.is_terminated()
10484    }
10485}
10486
10487impl futures::Stream for RingBufferEventStream {
10488    type Item = Result<RingBufferEvent, fidl::Error>;
10489
10490    fn poll_next(
10491        mut self: std::pin::Pin<&mut Self>,
10492        cx: &mut std::task::Context<'_>,
10493    ) -> std::task::Poll<Option<Self::Item>> {
10494        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10495            &mut self.event_receiver,
10496            cx
10497        )?) {
10498            Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
10499            None => std::task::Poll::Ready(None),
10500        }
10501    }
10502}
10503
10504#[derive(Debug)]
10505pub enum RingBufferEvent {
10506    #[non_exhaustive]
10507    _UnknownEvent {
10508        /// Ordinal of the event that was sent.
10509        ordinal: u64,
10510    },
10511}
10512
10513impl RingBufferEvent {
10514    /// Decodes a message buffer as a [`RingBufferEvent`].
10515    fn decode(
10516        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10517    ) -> Result<RingBufferEvent, fidl::Error> {
10518        let (bytes, _handles) = buf.split_mut();
10519        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10520        debug_assert_eq!(tx_header.tx_id, 0);
10521        match tx_header.ordinal {
10522            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
10523                Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
10524            }
10525            _ => Err(fidl::Error::UnknownOrdinal {
10526                ordinal: tx_header.ordinal,
10527                protocol_name: <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10528            }),
10529        }
10530    }
10531}
10532
10533/// A Stream of incoming requests for fuchsia.hardware.audio/RingBuffer.
10534pub struct RingBufferRequestStream {
10535    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10536    is_terminated: bool,
10537}
10538
10539impl std::marker::Unpin for RingBufferRequestStream {}
10540
10541impl futures::stream::FusedStream for RingBufferRequestStream {
10542    fn is_terminated(&self) -> bool {
10543        self.is_terminated
10544    }
10545}
10546
10547impl fidl::endpoints::RequestStream for RingBufferRequestStream {
10548    type Protocol = RingBufferMarker;
10549    type ControlHandle = RingBufferControlHandle;
10550
10551    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10552        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10553    }
10554
10555    fn control_handle(&self) -> Self::ControlHandle {
10556        RingBufferControlHandle { inner: self.inner.clone() }
10557    }
10558
10559    fn into_inner(
10560        self,
10561    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10562    {
10563        (self.inner, self.is_terminated)
10564    }
10565
10566    fn from_inner(
10567        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10568        is_terminated: bool,
10569    ) -> Self {
10570        Self { inner, is_terminated }
10571    }
10572}
10573
10574impl futures::Stream for RingBufferRequestStream {
10575    type Item = Result<RingBufferRequest, fidl::Error>;
10576
10577    fn poll_next(
10578        mut self: std::pin::Pin<&mut Self>,
10579        cx: &mut std::task::Context<'_>,
10580    ) -> std::task::Poll<Option<Self::Item>> {
10581        let this = &mut *self;
10582        if this.inner.check_shutdown(cx) {
10583            this.is_terminated = true;
10584            return std::task::Poll::Ready(None);
10585        }
10586        if this.is_terminated {
10587            panic!("polled RingBufferRequestStream after completion");
10588        }
10589        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10590            |bytes, handles| {
10591                match this.inner.channel().read_etc(cx, bytes, handles) {
10592                    std::task::Poll::Ready(Ok(())) => {}
10593                    std::task::Poll::Pending => return std::task::Poll::Pending,
10594                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10595                        this.is_terminated = true;
10596                        return std::task::Poll::Ready(None);
10597                    }
10598                    std::task::Poll::Ready(Err(e)) => {
10599                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10600                            e.into(),
10601                        ))));
10602                    }
10603                }
10604
10605                // A message has been received from the channel
10606                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10607
10608                std::task::Poll::Ready(Some(match header.ordinal {
10609                    0x12947f061a8fe1 => {
10610                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10611                        let mut req = fidl::new_empty!(
10612                            fidl::encoding::EmptyPayload,
10613                            fidl::encoding::DefaultFuchsiaResourceDialect
10614                        );
10615                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10616                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10617                        Ok(RingBufferRequest::GetProperties {
10618                            responder: RingBufferGetPropertiesResponder {
10619                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10620                                tx_id: header.tx_id,
10621                            },
10622                        })
10623                    }
10624                    0x694d5b898a4167e5 => {
10625                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10626                        let mut req = fidl::new_empty!(
10627                            fidl::encoding::EmptyPayload,
10628                            fidl::encoding::DefaultFuchsiaResourceDialect
10629                        );
10630                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10631                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10632                        Ok(RingBufferRequest::WatchClockRecoveryPositionInfo {
10633                            responder: RingBufferWatchClockRecoveryPositionInfoResponder {
10634                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10635                                tx_id: header.tx_id,
10636                            },
10637                        })
10638                    }
10639                    0x44c8f4f5680e853a => {
10640                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10641                        let mut req = fidl::new_empty!(
10642                            RingBufferGetVmoRequest,
10643                            fidl::encoding::DefaultFuchsiaResourceDialect
10644                        );
10645                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
10646                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10647                        Ok(RingBufferRequest::GetVmo {
10648                            min_frames: req.min_frames,
10649                            clock_recovery_notifications_per_ring: req
10650                                .clock_recovery_notifications_per_ring,
10651
10652                            responder: RingBufferGetVmoResponder {
10653                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10654                                tx_id: header.tx_id,
10655                            },
10656                        })
10657                    }
10658                    0x5dd780a769a8892d => {
10659                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10660                        let mut req = fidl::new_empty!(
10661                            fidl::encoding::EmptyPayload,
10662                            fidl::encoding::DefaultFuchsiaResourceDialect
10663                        );
10664                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10665                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10666                        Ok(RingBufferRequest::Start {
10667                            responder: RingBufferStartResponder {
10668                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10669                                tx_id: header.tx_id,
10670                            },
10671                        })
10672                    }
10673                    0x49a73d9cf1d4e110 => {
10674                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10675                        let mut req = fidl::new_empty!(
10676                            fidl::encoding::EmptyPayload,
10677                            fidl::encoding::DefaultFuchsiaResourceDialect
10678                        );
10679                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10680                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10681                        Ok(RingBufferRequest::Stop {
10682                            responder: RingBufferStopResponder {
10683                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10684                                tx_id: header.tx_id,
10685                            },
10686                        })
10687                    }
10688                    0x605464c1d384f309 => {
10689                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10690                        let mut req = fidl::new_empty!(
10691                            RingBufferSetActiveChannelsRequest,
10692                            fidl::encoding::DefaultFuchsiaResourceDialect
10693                        );
10694                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
10695                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10696                        Ok(RingBufferRequest::SetActiveChannels {
10697                            active_channels_bitmask: req.active_channels_bitmask,
10698
10699                            responder: RingBufferSetActiveChannelsResponder {
10700                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10701                                tx_id: header.tx_id,
10702                            },
10703                        })
10704                    }
10705                    0x6c1248db213fcf9f => {
10706                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10707                        let mut req = fidl::new_empty!(
10708                            fidl::encoding::EmptyPayload,
10709                            fidl::encoding::DefaultFuchsiaResourceDialect
10710                        );
10711                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10712                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10713                        Ok(RingBufferRequest::WatchDelayInfo {
10714                            responder: RingBufferWatchDelayInfoResponder {
10715                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10716                                tx_id: header.tx_id,
10717                            },
10718                        })
10719                    }
10720                    _ if header.tx_id == 0
10721                        && header
10722                            .dynamic_flags()
10723                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
10724                    {
10725                        Ok(RingBufferRequest::_UnknownMethod {
10726                            ordinal: header.ordinal,
10727                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
10728                            method_type: fidl::MethodType::OneWay,
10729                        })
10730                    }
10731                    _ if header
10732                        .dynamic_flags()
10733                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
10734                    {
10735                        this.inner.send_framework_err(
10736                            fidl::encoding::FrameworkErr::UnknownMethod,
10737                            header.tx_id,
10738                            header.ordinal,
10739                            header.dynamic_flags(),
10740                            (bytes, handles),
10741                        )?;
10742                        Ok(RingBufferRequest::_UnknownMethod {
10743                            ordinal: header.ordinal,
10744                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
10745                            method_type: fidl::MethodType::TwoWay,
10746                        })
10747                    }
10748                    _ => Err(fidl::Error::UnknownOrdinal {
10749                        ordinal: header.ordinal,
10750                        protocol_name:
10751                            <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10752                    }),
10753                }))
10754            },
10755        )
10756    }
10757}
10758
10759/// Ring buffers are used to convey audio between parties (usually in different processes), allowing
10760/// concurrent, asynchronous data access without requiring locks. This pattern works because both
10761/// parties share an understanding of which buffer areas are safe to access, and how those areas
10762/// change over time.
10763///
10764/// For in-depth description of the responsibilities for both _producers_ and _consumers_,
10765/// before the ring buffer is started as well as while it is active, please see
10766/// [Ring Buffer Behavior](https://fuchsia.dev/fuchsia-src/development/audio/ring_buffer.md).
10767#[derive(Debug)]
10768pub enum RingBufferRequest {
10769    /// Accessor for top level static properties.
10770    GetProperties { responder: RingBufferGetPropertiesResponder },
10771    /// Gets the ring buffer current position via a hanging get.
10772    ///
10773    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
10774    /// `clock_recovery_notifications_per_ring` was specified.
10775    ///
10776    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
10777    /// not respond to subsequent client calls until the position information has changed from what
10778    /// was most recently provided to that client.
10779    ///
10780    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
10781    /// to the `Start` command.
10782    ///
10783    /// At the `start_time` returned by `Start`, position is always 0. From there, it
10784    /// progresses at the rate specified by the rate, sample format (and clock domain,
10785    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
10786    ///
10787    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
10788    /// estimated position to be used for clock recovery at most at
10789    /// `clock_recovery_notifications_per_ring` frequency.
10790    ///
10791    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
10792    /// increasing.
10793    ///
10794    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
10795    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
10796    WatchClockRecoveryPositionInfo { responder: RingBufferWatchClockRecoveryPositionInfoResponder },
10797    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
10798    ///
10799    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
10800    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
10801    ///
10802    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
10803    /// that ring buffer contents can be transfered in and out, or else the call must be failed
10804    /// with GetVmoError.INVALID_ARGS.
10805    ///
10806    /// The driver may increase the ring buffer size beyond `min_frames` plus
10807    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
10808    /// alignment.
10809    ///
10810    /// Clients can treat the entire returned ring buffer as safe to access, except for the
10811    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
10812    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
10813    ///
10814    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
10815    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
10816    /// handle must also include ZX_RIGHT_WRITE.
10817    ///
10818    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
10819    /// `WatchClockRecoveryPositionInfo` client requests at most at
10820    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
10821    /// for clock recovery.
10822    GetVmo {
10823        min_frames: u32,
10824        clock_recovery_notifications_per_ring: u32,
10825        responder: RingBufferGetVmoResponder,
10826    },
10827    /// Start the ring buffer.
10828    ///
10829    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
10830    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
10831    /// write from or to the ring buffer position 0, subject to the overall position and buffering
10832    /// behavior described in 'Ring buffer behavior' below.
10833    ///
10834    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10835    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
10836    /// a second time before the first call has completed, then the channel must be closed with an
10837    /// error `ZX_ERR_BAD_STATE` returned.
10838    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
10839    Start { responder: RingBufferStartResponder },
10840    /// Stop the ring buffer.
10841    ///
10842    /// Once this call's response is received, no further position notifications will be sent until
10843    /// `Start` is called again.
10844    ///
10845    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10846    Stop { responder: RingBufferStopResponder },
10847    /// Sets which channels are active via a bitmask.
10848    ///
10849    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
10850    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
10851    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
10852    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
10853    /// turns on the hardware associated for all channels.
10854    ///
10855    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
10856    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
10857    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
10858    ///
10859    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
10860    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
10861    /// buffer's position advances (and position notifications sent as needed) regardless of the
10862    /// number of active channels, including if no channels are active. This means that the format
10863    /// in the ring buffer is not changed.
10864    ///
10865    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
10866    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
10867    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
10868    ///
10869    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
10870    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
10871    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
10872    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
10873    /// hardware configuration was completed. If the requested channel configuration is already
10874    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
10875    /// before the reply is sent. If called again with the same configuration, the reply must
10876    /// include the same `set_time` value as was previously returned.
10877    ///
10878    /// For input channels, it is not required that the driver zero-out inactive channels.
10879    ///
10880    /// If `SetActiveChannels` is called for a second time before the first call has completed,
10881    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10882    SetActiveChannels {
10883        active_channels_bitmask: u64,
10884        responder: RingBufferSetActiveChannelsResponder,
10885    },
10886    /// Get information about delays via a hanging get.
10887    ///
10888    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
10889    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
10890    /// changes from what was most recently reported.
10891    ///
10892    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
10893    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10894    WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
10895    /// An interaction was received which does not match any known method.
10896    #[non_exhaustive]
10897    _UnknownMethod {
10898        /// Ordinal of the method that was called.
10899        ordinal: u64,
10900        control_handle: RingBufferControlHandle,
10901        method_type: fidl::MethodType,
10902    },
10903}
10904
10905impl RingBufferRequest {
10906    #[allow(irrefutable_let_patterns)]
10907    pub fn into_get_properties(self) -> Option<(RingBufferGetPropertiesResponder)> {
10908        if let RingBufferRequest::GetProperties { responder } = self {
10909            Some((responder))
10910        } else {
10911            None
10912        }
10913    }
10914
10915    #[allow(irrefutable_let_patterns)]
10916    pub fn into_watch_clock_recovery_position_info(
10917        self,
10918    ) -> Option<(RingBufferWatchClockRecoveryPositionInfoResponder)> {
10919        if let RingBufferRequest::WatchClockRecoveryPositionInfo { responder } = self {
10920            Some((responder))
10921        } else {
10922            None
10923        }
10924    }
10925
10926    #[allow(irrefutable_let_patterns)]
10927    pub fn into_get_vmo(self) -> Option<(u32, u32, RingBufferGetVmoResponder)> {
10928        if let RingBufferRequest::GetVmo {
10929            min_frames,
10930            clock_recovery_notifications_per_ring,
10931            responder,
10932        } = self
10933        {
10934            Some((min_frames, clock_recovery_notifications_per_ring, responder))
10935        } else {
10936            None
10937        }
10938    }
10939
10940    #[allow(irrefutable_let_patterns)]
10941    pub fn into_start(self) -> Option<(RingBufferStartResponder)> {
10942        if let RingBufferRequest::Start { responder } = self { Some((responder)) } else { None }
10943    }
10944
10945    #[allow(irrefutable_let_patterns)]
10946    pub fn into_stop(self) -> Option<(RingBufferStopResponder)> {
10947        if let RingBufferRequest::Stop { responder } = self { Some((responder)) } else { None }
10948    }
10949
10950    #[allow(irrefutable_let_patterns)]
10951    pub fn into_set_active_channels(self) -> Option<(u64, RingBufferSetActiveChannelsResponder)> {
10952        if let RingBufferRequest::SetActiveChannels { active_channels_bitmask, responder } = self {
10953            Some((active_channels_bitmask, responder))
10954        } else {
10955            None
10956        }
10957    }
10958
10959    #[allow(irrefutable_let_patterns)]
10960    pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
10961        if let RingBufferRequest::WatchDelayInfo { responder } = self {
10962            Some((responder))
10963        } else {
10964            None
10965        }
10966    }
10967
10968    /// Name of the method defined in FIDL
10969    pub fn method_name(&self) -> &'static str {
10970        match *self {
10971            RingBufferRequest::GetProperties { .. } => "get_properties",
10972            RingBufferRequest::WatchClockRecoveryPositionInfo { .. } => {
10973                "watch_clock_recovery_position_info"
10974            }
10975            RingBufferRequest::GetVmo { .. } => "get_vmo",
10976            RingBufferRequest::Start { .. } => "start",
10977            RingBufferRequest::Stop { .. } => "stop",
10978            RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
10979            RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
10980            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
10981                "unknown one-way method"
10982            }
10983            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
10984                "unknown two-way method"
10985            }
10986        }
10987    }
10988}
10989
10990#[derive(Debug, Clone)]
10991pub struct RingBufferControlHandle {
10992    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10993}
10994
10995impl RingBufferControlHandle {
10996    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
10997        self.inner.shutdown_with_epitaph(status.into())
10998    }
10999}
11000
11001impl fidl::endpoints::ControlHandle for RingBufferControlHandle {
11002    fn shutdown(&self) {
11003        self.inner.shutdown()
11004    }
11005
11006    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
11007        self.inner.shutdown_with_epitaph(status)
11008    }
11009
11010    fn is_closed(&self) -> bool {
11011        self.inner.channel().is_closed()
11012    }
11013    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11014        self.inner.channel().on_closed()
11015    }
11016
11017    #[cfg(target_os = "fuchsia")]
11018    fn signal_peer(
11019        &self,
11020        clear_mask: zx::Signals,
11021        set_mask: zx::Signals,
11022    ) -> Result<(), zx_status::Status> {
11023        use fidl::Peered;
11024        self.inner.channel().signal_peer(clear_mask, set_mask)
11025    }
11026}
11027
11028impl RingBufferControlHandle {}
11029
11030#[must_use = "FIDL methods require a response to be sent"]
11031#[derive(Debug)]
11032pub struct RingBufferGetPropertiesResponder {
11033    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11034    tx_id: u32,
11035}
11036
11037/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11038/// if the responder is dropped without sending a response, so that the client
11039/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11040impl std::ops::Drop for RingBufferGetPropertiesResponder {
11041    fn drop(&mut self) {
11042        self.control_handle.shutdown();
11043        // Safety: drops once, never accessed again
11044        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11045    }
11046}
11047
11048impl fidl::endpoints::Responder for RingBufferGetPropertiesResponder {
11049    type ControlHandle = RingBufferControlHandle;
11050
11051    fn control_handle(&self) -> &RingBufferControlHandle {
11052        &self.control_handle
11053    }
11054
11055    fn drop_without_shutdown(mut self) {
11056        // Safety: drops once, never accessed again due to mem::forget
11057        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11058        // Prevent Drop from running (which would shut down the channel)
11059        std::mem::forget(self);
11060    }
11061}
11062
11063impl RingBufferGetPropertiesResponder {
11064    /// Sends a response to the FIDL transaction.
11065    ///
11066    /// Sets the channel to shutdown if an error occurs.
11067    pub fn send(self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
11068        let _result = self.send_raw(properties);
11069        if _result.is_err() {
11070            self.control_handle.shutdown();
11071        }
11072        self.drop_without_shutdown();
11073        _result
11074    }
11075
11076    /// Similar to "send" but does not shutdown the channel if an error occurs.
11077    pub fn send_no_shutdown_on_err(
11078        self,
11079        mut properties: &RingBufferProperties,
11080    ) -> Result<(), fidl::Error> {
11081        let _result = self.send_raw(properties);
11082        self.drop_without_shutdown();
11083        _result
11084    }
11085
11086    fn send_raw(&self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
11087        self.control_handle.inner.send::<RingBufferGetPropertiesResponse>(
11088            (properties,),
11089            self.tx_id,
11090            0x12947f061a8fe1,
11091            fidl::encoding::DynamicFlags::empty(),
11092        )
11093    }
11094}
11095
11096#[must_use = "FIDL methods require a response to be sent"]
11097#[derive(Debug)]
11098pub struct RingBufferWatchClockRecoveryPositionInfoResponder {
11099    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11100    tx_id: u32,
11101}
11102
11103/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11104/// if the responder is dropped without sending a response, so that the client
11105/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11106impl std::ops::Drop for RingBufferWatchClockRecoveryPositionInfoResponder {
11107    fn drop(&mut self) {
11108        self.control_handle.shutdown();
11109        // Safety: drops once, never accessed again
11110        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11111    }
11112}
11113
11114impl fidl::endpoints::Responder for RingBufferWatchClockRecoveryPositionInfoResponder {
11115    type ControlHandle = RingBufferControlHandle;
11116
11117    fn control_handle(&self) -> &RingBufferControlHandle {
11118        &self.control_handle
11119    }
11120
11121    fn drop_without_shutdown(mut self) {
11122        // Safety: drops once, never accessed again due to mem::forget
11123        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11124        // Prevent Drop from running (which would shut down the channel)
11125        std::mem::forget(self);
11126    }
11127}
11128
11129impl RingBufferWatchClockRecoveryPositionInfoResponder {
11130    /// Sends a response to the FIDL transaction.
11131    ///
11132    /// Sets the channel to shutdown if an error occurs.
11133    pub fn send(self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
11134        let _result = self.send_raw(position_info);
11135        if _result.is_err() {
11136            self.control_handle.shutdown();
11137        }
11138        self.drop_without_shutdown();
11139        _result
11140    }
11141
11142    /// Similar to "send" but does not shutdown the channel if an error occurs.
11143    pub fn send_no_shutdown_on_err(
11144        self,
11145        mut position_info: &RingBufferPositionInfo,
11146    ) -> Result<(), fidl::Error> {
11147        let _result = self.send_raw(position_info);
11148        self.drop_without_shutdown();
11149        _result
11150    }
11151
11152    fn send_raw(&self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
11153        self.control_handle.inner.send::<RingBufferWatchClockRecoveryPositionInfoResponse>(
11154            (position_info,),
11155            self.tx_id,
11156            0x694d5b898a4167e5,
11157            fidl::encoding::DynamicFlags::empty(),
11158        )
11159    }
11160}
11161
11162#[must_use = "FIDL methods require a response to be sent"]
11163#[derive(Debug)]
11164pub struct RingBufferGetVmoResponder {
11165    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11166    tx_id: u32,
11167}
11168
11169/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11170/// if the responder is dropped without sending a response, so that the client
11171/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11172impl std::ops::Drop for RingBufferGetVmoResponder {
11173    fn drop(&mut self) {
11174        self.control_handle.shutdown();
11175        // Safety: drops once, never accessed again
11176        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11177    }
11178}
11179
11180impl fidl::endpoints::Responder for RingBufferGetVmoResponder {
11181    type ControlHandle = RingBufferControlHandle;
11182
11183    fn control_handle(&self) -> &RingBufferControlHandle {
11184        &self.control_handle
11185    }
11186
11187    fn drop_without_shutdown(mut self) {
11188        // Safety: drops once, never accessed again due to mem::forget
11189        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11190        // Prevent Drop from running (which would shut down the channel)
11191        std::mem::forget(self);
11192    }
11193}
11194
11195impl RingBufferGetVmoResponder {
11196    /// Sends a response to the FIDL transaction.
11197    ///
11198    /// Sets the channel to shutdown if an error occurs.
11199    pub fn send(
11200        self,
11201        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11202    ) -> Result<(), fidl::Error> {
11203        let _result = self.send_raw(result);
11204        if _result.is_err() {
11205            self.control_handle.shutdown();
11206        }
11207        self.drop_without_shutdown();
11208        _result
11209    }
11210
11211    /// Similar to "send" but does not shutdown the channel if an error occurs.
11212    pub fn send_no_shutdown_on_err(
11213        self,
11214        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11215    ) -> Result<(), fidl::Error> {
11216        let _result = self.send_raw(result);
11217        self.drop_without_shutdown();
11218        _result
11219    }
11220
11221    fn send_raw(
11222        &self,
11223        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11224    ) -> Result<(), fidl::Error> {
11225        self.control_handle
11226            .inner
11227            .send::<fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>>(
11228                result,
11229                self.tx_id,
11230                0x44c8f4f5680e853a,
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 RingBufferStartResponder {
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 RingBufferStartResponder {
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 RingBufferStartResponder {
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 RingBufferStartResponder {
11270    /// Sends a response to the FIDL transaction.
11271    ///
11272    /// Sets the channel to shutdown if an error occurs.
11273    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
11274        let _result = self.send_raw(start_time);
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, mut start_time: i64) -> Result<(), fidl::Error> {
11284        let _result = self.send_raw(start_time);
11285        self.drop_without_shutdown();
11286        _result
11287    }
11288
11289    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
11290        self.control_handle.inner.send::<RingBufferStartResponse>(
11291            (start_time,),
11292            self.tx_id,
11293            0x5dd780a769a8892d,
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 RingBufferStopResponder {
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 RingBufferStopResponder {
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 RingBufferStopResponder {
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 RingBufferStopResponder {
11333    /// Sends a response to the FIDL transaction.
11334    ///
11335    /// Sets the channel to shutdown if an error occurs.
11336    pub fn send(self) -> Result<(), fidl::Error> {
11337        let _result = self.send_raw();
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) -> Result<(), fidl::Error> {
11347        let _result = self.send_raw();
11348        self.drop_without_shutdown();
11349        _result
11350    }
11351
11352    fn send_raw(&self) -> Result<(), fidl::Error> {
11353        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11354            (),
11355            self.tx_id,
11356            0x49a73d9cf1d4e110,
11357            fidl::encoding::DynamicFlags::empty(),
11358        )
11359    }
11360}
11361
11362#[must_use = "FIDL methods require a response to be sent"]
11363#[derive(Debug)]
11364pub struct RingBufferSetActiveChannelsResponder {
11365    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11366    tx_id: u32,
11367}
11368
11369/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11370/// if the responder is dropped without sending a response, so that the client
11371/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11372impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
11373    fn drop(&mut self) {
11374        self.control_handle.shutdown();
11375        // Safety: drops once, never accessed again
11376        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11377    }
11378}
11379
11380impl fidl::endpoints::Responder for RingBufferSetActiveChannelsResponder {
11381    type ControlHandle = RingBufferControlHandle;
11382
11383    fn control_handle(&self) -> &RingBufferControlHandle {
11384        &self.control_handle
11385    }
11386
11387    fn drop_without_shutdown(mut self) {
11388        // Safety: drops once, never accessed again due to mem::forget
11389        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11390        // Prevent Drop from running (which would shut down the channel)
11391        std::mem::forget(self);
11392    }
11393}
11394
11395impl RingBufferSetActiveChannelsResponder {
11396    /// Sends a response to the FIDL transaction.
11397    ///
11398    /// Sets the channel to shutdown if an error occurs.
11399    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11400        let _result = self.send_raw(result);
11401        if _result.is_err() {
11402            self.control_handle.shutdown();
11403        }
11404        self.drop_without_shutdown();
11405        _result
11406    }
11407
11408    /// Similar to "send" but does not shutdown the channel if an error occurs.
11409    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11410        let _result = self.send_raw(result);
11411        self.drop_without_shutdown();
11412        _result
11413    }
11414
11415    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11416        self.control_handle.inner.send::<fidl::encoding::ResultType<
11417            RingBufferSetActiveChannelsResponse,
11418            i32,
11419        >>(
11420            result.map(|set_time| (set_time,)),
11421            self.tx_id,
11422            0x605464c1d384f309,
11423            fidl::encoding::DynamicFlags::empty(),
11424        )
11425    }
11426}
11427
11428#[must_use = "FIDL methods require a response to be sent"]
11429#[derive(Debug)]
11430pub struct RingBufferWatchDelayInfoResponder {
11431    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11432    tx_id: u32,
11433}
11434
11435/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11436/// if the responder is dropped without sending a response, so that the client
11437/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11438impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
11439    fn drop(&mut self) {
11440        self.control_handle.shutdown();
11441        // Safety: drops once, never accessed again
11442        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11443    }
11444}
11445
11446impl fidl::endpoints::Responder for RingBufferWatchDelayInfoResponder {
11447    type ControlHandle = RingBufferControlHandle;
11448
11449    fn control_handle(&self) -> &RingBufferControlHandle {
11450        &self.control_handle
11451    }
11452
11453    fn drop_without_shutdown(mut self) {
11454        // Safety: drops once, never accessed again due to mem::forget
11455        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11456        // Prevent Drop from running (which would shut down the channel)
11457        std::mem::forget(self);
11458    }
11459}
11460
11461impl RingBufferWatchDelayInfoResponder {
11462    /// Sends a response to the FIDL transaction.
11463    ///
11464    /// Sets the channel to shutdown if an error occurs.
11465    pub fn send(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11466        let _result = self.send_raw(delay_info);
11467        if _result.is_err() {
11468            self.control_handle.shutdown();
11469        }
11470        self.drop_without_shutdown();
11471        _result
11472    }
11473
11474    /// Similar to "send" but does not shutdown the channel if an error occurs.
11475    pub fn send_no_shutdown_on_err(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11476        let _result = self.send_raw(delay_info);
11477        self.drop_without_shutdown();
11478        _result
11479    }
11480
11481    fn send_raw(&self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11482        self.control_handle
11483            .inner
11484            .send::<fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>>(
11485                fidl::encoding::Flexible::new((delay_info,)),
11486                self.tx_id,
11487                0x6c1248db213fcf9f,
11488                fidl::encoding::DynamicFlags::FLEXIBLE,
11489            )
11490    }
11491}
11492
11493#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11494pub struct StreamConfigMarker;
11495
11496impl fidl::endpoints::ProtocolMarker for StreamConfigMarker {
11497    type Proxy = StreamConfigProxy;
11498    type RequestStream = StreamConfigRequestStream;
11499    #[cfg(target_os = "fuchsia")]
11500    type SynchronousProxy = StreamConfigSynchronousProxy;
11501
11502    const DEBUG_NAME: &'static str = "(anonymous) StreamConfig";
11503}
11504
11505pub trait StreamConfigProxyInterface: Send + Sync {
11506    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
11507        + Send;
11508    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
11509    fn r#signal_processing_connect(
11510        &self,
11511        protocol: fidl::endpoints::ServerEnd<
11512            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11513        >,
11514    ) -> Result<(), fidl::Error>;
11515    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
11516        + Send;
11517    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
11518    type GetSupportedFormatsResponseFut: std::future::Future<Output = Result<Vec<SupportedFormats>, fidl::Error>>
11519        + Send;
11520    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut;
11521    fn r#create_ring_buffer(
11522        &self,
11523        format: &Format,
11524        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11525    ) -> Result<(), fidl::Error>;
11526    type WatchGainStateResponseFut: std::future::Future<Output = Result<GainState, fidl::Error>>
11527        + Send;
11528    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut;
11529    fn r#set_gain(&self, target_state: &GainState) -> Result<(), fidl::Error>;
11530    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
11531        + Send;
11532    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
11533}
11534#[derive(Debug)]
11535#[cfg(target_os = "fuchsia")]
11536pub struct StreamConfigSynchronousProxy {
11537    client: fidl::client::sync::Client,
11538}
11539
11540#[cfg(target_os = "fuchsia")]
11541impl fidl::endpoints::SynchronousProxy for StreamConfigSynchronousProxy {
11542    type Proxy = StreamConfigProxy;
11543    type Protocol = StreamConfigMarker;
11544
11545    fn from_channel(inner: fidl::Channel) -> Self {
11546        Self::new(inner)
11547    }
11548
11549    fn into_channel(self) -> fidl::Channel {
11550        self.client.into_channel()
11551    }
11552
11553    fn as_channel(&self) -> &fidl::Channel {
11554        self.client.as_channel()
11555    }
11556}
11557
11558#[cfg(target_os = "fuchsia")]
11559impl StreamConfigSynchronousProxy {
11560    pub fn new(channel: fidl::Channel) -> Self {
11561        Self { client: fidl::client::sync::Client::new(channel) }
11562    }
11563
11564    pub fn into_channel(self) -> fidl::Channel {
11565        self.client.into_channel()
11566    }
11567
11568    /// Waits until an event arrives and returns it. It is safe for other
11569    /// threads to make concurrent requests while waiting for an event.
11570    pub fn wait_for_event(
11571        &self,
11572        deadline: zx::MonotonicInstant,
11573    ) -> Result<StreamConfigEvent, fidl::Error> {
11574        StreamConfigEvent::decode(self.client.wait_for_event::<StreamConfigMarker>(deadline)?)
11575    }
11576
11577    /// Retrieves top level health state.
11578    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
11579    pub fn r#get_health_state(
11580        &self,
11581        ___deadline: zx::MonotonicInstant,
11582    ) -> Result<HealthState, fidl::Error> {
11583        let _response = self.client.send_query::<
11584            fidl::encoding::EmptyPayload,
11585            HealthGetHealthStateResponse,
11586            StreamConfigMarker,
11587        >(
11588            (),
11589            0x4e146d6bca733a84,
11590            fidl::encoding::DynamicFlags::empty(),
11591            ___deadline,
11592        )?;
11593        Ok(_response.state)
11594    }
11595
11596    /// Connect to a `SignalProcessing` protocol.
11597    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
11598    /// the maximum number of connections have already been created, for instance one, then the
11599    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
11600    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
11601    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
11602    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
11603    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
11604    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
11605    /// is intended to be composed, and hence the more verbose name allows differentiation and
11606    /// improved clarity.
11607    pub fn r#signal_processing_connect(
11608        &self,
11609        mut protocol: fidl::endpoints::ServerEnd<
11610            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11611        >,
11612    ) -> Result<(), fidl::Error> {
11613        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
11614            (protocol,),
11615            0xa81907ce6066295,
11616            fidl::encoding::DynamicFlags::empty(),
11617        )
11618    }
11619
11620    /// Retrieves top level static properties.
11621    pub fn r#get_properties(
11622        &self,
11623        ___deadline: zx::MonotonicInstant,
11624    ) -> Result<StreamProperties, fidl::Error> {
11625        let _response = self.client.send_query::<
11626            fidl::encoding::EmptyPayload,
11627            StreamConfigGetPropertiesResponse,
11628            StreamConfigMarker,
11629        >(
11630            (),
11631            0x7d89c02f3e2d3c01,
11632            fidl::encoding::DynamicFlags::empty(),
11633            ___deadline,
11634        )?;
11635        Ok(_response.properties)
11636    }
11637
11638    /// Gets formats supported by a given driver. When not all combinations supported by the
11639    /// driver can be described with one `SupportedFormats`, the driver returns more than one
11640    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
11641    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
11642    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
11643    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
11644    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
11645    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
11646    /// <<16bits,32bits>,<48KHz,96KHz>>.
11647    pub fn r#get_supported_formats(
11648        &self,
11649        ___deadline: zx::MonotonicInstant,
11650    ) -> Result<Vec<SupportedFormats>, fidl::Error> {
11651        let _response = self.client.send_query::<
11652            fidl::encoding::EmptyPayload,
11653            StreamConfigGetSupportedFormatsResponse,
11654            StreamConfigMarker,
11655        >(
11656            (),
11657            0x448efa7850cafe7e,
11658            fidl::encoding::DynamicFlags::empty(),
11659            ___deadline,
11660        )?;
11661        Ok(_response.supported_formats)
11662    }
11663
11664    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
11665    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
11666    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
11667    /// ring buffer channel had been established and was still active, the driver must close that
11668    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
11669    /// operations in the process.
11670    pub fn r#create_ring_buffer(
11671        &self,
11672        mut format: &Format,
11673        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11674    ) -> Result<(), fidl::Error> {
11675        self.client.send::<StreamConfigCreateRingBufferRequest>(
11676            (format, ring_buffer),
11677            0x2afb19dd13faa1ba,
11678            fidl::encoding::DynamicFlags::empty(),
11679        )
11680    }
11681
11682    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
11683    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
11684    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
11685    /// from what was most recently reported.
11686    /// If `WatchGainState` is called for a second time before the first call has completed, then
11687    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11688    pub fn r#watch_gain_state(
11689        &self,
11690        ___deadline: zx::MonotonicInstant,
11691    ) -> Result<GainState, fidl::Error> {
11692        let _response = self.client.send_query::<
11693            fidl::encoding::EmptyPayload,
11694            StreamConfigWatchGainStateResponse,
11695            StreamConfigMarker,
11696        >(
11697            (),
11698            0x4772506136ab65c1,
11699            fidl::encoding::DynamicFlags::empty(),
11700            ___deadline,
11701        )?;
11702        Ok(_response.gain_state)
11703    }
11704
11705    /// Client update of the gain state.
11706    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
11707        self.client.send::<StreamConfigSetGainRequest>(
11708            (target_state,),
11709            0x3943b41498c6a384,
11710            fidl::encoding::DynamicFlags::empty(),
11711        )
11712    }
11713
11714    /// Get the plug detect state via a hanging get. The driver will reply to the first
11715    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
11716    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
11717    /// If `WatchPlugState` is called for a second time before the first call has completed, then
11718    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11719    pub fn r#watch_plug_state(
11720        &self,
11721        ___deadline: zx::MonotonicInstant,
11722    ) -> Result<PlugState, fidl::Error> {
11723        let _response = self.client.send_query::<
11724            fidl::encoding::EmptyPayload,
11725            StreamConfigWatchPlugStateResponse,
11726            StreamConfigMarker,
11727        >(
11728            (),
11729            0x497345a6f048b2a6,
11730            fidl::encoding::DynamicFlags::empty(),
11731            ___deadline,
11732        )?;
11733        Ok(_response.plug_state)
11734    }
11735}
11736
11737#[cfg(target_os = "fuchsia")]
11738impl From<StreamConfigSynchronousProxy> for zx::NullableHandle {
11739    fn from(value: StreamConfigSynchronousProxy) -> Self {
11740        value.into_channel().into()
11741    }
11742}
11743
11744#[cfg(target_os = "fuchsia")]
11745impl From<fidl::Channel> for StreamConfigSynchronousProxy {
11746    fn from(value: fidl::Channel) -> Self {
11747        Self::new(value)
11748    }
11749}
11750
11751#[cfg(target_os = "fuchsia")]
11752impl fidl::endpoints::FromClient for StreamConfigSynchronousProxy {
11753    type Protocol = StreamConfigMarker;
11754
11755    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigMarker>) -> Self {
11756        Self::new(value.into_channel())
11757    }
11758}
11759
11760#[derive(Debug, Clone)]
11761pub struct StreamConfigProxy {
11762    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11763}
11764
11765impl fidl::endpoints::Proxy for StreamConfigProxy {
11766    type Protocol = StreamConfigMarker;
11767
11768    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11769        Self::new(inner)
11770    }
11771
11772    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11773        self.client.into_channel().map_err(|client| Self { client })
11774    }
11775
11776    fn as_channel(&self) -> &::fidl::AsyncChannel {
11777        self.client.as_channel()
11778    }
11779}
11780
11781impl StreamConfigProxy {
11782    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfig.
11783    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11784        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11785        Self { client: fidl::client::Client::new(channel, protocol_name) }
11786    }
11787
11788    /// Get a Stream of events from the remote end of the protocol.
11789    ///
11790    /// # Panics
11791    ///
11792    /// Panics if the event stream was already taken.
11793    pub fn take_event_stream(&self) -> StreamConfigEventStream {
11794        StreamConfigEventStream { event_receiver: self.client.take_event_receiver() }
11795    }
11796
11797    /// Retrieves top level health state.
11798    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
11799    pub fn r#get_health_state(
11800        &self,
11801    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
11802    {
11803        StreamConfigProxyInterface::r#get_health_state(self)
11804    }
11805
11806    /// Connect to a `SignalProcessing` protocol.
11807    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
11808    /// the maximum number of connections have already been created, for instance one, then the
11809    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
11810    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
11811    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
11812    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
11813    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
11814    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
11815    /// is intended to be composed, and hence the more verbose name allows differentiation and
11816    /// improved clarity.
11817    pub fn r#signal_processing_connect(
11818        &self,
11819        mut protocol: fidl::endpoints::ServerEnd<
11820            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11821        >,
11822    ) -> Result<(), fidl::Error> {
11823        StreamConfigProxyInterface::r#signal_processing_connect(self, protocol)
11824    }
11825
11826    /// Retrieves top level static properties.
11827    pub fn r#get_properties(
11828        &self,
11829    ) -> fidl::client::QueryResponseFut<
11830        StreamProperties,
11831        fidl::encoding::DefaultFuchsiaResourceDialect,
11832    > {
11833        StreamConfigProxyInterface::r#get_properties(self)
11834    }
11835
11836    /// Gets formats supported by a given driver. When not all combinations supported by the
11837    /// driver can be described with one `SupportedFormats`, the driver returns more than one
11838    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
11839    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
11840    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
11841    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
11842    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
11843    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
11844    /// <<16bits,32bits>,<48KHz,96KHz>>.
11845    pub fn r#get_supported_formats(
11846        &self,
11847    ) -> fidl::client::QueryResponseFut<
11848        Vec<SupportedFormats>,
11849        fidl::encoding::DefaultFuchsiaResourceDialect,
11850    > {
11851        StreamConfigProxyInterface::r#get_supported_formats(self)
11852    }
11853
11854    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
11855    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
11856    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
11857    /// ring buffer channel had been established and was still active, the driver must close that
11858    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
11859    /// operations in the process.
11860    pub fn r#create_ring_buffer(
11861        &self,
11862        mut format: &Format,
11863        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11864    ) -> Result<(), fidl::Error> {
11865        StreamConfigProxyInterface::r#create_ring_buffer(self, format, ring_buffer)
11866    }
11867
11868    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
11869    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
11870    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
11871    /// from what was most recently reported.
11872    /// If `WatchGainState` is called for a second time before the first call has completed, then
11873    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11874    pub fn r#watch_gain_state(
11875        &self,
11876    ) -> fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>
11877    {
11878        StreamConfigProxyInterface::r#watch_gain_state(self)
11879    }
11880
11881    /// Client update of the gain state.
11882    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
11883        StreamConfigProxyInterface::r#set_gain(self, target_state)
11884    }
11885
11886    /// Get the plug detect state via a hanging get. The driver will reply to the first
11887    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
11888    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
11889    /// If `WatchPlugState` is called for a second time before the first call has completed, then
11890    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11891    pub fn r#watch_plug_state(
11892        &self,
11893    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
11894    {
11895        StreamConfigProxyInterface::r#watch_plug_state(self)
11896    }
11897}
11898
11899impl StreamConfigProxyInterface for StreamConfigProxy {
11900    type GetHealthStateResponseFut =
11901        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
11902    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
11903        fn _decode(
11904            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11905        ) -> Result<HealthState, fidl::Error> {
11906            let _response = fidl::client::decode_transaction_body::<
11907                HealthGetHealthStateResponse,
11908                fidl::encoding::DefaultFuchsiaResourceDialect,
11909                0x4e146d6bca733a84,
11910            >(_buf?)?;
11911            Ok(_response.state)
11912        }
11913        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
11914            (),
11915            0x4e146d6bca733a84,
11916            fidl::encoding::DynamicFlags::empty(),
11917            _decode,
11918        )
11919    }
11920
11921    fn r#signal_processing_connect(
11922        &self,
11923        mut protocol: fidl::endpoints::ServerEnd<
11924            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11925        >,
11926    ) -> Result<(), fidl::Error> {
11927        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
11928            (protocol,),
11929            0xa81907ce6066295,
11930            fidl::encoding::DynamicFlags::empty(),
11931        )
11932    }
11933
11934    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
11935        StreamProperties,
11936        fidl::encoding::DefaultFuchsiaResourceDialect,
11937    >;
11938    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
11939        fn _decode(
11940            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11941        ) -> Result<StreamProperties, fidl::Error> {
11942            let _response = fidl::client::decode_transaction_body::<
11943                StreamConfigGetPropertiesResponse,
11944                fidl::encoding::DefaultFuchsiaResourceDialect,
11945                0x7d89c02f3e2d3c01,
11946            >(_buf?)?;
11947            Ok(_response.properties)
11948        }
11949        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
11950            (),
11951            0x7d89c02f3e2d3c01,
11952            fidl::encoding::DynamicFlags::empty(),
11953            _decode,
11954        )
11955    }
11956
11957    type GetSupportedFormatsResponseFut = fidl::client::QueryResponseFut<
11958        Vec<SupportedFormats>,
11959        fidl::encoding::DefaultFuchsiaResourceDialect,
11960    >;
11961    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut {
11962        fn _decode(
11963            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11964        ) -> Result<Vec<SupportedFormats>, fidl::Error> {
11965            let _response = fidl::client::decode_transaction_body::<
11966                StreamConfigGetSupportedFormatsResponse,
11967                fidl::encoding::DefaultFuchsiaResourceDialect,
11968                0x448efa7850cafe7e,
11969            >(_buf?)?;
11970            Ok(_response.supported_formats)
11971        }
11972        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<SupportedFormats>>(
11973            (),
11974            0x448efa7850cafe7e,
11975            fidl::encoding::DynamicFlags::empty(),
11976            _decode,
11977        )
11978    }
11979
11980    fn r#create_ring_buffer(
11981        &self,
11982        mut format: &Format,
11983        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11984    ) -> Result<(), fidl::Error> {
11985        self.client.send::<StreamConfigCreateRingBufferRequest>(
11986            (format, ring_buffer),
11987            0x2afb19dd13faa1ba,
11988            fidl::encoding::DynamicFlags::empty(),
11989        )
11990    }
11991
11992    type WatchGainStateResponseFut =
11993        fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>;
11994    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut {
11995        fn _decode(
11996            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11997        ) -> Result<GainState, fidl::Error> {
11998            let _response = fidl::client::decode_transaction_body::<
11999                StreamConfigWatchGainStateResponse,
12000                fidl::encoding::DefaultFuchsiaResourceDialect,
12001                0x4772506136ab65c1,
12002            >(_buf?)?;
12003            Ok(_response.gain_state)
12004        }
12005        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GainState>(
12006            (),
12007            0x4772506136ab65c1,
12008            fidl::encoding::DynamicFlags::empty(),
12009            _decode,
12010        )
12011    }
12012
12013    fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
12014        self.client.send::<StreamConfigSetGainRequest>(
12015            (target_state,),
12016            0x3943b41498c6a384,
12017            fidl::encoding::DynamicFlags::empty(),
12018        )
12019    }
12020
12021    type WatchPlugStateResponseFut =
12022        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
12023    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
12024        fn _decode(
12025            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12026        ) -> Result<PlugState, fidl::Error> {
12027            let _response = fidl::client::decode_transaction_body::<
12028                StreamConfigWatchPlugStateResponse,
12029                fidl::encoding::DefaultFuchsiaResourceDialect,
12030                0x497345a6f048b2a6,
12031            >(_buf?)?;
12032            Ok(_response.plug_state)
12033        }
12034        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
12035            (),
12036            0x497345a6f048b2a6,
12037            fidl::encoding::DynamicFlags::empty(),
12038            _decode,
12039        )
12040    }
12041}
12042
12043pub struct StreamConfigEventStream {
12044    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12045}
12046
12047impl std::marker::Unpin for StreamConfigEventStream {}
12048
12049impl futures::stream::FusedStream for StreamConfigEventStream {
12050    fn is_terminated(&self) -> bool {
12051        self.event_receiver.is_terminated()
12052    }
12053}
12054
12055impl futures::Stream for StreamConfigEventStream {
12056    type Item = Result<StreamConfigEvent, fidl::Error>;
12057
12058    fn poll_next(
12059        mut self: std::pin::Pin<&mut Self>,
12060        cx: &mut std::task::Context<'_>,
12061    ) -> std::task::Poll<Option<Self::Item>> {
12062        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12063            &mut self.event_receiver,
12064            cx
12065        )?) {
12066            Some(buf) => std::task::Poll::Ready(Some(StreamConfigEvent::decode(buf))),
12067            None => std::task::Poll::Ready(None),
12068        }
12069    }
12070}
12071
12072#[derive(Debug)]
12073pub enum StreamConfigEvent {}
12074
12075impl StreamConfigEvent {
12076    /// Decodes a message buffer as a [`StreamConfigEvent`].
12077    fn decode(
12078        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12079    ) -> Result<StreamConfigEvent, fidl::Error> {
12080        let (bytes, _handles) = buf.split_mut();
12081        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12082        debug_assert_eq!(tx_header.tx_id, 0);
12083        match tx_header.ordinal {
12084            _ => Err(fidl::Error::UnknownOrdinal {
12085                ordinal: tx_header.ordinal,
12086                protocol_name: <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12087            }),
12088        }
12089    }
12090}
12091
12092/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfig.
12093pub struct StreamConfigRequestStream {
12094    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12095    is_terminated: bool,
12096}
12097
12098impl std::marker::Unpin for StreamConfigRequestStream {}
12099
12100impl futures::stream::FusedStream for StreamConfigRequestStream {
12101    fn is_terminated(&self) -> bool {
12102        self.is_terminated
12103    }
12104}
12105
12106impl fidl::endpoints::RequestStream for StreamConfigRequestStream {
12107    type Protocol = StreamConfigMarker;
12108    type ControlHandle = StreamConfigControlHandle;
12109
12110    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12111        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12112    }
12113
12114    fn control_handle(&self) -> Self::ControlHandle {
12115        StreamConfigControlHandle { inner: self.inner.clone() }
12116    }
12117
12118    fn into_inner(
12119        self,
12120    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12121    {
12122        (self.inner, self.is_terminated)
12123    }
12124
12125    fn from_inner(
12126        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12127        is_terminated: bool,
12128    ) -> Self {
12129        Self { inner, is_terminated }
12130    }
12131}
12132
12133impl futures::Stream for StreamConfigRequestStream {
12134    type Item = Result<StreamConfigRequest, fidl::Error>;
12135
12136    fn poll_next(
12137        mut self: std::pin::Pin<&mut Self>,
12138        cx: &mut std::task::Context<'_>,
12139    ) -> std::task::Poll<Option<Self::Item>> {
12140        let this = &mut *self;
12141        if this.inner.check_shutdown(cx) {
12142            this.is_terminated = true;
12143            return std::task::Poll::Ready(None);
12144        }
12145        if this.is_terminated {
12146            panic!("polled StreamConfigRequestStream after completion");
12147        }
12148        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12149            |bytes, handles| {
12150                match this.inner.channel().read_etc(cx, bytes, handles) {
12151                    std::task::Poll::Ready(Ok(())) => {}
12152                    std::task::Poll::Pending => return std::task::Poll::Pending,
12153                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12154                        this.is_terminated = true;
12155                        return std::task::Poll::Ready(None);
12156                    }
12157                    std::task::Poll::Ready(Err(e)) => {
12158                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12159                            e.into(),
12160                        ))));
12161                    }
12162                }
12163
12164                // A message has been received from the channel
12165                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12166
12167                std::task::Poll::Ready(Some(match header.ordinal {
12168                    0x4e146d6bca733a84 => {
12169                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12170                        let mut req = fidl::new_empty!(
12171                            fidl::encoding::EmptyPayload,
12172                            fidl::encoding::DefaultFuchsiaResourceDialect
12173                        );
12174                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12175                        let control_handle =
12176                            StreamConfigControlHandle { inner: this.inner.clone() };
12177                        Ok(StreamConfigRequest::GetHealthState {
12178                            responder: StreamConfigGetHealthStateResponder {
12179                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12180                                tx_id: header.tx_id,
12181                            },
12182                        })
12183                    }
12184                    0xa81907ce6066295 => {
12185                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12186                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12187                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
12188                        let control_handle =
12189                            StreamConfigControlHandle { inner: this.inner.clone() };
12190                        Ok(StreamConfigRequest::SignalProcessingConnect {
12191                            protocol: req.protocol,
12192
12193                            control_handle,
12194                        })
12195                    }
12196                    0x7d89c02f3e2d3c01 => {
12197                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12198                        let mut req = fidl::new_empty!(
12199                            fidl::encoding::EmptyPayload,
12200                            fidl::encoding::DefaultFuchsiaResourceDialect
12201                        );
12202                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12203                        let control_handle =
12204                            StreamConfigControlHandle { inner: this.inner.clone() };
12205                        Ok(StreamConfigRequest::GetProperties {
12206                            responder: StreamConfigGetPropertiesResponder {
12207                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12208                                tx_id: header.tx_id,
12209                            },
12210                        })
12211                    }
12212                    0x448efa7850cafe7e => {
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::GetSupportedFormats {
12222                            responder: StreamConfigGetSupportedFormatsResponder {
12223                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12224                                tx_id: header.tx_id,
12225                            },
12226                        })
12227                    }
12228                    0x2afb19dd13faa1ba => {
12229                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12230                        let mut req = fidl::new_empty!(
12231                            StreamConfigCreateRingBufferRequest,
12232                            fidl::encoding::DefaultFuchsiaResourceDialect
12233                        );
12234                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
12235                        let control_handle =
12236                            StreamConfigControlHandle { inner: this.inner.clone() };
12237                        Ok(StreamConfigRequest::CreateRingBuffer {
12238                            format: req.format,
12239                            ring_buffer: req.ring_buffer,
12240
12241                            control_handle,
12242                        })
12243                    }
12244                    0x4772506136ab65c1 => {
12245                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12246                        let mut req = fidl::new_empty!(
12247                            fidl::encoding::EmptyPayload,
12248                            fidl::encoding::DefaultFuchsiaResourceDialect
12249                        );
12250                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12251                        let control_handle =
12252                            StreamConfigControlHandle { inner: this.inner.clone() };
12253                        Ok(StreamConfigRequest::WatchGainState {
12254                            responder: StreamConfigWatchGainStateResponder {
12255                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12256                                tx_id: header.tx_id,
12257                            },
12258                        })
12259                    }
12260                    0x3943b41498c6a384 => {
12261                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12262                        let mut req = fidl::new_empty!(
12263                            StreamConfigSetGainRequest,
12264                            fidl::encoding::DefaultFuchsiaResourceDialect
12265                        );
12266                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
12267                        let control_handle =
12268                            StreamConfigControlHandle { inner: this.inner.clone() };
12269                        Ok(StreamConfigRequest::SetGain {
12270                            target_state: req.target_state,
12271
12272                            control_handle,
12273                        })
12274                    }
12275                    0x497345a6f048b2a6 => {
12276                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12277                        let mut req = fidl::new_empty!(
12278                            fidl::encoding::EmptyPayload,
12279                            fidl::encoding::DefaultFuchsiaResourceDialect
12280                        );
12281                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12282                        let control_handle =
12283                            StreamConfigControlHandle { inner: this.inner.clone() };
12284                        Ok(StreamConfigRequest::WatchPlugState {
12285                            responder: StreamConfigWatchPlugStateResponder {
12286                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12287                                tx_id: header.tx_id,
12288                            },
12289                        })
12290                    }
12291                    _ => Err(fidl::Error::UnknownOrdinal {
12292                        ordinal: header.ordinal,
12293                        protocol_name:
12294                            <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12295                    }),
12296                }))
12297            },
12298        )
12299    }
12300}
12301
12302/// For an overview see
12303/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/development/audio/drivers/streaming)
12304/// # Deprecation
12305///
12306/// Not supported anymore, instead use an
12307/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
12308/// with one Ring Buffer, see
12309/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
12310#[derive(Debug)]
12311pub enum StreamConfigRequest {
12312    /// Retrieves top level health state.
12313    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
12314    GetHealthState { responder: StreamConfigGetHealthStateResponder },
12315    /// Connect to a `SignalProcessing` protocol.
12316    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
12317    /// the maximum number of connections have already been created, for instance one, then the
12318    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
12319    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
12320    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
12321    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
12322    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
12323    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
12324    /// is intended to be composed, and hence the more verbose name allows differentiation and
12325    /// improved clarity.
12326    SignalProcessingConnect {
12327        protocol: fidl::endpoints::ServerEnd<
12328            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
12329        >,
12330        control_handle: StreamConfigControlHandle,
12331    },
12332    /// Retrieves top level static properties.
12333    GetProperties { responder: StreamConfigGetPropertiesResponder },
12334    /// Gets formats supported by a given driver. When not all combinations supported by the
12335    /// driver can be described with one `SupportedFormats`, the driver returns more than one
12336    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
12337    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
12338    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
12339    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
12340    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
12341    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
12342    /// <<16bits,32bits>,<48KHz,96KHz>>.
12343    GetSupportedFormats { responder: StreamConfigGetSupportedFormatsResponder },
12344    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
12345    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
12346    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
12347    /// ring buffer channel had been established and was still active, the driver must close that
12348    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
12349    /// operations in the process.
12350    CreateRingBuffer {
12351        format: Format,
12352        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
12353        control_handle: StreamConfigControlHandle,
12354    },
12355    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
12356    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
12357    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
12358    /// from what was most recently reported.
12359    /// If `WatchGainState` is called for a second time before the first call has completed, then
12360    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
12361    WatchGainState { responder: StreamConfigWatchGainStateResponder },
12362    /// Client update of the gain state.
12363    SetGain { target_state: GainState, control_handle: StreamConfigControlHandle },
12364    /// Get the plug detect state via a hanging get. The driver will reply to the first
12365    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
12366    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
12367    /// If `WatchPlugState` is called for a second time before the first call has completed, then
12368    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
12369    WatchPlugState { responder: StreamConfigWatchPlugStateResponder },
12370}
12371
12372impl StreamConfigRequest {
12373    #[allow(irrefutable_let_patterns)]
12374    pub fn into_get_health_state(self) -> Option<(StreamConfigGetHealthStateResponder)> {
12375        if let StreamConfigRequest::GetHealthState { responder } = self {
12376            Some((responder))
12377        } else {
12378            None
12379        }
12380    }
12381
12382    #[allow(irrefutable_let_patterns)]
12383    pub fn into_signal_processing_connect(
12384        self,
12385    ) -> Option<(
12386        fidl::endpoints::ServerEnd<
12387            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
12388        >,
12389        StreamConfigControlHandle,
12390    )> {
12391        if let StreamConfigRequest::SignalProcessingConnect { protocol, control_handle } = self {
12392            Some((protocol, control_handle))
12393        } else {
12394            None
12395        }
12396    }
12397
12398    #[allow(irrefutable_let_patterns)]
12399    pub fn into_get_properties(self) -> Option<(StreamConfigGetPropertiesResponder)> {
12400        if let StreamConfigRequest::GetProperties { responder } = self {
12401            Some((responder))
12402        } else {
12403            None
12404        }
12405    }
12406
12407    #[allow(irrefutable_let_patterns)]
12408    pub fn into_get_supported_formats(self) -> Option<(StreamConfigGetSupportedFormatsResponder)> {
12409        if let StreamConfigRequest::GetSupportedFormats { responder } = self {
12410            Some((responder))
12411        } else {
12412            None
12413        }
12414    }
12415
12416    #[allow(irrefutable_let_patterns)]
12417    pub fn into_create_ring_buffer(
12418        self,
12419    ) -> Option<(Format, fidl::endpoints::ServerEnd<RingBufferMarker>, StreamConfigControlHandle)>
12420    {
12421        if let StreamConfigRequest::CreateRingBuffer { format, ring_buffer, control_handle } = self
12422        {
12423            Some((format, ring_buffer, control_handle))
12424        } else {
12425            None
12426        }
12427    }
12428
12429    #[allow(irrefutable_let_patterns)]
12430    pub fn into_watch_gain_state(self) -> Option<(StreamConfigWatchGainStateResponder)> {
12431        if let StreamConfigRequest::WatchGainState { responder } = self {
12432            Some((responder))
12433        } else {
12434            None
12435        }
12436    }
12437
12438    #[allow(irrefutable_let_patterns)]
12439    pub fn into_set_gain(self) -> Option<(GainState, StreamConfigControlHandle)> {
12440        if let StreamConfigRequest::SetGain { target_state, control_handle } = self {
12441            Some((target_state, control_handle))
12442        } else {
12443            None
12444        }
12445    }
12446
12447    #[allow(irrefutable_let_patterns)]
12448    pub fn into_watch_plug_state(self) -> Option<(StreamConfigWatchPlugStateResponder)> {
12449        if let StreamConfigRequest::WatchPlugState { responder } = self {
12450            Some((responder))
12451        } else {
12452            None
12453        }
12454    }
12455
12456    /// Name of the method defined in FIDL
12457    pub fn method_name(&self) -> &'static str {
12458        match *self {
12459            StreamConfigRequest::GetHealthState { .. } => "get_health_state",
12460            StreamConfigRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
12461            StreamConfigRequest::GetProperties { .. } => "get_properties",
12462            StreamConfigRequest::GetSupportedFormats { .. } => "get_supported_formats",
12463            StreamConfigRequest::CreateRingBuffer { .. } => "create_ring_buffer",
12464            StreamConfigRequest::WatchGainState { .. } => "watch_gain_state",
12465            StreamConfigRequest::SetGain { .. } => "set_gain",
12466            StreamConfigRequest::WatchPlugState { .. } => "watch_plug_state",
12467        }
12468    }
12469}
12470
12471#[derive(Debug, Clone)]
12472pub struct StreamConfigControlHandle {
12473    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12474}
12475
12476impl StreamConfigControlHandle {
12477    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
12478        self.inner.shutdown_with_epitaph(status.into())
12479    }
12480}
12481
12482impl fidl::endpoints::ControlHandle for StreamConfigControlHandle {
12483    fn shutdown(&self) {
12484        self.inner.shutdown()
12485    }
12486
12487    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
12488        self.inner.shutdown_with_epitaph(status)
12489    }
12490
12491    fn is_closed(&self) -> bool {
12492        self.inner.channel().is_closed()
12493    }
12494    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12495        self.inner.channel().on_closed()
12496    }
12497
12498    #[cfg(target_os = "fuchsia")]
12499    fn signal_peer(
12500        &self,
12501        clear_mask: zx::Signals,
12502        set_mask: zx::Signals,
12503    ) -> Result<(), zx_status::Status> {
12504        use fidl::Peered;
12505        self.inner.channel().signal_peer(clear_mask, set_mask)
12506    }
12507}
12508
12509impl StreamConfigControlHandle {}
12510
12511#[must_use = "FIDL methods require a response to be sent"]
12512#[derive(Debug)]
12513pub struct StreamConfigGetHealthStateResponder {
12514    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12515    tx_id: u32,
12516}
12517
12518/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12519/// if the responder is dropped without sending a response, so that the client
12520/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12521impl std::ops::Drop for StreamConfigGetHealthStateResponder {
12522    fn drop(&mut self) {
12523        self.control_handle.shutdown();
12524        // Safety: drops once, never accessed again
12525        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12526    }
12527}
12528
12529impl fidl::endpoints::Responder for StreamConfigGetHealthStateResponder {
12530    type ControlHandle = StreamConfigControlHandle;
12531
12532    fn control_handle(&self) -> &StreamConfigControlHandle {
12533        &self.control_handle
12534    }
12535
12536    fn drop_without_shutdown(mut self) {
12537        // Safety: drops once, never accessed again due to mem::forget
12538        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12539        // Prevent Drop from running (which would shut down the channel)
12540        std::mem::forget(self);
12541    }
12542}
12543
12544impl StreamConfigGetHealthStateResponder {
12545    /// Sends a response to the FIDL transaction.
12546    ///
12547    /// Sets the channel to shutdown if an error occurs.
12548    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
12549        let _result = self.send_raw(state);
12550        if _result.is_err() {
12551            self.control_handle.shutdown();
12552        }
12553        self.drop_without_shutdown();
12554        _result
12555    }
12556
12557    /// Similar to "send" but does not shutdown the channel if an error occurs.
12558    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
12559        let _result = self.send_raw(state);
12560        self.drop_without_shutdown();
12561        _result
12562    }
12563
12564    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
12565        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
12566            (state,),
12567            self.tx_id,
12568            0x4e146d6bca733a84,
12569            fidl::encoding::DynamicFlags::empty(),
12570        )
12571    }
12572}
12573
12574#[must_use = "FIDL methods require a response to be sent"]
12575#[derive(Debug)]
12576pub struct StreamConfigGetPropertiesResponder {
12577    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12578    tx_id: u32,
12579}
12580
12581/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12582/// if the responder is dropped without sending a response, so that the client
12583/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12584impl std::ops::Drop for StreamConfigGetPropertiesResponder {
12585    fn drop(&mut self) {
12586        self.control_handle.shutdown();
12587        // Safety: drops once, never accessed again
12588        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12589    }
12590}
12591
12592impl fidl::endpoints::Responder for StreamConfigGetPropertiesResponder {
12593    type ControlHandle = StreamConfigControlHandle;
12594
12595    fn control_handle(&self) -> &StreamConfigControlHandle {
12596        &self.control_handle
12597    }
12598
12599    fn drop_without_shutdown(mut self) {
12600        // Safety: drops once, never accessed again due to mem::forget
12601        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12602        // Prevent Drop from running (which would shut down the channel)
12603        std::mem::forget(self);
12604    }
12605}
12606
12607impl StreamConfigGetPropertiesResponder {
12608    /// Sends a response to the FIDL transaction.
12609    ///
12610    /// Sets the channel to shutdown if an error occurs.
12611    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
12612        let _result = self.send_raw(properties);
12613        if _result.is_err() {
12614            self.control_handle.shutdown();
12615        }
12616        self.drop_without_shutdown();
12617        _result
12618    }
12619
12620    /// Similar to "send" but does not shutdown the channel if an error occurs.
12621    pub fn send_no_shutdown_on_err(
12622        self,
12623        mut properties: &StreamProperties,
12624    ) -> Result<(), fidl::Error> {
12625        let _result = self.send_raw(properties);
12626        self.drop_without_shutdown();
12627        _result
12628    }
12629
12630    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
12631        self.control_handle.inner.send::<StreamConfigGetPropertiesResponse>(
12632            (properties,),
12633            self.tx_id,
12634            0x7d89c02f3e2d3c01,
12635            fidl::encoding::DynamicFlags::empty(),
12636        )
12637    }
12638}
12639
12640#[must_use = "FIDL methods require a response to be sent"]
12641#[derive(Debug)]
12642pub struct StreamConfigGetSupportedFormatsResponder {
12643    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12644    tx_id: u32,
12645}
12646
12647/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12648/// if the responder is dropped without sending a response, so that the client
12649/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12650impl std::ops::Drop for StreamConfigGetSupportedFormatsResponder {
12651    fn drop(&mut self) {
12652        self.control_handle.shutdown();
12653        // Safety: drops once, never accessed again
12654        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12655    }
12656}
12657
12658impl fidl::endpoints::Responder for StreamConfigGetSupportedFormatsResponder {
12659    type ControlHandle = StreamConfigControlHandle;
12660
12661    fn control_handle(&self) -> &StreamConfigControlHandle {
12662        &self.control_handle
12663    }
12664
12665    fn drop_without_shutdown(mut self) {
12666        // Safety: drops once, never accessed again due to mem::forget
12667        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12668        // Prevent Drop from running (which would shut down the channel)
12669        std::mem::forget(self);
12670    }
12671}
12672
12673impl StreamConfigGetSupportedFormatsResponder {
12674    /// Sends a response to the FIDL transaction.
12675    ///
12676    /// Sets the channel to shutdown if an error occurs.
12677    pub fn send(self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
12678        let _result = self.send_raw(supported_formats);
12679        if _result.is_err() {
12680            self.control_handle.shutdown();
12681        }
12682        self.drop_without_shutdown();
12683        _result
12684    }
12685
12686    /// Similar to "send" but does not shutdown the channel if an error occurs.
12687    pub fn send_no_shutdown_on_err(
12688        self,
12689        mut supported_formats: &[SupportedFormats],
12690    ) -> Result<(), fidl::Error> {
12691        let _result = self.send_raw(supported_formats);
12692        self.drop_without_shutdown();
12693        _result
12694    }
12695
12696    fn send_raw(&self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
12697        self.control_handle.inner.send::<StreamConfigGetSupportedFormatsResponse>(
12698            (supported_formats,),
12699            self.tx_id,
12700            0x448efa7850cafe7e,
12701            fidl::encoding::DynamicFlags::empty(),
12702        )
12703    }
12704}
12705
12706#[must_use = "FIDL methods require a response to be sent"]
12707#[derive(Debug)]
12708pub struct StreamConfigWatchGainStateResponder {
12709    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12710    tx_id: u32,
12711}
12712
12713/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12714/// if the responder is dropped without sending a response, so that the client
12715/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12716impl std::ops::Drop for StreamConfigWatchGainStateResponder {
12717    fn drop(&mut self) {
12718        self.control_handle.shutdown();
12719        // Safety: drops once, never accessed again
12720        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12721    }
12722}
12723
12724impl fidl::endpoints::Responder for StreamConfigWatchGainStateResponder {
12725    type ControlHandle = StreamConfigControlHandle;
12726
12727    fn control_handle(&self) -> &StreamConfigControlHandle {
12728        &self.control_handle
12729    }
12730
12731    fn drop_without_shutdown(mut self) {
12732        // Safety: drops once, never accessed again due to mem::forget
12733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12734        // Prevent Drop from running (which would shut down the channel)
12735        std::mem::forget(self);
12736    }
12737}
12738
12739impl StreamConfigWatchGainStateResponder {
12740    /// Sends a response to the FIDL transaction.
12741    ///
12742    /// Sets the channel to shutdown if an error occurs.
12743    pub fn send(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12744        let _result = self.send_raw(gain_state);
12745        if _result.is_err() {
12746            self.control_handle.shutdown();
12747        }
12748        self.drop_without_shutdown();
12749        _result
12750    }
12751
12752    /// Similar to "send" but does not shutdown the channel if an error occurs.
12753    pub fn send_no_shutdown_on_err(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12754        let _result = self.send_raw(gain_state);
12755        self.drop_without_shutdown();
12756        _result
12757    }
12758
12759    fn send_raw(&self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12760        self.control_handle.inner.send::<StreamConfigWatchGainStateResponse>(
12761            (gain_state,),
12762            self.tx_id,
12763            0x4772506136ab65c1,
12764            fidl::encoding::DynamicFlags::empty(),
12765        )
12766    }
12767}
12768
12769#[must_use = "FIDL methods require a response to be sent"]
12770#[derive(Debug)]
12771pub struct StreamConfigWatchPlugStateResponder {
12772    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12773    tx_id: u32,
12774}
12775
12776/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12777/// if the responder is dropped without sending a response, so that the client
12778/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12779impl std::ops::Drop for StreamConfigWatchPlugStateResponder {
12780    fn drop(&mut self) {
12781        self.control_handle.shutdown();
12782        // Safety: drops once, never accessed again
12783        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12784    }
12785}
12786
12787impl fidl::endpoints::Responder for StreamConfigWatchPlugStateResponder {
12788    type ControlHandle = StreamConfigControlHandle;
12789
12790    fn control_handle(&self) -> &StreamConfigControlHandle {
12791        &self.control_handle
12792    }
12793
12794    fn drop_without_shutdown(mut self) {
12795        // Safety: drops once, never accessed again due to mem::forget
12796        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12797        // Prevent Drop from running (which would shut down the channel)
12798        std::mem::forget(self);
12799    }
12800}
12801
12802impl StreamConfigWatchPlugStateResponder {
12803    /// Sends a response to the FIDL transaction.
12804    ///
12805    /// Sets the channel to shutdown if an error occurs.
12806    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12807        let _result = self.send_raw(plug_state);
12808        if _result.is_err() {
12809            self.control_handle.shutdown();
12810        }
12811        self.drop_without_shutdown();
12812        _result
12813    }
12814
12815    /// Similar to "send" but does not shutdown the channel if an error occurs.
12816    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12817        let _result = self.send_raw(plug_state);
12818        self.drop_without_shutdown();
12819        _result
12820    }
12821
12822    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12823        self.control_handle.inner.send::<StreamConfigWatchPlugStateResponse>(
12824            (plug_state,),
12825            self.tx_id,
12826            0x497345a6f048b2a6,
12827            fidl::encoding::DynamicFlags::empty(),
12828        )
12829    }
12830}
12831
12832#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
12833pub struct StreamConfigConnectorMarker;
12834
12835impl fidl::endpoints::ProtocolMarker for StreamConfigConnectorMarker {
12836    type Proxy = StreamConfigConnectorProxy;
12837    type RequestStream = StreamConfigConnectorRequestStream;
12838    #[cfg(target_os = "fuchsia")]
12839    type SynchronousProxy = StreamConfigConnectorSynchronousProxy;
12840
12841    const DEBUG_NAME: &'static str = "(anonymous) StreamConfigConnector";
12842}
12843
12844pub trait StreamConfigConnectorProxyInterface: Send + Sync {
12845    fn r#connect(
12846        &self,
12847        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12848    ) -> Result<(), fidl::Error>;
12849}
12850#[derive(Debug)]
12851#[cfg(target_os = "fuchsia")]
12852pub struct StreamConfigConnectorSynchronousProxy {
12853    client: fidl::client::sync::Client,
12854}
12855
12856#[cfg(target_os = "fuchsia")]
12857impl fidl::endpoints::SynchronousProxy for StreamConfigConnectorSynchronousProxy {
12858    type Proxy = StreamConfigConnectorProxy;
12859    type Protocol = StreamConfigConnectorMarker;
12860
12861    fn from_channel(inner: fidl::Channel) -> Self {
12862        Self::new(inner)
12863    }
12864
12865    fn into_channel(self) -> fidl::Channel {
12866        self.client.into_channel()
12867    }
12868
12869    fn as_channel(&self) -> &fidl::Channel {
12870        self.client.as_channel()
12871    }
12872}
12873
12874#[cfg(target_os = "fuchsia")]
12875impl StreamConfigConnectorSynchronousProxy {
12876    pub fn new(channel: fidl::Channel) -> Self {
12877        Self { client: fidl::client::sync::Client::new(channel) }
12878    }
12879
12880    pub fn into_channel(self) -> fidl::Channel {
12881        self.client.into_channel()
12882    }
12883
12884    /// Waits until an event arrives and returns it. It is safe for other
12885    /// threads to make concurrent requests while waiting for an event.
12886    pub fn wait_for_event(
12887        &self,
12888        deadline: zx::MonotonicInstant,
12889    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
12890        StreamConfigConnectorEvent::decode(
12891            self.client.wait_for_event::<StreamConfigConnectorMarker>(deadline)?,
12892        )
12893    }
12894
12895    /// Connect to a `StreamConfig` protocol.
12896    /// This method allows a component to serve FIDL outside the devhost's control.
12897    pub fn r#connect(
12898        &self,
12899        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12900    ) -> Result<(), fidl::Error> {
12901        self.client.send::<StreamConfigConnectorConnectRequest>(
12902            (protocol,),
12903            0x22051ff3021eafec,
12904            fidl::encoding::DynamicFlags::empty(),
12905        )
12906    }
12907}
12908
12909#[cfg(target_os = "fuchsia")]
12910impl From<StreamConfigConnectorSynchronousProxy> for zx::NullableHandle {
12911    fn from(value: StreamConfigConnectorSynchronousProxy) -> Self {
12912        value.into_channel().into()
12913    }
12914}
12915
12916#[cfg(target_os = "fuchsia")]
12917impl From<fidl::Channel> for StreamConfigConnectorSynchronousProxy {
12918    fn from(value: fidl::Channel) -> Self {
12919        Self::new(value)
12920    }
12921}
12922
12923#[cfg(target_os = "fuchsia")]
12924impl fidl::endpoints::FromClient for StreamConfigConnectorSynchronousProxy {
12925    type Protocol = StreamConfigConnectorMarker;
12926
12927    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigConnectorMarker>) -> Self {
12928        Self::new(value.into_channel())
12929    }
12930}
12931
12932#[derive(Debug, Clone)]
12933pub struct StreamConfigConnectorProxy {
12934    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
12935}
12936
12937impl fidl::endpoints::Proxy for StreamConfigConnectorProxy {
12938    type Protocol = StreamConfigConnectorMarker;
12939
12940    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
12941        Self::new(inner)
12942    }
12943
12944    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
12945        self.client.into_channel().map_err(|client| Self { client })
12946    }
12947
12948    fn as_channel(&self) -> &::fidl::AsyncChannel {
12949        self.client.as_channel()
12950    }
12951}
12952
12953impl StreamConfigConnectorProxy {
12954    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfigConnector.
12955    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
12956        let protocol_name =
12957            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12958        Self { client: fidl::client::Client::new(channel, protocol_name) }
12959    }
12960
12961    /// Get a Stream of events from the remote end of the protocol.
12962    ///
12963    /// # Panics
12964    ///
12965    /// Panics if the event stream was already taken.
12966    pub fn take_event_stream(&self) -> StreamConfigConnectorEventStream {
12967        StreamConfigConnectorEventStream { event_receiver: self.client.take_event_receiver() }
12968    }
12969
12970    /// Connect to a `StreamConfig` protocol.
12971    /// This method allows a component to serve FIDL outside the devhost's control.
12972    pub fn r#connect(
12973        &self,
12974        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12975    ) -> Result<(), fidl::Error> {
12976        StreamConfigConnectorProxyInterface::r#connect(self, protocol)
12977    }
12978}
12979
12980impl StreamConfigConnectorProxyInterface for StreamConfigConnectorProxy {
12981    fn r#connect(
12982        &self,
12983        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12984    ) -> Result<(), fidl::Error> {
12985        self.client.send::<StreamConfigConnectorConnectRequest>(
12986            (protocol,),
12987            0x22051ff3021eafec,
12988            fidl::encoding::DynamicFlags::empty(),
12989        )
12990    }
12991}
12992
12993pub struct StreamConfigConnectorEventStream {
12994    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12995}
12996
12997impl std::marker::Unpin for StreamConfigConnectorEventStream {}
12998
12999impl futures::stream::FusedStream for StreamConfigConnectorEventStream {
13000    fn is_terminated(&self) -> bool {
13001        self.event_receiver.is_terminated()
13002    }
13003}
13004
13005impl futures::Stream for StreamConfigConnectorEventStream {
13006    type Item = Result<StreamConfigConnectorEvent, fidl::Error>;
13007
13008    fn poll_next(
13009        mut self: std::pin::Pin<&mut Self>,
13010        cx: &mut std::task::Context<'_>,
13011    ) -> std::task::Poll<Option<Self::Item>> {
13012        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
13013            &mut self.event_receiver,
13014            cx
13015        )?) {
13016            Some(buf) => std::task::Poll::Ready(Some(StreamConfigConnectorEvent::decode(buf))),
13017            None => std::task::Poll::Ready(None),
13018        }
13019    }
13020}
13021
13022#[derive(Debug)]
13023pub enum StreamConfigConnectorEvent {}
13024
13025impl StreamConfigConnectorEvent {
13026    /// Decodes a message buffer as a [`StreamConfigConnectorEvent`].
13027    fn decode(
13028        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
13029    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
13030        let (bytes, _handles) = buf.split_mut();
13031        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
13032        debug_assert_eq!(tx_header.tx_id, 0);
13033        match tx_header.ordinal {
13034            _ => Err(fidl::Error::UnknownOrdinal {
13035                ordinal: tx_header.ordinal,
13036                protocol_name:
13037                    <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13038            }),
13039        }
13040    }
13041}
13042
13043/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfigConnector.
13044pub struct StreamConfigConnectorRequestStream {
13045    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13046    is_terminated: bool,
13047}
13048
13049impl std::marker::Unpin for StreamConfigConnectorRequestStream {}
13050
13051impl futures::stream::FusedStream for StreamConfigConnectorRequestStream {
13052    fn is_terminated(&self) -> bool {
13053        self.is_terminated
13054    }
13055}
13056
13057impl fidl::endpoints::RequestStream for StreamConfigConnectorRequestStream {
13058    type Protocol = StreamConfigConnectorMarker;
13059    type ControlHandle = StreamConfigConnectorControlHandle;
13060
13061    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
13062        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
13063    }
13064
13065    fn control_handle(&self) -> Self::ControlHandle {
13066        StreamConfigConnectorControlHandle { inner: self.inner.clone() }
13067    }
13068
13069    fn into_inner(
13070        self,
13071    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
13072    {
13073        (self.inner, self.is_terminated)
13074    }
13075
13076    fn from_inner(
13077        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13078        is_terminated: bool,
13079    ) -> Self {
13080        Self { inner, is_terminated }
13081    }
13082}
13083
13084impl futures::Stream for StreamConfigConnectorRequestStream {
13085    type Item = Result<StreamConfigConnectorRequest, fidl::Error>;
13086
13087    fn poll_next(
13088        mut self: std::pin::Pin<&mut Self>,
13089        cx: &mut std::task::Context<'_>,
13090    ) -> std::task::Poll<Option<Self::Item>> {
13091        let this = &mut *self;
13092        if this.inner.check_shutdown(cx) {
13093            this.is_terminated = true;
13094            return std::task::Poll::Ready(None);
13095        }
13096        if this.is_terminated {
13097            panic!("polled StreamConfigConnectorRequestStream after completion");
13098        }
13099        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
13100            |bytes, handles| {
13101                match this.inner.channel().read_etc(cx, bytes, handles) {
13102                    std::task::Poll::Ready(Ok(())) => {}
13103                    std::task::Poll::Pending => return std::task::Poll::Pending,
13104                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
13105                        this.is_terminated = true;
13106                        return std::task::Poll::Ready(None);
13107                    }
13108                    std::task::Poll::Ready(Err(e)) => {
13109                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
13110                            e.into(),
13111                        ))));
13112                    }
13113                }
13114
13115                // A message has been received from the channel
13116                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
13117
13118                std::task::Poll::Ready(Some(match header.ordinal {
13119                0x22051ff3021eafec => {
13120                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
13121                    let mut req = fidl::new_empty!(StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
13122                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
13123                    let control_handle = StreamConfigConnectorControlHandle {
13124                        inner: this.inner.clone(),
13125                    };
13126                    Ok(StreamConfigConnectorRequest::Connect {protocol: req.protocol,
13127
13128                        control_handle,
13129                    })
13130                }
13131                _ => Err(fidl::Error::UnknownOrdinal {
13132                    ordinal: header.ordinal,
13133                    protocol_name: <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13134                }),
13135            }))
13136            },
13137        )
13138    }
13139}
13140
13141/// For an overview see
13142/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/development/audio/drivers/streaming).
13143/// # Deprecation
13144///
13145/// Not supported anymore, instead use an
13146/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13147/// with one Ring Buffer, see
13148/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13149#[derive(Debug)]
13150pub enum StreamConfigConnectorRequest {
13151    /// Connect to a `StreamConfig` protocol.
13152    /// This method allows a component to serve FIDL outside the devhost's control.
13153    Connect {
13154        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
13155        control_handle: StreamConfigConnectorControlHandle,
13156    },
13157}
13158
13159impl StreamConfigConnectorRequest {
13160    #[allow(irrefutable_let_patterns)]
13161    pub fn into_connect(
13162        self,
13163    ) -> Option<(fidl::endpoints::ServerEnd<StreamConfigMarker>, StreamConfigConnectorControlHandle)>
13164    {
13165        if let StreamConfigConnectorRequest::Connect { protocol, control_handle } = self {
13166            Some((protocol, control_handle))
13167        } else {
13168            None
13169        }
13170    }
13171
13172    /// Name of the method defined in FIDL
13173    pub fn method_name(&self) -> &'static str {
13174        match *self {
13175            StreamConfigConnectorRequest::Connect { .. } => "connect",
13176        }
13177    }
13178}
13179
13180#[derive(Debug, Clone)]
13181pub struct StreamConfigConnectorControlHandle {
13182    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13183}
13184
13185impl StreamConfigConnectorControlHandle {
13186    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
13187        self.inner.shutdown_with_epitaph(status.into())
13188    }
13189}
13190
13191impl fidl::endpoints::ControlHandle for StreamConfigConnectorControlHandle {
13192    fn shutdown(&self) {
13193        self.inner.shutdown()
13194    }
13195
13196    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
13197        self.inner.shutdown_with_epitaph(status)
13198    }
13199
13200    fn is_closed(&self) -> bool {
13201        self.inner.channel().is_closed()
13202    }
13203    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
13204        self.inner.channel().on_closed()
13205    }
13206
13207    #[cfg(target_os = "fuchsia")]
13208    fn signal_peer(
13209        &self,
13210        clear_mask: zx::Signals,
13211        set_mask: zx::Signals,
13212    ) -> Result<(), zx_status::Status> {
13213        use fidl::Peered;
13214        self.inner.channel().signal_peer(clear_mask, set_mask)
13215    }
13216}
13217
13218impl StreamConfigConnectorControlHandle {}
13219
13220#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13221pub struct CodecConnectorServiceMarker;
13222
13223#[cfg(target_os = "fuchsia")]
13224impl fidl::endpoints::ServiceMarker for CodecConnectorServiceMarker {
13225    type Proxy = CodecConnectorServiceProxy;
13226    type Request = CodecConnectorServiceRequest;
13227    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecConnectorService";
13228}
13229
13230/// A request for one of the member protocols of CodecConnectorService.
13231///
13232/// # Deprecation
13233///
13234/// Not supported anymore, instead use an
13235/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13236/// with one DAI and no Ring Buffer, see
13237/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13238#[cfg(target_os = "fuchsia")]
13239pub enum CodecConnectorServiceRequest {
13240    CodecConnector(CodecConnectorRequestStream),
13241}
13242
13243#[cfg(target_os = "fuchsia")]
13244impl fidl::endpoints::ServiceRequest for CodecConnectorServiceRequest {
13245    type Service = CodecConnectorServiceMarker;
13246
13247    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13248        match name {
13249            "codec_connector" => Self::CodecConnector(
13250                <CodecConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13251                    _channel,
13252                ),
13253            ),
13254            _ => panic!("no such member protocol name for service CodecConnectorService"),
13255        }
13256    }
13257
13258    fn member_names() -> &'static [&'static str] {
13259        &["codec_connector"]
13260    }
13261}
13262/// # Deprecation
13263///
13264/// Not supported anymore, instead use an
13265/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13266/// with one DAI and no Ring Buffer, see
13267/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13268#[cfg(target_os = "fuchsia")]
13269pub struct CodecConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13270
13271#[cfg(target_os = "fuchsia")]
13272impl fidl::endpoints::ServiceProxy for CodecConnectorServiceProxy {
13273    type Service = CodecConnectorServiceMarker;
13274
13275    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13276        Self(opener)
13277    }
13278}
13279
13280#[cfg(target_os = "fuchsia")]
13281impl CodecConnectorServiceProxy {
13282    pub fn connect_to_codec_connector(&self) -> Result<CodecConnectorProxy, fidl::Error> {
13283        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecConnectorMarker>();
13284        self.connect_channel_to_codec_connector(server_end)?;
13285        Ok(proxy)
13286    }
13287
13288    /// Like `connect_to_codec_connector`, but returns a sync proxy.
13289    /// See [`Self::connect_to_codec_connector`] for more details.
13290    pub fn connect_to_codec_connector_sync(
13291        &self,
13292    ) -> Result<CodecConnectorSynchronousProxy, fidl::Error> {
13293        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecConnectorMarker>();
13294        self.connect_channel_to_codec_connector(server_end)?;
13295        Ok(proxy)
13296    }
13297
13298    /// Like `connect_to_codec_connector`, but accepts a server end.
13299    /// See [`Self::connect_to_codec_connector`] for more details.
13300    pub fn connect_channel_to_codec_connector(
13301        &self,
13302        server_end: fidl::endpoints::ServerEnd<CodecConnectorMarker>,
13303    ) -> Result<(), fidl::Error> {
13304        self.0.open_member("codec_connector", server_end.into_channel())
13305    }
13306
13307    pub fn instance_name(&self) -> &str {
13308        self.0.instance_name()
13309    }
13310}
13311
13312#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13313pub struct CodecServiceMarker;
13314
13315#[cfg(target_os = "fuchsia")]
13316impl fidl::endpoints::ServiceMarker for CodecServiceMarker {
13317    type Proxy = CodecServiceProxy;
13318    type Request = CodecServiceRequest;
13319    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecService";
13320}
13321
13322/// A request for one of the member protocols of CodecService.
13323///
13324/// # Deprecation
13325///
13326/// Not supported anymore, instead use an
13327/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13328/// with one DAI and no Ring Buffer, see
13329/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13330#[cfg(target_os = "fuchsia")]
13331pub enum CodecServiceRequest {
13332    Codec(CodecRequestStream),
13333}
13334
13335#[cfg(target_os = "fuchsia")]
13336impl fidl::endpoints::ServiceRequest for CodecServiceRequest {
13337    type Service = CodecServiceMarker;
13338
13339    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13340        match name {
13341            "codec" => Self::Codec(
13342                <CodecRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13343            ),
13344            _ => panic!("no such member protocol name for service CodecService"),
13345        }
13346    }
13347
13348    fn member_names() -> &'static [&'static str] {
13349        &["codec"]
13350    }
13351}
13352/// # Deprecation
13353///
13354/// Not supported anymore, instead use an
13355/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13356/// with one DAI and no Ring Buffer, see
13357/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13358#[cfg(target_os = "fuchsia")]
13359pub struct CodecServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13360
13361#[cfg(target_os = "fuchsia")]
13362impl fidl::endpoints::ServiceProxy for CodecServiceProxy {
13363    type Service = CodecServiceMarker;
13364
13365    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13366        Self(opener)
13367    }
13368}
13369
13370#[cfg(target_os = "fuchsia")]
13371impl CodecServiceProxy {
13372    pub fn connect_to_codec(&self) -> Result<CodecProxy, fidl::Error> {
13373        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecMarker>();
13374        self.connect_channel_to_codec(server_end)?;
13375        Ok(proxy)
13376    }
13377
13378    /// Like `connect_to_codec`, but returns a sync proxy.
13379    /// See [`Self::connect_to_codec`] for more details.
13380    pub fn connect_to_codec_sync(&self) -> Result<CodecSynchronousProxy, fidl::Error> {
13381        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecMarker>();
13382        self.connect_channel_to_codec(server_end)?;
13383        Ok(proxy)
13384    }
13385
13386    /// Like `connect_to_codec`, but accepts a server end.
13387    /// See [`Self::connect_to_codec`] for more details.
13388    pub fn connect_channel_to_codec(
13389        &self,
13390        server_end: fidl::endpoints::ServerEnd<CodecMarker>,
13391    ) -> Result<(), fidl::Error> {
13392        self.0.open_member("codec", server_end.into_channel())
13393    }
13394
13395    pub fn instance_name(&self) -> &str {
13396        self.0.instance_name()
13397    }
13398}
13399
13400#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13401pub struct CompositeConnectorServiceMarker;
13402
13403#[cfg(target_os = "fuchsia")]
13404impl fidl::endpoints::ServiceMarker for CompositeConnectorServiceMarker {
13405    type Proxy = CompositeConnectorServiceProxy;
13406    type Request = CompositeConnectorServiceRequest;
13407    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CompositeConnectorService";
13408}
13409
13410/// A request for one of the member protocols of CompositeConnectorService.
13411///
13412#[cfg(target_os = "fuchsia")]
13413pub enum CompositeConnectorServiceRequest {
13414    CompositeConnector(CompositeConnectorRequestStream),
13415}
13416
13417#[cfg(target_os = "fuchsia")]
13418impl fidl::endpoints::ServiceRequest for CompositeConnectorServiceRequest {
13419    type Service = CompositeConnectorServiceMarker;
13420
13421    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13422        match name {
13423            "composite_connector" => Self::CompositeConnector(
13424                <CompositeConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13425                    _channel,
13426                ),
13427            ),
13428            _ => panic!("no such member protocol name for service CompositeConnectorService"),
13429        }
13430    }
13431
13432    fn member_names() -> &'static [&'static str] {
13433        &["composite_connector"]
13434    }
13435}
13436#[cfg(target_os = "fuchsia")]
13437pub struct CompositeConnectorServiceProxy(
13438    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13439);
13440
13441#[cfg(target_os = "fuchsia")]
13442impl fidl::endpoints::ServiceProxy for CompositeConnectorServiceProxy {
13443    type Service = CompositeConnectorServiceMarker;
13444
13445    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13446        Self(opener)
13447    }
13448}
13449
13450#[cfg(target_os = "fuchsia")]
13451impl CompositeConnectorServiceProxy {
13452    pub fn connect_to_composite_connector(&self) -> Result<CompositeConnectorProxy, fidl::Error> {
13453        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeConnectorMarker>();
13454        self.connect_channel_to_composite_connector(server_end)?;
13455        Ok(proxy)
13456    }
13457
13458    /// Like `connect_to_composite_connector`, but returns a sync proxy.
13459    /// See [`Self::connect_to_composite_connector`] for more details.
13460    pub fn connect_to_composite_connector_sync(
13461        &self,
13462    ) -> Result<CompositeConnectorSynchronousProxy, fidl::Error> {
13463        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeConnectorMarker>();
13464        self.connect_channel_to_composite_connector(server_end)?;
13465        Ok(proxy)
13466    }
13467
13468    /// Like `connect_to_composite_connector`, but accepts a server end.
13469    /// See [`Self::connect_to_composite_connector`] for more details.
13470    pub fn connect_channel_to_composite_connector(
13471        &self,
13472        server_end: fidl::endpoints::ServerEnd<CompositeConnectorMarker>,
13473    ) -> Result<(), fidl::Error> {
13474        self.0.open_member("composite_connector", server_end.into_channel())
13475    }
13476
13477    pub fn instance_name(&self) -> &str {
13478        self.0.instance_name()
13479    }
13480}
13481
13482#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13483pub struct DaiConnectorServiceMarker;
13484
13485#[cfg(target_os = "fuchsia")]
13486impl fidl::endpoints::ServiceMarker for DaiConnectorServiceMarker {
13487    type Proxy = DaiConnectorServiceProxy;
13488    type Request = DaiConnectorServiceRequest;
13489    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiConnectorService";
13490}
13491
13492/// A request for one of the member protocols of DaiConnectorService.
13493///
13494/// # Deprecation
13495///
13496/// Not supported anymore, instead use an
13497/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13498/// with one DAI and one Ring Buffer, see
13499/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13500#[cfg(target_os = "fuchsia")]
13501pub enum DaiConnectorServiceRequest {
13502    DaiConnector(DaiConnectorRequestStream),
13503}
13504
13505#[cfg(target_os = "fuchsia")]
13506impl fidl::endpoints::ServiceRequest for DaiConnectorServiceRequest {
13507    type Service = DaiConnectorServiceMarker;
13508
13509    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13510        match name {
13511            "dai_connector" => Self::DaiConnector(
13512                <DaiConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13513                    _channel,
13514                ),
13515            ),
13516            _ => panic!("no such member protocol name for service DaiConnectorService"),
13517        }
13518    }
13519
13520    fn member_names() -> &'static [&'static str] {
13521        &["dai_connector"]
13522    }
13523}
13524/// # Deprecation
13525///
13526/// Not supported anymore, instead use an
13527/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13528/// with one DAI and one Ring Buffer, see
13529/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13530#[cfg(target_os = "fuchsia")]
13531pub struct DaiConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13532
13533#[cfg(target_os = "fuchsia")]
13534impl fidl::endpoints::ServiceProxy for DaiConnectorServiceProxy {
13535    type Service = DaiConnectorServiceMarker;
13536
13537    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13538        Self(opener)
13539    }
13540}
13541
13542#[cfg(target_os = "fuchsia")]
13543impl DaiConnectorServiceProxy {
13544    pub fn connect_to_dai_connector(&self) -> Result<DaiConnectorProxy, fidl::Error> {
13545        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiConnectorMarker>();
13546        self.connect_channel_to_dai_connector(server_end)?;
13547        Ok(proxy)
13548    }
13549
13550    /// Like `connect_to_dai_connector`, but returns a sync proxy.
13551    /// See [`Self::connect_to_dai_connector`] for more details.
13552    pub fn connect_to_dai_connector_sync(
13553        &self,
13554    ) -> Result<DaiConnectorSynchronousProxy, fidl::Error> {
13555        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiConnectorMarker>();
13556        self.connect_channel_to_dai_connector(server_end)?;
13557        Ok(proxy)
13558    }
13559
13560    /// Like `connect_to_dai_connector`, but accepts a server end.
13561    /// See [`Self::connect_to_dai_connector`] for more details.
13562    pub fn connect_channel_to_dai_connector(
13563        &self,
13564        server_end: fidl::endpoints::ServerEnd<DaiConnectorMarker>,
13565    ) -> Result<(), fidl::Error> {
13566        self.0.open_member("dai_connector", server_end.into_channel())
13567    }
13568
13569    pub fn instance_name(&self) -> &str {
13570        self.0.instance_name()
13571    }
13572}
13573
13574#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13575pub struct DaiServiceMarker;
13576
13577#[cfg(target_os = "fuchsia")]
13578impl fidl::endpoints::ServiceMarker for DaiServiceMarker {
13579    type Proxy = DaiServiceProxy;
13580    type Request = DaiServiceRequest;
13581    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiService";
13582}
13583
13584/// A request for one of the member protocols of DaiService.
13585///
13586/// # Deprecation
13587///
13588/// Not supported anymore, instead use an
13589/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13590/// with one DAI and one Ring Buffer, see
13591/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13592#[cfg(target_os = "fuchsia")]
13593pub enum DaiServiceRequest {
13594    Dai(DaiRequestStream),
13595}
13596
13597#[cfg(target_os = "fuchsia")]
13598impl fidl::endpoints::ServiceRequest for DaiServiceRequest {
13599    type Service = DaiServiceMarker;
13600
13601    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13602        match name {
13603            "dai" => Self::Dai(<DaiRequestStream as fidl::endpoints::RequestStream>::from_channel(
13604                _channel,
13605            )),
13606            _ => panic!("no such member protocol name for service DaiService"),
13607        }
13608    }
13609
13610    fn member_names() -> &'static [&'static str] {
13611        &["dai"]
13612    }
13613}
13614/// # Deprecation
13615///
13616/// Not supported anymore, instead use an
13617/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13618/// with one DAI and one Ring Buffer, see
13619/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13620#[cfg(target_os = "fuchsia")]
13621pub struct DaiServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13622
13623#[cfg(target_os = "fuchsia")]
13624impl fidl::endpoints::ServiceProxy for DaiServiceProxy {
13625    type Service = DaiServiceMarker;
13626
13627    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13628        Self(opener)
13629    }
13630}
13631
13632#[cfg(target_os = "fuchsia")]
13633impl DaiServiceProxy {
13634    pub fn connect_to_dai(&self) -> Result<DaiProxy, fidl::Error> {
13635        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiMarker>();
13636        self.connect_channel_to_dai(server_end)?;
13637        Ok(proxy)
13638    }
13639
13640    /// Like `connect_to_dai`, but returns a sync proxy.
13641    /// See [`Self::connect_to_dai`] for more details.
13642    pub fn connect_to_dai_sync(&self) -> Result<DaiSynchronousProxy, fidl::Error> {
13643        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiMarker>();
13644        self.connect_channel_to_dai(server_end)?;
13645        Ok(proxy)
13646    }
13647
13648    /// Like `connect_to_dai`, but accepts a server end.
13649    /// See [`Self::connect_to_dai`] for more details.
13650    pub fn connect_channel_to_dai(
13651        &self,
13652        server_end: fidl::endpoints::ServerEnd<DaiMarker>,
13653    ) -> Result<(), fidl::Error> {
13654        self.0.open_member("dai", server_end.into_channel())
13655    }
13656
13657    pub fn instance_name(&self) -> &str {
13658        self.0.instance_name()
13659    }
13660}
13661
13662#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13663pub struct DeviceServiceMarker;
13664
13665#[cfg(target_os = "fuchsia")]
13666impl fidl::endpoints::ServiceMarker for DeviceServiceMarker {
13667    type Proxy = DeviceServiceProxy;
13668    type Request = DeviceServiceRequest;
13669    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DeviceService";
13670}
13671
13672/// A request for one of the member protocols of DeviceService.
13673///
13674#[cfg(target_os = "fuchsia")]
13675pub enum DeviceServiceRequest {
13676    Device(CompositeRequestStream),
13677}
13678
13679#[cfg(target_os = "fuchsia")]
13680impl fidl::endpoints::ServiceRequest for DeviceServiceRequest {
13681    type Service = DeviceServiceMarker;
13682
13683    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13684        match name {
13685            "device" => Self::Device(
13686                <CompositeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13687            ),
13688            _ => panic!("no such member protocol name for service DeviceService"),
13689        }
13690    }
13691
13692    fn member_names() -> &'static [&'static str] {
13693        &["device"]
13694    }
13695}
13696#[cfg(target_os = "fuchsia")]
13697pub struct DeviceServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13698
13699#[cfg(target_os = "fuchsia")]
13700impl fidl::endpoints::ServiceProxy for DeviceServiceProxy {
13701    type Service = DeviceServiceMarker;
13702
13703    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13704        Self(opener)
13705    }
13706}
13707
13708#[cfg(target_os = "fuchsia")]
13709impl DeviceServiceProxy {
13710    pub fn connect_to_device(&self) -> Result<CompositeProxy, fidl::Error> {
13711        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeMarker>();
13712        self.connect_channel_to_device(server_end)?;
13713        Ok(proxy)
13714    }
13715
13716    /// Like `connect_to_device`, but returns a sync proxy.
13717    /// See [`Self::connect_to_device`] for more details.
13718    pub fn connect_to_device_sync(&self) -> Result<CompositeSynchronousProxy, fidl::Error> {
13719        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeMarker>();
13720        self.connect_channel_to_device(server_end)?;
13721        Ok(proxy)
13722    }
13723
13724    /// Like `connect_to_device`, but accepts a server end.
13725    /// See [`Self::connect_to_device`] for more details.
13726    pub fn connect_channel_to_device(
13727        &self,
13728        server_end: fidl::endpoints::ServerEnd<CompositeMarker>,
13729    ) -> Result<(), fidl::Error> {
13730        self.0.open_member("device", server_end.into_channel())
13731    }
13732
13733    pub fn instance_name(&self) -> &str {
13734        self.0.instance_name()
13735    }
13736}
13737
13738#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13739pub struct StreamConfigConnectorInputServiceMarker;
13740
13741#[cfg(target_os = "fuchsia")]
13742impl fidl::endpoints::ServiceMarker for StreamConfigConnectorInputServiceMarker {
13743    type Proxy = StreamConfigConnectorInputServiceProxy;
13744    type Request = StreamConfigConnectorInputServiceRequest;
13745    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorInputService";
13746}
13747
13748/// A request for one of the member protocols of StreamConfigConnectorInputService.
13749///
13750#[cfg(target_os = "fuchsia")]
13751pub enum StreamConfigConnectorInputServiceRequest {
13752    StreamConfigConnector(StreamConfigConnectorRequestStream),
13753}
13754
13755#[cfg(target_os = "fuchsia")]
13756impl fidl::endpoints::ServiceRequest for StreamConfigConnectorInputServiceRequest {
13757    type Service = StreamConfigConnectorInputServiceMarker;
13758
13759    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13760        match name {
13761            "stream_config_connector" => Self::StreamConfigConnector(
13762                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13763            ),
13764            _ => panic!("no such member protocol name for service StreamConfigConnectorInputService"),
13765        }
13766    }
13767
13768    fn member_names() -> &'static [&'static str] {
13769        &["stream_config_connector"]
13770    }
13771}
13772#[cfg(target_os = "fuchsia")]
13773pub struct StreamConfigConnectorInputServiceProxy(
13774    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13775);
13776
13777#[cfg(target_os = "fuchsia")]
13778impl fidl::endpoints::ServiceProxy for StreamConfigConnectorInputServiceProxy {
13779    type Service = StreamConfigConnectorInputServiceMarker;
13780
13781    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13782        Self(opener)
13783    }
13784}
13785
13786#[cfg(target_os = "fuchsia")]
13787impl StreamConfigConnectorInputServiceProxy {
13788    pub fn connect_to_stream_config_connector(
13789        &self,
13790    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13791        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13792        self.connect_channel_to_stream_config_connector(server_end)?;
13793        Ok(proxy)
13794    }
13795
13796    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13797    /// See [`Self::connect_to_stream_config_connector`] for more details.
13798    pub fn connect_to_stream_config_connector_sync(
13799        &self,
13800    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13801        let (proxy, server_end) =
13802            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13803        self.connect_channel_to_stream_config_connector(server_end)?;
13804        Ok(proxy)
13805    }
13806
13807    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13808    /// See [`Self::connect_to_stream_config_connector`] for more details.
13809    pub fn connect_channel_to_stream_config_connector(
13810        &self,
13811        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13812    ) -> Result<(), fidl::Error> {
13813        self.0.open_member("stream_config_connector", server_end.into_channel())
13814    }
13815
13816    pub fn instance_name(&self) -> &str {
13817        self.0.instance_name()
13818    }
13819}
13820
13821#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13822pub struct StreamConfigConnectorOutputServiceMarker;
13823
13824#[cfg(target_os = "fuchsia")]
13825impl fidl::endpoints::ServiceMarker for StreamConfigConnectorOutputServiceMarker {
13826    type Proxy = StreamConfigConnectorOutputServiceProxy;
13827    type Request = StreamConfigConnectorOutputServiceRequest;
13828    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorOutputService";
13829}
13830
13831/// A request for one of the member protocols of StreamConfigConnectorOutputService.
13832///
13833#[cfg(target_os = "fuchsia")]
13834pub enum StreamConfigConnectorOutputServiceRequest {
13835    StreamConfigConnector(StreamConfigConnectorRequestStream),
13836}
13837
13838#[cfg(target_os = "fuchsia")]
13839impl fidl::endpoints::ServiceRequest for StreamConfigConnectorOutputServiceRequest {
13840    type Service = StreamConfigConnectorOutputServiceMarker;
13841
13842    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13843        match name {
13844            "stream_config_connector" => Self::StreamConfigConnector(
13845                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13846            ),
13847            _ => panic!("no such member protocol name for service StreamConfigConnectorOutputService"),
13848        }
13849    }
13850
13851    fn member_names() -> &'static [&'static str] {
13852        &["stream_config_connector"]
13853    }
13854}
13855#[cfg(target_os = "fuchsia")]
13856pub struct StreamConfigConnectorOutputServiceProxy(
13857    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13858);
13859
13860#[cfg(target_os = "fuchsia")]
13861impl fidl::endpoints::ServiceProxy for StreamConfigConnectorOutputServiceProxy {
13862    type Service = StreamConfigConnectorOutputServiceMarker;
13863
13864    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13865        Self(opener)
13866    }
13867}
13868
13869#[cfg(target_os = "fuchsia")]
13870impl StreamConfigConnectorOutputServiceProxy {
13871    pub fn connect_to_stream_config_connector(
13872        &self,
13873    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13874        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13875        self.connect_channel_to_stream_config_connector(server_end)?;
13876        Ok(proxy)
13877    }
13878
13879    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13880    /// See [`Self::connect_to_stream_config_connector`] for more details.
13881    pub fn connect_to_stream_config_connector_sync(
13882        &self,
13883    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13884        let (proxy, server_end) =
13885            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13886        self.connect_channel_to_stream_config_connector(server_end)?;
13887        Ok(proxy)
13888    }
13889
13890    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13891    /// See [`Self::connect_to_stream_config_connector`] for more details.
13892    pub fn connect_channel_to_stream_config_connector(
13893        &self,
13894        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13895    ) -> Result<(), fidl::Error> {
13896        self.0.open_member("stream_config_connector", server_end.into_channel())
13897    }
13898
13899    pub fn instance_name(&self) -> &str {
13900        self.0.instance_name()
13901    }
13902}
13903
13904#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13905pub struct StreamConfigConnectorServiceMarker;
13906
13907#[cfg(target_os = "fuchsia")]
13908impl fidl::endpoints::ServiceMarker for StreamConfigConnectorServiceMarker {
13909    type Proxy = StreamConfigConnectorServiceProxy;
13910    type Request = StreamConfigConnectorServiceRequest;
13911    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorService";
13912}
13913
13914/// A request for one of the member protocols of StreamConfigConnectorService.
13915///
13916/// # Deprecation
13917///
13918/// Not supported anymore, instead use an
13919/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13920/// with one Ring Buffer, see
13921/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13922#[cfg(target_os = "fuchsia")]
13923pub enum StreamConfigConnectorServiceRequest {
13924    StreamConfigConnector(StreamConfigConnectorRequestStream),
13925}
13926
13927#[cfg(target_os = "fuchsia")]
13928impl fidl::endpoints::ServiceRequest for StreamConfigConnectorServiceRequest {
13929    type Service = StreamConfigConnectorServiceMarker;
13930
13931    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13932        match name {
13933            "stream_config_connector" => Self::StreamConfigConnector(
13934                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13935            ),
13936            _ => panic!("no such member protocol name for service StreamConfigConnectorService"),
13937        }
13938    }
13939
13940    fn member_names() -> &'static [&'static str] {
13941        &["stream_config_connector"]
13942    }
13943}
13944/// # Deprecation
13945///
13946/// Not supported anymore, instead use an
13947/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13948/// with one Ring Buffer, see
13949/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13950#[cfg(target_os = "fuchsia")]
13951pub struct StreamConfigConnectorServiceProxy(
13952    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13953);
13954
13955#[cfg(target_os = "fuchsia")]
13956impl fidl::endpoints::ServiceProxy for StreamConfigConnectorServiceProxy {
13957    type Service = StreamConfigConnectorServiceMarker;
13958
13959    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13960        Self(opener)
13961    }
13962}
13963
13964#[cfg(target_os = "fuchsia")]
13965impl StreamConfigConnectorServiceProxy {
13966    pub fn connect_to_stream_config_connector(
13967        &self,
13968    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13969        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13970        self.connect_channel_to_stream_config_connector(server_end)?;
13971        Ok(proxy)
13972    }
13973
13974    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13975    /// See [`Self::connect_to_stream_config_connector`] for more details.
13976    pub fn connect_to_stream_config_connector_sync(
13977        &self,
13978    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13979        let (proxy, server_end) =
13980            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13981        self.connect_channel_to_stream_config_connector(server_end)?;
13982        Ok(proxy)
13983    }
13984
13985    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13986    /// See [`Self::connect_to_stream_config_connector`] for more details.
13987    pub fn connect_channel_to_stream_config_connector(
13988        &self,
13989        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13990    ) -> Result<(), fidl::Error> {
13991        self.0.open_member("stream_config_connector", server_end.into_channel())
13992    }
13993
13994    pub fn instance_name(&self) -> &str {
13995        self.0.instance_name()
13996    }
13997}
13998
13999#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
14000pub struct StreamConfigServiceMarker;
14001
14002#[cfg(target_os = "fuchsia")]
14003impl fidl::endpoints::ServiceMarker for StreamConfigServiceMarker {
14004    type Proxy = StreamConfigServiceProxy;
14005    type Request = StreamConfigServiceRequest;
14006    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigService";
14007}
14008
14009/// A request for one of the member protocols of StreamConfigService.
14010///
14011/// # Deprecation
14012///
14013/// Not supported anymore, instead use an
14014/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
14015/// with one Ring Buffer, see
14016/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
14017#[cfg(target_os = "fuchsia")]
14018pub enum StreamConfigServiceRequest {
14019    StreamConfig(StreamConfigRequestStream),
14020}
14021
14022#[cfg(target_os = "fuchsia")]
14023impl fidl::endpoints::ServiceRequest for StreamConfigServiceRequest {
14024    type Service = StreamConfigServiceMarker;
14025
14026    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
14027        match name {
14028            "stream_config" => Self::StreamConfig(
14029                <StreamConfigRequestStream as fidl::endpoints::RequestStream>::from_channel(
14030                    _channel,
14031                ),
14032            ),
14033            _ => panic!("no such member protocol name for service StreamConfigService"),
14034        }
14035    }
14036
14037    fn member_names() -> &'static [&'static str] {
14038        &["stream_config"]
14039    }
14040}
14041/// # Deprecation
14042///
14043/// Not supported anymore, instead use an
14044/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
14045/// with one Ring Buffer, see
14046/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
14047#[cfg(target_os = "fuchsia")]
14048pub struct StreamConfigServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
14049
14050#[cfg(target_os = "fuchsia")]
14051impl fidl::endpoints::ServiceProxy for StreamConfigServiceProxy {
14052    type Service = StreamConfigServiceMarker;
14053
14054    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
14055        Self(opener)
14056    }
14057}
14058
14059#[cfg(target_os = "fuchsia")]
14060impl StreamConfigServiceProxy {
14061    pub fn connect_to_stream_config(&self) -> Result<StreamConfigProxy, fidl::Error> {
14062        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigMarker>();
14063        self.connect_channel_to_stream_config(server_end)?;
14064        Ok(proxy)
14065    }
14066
14067    /// Like `connect_to_stream_config`, but returns a sync proxy.
14068    /// See [`Self::connect_to_stream_config`] for more details.
14069    pub fn connect_to_stream_config_sync(
14070        &self,
14071    ) -> Result<StreamConfigSynchronousProxy, fidl::Error> {
14072        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<StreamConfigMarker>();
14073        self.connect_channel_to_stream_config(server_end)?;
14074        Ok(proxy)
14075    }
14076
14077    /// Like `connect_to_stream_config`, but accepts a server end.
14078    /// See [`Self::connect_to_stream_config`] for more details.
14079    pub fn connect_channel_to_stream_config(
14080        &self,
14081        server_end: fidl::endpoints::ServerEnd<StreamConfigMarker>,
14082    ) -> Result<(), fidl::Error> {
14083        self.0.open_member("stream_config", server_end.into_channel())
14084    }
14085
14086    pub fn instance_name(&self) -> &str {
14087        self.0.instance_name()
14088    }
14089}
14090
14091mod internal {
14092    use super::*;
14093
14094    impl fidl::encoding::ResourceTypeMarker for CodecConnectorConnectRequest {
14095        type Borrowed<'a> = &'a mut Self;
14096        fn take_or_borrow<'a>(
14097            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14098        ) -> Self::Borrowed<'a> {
14099            value
14100        }
14101    }
14102
14103    unsafe impl fidl::encoding::TypeMarker for CodecConnectorConnectRequest {
14104        type Owned = Self;
14105
14106        #[inline(always)]
14107        fn inline_align(_context: fidl::encoding::Context) -> usize {
14108            4
14109        }
14110
14111        #[inline(always)]
14112        fn inline_size(_context: fidl::encoding::Context) -> usize {
14113            4
14114        }
14115    }
14116
14117    unsafe impl
14118        fidl::encoding::Encode<
14119            CodecConnectorConnectRequest,
14120            fidl::encoding::DefaultFuchsiaResourceDialect,
14121        > for &mut CodecConnectorConnectRequest
14122    {
14123        #[inline]
14124        unsafe fn encode(
14125            self,
14126            encoder: &mut fidl::encoding::Encoder<
14127                '_,
14128                fidl::encoding::DefaultFuchsiaResourceDialect,
14129            >,
14130            offset: usize,
14131            _depth: fidl::encoding::Depth,
14132        ) -> fidl::Result<()> {
14133            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
14134            // Delegate to tuple encoding.
14135            fidl::encoding::Encode::<CodecConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14136                (
14137                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.codec_protocol),
14138                ),
14139                encoder, offset, _depth
14140            )
14141        }
14142    }
14143    unsafe impl<
14144        T0: fidl::encoding::Encode<
14145                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14146                fidl::encoding::DefaultFuchsiaResourceDialect,
14147            >,
14148    >
14149        fidl::encoding::Encode<
14150            CodecConnectorConnectRequest,
14151            fidl::encoding::DefaultFuchsiaResourceDialect,
14152        > for (T0,)
14153    {
14154        #[inline]
14155        unsafe fn encode(
14156            self,
14157            encoder: &mut fidl::encoding::Encoder<
14158                '_,
14159                fidl::encoding::DefaultFuchsiaResourceDialect,
14160            >,
14161            offset: usize,
14162            depth: fidl::encoding::Depth,
14163        ) -> fidl::Result<()> {
14164            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
14165            // Zero out padding regions. There's no need to apply masks
14166            // because the unmasked parts will be overwritten by fields.
14167            // Write the fields.
14168            self.0.encode(encoder, offset + 0, depth)?;
14169            Ok(())
14170        }
14171    }
14172
14173    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14174        for CodecConnectorConnectRequest
14175    {
14176        #[inline(always)]
14177        fn new_empty() -> Self {
14178            Self {
14179                codec_protocol: fidl::new_empty!(
14180                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14181                    fidl::encoding::DefaultFuchsiaResourceDialect
14182                ),
14183            }
14184        }
14185
14186        #[inline]
14187        unsafe fn decode(
14188            &mut self,
14189            decoder: &mut fidl::encoding::Decoder<
14190                '_,
14191                fidl::encoding::DefaultFuchsiaResourceDialect,
14192            >,
14193            offset: usize,
14194            _depth: fidl::encoding::Depth,
14195        ) -> fidl::Result<()> {
14196            decoder.debug_check_bounds::<Self>(offset);
14197            // Verify that padding bytes are zero.
14198            fidl::decode!(
14199                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14200                fidl::encoding::DefaultFuchsiaResourceDialect,
14201                &mut self.codec_protocol,
14202                decoder,
14203                offset + 0,
14204                _depth
14205            )?;
14206            Ok(())
14207        }
14208    }
14209
14210    impl fidl::encoding::ResourceTypeMarker for CompositeConnectorConnectRequest {
14211        type Borrowed<'a> = &'a mut Self;
14212        fn take_or_borrow<'a>(
14213            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14214        ) -> Self::Borrowed<'a> {
14215            value
14216        }
14217    }
14218
14219    unsafe impl fidl::encoding::TypeMarker for CompositeConnectorConnectRequest {
14220        type Owned = Self;
14221
14222        #[inline(always)]
14223        fn inline_align(_context: fidl::encoding::Context) -> usize {
14224            4
14225        }
14226
14227        #[inline(always)]
14228        fn inline_size(_context: fidl::encoding::Context) -> usize {
14229            4
14230        }
14231    }
14232
14233    unsafe impl
14234        fidl::encoding::Encode<
14235            CompositeConnectorConnectRequest,
14236            fidl::encoding::DefaultFuchsiaResourceDialect,
14237        > for &mut CompositeConnectorConnectRequest
14238    {
14239        #[inline]
14240        unsafe fn encode(
14241            self,
14242            encoder: &mut fidl::encoding::Encoder<
14243                '_,
14244                fidl::encoding::DefaultFuchsiaResourceDialect,
14245            >,
14246            offset: usize,
14247            _depth: fidl::encoding::Depth,
14248        ) -> fidl::Result<()> {
14249            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
14250            // Delegate to tuple encoding.
14251            fidl::encoding::Encode::<CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14252                (
14253                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.composite_protocol),
14254                ),
14255                encoder, offset, _depth
14256            )
14257        }
14258    }
14259    unsafe impl<
14260        T0: fidl::encoding::Encode<
14261                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14262                fidl::encoding::DefaultFuchsiaResourceDialect,
14263            >,
14264    >
14265        fidl::encoding::Encode<
14266            CompositeConnectorConnectRequest,
14267            fidl::encoding::DefaultFuchsiaResourceDialect,
14268        > for (T0,)
14269    {
14270        #[inline]
14271        unsafe fn encode(
14272            self,
14273            encoder: &mut fidl::encoding::Encoder<
14274                '_,
14275                fidl::encoding::DefaultFuchsiaResourceDialect,
14276            >,
14277            offset: usize,
14278            depth: fidl::encoding::Depth,
14279        ) -> fidl::Result<()> {
14280            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
14281            // Zero out padding regions. There's no need to apply masks
14282            // because the unmasked parts will be overwritten by fields.
14283            // Write the fields.
14284            self.0.encode(encoder, offset + 0, depth)?;
14285            Ok(())
14286        }
14287    }
14288
14289    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14290        for CompositeConnectorConnectRequest
14291    {
14292        #[inline(always)]
14293        fn new_empty() -> Self {
14294            Self {
14295                composite_protocol: fidl::new_empty!(
14296                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14297                    fidl::encoding::DefaultFuchsiaResourceDialect
14298                ),
14299            }
14300        }
14301
14302        #[inline]
14303        unsafe fn decode(
14304            &mut self,
14305            decoder: &mut fidl::encoding::Decoder<
14306                '_,
14307                fidl::encoding::DefaultFuchsiaResourceDialect,
14308            >,
14309            offset: usize,
14310            _depth: fidl::encoding::Depth,
14311        ) -> fidl::Result<()> {
14312            decoder.debug_check_bounds::<Self>(offset);
14313            // Verify that padding bytes are zero.
14314            fidl::decode!(
14315                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14316                fidl::encoding::DefaultFuchsiaResourceDialect,
14317                &mut self.composite_protocol,
14318                decoder,
14319                offset + 0,
14320                _depth
14321            )?;
14322            Ok(())
14323        }
14324    }
14325
14326    impl fidl::encoding::ResourceTypeMarker for CompositeCreatePacketStreamRequest {
14327        type Borrowed<'a> = &'a mut Self;
14328        fn take_or_borrow<'a>(
14329            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14330        ) -> Self::Borrowed<'a> {
14331            value
14332        }
14333    }
14334
14335    unsafe impl fidl::encoding::TypeMarker for CompositeCreatePacketStreamRequest {
14336        type Owned = Self;
14337
14338        #[inline(always)]
14339        fn inline_align(_context: fidl::encoding::Context) -> usize {
14340            8
14341        }
14342
14343        #[inline(always)]
14344        fn inline_size(_context: fidl::encoding::Context) -> usize {
14345            32
14346        }
14347    }
14348
14349    unsafe impl
14350        fidl::encoding::Encode<
14351            CompositeCreatePacketStreamRequest,
14352            fidl::encoding::DefaultFuchsiaResourceDialect,
14353        > for &mut CompositeCreatePacketStreamRequest
14354    {
14355        #[inline]
14356        unsafe fn encode(
14357            self,
14358            encoder: &mut fidl::encoding::Encoder<
14359                '_,
14360                fidl::encoding::DefaultFuchsiaResourceDialect,
14361            >,
14362            offset: usize,
14363            _depth: fidl::encoding::Depth,
14364        ) -> fidl::Result<()> {
14365            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
14366            // Delegate to tuple encoding.
14367            fidl::encoding::Encode::<CompositeCreatePacketStreamRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14368                (
14369                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
14370                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
14371                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.packet_stream_control),
14372                ),
14373                encoder, offset, _depth
14374            )
14375        }
14376    }
14377    unsafe impl<
14378        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
14379        T1: fidl::encoding::Encode<Format2, fidl::encoding::DefaultFuchsiaResourceDialect>,
14380        T2: fidl::encoding::Encode<
14381                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14382                fidl::encoding::DefaultFuchsiaResourceDialect,
14383            >,
14384    >
14385        fidl::encoding::Encode<
14386            CompositeCreatePacketStreamRequest,
14387            fidl::encoding::DefaultFuchsiaResourceDialect,
14388        > for (T0, T1, T2)
14389    {
14390        #[inline]
14391        unsafe fn encode(
14392            self,
14393            encoder: &mut fidl::encoding::Encoder<
14394                '_,
14395                fidl::encoding::DefaultFuchsiaResourceDialect,
14396            >,
14397            offset: usize,
14398            depth: fidl::encoding::Depth,
14399        ) -> fidl::Result<()> {
14400            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
14401            // Zero out padding regions. There's no need to apply masks
14402            // because the unmasked parts will be overwritten by fields.
14403            unsafe {
14404                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
14405                (ptr as *mut u64).write_unaligned(0);
14406            }
14407            // Write the fields.
14408            self.0.encode(encoder, offset + 0, depth)?;
14409            self.1.encode(encoder, offset + 8, depth)?;
14410            self.2.encode(encoder, offset + 24, depth)?;
14411            Ok(())
14412        }
14413    }
14414
14415    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14416        for CompositeCreatePacketStreamRequest
14417    {
14418        #[inline(always)]
14419        fn new_empty() -> Self {
14420            Self {
14421                processing_element_id: fidl::new_empty!(
14422                    u64,
14423                    fidl::encoding::DefaultFuchsiaResourceDialect
14424                ),
14425                format: fidl::new_empty!(Format2, fidl::encoding::DefaultFuchsiaResourceDialect),
14426                packet_stream_control: fidl::new_empty!(
14427                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14428                    fidl::encoding::DefaultFuchsiaResourceDialect
14429                ),
14430            }
14431        }
14432
14433        #[inline]
14434        unsafe fn decode(
14435            &mut self,
14436            decoder: &mut fidl::encoding::Decoder<
14437                '_,
14438                fidl::encoding::DefaultFuchsiaResourceDialect,
14439            >,
14440            offset: usize,
14441            _depth: fidl::encoding::Depth,
14442        ) -> fidl::Result<()> {
14443            decoder.debug_check_bounds::<Self>(offset);
14444            // Verify that padding bytes are zero.
14445            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
14446            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14447            let mask = 0xffffffff00000000u64;
14448            let maskedval = padval & mask;
14449            if maskedval != 0 {
14450                return Err(fidl::Error::NonZeroPadding {
14451                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
14452                });
14453            }
14454            fidl::decode!(
14455                u64,
14456                fidl::encoding::DefaultFuchsiaResourceDialect,
14457                &mut self.processing_element_id,
14458                decoder,
14459                offset + 0,
14460                _depth
14461            )?;
14462            fidl::decode!(
14463                Format2,
14464                fidl::encoding::DefaultFuchsiaResourceDialect,
14465                &mut self.format,
14466                decoder,
14467                offset + 8,
14468                _depth
14469            )?;
14470            fidl::decode!(
14471                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14472                fidl::encoding::DefaultFuchsiaResourceDialect,
14473                &mut self.packet_stream_control,
14474                decoder,
14475                offset + 24,
14476                _depth
14477            )?;
14478            Ok(())
14479        }
14480    }
14481
14482    impl fidl::encoding::ResourceTypeMarker for CompositeCreateRingBufferRequest {
14483        type Borrowed<'a> = &'a mut Self;
14484        fn take_or_borrow<'a>(
14485            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14486        ) -> Self::Borrowed<'a> {
14487            value
14488        }
14489    }
14490
14491    unsafe impl fidl::encoding::TypeMarker for CompositeCreateRingBufferRequest {
14492        type Owned = Self;
14493
14494        #[inline(always)]
14495        fn inline_align(_context: fidl::encoding::Context) -> usize {
14496            8
14497        }
14498
14499        #[inline(always)]
14500        fn inline_size(_context: fidl::encoding::Context) -> usize {
14501            32
14502        }
14503    }
14504
14505    unsafe impl
14506        fidl::encoding::Encode<
14507            CompositeCreateRingBufferRequest,
14508            fidl::encoding::DefaultFuchsiaResourceDialect,
14509        > for &mut CompositeCreateRingBufferRequest
14510    {
14511        #[inline]
14512        unsafe fn encode(
14513            self,
14514            encoder: &mut fidl::encoding::Encoder<
14515                '_,
14516                fidl::encoding::DefaultFuchsiaResourceDialect,
14517            >,
14518            offset: usize,
14519            _depth: fidl::encoding::Depth,
14520        ) -> fidl::Result<()> {
14521            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
14522            // Delegate to tuple encoding.
14523            fidl::encoding::Encode::<CompositeCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14524                (
14525                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
14526                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
14527                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
14528                ),
14529                encoder, offset, _depth
14530            )
14531        }
14532    }
14533    unsafe impl<
14534        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
14535        T1: fidl::encoding::Encode<Format2, fidl::encoding::DefaultFuchsiaResourceDialect>,
14536        T2: fidl::encoding::Encode<
14537                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14538                fidl::encoding::DefaultFuchsiaResourceDialect,
14539            >,
14540    >
14541        fidl::encoding::Encode<
14542            CompositeCreateRingBufferRequest,
14543            fidl::encoding::DefaultFuchsiaResourceDialect,
14544        > for (T0, T1, T2)
14545    {
14546        #[inline]
14547        unsafe fn encode(
14548            self,
14549            encoder: &mut fidl::encoding::Encoder<
14550                '_,
14551                fidl::encoding::DefaultFuchsiaResourceDialect,
14552            >,
14553            offset: usize,
14554            depth: fidl::encoding::Depth,
14555        ) -> fidl::Result<()> {
14556            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
14557            // Zero out padding regions. There's no need to apply masks
14558            // because the unmasked parts will be overwritten by fields.
14559            unsafe {
14560                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
14561                (ptr as *mut u64).write_unaligned(0);
14562            }
14563            // Write the fields.
14564            self.0.encode(encoder, offset + 0, depth)?;
14565            self.1.encode(encoder, offset + 8, depth)?;
14566            self.2.encode(encoder, offset + 24, depth)?;
14567            Ok(())
14568        }
14569    }
14570
14571    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14572        for CompositeCreateRingBufferRequest
14573    {
14574        #[inline(always)]
14575        fn new_empty() -> Self {
14576            Self {
14577                processing_element_id: fidl::new_empty!(
14578                    u64,
14579                    fidl::encoding::DefaultFuchsiaResourceDialect
14580                ),
14581                format: fidl::new_empty!(Format2, fidl::encoding::DefaultFuchsiaResourceDialect),
14582                ring_buffer: fidl::new_empty!(
14583                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14584                    fidl::encoding::DefaultFuchsiaResourceDialect
14585                ),
14586            }
14587        }
14588
14589        #[inline]
14590        unsafe fn decode(
14591            &mut self,
14592            decoder: &mut fidl::encoding::Decoder<
14593                '_,
14594                fidl::encoding::DefaultFuchsiaResourceDialect,
14595            >,
14596            offset: usize,
14597            _depth: fidl::encoding::Depth,
14598        ) -> fidl::Result<()> {
14599            decoder.debug_check_bounds::<Self>(offset);
14600            // Verify that padding bytes are zero.
14601            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
14602            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14603            let mask = 0xffffffff00000000u64;
14604            let maskedval = padval & mask;
14605            if maskedval != 0 {
14606                return Err(fidl::Error::NonZeroPadding {
14607                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
14608                });
14609            }
14610            fidl::decode!(
14611                u64,
14612                fidl::encoding::DefaultFuchsiaResourceDialect,
14613                &mut self.processing_element_id,
14614                decoder,
14615                offset + 0,
14616                _depth
14617            )?;
14618            fidl::decode!(
14619                Format2,
14620                fidl::encoding::DefaultFuchsiaResourceDialect,
14621                &mut self.format,
14622                decoder,
14623                offset + 8,
14624                _depth
14625            )?;
14626            fidl::decode!(
14627                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14628                fidl::encoding::DefaultFuchsiaResourceDialect,
14629                &mut self.ring_buffer,
14630                decoder,
14631                offset + 24,
14632                _depth
14633            )?;
14634            Ok(())
14635        }
14636    }
14637
14638    impl fidl::encoding::ResourceTypeMarker for DaiConnectorConnectRequest {
14639        type Borrowed<'a> = &'a mut Self;
14640        fn take_or_borrow<'a>(
14641            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14642        ) -> Self::Borrowed<'a> {
14643            value
14644        }
14645    }
14646
14647    unsafe impl fidl::encoding::TypeMarker for DaiConnectorConnectRequest {
14648        type Owned = Self;
14649
14650        #[inline(always)]
14651        fn inline_align(_context: fidl::encoding::Context) -> usize {
14652            4
14653        }
14654
14655        #[inline(always)]
14656        fn inline_size(_context: fidl::encoding::Context) -> usize {
14657            4
14658        }
14659    }
14660
14661    unsafe impl
14662        fidl::encoding::Encode<
14663            DaiConnectorConnectRequest,
14664            fidl::encoding::DefaultFuchsiaResourceDialect,
14665        > for &mut DaiConnectorConnectRequest
14666    {
14667        #[inline]
14668        unsafe fn encode(
14669            self,
14670            encoder: &mut fidl::encoding::Encoder<
14671                '_,
14672                fidl::encoding::DefaultFuchsiaResourceDialect,
14673            >,
14674            offset: usize,
14675            _depth: fidl::encoding::Depth,
14676        ) -> fidl::Result<()> {
14677            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
14678            // Delegate to tuple encoding.
14679            fidl::encoding::Encode::<DaiConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14680                (
14681                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dai_protocol),
14682                ),
14683                encoder, offset, _depth
14684            )
14685        }
14686    }
14687    unsafe impl<
14688        T0: fidl::encoding::Encode<
14689                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14690                fidl::encoding::DefaultFuchsiaResourceDialect,
14691            >,
14692    >
14693        fidl::encoding::Encode<
14694            DaiConnectorConnectRequest,
14695            fidl::encoding::DefaultFuchsiaResourceDialect,
14696        > for (T0,)
14697    {
14698        #[inline]
14699        unsafe fn encode(
14700            self,
14701            encoder: &mut fidl::encoding::Encoder<
14702                '_,
14703                fidl::encoding::DefaultFuchsiaResourceDialect,
14704            >,
14705            offset: usize,
14706            depth: fidl::encoding::Depth,
14707        ) -> fidl::Result<()> {
14708            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
14709            // Zero out padding regions. There's no need to apply masks
14710            // because the unmasked parts will be overwritten by fields.
14711            // Write the fields.
14712            self.0.encode(encoder, offset + 0, depth)?;
14713            Ok(())
14714        }
14715    }
14716
14717    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14718        for DaiConnectorConnectRequest
14719    {
14720        #[inline(always)]
14721        fn new_empty() -> Self {
14722            Self {
14723                dai_protocol: fidl::new_empty!(
14724                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14725                    fidl::encoding::DefaultFuchsiaResourceDialect
14726                ),
14727            }
14728        }
14729
14730        #[inline]
14731        unsafe fn decode(
14732            &mut self,
14733            decoder: &mut fidl::encoding::Decoder<
14734                '_,
14735                fidl::encoding::DefaultFuchsiaResourceDialect,
14736            >,
14737            offset: usize,
14738            _depth: fidl::encoding::Depth,
14739        ) -> fidl::Result<()> {
14740            decoder.debug_check_bounds::<Self>(offset);
14741            // Verify that padding bytes are zero.
14742            fidl::decode!(
14743                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14744                fidl::encoding::DefaultFuchsiaResourceDialect,
14745                &mut self.dai_protocol,
14746                decoder,
14747                offset + 0,
14748                _depth
14749            )?;
14750            Ok(())
14751        }
14752    }
14753
14754    impl fidl::encoding::ResourceTypeMarker for DaiCreateRingBufferRequest {
14755        type Borrowed<'a> = &'a mut Self;
14756        fn take_or_borrow<'a>(
14757            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14758        ) -> Self::Borrowed<'a> {
14759            value
14760        }
14761    }
14762
14763    unsafe impl fidl::encoding::TypeMarker for DaiCreateRingBufferRequest {
14764        type Owned = Self;
14765
14766        #[inline(always)]
14767        fn inline_align(_context: fidl::encoding::Context) -> usize {
14768            8
14769        }
14770
14771        #[inline(always)]
14772        fn inline_size(_context: fidl::encoding::Context) -> usize {
14773            72
14774        }
14775    }
14776
14777    unsafe impl
14778        fidl::encoding::Encode<
14779            DaiCreateRingBufferRequest,
14780            fidl::encoding::DefaultFuchsiaResourceDialect,
14781        > for &mut DaiCreateRingBufferRequest
14782    {
14783        #[inline]
14784        unsafe fn encode(
14785            self,
14786            encoder: &mut fidl::encoding::Encoder<
14787                '_,
14788                fidl::encoding::DefaultFuchsiaResourceDialect,
14789            >,
14790            offset: usize,
14791            _depth: fidl::encoding::Depth,
14792        ) -> fidl::Result<()> {
14793            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
14794            // Delegate to tuple encoding.
14795            fidl::encoding::Encode::<DaiCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14796                (
14797                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_format),
14798                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_format),
14799                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
14800                ),
14801                encoder, offset, _depth
14802            )
14803        }
14804    }
14805    unsafe impl<
14806        T0: fidl::encoding::Encode<DaiFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
14807        T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
14808        T2: fidl::encoding::Encode<
14809                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14810                fidl::encoding::DefaultFuchsiaResourceDialect,
14811            >,
14812    >
14813        fidl::encoding::Encode<
14814            DaiCreateRingBufferRequest,
14815            fidl::encoding::DefaultFuchsiaResourceDialect,
14816        > for (T0, T1, T2)
14817    {
14818        #[inline]
14819        unsafe fn encode(
14820            self,
14821            encoder: &mut fidl::encoding::Encoder<
14822                '_,
14823                fidl::encoding::DefaultFuchsiaResourceDialect,
14824            >,
14825            offset: usize,
14826            depth: fidl::encoding::Depth,
14827        ) -> fidl::Result<()> {
14828            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
14829            // Zero out padding regions. There's no need to apply masks
14830            // because the unmasked parts will be overwritten by fields.
14831            unsafe {
14832                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
14833                (ptr as *mut u64).write_unaligned(0);
14834            }
14835            // Write the fields.
14836            self.0.encode(encoder, offset + 0, depth)?;
14837            self.1.encode(encoder, offset + 48, depth)?;
14838            self.2.encode(encoder, offset + 64, depth)?;
14839            Ok(())
14840        }
14841    }
14842
14843    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14844        for DaiCreateRingBufferRequest
14845    {
14846        #[inline(always)]
14847        fn new_empty() -> Self {
14848            Self {
14849                dai_format: fidl::new_empty!(
14850                    DaiFormat,
14851                    fidl::encoding::DefaultFuchsiaResourceDialect
14852                ),
14853                ring_buffer_format: fidl::new_empty!(
14854                    Format,
14855                    fidl::encoding::DefaultFuchsiaResourceDialect
14856                ),
14857                ring_buffer: fidl::new_empty!(
14858                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14859                    fidl::encoding::DefaultFuchsiaResourceDialect
14860                ),
14861            }
14862        }
14863
14864        #[inline]
14865        unsafe fn decode(
14866            &mut self,
14867            decoder: &mut fidl::encoding::Decoder<
14868                '_,
14869                fidl::encoding::DefaultFuchsiaResourceDialect,
14870            >,
14871            offset: usize,
14872            _depth: fidl::encoding::Depth,
14873        ) -> fidl::Result<()> {
14874            decoder.debug_check_bounds::<Self>(offset);
14875            // Verify that padding bytes are zero.
14876            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
14877            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14878            let mask = 0xffffffff00000000u64;
14879            let maskedval = padval & mask;
14880            if maskedval != 0 {
14881                return Err(fidl::Error::NonZeroPadding {
14882                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
14883                });
14884            }
14885            fidl::decode!(
14886                DaiFormat,
14887                fidl::encoding::DefaultFuchsiaResourceDialect,
14888                &mut self.dai_format,
14889                decoder,
14890                offset + 0,
14891                _depth
14892            )?;
14893            fidl::decode!(
14894                Format,
14895                fidl::encoding::DefaultFuchsiaResourceDialect,
14896                &mut self.ring_buffer_format,
14897                decoder,
14898                offset + 48,
14899                _depth
14900            )?;
14901            fidl::decode!(
14902                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14903                fidl::encoding::DefaultFuchsiaResourceDialect,
14904                &mut self.ring_buffer,
14905                decoder,
14906                offset + 64,
14907                _depth
14908            )?;
14909            Ok(())
14910        }
14911    }
14912
14913    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlAllocateVmosResponse {
14914        type Borrowed<'a> = &'a mut Self;
14915        fn take_or_borrow<'a>(
14916            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14917        ) -> Self::Borrowed<'a> {
14918            value
14919        }
14920    }
14921
14922    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlAllocateVmosResponse {
14923        type Owned = Self;
14924
14925        #[inline(always)]
14926        fn inline_align(_context: fidl::encoding::Context) -> usize {
14927            8
14928        }
14929
14930        #[inline(always)]
14931        fn inline_size(_context: fidl::encoding::Context) -> usize {
14932            16
14933        }
14934    }
14935
14936    unsafe impl
14937        fidl::encoding::Encode<
14938            PacketStreamControlAllocateVmosResponse,
14939            fidl::encoding::DefaultFuchsiaResourceDialect,
14940        > for &mut PacketStreamControlAllocateVmosResponse
14941    {
14942        #[inline]
14943        unsafe fn encode(
14944            self,
14945            encoder: &mut fidl::encoding::Encoder<
14946                '_,
14947                fidl::encoding::DefaultFuchsiaResourceDialect,
14948            >,
14949            offset: usize,
14950            _depth: fidl::encoding::Depth,
14951        ) -> fidl::Result<()> {
14952            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
14953            // Delegate to tuple encoding.
14954            fidl::encoding::Encode::<PacketStreamControlAllocateVmosResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14955                (
14956                    <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmos),
14957                ),
14958                encoder, offset, _depth
14959            )
14960        }
14961    }
14962    unsafe impl<
14963        T0: fidl::encoding::Encode<
14964                fidl::encoding::Vector<VmoInfo, 256>,
14965                fidl::encoding::DefaultFuchsiaResourceDialect,
14966            >,
14967    >
14968        fidl::encoding::Encode<
14969            PacketStreamControlAllocateVmosResponse,
14970            fidl::encoding::DefaultFuchsiaResourceDialect,
14971        > for (T0,)
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::<PacketStreamControlAllocateVmosResponse>(offset);
14984            // Zero out padding regions. There's no need to apply masks
14985            // because the unmasked parts will be overwritten by fields.
14986            // Write the fields.
14987            self.0.encode(encoder, offset + 0, depth)?;
14988            Ok(())
14989        }
14990    }
14991
14992    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14993        for PacketStreamControlAllocateVmosResponse
14994    {
14995        #[inline(always)]
14996        fn new_empty() -> Self {
14997            Self {
14998                vmos: fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect),
14999            }
15000        }
15001
15002        #[inline]
15003        unsafe fn decode(
15004            &mut self,
15005            decoder: &mut fidl::encoding::Decoder<
15006                '_,
15007                fidl::encoding::DefaultFuchsiaResourceDialect,
15008            >,
15009            offset: usize,
15010            _depth: fidl::encoding::Depth,
15011        ) -> fidl::Result<()> {
15012            decoder.debug_check_bounds::<Self>(offset);
15013            // Verify that padding bytes are zero.
15014            fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmos, decoder, offset + 0, _depth)?;
15015            Ok(())
15016        }
15017    }
15018
15019    impl fidl::encoding::ResourceTypeMarker for RingBufferGetVmoResponse {
15020        type Borrowed<'a> = &'a mut Self;
15021        fn take_or_borrow<'a>(
15022            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15023        ) -> Self::Borrowed<'a> {
15024            value
15025        }
15026    }
15027
15028    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoResponse {
15029        type Owned = Self;
15030
15031        #[inline(always)]
15032        fn inline_align(_context: fidl::encoding::Context) -> usize {
15033            4
15034        }
15035
15036        #[inline(always)]
15037        fn inline_size(_context: fidl::encoding::Context) -> usize {
15038            8
15039        }
15040    }
15041
15042    unsafe impl
15043        fidl::encoding::Encode<
15044            RingBufferGetVmoResponse,
15045            fidl::encoding::DefaultFuchsiaResourceDialect,
15046        > for &mut RingBufferGetVmoResponse
15047    {
15048        #[inline]
15049        unsafe fn encode(
15050            self,
15051            encoder: &mut fidl::encoding::Encoder<
15052                '_,
15053                fidl::encoding::DefaultFuchsiaResourceDialect,
15054            >,
15055            offset: usize,
15056            _depth: fidl::encoding::Depth,
15057        ) -> fidl::Result<()> {
15058            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
15059            // Delegate to tuple encoding.
15060            fidl::encoding::Encode::<
15061                RingBufferGetVmoResponse,
15062                fidl::encoding::DefaultFuchsiaResourceDialect,
15063            >::encode(
15064                (
15065                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_frames),
15066                    <fidl::encoding::HandleType<
15067                        fidl::Vmo,
15068                        { fidl::ObjectType::VMO.into_raw() },
15069                        2147483648,
15070                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
15071                        &mut self.ring_buffer
15072                    ),
15073                ),
15074                encoder,
15075                offset,
15076                _depth,
15077            )
15078        }
15079    }
15080    unsafe impl<
15081        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
15082        T1: fidl::encoding::Encode<
15083                fidl::encoding::HandleType<
15084                    fidl::Vmo,
15085                    { fidl::ObjectType::VMO.into_raw() },
15086                    2147483648,
15087                >,
15088                fidl::encoding::DefaultFuchsiaResourceDialect,
15089            >,
15090    >
15091        fidl::encoding::Encode<
15092            RingBufferGetVmoResponse,
15093            fidl::encoding::DefaultFuchsiaResourceDialect,
15094        > for (T0, T1)
15095    {
15096        #[inline]
15097        unsafe fn encode(
15098            self,
15099            encoder: &mut fidl::encoding::Encoder<
15100                '_,
15101                fidl::encoding::DefaultFuchsiaResourceDialect,
15102            >,
15103            offset: usize,
15104            depth: fidl::encoding::Depth,
15105        ) -> fidl::Result<()> {
15106            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
15107            // Zero out padding regions. There's no need to apply masks
15108            // because the unmasked parts will be overwritten by fields.
15109            // Write the fields.
15110            self.0.encode(encoder, offset + 0, depth)?;
15111            self.1.encode(encoder, offset + 4, depth)?;
15112            Ok(())
15113        }
15114    }
15115
15116    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15117        for RingBufferGetVmoResponse
15118    {
15119        #[inline(always)]
15120        fn new_empty() -> Self {
15121            Self {
15122                num_frames: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
15123                ring_buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
15124            }
15125        }
15126
15127        #[inline]
15128        unsafe fn decode(
15129            &mut self,
15130            decoder: &mut fidl::encoding::Decoder<
15131                '_,
15132                fidl::encoding::DefaultFuchsiaResourceDialect,
15133            >,
15134            offset: usize,
15135            _depth: fidl::encoding::Depth,
15136        ) -> fidl::Result<()> {
15137            decoder.debug_check_bounds::<Self>(offset);
15138            // Verify that padding bytes are zero.
15139            fidl::decode!(
15140                u32,
15141                fidl::encoding::DefaultFuchsiaResourceDialect,
15142                &mut self.num_frames,
15143                decoder,
15144                offset + 0,
15145                _depth
15146            )?;
15147            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.ring_buffer, decoder, offset + 4, _depth)?;
15148            Ok(())
15149        }
15150    }
15151
15152    impl fidl::encoding::ResourceTypeMarker for StreamConfigConnectorConnectRequest {
15153        type Borrowed<'a> = &'a mut Self;
15154        fn take_or_borrow<'a>(
15155            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15156        ) -> Self::Borrowed<'a> {
15157            value
15158        }
15159    }
15160
15161    unsafe impl fidl::encoding::TypeMarker for StreamConfigConnectorConnectRequest {
15162        type Owned = Self;
15163
15164        #[inline(always)]
15165        fn inline_align(_context: fidl::encoding::Context) -> usize {
15166            4
15167        }
15168
15169        #[inline(always)]
15170        fn inline_size(_context: fidl::encoding::Context) -> usize {
15171            4
15172        }
15173    }
15174
15175    unsafe impl
15176        fidl::encoding::Encode<
15177            StreamConfigConnectorConnectRequest,
15178            fidl::encoding::DefaultFuchsiaResourceDialect,
15179        > for &mut StreamConfigConnectorConnectRequest
15180    {
15181        #[inline]
15182        unsafe fn encode(
15183            self,
15184            encoder: &mut fidl::encoding::Encoder<
15185                '_,
15186                fidl::encoding::DefaultFuchsiaResourceDialect,
15187            >,
15188            offset: usize,
15189            _depth: fidl::encoding::Depth,
15190        ) -> fidl::Result<()> {
15191            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
15192            // Delegate to tuple encoding.
15193            fidl::encoding::Encode::<StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15194                (
15195                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
15196                ),
15197                encoder, offset, _depth
15198            )
15199        }
15200    }
15201    unsafe impl<
15202        T0: fidl::encoding::Encode<
15203                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15204                fidl::encoding::DefaultFuchsiaResourceDialect,
15205            >,
15206    >
15207        fidl::encoding::Encode<
15208            StreamConfigConnectorConnectRequest,
15209            fidl::encoding::DefaultFuchsiaResourceDialect,
15210        > for (T0,)
15211    {
15212        #[inline]
15213        unsafe fn encode(
15214            self,
15215            encoder: &mut fidl::encoding::Encoder<
15216                '_,
15217                fidl::encoding::DefaultFuchsiaResourceDialect,
15218            >,
15219            offset: usize,
15220            depth: fidl::encoding::Depth,
15221        ) -> fidl::Result<()> {
15222            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
15223            // Zero out padding regions. There's no need to apply masks
15224            // because the unmasked parts will be overwritten by fields.
15225            // Write the fields.
15226            self.0.encode(encoder, offset + 0, depth)?;
15227            Ok(())
15228        }
15229    }
15230
15231    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15232        for StreamConfigConnectorConnectRequest
15233    {
15234        #[inline(always)]
15235        fn new_empty() -> Self {
15236            Self {
15237                protocol: fidl::new_empty!(
15238                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15239                    fidl::encoding::DefaultFuchsiaResourceDialect
15240                ),
15241            }
15242        }
15243
15244        #[inline]
15245        unsafe fn decode(
15246            &mut self,
15247            decoder: &mut fidl::encoding::Decoder<
15248                '_,
15249                fidl::encoding::DefaultFuchsiaResourceDialect,
15250            >,
15251            offset: usize,
15252            _depth: fidl::encoding::Depth,
15253        ) -> fidl::Result<()> {
15254            decoder.debug_check_bounds::<Self>(offset);
15255            // Verify that padding bytes are zero.
15256            fidl::decode!(
15257                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15258                fidl::encoding::DefaultFuchsiaResourceDialect,
15259                &mut self.protocol,
15260                decoder,
15261                offset + 0,
15262                _depth
15263            )?;
15264            Ok(())
15265        }
15266    }
15267
15268    impl fidl::encoding::ResourceTypeMarker for StreamConfigCreateRingBufferRequest {
15269        type Borrowed<'a> = &'a mut Self;
15270        fn take_or_borrow<'a>(
15271            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15272        ) -> Self::Borrowed<'a> {
15273            value
15274        }
15275    }
15276
15277    unsafe impl fidl::encoding::TypeMarker for StreamConfigCreateRingBufferRequest {
15278        type Owned = Self;
15279
15280        #[inline(always)]
15281        fn inline_align(_context: fidl::encoding::Context) -> usize {
15282            8
15283        }
15284
15285        #[inline(always)]
15286        fn inline_size(_context: fidl::encoding::Context) -> usize {
15287            24
15288        }
15289    }
15290
15291    unsafe impl
15292        fidl::encoding::Encode<
15293            StreamConfigCreateRingBufferRequest,
15294            fidl::encoding::DefaultFuchsiaResourceDialect,
15295        > for &mut StreamConfigCreateRingBufferRequest
15296    {
15297        #[inline]
15298        unsafe fn encode(
15299            self,
15300            encoder: &mut fidl::encoding::Encoder<
15301                '_,
15302                fidl::encoding::DefaultFuchsiaResourceDialect,
15303            >,
15304            offset: usize,
15305            _depth: fidl::encoding::Depth,
15306        ) -> fidl::Result<()> {
15307            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
15308            // Delegate to tuple encoding.
15309            fidl::encoding::Encode::<StreamConfigCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15310                (
15311                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
15312                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
15313                ),
15314                encoder, offset, _depth
15315            )
15316        }
15317    }
15318    unsafe impl<
15319        T0: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
15320        T1: fidl::encoding::Encode<
15321                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15322                fidl::encoding::DefaultFuchsiaResourceDialect,
15323            >,
15324    >
15325        fidl::encoding::Encode<
15326            StreamConfigCreateRingBufferRequest,
15327            fidl::encoding::DefaultFuchsiaResourceDialect,
15328        > for (T0, T1)
15329    {
15330        #[inline]
15331        unsafe fn encode(
15332            self,
15333            encoder: &mut fidl::encoding::Encoder<
15334                '_,
15335                fidl::encoding::DefaultFuchsiaResourceDialect,
15336            >,
15337            offset: usize,
15338            depth: fidl::encoding::Depth,
15339        ) -> fidl::Result<()> {
15340            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
15341            // Zero out padding regions. There's no need to apply masks
15342            // because the unmasked parts will be overwritten by fields.
15343            unsafe {
15344                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
15345                (ptr as *mut u64).write_unaligned(0);
15346            }
15347            // Write the fields.
15348            self.0.encode(encoder, offset + 0, depth)?;
15349            self.1.encode(encoder, offset + 16, depth)?;
15350            Ok(())
15351        }
15352    }
15353
15354    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15355        for StreamConfigCreateRingBufferRequest
15356    {
15357        #[inline(always)]
15358        fn new_empty() -> Self {
15359            Self {
15360                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
15361                ring_buffer: fidl::new_empty!(
15362                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15363                    fidl::encoding::DefaultFuchsiaResourceDialect
15364                ),
15365            }
15366        }
15367
15368        #[inline]
15369        unsafe fn decode(
15370            &mut self,
15371            decoder: &mut fidl::encoding::Decoder<
15372                '_,
15373                fidl::encoding::DefaultFuchsiaResourceDialect,
15374            >,
15375            offset: usize,
15376            _depth: fidl::encoding::Depth,
15377        ) -> fidl::Result<()> {
15378            decoder.debug_check_bounds::<Self>(offset);
15379            // Verify that padding bytes are zero.
15380            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
15381            let padval = unsafe { (ptr as *const u64).read_unaligned() };
15382            let mask = 0xffffffff00000000u64;
15383            let maskedval = padval & mask;
15384            if maskedval != 0 {
15385                return Err(fidl::Error::NonZeroPadding {
15386                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
15387                });
15388            }
15389            fidl::decode!(
15390                Format,
15391                fidl::encoding::DefaultFuchsiaResourceDialect,
15392                &mut self.format,
15393                decoder,
15394                offset + 0,
15395                _depth
15396            )?;
15397            fidl::decode!(
15398                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15399                fidl::encoding::DefaultFuchsiaResourceDialect,
15400                &mut self.ring_buffer,
15401                decoder,
15402                offset + 16,
15403                _depth
15404            )?;
15405            Ok(())
15406        }
15407    }
15408
15409    impl PacketStreamControlSetPacketStreamSinkRequest {
15410        #[inline(always)]
15411        fn max_ordinal_present(&self) -> u64 {
15412            if let Some(_) = self.stream {
15413                return 1;
15414            }
15415            0
15416        }
15417    }
15418
15419    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
15420        type Borrowed<'a> = &'a mut Self;
15421        fn take_or_borrow<'a>(
15422            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15423        ) -> Self::Borrowed<'a> {
15424            value
15425        }
15426    }
15427
15428    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
15429        type Owned = Self;
15430
15431        #[inline(always)]
15432        fn inline_align(_context: fidl::encoding::Context) -> usize {
15433            8
15434        }
15435
15436        #[inline(always)]
15437        fn inline_size(_context: fidl::encoding::Context) -> usize {
15438            16
15439        }
15440    }
15441
15442    unsafe impl
15443        fidl::encoding::Encode<
15444            PacketStreamControlSetPacketStreamSinkRequest,
15445            fidl::encoding::DefaultFuchsiaResourceDialect,
15446        > for &mut PacketStreamControlSetPacketStreamSinkRequest
15447    {
15448        unsafe fn encode(
15449            self,
15450            encoder: &mut fidl::encoding::Encoder<
15451                '_,
15452                fidl::encoding::DefaultFuchsiaResourceDialect,
15453            >,
15454            offset: usize,
15455            mut depth: fidl::encoding::Depth,
15456        ) -> fidl::Result<()> {
15457            encoder.debug_check_bounds::<PacketStreamControlSetPacketStreamSinkRequest>(offset);
15458            // Vector header
15459            let max_ordinal: u64 = self.max_ordinal_present();
15460            encoder.write_num(max_ordinal, offset);
15461            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15462            // Calling encoder.out_of_line_offset(0) is not allowed.
15463            if max_ordinal == 0 {
15464                return Ok(());
15465            }
15466            depth.increment()?;
15467            let envelope_size = 8;
15468            let bytes_len = max_ordinal as usize * envelope_size;
15469            #[allow(unused_variables)]
15470            let offset = encoder.out_of_line_offset(bytes_len);
15471            let mut _prev_end_offset: usize = 0;
15472            if 1 > max_ordinal {
15473                return Ok(());
15474            }
15475
15476            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15477            // are envelope_size bytes.
15478            let cur_offset: usize = (1 - 1) * envelope_size;
15479
15480            // Zero reserved fields.
15481            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15482
15483            // Safety:
15484            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15485            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15486            //   envelope_size bytes, there is always sufficient room.
15487            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15488            self.stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15489            encoder, offset + cur_offset, depth
15490        )?;
15491
15492            _prev_end_offset = cur_offset + envelope_size;
15493
15494            Ok(())
15495        }
15496    }
15497
15498    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15499        for PacketStreamControlSetPacketStreamSinkRequest
15500    {
15501        #[inline(always)]
15502        fn new_empty() -> Self {
15503            Self::default()
15504        }
15505
15506        unsafe fn decode(
15507            &mut self,
15508            decoder: &mut fidl::encoding::Decoder<
15509                '_,
15510                fidl::encoding::DefaultFuchsiaResourceDialect,
15511            >,
15512            offset: usize,
15513            mut depth: fidl::encoding::Depth,
15514        ) -> fidl::Result<()> {
15515            decoder.debug_check_bounds::<Self>(offset);
15516            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15517                None => return Err(fidl::Error::NotNullable),
15518                Some(len) => len,
15519            };
15520            // Calling decoder.out_of_line_offset(0) is not allowed.
15521            if len == 0 {
15522                return Ok(());
15523            };
15524            depth.increment()?;
15525            let envelope_size = 8;
15526            let bytes_len = len * envelope_size;
15527            let offset = decoder.out_of_line_offset(bytes_len)?;
15528            // Decode the envelope for each type.
15529            let mut _next_ordinal_to_read = 0;
15530            let mut next_offset = offset;
15531            let end_offset = offset + bytes_len;
15532            _next_ordinal_to_read += 1;
15533            if next_offset >= end_offset {
15534                return Ok(());
15535            }
15536
15537            // Decode unknown envelopes for gaps in ordinals.
15538            while _next_ordinal_to_read < 1 {
15539                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15540                _next_ordinal_to_read += 1;
15541                next_offset += envelope_size;
15542            }
15543
15544            let next_out_of_line = decoder.next_out_of_line();
15545            let handles_before = decoder.remaining_handles();
15546            if let Some((inlined, num_bytes, num_handles)) =
15547                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15548            {
15549                let member_inline_size = <fidl::encoding::Endpoint<
15550                    fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15551                > as fidl::encoding::TypeMarker>::inline_size(
15552                    decoder.context
15553                );
15554                if inlined != (member_inline_size <= 4) {
15555                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15556                }
15557                let inner_offset;
15558                let mut inner_depth = depth.clone();
15559                if inlined {
15560                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15561                    inner_offset = next_offset;
15562                } else {
15563                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15564                    inner_depth.increment()?;
15565                }
15566                let val_ref = self.stream.get_or_insert_with(|| {
15567                    fidl::new_empty!(
15568                        fidl::encoding::Endpoint<
15569                            fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15570                        >,
15571                        fidl::encoding::DefaultFuchsiaResourceDialect
15572                    )
15573                });
15574                fidl::decode!(
15575                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>,
15576                    fidl::encoding::DefaultFuchsiaResourceDialect,
15577                    val_ref,
15578                    decoder,
15579                    inner_offset,
15580                    inner_depth
15581                )?;
15582                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15583                {
15584                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15585                }
15586                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15587                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15588                }
15589            }
15590
15591            next_offset += envelope_size;
15592
15593            // Decode the remaining unknown envelopes.
15594            while next_offset < end_offset {
15595                _next_ordinal_to_read += 1;
15596                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15597                next_offset += envelope_size;
15598            }
15599
15600            Ok(())
15601        }
15602    }
15603
15604    impl PacketStreamControlGetPacketStreamSinkResponse {
15605        #[inline(always)]
15606        fn max_ordinal_present(&self) -> u64 {
15607            if let Some(_) = self.stream {
15608                return 1;
15609            }
15610            0
15611        }
15612    }
15613
15614    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
15615        type Borrowed<'a> = &'a mut Self;
15616        fn take_or_borrow<'a>(
15617            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15618        ) -> Self::Borrowed<'a> {
15619            value
15620        }
15621    }
15622
15623    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
15624        type Owned = Self;
15625
15626        #[inline(always)]
15627        fn inline_align(_context: fidl::encoding::Context) -> usize {
15628            8
15629        }
15630
15631        #[inline(always)]
15632        fn inline_size(_context: fidl::encoding::Context) -> usize {
15633            16
15634        }
15635    }
15636
15637    unsafe impl
15638        fidl::encoding::Encode<
15639            PacketStreamControlGetPacketStreamSinkResponse,
15640            fidl::encoding::DefaultFuchsiaResourceDialect,
15641        > for &mut PacketStreamControlGetPacketStreamSinkResponse
15642    {
15643        unsafe fn encode(
15644            self,
15645            encoder: &mut fidl::encoding::Encoder<
15646                '_,
15647                fidl::encoding::DefaultFuchsiaResourceDialect,
15648            >,
15649            offset: usize,
15650            mut depth: fidl::encoding::Depth,
15651        ) -> fidl::Result<()> {
15652            encoder.debug_check_bounds::<PacketStreamControlGetPacketStreamSinkResponse>(offset);
15653            // Vector header
15654            let max_ordinal: u64 = self.max_ordinal_present();
15655            encoder.write_num(max_ordinal, offset);
15656            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15657            // Calling encoder.out_of_line_offset(0) is not allowed.
15658            if max_ordinal == 0 {
15659                return Ok(());
15660            }
15661            depth.increment()?;
15662            let envelope_size = 8;
15663            let bytes_len = max_ordinal as usize * envelope_size;
15664            #[allow(unused_variables)]
15665            let offset = encoder.out_of_line_offset(bytes_len);
15666            let mut _prev_end_offset: usize = 0;
15667            if 1 > max_ordinal {
15668                return Ok(());
15669            }
15670
15671            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15672            // are envelope_size bytes.
15673            let cur_offset: usize = (1 - 1) * envelope_size;
15674
15675            // Zero reserved fields.
15676            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15677
15678            // Safety:
15679            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15680            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15681            //   envelope_size bytes, there is always sufficient room.
15682            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15683            self.stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15684            encoder, offset + cur_offset, depth
15685        )?;
15686
15687            _prev_end_offset = cur_offset + envelope_size;
15688
15689            Ok(())
15690        }
15691    }
15692
15693    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15694        for PacketStreamControlGetPacketStreamSinkResponse
15695    {
15696        #[inline(always)]
15697        fn new_empty() -> Self {
15698            Self::default()
15699        }
15700
15701        unsafe fn decode(
15702            &mut self,
15703            decoder: &mut fidl::encoding::Decoder<
15704                '_,
15705                fidl::encoding::DefaultFuchsiaResourceDialect,
15706            >,
15707            offset: usize,
15708            mut depth: fidl::encoding::Depth,
15709        ) -> fidl::Result<()> {
15710            decoder.debug_check_bounds::<Self>(offset);
15711            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15712                None => return Err(fidl::Error::NotNullable),
15713                Some(len) => len,
15714            };
15715            // Calling decoder.out_of_line_offset(0) is not allowed.
15716            if len == 0 {
15717                return Ok(());
15718            };
15719            depth.increment()?;
15720            let envelope_size = 8;
15721            let bytes_len = len * envelope_size;
15722            let offset = decoder.out_of_line_offset(bytes_len)?;
15723            // Decode the envelope for each type.
15724            let mut _next_ordinal_to_read = 0;
15725            let mut next_offset = offset;
15726            let end_offset = offset + bytes_len;
15727            _next_ordinal_to_read += 1;
15728            if next_offset >= end_offset {
15729                return Ok(());
15730            }
15731
15732            // Decode unknown envelopes for gaps in ordinals.
15733            while _next_ordinal_to_read < 1 {
15734                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15735                _next_ordinal_to_read += 1;
15736                next_offset += envelope_size;
15737            }
15738
15739            let next_out_of_line = decoder.next_out_of_line();
15740            let handles_before = decoder.remaining_handles();
15741            if let Some((inlined, num_bytes, num_handles)) =
15742                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15743            {
15744                let member_inline_size = <fidl::encoding::Endpoint<
15745                    fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15746                > as fidl::encoding::TypeMarker>::inline_size(
15747                    decoder.context
15748                );
15749                if inlined != (member_inline_size <= 4) {
15750                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15751                }
15752                let inner_offset;
15753                let mut inner_depth = depth.clone();
15754                if inlined {
15755                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15756                    inner_offset = next_offset;
15757                } else {
15758                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15759                    inner_depth.increment()?;
15760                }
15761                let val_ref = self.stream.get_or_insert_with(|| {
15762                    fidl::new_empty!(
15763                        fidl::encoding::Endpoint<
15764                            fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15765                        >,
15766                        fidl::encoding::DefaultFuchsiaResourceDialect
15767                    )
15768                });
15769                fidl::decode!(
15770                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>,
15771                    fidl::encoding::DefaultFuchsiaResourceDialect,
15772                    val_ref,
15773                    decoder,
15774                    inner_offset,
15775                    inner_depth
15776                )?;
15777                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15778                {
15779                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15780                }
15781                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15782                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15783                }
15784            }
15785
15786            next_offset += envelope_size;
15787
15788            // Decode the remaining unknown envelopes.
15789            while next_offset < end_offset {
15790                _next_ordinal_to_read += 1;
15791                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15792                next_offset += envelope_size;
15793            }
15794
15795            Ok(())
15796        }
15797    }
15798
15799    impl PacketStreamSinkPutPacketRequest {
15800        #[inline(always)]
15801        fn max_ordinal_present(&self) -> u64 {
15802            if let Some(_) = self.payload {
15803                return 1;
15804            }
15805            0
15806        }
15807    }
15808
15809    impl fidl::encoding::ResourceTypeMarker for PacketStreamSinkPutPacketRequest {
15810        type Borrowed<'a> = &'a mut Self;
15811        fn take_or_borrow<'a>(
15812            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15813        ) -> Self::Borrowed<'a> {
15814            value
15815        }
15816    }
15817
15818    unsafe impl fidl::encoding::TypeMarker for PacketStreamSinkPutPacketRequest {
15819        type Owned = Self;
15820
15821        #[inline(always)]
15822        fn inline_align(_context: fidl::encoding::Context) -> usize {
15823            8
15824        }
15825
15826        #[inline(always)]
15827        fn inline_size(_context: fidl::encoding::Context) -> usize {
15828            16
15829        }
15830    }
15831
15832    unsafe impl
15833        fidl::encoding::Encode<
15834            PacketStreamSinkPutPacketRequest,
15835            fidl::encoding::DefaultFuchsiaResourceDialect,
15836        > for &mut PacketStreamSinkPutPacketRequest
15837    {
15838        unsafe fn encode(
15839            self,
15840            encoder: &mut fidl::encoding::Encoder<
15841                '_,
15842                fidl::encoding::DefaultFuchsiaResourceDialect,
15843            >,
15844            offset: usize,
15845            mut depth: fidl::encoding::Depth,
15846        ) -> fidl::Result<()> {
15847            encoder.debug_check_bounds::<PacketStreamSinkPutPacketRequest>(offset);
15848            // Vector header
15849            let max_ordinal: u64 = self.max_ordinal_present();
15850            encoder.write_num(max_ordinal, offset);
15851            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15852            // Calling encoder.out_of_line_offset(0) is not allowed.
15853            if max_ordinal == 0 {
15854                return Ok(());
15855            }
15856            depth.increment()?;
15857            let envelope_size = 8;
15858            let bytes_len = max_ordinal as usize * envelope_size;
15859            #[allow(unused_variables)]
15860            let offset = encoder.out_of_line_offset(bytes_len);
15861            let mut _prev_end_offset: usize = 0;
15862            if 1 > max_ordinal {
15863                return Ok(());
15864            }
15865
15866            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15867            // are envelope_size bytes.
15868            let cur_offset: usize = (1 - 1) * envelope_size;
15869
15870            // Zero reserved fields.
15871            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15872
15873            // Safety:
15874            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15875            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15876            //   envelope_size bytes, there is always sufficient room.
15877            fidl::encoding::encode_in_envelope_optional::<
15878                DataTransfer,
15879                fidl::encoding::DefaultFuchsiaResourceDialect,
15880            >(
15881                self.payload
15882                    .as_mut()
15883                    .map(<DataTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15884                encoder,
15885                offset + cur_offset,
15886                depth,
15887            )?;
15888
15889            _prev_end_offset = cur_offset + envelope_size;
15890
15891            Ok(())
15892        }
15893    }
15894
15895    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15896        for PacketStreamSinkPutPacketRequest
15897    {
15898        #[inline(always)]
15899        fn new_empty() -> Self {
15900            Self::default()
15901        }
15902
15903        unsafe fn decode(
15904            &mut self,
15905            decoder: &mut fidl::encoding::Decoder<
15906                '_,
15907                fidl::encoding::DefaultFuchsiaResourceDialect,
15908            >,
15909            offset: usize,
15910            mut depth: fidl::encoding::Depth,
15911        ) -> fidl::Result<()> {
15912            decoder.debug_check_bounds::<Self>(offset);
15913            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15914                None => return Err(fidl::Error::NotNullable),
15915                Some(len) => len,
15916            };
15917            // Calling decoder.out_of_line_offset(0) is not allowed.
15918            if len == 0 {
15919                return Ok(());
15920            };
15921            depth.increment()?;
15922            let envelope_size = 8;
15923            let bytes_len = len * envelope_size;
15924            let offset = decoder.out_of_line_offset(bytes_len)?;
15925            // Decode the envelope for each type.
15926            let mut _next_ordinal_to_read = 0;
15927            let mut next_offset = offset;
15928            let end_offset = offset + bytes_len;
15929            _next_ordinal_to_read += 1;
15930            if next_offset >= end_offset {
15931                return Ok(());
15932            }
15933
15934            // Decode unknown envelopes for gaps in ordinals.
15935            while _next_ordinal_to_read < 1 {
15936                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15937                _next_ordinal_to_read += 1;
15938                next_offset += envelope_size;
15939            }
15940
15941            let next_out_of_line = decoder.next_out_of_line();
15942            let handles_before = decoder.remaining_handles();
15943            if let Some((inlined, num_bytes, num_handles)) =
15944                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15945            {
15946                let member_inline_size =
15947                    <DataTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15948                if inlined != (member_inline_size <= 4) {
15949                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15950                }
15951                let inner_offset;
15952                let mut inner_depth = depth.clone();
15953                if inlined {
15954                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15955                    inner_offset = next_offset;
15956                } else {
15957                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15958                    inner_depth.increment()?;
15959                }
15960                let val_ref = self.payload.get_or_insert_with(|| {
15961                    fidl::new_empty!(DataTransfer, fidl::encoding::DefaultFuchsiaResourceDialect)
15962                });
15963                fidl::decode!(
15964                    DataTransfer,
15965                    fidl::encoding::DefaultFuchsiaResourceDialect,
15966                    val_ref,
15967                    decoder,
15968                    inner_offset,
15969                    inner_depth
15970                )?;
15971                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15972                {
15973                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15974                }
15975                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15976                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15977                }
15978            }
15979
15980            next_offset += envelope_size;
15981
15982            // Decode the remaining unknown envelopes.
15983            while next_offset < end_offset {
15984                _next_ordinal_to_read += 1;
15985                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15986                next_offset += envelope_size;
15987            }
15988
15989            Ok(())
15990        }
15991    }
15992
15993    impl RegisterVmosConfig {
15994        #[inline(always)]
15995        fn max_ordinal_present(&self) -> u64 {
15996            if let Some(_) = self.vmo_infos {
15997                return 1;
15998            }
15999            0
16000        }
16001    }
16002
16003    impl fidl::encoding::ResourceTypeMarker for RegisterVmosConfig {
16004        type Borrowed<'a> = &'a mut Self;
16005        fn take_or_borrow<'a>(
16006            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16007        ) -> Self::Borrowed<'a> {
16008            value
16009        }
16010    }
16011
16012    unsafe impl fidl::encoding::TypeMarker for RegisterVmosConfig {
16013        type Owned = Self;
16014
16015        #[inline(always)]
16016        fn inline_align(_context: fidl::encoding::Context) -> usize {
16017            8
16018        }
16019
16020        #[inline(always)]
16021        fn inline_size(_context: fidl::encoding::Context) -> usize {
16022            16
16023        }
16024    }
16025
16026    unsafe impl
16027        fidl::encoding::Encode<RegisterVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
16028        for &mut RegisterVmosConfig
16029    {
16030        unsafe fn encode(
16031            self,
16032            encoder: &mut fidl::encoding::Encoder<
16033                '_,
16034                fidl::encoding::DefaultFuchsiaResourceDialect,
16035            >,
16036            offset: usize,
16037            mut depth: fidl::encoding::Depth,
16038        ) -> fidl::Result<()> {
16039            encoder.debug_check_bounds::<RegisterVmosConfig>(offset);
16040            // Vector header
16041            let max_ordinal: u64 = self.max_ordinal_present();
16042            encoder.write_num(max_ordinal, offset);
16043            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16044            // Calling encoder.out_of_line_offset(0) is not allowed.
16045            if max_ordinal == 0 {
16046                return Ok(());
16047            }
16048            depth.increment()?;
16049            let envelope_size = 8;
16050            let bytes_len = max_ordinal as usize * envelope_size;
16051            #[allow(unused_variables)]
16052            let offset = encoder.out_of_line_offset(bytes_len);
16053            let mut _prev_end_offset: usize = 0;
16054            if 1 > max_ordinal {
16055                return Ok(());
16056            }
16057
16058            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16059            // are envelope_size bytes.
16060            let cur_offset: usize = (1 - 1) * envelope_size;
16061
16062            // Zero reserved fields.
16063            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16064
16065            // Safety:
16066            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16067            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16068            //   envelope_size bytes, there is always sufficient room.
16069            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect>(
16070            self.vmo_infos.as_mut().map(<fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16071            encoder, offset + cur_offset, depth
16072        )?;
16073
16074            _prev_end_offset = cur_offset + envelope_size;
16075
16076            Ok(())
16077        }
16078    }
16079
16080    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16081        for RegisterVmosConfig
16082    {
16083        #[inline(always)]
16084        fn new_empty() -> Self {
16085            Self::default()
16086        }
16087
16088        unsafe fn decode(
16089            &mut self,
16090            decoder: &mut fidl::encoding::Decoder<
16091                '_,
16092                fidl::encoding::DefaultFuchsiaResourceDialect,
16093            >,
16094            offset: usize,
16095            mut depth: fidl::encoding::Depth,
16096        ) -> fidl::Result<()> {
16097            decoder.debug_check_bounds::<Self>(offset);
16098            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16099                None => return Err(fidl::Error::NotNullable),
16100                Some(len) => len,
16101            };
16102            // Calling decoder.out_of_line_offset(0) is not allowed.
16103            if len == 0 {
16104                return Ok(());
16105            };
16106            depth.increment()?;
16107            let envelope_size = 8;
16108            let bytes_len = len * envelope_size;
16109            let offset = decoder.out_of_line_offset(bytes_len)?;
16110            // Decode the envelope for each type.
16111            let mut _next_ordinal_to_read = 0;
16112            let mut next_offset = offset;
16113            let end_offset = offset + bytes_len;
16114            _next_ordinal_to_read += 1;
16115            if next_offset >= end_offset {
16116                return Ok(());
16117            }
16118
16119            // Decode unknown envelopes for gaps in ordinals.
16120            while _next_ordinal_to_read < 1 {
16121                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16122                _next_ordinal_to_read += 1;
16123                next_offset += envelope_size;
16124            }
16125
16126            let next_out_of_line = decoder.next_out_of_line();
16127            let handles_before = decoder.remaining_handles();
16128            if let Some((inlined, num_bytes, num_handles)) =
16129                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16130            {
16131                let member_inline_size = <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16132                if inlined != (member_inline_size <= 4) {
16133                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16134                }
16135                let inner_offset;
16136                let mut inner_depth = depth.clone();
16137                if inlined {
16138                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16139                    inner_offset = next_offset;
16140                } else {
16141                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16142                    inner_depth.increment()?;
16143                }
16144                let val_ref =
16145                self.vmo_infos.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect));
16146                fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
16147                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16148                {
16149                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16150                }
16151                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16152                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16153                }
16154            }
16155
16156            next_offset += envelope_size;
16157
16158            // Decode the remaining unknown envelopes.
16159            while next_offset < end_offset {
16160                _next_ordinal_to_read += 1;
16161                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16162                next_offset += envelope_size;
16163            }
16164
16165            Ok(())
16166        }
16167    }
16168
16169    impl VmoInfo {
16170        #[inline(always)]
16171        fn max_ordinal_present(&self) -> u64 {
16172            if let Some(_) = self.vmo {
16173                return 2;
16174            }
16175            if let Some(_) = self.id {
16176                return 1;
16177            }
16178            0
16179        }
16180    }
16181
16182    impl fidl::encoding::ResourceTypeMarker for VmoInfo {
16183        type Borrowed<'a> = &'a mut Self;
16184        fn take_or_borrow<'a>(
16185            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16186        ) -> Self::Borrowed<'a> {
16187            value
16188        }
16189    }
16190
16191    unsafe impl fidl::encoding::TypeMarker for VmoInfo {
16192        type Owned = Self;
16193
16194        #[inline(always)]
16195        fn inline_align(_context: fidl::encoding::Context) -> usize {
16196            8
16197        }
16198
16199        #[inline(always)]
16200        fn inline_size(_context: fidl::encoding::Context) -> usize {
16201            16
16202        }
16203    }
16204
16205    unsafe impl fidl::encoding::Encode<VmoInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
16206        for &mut VmoInfo
16207    {
16208        unsafe fn encode(
16209            self,
16210            encoder: &mut fidl::encoding::Encoder<
16211                '_,
16212                fidl::encoding::DefaultFuchsiaResourceDialect,
16213            >,
16214            offset: usize,
16215            mut depth: fidl::encoding::Depth,
16216        ) -> fidl::Result<()> {
16217            encoder.debug_check_bounds::<VmoInfo>(offset);
16218            // Vector header
16219            let max_ordinal: u64 = self.max_ordinal_present();
16220            encoder.write_num(max_ordinal, offset);
16221            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16222            // Calling encoder.out_of_line_offset(0) is not allowed.
16223            if max_ordinal == 0 {
16224                return Ok(());
16225            }
16226            depth.increment()?;
16227            let envelope_size = 8;
16228            let bytes_len = max_ordinal as usize * envelope_size;
16229            #[allow(unused_variables)]
16230            let offset = encoder.out_of_line_offset(bytes_len);
16231            let mut _prev_end_offset: usize = 0;
16232            if 1 > max_ordinal {
16233                return Ok(());
16234            }
16235
16236            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16237            // are envelope_size bytes.
16238            let cur_offset: usize = (1 - 1) * envelope_size;
16239
16240            // Zero reserved fields.
16241            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16242
16243            // Safety:
16244            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16245            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16246            //   envelope_size bytes, there is always sufficient room.
16247            fidl::encoding::encode_in_envelope_optional::<
16248                u64,
16249                fidl::encoding::DefaultFuchsiaResourceDialect,
16250            >(
16251                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16252                encoder,
16253                offset + cur_offset,
16254                depth,
16255            )?;
16256
16257            _prev_end_offset = cur_offset + envelope_size;
16258            if 2 > max_ordinal {
16259                return Ok(());
16260            }
16261
16262            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16263            // are envelope_size bytes.
16264            let cur_offset: usize = (2 - 1) * envelope_size;
16265
16266            // Zero reserved fields.
16267            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16268
16269            // Safety:
16270            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16271            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16272            //   envelope_size bytes, there is always sufficient room.
16273            fidl::encoding::encode_in_envelope_optional::<
16274                fidl::encoding::HandleType<
16275                    fidl::Vmo,
16276                    { fidl::ObjectType::VMO.into_raw() },
16277                    2147483648,
16278                >,
16279                fidl::encoding::DefaultFuchsiaResourceDialect,
16280            >(
16281                self.vmo.as_mut().map(
16282                    <fidl::encoding::HandleType<
16283                        fidl::Vmo,
16284                        { fidl::ObjectType::VMO.into_raw() },
16285                        2147483648,
16286                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16287                ),
16288                encoder,
16289                offset + cur_offset,
16290                depth,
16291            )?;
16292
16293            _prev_end_offset = cur_offset + envelope_size;
16294
16295            Ok(())
16296        }
16297    }
16298
16299    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for VmoInfo {
16300        #[inline(always)]
16301        fn new_empty() -> Self {
16302            Self::default()
16303        }
16304
16305        unsafe fn decode(
16306            &mut self,
16307            decoder: &mut fidl::encoding::Decoder<
16308                '_,
16309                fidl::encoding::DefaultFuchsiaResourceDialect,
16310            >,
16311            offset: usize,
16312            mut depth: fidl::encoding::Depth,
16313        ) -> fidl::Result<()> {
16314            decoder.debug_check_bounds::<Self>(offset);
16315            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16316                None => return Err(fidl::Error::NotNullable),
16317                Some(len) => len,
16318            };
16319            // Calling decoder.out_of_line_offset(0) is not allowed.
16320            if len == 0 {
16321                return Ok(());
16322            };
16323            depth.increment()?;
16324            let envelope_size = 8;
16325            let bytes_len = len * envelope_size;
16326            let offset = decoder.out_of_line_offset(bytes_len)?;
16327            // Decode the envelope for each type.
16328            let mut _next_ordinal_to_read = 0;
16329            let mut next_offset = offset;
16330            let end_offset = offset + bytes_len;
16331            _next_ordinal_to_read += 1;
16332            if next_offset >= end_offset {
16333                return Ok(());
16334            }
16335
16336            // Decode unknown envelopes for gaps in ordinals.
16337            while _next_ordinal_to_read < 1 {
16338                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16339                _next_ordinal_to_read += 1;
16340                next_offset += envelope_size;
16341            }
16342
16343            let next_out_of_line = decoder.next_out_of_line();
16344            let handles_before = decoder.remaining_handles();
16345            if let Some((inlined, num_bytes, num_handles)) =
16346                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16347            {
16348                let member_inline_size =
16349                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16350                if inlined != (member_inline_size <= 4) {
16351                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16352                }
16353                let inner_offset;
16354                let mut inner_depth = depth.clone();
16355                if inlined {
16356                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16357                    inner_offset = next_offset;
16358                } else {
16359                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16360                    inner_depth.increment()?;
16361                }
16362                let val_ref = self.id.get_or_insert_with(|| {
16363                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16364                });
16365                fidl::decode!(
16366                    u64,
16367                    fidl::encoding::DefaultFuchsiaResourceDialect,
16368                    val_ref,
16369                    decoder,
16370                    inner_offset,
16371                    inner_depth
16372                )?;
16373                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16374                {
16375                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16376                }
16377                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16378                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16379                }
16380            }
16381
16382            next_offset += envelope_size;
16383            _next_ordinal_to_read += 1;
16384            if next_offset >= end_offset {
16385                return Ok(());
16386            }
16387
16388            // Decode unknown envelopes for gaps in ordinals.
16389            while _next_ordinal_to_read < 2 {
16390                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16391                _next_ordinal_to_read += 1;
16392                next_offset += envelope_size;
16393            }
16394
16395            let next_out_of_line = decoder.next_out_of_line();
16396            let handles_before = decoder.remaining_handles();
16397            if let Some((inlined, num_bytes, num_handles)) =
16398                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16399            {
16400                let member_inline_size = <fidl::encoding::HandleType<
16401                    fidl::Vmo,
16402                    { fidl::ObjectType::VMO.into_raw() },
16403                    2147483648,
16404                > as fidl::encoding::TypeMarker>::inline_size(
16405                    decoder.context
16406                );
16407                if inlined != (member_inline_size <= 4) {
16408                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16409                }
16410                let inner_offset;
16411                let mut inner_depth = depth.clone();
16412                if inlined {
16413                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16414                    inner_offset = next_offset;
16415                } else {
16416                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16417                    inner_depth.increment()?;
16418                }
16419                let val_ref =
16420                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
16421                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
16422                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16423                {
16424                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16425                }
16426                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16427                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16428                }
16429            }
16430
16431            next_offset += envelope_size;
16432
16433            // Decode the remaining unknown envelopes.
16434            while next_offset < end_offset {
16435                _next_ordinal_to_read += 1;
16436                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16437                next_offset += envelope_size;
16438            }
16439
16440            Ok(())
16441        }
16442    }
16443
16444    impl VmoTransfer {
16445        #[inline(always)]
16446        fn max_ordinal_present(&self) -> u64 {
16447            if let Some(_) = self.payload_size {
16448                return 3;
16449            }
16450            if let Some(_) = self.vmo_offset {
16451                return 2;
16452            }
16453            if let Some(_) = self.vmo_id {
16454                return 1;
16455            }
16456            0
16457        }
16458    }
16459
16460    impl fidl::encoding::ResourceTypeMarker for VmoTransfer {
16461        type Borrowed<'a> = &'a mut Self;
16462        fn take_or_borrow<'a>(
16463            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16464        ) -> Self::Borrowed<'a> {
16465            value
16466        }
16467    }
16468
16469    unsafe impl fidl::encoding::TypeMarker for VmoTransfer {
16470        type Owned = Self;
16471
16472        #[inline(always)]
16473        fn inline_align(_context: fidl::encoding::Context) -> usize {
16474            8
16475        }
16476
16477        #[inline(always)]
16478        fn inline_size(_context: fidl::encoding::Context) -> usize {
16479            16
16480        }
16481    }
16482
16483    unsafe impl fidl::encoding::Encode<VmoTransfer, fidl::encoding::DefaultFuchsiaResourceDialect>
16484        for &mut VmoTransfer
16485    {
16486        unsafe fn encode(
16487            self,
16488            encoder: &mut fidl::encoding::Encoder<
16489                '_,
16490                fidl::encoding::DefaultFuchsiaResourceDialect,
16491            >,
16492            offset: usize,
16493            mut depth: fidl::encoding::Depth,
16494        ) -> fidl::Result<()> {
16495            encoder.debug_check_bounds::<VmoTransfer>(offset);
16496            // Vector header
16497            let max_ordinal: u64 = self.max_ordinal_present();
16498            encoder.write_num(max_ordinal, offset);
16499            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16500            // Calling encoder.out_of_line_offset(0) is not allowed.
16501            if max_ordinal == 0 {
16502                return Ok(());
16503            }
16504            depth.increment()?;
16505            let envelope_size = 8;
16506            let bytes_len = max_ordinal as usize * envelope_size;
16507            #[allow(unused_variables)]
16508            let offset = encoder.out_of_line_offset(bytes_len);
16509            let mut _prev_end_offset: usize = 0;
16510            if 1 > max_ordinal {
16511                return Ok(());
16512            }
16513
16514            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16515            // are envelope_size bytes.
16516            let cur_offset: usize = (1 - 1) * envelope_size;
16517
16518            // Zero reserved fields.
16519            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16520
16521            // Safety:
16522            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16523            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16524            //   envelope_size bytes, there is always sufficient room.
16525            fidl::encoding::encode_in_envelope_optional::<
16526                u64,
16527                fidl::encoding::DefaultFuchsiaResourceDialect,
16528            >(
16529                self.vmo_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16530                encoder,
16531                offset + cur_offset,
16532                depth,
16533            )?;
16534
16535            _prev_end_offset = cur_offset + envelope_size;
16536            if 2 > max_ordinal {
16537                return Ok(());
16538            }
16539
16540            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16541            // are envelope_size bytes.
16542            let cur_offset: usize = (2 - 1) * envelope_size;
16543
16544            // Zero reserved fields.
16545            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16546
16547            // Safety:
16548            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16549            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16550            //   envelope_size bytes, there is always sufficient room.
16551            fidl::encoding::encode_in_envelope_optional::<
16552                u64,
16553                fidl::encoding::DefaultFuchsiaResourceDialect,
16554            >(
16555                self.vmo_offset.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16556                encoder,
16557                offset + cur_offset,
16558                depth,
16559            )?;
16560
16561            _prev_end_offset = cur_offset + envelope_size;
16562            if 3 > max_ordinal {
16563                return Ok(());
16564            }
16565
16566            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16567            // are envelope_size bytes.
16568            let cur_offset: usize = (3 - 1) * envelope_size;
16569
16570            // Zero reserved fields.
16571            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16572
16573            // Safety:
16574            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16575            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16576            //   envelope_size bytes, there is always sufficient room.
16577            fidl::encoding::encode_in_envelope_optional::<
16578                u64,
16579                fidl::encoding::DefaultFuchsiaResourceDialect,
16580            >(
16581                self.payload_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16582                encoder,
16583                offset + cur_offset,
16584                depth,
16585            )?;
16586
16587            _prev_end_offset = cur_offset + envelope_size;
16588
16589            Ok(())
16590        }
16591    }
16592
16593    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for VmoTransfer {
16594        #[inline(always)]
16595        fn new_empty() -> Self {
16596            Self::default()
16597        }
16598
16599        unsafe fn decode(
16600            &mut self,
16601            decoder: &mut fidl::encoding::Decoder<
16602                '_,
16603                fidl::encoding::DefaultFuchsiaResourceDialect,
16604            >,
16605            offset: usize,
16606            mut depth: fidl::encoding::Depth,
16607        ) -> fidl::Result<()> {
16608            decoder.debug_check_bounds::<Self>(offset);
16609            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16610                None => return Err(fidl::Error::NotNullable),
16611                Some(len) => len,
16612            };
16613            // Calling decoder.out_of_line_offset(0) is not allowed.
16614            if len == 0 {
16615                return Ok(());
16616            };
16617            depth.increment()?;
16618            let envelope_size = 8;
16619            let bytes_len = len * envelope_size;
16620            let offset = decoder.out_of_line_offset(bytes_len)?;
16621            // Decode the envelope for each type.
16622            let mut _next_ordinal_to_read = 0;
16623            let mut next_offset = offset;
16624            let end_offset = offset + bytes_len;
16625            _next_ordinal_to_read += 1;
16626            if next_offset >= end_offset {
16627                return Ok(());
16628            }
16629
16630            // Decode unknown envelopes for gaps in ordinals.
16631            while _next_ordinal_to_read < 1 {
16632                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16633                _next_ordinal_to_read += 1;
16634                next_offset += envelope_size;
16635            }
16636
16637            let next_out_of_line = decoder.next_out_of_line();
16638            let handles_before = decoder.remaining_handles();
16639            if let Some((inlined, num_bytes, num_handles)) =
16640                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16641            {
16642                let member_inline_size =
16643                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16644                if inlined != (member_inline_size <= 4) {
16645                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16646                }
16647                let inner_offset;
16648                let mut inner_depth = depth.clone();
16649                if inlined {
16650                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16651                    inner_offset = next_offset;
16652                } else {
16653                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16654                    inner_depth.increment()?;
16655                }
16656                let val_ref = self.vmo_id.get_or_insert_with(|| {
16657                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16658                });
16659                fidl::decode!(
16660                    u64,
16661                    fidl::encoding::DefaultFuchsiaResourceDialect,
16662                    val_ref,
16663                    decoder,
16664                    inner_offset,
16665                    inner_depth
16666                )?;
16667                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16668                {
16669                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16670                }
16671                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16672                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16673                }
16674            }
16675
16676            next_offset += envelope_size;
16677            _next_ordinal_to_read += 1;
16678            if next_offset >= end_offset {
16679                return Ok(());
16680            }
16681
16682            // Decode unknown envelopes for gaps in ordinals.
16683            while _next_ordinal_to_read < 2 {
16684                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16685                _next_ordinal_to_read += 1;
16686                next_offset += envelope_size;
16687            }
16688
16689            let next_out_of_line = decoder.next_out_of_line();
16690            let handles_before = decoder.remaining_handles();
16691            if let Some((inlined, num_bytes, num_handles)) =
16692                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16693            {
16694                let member_inline_size =
16695                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16696                if inlined != (member_inline_size <= 4) {
16697                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16698                }
16699                let inner_offset;
16700                let mut inner_depth = depth.clone();
16701                if inlined {
16702                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16703                    inner_offset = next_offset;
16704                } else {
16705                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16706                    inner_depth.increment()?;
16707                }
16708                let val_ref = self.vmo_offset.get_or_insert_with(|| {
16709                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16710                });
16711                fidl::decode!(
16712                    u64,
16713                    fidl::encoding::DefaultFuchsiaResourceDialect,
16714                    val_ref,
16715                    decoder,
16716                    inner_offset,
16717                    inner_depth
16718                )?;
16719                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16720                {
16721                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16722                }
16723                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16724                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16725                }
16726            }
16727
16728            next_offset += envelope_size;
16729            _next_ordinal_to_read += 1;
16730            if next_offset >= end_offset {
16731                return Ok(());
16732            }
16733
16734            // Decode unknown envelopes for gaps in ordinals.
16735            while _next_ordinal_to_read < 3 {
16736                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16737                _next_ordinal_to_read += 1;
16738                next_offset += envelope_size;
16739            }
16740
16741            let next_out_of_line = decoder.next_out_of_line();
16742            let handles_before = decoder.remaining_handles();
16743            if let Some((inlined, num_bytes, num_handles)) =
16744                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16745            {
16746                let member_inline_size =
16747                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16748                if inlined != (member_inline_size <= 4) {
16749                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16750                }
16751                let inner_offset;
16752                let mut inner_depth = depth.clone();
16753                if inlined {
16754                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16755                    inner_offset = next_offset;
16756                } else {
16757                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16758                    inner_depth.increment()?;
16759                }
16760                let val_ref = self.payload_size.get_or_insert_with(|| {
16761                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16762                });
16763                fidl::decode!(
16764                    u64,
16765                    fidl::encoding::DefaultFuchsiaResourceDialect,
16766                    val_ref,
16767                    decoder,
16768                    inner_offset,
16769                    inner_depth
16770                )?;
16771                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16772                {
16773                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16774                }
16775                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16776                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16777                }
16778            }
16779
16780            next_offset += envelope_size;
16781
16782            // Decode the remaining unknown envelopes.
16783            while next_offset < end_offset {
16784                _next_ordinal_to_read += 1;
16785                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16786                next_offset += envelope_size;
16787            }
16788
16789            Ok(())
16790        }
16791    }
16792
16793    impl fidl::encoding::ResourceTypeMarker for DataTransfer {
16794        type Borrowed<'a> = &'a mut Self;
16795        fn take_or_borrow<'a>(
16796            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16797        ) -> Self::Borrowed<'a> {
16798            value
16799        }
16800    }
16801
16802    unsafe impl fidl::encoding::TypeMarker for DataTransfer {
16803        type Owned = Self;
16804
16805        #[inline(always)]
16806        fn inline_align(_context: fidl::encoding::Context) -> usize {
16807            8
16808        }
16809
16810        #[inline(always)]
16811        fn inline_size(_context: fidl::encoding::Context) -> usize {
16812            16
16813        }
16814    }
16815
16816    unsafe impl fidl::encoding::Encode<DataTransfer, fidl::encoding::DefaultFuchsiaResourceDialect>
16817        for &mut DataTransfer
16818    {
16819        #[inline]
16820        unsafe fn encode(
16821            self,
16822            encoder: &mut fidl::encoding::Encoder<
16823                '_,
16824                fidl::encoding::DefaultFuchsiaResourceDialect,
16825            >,
16826            offset: usize,
16827            _depth: fidl::encoding::Depth,
16828        ) -> fidl::Result<()> {
16829            encoder.debug_check_bounds::<DataTransfer>(offset);
16830            encoder.write_num::<u64>(self.ordinal(), offset);
16831            match self {
16832                DataTransfer::VmoTransfer(ref mut val) => fidl::encoding::encode_in_envelope::<
16833                    VmoTransfer,
16834                    fidl::encoding::DefaultFuchsiaResourceDialect,
16835                >(
16836                    <VmoTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
16837                    encoder,
16838                    offset + 8,
16839                    _depth,
16840                ),
16841                DataTransfer::InlineData(ref val) => fidl::encoding::encode_in_envelope::<
16842                    fidl::encoding::Vector<u8, 8192>,
16843                    fidl::encoding::DefaultFuchsiaResourceDialect,
16844                >(
16845                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
16846                        val,
16847                    ),
16848                    encoder,
16849                    offset + 8,
16850                    _depth,
16851                ),
16852                DataTransfer::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
16853            }
16854        }
16855    }
16856
16857    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DataTransfer {
16858        #[inline(always)]
16859        fn new_empty() -> Self {
16860            Self::__SourceBreaking { unknown_ordinal: 0 }
16861        }
16862
16863        #[inline]
16864        unsafe fn decode(
16865            &mut self,
16866            decoder: &mut fidl::encoding::Decoder<
16867                '_,
16868                fidl::encoding::DefaultFuchsiaResourceDialect,
16869            >,
16870            offset: usize,
16871            mut depth: fidl::encoding::Depth,
16872        ) -> fidl::Result<()> {
16873            decoder.debug_check_bounds::<Self>(offset);
16874            #[allow(unused_variables)]
16875            let next_out_of_line = decoder.next_out_of_line();
16876            let handles_before = decoder.remaining_handles();
16877            let (ordinal, inlined, num_bytes, num_handles) =
16878                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
16879
16880            let member_inline_size = match ordinal {
16881                1 => <VmoTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context),
16882                2 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
16883                    decoder.context,
16884                ),
16885                0 => return Err(fidl::Error::UnknownUnionTag),
16886                _ => num_bytes as usize,
16887            };
16888
16889            if inlined != (member_inline_size <= 4) {
16890                return Err(fidl::Error::InvalidInlineBitInEnvelope);
16891            }
16892            let _inner_offset;
16893            if inlined {
16894                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
16895                _inner_offset = offset + 8;
16896            } else {
16897                depth.increment()?;
16898                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16899            }
16900            match ordinal {
16901                1 => {
16902                    #[allow(irrefutable_let_patterns)]
16903                    if let DataTransfer::VmoTransfer(_) = self {
16904                        // Do nothing, read the value into the object
16905                    } else {
16906                        // Initialize `self` to the right variant
16907                        *self = DataTransfer::VmoTransfer(fidl::new_empty!(
16908                            VmoTransfer,
16909                            fidl::encoding::DefaultFuchsiaResourceDialect
16910                        ));
16911                    }
16912                    #[allow(irrefutable_let_patterns)]
16913                    if let DataTransfer::VmoTransfer(ref mut val) = self {
16914                        fidl::decode!(
16915                            VmoTransfer,
16916                            fidl::encoding::DefaultFuchsiaResourceDialect,
16917                            val,
16918                            decoder,
16919                            _inner_offset,
16920                            depth
16921                        )?;
16922                    } else {
16923                        unreachable!()
16924                    }
16925                }
16926                2 => {
16927                    #[allow(irrefutable_let_patterns)]
16928                    if let DataTransfer::InlineData(_) = self {
16929                        // Do nothing, read the value into the object
16930                    } else {
16931                        // Initialize `self` to the right variant
16932                        *self = DataTransfer::InlineData(
16933                            fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect),
16934                        );
16935                    }
16936                    #[allow(irrefutable_let_patterns)]
16937                    if let DataTransfer::InlineData(ref mut val) = self {
16938                        fidl::decode!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
16939                    } else {
16940                        unreachable!()
16941                    }
16942                }
16943                #[allow(deprecated)]
16944                ordinal => {
16945                    for _ in 0..num_handles {
16946                        decoder.drop_next_handle()?;
16947                    }
16948                    *self = DataTransfer::__SourceBreaking { unknown_ordinal: ordinal };
16949                }
16950            }
16951            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
16952                return Err(fidl::Error::InvalidNumBytesInEnvelope);
16953            }
16954            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16955                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16956            }
16957            Ok(())
16958        }
16959    }
16960}