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/concepts/drivers/driver_architectures/audio_drivers/audio_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` will be closed.
2426    ///
2427    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2428    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2429    /// any processing elements, and reconstruct any ring buffers.
2430    ///
2431    /// If the driver can't successfully reset the hardware, it will return an error and then close
2432    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2433    pub fn r#reset(
2434        &self,
2435        ___deadline: zx::MonotonicInstant,
2436    ) -> Result<CompositeResetResult, fidl::Error> {
2437        let _response = self.client.send_query::<
2438            fidl::encoding::EmptyPayload,
2439            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2440            CompositeMarker,
2441        >(
2442            (),
2443            0xac355fb98341996,
2444            fidl::encoding::DynamicFlags::FLEXIBLE,
2445            ___deadline,
2446        )?
2447        .into_result::<CompositeMarker>("reset")?;
2448        Ok(_response.map(|x| x))
2449    }
2450
2451    /// Retrieves top level static properties.
2452    pub fn r#get_properties(
2453        &self,
2454        ___deadline: zx::MonotonicInstant,
2455    ) -> Result<CompositeProperties, fidl::Error> {
2456        let _response = self.client.send_query::<
2457            fidl::encoding::EmptyPayload,
2458            fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>,
2459            CompositeMarker,
2460        >(
2461            (),
2462            0x31846fa0a459942b,
2463            fidl::encoding::DynamicFlags::FLEXIBLE,
2464            ___deadline,
2465        )?
2466        .into_result::<CompositeMarker>("get_properties")?;
2467        Ok(_response.properties)
2468    }
2469
2470    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2471    /// in the topology supported by this driver as returned by `GetElements` from
2472    /// fuchsia.hardware.audio.signalprocessing.
2473    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2474    /// client may retry at a later time.
2475    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2476    /// by `GetElements`.
2477    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2478    /// `RING_BUFFER`.
2479    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2480    /// the parameters in `SupportedFormats2` may be supported.
2481    /// The vector returned to the caller must contain at least one entry.
2482    pub fn r#get_ring_buffer_formats(
2483        &self,
2484        mut processing_element_id: u64,
2485        ___deadline: zx::MonotonicInstant,
2486    ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2487        let _response = self.client.send_query::<
2488            CompositeGetRingBufferFormatsRequest,
2489            fidl::encoding::FlexibleResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2490            CompositeMarker,
2491        >(
2492            (processing_element_id,),
2493            0x1d89b701b6816ac4,
2494            fidl::encoding::DynamicFlags::FLEXIBLE,
2495            ___deadline,
2496        )?
2497        .into_result::<CompositeMarker>("get_ring_buffer_formats")?;
2498        Ok(_response.map(|x| x.ring_buffer_formats))
2499    }
2500
2501    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2502    /// processing element specified by `processing_element_id`. The format is based on information
2503    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2504    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2505    /// audio buffer provided by the driver.
2506    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2507    /// by `GetElements`.
2508    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2509    /// `RING_BUFFER`.
2510    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2511    /// `format` is not supported.
2512    pub fn r#create_ring_buffer(
2513        &self,
2514        mut processing_element_id: u64,
2515        mut format: &Format2,
2516        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2517        ___deadline: zx::MonotonicInstant,
2518    ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2519        let _response = self.client.send_query::<
2520            CompositeCreateRingBufferRequest,
2521            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2522            CompositeMarker,
2523        >(
2524            (processing_element_id, format, ring_buffer,),
2525            0x28c5685f85262033,
2526            fidl::encoding::DynamicFlags::FLEXIBLE,
2527            ___deadline,
2528        )?
2529        .into_result::<CompositeMarker>("create_ring_buffer")?;
2530        Ok(_response.map(|x| x))
2531    }
2532
2533    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2534    /// in the topology supported by this driver as returned by `GetElements` from
2535    /// fuchsia.hardware.audio.signalprocessing.
2536    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2537    /// may retry at a later time.
2538    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2539    /// by `GetElements`.
2540    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2541    /// `DAI_INTERCONNECT`.
2542    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2543    /// the parameters in DaiSupportedFormats may be supported.
2544    /// The vector returned to the caller must contain at least one entry.
2545    pub fn r#get_dai_formats(
2546        &self,
2547        mut processing_element_id: u64,
2548        ___deadline: zx::MonotonicInstant,
2549    ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2550        let _response = self.client.send_query::<
2551            CompositeGetDaiFormatsRequest,
2552            fidl::encoding::FlexibleResultType<CompositeGetDaiFormatsResponse, DriverError>,
2553            CompositeMarker,
2554        >(
2555            (processing_element_id,),
2556            0x3cbeaed59c8f69b,
2557            fidl::encoding::DynamicFlags::FLEXIBLE,
2558            ___deadline,
2559        )?
2560        .into_result::<CompositeMarker>("get_dai_formats")?;
2561        Ok(_response.map(|x| x.dai_formats))
2562    }
2563
2564    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2565    /// processing element specified by `processing_element_id`. The format is based on information
2566    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2567    /// requirement.
2568    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2569    /// by `GetElements`.
2570    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2571    /// `DAI_INTERCONNECT`.
2572    pub fn r#set_dai_format(
2573        &self,
2574        mut processing_element_id: u64,
2575        mut format: &DaiFormat,
2576        ___deadline: zx::MonotonicInstant,
2577    ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2578        let _response = self.client.send_query::<
2579            CompositeSetDaiFormatRequest,
2580            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2581            CompositeMarker,
2582        >(
2583            (processing_element_id, format,),
2584            0x155acf5cc0dc8a84,
2585            fidl::encoding::DynamicFlags::FLEXIBLE,
2586            ___deadline,
2587        )?
2588        .into_result::<CompositeMarker>("set_dai_format")?;
2589        Ok(_response.map(|x| x))
2590    }
2591
2592    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2593    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2594    /// from fuchsia.hardware.audio.signalprocessing.
2595    ///
2596    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2597    /// client may retry this request at a later time.
2598    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2599    /// `GetElements`.
2600    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2601    /// `PACKET_STREAM`.
2602    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2603    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2604    /// combinations of the parameters in `SupportedFormats2` may be supported.
2605    /// The vector returned to the caller must contain at least one entry.
2606    pub fn r#get_packet_stream_formats(
2607        &self,
2608        mut processing_element_id: u64,
2609        ___deadline: zx::MonotonicInstant,
2610    ) -> Result<CompositeGetPacketStreamFormatsResult, fidl::Error> {
2611        let _response = self.client.send_query::<
2612            CompositeGetPacketStreamFormatsRequest,
2613            fidl::encoding::FlexibleResultType<CompositeGetPacketStreamFormatsResponse, DriverError>,
2614            CompositeMarker,
2615        >(
2616            (processing_element_id,),
2617            0x73cc47c6ad39bca7,
2618            fidl::encoding::DynamicFlags::FLEXIBLE,
2619            ___deadline,
2620        )?
2621        .into_result::<CompositeMarker>("get_packet_stream_formats")?;
2622        Ok(_response.map(|x| x.packet_stream_formats))
2623    }
2624
2625    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2626    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
2627    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
2628    /// the client, and any other requirement. The returned `packet_stream` channel is used to
2629    /// access and control the packet stream protocol served by the driver.
2630    ///
2631    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2632    /// `GetElements`.
2633    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2634    /// `PACKET_STREAM`.
2635    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2636    /// at this time, but it should be able to at some future time. This request can be retried.
2637    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2638    ///`format` is not supported.
2639    pub fn r#create_packet_stream(
2640        &self,
2641        mut processing_element_id: u64,
2642        mut format: &Format2,
2643        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
2644        ___deadline: zx::MonotonicInstant,
2645    ) -> Result<CompositeCreatePacketStreamResult, fidl::Error> {
2646        let _response = self.client.send_query::<
2647            CompositeCreatePacketStreamRequest,
2648            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2649            CompositeMarker,
2650        >(
2651            (processing_element_id, format, packet_stream_control,),
2652            0x50e8902b756c707c,
2653            fidl::encoding::DynamicFlags::FLEXIBLE,
2654            ___deadline,
2655        )?
2656        .into_result::<CompositeMarker>("create_packet_stream")?;
2657        Ok(_response.map(|x| x))
2658    }
2659}
2660
2661#[cfg(target_os = "fuchsia")]
2662impl From<CompositeSynchronousProxy> for zx::NullableHandle {
2663    fn from(value: CompositeSynchronousProxy) -> Self {
2664        value.into_channel().into()
2665    }
2666}
2667
2668#[cfg(target_os = "fuchsia")]
2669impl From<fidl::Channel> for CompositeSynchronousProxy {
2670    fn from(value: fidl::Channel) -> Self {
2671        Self::new(value)
2672    }
2673}
2674
2675#[cfg(target_os = "fuchsia")]
2676impl fidl::endpoints::FromClient for CompositeSynchronousProxy {
2677    type Protocol = CompositeMarker;
2678
2679    fn from_client(value: fidl::endpoints::ClientEnd<CompositeMarker>) -> Self {
2680        Self::new(value.into_channel())
2681    }
2682}
2683
2684#[derive(Debug, Clone)]
2685pub struct CompositeProxy {
2686    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2687}
2688
2689impl fidl::endpoints::Proxy for CompositeProxy {
2690    type Protocol = CompositeMarker;
2691
2692    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2693        Self::new(inner)
2694    }
2695
2696    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2697        self.client.into_channel().map_err(|client| Self { client })
2698    }
2699
2700    fn as_channel(&self) -> &::fidl::AsyncChannel {
2701        self.client.as_channel()
2702    }
2703}
2704
2705impl CompositeProxy {
2706    /// Create a new Proxy for fuchsia.hardware.audio/Composite.
2707    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2708        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2709        Self { client: fidl::client::Client::new(channel, protocol_name) }
2710    }
2711
2712    /// Get a Stream of events from the remote end of the protocol.
2713    ///
2714    /// # Panics
2715    ///
2716    /// Panics if the event stream was already taken.
2717    pub fn take_event_stream(&self) -> CompositeEventStream {
2718        CompositeEventStream { event_receiver: self.client.take_event_receiver() }
2719    }
2720
2721    /// Retrieves top level health state.
2722    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2723    pub fn r#get_health_state(
2724        &self,
2725    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
2726    {
2727        CompositeProxyInterface::r#get_health_state(self)
2728    }
2729
2730    /// Connect to a `SignalProcessing` protocol.
2731    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2732    /// the maximum number of connections have already been created, for instance one, then the
2733    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2734    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2735    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2736    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2737    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2738    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2739    /// is intended to be composed, and hence the more verbose name allows differentiation and
2740    /// improved clarity.
2741    pub fn r#signal_processing_connect(
2742        &self,
2743        mut protocol: fidl::endpoints::ServerEnd<
2744            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2745        >,
2746    ) -> Result<(), fidl::Error> {
2747        CompositeProxyInterface::r#signal_processing_connect(self, protocol)
2748    }
2749
2750    /// Resets the hardware including all DAI interconnects and signal processing.
2751    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2752    ///
2753    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2754    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2755    /// any processing elements, and reconstruct any ring buffers.
2756    ///
2757    /// If the driver can't successfully reset the hardware, it will return an error and then close
2758    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2759    pub fn r#reset(
2760        &self,
2761    ) -> fidl::client::QueryResponseFut<
2762        CompositeResetResult,
2763        fidl::encoding::DefaultFuchsiaResourceDialect,
2764    > {
2765        CompositeProxyInterface::r#reset(self)
2766    }
2767
2768    /// Retrieves top level static properties.
2769    pub fn r#get_properties(
2770        &self,
2771    ) -> fidl::client::QueryResponseFut<
2772        CompositeProperties,
2773        fidl::encoding::DefaultFuchsiaResourceDialect,
2774    > {
2775        CompositeProxyInterface::r#get_properties(self)
2776    }
2777
2778    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2779    /// in the topology supported by this driver as returned by `GetElements` from
2780    /// fuchsia.hardware.audio.signalprocessing.
2781    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2782    /// client may retry at a later time.
2783    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2784    /// by `GetElements`.
2785    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2786    /// `RING_BUFFER`.
2787    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2788    /// the parameters in `SupportedFormats2` may be supported.
2789    /// The vector returned to the caller must contain at least one entry.
2790    pub fn r#get_ring_buffer_formats(
2791        &self,
2792        mut processing_element_id: u64,
2793    ) -> fidl::client::QueryResponseFut<
2794        CompositeGetRingBufferFormatsResult,
2795        fidl::encoding::DefaultFuchsiaResourceDialect,
2796    > {
2797        CompositeProxyInterface::r#get_ring_buffer_formats(self, processing_element_id)
2798    }
2799
2800    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2801    /// processing element specified by `processing_element_id`. The format is based on information
2802    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2803    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2804    /// audio buffer provided by the driver.
2805    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2806    /// by `GetElements`.
2807    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2808    /// `RING_BUFFER`.
2809    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2810    /// `format` is not supported.
2811    pub fn r#create_ring_buffer(
2812        &self,
2813        mut processing_element_id: u64,
2814        mut format: &Format2,
2815        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2816    ) -> fidl::client::QueryResponseFut<
2817        CompositeCreateRingBufferResult,
2818        fidl::encoding::DefaultFuchsiaResourceDialect,
2819    > {
2820        CompositeProxyInterface::r#create_ring_buffer(
2821            self,
2822            processing_element_id,
2823            format,
2824            ring_buffer,
2825        )
2826    }
2827
2828    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2829    /// in the topology supported by this driver as returned by `GetElements` from
2830    /// fuchsia.hardware.audio.signalprocessing.
2831    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2832    /// may retry at a later time.
2833    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2834    /// by `GetElements`.
2835    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2836    /// `DAI_INTERCONNECT`.
2837    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2838    /// the parameters in DaiSupportedFormats may be supported.
2839    /// The vector returned to the caller must contain at least one entry.
2840    pub fn r#get_dai_formats(
2841        &self,
2842        mut processing_element_id: u64,
2843    ) -> fidl::client::QueryResponseFut<
2844        CompositeGetDaiFormatsResult,
2845        fidl::encoding::DefaultFuchsiaResourceDialect,
2846    > {
2847        CompositeProxyInterface::r#get_dai_formats(self, processing_element_id)
2848    }
2849
2850    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2851    /// processing element specified by `processing_element_id`. The format is based on information
2852    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2853    /// requirement.
2854    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2855    /// by `GetElements`.
2856    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2857    /// `DAI_INTERCONNECT`.
2858    pub fn r#set_dai_format(
2859        &self,
2860        mut processing_element_id: u64,
2861        mut format: &DaiFormat,
2862    ) -> fidl::client::QueryResponseFut<
2863        CompositeSetDaiFormatResult,
2864        fidl::encoding::DefaultFuchsiaResourceDialect,
2865    > {
2866        CompositeProxyInterface::r#set_dai_format(self, processing_element_id, format)
2867    }
2868
2869    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2870    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2871    /// from fuchsia.hardware.audio.signalprocessing.
2872    ///
2873    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2874    /// client may retry this request at a later time.
2875    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2876    /// `GetElements`.
2877    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2878    /// `PACKET_STREAM`.
2879    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2880    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2881    /// combinations of the parameters in `SupportedFormats2` may be supported.
2882    /// The vector returned to the caller must contain at least one entry.
2883    pub fn r#get_packet_stream_formats(
2884        &self,
2885        mut processing_element_id: u64,
2886    ) -> fidl::client::QueryResponseFut<
2887        CompositeGetPacketStreamFormatsResult,
2888        fidl::encoding::DefaultFuchsiaResourceDialect,
2889    > {
2890        CompositeProxyInterface::r#get_packet_stream_formats(self, processing_element_id)
2891    }
2892
2893    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2894    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
2895    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
2896    /// the client, and any other requirement. The returned `packet_stream` channel is used to
2897    /// access and control the packet stream protocol served by the driver.
2898    ///
2899    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2900    /// `GetElements`.
2901    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2902    /// `PACKET_STREAM`.
2903    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2904    /// at this time, but it should be able to at some future time. This request can be retried.
2905    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2906    ///`format` is not supported.
2907    pub fn r#create_packet_stream(
2908        &self,
2909        mut processing_element_id: u64,
2910        mut format: &Format2,
2911        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
2912    ) -> fidl::client::QueryResponseFut<
2913        CompositeCreatePacketStreamResult,
2914        fidl::encoding::DefaultFuchsiaResourceDialect,
2915    > {
2916        CompositeProxyInterface::r#create_packet_stream(
2917            self,
2918            processing_element_id,
2919            format,
2920            packet_stream_control,
2921        )
2922    }
2923}
2924
2925impl CompositeProxyInterface for CompositeProxy {
2926    type GetHealthStateResponseFut =
2927        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
2928    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
2929        fn _decode(
2930            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2931        ) -> Result<HealthState, fidl::Error> {
2932            let _response = fidl::client::decode_transaction_body::<
2933                HealthGetHealthStateResponse,
2934                fidl::encoding::DefaultFuchsiaResourceDialect,
2935                0x4e146d6bca733a84,
2936            >(_buf?)?;
2937            Ok(_response.state)
2938        }
2939        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
2940            (),
2941            0x4e146d6bca733a84,
2942            fidl::encoding::DynamicFlags::empty(),
2943            _decode,
2944        )
2945    }
2946
2947    fn r#signal_processing_connect(
2948        &self,
2949        mut protocol: fidl::endpoints::ServerEnd<
2950            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2951        >,
2952    ) -> Result<(), fidl::Error> {
2953        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2954            (protocol,),
2955            0xa81907ce6066295,
2956            fidl::encoding::DynamicFlags::empty(),
2957        )
2958    }
2959
2960    type ResetResponseFut = fidl::client::QueryResponseFut<
2961        CompositeResetResult,
2962        fidl::encoding::DefaultFuchsiaResourceDialect,
2963    >;
2964    fn r#reset(&self) -> Self::ResetResponseFut {
2965        fn _decode(
2966            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2967        ) -> Result<CompositeResetResult, fidl::Error> {
2968            let _response = fidl::client::decode_transaction_body::<
2969                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2970                fidl::encoding::DefaultFuchsiaResourceDialect,
2971                0xac355fb98341996,
2972            >(_buf?)?
2973            .into_result::<CompositeMarker>("reset")?;
2974            Ok(_response.map(|x| x))
2975        }
2976        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeResetResult>(
2977            (),
2978            0xac355fb98341996,
2979            fidl::encoding::DynamicFlags::FLEXIBLE,
2980            _decode,
2981        )
2982    }
2983
2984    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2985        CompositeProperties,
2986        fidl::encoding::DefaultFuchsiaResourceDialect,
2987    >;
2988    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2989        fn _decode(
2990            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2991        ) -> Result<CompositeProperties, fidl::Error> {
2992            let _response = fidl::client::decode_transaction_body::<
2993                fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>,
2994                fidl::encoding::DefaultFuchsiaResourceDialect,
2995                0x31846fa0a459942b,
2996            >(_buf?)?
2997            .into_result::<CompositeMarker>("get_properties")?;
2998            Ok(_response.properties)
2999        }
3000        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeProperties>(
3001            (),
3002            0x31846fa0a459942b,
3003            fidl::encoding::DynamicFlags::FLEXIBLE,
3004            _decode,
3005        )
3006    }
3007
3008    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
3009        CompositeGetRingBufferFormatsResult,
3010        fidl::encoding::DefaultFuchsiaResourceDialect,
3011    >;
3012    fn r#get_ring_buffer_formats(
3013        &self,
3014        mut processing_element_id: u64,
3015    ) -> Self::GetRingBufferFormatsResponseFut {
3016        fn _decode(
3017            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3018        ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
3019            let _response = fidl::client::decode_transaction_body::<
3020                fidl::encoding::FlexibleResultType<
3021                    CompositeGetRingBufferFormatsResponse,
3022                    DriverError,
3023                >,
3024                fidl::encoding::DefaultFuchsiaResourceDialect,
3025                0x1d89b701b6816ac4,
3026            >(_buf?)?
3027            .into_result::<CompositeMarker>("get_ring_buffer_formats")?;
3028            Ok(_response.map(|x| x.ring_buffer_formats))
3029        }
3030        self.client.send_query_and_decode::<
3031            CompositeGetRingBufferFormatsRequest,
3032            CompositeGetRingBufferFormatsResult,
3033        >(
3034            (processing_element_id,),
3035            0x1d89b701b6816ac4,
3036            fidl::encoding::DynamicFlags::FLEXIBLE,
3037            _decode,
3038        )
3039    }
3040
3041    type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
3042        CompositeCreateRingBufferResult,
3043        fidl::encoding::DefaultFuchsiaResourceDialect,
3044    >;
3045    fn r#create_ring_buffer(
3046        &self,
3047        mut processing_element_id: u64,
3048        mut format: &Format2,
3049        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3050    ) -> Self::CreateRingBufferResponseFut {
3051        fn _decode(
3052            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3053        ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
3054            let _response = fidl::client::decode_transaction_body::<
3055                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3056                fidl::encoding::DefaultFuchsiaResourceDialect,
3057                0x28c5685f85262033,
3058            >(_buf?)?
3059            .into_result::<CompositeMarker>("create_ring_buffer")?;
3060            Ok(_response.map(|x| x))
3061        }
3062        self.client.send_query_and_decode::<
3063            CompositeCreateRingBufferRequest,
3064            CompositeCreateRingBufferResult,
3065        >(
3066            (processing_element_id, format, ring_buffer,),
3067            0x28c5685f85262033,
3068            fidl::encoding::DynamicFlags::FLEXIBLE,
3069            _decode,
3070        )
3071    }
3072
3073    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
3074        CompositeGetDaiFormatsResult,
3075        fidl::encoding::DefaultFuchsiaResourceDialect,
3076    >;
3077    fn r#get_dai_formats(&self, mut processing_element_id: u64) -> Self::GetDaiFormatsResponseFut {
3078        fn _decode(
3079            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3080        ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
3081            let _response = fidl::client::decode_transaction_body::<
3082                fidl::encoding::FlexibleResultType<CompositeGetDaiFormatsResponse, DriverError>,
3083                fidl::encoding::DefaultFuchsiaResourceDialect,
3084                0x3cbeaed59c8f69b,
3085            >(_buf?)?
3086            .into_result::<CompositeMarker>("get_dai_formats")?;
3087            Ok(_response.map(|x| x.dai_formats))
3088        }
3089        self.client
3090            .send_query_and_decode::<CompositeGetDaiFormatsRequest, CompositeGetDaiFormatsResult>(
3091                (processing_element_id,),
3092                0x3cbeaed59c8f69b,
3093                fidl::encoding::DynamicFlags::FLEXIBLE,
3094                _decode,
3095            )
3096    }
3097
3098    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
3099        CompositeSetDaiFormatResult,
3100        fidl::encoding::DefaultFuchsiaResourceDialect,
3101    >;
3102    fn r#set_dai_format(
3103        &self,
3104        mut processing_element_id: u64,
3105        mut format: &DaiFormat,
3106    ) -> Self::SetDaiFormatResponseFut {
3107        fn _decode(
3108            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3109        ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
3110            let _response = fidl::client::decode_transaction_body::<
3111                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3112                fidl::encoding::DefaultFuchsiaResourceDialect,
3113                0x155acf5cc0dc8a84,
3114            >(_buf?)?
3115            .into_result::<CompositeMarker>("set_dai_format")?;
3116            Ok(_response.map(|x| x))
3117        }
3118        self.client
3119            .send_query_and_decode::<CompositeSetDaiFormatRequest, CompositeSetDaiFormatResult>(
3120                (processing_element_id, format),
3121                0x155acf5cc0dc8a84,
3122                fidl::encoding::DynamicFlags::FLEXIBLE,
3123                _decode,
3124            )
3125    }
3126
3127    type GetPacketStreamFormatsResponseFut = fidl::client::QueryResponseFut<
3128        CompositeGetPacketStreamFormatsResult,
3129        fidl::encoding::DefaultFuchsiaResourceDialect,
3130    >;
3131    fn r#get_packet_stream_formats(
3132        &self,
3133        mut processing_element_id: u64,
3134    ) -> Self::GetPacketStreamFormatsResponseFut {
3135        fn _decode(
3136            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3137        ) -> Result<CompositeGetPacketStreamFormatsResult, fidl::Error> {
3138            let _response = fidl::client::decode_transaction_body::<
3139                fidl::encoding::FlexibleResultType<
3140                    CompositeGetPacketStreamFormatsResponse,
3141                    DriverError,
3142                >,
3143                fidl::encoding::DefaultFuchsiaResourceDialect,
3144                0x73cc47c6ad39bca7,
3145            >(_buf?)?
3146            .into_result::<CompositeMarker>("get_packet_stream_formats")?;
3147            Ok(_response.map(|x| x.packet_stream_formats))
3148        }
3149        self.client.send_query_and_decode::<
3150            CompositeGetPacketStreamFormatsRequest,
3151            CompositeGetPacketStreamFormatsResult,
3152        >(
3153            (processing_element_id,),
3154            0x73cc47c6ad39bca7,
3155            fidl::encoding::DynamicFlags::FLEXIBLE,
3156            _decode,
3157        )
3158    }
3159
3160    type CreatePacketStreamResponseFut = fidl::client::QueryResponseFut<
3161        CompositeCreatePacketStreamResult,
3162        fidl::encoding::DefaultFuchsiaResourceDialect,
3163    >;
3164    fn r#create_packet_stream(
3165        &self,
3166        mut processing_element_id: u64,
3167        mut format: &Format2,
3168        mut packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3169    ) -> Self::CreatePacketStreamResponseFut {
3170        fn _decode(
3171            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3172        ) -> Result<CompositeCreatePacketStreamResult, fidl::Error> {
3173            let _response = fidl::client::decode_transaction_body::<
3174                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
3175                fidl::encoding::DefaultFuchsiaResourceDialect,
3176                0x50e8902b756c707c,
3177            >(_buf?)?
3178            .into_result::<CompositeMarker>("create_packet_stream")?;
3179            Ok(_response.map(|x| x))
3180        }
3181        self.client.send_query_and_decode::<
3182            CompositeCreatePacketStreamRequest,
3183            CompositeCreatePacketStreamResult,
3184        >(
3185            (processing_element_id, format, packet_stream_control,),
3186            0x50e8902b756c707c,
3187            fidl::encoding::DynamicFlags::FLEXIBLE,
3188            _decode,
3189        )
3190    }
3191}
3192
3193pub struct CompositeEventStream {
3194    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3195}
3196
3197impl std::marker::Unpin for CompositeEventStream {}
3198
3199impl futures::stream::FusedStream for CompositeEventStream {
3200    fn is_terminated(&self) -> bool {
3201        self.event_receiver.is_terminated()
3202    }
3203}
3204
3205impl futures::Stream for CompositeEventStream {
3206    type Item = Result<CompositeEvent, fidl::Error>;
3207
3208    fn poll_next(
3209        mut self: std::pin::Pin<&mut Self>,
3210        cx: &mut std::task::Context<'_>,
3211    ) -> std::task::Poll<Option<Self::Item>> {
3212        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3213            &mut self.event_receiver,
3214            cx
3215        )?) {
3216            Some(buf) => std::task::Poll::Ready(Some(CompositeEvent::decode(buf))),
3217            None => std::task::Poll::Ready(None),
3218        }
3219    }
3220}
3221
3222#[derive(Debug)]
3223pub enum CompositeEvent {
3224    #[non_exhaustive]
3225    _UnknownEvent {
3226        /// Ordinal of the event that was sent.
3227        ordinal: u64,
3228    },
3229}
3230
3231impl CompositeEvent {
3232    /// Decodes a message buffer as a [`CompositeEvent`].
3233    fn decode(
3234        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3235    ) -> Result<CompositeEvent, fidl::Error> {
3236        let (bytes, _handles) = buf.split_mut();
3237        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3238        debug_assert_eq!(tx_header.tx_id, 0);
3239        match tx_header.ordinal {
3240            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3241                Ok(CompositeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3242            }
3243            _ => Err(fidl::Error::UnknownOrdinal {
3244                ordinal: tx_header.ordinal,
3245                protocol_name: <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3246            }),
3247        }
3248    }
3249}
3250
3251/// A Stream of incoming requests for fuchsia.hardware.audio/Composite.
3252pub struct CompositeRequestStream {
3253    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3254    is_terminated: bool,
3255}
3256
3257impl std::marker::Unpin for CompositeRequestStream {}
3258
3259impl futures::stream::FusedStream for CompositeRequestStream {
3260    fn is_terminated(&self) -> bool {
3261        self.is_terminated
3262    }
3263}
3264
3265impl fidl::endpoints::RequestStream for CompositeRequestStream {
3266    type Protocol = CompositeMarker;
3267    type ControlHandle = CompositeControlHandle;
3268
3269    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3270        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3271    }
3272
3273    fn control_handle(&self) -> Self::ControlHandle {
3274        CompositeControlHandle { inner: self.inner.clone() }
3275    }
3276
3277    fn into_inner(
3278        self,
3279    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3280    {
3281        (self.inner, self.is_terminated)
3282    }
3283
3284    fn from_inner(
3285        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3286        is_terminated: bool,
3287    ) -> Self {
3288        Self { inner, is_terminated }
3289    }
3290}
3291
3292impl futures::Stream for CompositeRequestStream {
3293    type Item = Result<CompositeRequest, fidl::Error>;
3294
3295    fn poll_next(
3296        mut self: std::pin::Pin<&mut Self>,
3297        cx: &mut std::task::Context<'_>,
3298    ) -> std::task::Poll<Option<Self::Item>> {
3299        let this = &mut *self;
3300        if this.inner.check_shutdown(cx) {
3301            this.is_terminated = true;
3302            return std::task::Poll::Ready(None);
3303        }
3304        if this.is_terminated {
3305            panic!("polled CompositeRequestStream after completion");
3306        }
3307        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3308            |bytes, handles| {
3309                match this.inner.channel().read_etc(cx, bytes, handles) {
3310                    std::task::Poll::Ready(Ok(())) => {}
3311                    std::task::Poll::Pending => return std::task::Poll::Pending,
3312                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3313                        this.is_terminated = true;
3314                        return std::task::Poll::Ready(None);
3315                    }
3316                    std::task::Poll::Ready(Err(e)) => {
3317                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3318                            e.into(),
3319                        ))));
3320                    }
3321                }
3322
3323                // A message has been received from the channel
3324                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3325
3326                std::task::Poll::Ready(Some(match header.ordinal {
3327                    0x4e146d6bca733a84 => {
3328                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3329                        let mut req = fidl::new_empty!(
3330                            fidl::encoding::EmptyPayload,
3331                            fidl::encoding::DefaultFuchsiaResourceDialect
3332                        );
3333                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3334                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3335                        Ok(CompositeRequest::GetHealthState {
3336                            responder: CompositeGetHealthStateResponder {
3337                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3338                                tx_id: header.tx_id,
3339                            },
3340                        })
3341                    }
3342                    0xa81907ce6066295 => {
3343                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3344                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3345                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3346                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3347                        Ok(CompositeRequest::SignalProcessingConnect {
3348                            protocol: req.protocol,
3349
3350                            control_handle,
3351                        })
3352                    }
3353                    0xac355fb98341996 => {
3354                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3355                        let mut req = fidl::new_empty!(
3356                            fidl::encoding::EmptyPayload,
3357                            fidl::encoding::DefaultFuchsiaResourceDialect
3358                        );
3359                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3360                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3361                        Ok(CompositeRequest::Reset {
3362                            responder: CompositeResetResponder {
3363                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3364                                tx_id: header.tx_id,
3365                            },
3366                        })
3367                    }
3368                    0x31846fa0a459942b => {
3369                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3370                        let mut req = fidl::new_empty!(
3371                            fidl::encoding::EmptyPayload,
3372                            fidl::encoding::DefaultFuchsiaResourceDialect
3373                        );
3374                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3375                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3376                        Ok(CompositeRequest::GetProperties {
3377                            responder: CompositeGetPropertiesResponder {
3378                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3379                                tx_id: header.tx_id,
3380                            },
3381                        })
3382                    }
3383                    0x1d89b701b6816ac4 => {
3384                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3385                        let mut req = fidl::new_empty!(
3386                            CompositeGetRingBufferFormatsRequest,
3387                            fidl::encoding::DefaultFuchsiaResourceDialect
3388                        );
3389                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetRingBufferFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3390                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3391                        Ok(CompositeRequest::GetRingBufferFormats {
3392                            processing_element_id: req.processing_element_id,
3393
3394                            responder: CompositeGetRingBufferFormatsResponder {
3395                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3396                                tx_id: header.tx_id,
3397                            },
3398                        })
3399                    }
3400                    0x28c5685f85262033 => {
3401                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3402                        let mut req = fidl::new_empty!(
3403                            CompositeCreateRingBufferRequest,
3404                            fidl::encoding::DefaultFuchsiaResourceDialect
3405                        );
3406                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
3407                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3408                        Ok(CompositeRequest::CreateRingBuffer {
3409                            processing_element_id: req.processing_element_id,
3410                            format: req.format,
3411                            ring_buffer: req.ring_buffer,
3412
3413                            responder: CompositeCreateRingBufferResponder {
3414                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3415                                tx_id: header.tx_id,
3416                            },
3417                        })
3418                    }
3419                    0x3cbeaed59c8f69b => {
3420                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3421                        let mut req = fidl::new_empty!(
3422                            CompositeGetDaiFormatsRequest,
3423                            fidl::encoding::DefaultFuchsiaResourceDialect
3424                        );
3425                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetDaiFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3426                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3427                        Ok(CompositeRequest::GetDaiFormats {
3428                            processing_element_id: req.processing_element_id,
3429
3430                            responder: CompositeGetDaiFormatsResponder {
3431                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3432                                tx_id: header.tx_id,
3433                            },
3434                        })
3435                    }
3436                    0x155acf5cc0dc8a84 => {
3437                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3438                        let mut req = fidl::new_empty!(
3439                            CompositeSetDaiFormatRequest,
3440                            fidl::encoding::DefaultFuchsiaResourceDialect
3441                        );
3442                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
3443                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3444                        Ok(CompositeRequest::SetDaiFormat {
3445                            processing_element_id: req.processing_element_id,
3446                            format: req.format,
3447
3448                            responder: CompositeSetDaiFormatResponder {
3449                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3450                                tx_id: header.tx_id,
3451                            },
3452                        })
3453                    }
3454                    0x73cc47c6ad39bca7 => {
3455                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3456                        let mut req = fidl::new_empty!(
3457                            CompositeGetPacketStreamFormatsRequest,
3458                            fidl::encoding::DefaultFuchsiaResourceDialect
3459                        );
3460                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetPacketStreamFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3461                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3462                        Ok(CompositeRequest::GetPacketStreamFormats {
3463                            processing_element_id: req.processing_element_id,
3464
3465                            responder: CompositeGetPacketStreamFormatsResponder {
3466                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3467                                tx_id: header.tx_id,
3468                            },
3469                        })
3470                    }
3471                    0x50e8902b756c707c => {
3472                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3473                        let mut req = fidl::new_empty!(
3474                            CompositeCreatePacketStreamRequest,
3475                            fidl::encoding::DefaultFuchsiaResourceDialect
3476                        );
3477                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreatePacketStreamRequest>(&header, _body_bytes, handles, &mut req)?;
3478                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3479                        Ok(CompositeRequest::CreatePacketStream {
3480                            processing_element_id: req.processing_element_id,
3481                            format: req.format,
3482                            packet_stream_control: req.packet_stream_control,
3483
3484                            responder: CompositeCreatePacketStreamResponder {
3485                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3486                                tx_id: header.tx_id,
3487                            },
3488                        })
3489                    }
3490                    _ if header.tx_id == 0
3491                        && header
3492                            .dynamic_flags()
3493                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3494                    {
3495                        Ok(CompositeRequest::_UnknownMethod {
3496                            ordinal: header.ordinal,
3497                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
3498                            method_type: fidl::MethodType::OneWay,
3499                        })
3500                    }
3501                    _ if header
3502                        .dynamic_flags()
3503                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3504                    {
3505                        this.inner.send_framework_err(
3506                            fidl::encoding::FrameworkErr::UnknownMethod,
3507                            header.tx_id,
3508                            header.ordinal,
3509                            header.dynamic_flags(),
3510                            (bytes, handles),
3511                        )?;
3512                        Ok(CompositeRequest::_UnknownMethod {
3513                            ordinal: header.ordinal,
3514                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
3515                            method_type: fidl::MethodType::TwoWay,
3516                        })
3517                    }
3518                    _ => Err(fidl::Error::UnknownOrdinal {
3519                        ordinal: header.ordinal,
3520                        protocol_name:
3521                            <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3522                    }),
3523                }))
3524            },
3525        )
3526    }
3527}
3528
3529#[derive(Debug)]
3530pub enum CompositeRequest {
3531    /// Retrieves top level health state.
3532    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
3533    GetHealthState { responder: CompositeGetHealthStateResponder },
3534    /// Connect to a `SignalProcessing` protocol.
3535    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
3536    /// the maximum number of connections have already been created, for instance one, then the
3537    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
3538    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
3539    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
3540    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
3541    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
3542    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
3543    /// is intended to be composed, and hence the more verbose name allows differentiation and
3544    /// improved clarity.
3545    SignalProcessingConnect {
3546        protocol: fidl::endpoints::ServerEnd<
3547            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3548        >,
3549        control_handle: CompositeControlHandle,
3550    },
3551    /// Resets the hardware including all DAI interconnects and signal processing.
3552    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
3553    ///
3554    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
3555    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
3556    /// any processing elements, and reconstruct any ring buffers.
3557    ///
3558    /// If the driver can't successfully reset the hardware, it will return an error and then close
3559    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
3560    Reset { responder: CompositeResetResponder },
3561    /// Retrieves top level static properties.
3562    GetProperties { responder: CompositeGetPropertiesResponder },
3563    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
3564    /// in the topology supported by this driver as returned by `GetElements` from
3565    /// fuchsia.hardware.audio.signalprocessing.
3566    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
3567    /// client may retry at a later time.
3568    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3569    /// by `GetElements`.
3570    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3571    /// `RING_BUFFER`.
3572    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
3573    /// the parameters in `SupportedFormats2` may be supported.
3574    /// The vector returned to the caller must contain at least one entry.
3575    GetRingBufferFormats {
3576        processing_element_id: u64,
3577        responder: CompositeGetRingBufferFormatsResponder,
3578    },
3579    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
3580    /// processing element specified by `processing_element_id`. The format is based on information
3581    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
3582    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
3583    /// audio buffer provided by the driver.
3584    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3585    /// by `GetElements`.
3586    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3587    /// `RING_BUFFER`.
3588    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
3589    /// `format` is not supported.
3590    CreateRingBuffer {
3591        processing_element_id: u64,
3592        format: Format2,
3593        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3594        responder: CompositeCreateRingBufferResponder,
3595    },
3596    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
3597    /// in the topology supported by this driver as returned by `GetElements` from
3598    /// fuchsia.hardware.audio.signalprocessing.
3599    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
3600    /// may retry at a later time.
3601    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3602    /// by `GetElements`.
3603    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3604    /// `DAI_INTERCONNECT`.
3605    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
3606    /// the parameters in DaiSupportedFormats may be supported.
3607    /// The vector returned to the caller must contain at least one entry.
3608    GetDaiFormats { processing_element_id: u64, responder: CompositeGetDaiFormatsResponder },
3609    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
3610    /// processing element specified by `processing_element_id`. The format is based on information
3611    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
3612    /// requirement.
3613    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3614    /// by `GetElements`.
3615    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3616    /// `DAI_INTERCONNECT`.
3617    SetDaiFormat {
3618        processing_element_id: u64,
3619        format: DaiFormat,
3620        responder: CompositeSetDaiFormatResponder,
3621    },
3622    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
3623    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
3624    /// from fuchsia.hardware.audio.signalprocessing.
3625    ///
3626    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
3627    /// client may retry this request at a later time.
3628    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
3629    /// `GetElements`.
3630    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3631    /// `PACKET_STREAM`.
3632    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
3633    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
3634    /// combinations of the parameters in `SupportedFormats2` may be supported.
3635    /// The vector returned to the caller must contain at least one entry.
3636    GetPacketStreamFormats {
3637        processing_element_id: u64,
3638        responder: CompositeGetPacketStreamFormatsResponder,
3639    },
3640    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
3641    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
3642    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
3643    /// the client, and any other requirement. The returned `packet_stream` channel is used to
3644    /// access and control the packet stream protocol served by the driver.
3645    ///
3646    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
3647    /// `GetElements`.
3648    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3649    /// `PACKET_STREAM`.
3650    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
3651    /// at this time, but it should be able to at some future time. This request can be retried.
3652    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
3653    ///`format` is not supported.
3654    CreatePacketStream {
3655        processing_element_id: u64,
3656        format: Format2,
3657        packet_stream_control: fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3658        responder: CompositeCreatePacketStreamResponder,
3659    },
3660    /// An interaction was received which does not match any known method.
3661    #[non_exhaustive]
3662    _UnknownMethod {
3663        /// Ordinal of the method that was called.
3664        ordinal: u64,
3665        control_handle: CompositeControlHandle,
3666        method_type: fidl::MethodType,
3667    },
3668}
3669
3670impl CompositeRequest {
3671    #[allow(irrefutable_let_patterns)]
3672    pub fn into_get_health_state(self) -> Option<(CompositeGetHealthStateResponder)> {
3673        if let CompositeRequest::GetHealthState { responder } = self {
3674            Some((responder))
3675        } else {
3676            None
3677        }
3678    }
3679
3680    #[allow(irrefutable_let_patterns)]
3681    pub fn into_signal_processing_connect(
3682        self,
3683    ) -> Option<(
3684        fidl::endpoints::ServerEnd<
3685            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3686        >,
3687        CompositeControlHandle,
3688    )> {
3689        if let CompositeRequest::SignalProcessingConnect { protocol, control_handle } = self {
3690            Some((protocol, control_handle))
3691        } else {
3692            None
3693        }
3694    }
3695
3696    #[allow(irrefutable_let_patterns)]
3697    pub fn into_reset(self) -> Option<(CompositeResetResponder)> {
3698        if let CompositeRequest::Reset { responder } = self { Some((responder)) } else { None }
3699    }
3700
3701    #[allow(irrefutable_let_patterns)]
3702    pub fn into_get_properties(self) -> Option<(CompositeGetPropertiesResponder)> {
3703        if let CompositeRequest::GetProperties { responder } = self {
3704            Some((responder))
3705        } else {
3706            None
3707        }
3708    }
3709
3710    #[allow(irrefutable_let_patterns)]
3711    pub fn into_get_ring_buffer_formats(
3712        self,
3713    ) -> Option<(u64, CompositeGetRingBufferFormatsResponder)> {
3714        if let CompositeRequest::GetRingBufferFormats { processing_element_id, responder } = self {
3715            Some((processing_element_id, responder))
3716        } else {
3717            None
3718        }
3719    }
3720
3721    #[allow(irrefutable_let_patterns)]
3722    pub fn into_create_ring_buffer(
3723        self,
3724    ) -> Option<(
3725        u64,
3726        Format2,
3727        fidl::endpoints::ServerEnd<RingBufferMarker>,
3728        CompositeCreateRingBufferResponder,
3729    )> {
3730        if let CompositeRequest::CreateRingBuffer {
3731            processing_element_id,
3732            format,
3733            ring_buffer,
3734            responder,
3735        } = self
3736        {
3737            Some((processing_element_id, format, ring_buffer, responder))
3738        } else {
3739            None
3740        }
3741    }
3742
3743    #[allow(irrefutable_let_patterns)]
3744    pub fn into_get_dai_formats(self) -> Option<(u64, CompositeGetDaiFormatsResponder)> {
3745        if let CompositeRequest::GetDaiFormats { processing_element_id, responder } = self {
3746            Some((processing_element_id, responder))
3747        } else {
3748            None
3749        }
3750    }
3751
3752    #[allow(irrefutable_let_patterns)]
3753    pub fn into_set_dai_format(self) -> Option<(u64, DaiFormat, CompositeSetDaiFormatResponder)> {
3754        if let CompositeRequest::SetDaiFormat { processing_element_id, format, responder } = self {
3755            Some((processing_element_id, format, responder))
3756        } else {
3757            None
3758        }
3759    }
3760
3761    #[allow(irrefutable_let_patterns)]
3762    pub fn into_get_packet_stream_formats(
3763        self,
3764    ) -> Option<(u64, CompositeGetPacketStreamFormatsResponder)> {
3765        if let CompositeRequest::GetPacketStreamFormats { processing_element_id, responder } = self
3766        {
3767            Some((processing_element_id, responder))
3768        } else {
3769            None
3770        }
3771    }
3772
3773    #[allow(irrefutable_let_patterns)]
3774    pub fn into_create_packet_stream(
3775        self,
3776    ) -> Option<(
3777        u64,
3778        Format2,
3779        fidl::endpoints::ServerEnd<PacketStreamControlMarker>,
3780        CompositeCreatePacketStreamResponder,
3781    )> {
3782        if let CompositeRequest::CreatePacketStream {
3783            processing_element_id,
3784            format,
3785            packet_stream_control,
3786            responder,
3787        } = self
3788        {
3789            Some((processing_element_id, format, packet_stream_control, responder))
3790        } else {
3791            None
3792        }
3793    }
3794
3795    /// Name of the method defined in FIDL
3796    pub fn method_name(&self) -> &'static str {
3797        match *self {
3798            CompositeRequest::GetHealthState { .. } => "get_health_state",
3799            CompositeRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
3800            CompositeRequest::Reset { .. } => "reset",
3801            CompositeRequest::GetProperties { .. } => "get_properties",
3802            CompositeRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
3803            CompositeRequest::CreateRingBuffer { .. } => "create_ring_buffer",
3804            CompositeRequest::GetDaiFormats { .. } => "get_dai_formats",
3805            CompositeRequest::SetDaiFormat { .. } => "set_dai_format",
3806            CompositeRequest::GetPacketStreamFormats { .. } => "get_packet_stream_formats",
3807            CompositeRequest::CreatePacketStream { .. } => "create_packet_stream",
3808            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3809                "unknown one-way method"
3810            }
3811            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3812                "unknown two-way method"
3813            }
3814        }
3815    }
3816}
3817
3818#[derive(Debug, Clone)]
3819pub struct CompositeControlHandle {
3820    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3821}
3822
3823impl CompositeControlHandle {
3824    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3825        self.inner.shutdown_with_epitaph(status.into())
3826    }
3827}
3828
3829impl fidl::endpoints::ControlHandle for CompositeControlHandle {
3830    fn shutdown(&self) {
3831        self.inner.shutdown()
3832    }
3833
3834    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3835        self.inner.shutdown_with_epitaph(status)
3836    }
3837
3838    fn is_closed(&self) -> bool {
3839        self.inner.channel().is_closed()
3840    }
3841    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3842        self.inner.channel().on_closed()
3843    }
3844
3845    #[cfg(target_os = "fuchsia")]
3846    fn signal_peer(
3847        &self,
3848        clear_mask: zx::Signals,
3849        set_mask: zx::Signals,
3850    ) -> Result<(), zx_status::Status> {
3851        use fidl::Peered;
3852        self.inner.channel().signal_peer(clear_mask, set_mask)
3853    }
3854}
3855
3856impl CompositeControlHandle {}
3857
3858#[must_use = "FIDL methods require a response to be sent"]
3859#[derive(Debug)]
3860pub struct CompositeGetHealthStateResponder {
3861    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3862    tx_id: u32,
3863}
3864
3865/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3866/// if the responder is dropped without sending a response, so that the client
3867/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3868impl std::ops::Drop for CompositeGetHealthStateResponder {
3869    fn drop(&mut self) {
3870        self.control_handle.shutdown();
3871        // Safety: drops once, never accessed again
3872        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3873    }
3874}
3875
3876impl fidl::endpoints::Responder for CompositeGetHealthStateResponder {
3877    type ControlHandle = CompositeControlHandle;
3878
3879    fn control_handle(&self) -> &CompositeControlHandle {
3880        &self.control_handle
3881    }
3882
3883    fn drop_without_shutdown(mut self) {
3884        // Safety: drops once, never accessed again due to mem::forget
3885        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3886        // Prevent Drop from running (which would shut down the channel)
3887        std::mem::forget(self);
3888    }
3889}
3890
3891impl CompositeGetHealthStateResponder {
3892    /// Sends a response to the FIDL transaction.
3893    ///
3894    /// Sets the channel to shutdown if an error occurs.
3895    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3896        let _result = self.send_raw(state);
3897        if _result.is_err() {
3898            self.control_handle.shutdown();
3899        }
3900        self.drop_without_shutdown();
3901        _result
3902    }
3903
3904    /// Similar to "send" but does not shutdown the channel if an error occurs.
3905    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3906        let _result = self.send_raw(state);
3907        self.drop_without_shutdown();
3908        _result
3909    }
3910
3911    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
3912        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
3913            (state,),
3914            self.tx_id,
3915            0x4e146d6bca733a84,
3916            fidl::encoding::DynamicFlags::empty(),
3917        )
3918    }
3919}
3920
3921#[must_use = "FIDL methods require a response to be sent"]
3922#[derive(Debug)]
3923pub struct CompositeResetResponder {
3924    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3925    tx_id: u32,
3926}
3927
3928/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3929/// if the responder is dropped without sending a response, so that the client
3930/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3931impl std::ops::Drop for CompositeResetResponder {
3932    fn drop(&mut self) {
3933        self.control_handle.shutdown();
3934        // Safety: drops once, never accessed again
3935        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3936    }
3937}
3938
3939impl fidl::endpoints::Responder for CompositeResetResponder {
3940    type ControlHandle = CompositeControlHandle;
3941
3942    fn control_handle(&self) -> &CompositeControlHandle {
3943        &self.control_handle
3944    }
3945
3946    fn drop_without_shutdown(mut self) {
3947        // Safety: drops once, never accessed again due to mem::forget
3948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3949        // Prevent Drop from running (which would shut down the channel)
3950        std::mem::forget(self);
3951    }
3952}
3953
3954impl CompositeResetResponder {
3955    /// Sends a response to the FIDL transaction.
3956    ///
3957    /// Sets the channel to shutdown if an error occurs.
3958    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3959        let _result = self.send_raw(result);
3960        if _result.is_err() {
3961            self.control_handle.shutdown();
3962        }
3963        self.drop_without_shutdown();
3964        _result
3965    }
3966
3967    /// Similar to "send" but does not shutdown the channel if an error occurs.
3968    pub fn send_no_shutdown_on_err(
3969        self,
3970        mut result: Result<(), DriverError>,
3971    ) -> Result<(), fidl::Error> {
3972        let _result = self.send_raw(result);
3973        self.drop_without_shutdown();
3974        _result
3975    }
3976
3977    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3978        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3979            fidl::encoding::EmptyStruct,
3980            DriverError,
3981        >>(
3982            fidl::encoding::FlexibleResult::new(result),
3983            self.tx_id,
3984            0xac355fb98341996,
3985            fidl::encoding::DynamicFlags::FLEXIBLE,
3986        )
3987    }
3988}
3989
3990#[must_use = "FIDL methods require a response to be sent"]
3991#[derive(Debug)]
3992pub struct CompositeGetPropertiesResponder {
3993    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3994    tx_id: u32,
3995}
3996
3997/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3998/// if the responder is dropped without sending a response, so that the client
3999/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4000impl std::ops::Drop for CompositeGetPropertiesResponder {
4001    fn drop(&mut self) {
4002        self.control_handle.shutdown();
4003        // Safety: drops once, never accessed again
4004        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4005    }
4006}
4007
4008impl fidl::endpoints::Responder for CompositeGetPropertiesResponder {
4009    type ControlHandle = CompositeControlHandle;
4010
4011    fn control_handle(&self) -> &CompositeControlHandle {
4012        &self.control_handle
4013    }
4014
4015    fn drop_without_shutdown(mut self) {
4016        // Safety: drops once, never accessed again due to mem::forget
4017        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4018        // Prevent Drop from running (which would shut down the channel)
4019        std::mem::forget(self);
4020    }
4021}
4022
4023impl CompositeGetPropertiesResponder {
4024    /// Sends a response to the FIDL transaction.
4025    ///
4026    /// Sets the channel to shutdown if an error occurs.
4027    pub fn send(self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
4028        let _result = self.send_raw(properties);
4029        if _result.is_err() {
4030            self.control_handle.shutdown();
4031        }
4032        self.drop_without_shutdown();
4033        _result
4034    }
4035
4036    /// Similar to "send" but does not shutdown the channel if an error occurs.
4037    pub fn send_no_shutdown_on_err(
4038        self,
4039        mut properties: &CompositeProperties,
4040    ) -> Result<(), fidl::Error> {
4041        let _result = self.send_raw(properties);
4042        self.drop_without_shutdown();
4043        _result
4044    }
4045
4046    fn send_raw(&self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
4047        self.control_handle
4048            .inner
4049            .send::<fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>>(
4050                fidl::encoding::Flexible::new((properties,)),
4051                self.tx_id,
4052                0x31846fa0a459942b,
4053                fidl::encoding::DynamicFlags::FLEXIBLE,
4054            )
4055    }
4056}
4057
4058#[must_use = "FIDL methods require a response to be sent"]
4059#[derive(Debug)]
4060pub struct CompositeGetRingBufferFormatsResponder {
4061    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4062    tx_id: u32,
4063}
4064
4065/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4066/// if the responder is dropped without sending a response, so that the client
4067/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4068impl std::ops::Drop for CompositeGetRingBufferFormatsResponder {
4069    fn drop(&mut self) {
4070        self.control_handle.shutdown();
4071        // Safety: drops once, never accessed again
4072        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4073    }
4074}
4075
4076impl fidl::endpoints::Responder for CompositeGetRingBufferFormatsResponder {
4077    type ControlHandle = CompositeControlHandle;
4078
4079    fn control_handle(&self) -> &CompositeControlHandle {
4080        &self.control_handle
4081    }
4082
4083    fn drop_without_shutdown(mut self) {
4084        // Safety: drops once, never accessed again due to mem::forget
4085        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4086        // Prevent Drop from running (which would shut down the channel)
4087        std::mem::forget(self);
4088    }
4089}
4090
4091impl CompositeGetRingBufferFormatsResponder {
4092    /// Sends a response to the FIDL transaction.
4093    ///
4094    /// Sets the channel to shutdown if an error occurs.
4095    pub fn send(
4096        self,
4097        mut result: Result<&[SupportedFormats2], DriverError>,
4098    ) -> Result<(), fidl::Error> {
4099        let _result = self.send_raw(result);
4100        if _result.is_err() {
4101            self.control_handle.shutdown();
4102        }
4103        self.drop_without_shutdown();
4104        _result
4105    }
4106
4107    /// Similar to "send" but does not shutdown the channel if an error occurs.
4108    pub fn send_no_shutdown_on_err(
4109        self,
4110        mut result: Result<&[SupportedFormats2], DriverError>,
4111    ) -> Result<(), fidl::Error> {
4112        let _result = self.send_raw(result);
4113        self.drop_without_shutdown();
4114        _result
4115    }
4116
4117    fn send_raw(
4118        &self,
4119        mut result: Result<&[SupportedFormats2], DriverError>,
4120    ) -> Result<(), fidl::Error> {
4121        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4122            CompositeGetRingBufferFormatsResponse,
4123            DriverError,
4124        >>(
4125            fidl::encoding::FlexibleResult::new(
4126                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
4127            ),
4128            self.tx_id,
4129            0x1d89b701b6816ac4,
4130            fidl::encoding::DynamicFlags::FLEXIBLE,
4131        )
4132    }
4133}
4134
4135#[must_use = "FIDL methods require a response to be sent"]
4136#[derive(Debug)]
4137pub struct CompositeCreateRingBufferResponder {
4138    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4139    tx_id: u32,
4140}
4141
4142/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4143/// if the responder is dropped without sending a response, so that the client
4144/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4145impl std::ops::Drop for CompositeCreateRingBufferResponder {
4146    fn drop(&mut self) {
4147        self.control_handle.shutdown();
4148        // Safety: drops once, never accessed again
4149        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4150    }
4151}
4152
4153impl fidl::endpoints::Responder for CompositeCreateRingBufferResponder {
4154    type ControlHandle = CompositeControlHandle;
4155
4156    fn control_handle(&self) -> &CompositeControlHandle {
4157        &self.control_handle
4158    }
4159
4160    fn drop_without_shutdown(mut self) {
4161        // Safety: drops once, never accessed again due to mem::forget
4162        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4163        // Prevent Drop from running (which would shut down the channel)
4164        std::mem::forget(self);
4165    }
4166}
4167
4168impl CompositeCreateRingBufferResponder {
4169    /// Sends a response to the FIDL transaction.
4170    ///
4171    /// Sets the channel to shutdown if an error occurs.
4172    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4173        let _result = self.send_raw(result);
4174        if _result.is_err() {
4175            self.control_handle.shutdown();
4176        }
4177        self.drop_without_shutdown();
4178        _result
4179    }
4180
4181    /// Similar to "send" but does not shutdown the channel if an error occurs.
4182    pub fn send_no_shutdown_on_err(
4183        self,
4184        mut result: Result<(), DriverError>,
4185    ) -> Result<(), fidl::Error> {
4186        let _result = self.send_raw(result);
4187        self.drop_without_shutdown();
4188        _result
4189    }
4190
4191    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4192        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4193            fidl::encoding::EmptyStruct,
4194            DriverError,
4195        >>(
4196            fidl::encoding::FlexibleResult::new(result),
4197            self.tx_id,
4198            0x28c5685f85262033,
4199            fidl::encoding::DynamicFlags::FLEXIBLE,
4200        )
4201    }
4202}
4203
4204#[must_use = "FIDL methods require a response to be sent"]
4205#[derive(Debug)]
4206pub struct CompositeGetDaiFormatsResponder {
4207    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4208    tx_id: u32,
4209}
4210
4211/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4212/// if the responder is dropped without sending a response, so that the client
4213/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4214impl std::ops::Drop for CompositeGetDaiFormatsResponder {
4215    fn drop(&mut self) {
4216        self.control_handle.shutdown();
4217        // Safety: drops once, never accessed again
4218        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4219    }
4220}
4221
4222impl fidl::endpoints::Responder for CompositeGetDaiFormatsResponder {
4223    type ControlHandle = CompositeControlHandle;
4224
4225    fn control_handle(&self) -> &CompositeControlHandle {
4226        &self.control_handle
4227    }
4228
4229    fn drop_without_shutdown(mut self) {
4230        // Safety: drops once, never accessed again due to mem::forget
4231        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4232        // Prevent Drop from running (which would shut down the channel)
4233        std::mem::forget(self);
4234    }
4235}
4236
4237impl CompositeGetDaiFormatsResponder {
4238    /// Sends a response to the FIDL transaction.
4239    ///
4240    /// Sets the channel to shutdown if an error occurs.
4241    pub fn send(
4242        self,
4243        mut result: Result<&[DaiSupportedFormats], DriverError>,
4244    ) -> Result<(), fidl::Error> {
4245        let _result = self.send_raw(result);
4246        if _result.is_err() {
4247            self.control_handle.shutdown();
4248        }
4249        self.drop_without_shutdown();
4250        _result
4251    }
4252
4253    /// Similar to "send" but does not shutdown the channel if an error occurs.
4254    pub fn send_no_shutdown_on_err(
4255        self,
4256        mut result: Result<&[DaiSupportedFormats], DriverError>,
4257    ) -> Result<(), fidl::Error> {
4258        let _result = self.send_raw(result);
4259        self.drop_without_shutdown();
4260        _result
4261    }
4262
4263    fn send_raw(
4264        &self,
4265        mut result: Result<&[DaiSupportedFormats], DriverError>,
4266    ) -> Result<(), fidl::Error> {
4267        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4268            CompositeGetDaiFormatsResponse,
4269            DriverError,
4270        >>(
4271            fidl::encoding::FlexibleResult::new(result.map(|dai_formats| (dai_formats,))),
4272            self.tx_id,
4273            0x3cbeaed59c8f69b,
4274            fidl::encoding::DynamicFlags::FLEXIBLE,
4275        )
4276    }
4277}
4278
4279#[must_use = "FIDL methods require a response to be sent"]
4280#[derive(Debug)]
4281pub struct CompositeSetDaiFormatResponder {
4282    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4283    tx_id: u32,
4284}
4285
4286/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4287/// if the responder is dropped without sending a response, so that the client
4288/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4289impl std::ops::Drop for CompositeSetDaiFormatResponder {
4290    fn drop(&mut self) {
4291        self.control_handle.shutdown();
4292        // Safety: drops once, never accessed again
4293        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4294    }
4295}
4296
4297impl fidl::endpoints::Responder for CompositeSetDaiFormatResponder {
4298    type ControlHandle = CompositeControlHandle;
4299
4300    fn control_handle(&self) -> &CompositeControlHandle {
4301        &self.control_handle
4302    }
4303
4304    fn drop_without_shutdown(mut self) {
4305        // Safety: drops once, never accessed again due to mem::forget
4306        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4307        // Prevent Drop from running (which would shut down the channel)
4308        std::mem::forget(self);
4309    }
4310}
4311
4312impl CompositeSetDaiFormatResponder {
4313    /// Sends a response to the FIDL transaction.
4314    ///
4315    /// Sets the channel to shutdown if an error occurs.
4316    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4317        let _result = self.send_raw(result);
4318        if _result.is_err() {
4319            self.control_handle.shutdown();
4320        }
4321        self.drop_without_shutdown();
4322        _result
4323    }
4324
4325    /// Similar to "send" but does not shutdown the channel if an error occurs.
4326    pub fn send_no_shutdown_on_err(
4327        self,
4328        mut result: Result<(), DriverError>,
4329    ) -> Result<(), fidl::Error> {
4330        let _result = self.send_raw(result);
4331        self.drop_without_shutdown();
4332        _result
4333    }
4334
4335    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4336        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4337            fidl::encoding::EmptyStruct,
4338            DriverError,
4339        >>(
4340            fidl::encoding::FlexibleResult::new(result),
4341            self.tx_id,
4342            0x155acf5cc0dc8a84,
4343            fidl::encoding::DynamicFlags::FLEXIBLE,
4344        )
4345    }
4346}
4347
4348#[must_use = "FIDL methods require a response to be sent"]
4349#[derive(Debug)]
4350pub struct CompositeGetPacketStreamFormatsResponder {
4351    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4352    tx_id: u32,
4353}
4354
4355/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4356/// if the responder is dropped without sending a response, so that the client
4357/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4358impl std::ops::Drop for CompositeGetPacketStreamFormatsResponder {
4359    fn drop(&mut self) {
4360        self.control_handle.shutdown();
4361        // Safety: drops once, never accessed again
4362        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4363    }
4364}
4365
4366impl fidl::endpoints::Responder for CompositeGetPacketStreamFormatsResponder {
4367    type ControlHandle = CompositeControlHandle;
4368
4369    fn control_handle(&self) -> &CompositeControlHandle {
4370        &self.control_handle
4371    }
4372
4373    fn drop_without_shutdown(mut self) {
4374        // Safety: drops once, never accessed again due to mem::forget
4375        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4376        // Prevent Drop from running (which would shut down the channel)
4377        std::mem::forget(self);
4378    }
4379}
4380
4381impl CompositeGetPacketStreamFormatsResponder {
4382    /// Sends a response to the FIDL transaction.
4383    ///
4384    /// Sets the channel to shutdown if an error occurs.
4385    pub fn send(
4386        self,
4387        mut result: Result<&[SupportedFormats2], DriverError>,
4388    ) -> Result<(), fidl::Error> {
4389        let _result = self.send_raw(result);
4390        if _result.is_err() {
4391            self.control_handle.shutdown();
4392        }
4393        self.drop_without_shutdown();
4394        _result
4395    }
4396
4397    /// Similar to "send" but does not shutdown the channel if an error occurs.
4398    pub fn send_no_shutdown_on_err(
4399        self,
4400        mut result: Result<&[SupportedFormats2], DriverError>,
4401    ) -> Result<(), fidl::Error> {
4402        let _result = self.send_raw(result);
4403        self.drop_without_shutdown();
4404        _result
4405    }
4406
4407    fn send_raw(
4408        &self,
4409        mut result: Result<&[SupportedFormats2], DriverError>,
4410    ) -> Result<(), fidl::Error> {
4411        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4412            CompositeGetPacketStreamFormatsResponse,
4413            DriverError,
4414        >>(
4415            fidl::encoding::FlexibleResult::new(
4416                result.map(|packet_stream_formats| (packet_stream_formats,)),
4417            ),
4418            self.tx_id,
4419            0x73cc47c6ad39bca7,
4420            fidl::encoding::DynamicFlags::FLEXIBLE,
4421        )
4422    }
4423}
4424
4425#[must_use = "FIDL methods require a response to be sent"]
4426#[derive(Debug)]
4427pub struct CompositeCreatePacketStreamResponder {
4428    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
4429    tx_id: u32,
4430}
4431
4432/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
4433/// if the responder is dropped without sending a response, so that the client
4434/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4435impl std::ops::Drop for CompositeCreatePacketStreamResponder {
4436    fn drop(&mut self) {
4437        self.control_handle.shutdown();
4438        // Safety: drops once, never accessed again
4439        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4440    }
4441}
4442
4443impl fidl::endpoints::Responder for CompositeCreatePacketStreamResponder {
4444    type ControlHandle = CompositeControlHandle;
4445
4446    fn control_handle(&self) -> &CompositeControlHandle {
4447        &self.control_handle
4448    }
4449
4450    fn drop_without_shutdown(mut self) {
4451        // Safety: drops once, never accessed again due to mem::forget
4452        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4453        // Prevent Drop from running (which would shut down the channel)
4454        std::mem::forget(self);
4455    }
4456}
4457
4458impl CompositeCreatePacketStreamResponder {
4459    /// Sends a response to the FIDL transaction.
4460    ///
4461    /// Sets the channel to shutdown if an error occurs.
4462    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4463        let _result = self.send_raw(result);
4464        if _result.is_err() {
4465            self.control_handle.shutdown();
4466        }
4467        self.drop_without_shutdown();
4468        _result
4469    }
4470
4471    /// Similar to "send" but does not shutdown the channel if an error occurs.
4472    pub fn send_no_shutdown_on_err(
4473        self,
4474        mut result: Result<(), DriverError>,
4475    ) -> Result<(), fidl::Error> {
4476        let _result = self.send_raw(result);
4477        self.drop_without_shutdown();
4478        _result
4479    }
4480
4481    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
4482        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4483            fidl::encoding::EmptyStruct,
4484            DriverError,
4485        >>(
4486            fidl::encoding::FlexibleResult::new(result),
4487            self.tx_id,
4488            0x50e8902b756c707c,
4489            fidl::encoding::DynamicFlags::FLEXIBLE,
4490        )
4491    }
4492}
4493
4494#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4495pub struct CompositeConnectorMarker;
4496
4497impl fidl::endpoints::ProtocolMarker for CompositeConnectorMarker {
4498    type Proxy = CompositeConnectorProxy;
4499    type RequestStream = CompositeConnectorRequestStream;
4500    #[cfg(target_os = "fuchsia")]
4501    type SynchronousProxy = CompositeConnectorSynchronousProxy;
4502
4503    const DEBUG_NAME: &'static str = "(anonymous) CompositeConnector";
4504}
4505
4506pub trait CompositeConnectorProxyInterface: Send + Sync {
4507    fn r#connect(
4508        &self,
4509        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4510    ) -> Result<(), fidl::Error>;
4511}
4512#[derive(Debug)]
4513#[cfg(target_os = "fuchsia")]
4514pub struct CompositeConnectorSynchronousProxy {
4515    client: fidl::client::sync::Client,
4516}
4517
4518#[cfg(target_os = "fuchsia")]
4519impl fidl::endpoints::SynchronousProxy for CompositeConnectorSynchronousProxy {
4520    type Proxy = CompositeConnectorProxy;
4521    type Protocol = CompositeConnectorMarker;
4522
4523    fn from_channel(inner: fidl::Channel) -> Self {
4524        Self::new(inner)
4525    }
4526
4527    fn into_channel(self) -> fidl::Channel {
4528        self.client.into_channel()
4529    }
4530
4531    fn as_channel(&self) -> &fidl::Channel {
4532        self.client.as_channel()
4533    }
4534}
4535
4536#[cfg(target_os = "fuchsia")]
4537impl CompositeConnectorSynchronousProxy {
4538    pub fn new(channel: fidl::Channel) -> Self {
4539        Self { client: fidl::client::sync::Client::new(channel) }
4540    }
4541
4542    pub fn into_channel(self) -> fidl::Channel {
4543        self.client.into_channel()
4544    }
4545
4546    /// Waits until an event arrives and returns it. It is safe for other
4547    /// threads to make concurrent requests while waiting for an event.
4548    pub fn wait_for_event(
4549        &self,
4550        deadline: zx::MonotonicInstant,
4551    ) -> Result<CompositeConnectorEvent, fidl::Error> {
4552        CompositeConnectorEvent::decode(
4553            self.client.wait_for_event::<CompositeConnectorMarker>(deadline)?,
4554        )
4555    }
4556
4557    /// Connect to a `Device` protocol.
4558    /// This method allows a component to serve FIDL outside the devhost's control.
4559    pub fn r#connect(
4560        &self,
4561        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4562    ) -> Result<(), fidl::Error> {
4563        self.client.send::<CompositeConnectorConnectRequest>(
4564            (composite_protocol,),
4565            0x7ee557529079e466,
4566            fidl::encoding::DynamicFlags::empty(),
4567        )
4568    }
4569}
4570
4571#[cfg(target_os = "fuchsia")]
4572impl From<CompositeConnectorSynchronousProxy> for zx::NullableHandle {
4573    fn from(value: CompositeConnectorSynchronousProxy) -> Self {
4574        value.into_channel().into()
4575    }
4576}
4577
4578#[cfg(target_os = "fuchsia")]
4579impl From<fidl::Channel> for CompositeConnectorSynchronousProxy {
4580    fn from(value: fidl::Channel) -> Self {
4581        Self::new(value)
4582    }
4583}
4584
4585#[cfg(target_os = "fuchsia")]
4586impl fidl::endpoints::FromClient for CompositeConnectorSynchronousProxy {
4587    type Protocol = CompositeConnectorMarker;
4588
4589    fn from_client(value: fidl::endpoints::ClientEnd<CompositeConnectorMarker>) -> Self {
4590        Self::new(value.into_channel())
4591    }
4592}
4593
4594#[derive(Debug, Clone)]
4595pub struct CompositeConnectorProxy {
4596    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4597}
4598
4599impl fidl::endpoints::Proxy for CompositeConnectorProxy {
4600    type Protocol = CompositeConnectorMarker;
4601
4602    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4603        Self::new(inner)
4604    }
4605
4606    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4607        self.client.into_channel().map_err(|client| Self { client })
4608    }
4609
4610    fn as_channel(&self) -> &::fidl::AsyncChannel {
4611        self.client.as_channel()
4612    }
4613}
4614
4615impl CompositeConnectorProxy {
4616    /// Create a new Proxy for fuchsia.hardware.audio/CompositeConnector.
4617    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4618        let protocol_name =
4619            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4620        Self { client: fidl::client::Client::new(channel, protocol_name) }
4621    }
4622
4623    /// Get a Stream of events from the remote end of the protocol.
4624    ///
4625    /// # Panics
4626    ///
4627    /// Panics if the event stream was already taken.
4628    pub fn take_event_stream(&self) -> CompositeConnectorEventStream {
4629        CompositeConnectorEventStream { event_receiver: self.client.take_event_receiver() }
4630    }
4631
4632    /// Connect to a `Device` protocol.
4633    /// This method allows a component to serve FIDL outside the devhost's control.
4634    pub fn r#connect(
4635        &self,
4636        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4637    ) -> Result<(), fidl::Error> {
4638        CompositeConnectorProxyInterface::r#connect(self, composite_protocol)
4639    }
4640}
4641
4642impl CompositeConnectorProxyInterface for CompositeConnectorProxy {
4643    fn r#connect(
4644        &self,
4645        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4646    ) -> Result<(), fidl::Error> {
4647        self.client.send::<CompositeConnectorConnectRequest>(
4648            (composite_protocol,),
4649            0x7ee557529079e466,
4650            fidl::encoding::DynamicFlags::empty(),
4651        )
4652    }
4653}
4654
4655pub struct CompositeConnectorEventStream {
4656    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4657}
4658
4659impl std::marker::Unpin for CompositeConnectorEventStream {}
4660
4661impl futures::stream::FusedStream for CompositeConnectorEventStream {
4662    fn is_terminated(&self) -> bool {
4663        self.event_receiver.is_terminated()
4664    }
4665}
4666
4667impl futures::Stream for CompositeConnectorEventStream {
4668    type Item = Result<CompositeConnectorEvent, fidl::Error>;
4669
4670    fn poll_next(
4671        mut self: std::pin::Pin<&mut Self>,
4672        cx: &mut std::task::Context<'_>,
4673    ) -> std::task::Poll<Option<Self::Item>> {
4674        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4675            &mut self.event_receiver,
4676            cx
4677        )?) {
4678            Some(buf) => std::task::Poll::Ready(Some(CompositeConnectorEvent::decode(buf))),
4679            None => std::task::Poll::Ready(None),
4680        }
4681    }
4682}
4683
4684#[derive(Debug)]
4685pub enum CompositeConnectorEvent {}
4686
4687impl CompositeConnectorEvent {
4688    /// Decodes a message buffer as a [`CompositeConnectorEvent`].
4689    fn decode(
4690        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4691    ) -> Result<CompositeConnectorEvent, fidl::Error> {
4692        let (bytes, _handles) = buf.split_mut();
4693        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4694        debug_assert_eq!(tx_header.tx_id, 0);
4695        match tx_header.ordinal {
4696            _ => Err(fidl::Error::UnknownOrdinal {
4697                ordinal: tx_header.ordinal,
4698                protocol_name:
4699                    <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4700            }),
4701        }
4702    }
4703}
4704
4705/// A Stream of incoming requests for fuchsia.hardware.audio/CompositeConnector.
4706pub struct CompositeConnectorRequestStream {
4707    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4708    is_terminated: bool,
4709}
4710
4711impl std::marker::Unpin for CompositeConnectorRequestStream {}
4712
4713impl futures::stream::FusedStream for CompositeConnectorRequestStream {
4714    fn is_terminated(&self) -> bool {
4715        self.is_terminated
4716    }
4717}
4718
4719impl fidl::endpoints::RequestStream for CompositeConnectorRequestStream {
4720    type Protocol = CompositeConnectorMarker;
4721    type ControlHandle = CompositeConnectorControlHandle;
4722
4723    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4724        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4725    }
4726
4727    fn control_handle(&self) -> Self::ControlHandle {
4728        CompositeConnectorControlHandle { inner: self.inner.clone() }
4729    }
4730
4731    fn into_inner(
4732        self,
4733    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4734    {
4735        (self.inner, self.is_terminated)
4736    }
4737
4738    fn from_inner(
4739        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4740        is_terminated: bool,
4741    ) -> Self {
4742        Self { inner, is_terminated }
4743    }
4744}
4745
4746impl futures::Stream for CompositeConnectorRequestStream {
4747    type Item = Result<CompositeConnectorRequest, fidl::Error>;
4748
4749    fn poll_next(
4750        mut self: std::pin::Pin<&mut Self>,
4751        cx: &mut std::task::Context<'_>,
4752    ) -> std::task::Poll<Option<Self::Item>> {
4753        let this = &mut *self;
4754        if this.inner.check_shutdown(cx) {
4755            this.is_terminated = true;
4756            return std::task::Poll::Ready(None);
4757        }
4758        if this.is_terminated {
4759            panic!("polled CompositeConnectorRequestStream after completion");
4760        }
4761        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4762            |bytes, handles| {
4763                match this.inner.channel().read_etc(cx, bytes, handles) {
4764                    std::task::Poll::Ready(Ok(())) => {}
4765                    std::task::Poll::Pending => return std::task::Poll::Pending,
4766                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4767                        this.is_terminated = true;
4768                        return std::task::Poll::Ready(None);
4769                    }
4770                    std::task::Poll::Ready(Err(e)) => {
4771                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4772                            e.into(),
4773                        ))));
4774                    }
4775                }
4776
4777                // A message has been received from the channel
4778                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4779
4780                std::task::Poll::Ready(Some(match header.ordinal {
4781                0x7ee557529079e466 => {
4782                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4783                    let mut req = fidl::new_empty!(CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4784                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4785                    let control_handle = CompositeConnectorControlHandle {
4786                        inner: this.inner.clone(),
4787                    };
4788                    Ok(CompositeConnectorRequest::Connect {composite_protocol: req.composite_protocol,
4789
4790                        control_handle,
4791                    })
4792                }
4793                _ => Err(fidl::Error::UnknownOrdinal {
4794                    ordinal: header.ordinal,
4795                    protocol_name: <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4796                }),
4797            }))
4798            },
4799        )
4800    }
4801}
4802
4803/// For an overview see
4804/// [Audio Composite Devices](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md).
4805#[derive(Debug)]
4806pub enum CompositeConnectorRequest {
4807    /// Connect to a `Device` protocol.
4808    /// This method allows a component to serve FIDL outside the devhost's control.
4809    Connect {
4810        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4811        control_handle: CompositeConnectorControlHandle,
4812    },
4813}
4814
4815impl CompositeConnectorRequest {
4816    #[allow(irrefutable_let_patterns)]
4817    pub fn into_connect(
4818        self,
4819    ) -> Option<(fidl::endpoints::ServerEnd<CompositeMarker>, CompositeConnectorControlHandle)>
4820    {
4821        if let CompositeConnectorRequest::Connect { composite_protocol, control_handle } = self {
4822            Some((composite_protocol, control_handle))
4823        } else {
4824            None
4825        }
4826    }
4827
4828    /// Name of the method defined in FIDL
4829    pub fn method_name(&self) -> &'static str {
4830        match *self {
4831            CompositeConnectorRequest::Connect { .. } => "connect",
4832        }
4833    }
4834}
4835
4836#[derive(Debug, Clone)]
4837pub struct CompositeConnectorControlHandle {
4838    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4839}
4840
4841impl CompositeConnectorControlHandle {
4842    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4843        self.inner.shutdown_with_epitaph(status.into())
4844    }
4845}
4846
4847impl fidl::endpoints::ControlHandle for CompositeConnectorControlHandle {
4848    fn shutdown(&self) {
4849        self.inner.shutdown()
4850    }
4851
4852    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4853        self.inner.shutdown_with_epitaph(status)
4854    }
4855
4856    fn is_closed(&self) -> bool {
4857        self.inner.channel().is_closed()
4858    }
4859    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4860        self.inner.channel().on_closed()
4861    }
4862
4863    #[cfg(target_os = "fuchsia")]
4864    fn signal_peer(
4865        &self,
4866        clear_mask: zx::Signals,
4867        set_mask: zx::Signals,
4868    ) -> Result<(), zx_status::Status> {
4869        use fidl::Peered;
4870        self.inner.channel().signal_peer(clear_mask, set_mask)
4871    }
4872}
4873
4874impl CompositeConnectorControlHandle {}
4875
4876#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4877pub struct DaiMarker;
4878
4879impl fidl::endpoints::ProtocolMarker for DaiMarker {
4880    type Proxy = DaiProxy;
4881    type RequestStream = DaiRequestStream;
4882    #[cfg(target_os = "fuchsia")]
4883    type SynchronousProxy = DaiSynchronousProxy;
4884
4885    const DEBUG_NAME: &'static str = "(anonymous) Dai";
4886}
4887pub type DaiGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
4888pub type DaiGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, i32>;
4889
4890pub trait DaiProxyInterface: Send + Sync {
4891    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
4892        + Send;
4893    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
4894    fn r#signal_processing_connect(
4895        &self,
4896        protocol: fidl::endpoints::ServerEnd<
4897            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4898        >,
4899    ) -> Result<(), fidl::Error>;
4900    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4901    fn r#reset(&self) -> Self::ResetResponseFut;
4902    type GetPropertiesResponseFut: std::future::Future<Output = Result<DaiProperties, fidl::Error>>
4903        + Send;
4904    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
4905    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<DaiGetDaiFormatsResult, fidl::Error>>
4906        + Send;
4907    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
4908    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<DaiGetRingBufferFormatsResult, fidl::Error>>
4909        + Send;
4910    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut;
4911    fn r#create_ring_buffer(
4912        &self,
4913        dai_format: &DaiFormat,
4914        ring_buffer_format: &Format,
4915        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4916    ) -> Result<(), fidl::Error>;
4917}
4918#[derive(Debug)]
4919#[cfg(target_os = "fuchsia")]
4920pub struct DaiSynchronousProxy {
4921    client: fidl::client::sync::Client,
4922}
4923
4924#[cfg(target_os = "fuchsia")]
4925impl fidl::endpoints::SynchronousProxy for DaiSynchronousProxy {
4926    type Proxy = DaiProxy;
4927    type Protocol = DaiMarker;
4928
4929    fn from_channel(inner: fidl::Channel) -> Self {
4930        Self::new(inner)
4931    }
4932
4933    fn into_channel(self) -> fidl::Channel {
4934        self.client.into_channel()
4935    }
4936
4937    fn as_channel(&self) -> &fidl::Channel {
4938        self.client.as_channel()
4939    }
4940}
4941
4942#[cfg(target_os = "fuchsia")]
4943impl DaiSynchronousProxy {
4944    pub fn new(channel: fidl::Channel) -> Self {
4945        Self { client: fidl::client::sync::Client::new(channel) }
4946    }
4947
4948    pub fn into_channel(self) -> fidl::Channel {
4949        self.client.into_channel()
4950    }
4951
4952    /// Waits until an event arrives and returns it. It is safe for other
4953    /// threads to make concurrent requests while waiting for an event.
4954    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<DaiEvent, fidl::Error> {
4955        DaiEvent::decode(self.client.wait_for_event::<DaiMarker>(deadline)?)
4956    }
4957
4958    /// Retrieves top level health state.
4959    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4960    pub fn r#get_health_state(
4961        &self,
4962        ___deadline: zx::MonotonicInstant,
4963    ) -> Result<HealthState, fidl::Error> {
4964        let _response = self
4965            .client
4966            .send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse, DaiMarker>(
4967                (),
4968                0x4e146d6bca733a84,
4969                fidl::encoding::DynamicFlags::empty(),
4970                ___deadline,
4971            )?;
4972        Ok(_response.state)
4973    }
4974
4975    /// Connect to a `SignalProcessing` protocol.
4976    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4977    /// the maximum number of connections have already been created, for instance one, then the
4978    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4979    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4980    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4981    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4982    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4983    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4984    /// is intended to be composed, and hence the more verbose name allows differentiation and
4985    /// improved clarity.
4986    pub fn r#signal_processing_connect(
4987        &self,
4988        mut protocol: fidl::endpoints::ServerEnd<
4989            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4990        >,
4991    ) -> Result<(), fidl::Error> {
4992        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4993            (protocol,),
4994            0xa81907ce6066295,
4995            fidl::encoding::DynamicFlags::empty(),
4996        )
4997    }
4998
4999    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5000    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5001    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5002    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5003    /// protocol channel and retry.
5004    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
5005        let _response = self
5006            .client
5007            .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload, DaiMarker>(
5008                (),
5009                0x69e5fa9fa2f78c14,
5010                fidl::encoding::DynamicFlags::empty(),
5011                ___deadline,
5012            )?;
5013        Ok(_response)
5014    }
5015
5016    /// Retrieves top level static properties.
5017    pub fn r#get_properties(
5018        &self,
5019        ___deadline: zx::MonotonicInstant,
5020    ) -> Result<DaiProperties, fidl::Error> {
5021        let _response = self
5022            .client
5023            .send_query::<fidl::encoding::EmptyPayload, DaiGetPropertiesResponse, DaiMarker>(
5024                (),
5025                0x2c25a1a66149510b,
5026                fidl::encoding::DynamicFlags::empty(),
5027                ___deadline,
5028            )?;
5029        Ok(_response.properties)
5030    }
5031
5032    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5033    /// may reply with an error status and the client may retry at a later time.
5034    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5035    /// the parameters in SupportedFormats may be supported.
5036    pub fn r#get_dai_formats(
5037        &self,
5038        ___deadline: zx::MonotonicInstant,
5039    ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
5040        let _response = self.client.send_query::<
5041            fidl::encoding::EmptyPayload,
5042            fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
5043            DaiMarker,
5044        >(
5045            (),
5046            0x1eb37b0cddf79d69,
5047            fidl::encoding::DynamicFlags::empty(),
5048            ___deadline,
5049        )?;
5050        Ok(_response.map(|x| x.dai_formats))
5051    }
5052
5053    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5054    /// may reply with an error status and the client may retry at a later time.
5055    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5056    /// the parameters in `SupportedFormats` may be supported.
5057    pub fn r#get_ring_buffer_formats(
5058        &self,
5059        ___deadline: zx::MonotonicInstant,
5060    ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
5061        let _response = self.client.send_query::<
5062            fidl::encoding::EmptyPayload,
5063            fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
5064            DaiMarker,
5065        >(
5066            (),
5067            0x760371081d8c92e4,
5068            fidl::encoding::DynamicFlags::empty(),
5069            ___deadline,
5070        )?;
5071        Ok(_response.map(|x| x.ring_buffer_formats))
5072    }
5073
5074    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5075    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5076    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5077    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5078    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5079    /// gracefully quiesce any on-going streaming operations in the process.
5080    pub fn r#create_ring_buffer(
5081        &self,
5082        mut dai_format: &DaiFormat,
5083        mut ring_buffer_format: &Format,
5084        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5085    ) -> Result<(), fidl::Error> {
5086        self.client.send::<DaiCreateRingBufferRequest>(
5087            (dai_format, ring_buffer_format, ring_buffer),
5088            0x5af9760589a75257,
5089            fidl::encoding::DynamicFlags::empty(),
5090        )
5091    }
5092}
5093
5094#[cfg(target_os = "fuchsia")]
5095impl From<DaiSynchronousProxy> for zx::NullableHandle {
5096    fn from(value: DaiSynchronousProxy) -> Self {
5097        value.into_channel().into()
5098    }
5099}
5100
5101#[cfg(target_os = "fuchsia")]
5102impl From<fidl::Channel> for DaiSynchronousProxy {
5103    fn from(value: fidl::Channel) -> Self {
5104        Self::new(value)
5105    }
5106}
5107
5108#[cfg(target_os = "fuchsia")]
5109impl fidl::endpoints::FromClient for DaiSynchronousProxy {
5110    type Protocol = DaiMarker;
5111
5112    fn from_client(value: fidl::endpoints::ClientEnd<DaiMarker>) -> Self {
5113        Self::new(value.into_channel())
5114    }
5115}
5116
5117#[derive(Debug, Clone)]
5118pub struct DaiProxy {
5119    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5120}
5121
5122impl fidl::endpoints::Proxy for DaiProxy {
5123    type Protocol = DaiMarker;
5124
5125    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5126        Self::new(inner)
5127    }
5128
5129    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5130        self.client.into_channel().map_err(|client| Self { client })
5131    }
5132
5133    fn as_channel(&self) -> &::fidl::AsyncChannel {
5134        self.client.as_channel()
5135    }
5136}
5137
5138impl DaiProxy {
5139    /// Create a new Proxy for fuchsia.hardware.audio/Dai.
5140    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5141        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5142        Self { client: fidl::client::Client::new(channel, protocol_name) }
5143    }
5144
5145    /// Get a Stream of events from the remote end of the protocol.
5146    ///
5147    /// # Panics
5148    ///
5149    /// Panics if the event stream was already taken.
5150    pub fn take_event_stream(&self) -> DaiEventStream {
5151        DaiEventStream { event_receiver: self.client.take_event_receiver() }
5152    }
5153
5154    /// Retrieves top level health state.
5155    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5156    pub fn r#get_health_state(
5157        &self,
5158    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
5159    {
5160        DaiProxyInterface::r#get_health_state(self)
5161    }
5162
5163    /// Connect to a `SignalProcessing` protocol.
5164    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
5165    /// the maximum number of connections have already been created, for instance one, then the
5166    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
5167    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
5168    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
5169    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
5170    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
5171    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
5172    /// is intended to be composed, and hence the more verbose name allows differentiation and
5173    /// improved clarity.
5174    pub fn r#signal_processing_connect(
5175        &self,
5176        mut protocol: fidl::endpoints::ServerEnd<
5177            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5178        >,
5179    ) -> Result<(), fidl::Error> {
5180        DaiProxyInterface::r#signal_processing_connect(self, protocol)
5181    }
5182
5183    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5184    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5185    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5186    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5187    /// protocol channel and retry.
5188    pub fn r#reset(
5189        &self,
5190    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5191        DaiProxyInterface::r#reset(self)
5192    }
5193
5194    /// Retrieves top level static properties.
5195    pub fn r#get_properties(
5196        &self,
5197    ) -> fidl::client::QueryResponseFut<DaiProperties, fidl::encoding::DefaultFuchsiaResourceDialect>
5198    {
5199        DaiProxyInterface::r#get_properties(self)
5200    }
5201
5202    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5203    /// may reply with an error status and the client may retry at a later time.
5204    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5205    /// the parameters in SupportedFormats may be supported.
5206    pub fn r#get_dai_formats(
5207        &self,
5208    ) -> fidl::client::QueryResponseFut<
5209        DaiGetDaiFormatsResult,
5210        fidl::encoding::DefaultFuchsiaResourceDialect,
5211    > {
5212        DaiProxyInterface::r#get_dai_formats(self)
5213    }
5214
5215    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5216    /// may reply with an error status and the client may retry at a later time.
5217    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5218    /// the parameters in `SupportedFormats` may be supported.
5219    pub fn r#get_ring_buffer_formats(
5220        &self,
5221    ) -> fidl::client::QueryResponseFut<
5222        DaiGetRingBufferFormatsResult,
5223        fidl::encoding::DefaultFuchsiaResourceDialect,
5224    > {
5225        DaiProxyInterface::r#get_ring_buffer_formats(self)
5226    }
5227
5228    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5229    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5230    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5231    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5232    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5233    /// gracefully quiesce any on-going streaming operations in the process.
5234    pub fn r#create_ring_buffer(
5235        &self,
5236        mut dai_format: &DaiFormat,
5237        mut ring_buffer_format: &Format,
5238        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5239    ) -> Result<(), fidl::Error> {
5240        DaiProxyInterface::r#create_ring_buffer(self, dai_format, ring_buffer_format, ring_buffer)
5241    }
5242}
5243
5244impl DaiProxyInterface for DaiProxy {
5245    type GetHealthStateResponseFut =
5246        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
5247    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
5248        fn _decode(
5249            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5250        ) -> Result<HealthState, fidl::Error> {
5251            let _response = fidl::client::decode_transaction_body::<
5252                HealthGetHealthStateResponse,
5253                fidl::encoding::DefaultFuchsiaResourceDialect,
5254                0x4e146d6bca733a84,
5255            >(_buf?)?;
5256            Ok(_response.state)
5257        }
5258        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
5259            (),
5260            0x4e146d6bca733a84,
5261            fidl::encoding::DynamicFlags::empty(),
5262            _decode,
5263        )
5264    }
5265
5266    fn r#signal_processing_connect(
5267        &self,
5268        mut protocol: fidl::endpoints::ServerEnd<
5269            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5270        >,
5271    ) -> Result<(), fidl::Error> {
5272        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
5273            (protocol,),
5274            0xa81907ce6066295,
5275            fidl::encoding::DynamicFlags::empty(),
5276        )
5277    }
5278
5279    type ResetResponseFut =
5280        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5281    fn r#reset(&self) -> Self::ResetResponseFut {
5282        fn _decode(
5283            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5284        ) -> Result<(), fidl::Error> {
5285            let _response = fidl::client::decode_transaction_body::<
5286                fidl::encoding::EmptyPayload,
5287                fidl::encoding::DefaultFuchsiaResourceDialect,
5288                0x69e5fa9fa2f78c14,
5289            >(_buf?)?;
5290            Ok(_response)
5291        }
5292        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
5293            (),
5294            0x69e5fa9fa2f78c14,
5295            fidl::encoding::DynamicFlags::empty(),
5296            _decode,
5297        )
5298    }
5299
5300    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
5301        DaiProperties,
5302        fidl::encoding::DefaultFuchsiaResourceDialect,
5303    >;
5304    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
5305        fn _decode(
5306            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5307        ) -> Result<DaiProperties, fidl::Error> {
5308            let _response = fidl::client::decode_transaction_body::<
5309                DaiGetPropertiesResponse,
5310                fidl::encoding::DefaultFuchsiaResourceDialect,
5311                0x2c25a1a66149510b,
5312            >(_buf?)?;
5313            Ok(_response.properties)
5314        }
5315        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiProperties>(
5316            (),
5317            0x2c25a1a66149510b,
5318            fidl::encoding::DynamicFlags::empty(),
5319            _decode,
5320        )
5321    }
5322
5323    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
5324        DaiGetDaiFormatsResult,
5325        fidl::encoding::DefaultFuchsiaResourceDialect,
5326    >;
5327    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
5328        fn _decode(
5329            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5330        ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
5331            let _response = fidl::client::decode_transaction_body::<
5332                fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
5333                fidl::encoding::DefaultFuchsiaResourceDialect,
5334                0x1eb37b0cddf79d69,
5335            >(_buf?)?;
5336            Ok(_response.map(|x| x.dai_formats))
5337        }
5338        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetDaiFormatsResult>(
5339            (),
5340            0x1eb37b0cddf79d69,
5341            fidl::encoding::DynamicFlags::empty(),
5342            _decode,
5343        )
5344    }
5345
5346    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
5347        DaiGetRingBufferFormatsResult,
5348        fidl::encoding::DefaultFuchsiaResourceDialect,
5349    >;
5350    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut {
5351        fn _decode(
5352            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5353        ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
5354            let _response = fidl::client::decode_transaction_body::<
5355                fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
5356                fidl::encoding::DefaultFuchsiaResourceDialect,
5357                0x760371081d8c92e4,
5358            >(_buf?)?;
5359            Ok(_response.map(|x| x.ring_buffer_formats))
5360        }
5361        self.client
5362            .send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetRingBufferFormatsResult>(
5363                (),
5364                0x760371081d8c92e4,
5365                fidl::encoding::DynamicFlags::empty(),
5366                _decode,
5367            )
5368    }
5369
5370    fn r#create_ring_buffer(
5371        &self,
5372        mut dai_format: &DaiFormat,
5373        mut ring_buffer_format: &Format,
5374        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5375    ) -> Result<(), fidl::Error> {
5376        self.client.send::<DaiCreateRingBufferRequest>(
5377            (dai_format, ring_buffer_format, ring_buffer),
5378            0x5af9760589a75257,
5379            fidl::encoding::DynamicFlags::empty(),
5380        )
5381    }
5382}
5383
5384pub struct DaiEventStream {
5385    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5386}
5387
5388impl std::marker::Unpin for DaiEventStream {}
5389
5390impl futures::stream::FusedStream for DaiEventStream {
5391    fn is_terminated(&self) -> bool {
5392        self.event_receiver.is_terminated()
5393    }
5394}
5395
5396impl futures::Stream for DaiEventStream {
5397    type Item = Result<DaiEvent, fidl::Error>;
5398
5399    fn poll_next(
5400        mut self: std::pin::Pin<&mut Self>,
5401        cx: &mut std::task::Context<'_>,
5402    ) -> std::task::Poll<Option<Self::Item>> {
5403        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5404            &mut self.event_receiver,
5405            cx
5406        )?) {
5407            Some(buf) => std::task::Poll::Ready(Some(DaiEvent::decode(buf))),
5408            None => std::task::Poll::Ready(None),
5409        }
5410    }
5411}
5412
5413#[derive(Debug)]
5414pub enum DaiEvent {}
5415
5416impl DaiEvent {
5417    /// Decodes a message buffer as a [`DaiEvent`].
5418    fn decode(
5419        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5420    ) -> Result<DaiEvent, fidl::Error> {
5421        let (bytes, _handles) = buf.split_mut();
5422        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5423        debug_assert_eq!(tx_header.tx_id, 0);
5424        match tx_header.ordinal {
5425            _ => Err(fidl::Error::UnknownOrdinal {
5426                ordinal: tx_header.ordinal,
5427                protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5428            }),
5429        }
5430    }
5431}
5432
5433/// A Stream of incoming requests for fuchsia.hardware.audio/Dai.
5434pub struct DaiRequestStream {
5435    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5436    is_terminated: bool,
5437}
5438
5439impl std::marker::Unpin for DaiRequestStream {}
5440
5441impl futures::stream::FusedStream for DaiRequestStream {
5442    fn is_terminated(&self) -> bool {
5443        self.is_terminated
5444    }
5445}
5446
5447impl fidl::endpoints::RequestStream for DaiRequestStream {
5448    type Protocol = DaiMarker;
5449    type ControlHandle = DaiControlHandle;
5450
5451    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5452        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5453    }
5454
5455    fn control_handle(&self) -> Self::ControlHandle {
5456        DaiControlHandle { inner: self.inner.clone() }
5457    }
5458
5459    fn into_inner(
5460        self,
5461    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5462    {
5463        (self.inner, self.is_terminated)
5464    }
5465
5466    fn from_inner(
5467        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5468        is_terminated: bool,
5469    ) -> Self {
5470        Self { inner, is_terminated }
5471    }
5472}
5473
5474impl futures::Stream for DaiRequestStream {
5475    type Item = Result<DaiRequest, fidl::Error>;
5476
5477    fn poll_next(
5478        mut self: std::pin::Pin<&mut Self>,
5479        cx: &mut std::task::Context<'_>,
5480    ) -> std::task::Poll<Option<Self::Item>> {
5481        let this = &mut *self;
5482        if this.inner.check_shutdown(cx) {
5483            this.is_terminated = true;
5484            return std::task::Poll::Ready(None);
5485        }
5486        if this.is_terminated {
5487            panic!("polled DaiRequestStream after completion");
5488        }
5489        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5490            |bytes, handles| {
5491                match this.inner.channel().read_etc(cx, bytes, handles) {
5492                    std::task::Poll::Ready(Ok(())) => {}
5493                    std::task::Poll::Pending => return std::task::Poll::Pending,
5494                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5495                        this.is_terminated = true;
5496                        return std::task::Poll::Ready(None);
5497                    }
5498                    std::task::Poll::Ready(Err(e)) => {
5499                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5500                            e.into(),
5501                        ))));
5502                    }
5503                }
5504
5505                // A message has been received from the channel
5506                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5507
5508                std::task::Poll::Ready(Some(match header.ordinal {
5509                    0x4e146d6bca733a84 => {
5510                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5511                        let mut req = fidl::new_empty!(
5512                            fidl::encoding::EmptyPayload,
5513                            fidl::encoding::DefaultFuchsiaResourceDialect
5514                        );
5515                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5516                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5517                        Ok(DaiRequest::GetHealthState {
5518                            responder: DaiGetHealthStateResponder {
5519                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5520                                tx_id: header.tx_id,
5521                            },
5522                        })
5523                    }
5524                    0xa81907ce6066295 => {
5525                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5526                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5527                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5528                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5529                        Ok(DaiRequest::SignalProcessingConnect {
5530                            protocol: req.protocol,
5531
5532                            control_handle,
5533                        })
5534                    }
5535                    0x69e5fa9fa2f78c14 => {
5536                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5537                        let mut req = fidl::new_empty!(
5538                            fidl::encoding::EmptyPayload,
5539                            fidl::encoding::DefaultFuchsiaResourceDialect
5540                        );
5541                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5542                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5543                        Ok(DaiRequest::Reset {
5544                            responder: DaiResetResponder {
5545                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5546                                tx_id: header.tx_id,
5547                            },
5548                        })
5549                    }
5550                    0x2c25a1a66149510b => {
5551                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5552                        let mut req = fidl::new_empty!(
5553                            fidl::encoding::EmptyPayload,
5554                            fidl::encoding::DefaultFuchsiaResourceDialect
5555                        );
5556                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5557                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5558                        Ok(DaiRequest::GetProperties {
5559                            responder: DaiGetPropertiesResponder {
5560                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5561                                tx_id: header.tx_id,
5562                            },
5563                        })
5564                    }
5565                    0x1eb37b0cddf79d69 => {
5566                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5567                        let mut req = fidl::new_empty!(
5568                            fidl::encoding::EmptyPayload,
5569                            fidl::encoding::DefaultFuchsiaResourceDialect
5570                        );
5571                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5572                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5573                        Ok(DaiRequest::GetDaiFormats {
5574                            responder: DaiGetDaiFormatsResponder {
5575                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5576                                tx_id: header.tx_id,
5577                            },
5578                        })
5579                    }
5580                    0x760371081d8c92e4 => {
5581                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5582                        let mut req = fidl::new_empty!(
5583                            fidl::encoding::EmptyPayload,
5584                            fidl::encoding::DefaultFuchsiaResourceDialect
5585                        );
5586                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5587                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5588                        Ok(DaiRequest::GetRingBufferFormats {
5589                            responder: DaiGetRingBufferFormatsResponder {
5590                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5591                                tx_id: header.tx_id,
5592                            },
5593                        })
5594                    }
5595                    0x5af9760589a75257 => {
5596                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5597                        let mut req = fidl::new_empty!(
5598                            DaiCreateRingBufferRequest,
5599                            fidl::encoding::DefaultFuchsiaResourceDialect
5600                        );
5601                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
5602                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5603                        Ok(DaiRequest::CreateRingBuffer {
5604                            dai_format: req.dai_format,
5605                            ring_buffer_format: req.ring_buffer_format,
5606                            ring_buffer: req.ring_buffer,
5607
5608                            control_handle,
5609                        })
5610                    }
5611                    _ => Err(fidl::Error::UnknownOrdinal {
5612                        ordinal: header.ordinal,
5613                        protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5614                    }),
5615                }))
5616            },
5617        )
5618    }
5619}
5620
5621/// For an overview see
5622/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_dai).
5623/// # Deprecation
5624///
5625/// Not supported anymore, instead use an
5626/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5627/// with one DAI and one Ring Buffer, see
5628/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5629#[derive(Debug)]
5630pub enum DaiRequest {
5631    /// Retrieves top level health state.
5632    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5633    GetHealthState { responder: DaiGetHealthStateResponder },
5634    /// Connect to a `SignalProcessing` protocol.
5635    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
5636    /// the maximum number of connections have already been created, for instance one, then the
5637    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
5638    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
5639    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
5640    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
5641    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
5642    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
5643    /// is intended to be composed, and hence the more verbose name allows differentiation and
5644    /// improved clarity.
5645    SignalProcessingConnect {
5646        protocol: fidl::endpoints::ServerEnd<
5647            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5648        >,
5649        control_handle: DaiControlHandle,
5650    },
5651    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5652    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5653    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5654    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5655    /// protocol channel and retry.
5656    Reset { responder: DaiResetResponder },
5657    /// Retrieves top level static properties.
5658    GetProperties { responder: DaiGetPropertiesResponder },
5659    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5660    /// may reply with an error status and the client may retry at a later time.
5661    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5662    /// the parameters in SupportedFormats may be supported.
5663    GetDaiFormats { responder: DaiGetDaiFormatsResponder },
5664    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5665    /// may reply with an error status and the client may retry at a later time.
5666    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5667    /// the parameters in `SupportedFormats` may be supported.
5668    GetRingBufferFormats { responder: DaiGetRingBufferFormatsResponder },
5669    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5670    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5671    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5672    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5673    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5674    /// gracefully quiesce any on-going streaming operations in the process.
5675    CreateRingBuffer {
5676        dai_format: DaiFormat,
5677        ring_buffer_format: Format,
5678        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5679        control_handle: DaiControlHandle,
5680    },
5681}
5682
5683impl DaiRequest {
5684    #[allow(irrefutable_let_patterns)]
5685    pub fn into_get_health_state(self) -> Option<(DaiGetHealthStateResponder)> {
5686        if let DaiRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
5687    }
5688
5689    #[allow(irrefutable_let_patterns)]
5690    pub fn into_signal_processing_connect(
5691        self,
5692    ) -> Option<(
5693        fidl::endpoints::ServerEnd<
5694            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5695        >,
5696        DaiControlHandle,
5697    )> {
5698        if let DaiRequest::SignalProcessingConnect { protocol, control_handle } = self {
5699            Some((protocol, control_handle))
5700        } else {
5701            None
5702        }
5703    }
5704
5705    #[allow(irrefutable_let_patterns)]
5706    pub fn into_reset(self) -> Option<(DaiResetResponder)> {
5707        if let DaiRequest::Reset { responder } = self { Some((responder)) } else { None }
5708    }
5709
5710    #[allow(irrefutable_let_patterns)]
5711    pub fn into_get_properties(self) -> Option<(DaiGetPropertiesResponder)> {
5712        if let DaiRequest::GetProperties { responder } = self { Some((responder)) } else { None }
5713    }
5714
5715    #[allow(irrefutable_let_patterns)]
5716    pub fn into_get_dai_formats(self) -> Option<(DaiGetDaiFormatsResponder)> {
5717        if let DaiRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
5718    }
5719
5720    #[allow(irrefutable_let_patterns)]
5721    pub fn into_get_ring_buffer_formats(self) -> Option<(DaiGetRingBufferFormatsResponder)> {
5722        if let DaiRequest::GetRingBufferFormats { responder } = self {
5723            Some((responder))
5724        } else {
5725            None
5726        }
5727    }
5728
5729    #[allow(irrefutable_let_patterns)]
5730    pub fn into_create_ring_buffer(
5731        self,
5732    ) -> Option<(DaiFormat, Format, fidl::endpoints::ServerEnd<RingBufferMarker>, DaiControlHandle)>
5733    {
5734        if let DaiRequest::CreateRingBuffer {
5735            dai_format,
5736            ring_buffer_format,
5737            ring_buffer,
5738            control_handle,
5739        } = self
5740        {
5741            Some((dai_format, ring_buffer_format, ring_buffer, control_handle))
5742        } else {
5743            None
5744        }
5745    }
5746
5747    /// Name of the method defined in FIDL
5748    pub fn method_name(&self) -> &'static str {
5749        match *self {
5750            DaiRequest::GetHealthState { .. } => "get_health_state",
5751            DaiRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
5752            DaiRequest::Reset { .. } => "reset",
5753            DaiRequest::GetProperties { .. } => "get_properties",
5754            DaiRequest::GetDaiFormats { .. } => "get_dai_formats",
5755            DaiRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
5756            DaiRequest::CreateRingBuffer { .. } => "create_ring_buffer",
5757        }
5758    }
5759}
5760
5761#[derive(Debug, Clone)]
5762pub struct DaiControlHandle {
5763    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5764}
5765
5766impl DaiControlHandle {
5767    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5768        self.inner.shutdown_with_epitaph(status.into())
5769    }
5770}
5771
5772impl fidl::endpoints::ControlHandle for DaiControlHandle {
5773    fn shutdown(&self) {
5774        self.inner.shutdown()
5775    }
5776
5777    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5778        self.inner.shutdown_with_epitaph(status)
5779    }
5780
5781    fn is_closed(&self) -> bool {
5782        self.inner.channel().is_closed()
5783    }
5784    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5785        self.inner.channel().on_closed()
5786    }
5787
5788    #[cfg(target_os = "fuchsia")]
5789    fn signal_peer(
5790        &self,
5791        clear_mask: zx::Signals,
5792        set_mask: zx::Signals,
5793    ) -> Result<(), zx_status::Status> {
5794        use fidl::Peered;
5795        self.inner.channel().signal_peer(clear_mask, set_mask)
5796    }
5797}
5798
5799impl DaiControlHandle {}
5800
5801#[must_use = "FIDL methods require a response to be sent"]
5802#[derive(Debug)]
5803pub struct DaiGetHealthStateResponder {
5804    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5805    tx_id: u32,
5806}
5807
5808/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5809/// if the responder is dropped without sending a response, so that the client
5810/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5811impl std::ops::Drop for DaiGetHealthStateResponder {
5812    fn drop(&mut self) {
5813        self.control_handle.shutdown();
5814        // Safety: drops once, never accessed again
5815        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5816    }
5817}
5818
5819impl fidl::endpoints::Responder for DaiGetHealthStateResponder {
5820    type ControlHandle = DaiControlHandle;
5821
5822    fn control_handle(&self) -> &DaiControlHandle {
5823        &self.control_handle
5824    }
5825
5826    fn drop_without_shutdown(mut self) {
5827        // Safety: drops once, never accessed again due to mem::forget
5828        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5829        // Prevent Drop from running (which would shut down the channel)
5830        std::mem::forget(self);
5831    }
5832}
5833
5834impl DaiGetHealthStateResponder {
5835    /// Sends a response to the FIDL transaction.
5836    ///
5837    /// Sets the channel to shutdown if an error occurs.
5838    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5839        let _result = self.send_raw(state);
5840        if _result.is_err() {
5841            self.control_handle.shutdown();
5842        }
5843        self.drop_without_shutdown();
5844        _result
5845    }
5846
5847    /// Similar to "send" but does not shutdown the channel if an error occurs.
5848    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5849        let _result = self.send_raw(state);
5850        self.drop_without_shutdown();
5851        _result
5852    }
5853
5854    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
5855        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
5856            (state,),
5857            self.tx_id,
5858            0x4e146d6bca733a84,
5859            fidl::encoding::DynamicFlags::empty(),
5860        )
5861    }
5862}
5863
5864#[must_use = "FIDL methods require a response to be sent"]
5865#[derive(Debug)]
5866pub struct DaiResetResponder {
5867    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5868    tx_id: u32,
5869}
5870
5871/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5872/// if the responder is dropped without sending a response, so that the client
5873/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5874impl std::ops::Drop for DaiResetResponder {
5875    fn drop(&mut self) {
5876        self.control_handle.shutdown();
5877        // Safety: drops once, never accessed again
5878        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5879    }
5880}
5881
5882impl fidl::endpoints::Responder for DaiResetResponder {
5883    type ControlHandle = DaiControlHandle;
5884
5885    fn control_handle(&self) -> &DaiControlHandle {
5886        &self.control_handle
5887    }
5888
5889    fn drop_without_shutdown(mut self) {
5890        // Safety: drops once, never accessed again due to mem::forget
5891        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5892        // Prevent Drop from running (which would shut down the channel)
5893        std::mem::forget(self);
5894    }
5895}
5896
5897impl DaiResetResponder {
5898    /// Sends a response to the FIDL transaction.
5899    ///
5900    /// Sets the channel to shutdown if an error occurs.
5901    pub fn send(self) -> Result<(), fidl::Error> {
5902        let _result = self.send_raw();
5903        if _result.is_err() {
5904            self.control_handle.shutdown();
5905        }
5906        self.drop_without_shutdown();
5907        _result
5908    }
5909
5910    /// Similar to "send" but does not shutdown the channel if an error occurs.
5911    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5912        let _result = self.send_raw();
5913        self.drop_without_shutdown();
5914        _result
5915    }
5916
5917    fn send_raw(&self) -> Result<(), fidl::Error> {
5918        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5919            (),
5920            self.tx_id,
5921            0x69e5fa9fa2f78c14,
5922            fidl::encoding::DynamicFlags::empty(),
5923        )
5924    }
5925}
5926
5927#[must_use = "FIDL methods require a response to be sent"]
5928#[derive(Debug)]
5929pub struct DaiGetPropertiesResponder {
5930    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5931    tx_id: u32,
5932}
5933
5934/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5935/// if the responder is dropped without sending a response, so that the client
5936/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5937impl std::ops::Drop for DaiGetPropertiesResponder {
5938    fn drop(&mut self) {
5939        self.control_handle.shutdown();
5940        // Safety: drops once, never accessed again
5941        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5942    }
5943}
5944
5945impl fidl::endpoints::Responder for DaiGetPropertiesResponder {
5946    type ControlHandle = DaiControlHandle;
5947
5948    fn control_handle(&self) -> &DaiControlHandle {
5949        &self.control_handle
5950    }
5951
5952    fn drop_without_shutdown(mut self) {
5953        // Safety: drops once, never accessed again due to mem::forget
5954        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5955        // Prevent Drop from running (which would shut down the channel)
5956        std::mem::forget(self);
5957    }
5958}
5959
5960impl DaiGetPropertiesResponder {
5961    /// Sends a response to the FIDL transaction.
5962    ///
5963    /// Sets the channel to shutdown if an error occurs.
5964    pub fn send(self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5965        let _result = self.send_raw(properties);
5966        if _result.is_err() {
5967            self.control_handle.shutdown();
5968        }
5969        self.drop_without_shutdown();
5970        _result
5971    }
5972
5973    /// Similar to "send" but does not shutdown the channel if an error occurs.
5974    pub fn send_no_shutdown_on_err(
5975        self,
5976        mut properties: &DaiProperties,
5977    ) -> Result<(), fidl::Error> {
5978        let _result = self.send_raw(properties);
5979        self.drop_without_shutdown();
5980        _result
5981    }
5982
5983    fn send_raw(&self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5984        self.control_handle.inner.send::<DaiGetPropertiesResponse>(
5985            (properties,),
5986            self.tx_id,
5987            0x2c25a1a66149510b,
5988            fidl::encoding::DynamicFlags::empty(),
5989        )
5990    }
5991}
5992
5993#[must_use = "FIDL methods require a response to be sent"]
5994#[derive(Debug)]
5995pub struct DaiGetDaiFormatsResponder {
5996    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5997    tx_id: u32,
5998}
5999
6000/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
6001/// if the responder is dropped without sending a response, so that the client
6002/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6003impl std::ops::Drop for DaiGetDaiFormatsResponder {
6004    fn drop(&mut self) {
6005        self.control_handle.shutdown();
6006        // Safety: drops once, never accessed again
6007        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6008    }
6009}
6010
6011impl fidl::endpoints::Responder for DaiGetDaiFormatsResponder {
6012    type ControlHandle = DaiControlHandle;
6013
6014    fn control_handle(&self) -> &DaiControlHandle {
6015        &self.control_handle
6016    }
6017
6018    fn drop_without_shutdown(mut self) {
6019        // Safety: drops once, never accessed again due to mem::forget
6020        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6021        // Prevent Drop from running (which would shut down the channel)
6022        std::mem::forget(self);
6023    }
6024}
6025
6026impl DaiGetDaiFormatsResponder {
6027    /// Sends a response to the FIDL transaction.
6028    ///
6029    /// Sets the channel to shutdown if an error occurs.
6030    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
6031        let _result = self.send_raw(result);
6032        if _result.is_err() {
6033            self.control_handle.shutdown();
6034        }
6035        self.drop_without_shutdown();
6036        _result
6037    }
6038
6039    /// Similar to "send" but does not shutdown the channel if an error occurs.
6040    pub fn send_no_shutdown_on_err(
6041        self,
6042        mut result: Result<&[DaiSupportedFormats], i32>,
6043    ) -> Result<(), fidl::Error> {
6044        let _result = self.send_raw(result);
6045        self.drop_without_shutdown();
6046        _result
6047    }
6048
6049    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
6050        self.control_handle.inner.send::<fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>>(
6051            result.map(|dai_formats| (dai_formats,)),
6052            self.tx_id,
6053            0x1eb37b0cddf79d69,
6054            fidl::encoding::DynamicFlags::empty(),
6055        )
6056    }
6057}
6058
6059#[must_use = "FIDL methods require a response to be sent"]
6060#[derive(Debug)]
6061pub struct DaiGetRingBufferFormatsResponder {
6062    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
6063    tx_id: u32,
6064}
6065
6066/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
6067/// if the responder is dropped without sending a response, so that the client
6068/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6069impl std::ops::Drop for DaiGetRingBufferFormatsResponder {
6070    fn drop(&mut self) {
6071        self.control_handle.shutdown();
6072        // Safety: drops once, never accessed again
6073        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6074    }
6075}
6076
6077impl fidl::endpoints::Responder for DaiGetRingBufferFormatsResponder {
6078    type ControlHandle = DaiControlHandle;
6079
6080    fn control_handle(&self) -> &DaiControlHandle {
6081        &self.control_handle
6082    }
6083
6084    fn drop_without_shutdown(mut self) {
6085        // Safety: drops once, never accessed again due to mem::forget
6086        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6087        // Prevent Drop from running (which would shut down the channel)
6088        std::mem::forget(self);
6089    }
6090}
6091
6092impl DaiGetRingBufferFormatsResponder {
6093    /// Sends a response to the FIDL transaction.
6094    ///
6095    /// Sets the channel to shutdown if an error occurs.
6096    pub fn send(self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
6097        let _result = self.send_raw(result);
6098        if _result.is_err() {
6099            self.control_handle.shutdown();
6100        }
6101        self.drop_without_shutdown();
6102        _result
6103    }
6104
6105    /// Similar to "send" but does not shutdown the channel if an error occurs.
6106    pub fn send_no_shutdown_on_err(
6107        self,
6108        mut result: Result<&[SupportedFormats], i32>,
6109    ) -> Result<(), fidl::Error> {
6110        let _result = self.send_raw(result);
6111        self.drop_without_shutdown();
6112        _result
6113    }
6114
6115    fn send_raw(&self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
6116        self.control_handle
6117            .inner
6118            .send::<fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>>(
6119                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
6120                self.tx_id,
6121                0x760371081d8c92e4,
6122                fidl::encoding::DynamicFlags::empty(),
6123            )
6124    }
6125}
6126
6127#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6128pub struct DaiConnectorMarker;
6129
6130impl fidl::endpoints::ProtocolMarker for DaiConnectorMarker {
6131    type Proxy = DaiConnectorProxy;
6132    type RequestStream = DaiConnectorRequestStream;
6133    #[cfg(target_os = "fuchsia")]
6134    type SynchronousProxy = DaiConnectorSynchronousProxy;
6135
6136    const DEBUG_NAME: &'static str = "(anonymous) DaiConnector";
6137}
6138
6139pub trait DaiConnectorProxyInterface: Send + Sync {
6140    fn r#connect(
6141        &self,
6142        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6143    ) -> Result<(), fidl::Error>;
6144}
6145#[derive(Debug)]
6146#[cfg(target_os = "fuchsia")]
6147pub struct DaiConnectorSynchronousProxy {
6148    client: fidl::client::sync::Client,
6149}
6150
6151#[cfg(target_os = "fuchsia")]
6152impl fidl::endpoints::SynchronousProxy for DaiConnectorSynchronousProxy {
6153    type Proxy = DaiConnectorProxy;
6154    type Protocol = DaiConnectorMarker;
6155
6156    fn from_channel(inner: fidl::Channel) -> Self {
6157        Self::new(inner)
6158    }
6159
6160    fn into_channel(self) -> fidl::Channel {
6161        self.client.into_channel()
6162    }
6163
6164    fn as_channel(&self) -> &fidl::Channel {
6165        self.client.as_channel()
6166    }
6167}
6168
6169#[cfg(target_os = "fuchsia")]
6170impl DaiConnectorSynchronousProxy {
6171    pub fn new(channel: fidl::Channel) -> Self {
6172        Self { client: fidl::client::sync::Client::new(channel) }
6173    }
6174
6175    pub fn into_channel(self) -> fidl::Channel {
6176        self.client.into_channel()
6177    }
6178
6179    /// Waits until an event arrives and returns it. It is safe for other
6180    /// threads to make concurrent requests while waiting for an event.
6181    pub fn wait_for_event(
6182        &self,
6183        deadline: zx::MonotonicInstant,
6184    ) -> Result<DaiConnectorEvent, fidl::Error> {
6185        DaiConnectorEvent::decode(self.client.wait_for_event::<DaiConnectorMarker>(deadline)?)
6186    }
6187
6188    /// This connects to a DAI protocol server.
6189    pub fn r#connect(
6190        &self,
6191        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6192    ) -> Result<(), fidl::Error> {
6193        self.client.send::<DaiConnectorConnectRequest>(
6194            (dai_protocol,),
6195            0x4e4db05c2eca1450,
6196            fidl::encoding::DynamicFlags::empty(),
6197        )
6198    }
6199}
6200
6201#[cfg(target_os = "fuchsia")]
6202impl From<DaiConnectorSynchronousProxy> for zx::NullableHandle {
6203    fn from(value: DaiConnectorSynchronousProxy) -> Self {
6204        value.into_channel().into()
6205    }
6206}
6207
6208#[cfg(target_os = "fuchsia")]
6209impl From<fidl::Channel> for DaiConnectorSynchronousProxy {
6210    fn from(value: fidl::Channel) -> Self {
6211        Self::new(value)
6212    }
6213}
6214
6215#[cfg(target_os = "fuchsia")]
6216impl fidl::endpoints::FromClient for DaiConnectorSynchronousProxy {
6217    type Protocol = DaiConnectorMarker;
6218
6219    fn from_client(value: fidl::endpoints::ClientEnd<DaiConnectorMarker>) -> Self {
6220        Self::new(value.into_channel())
6221    }
6222}
6223
6224#[derive(Debug, Clone)]
6225pub struct DaiConnectorProxy {
6226    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6227}
6228
6229impl fidl::endpoints::Proxy for DaiConnectorProxy {
6230    type Protocol = DaiConnectorMarker;
6231
6232    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6233        Self::new(inner)
6234    }
6235
6236    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6237        self.client.into_channel().map_err(|client| Self { client })
6238    }
6239
6240    fn as_channel(&self) -> &::fidl::AsyncChannel {
6241        self.client.as_channel()
6242    }
6243}
6244
6245impl DaiConnectorProxy {
6246    /// Create a new Proxy for fuchsia.hardware.audio/DaiConnector.
6247    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6248        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6249        Self { client: fidl::client::Client::new(channel, protocol_name) }
6250    }
6251
6252    /// Get a Stream of events from the remote end of the protocol.
6253    ///
6254    /// # Panics
6255    ///
6256    /// Panics if the event stream was already taken.
6257    pub fn take_event_stream(&self) -> DaiConnectorEventStream {
6258        DaiConnectorEventStream { event_receiver: self.client.take_event_receiver() }
6259    }
6260
6261    /// This connects to a DAI protocol server.
6262    pub fn r#connect(
6263        &self,
6264        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6265    ) -> Result<(), fidl::Error> {
6266        DaiConnectorProxyInterface::r#connect(self, dai_protocol)
6267    }
6268}
6269
6270impl DaiConnectorProxyInterface for DaiConnectorProxy {
6271    fn r#connect(
6272        &self,
6273        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6274    ) -> Result<(), fidl::Error> {
6275        self.client.send::<DaiConnectorConnectRequest>(
6276            (dai_protocol,),
6277            0x4e4db05c2eca1450,
6278            fidl::encoding::DynamicFlags::empty(),
6279        )
6280    }
6281}
6282
6283pub struct DaiConnectorEventStream {
6284    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6285}
6286
6287impl std::marker::Unpin for DaiConnectorEventStream {}
6288
6289impl futures::stream::FusedStream for DaiConnectorEventStream {
6290    fn is_terminated(&self) -> bool {
6291        self.event_receiver.is_terminated()
6292    }
6293}
6294
6295impl futures::Stream for DaiConnectorEventStream {
6296    type Item = Result<DaiConnectorEvent, fidl::Error>;
6297
6298    fn poll_next(
6299        mut self: std::pin::Pin<&mut Self>,
6300        cx: &mut std::task::Context<'_>,
6301    ) -> std::task::Poll<Option<Self::Item>> {
6302        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6303            &mut self.event_receiver,
6304            cx
6305        )?) {
6306            Some(buf) => std::task::Poll::Ready(Some(DaiConnectorEvent::decode(buf))),
6307            None => std::task::Poll::Ready(None),
6308        }
6309    }
6310}
6311
6312#[derive(Debug)]
6313pub enum DaiConnectorEvent {}
6314
6315impl DaiConnectorEvent {
6316    /// Decodes a message buffer as a [`DaiConnectorEvent`].
6317    fn decode(
6318        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6319    ) -> Result<DaiConnectorEvent, fidl::Error> {
6320        let (bytes, _handles) = buf.split_mut();
6321        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6322        debug_assert_eq!(tx_header.tx_id, 0);
6323        match tx_header.ordinal {
6324            _ => Err(fidl::Error::UnknownOrdinal {
6325                ordinal: tx_header.ordinal,
6326                protocol_name: <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6327            }),
6328        }
6329    }
6330}
6331
6332/// A Stream of incoming requests for fuchsia.hardware.audio/DaiConnector.
6333pub struct DaiConnectorRequestStream {
6334    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6335    is_terminated: bool,
6336}
6337
6338impl std::marker::Unpin for DaiConnectorRequestStream {}
6339
6340impl futures::stream::FusedStream for DaiConnectorRequestStream {
6341    fn is_terminated(&self) -> bool {
6342        self.is_terminated
6343    }
6344}
6345
6346impl fidl::endpoints::RequestStream for DaiConnectorRequestStream {
6347    type Protocol = DaiConnectorMarker;
6348    type ControlHandle = DaiConnectorControlHandle;
6349
6350    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6351        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6352    }
6353
6354    fn control_handle(&self) -> Self::ControlHandle {
6355        DaiConnectorControlHandle { inner: self.inner.clone() }
6356    }
6357
6358    fn into_inner(
6359        self,
6360    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6361    {
6362        (self.inner, self.is_terminated)
6363    }
6364
6365    fn from_inner(
6366        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6367        is_terminated: bool,
6368    ) -> Self {
6369        Self { inner, is_terminated }
6370    }
6371}
6372
6373impl futures::Stream for DaiConnectorRequestStream {
6374    type Item = Result<DaiConnectorRequest, fidl::Error>;
6375
6376    fn poll_next(
6377        mut self: std::pin::Pin<&mut Self>,
6378        cx: &mut std::task::Context<'_>,
6379    ) -> std::task::Poll<Option<Self::Item>> {
6380        let this = &mut *self;
6381        if this.inner.check_shutdown(cx) {
6382            this.is_terminated = true;
6383            return std::task::Poll::Ready(None);
6384        }
6385        if this.is_terminated {
6386            panic!("polled DaiConnectorRequestStream after completion");
6387        }
6388        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6389            |bytes, handles| {
6390                match this.inner.channel().read_etc(cx, bytes, handles) {
6391                    std::task::Poll::Ready(Ok(())) => {}
6392                    std::task::Poll::Pending => return std::task::Poll::Pending,
6393                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6394                        this.is_terminated = true;
6395                        return std::task::Poll::Ready(None);
6396                    }
6397                    std::task::Poll::Ready(Err(e)) => {
6398                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6399                            e.into(),
6400                        ))));
6401                    }
6402                }
6403
6404                // A message has been received from the channel
6405                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6406
6407                std::task::Poll::Ready(Some(match header.ordinal {
6408                    0x4e4db05c2eca1450 => {
6409                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6410                        let mut req = fidl::new_empty!(
6411                            DaiConnectorConnectRequest,
6412                            fidl::encoding::DefaultFuchsiaResourceDialect
6413                        );
6414                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
6415                        let control_handle =
6416                            DaiConnectorControlHandle { inner: this.inner.clone() };
6417                        Ok(DaiConnectorRequest::Connect {
6418                            dai_protocol: req.dai_protocol,
6419
6420                            control_handle,
6421                        })
6422                    }
6423                    _ => Err(fidl::Error::UnknownOrdinal {
6424                        ordinal: header.ordinal,
6425                        protocol_name:
6426                            <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6427                    }),
6428                }))
6429            },
6430        )
6431    }
6432}
6433
6434/// For an overview of the DAI protocols see
6435/// [Digital Audio Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_dai.md)
6436/// # Deprecation
6437///
6438/// Not supported anymore, instead use an
6439/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
6440/// with one DAI and one Ring Buffer, see
6441/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
6442#[derive(Debug)]
6443pub enum DaiConnectorRequest {
6444    /// This connects to a DAI protocol server.
6445    Connect {
6446        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
6447        control_handle: DaiConnectorControlHandle,
6448    },
6449}
6450
6451impl DaiConnectorRequest {
6452    #[allow(irrefutable_let_patterns)]
6453    pub fn into_connect(
6454        self,
6455    ) -> Option<(fidl::endpoints::ServerEnd<DaiMarker>, DaiConnectorControlHandle)> {
6456        if let DaiConnectorRequest::Connect { dai_protocol, control_handle } = self {
6457            Some((dai_protocol, control_handle))
6458        } else {
6459            None
6460        }
6461    }
6462
6463    /// Name of the method defined in FIDL
6464    pub fn method_name(&self) -> &'static str {
6465        match *self {
6466            DaiConnectorRequest::Connect { .. } => "connect",
6467        }
6468    }
6469}
6470
6471#[derive(Debug, Clone)]
6472pub struct DaiConnectorControlHandle {
6473    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6474}
6475
6476impl DaiConnectorControlHandle {
6477    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6478        self.inner.shutdown_with_epitaph(status.into())
6479    }
6480}
6481
6482impl fidl::endpoints::ControlHandle for DaiConnectorControlHandle {
6483    fn shutdown(&self) {
6484        self.inner.shutdown()
6485    }
6486
6487    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6488        self.inner.shutdown_with_epitaph(status)
6489    }
6490
6491    fn is_closed(&self) -> bool {
6492        self.inner.channel().is_closed()
6493    }
6494    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6495        self.inner.channel().on_closed()
6496    }
6497
6498    #[cfg(target_os = "fuchsia")]
6499    fn signal_peer(
6500        &self,
6501        clear_mask: zx::Signals,
6502        set_mask: zx::Signals,
6503    ) -> Result<(), zx_status::Status> {
6504        use fidl::Peered;
6505        self.inner.channel().signal_peer(clear_mask, set_mask)
6506    }
6507}
6508
6509impl DaiConnectorControlHandle {}
6510
6511#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6512pub struct HealthMarker;
6513
6514impl fidl::endpoints::ProtocolMarker for HealthMarker {
6515    type Proxy = HealthProxy;
6516    type RequestStream = HealthRequestStream;
6517    #[cfg(target_os = "fuchsia")]
6518    type SynchronousProxy = HealthSynchronousProxy;
6519
6520    const DEBUG_NAME: &'static str = "(anonymous) Health";
6521}
6522
6523pub trait HealthProxyInterface: Send + Sync {
6524    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
6525        + Send;
6526    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
6527}
6528#[derive(Debug)]
6529#[cfg(target_os = "fuchsia")]
6530pub struct HealthSynchronousProxy {
6531    client: fidl::client::sync::Client,
6532}
6533
6534#[cfg(target_os = "fuchsia")]
6535impl fidl::endpoints::SynchronousProxy for HealthSynchronousProxy {
6536    type Proxy = HealthProxy;
6537    type Protocol = HealthMarker;
6538
6539    fn from_channel(inner: fidl::Channel) -> Self {
6540        Self::new(inner)
6541    }
6542
6543    fn into_channel(self) -> fidl::Channel {
6544        self.client.into_channel()
6545    }
6546
6547    fn as_channel(&self) -> &fidl::Channel {
6548        self.client.as_channel()
6549    }
6550}
6551
6552#[cfg(target_os = "fuchsia")]
6553impl HealthSynchronousProxy {
6554    pub fn new(channel: fidl::Channel) -> Self {
6555        Self { client: fidl::client::sync::Client::new(channel) }
6556    }
6557
6558    pub fn into_channel(self) -> fidl::Channel {
6559        self.client.into_channel()
6560    }
6561
6562    /// Waits until an event arrives and returns it. It is safe for other
6563    /// threads to make concurrent requests while waiting for an event.
6564    pub fn wait_for_event(
6565        &self,
6566        deadline: zx::MonotonicInstant,
6567    ) -> Result<HealthEvent, fidl::Error> {
6568        HealthEvent::decode(self.client.wait_for_event::<HealthMarker>(deadline)?)
6569    }
6570
6571    /// Retrieves top level health state.
6572    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6573    pub fn r#get_health_state(
6574        &self,
6575        ___deadline: zx::MonotonicInstant,
6576    ) -> Result<HealthState, fidl::Error> {
6577        let _response = self
6578            .client
6579            .send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse, HealthMarker>(
6580                (),
6581                0x4e146d6bca733a84,
6582                fidl::encoding::DynamicFlags::empty(),
6583                ___deadline,
6584            )?;
6585        Ok(_response.state)
6586    }
6587}
6588
6589#[cfg(target_os = "fuchsia")]
6590impl From<HealthSynchronousProxy> for zx::NullableHandle {
6591    fn from(value: HealthSynchronousProxy) -> Self {
6592        value.into_channel().into()
6593    }
6594}
6595
6596#[cfg(target_os = "fuchsia")]
6597impl From<fidl::Channel> for HealthSynchronousProxy {
6598    fn from(value: fidl::Channel) -> Self {
6599        Self::new(value)
6600    }
6601}
6602
6603#[cfg(target_os = "fuchsia")]
6604impl fidl::endpoints::FromClient for HealthSynchronousProxy {
6605    type Protocol = HealthMarker;
6606
6607    fn from_client(value: fidl::endpoints::ClientEnd<HealthMarker>) -> Self {
6608        Self::new(value.into_channel())
6609    }
6610}
6611
6612#[derive(Debug, Clone)]
6613pub struct HealthProxy {
6614    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6615}
6616
6617impl fidl::endpoints::Proxy for HealthProxy {
6618    type Protocol = HealthMarker;
6619
6620    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6621        Self::new(inner)
6622    }
6623
6624    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6625        self.client.into_channel().map_err(|client| Self { client })
6626    }
6627
6628    fn as_channel(&self) -> &::fidl::AsyncChannel {
6629        self.client.as_channel()
6630    }
6631}
6632
6633impl HealthProxy {
6634    /// Create a new Proxy for fuchsia.hardware.audio/Health.
6635    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6636        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6637        Self { client: fidl::client::Client::new(channel, protocol_name) }
6638    }
6639
6640    /// Get a Stream of events from the remote end of the protocol.
6641    ///
6642    /// # Panics
6643    ///
6644    /// Panics if the event stream was already taken.
6645    pub fn take_event_stream(&self) -> HealthEventStream {
6646        HealthEventStream { event_receiver: self.client.take_event_receiver() }
6647    }
6648
6649    /// Retrieves top level health state.
6650    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6651    pub fn r#get_health_state(
6652        &self,
6653    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
6654    {
6655        HealthProxyInterface::r#get_health_state(self)
6656    }
6657}
6658
6659impl HealthProxyInterface for HealthProxy {
6660    type GetHealthStateResponseFut =
6661        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
6662    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
6663        fn _decode(
6664            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6665        ) -> Result<HealthState, fidl::Error> {
6666            let _response = fidl::client::decode_transaction_body::<
6667                HealthGetHealthStateResponse,
6668                fidl::encoding::DefaultFuchsiaResourceDialect,
6669                0x4e146d6bca733a84,
6670            >(_buf?)?;
6671            Ok(_response.state)
6672        }
6673        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
6674            (),
6675            0x4e146d6bca733a84,
6676            fidl::encoding::DynamicFlags::empty(),
6677            _decode,
6678        )
6679    }
6680}
6681
6682pub struct HealthEventStream {
6683    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6684}
6685
6686impl std::marker::Unpin for HealthEventStream {}
6687
6688impl futures::stream::FusedStream for HealthEventStream {
6689    fn is_terminated(&self) -> bool {
6690        self.event_receiver.is_terminated()
6691    }
6692}
6693
6694impl futures::Stream for HealthEventStream {
6695    type Item = Result<HealthEvent, fidl::Error>;
6696
6697    fn poll_next(
6698        mut self: std::pin::Pin<&mut Self>,
6699        cx: &mut std::task::Context<'_>,
6700    ) -> std::task::Poll<Option<Self::Item>> {
6701        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6702            &mut self.event_receiver,
6703            cx
6704        )?) {
6705            Some(buf) => std::task::Poll::Ready(Some(HealthEvent::decode(buf))),
6706            None => std::task::Poll::Ready(None),
6707        }
6708    }
6709}
6710
6711#[derive(Debug)]
6712pub enum HealthEvent {}
6713
6714impl HealthEvent {
6715    /// Decodes a message buffer as a [`HealthEvent`].
6716    fn decode(
6717        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6718    ) -> Result<HealthEvent, fidl::Error> {
6719        let (bytes, _handles) = buf.split_mut();
6720        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6721        debug_assert_eq!(tx_header.tx_id, 0);
6722        match tx_header.ordinal {
6723            _ => Err(fidl::Error::UnknownOrdinal {
6724                ordinal: tx_header.ordinal,
6725                protocol_name: <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6726            }),
6727        }
6728    }
6729}
6730
6731/// A Stream of incoming requests for fuchsia.hardware.audio/Health.
6732pub struct HealthRequestStream {
6733    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6734    is_terminated: bool,
6735}
6736
6737impl std::marker::Unpin for HealthRequestStream {}
6738
6739impl futures::stream::FusedStream for HealthRequestStream {
6740    fn is_terminated(&self) -> bool {
6741        self.is_terminated
6742    }
6743}
6744
6745impl fidl::endpoints::RequestStream for HealthRequestStream {
6746    type Protocol = HealthMarker;
6747    type ControlHandle = HealthControlHandle;
6748
6749    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6750        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6751    }
6752
6753    fn control_handle(&self) -> Self::ControlHandle {
6754        HealthControlHandle { inner: self.inner.clone() }
6755    }
6756
6757    fn into_inner(
6758        self,
6759    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6760    {
6761        (self.inner, self.is_terminated)
6762    }
6763
6764    fn from_inner(
6765        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6766        is_terminated: bool,
6767    ) -> Self {
6768        Self { inner, is_terminated }
6769    }
6770}
6771
6772impl futures::Stream for HealthRequestStream {
6773    type Item = Result<HealthRequest, fidl::Error>;
6774
6775    fn poll_next(
6776        mut self: std::pin::Pin<&mut Self>,
6777        cx: &mut std::task::Context<'_>,
6778    ) -> std::task::Poll<Option<Self::Item>> {
6779        let this = &mut *self;
6780        if this.inner.check_shutdown(cx) {
6781            this.is_terminated = true;
6782            return std::task::Poll::Ready(None);
6783        }
6784        if this.is_terminated {
6785            panic!("polled HealthRequestStream after completion");
6786        }
6787        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6788            |bytes, handles| {
6789                match this.inner.channel().read_etc(cx, bytes, handles) {
6790                    std::task::Poll::Ready(Ok(())) => {}
6791                    std::task::Poll::Pending => return std::task::Poll::Pending,
6792                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6793                        this.is_terminated = true;
6794                        return std::task::Poll::Ready(None);
6795                    }
6796                    std::task::Poll::Ready(Err(e)) => {
6797                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6798                            e.into(),
6799                        ))));
6800                    }
6801                }
6802
6803                // A message has been received from the channel
6804                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6805
6806                std::task::Poll::Ready(Some(match header.ordinal {
6807                    0x4e146d6bca733a84 => {
6808                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6809                        let mut req = fidl::new_empty!(
6810                            fidl::encoding::EmptyPayload,
6811                            fidl::encoding::DefaultFuchsiaResourceDialect
6812                        );
6813                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6814                        let control_handle = HealthControlHandle { inner: this.inner.clone() };
6815                        Ok(HealthRequest::GetHealthState {
6816                            responder: HealthGetHealthStateResponder {
6817                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6818                                tx_id: header.tx_id,
6819                            },
6820                        })
6821                    }
6822                    _ => Err(fidl::Error::UnknownOrdinal {
6823                        ordinal: header.ordinal,
6824                        protocol_name:
6825                            <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6826                    }),
6827                }))
6828            },
6829        )
6830    }
6831}
6832
6833#[derive(Debug)]
6834pub enum HealthRequest {
6835    /// Retrieves top level health state.
6836    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6837    GetHealthState { responder: HealthGetHealthStateResponder },
6838}
6839
6840impl HealthRequest {
6841    #[allow(irrefutable_let_patterns)]
6842    pub fn into_get_health_state(self) -> Option<(HealthGetHealthStateResponder)> {
6843        if let HealthRequest::GetHealthState { responder } = self {
6844            Some((responder))
6845        } else {
6846            None
6847        }
6848    }
6849
6850    /// Name of the method defined in FIDL
6851    pub fn method_name(&self) -> &'static str {
6852        match *self {
6853            HealthRequest::GetHealthState { .. } => "get_health_state",
6854        }
6855    }
6856}
6857
6858#[derive(Debug, Clone)]
6859pub struct HealthControlHandle {
6860    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6861}
6862
6863impl HealthControlHandle {
6864    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6865        self.inner.shutdown_with_epitaph(status.into())
6866    }
6867}
6868
6869impl fidl::endpoints::ControlHandle for HealthControlHandle {
6870    fn shutdown(&self) {
6871        self.inner.shutdown()
6872    }
6873
6874    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6875        self.inner.shutdown_with_epitaph(status)
6876    }
6877
6878    fn is_closed(&self) -> bool {
6879        self.inner.channel().is_closed()
6880    }
6881    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6882        self.inner.channel().on_closed()
6883    }
6884
6885    #[cfg(target_os = "fuchsia")]
6886    fn signal_peer(
6887        &self,
6888        clear_mask: zx::Signals,
6889        set_mask: zx::Signals,
6890    ) -> Result<(), zx_status::Status> {
6891        use fidl::Peered;
6892        self.inner.channel().signal_peer(clear_mask, set_mask)
6893    }
6894}
6895
6896impl HealthControlHandle {}
6897
6898#[must_use = "FIDL methods require a response to be sent"]
6899#[derive(Debug)]
6900pub struct HealthGetHealthStateResponder {
6901    control_handle: std::mem::ManuallyDrop<HealthControlHandle>,
6902    tx_id: u32,
6903}
6904
6905/// Set the the channel to be shutdown (see [`HealthControlHandle::shutdown`])
6906/// if the responder is dropped without sending a response, so that the client
6907/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6908impl std::ops::Drop for HealthGetHealthStateResponder {
6909    fn drop(&mut self) {
6910        self.control_handle.shutdown();
6911        // Safety: drops once, never accessed again
6912        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6913    }
6914}
6915
6916impl fidl::endpoints::Responder for HealthGetHealthStateResponder {
6917    type ControlHandle = HealthControlHandle;
6918
6919    fn control_handle(&self) -> &HealthControlHandle {
6920        &self.control_handle
6921    }
6922
6923    fn drop_without_shutdown(mut self) {
6924        // Safety: drops once, never accessed again due to mem::forget
6925        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6926        // Prevent Drop from running (which would shut down the channel)
6927        std::mem::forget(self);
6928    }
6929}
6930
6931impl HealthGetHealthStateResponder {
6932    /// Sends a response to the FIDL transaction.
6933    ///
6934    /// Sets the channel to shutdown if an error occurs.
6935    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6936        let _result = self.send_raw(state);
6937        if _result.is_err() {
6938            self.control_handle.shutdown();
6939        }
6940        self.drop_without_shutdown();
6941        _result
6942    }
6943
6944    /// Similar to "send" but does not shutdown the channel if an error occurs.
6945    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6946        let _result = self.send_raw(state);
6947        self.drop_without_shutdown();
6948        _result
6949    }
6950
6951    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
6952        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
6953            (state,),
6954            self.tx_id,
6955            0x4e146d6bca733a84,
6956            fidl::encoding::DynamicFlags::empty(),
6957        )
6958    }
6959}
6960
6961#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6962pub struct PacketStreamControlMarker;
6963
6964impl fidl::endpoints::ProtocolMarker for PacketStreamControlMarker {
6965    type Proxy = PacketStreamControlProxy;
6966    type RequestStream = PacketStreamControlRequestStream;
6967    #[cfg(target_os = "fuchsia")]
6968    type SynchronousProxy = PacketStreamControlSynchronousProxy;
6969
6970    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamControl";
6971}
6972pub type PacketStreamControlAllocateVmosResult = Result<Vec<VmoInfo>, i32>;
6973pub type PacketStreamControlDeallocateVmosResult = Result<(), i32>;
6974pub type PacketStreamControlRegisterVmosResult = Result<(), i32>;
6975pub type PacketStreamControlUnregisterVmosResult = Result<(), i32>;
6976pub type PacketStreamControlGetPacketStreamSinkResult =
6977    Result<PacketStreamControlGetPacketStreamSinkResponse, i32>;
6978pub type PacketStreamControlSetPacketStreamSinkResult = Result<(), i32>;
6979pub type PacketStreamControlStartResult = Result<(), i32>;
6980pub type PacketStreamControlStopResult = Result<(), i32>;
6981
6982pub trait PacketStreamControlProxyInterface: Send + Sync {
6983    type GetPropertiesResponseFut: std::future::Future<Output = Result<PacketStreamProperties, fidl::Error>>
6984        + Send;
6985    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
6986    type AllocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlAllocateVmosResult, fidl::Error>>
6987        + Send;
6988    fn r#allocate_vmos(&self, payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut;
6989    type DeallocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlDeallocateVmosResult, fidl::Error>>
6990        + Send;
6991    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut;
6992    type RegisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlRegisterVmosResult, fidl::Error>>
6993        + Send;
6994    fn r#register_vmos(&self, payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut;
6995    type UnregisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlUnregisterVmosResult, fidl::Error>>
6996        + Send;
6997    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut;
6998    type GetPacketStreamSinkResponseFut: std::future::Future<
6999            Output = Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error>,
7000        > + Send;
7001    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut;
7002    type SetPacketStreamSinkResponseFut: std::future::Future<
7003            Output = Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error>,
7004        > + Send;
7005    fn r#set_packet_stream_sink(
7006        &self,
7007        payload: PacketStreamControlSetPacketStreamSinkRequest,
7008    ) -> Self::SetPacketStreamSinkResponseFut;
7009    type StartResponseFut: std::future::Future<Output = Result<PacketStreamControlStartResult, fidl::Error>>
7010        + Send;
7011    fn r#start(&self) -> Self::StartResponseFut;
7012    type StopResponseFut: std::future::Future<Output = Result<PacketStreamControlStopResult, fidl::Error>>
7013        + Send;
7014    fn r#stop(&self) -> Self::StopResponseFut;
7015}
7016#[derive(Debug)]
7017#[cfg(target_os = "fuchsia")]
7018pub struct PacketStreamControlSynchronousProxy {
7019    client: fidl::client::sync::Client,
7020}
7021
7022#[cfg(target_os = "fuchsia")]
7023impl fidl::endpoints::SynchronousProxy for PacketStreamControlSynchronousProxy {
7024    type Proxy = PacketStreamControlProxy;
7025    type Protocol = PacketStreamControlMarker;
7026
7027    fn from_channel(inner: fidl::Channel) -> Self {
7028        Self::new(inner)
7029    }
7030
7031    fn into_channel(self) -> fidl::Channel {
7032        self.client.into_channel()
7033    }
7034
7035    fn as_channel(&self) -> &fidl::Channel {
7036        self.client.as_channel()
7037    }
7038}
7039
7040#[cfg(target_os = "fuchsia")]
7041impl PacketStreamControlSynchronousProxy {
7042    pub fn new(channel: fidl::Channel) -> Self {
7043        Self { client: fidl::client::sync::Client::new(channel) }
7044    }
7045
7046    pub fn into_channel(self) -> fidl::Channel {
7047        self.client.into_channel()
7048    }
7049
7050    /// Waits until an event arrives and returns it. It is safe for other
7051    /// threads to make concurrent requests while waiting for an event.
7052    pub fn wait_for_event(
7053        &self,
7054        deadline: zx::MonotonicInstant,
7055    ) -> Result<PacketStreamControlEvent, fidl::Error> {
7056        PacketStreamControlEvent::decode(
7057            self.client.wait_for_event::<PacketStreamControlMarker>(deadline)?,
7058        )
7059    }
7060
7061    /// Accessor for top level static properties.
7062    pub fn r#get_properties(
7063        &self,
7064        ___deadline: zx::MonotonicInstant,
7065    ) -> Result<PacketStreamProperties, fidl::Error> {
7066        let _response = self.client.send_query::<
7067            fidl::encoding::EmptyPayload,
7068            fidl::encoding::FlexibleType<PacketStreamControlGetPropertiesResponse>,
7069            PacketStreamControlMarker,
7070        >(
7071            (),
7072            0x586cf4f0f8d2771f,
7073            fidl::encoding::DynamicFlags::FLEXIBLE,
7074            ___deadline,
7075        )?
7076        .into_result::<PacketStreamControlMarker>("get_properties")?;
7077        Ok(_response.properties)
7078    }
7079
7080    /// Request the driver to allocate VMOs for data transfer.
7081    /// Returns the allocated VMOs and their assigned IDs.
7082    ///
7083    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7084    /// If the packet stream is an output stream, then the handle must also include
7085    /// ZX_RIGHT_WRITE.
7086    ///
7087    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
7088    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
7089    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
7090    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
7091    /// reconfigure.
7092    pub fn r#allocate_vmos(
7093        &self,
7094        mut payload: &AllocateVmosConfig,
7095        ___deadline: zx::MonotonicInstant,
7096    ) -> Result<PacketStreamControlAllocateVmosResult, fidl::Error> {
7097        let _response = self.client.send_query::<
7098            AllocateVmosConfig,
7099            fidl::encoding::FlexibleResultType<PacketStreamControlAllocateVmosResponse, i32>,
7100            PacketStreamControlMarker,
7101        >(
7102            payload,
7103            0x7ff1473165ed344b,
7104            fidl::encoding::DynamicFlags::FLEXIBLE,
7105            ___deadline,
7106        )?
7107        .into_result::<PacketStreamControlMarker>("allocate_vmos")?;
7108        Ok(_response.map(|x| x.vmos))
7109    }
7110
7111    /// Releases all VMOs previously allocated via `AllocateVmos`.
7112    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7113    ///
7114    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
7115    /// not stopped.
7116    pub fn r#deallocate_vmos(
7117        &self,
7118        ___deadline: zx::MonotonicInstant,
7119    ) -> Result<PacketStreamControlDeallocateVmosResult, fidl::Error> {
7120        let _response = self.client.send_query::<
7121            fidl::encoding::EmptyPayload,
7122            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7123            PacketStreamControlMarker,
7124        >(
7125            (),
7126            0x4db5cc85a7b8405b,
7127            fidl::encoding::DynamicFlags::FLEXIBLE,
7128            ___deadline,
7129        )?
7130        .into_result::<PacketStreamControlMarker>("deallocate_vmos")?;
7131        Ok(_response.map(|x| x))
7132    }
7133
7134    /// Registers client-allocated VMOs with the driver.
7135    ///
7136    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7137    /// If the packet stream is an input stream, then the handle must also include
7138    /// ZX_RIGHT_WRITE.
7139    ///
7140    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
7141    /// or if duplicate `vmo_id`s are found.
7142    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
7143    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
7144    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
7145    /// reconfigure.
7146    pub fn r#register_vmos(
7147        &self,
7148        mut payload: RegisterVmosConfig,
7149        ___deadline: zx::MonotonicInstant,
7150    ) -> Result<PacketStreamControlRegisterVmosResult, fidl::Error> {
7151        let _response = self.client.send_query::<
7152            RegisterVmosConfig,
7153            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7154            PacketStreamControlMarker,
7155        >(
7156            &mut payload,
7157            0x29c3b656a1020bfd,
7158            fidl::encoding::DynamicFlags::FLEXIBLE,
7159            ___deadline,
7160        )?
7161        .into_result::<PacketStreamControlMarker>("register_vmos")?;
7162        Ok(_response.map(|x| x))
7163    }
7164
7165    /// Unregisters all VMOs previously registered via `RegisterVmos`.
7166    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7167    ///
7168    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
7169    /// not stopped.
7170    pub fn r#unregister_vmos(
7171        &self,
7172        ___deadline: zx::MonotonicInstant,
7173    ) -> Result<PacketStreamControlUnregisterVmosResult, fidl::Error> {
7174        let _response = self.client.send_query::<
7175            fidl::encoding::EmptyPayload,
7176            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7177            PacketStreamControlMarker,
7178        >(
7179            (),
7180            0x3e3b4dbfe26b6094,
7181            fidl::encoding::DynamicFlags::FLEXIBLE,
7182            ___deadline,
7183        )?
7184        .into_result::<PacketStreamControlMarker>("unregister_vmos")?;
7185        Ok(_response.map(|x| x))
7186    }
7187
7188    /// Connects to the data sink implemented by the driver.
7189    /// This is used for audio **Output** where the driver consumes data.
7190    ///
7191    /// Flow:
7192    /// 1. App writes audio data to a registered VMO.
7193    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
7194    ///    true).
7195    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
7196    /// 4. Driver consumes the data.
7197    ///
7198    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
7199    /// and any pending requests on that channel are discarded. The new channel replaces the old
7200    /// one.
7201    ///
7202    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
7203    /// not support this method.
7204    pub fn r#get_packet_stream_sink(
7205        &self,
7206        ___deadline: zx::MonotonicInstant,
7207    ) -> Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error> {
7208        let _response =
7209            self.client
7210                .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
7211                    PacketStreamControlGetPacketStreamSinkResponse,
7212                    i32,
7213                >, PacketStreamControlMarker>(
7214                    (),
7215                    0x7394726463ebbc6a,
7216                    fidl::encoding::DynamicFlags::FLEXIBLE,
7217                    ___deadline,
7218                )?
7219                .into_result::<PacketStreamControlMarker>("get_packet_stream_sink")?;
7220        Ok(_response.map(|x| x))
7221    }
7222
7223    /// Provides a data sink to the driver.
7224    /// This is used for audio **Input** where the driver produces data.
7225    ///
7226    /// Flow:
7227    /// 1. Driver writes audio data to a registered VMO.
7228    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
7229    /// 3. App receives `PutPacket`.
7230    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
7231    ///    true).
7232    /// 5. App reads the data.
7233    ///
7234    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
7235    /// channel. The new channel replaces the old one.
7236    ///
7237    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
7238    /// not support this method.
7239    pub fn r#set_packet_stream_sink(
7240        &self,
7241        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7242        ___deadline: zx::MonotonicInstant,
7243    ) -> Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error> {
7244        let _response = self.client.send_query::<
7245            PacketStreamControlSetPacketStreamSinkRequest,
7246            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7247            PacketStreamControlMarker,
7248        >(
7249            &mut payload,
7250            0xab88800e31dc0e4,
7251            fidl::encoding::DynamicFlags::FLEXIBLE,
7252            ___deadline,
7253        )?
7254        .into_result::<PacketStreamControlMarker>("set_packet_stream_sink")?;
7255        Ok(_response.map(|x| x))
7256    }
7257
7258    /// Start the packet-stream.
7259    ///
7260    /// Returns `ZX_ERR_BAD_STATE` if:
7261    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
7262    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
7263    ///   `INLINE` is supported.
7264    /// * The stream is already started.
7265    pub fn r#start(
7266        &self,
7267        ___deadline: zx::MonotonicInstant,
7268    ) -> Result<PacketStreamControlStartResult, fidl::Error> {
7269        let _response = self.client.send_query::<
7270            fidl::encoding::EmptyPayload,
7271            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7272            PacketStreamControlMarker,
7273        >(
7274            (),
7275            0x3a584b94d8a6bfd0,
7276            fidl::encoding::DynamicFlags::FLEXIBLE,
7277            ___deadline,
7278        )?
7279        .into_result::<PacketStreamControlMarker>("start")?;
7280        Ok(_response.map(|x| x))
7281    }
7282
7283    /// Stop the packet-stream.
7284    ///
7285    /// Once the response is received, the stream is halted.
7286    ///
7287    /// Behavior depends on the stream direction:
7288    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
7289    ///   requests will remain pending until `Start` is called again. Clients may call
7290    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
7291    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
7292    ///   calls will be made by the driver until `Start` is called again.
7293    ///
7294    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
7295    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
7296    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
7297    ///   complete successfully after `Stop` has returned.
7298    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
7299    ///   arrive at the client after `Stop` has returned.
7300    ///
7301    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
7302    pub fn r#stop(
7303        &self,
7304        ___deadline: zx::MonotonicInstant,
7305    ) -> Result<PacketStreamControlStopResult, fidl::Error> {
7306        let _response = self.client.send_query::<
7307            fidl::encoding::EmptyPayload,
7308            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7309            PacketStreamControlMarker,
7310        >(
7311            (),
7312            0x703e4fafcdd7ef32,
7313            fidl::encoding::DynamicFlags::FLEXIBLE,
7314            ___deadline,
7315        )?
7316        .into_result::<PacketStreamControlMarker>("stop")?;
7317        Ok(_response.map(|x| x))
7318    }
7319}
7320
7321#[cfg(target_os = "fuchsia")]
7322impl From<PacketStreamControlSynchronousProxy> for zx::NullableHandle {
7323    fn from(value: PacketStreamControlSynchronousProxy) -> Self {
7324        value.into_channel().into()
7325    }
7326}
7327
7328#[cfg(target_os = "fuchsia")]
7329impl From<fidl::Channel> for PacketStreamControlSynchronousProxy {
7330    fn from(value: fidl::Channel) -> Self {
7331        Self::new(value)
7332    }
7333}
7334
7335#[cfg(target_os = "fuchsia")]
7336impl fidl::endpoints::FromClient for PacketStreamControlSynchronousProxy {
7337    type Protocol = PacketStreamControlMarker;
7338
7339    fn from_client(value: fidl::endpoints::ClientEnd<PacketStreamControlMarker>) -> Self {
7340        Self::new(value.into_channel())
7341    }
7342}
7343
7344#[derive(Debug, Clone)]
7345pub struct PacketStreamControlProxy {
7346    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7347}
7348
7349impl fidl::endpoints::Proxy for PacketStreamControlProxy {
7350    type Protocol = PacketStreamControlMarker;
7351
7352    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7353        Self::new(inner)
7354    }
7355
7356    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7357        self.client.into_channel().map_err(|client| Self { client })
7358    }
7359
7360    fn as_channel(&self) -> &::fidl::AsyncChannel {
7361        self.client.as_channel()
7362    }
7363}
7364
7365impl PacketStreamControlProxy {
7366    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamControl.
7367    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7368        let protocol_name =
7369            <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7370        Self { client: fidl::client::Client::new(channel, protocol_name) }
7371    }
7372
7373    /// Get a Stream of events from the remote end of the protocol.
7374    ///
7375    /// # Panics
7376    ///
7377    /// Panics if the event stream was already taken.
7378    pub fn take_event_stream(&self) -> PacketStreamControlEventStream {
7379        PacketStreamControlEventStream { event_receiver: self.client.take_event_receiver() }
7380    }
7381
7382    /// Accessor for top level static properties.
7383    pub fn r#get_properties(
7384        &self,
7385    ) -> fidl::client::QueryResponseFut<
7386        PacketStreamProperties,
7387        fidl::encoding::DefaultFuchsiaResourceDialect,
7388    > {
7389        PacketStreamControlProxyInterface::r#get_properties(self)
7390    }
7391
7392    /// Request the driver to allocate VMOs for data transfer.
7393    /// Returns the allocated VMOs and their assigned IDs.
7394    ///
7395    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7396    /// If the packet stream is an output stream, then the handle must also include
7397    /// ZX_RIGHT_WRITE.
7398    ///
7399    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
7400    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
7401    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
7402    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
7403    /// reconfigure.
7404    pub fn r#allocate_vmos(
7405        &self,
7406        mut payload: &AllocateVmosConfig,
7407    ) -> fidl::client::QueryResponseFut<
7408        PacketStreamControlAllocateVmosResult,
7409        fidl::encoding::DefaultFuchsiaResourceDialect,
7410    > {
7411        PacketStreamControlProxyInterface::r#allocate_vmos(self, payload)
7412    }
7413
7414    /// Releases all VMOs previously allocated via `AllocateVmos`.
7415    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7416    ///
7417    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
7418    /// not stopped.
7419    pub fn r#deallocate_vmos(
7420        &self,
7421    ) -> fidl::client::QueryResponseFut<
7422        PacketStreamControlDeallocateVmosResult,
7423        fidl::encoding::DefaultFuchsiaResourceDialect,
7424    > {
7425        PacketStreamControlProxyInterface::r#deallocate_vmos(self)
7426    }
7427
7428    /// Registers client-allocated VMOs with the driver.
7429    ///
7430    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7431    /// If the packet stream is an input stream, then the handle must also include
7432    /// ZX_RIGHT_WRITE.
7433    ///
7434    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
7435    /// or if duplicate `vmo_id`s are found.
7436    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
7437    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
7438    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
7439    /// reconfigure.
7440    pub fn r#register_vmos(
7441        &self,
7442        mut payload: RegisterVmosConfig,
7443    ) -> fidl::client::QueryResponseFut<
7444        PacketStreamControlRegisterVmosResult,
7445        fidl::encoding::DefaultFuchsiaResourceDialect,
7446    > {
7447        PacketStreamControlProxyInterface::r#register_vmos(self, payload)
7448    }
7449
7450    /// Unregisters all VMOs previously registered via `RegisterVmos`.
7451    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
7452    ///
7453    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
7454    /// not stopped.
7455    pub fn r#unregister_vmos(
7456        &self,
7457    ) -> fidl::client::QueryResponseFut<
7458        PacketStreamControlUnregisterVmosResult,
7459        fidl::encoding::DefaultFuchsiaResourceDialect,
7460    > {
7461        PacketStreamControlProxyInterface::r#unregister_vmos(self)
7462    }
7463
7464    /// Connects to the data sink implemented by the driver.
7465    /// This is used for audio **Output** where the driver consumes data.
7466    ///
7467    /// Flow:
7468    /// 1. App writes audio data to a registered VMO.
7469    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
7470    ///    true).
7471    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
7472    /// 4. Driver consumes the data.
7473    ///
7474    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
7475    /// and any pending requests on that channel are discarded. The new channel replaces the old
7476    /// one.
7477    ///
7478    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
7479    /// not support this method.
7480    pub fn r#get_packet_stream_sink(
7481        &self,
7482    ) -> fidl::client::QueryResponseFut<
7483        PacketStreamControlGetPacketStreamSinkResult,
7484        fidl::encoding::DefaultFuchsiaResourceDialect,
7485    > {
7486        PacketStreamControlProxyInterface::r#get_packet_stream_sink(self)
7487    }
7488
7489    /// Provides a data sink to the driver.
7490    /// This is used for audio **Input** where the driver produces data.
7491    ///
7492    /// Flow:
7493    /// 1. Driver writes audio data to a registered VMO.
7494    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
7495    /// 3. App receives `PutPacket`.
7496    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
7497    ///    true).
7498    /// 5. App reads the data.
7499    ///
7500    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
7501    /// channel. The new channel replaces the old one.
7502    ///
7503    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
7504    /// not support this method.
7505    pub fn r#set_packet_stream_sink(
7506        &self,
7507        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7508    ) -> fidl::client::QueryResponseFut<
7509        PacketStreamControlSetPacketStreamSinkResult,
7510        fidl::encoding::DefaultFuchsiaResourceDialect,
7511    > {
7512        PacketStreamControlProxyInterface::r#set_packet_stream_sink(self, payload)
7513    }
7514
7515    /// Start the packet-stream.
7516    ///
7517    /// Returns `ZX_ERR_BAD_STATE` if:
7518    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
7519    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
7520    ///   `INLINE` is supported.
7521    /// * The stream is already started.
7522    pub fn r#start(
7523        &self,
7524    ) -> fidl::client::QueryResponseFut<
7525        PacketStreamControlStartResult,
7526        fidl::encoding::DefaultFuchsiaResourceDialect,
7527    > {
7528        PacketStreamControlProxyInterface::r#start(self)
7529    }
7530
7531    /// Stop the packet-stream.
7532    ///
7533    /// Once the response is received, the stream is halted.
7534    ///
7535    /// Behavior depends on the stream direction:
7536    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
7537    ///   requests will remain pending until `Start` is called again. Clients may call
7538    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
7539    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
7540    ///   calls will be made by the driver until `Start` is called again.
7541    ///
7542    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
7543    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
7544    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
7545    ///   complete successfully after `Stop` has returned.
7546    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
7547    ///   arrive at the client after `Stop` has returned.
7548    ///
7549    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
7550    pub fn r#stop(
7551        &self,
7552    ) -> fidl::client::QueryResponseFut<
7553        PacketStreamControlStopResult,
7554        fidl::encoding::DefaultFuchsiaResourceDialect,
7555    > {
7556        PacketStreamControlProxyInterface::r#stop(self)
7557    }
7558}
7559
7560impl PacketStreamControlProxyInterface for PacketStreamControlProxy {
7561    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
7562        PacketStreamProperties,
7563        fidl::encoding::DefaultFuchsiaResourceDialect,
7564    >;
7565    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
7566        fn _decode(
7567            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7568        ) -> Result<PacketStreamProperties, fidl::Error> {
7569            let _response = fidl::client::decode_transaction_body::<
7570                fidl::encoding::FlexibleType<PacketStreamControlGetPropertiesResponse>,
7571                fidl::encoding::DefaultFuchsiaResourceDialect,
7572                0x586cf4f0f8d2771f,
7573            >(_buf?)?
7574            .into_result::<PacketStreamControlMarker>("get_properties")?;
7575            Ok(_response.properties)
7576        }
7577        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamProperties>(
7578            (),
7579            0x586cf4f0f8d2771f,
7580            fidl::encoding::DynamicFlags::FLEXIBLE,
7581            _decode,
7582        )
7583    }
7584
7585    type AllocateVmosResponseFut = fidl::client::QueryResponseFut<
7586        PacketStreamControlAllocateVmosResult,
7587        fidl::encoding::DefaultFuchsiaResourceDialect,
7588    >;
7589    fn r#allocate_vmos(&self, mut payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut {
7590        fn _decode(
7591            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7592        ) -> Result<PacketStreamControlAllocateVmosResult, fidl::Error> {
7593            let _response = fidl::client::decode_transaction_body::<
7594                fidl::encoding::FlexibleResultType<PacketStreamControlAllocateVmosResponse, i32>,
7595                fidl::encoding::DefaultFuchsiaResourceDialect,
7596                0x7ff1473165ed344b,
7597            >(_buf?)?
7598            .into_result::<PacketStreamControlMarker>("allocate_vmos")?;
7599            Ok(_response.map(|x| x.vmos))
7600        }
7601        self.client
7602            .send_query_and_decode::<AllocateVmosConfig, PacketStreamControlAllocateVmosResult>(
7603                payload,
7604                0x7ff1473165ed344b,
7605                fidl::encoding::DynamicFlags::FLEXIBLE,
7606                _decode,
7607            )
7608    }
7609
7610    type DeallocateVmosResponseFut = fidl::client::QueryResponseFut<
7611        PacketStreamControlDeallocateVmosResult,
7612        fidl::encoding::DefaultFuchsiaResourceDialect,
7613    >;
7614    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut {
7615        fn _decode(
7616            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7617        ) -> Result<PacketStreamControlDeallocateVmosResult, fidl::Error> {
7618            let _response = fidl::client::decode_transaction_body::<
7619                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7620                fidl::encoding::DefaultFuchsiaResourceDialect,
7621                0x4db5cc85a7b8405b,
7622            >(_buf?)?
7623            .into_result::<PacketStreamControlMarker>("deallocate_vmos")?;
7624            Ok(_response.map(|x| x))
7625        }
7626        self.client.send_query_and_decode::<
7627            fidl::encoding::EmptyPayload,
7628            PacketStreamControlDeallocateVmosResult,
7629        >(
7630            (),
7631            0x4db5cc85a7b8405b,
7632            fidl::encoding::DynamicFlags::FLEXIBLE,
7633            _decode,
7634        )
7635    }
7636
7637    type RegisterVmosResponseFut = fidl::client::QueryResponseFut<
7638        PacketStreamControlRegisterVmosResult,
7639        fidl::encoding::DefaultFuchsiaResourceDialect,
7640    >;
7641    fn r#register_vmos(&self, mut payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut {
7642        fn _decode(
7643            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7644        ) -> Result<PacketStreamControlRegisterVmosResult, fidl::Error> {
7645            let _response = fidl::client::decode_transaction_body::<
7646                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7647                fidl::encoding::DefaultFuchsiaResourceDialect,
7648                0x29c3b656a1020bfd,
7649            >(_buf?)?
7650            .into_result::<PacketStreamControlMarker>("register_vmos")?;
7651            Ok(_response.map(|x| x))
7652        }
7653        self.client
7654            .send_query_and_decode::<RegisterVmosConfig, PacketStreamControlRegisterVmosResult>(
7655                &mut payload,
7656                0x29c3b656a1020bfd,
7657                fidl::encoding::DynamicFlags::FLEXIBLE,
7658                _decode,
7659            )
7660    }
7661
7662    type UnregisterVmosResponseFut = fidl::client::QueryResponseFut<
7663        PacketStreamControlUnregisterVmosResult,
7664        fidl::encoding::DefaultFuchsiaResourceDialect,
7665    >;
7666    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut {
7667        fn _decode(
7668            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7669        ) -> Result<PacketStreamControlUnregisterVmosResult, fidl::Error> {
7670            let _response = fidl::client::decode_transaction_body::<
7671                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7672                fidl::encoding::DefaultFuchsiaResourceDialect,
7673                0x3e3b4dbfe26b6094,
7674            >(_buf?)?
7675            .into_result::<PacketStreamControlMarker>("unregister_vmos")?;
7676            Ok(_response.map(|x| x))
7677        }
7678        self.client.send_query_and_decode::<
7679            fidl::encoding::EmptyPayload,
7680            PacketStreamControlUnregisterVmosResult,
7681        >(
7682            (),
7683            0x3e3b4dbfe26b6094,
7684            fidl::encoding::DynamicFlags::FLEXIBLE,
7685            _decode,
7686        )
7687    }
7688
7689    type GetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
7690        PacketStreamControlGetPacketStreamSinkResult,
7691        fidl::encoding::DefaultFuchsiaResourceDialect,
7692    >;
7693    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut {
7694        fn _decode(
7695            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7696        ) -> Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error> {
7697            let _response = fidl::client::decode_transaction_body::<
7698                fidl::encoding::FlexibleResultType<
7699                    PacketStreamControlGetPacketStreamSinkResponse,
7700                    i32,
7701                >,
7702                fidl::encoding::DefaultFuchsiaResourceDialect,
7703                0x7394726463ebbc6a,
7704            >(_buf?)?
7705            .into_result::<PacketStreamControlMarker>("get_packet_stream_sink")?;
7706            Ok(_response.map(|x| x))
7707        }
7708        self.client.send_query_and_decode::<
7709            fidl::encoding::EmptyPayload,
7710            PacketStreamControlGetPacketStreamSinkResult,
7711        >(
7712            (),
7713            0x7394726463ebbc6a,
7714            fidl::encoding::DynamicFlags::FLEXIBLE,
7715            _decode,
7716        )
7717    }
7718
7719    type SetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
7720        PacketStreamControlSetPacketStreamSinkResult,
7721        fidl::encoding::DefaultFuchsiaResourceDialect,
7722    >;
7723    fn r#set_packet_stream_sink(
7724        &self,
7725        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
7726    ) -> Self::SetPacketStreamSinkResponseFut {
7727        fn _decode(
7728            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7729        ) -> Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error> {
7730            let _response = fidl::client::decode_transaction_body::<
7731                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7732                fidl::encoding::DefaultFuchsiaResourceDialect,
7733                0xab88800e31dc0e4,
7734            >(_buf?)?
7735            .into_result::<PacketStreamControlMarker>("set_packet_stream_sink")?;
7736            Ok(_response.map(|x| x))
7737        }
7738        self.client.send_query_and_decode::<
7739            PacketStreamControlSetPacketStreamSinkRequest,
7740            PacketStreamControlSetPacketStreamSinkResult,
7741        >(
7742            &mut payload,
7743            0xab88800e31dc0e4,
7744            fidl::encoding::DynamicFlags::FLEXIBLE,
7745            _decode,
7746        )
7747    }
7748
7749    type StartResponseFut = fidl::client::QueryResponseFut<
7750        PacketStreamControlStartResult,
7751        fidl::encoding::DefaultFuchsiaResourceDialect,
7752    >;
7753    fn r#start(&self) -> Self::StartResponseFut {
7754        fn _decode(
7755            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7756        ) -> Result<PacketStreamControlStartResult, fidl::Error> {
7757            let _response = fidl::client::decode_transaction_body::<
7758                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7759                fidl::encoding::DefaultFuchsiaResourceDialect,
7760                0x3a584b94d8a6bfd0,
7761            >(_buf?)?
7762            .into_result::<PacketStreamControlMarker>("start")?;
7763            Ok(_response.map(|x| x))
7764        }
7765        self.client
7766            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStartResult>(
7767                (),
7768                0x3a584b94d8a6bfd0,
7769                fidl::encoding::DynamicFlags::FLEXIBLE,
7770                _decode,
7771            )
7772    }
7773
7774    type StopResponseFut = fidl::client::QueryResponseFut<
7775        PacketStreamControlStopResult,
7776        fidl::encoding::DefaultFuchsiaResourceDialect,
7777    >;
7778    fn r#stop(&self) -> Self::StopResponseFut {
7779        fn _decode(
7780            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7781        ) -> Result<PacketStreamControlStopResult, fidl::Error> {
7782            let _response = fidl::client::decode_transaction_body::<
7783                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7784                fidl::encoding::DefaultFuchsiaResourceDialect,
7785                0x703e4fafcdd7ef32,
7786            >(_buf?)?
7787            .into_result::<PacketStreamControlMarker>("stop")?;
7788            Ok(_response.map(|x| x))
7789        }
7790        self.client
7791            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStopResult>(
7792                (),
7793                0x703e4fafcdd7ef32,
7794                fidl::encoding::DynamicFlags::FLEXIBLE,
7795                _decode,
7796            )
7797    }
7798}
7799
7800pub struct PacketStreamControlEventStream {
7801    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7802}
7803
7804impl std::marker::Unpin for PacketStreamControlEventStream {}
7805
7806impl futures::stream::FusedStream for PacketStreamControlEventStream {
7807    fn is_terminated(&self) -> bool {
7808        self.event_receiver.is_terminated()
7809    }
7810}
7811
7812impl futures::Stream for PacketStreamControlEventStream {
7813    type Item = Result<PacketStreamControlEvent, fidl::Error>;
7814
7815    fn poll_next(
7816        mut self: std::pin::Pin<&mut Self>,
7817        cx: &mut std::task::Context<'_>,
7818    ) -> std::task::Poll<Option<Self::Item>> {
7819        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7820            &mut self.event_receiver,
7821            cx
7822        )?) {
7823            Some(buf) => std::task::Poll::Ready(Some(PacketStreamControlEvent::decode(buf))),
7824            None => std::task::Poll::Ready(None),
7825        }
7826    }
7827}
7828
7829#[derive(Debug)]
7830pub enum PacketStreamControlEvent {
7831    #[non_exhaustive]
7832    _UnknownEvent {
7833        /// Ordinal of the event that was sent.
7834        ordinal: u64,
7835    },
7836}
7837
7838impl PacketStreamControlEvent {
7839    /// Decodes a message buffer as a [`PacketStreamControlEvent`].
7840    fn decode(
7841        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7842    ) -> Result<PacketStreamControlEvent, fidl::Error> {
7843        let (bytes, _handles) = buf.split_mut();
7844        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7845        debug_assert_eq!(tx_header.tx_id, 0);
7846        match tx_header.ordinal {
7847            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7848                Ok(PacketStreamControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7849            }
7850            _ => Err(fidl::Error::UnknownOrdinal {
7851                ordinal: tx_header.ordinal,
7852                protocol_name:
7853                    <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7854            }),
7855        }
7856    }
7857}
7858
7859/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamControl.
7860pub struct PacketStreamControlRequestStream {
7861    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7862    is_terminated: bool,
7863}
7864
7865impl std::marker::Unpin for PacketStreamControlRequestStream {}
7866
7867impl futures::stream::FusedStream for PacketStreamControlRequestStream {
7868    fn is_terminated(&self) -> bool {
7869        self.is_terminated
7870    }
7871}
7872
7873impl fidl::endpoints::RequestStream for PacketStreamControlRequestStream {
7874    type Protocol = PacketStreamControlMarker;
7875    type ControlHandle = PacketStreamControlControlHandle;
7876
7877    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7878        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7879    }
7880
7881    fn control_handle(&self) -> Self::ControlHandle {
7882        PacketStreamControlControlHandle { inner: self.inner.clone() }
7883    }
7884
7885    fn into_inner(
7886        self,
7887    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7888    {
7889        (self.inner, self.is_terminated)
7890    }
7891
7892    fn from_inner(
7893        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7894        is_terminated: bool,
7895    ) -> Self {
7896        Self { inner, is_terminated }
7897    }
7898}
7899
7900impl futures::Stream for PacketStreamControlRequestStream {
7901    type Item = Result<PacketStreamControlRequest, fidl::Error>;
7902
7903    fn poll_next(
7904        mut self: std::pin::Pin<&mut Self>,
7905        cx: &mut std::task::Context<'_>,
7906    ) -> std::task::Poll<Option<Self::Item>> {
7907        let this = &mut *self;
7908        if this.inner.check_shutdown(cx) {
7909            this.is_terminated = true;
7910            return std::task::Poll::Ready(None);
7911        }
7912        if this.is_terminated {
7913            panic!("polled PacketStreamControlRequestStream after completion");
7914        }
7915        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7916            |bytes, handles| {
7917                match this.inner.channel().read_etc(cx, bytes, handles) {
7918                    std::task::Poll::Ready(Ok(())) => {}
7919                    std::task::Poll::Pending => return std::task::Poll::Pending,
7920                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7921                        this.is_terminated = true;
7922                        return std::task::Poll::Ready(None);
7923                    }
7924                    std::task::Poll::Ready(Err(e)) => {
7925                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7926                            e.into(),
7927                        ))));
7928                    }
7929                }
7930
7931                // A message has been received from the channel
7932                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7933
7934                std::task::Poll::Ready(Some(match header.ordinal {
7935                0x586cf4f0f8d2771f => {
7936                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7937                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7938                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7939                    let control_handle = PacketStreamControlControlHandle {
7940                        inner: this.inner.clone(),
7941                    };
7942                    Ok(PacketStreamControlRequest::GetProperties {
7943                        responder: PacketStreamControlGetPropertiesResponder {
7944                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7945                            tx_id: header.tx_id,
7946                        },
7947                    })
7948                }
7949                0x7ff1473165ed344b => {
7950                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7951                    let mut req = fidl::new_empty!(AllocateVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect);
7952                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AllocateVmosConfig>(&header, _body_bytes, handles, &mut req)?;
7953                    let control_handle = PacketStreamControlControlHandle {
7954                        inner: this.inner.clone(),
7955                    };
7956                    Ok(PacketStreamControlRequest::AllocateVmos {payload: req,
7957                        responder: PacketStreamControlAllocateVmosResponder {
7958                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7959                            tx_id: header.tx_id,
7960                        },
7961                    })
7962                }
7963                0x4db5cc85a7b8405b => {
7964                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7965                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7966                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7967                    let control_handle = PacketStreamControlControlHandle {
7968                        inner: this.inner.clone(),
7969                    };
7970                    Ok(PacketStreamControlRequest::DeallocateVmos {
7971                        responder: PacketStreamControlDeallocateVmosResponder {
7972                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7973                            tx_id: header.tx_id,
7974                        },
7975                    })
7976                }
7977                0x29c3b656a1020bfd => {
7978                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7979                    let mut req = fidl::new_empty!(RegisterVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect);
7980                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegisterVmosConfig>(&header, _body_bytes, handles, &mut req)?;
7981                    let control_handle = PacketStreamControlControlHandle {
7982                        inner: this.inner.clone(),
7983                    };
7984                    Ok(PacketStreamControlRequest::RegisterVmos {payload: req,
7985                        responder: PacketStreamControlRegisterVmosResponder {
7986                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7987                            tx_id: header.tx_id,
7988                        },
7989                    })
7990                }
7991                0x3e3b4dbfe26b6094 => {
7992                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7993                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7994                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7995                    let control_handle = PacketStreamControlControlHandle {
7996                        inner: this.inner.clone(),
7997                    };
7998                    Ok(PacketStreamControlRequest::UnregisterVmos {
7999                        responder: PacketStreamControlUnregisterVmosResponder {
8000                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8001                            tx_id: header.tx_id,
8002                        },
8003                    })
8004                }
8005                0x7394726463ebbc6a => {
8006                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8007                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8008                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8009                    let control_handle = PacketStreamControlControlHandle {
8010                        inner: this.inner.clone(),
8011                    };
8012                    Ok(PacketStreamControlRequest::GetPacketStreamSink {
8013                        responder: PacketStreamControlGetPacketStreamSinkResponder {
8014                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8015                            tx_id: header.tx_id,
8016                        },
8017                    })
8018                }
8019                0xab88800e31dc0e4 => {
8020                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8021                    let mut req = fidl::new_empty!(PacketStreamControlSetPacketStreamSinkRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8022                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PacketStreamControlSetPacketStreamSinkRequest>(&header, _body_bytes, handles, &mut req)?;
8023                    let control_handle = PacketStreamControlControlHandle {
8024                        inner: this.inner.clone(),
8025                    };
8026                    Ok(PacketStreamControlRequest::SetPacketStreamSink {payload: req,
8027                        responder: PacketStreamControlSetPacketStreamSinkResponder {
8028                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8029                            tx_id: header.tx_id,
8030                        },
8031                    })
8032                }
8033                0x3a584b94d8a6bfd0 => {
8034                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8035                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8036                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8037                    let control_handle = PacketStreamControlControlHandle {
8038                        inner: this.inner.clone(),
8039                    };
8040                    Ok(PacketStreamControlRequest::Start {
8041                        responder: PacketStreamControlStartResponder {
8042                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8043                            tx_id: header.tx_id,
8044                        },
8045                    })
8046                }
8047                0x703e4fafcdd7ef32 => {
8048                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8049                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8050                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8051                    let control_handle = PacketStreamControlControlHandle {
8052                        inner: this.inner.clone(),
8053                    };
8054                    Ok(PacketStreamControlRequest::Stop {
8055                        responder: PacketStreamControlStopResponder {
8056                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8057                            tx_id: header.tx_id,
8058                        },
8059                    })
8060                }
8061                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8062                    Ok(PacketStreamControlRequest::_UnknownMethod {
8063                        ordinal: header.ordinal,
8064                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
8065                        method_type: fidl::MethodType::OneWay,
8066                    })
8067                }
8068                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8069                    this.inner.send_framework_err(
8070                        fidl::encoding::FrameworkErr::UnknownMethod,
8071                        header.tx_id,
8072                        header.ordinal,
8073                        header.dynamic_flags(),
8074                        (bytes, handles),
8075                    )?;
8076                    Ok(PacketStreamControlRequest::_UnknownMethod {
8077                        ordinal: header.ordinal,
8078                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
8079                        method_type: fidl::MethodType::TwoWay,
8080                    })
8081                }
8082                _ => Err(fidl::Error::UnknownOrdinal {
8083                    ordinal: header.ordinal,
8084                    protocol_name: <PacketStreamControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8085                }),
8086            }))
8087            },
8088        )
8089    }
8090}
8091
8092/// Control protocol for establishing and managing the packet stream.
8093#[derive(Debug)]
8094pub enum PacketStreamControlRequest {
8095    /// Accessor for top level static properties.
8096    GetProperties { responder: PacketStreamControlGetPropertiesResponder },
8097    /// Request the driver to allocate VMOs for data transfer.
8098    /// Returns the allocated VMOs and their assigned IDs.
8099    ///
8100    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8101    /// If the packet stream is an output stream, then the handle must also include
8102    /// ZX_RIGHT_WRITE.
8103    ///
8104    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
8105    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
8106    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
8107    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
8108    /// reconfigure.
8109    AllocateVmos {
8110        payload: AllocateVmosConfig,
8111        responder: PacketStreamControlAllocateVmosResponder,
8112    },
8113    /// Releases all VMOs previously allocated via `AllocateVmos`.
8114    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
8115    ///
8116    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
8117    /// not stopped.
8118    DeallocateVmos { responder: PacketStreamControlDeallocateVmosResponder },
8119    /// Registers client-allocated VMOs with the driver.
8120    ///
8121    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8122    /// If the packet stream is an input stream, then the handle must also include
8123    /// ZX_RIGHT_WRITE.
8124    ///
8125    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
8126    /// or if duplicate `vmo_id`s are found.
8127    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
8128    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
8129    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
8130    /// reconfigure.
8131    RegisterVmos {
8132        payload: RegisterVmosConfig,
8133        responder: PacketStreamControlRegisterVmosResponder,
8134    },
8135    /// Unregisters all VMOs previously registered via `RegisterVmos`.
8136    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
8137    ///
8138    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
8139    /// not stopped.
8140    UnregisterVmos { responder: PacketStreamControlUnregisterVmosResponder },
8141    /// Connects to the data sink implemented by the driver.
8142    /// This is used for audio **Output** where the driver consumes data.
8143    ///
8144    /// Flow:
8145    /// 1. App writes audio data to a registered VMO.
8146    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
8147    ///    true).
8148    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
8149    /// 4. Driver consumes the data.
8150    ///
8151    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
8152    /// and any pending requests on that channel are discarded. The new channel replaces the old
8153    /// one.
8154    ///
8155    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
8156    /// not support this method.
8157    GetPacketStreamSink { responder: PacketStreamControlGetPacketStreamSinkResponder },
8158    /// Provides a data sink to the driver.
8159    /// This is used for audio **Input** where the driver produces data.
8160    ///
8161    /// Flow:
8162    /// 1. Driver writes audio data to a registered VMO.
8163    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
8164    /// 3. App receives `PutPacket`.
8165    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
8166    ///    true).
8167    /// 5. App reads the data.
8168    ///
8169    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
8170    /// channel. The new channel replaces the old one.
8171    ///
8172    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
8173    /// not support this method.
8174    SetPacketStreamSink {
8175        payload: PacketStreamControlSetPacketStreamSinkRequest,
8176        responder: PacketStreamControlSetPacketStreamSinkResponder,
8177    },
8178    /// Start the packet-stream.
8179    ///
8180    /// Returns `ZX_ERR_BAD_STATE` if:
8181    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
8182    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
8183    ///   `INLINE` is supported.
8184    /// * The stream is already started.
8185    Start { responder: PacketStreamControlStartResponder },
8186    /// Stop the packet-stream.
8187    ///
8188    /// Once the response is received, the stream is halted.
8189    ///
8190    /// Behavior depends on the stream direction:
8191    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
8192    ///   requests will remain pending until `Start` is called again. Clients may call
8193    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
8194    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
8195    ///   calls will be made by the driver until `Start` is called again.
8196    ///
8197    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
8198    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
8199    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
8200    ///   complete successfully after `Stop` has returned.
8201    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
8202    ///   arrive at the client after `Stop` has returned.
8203    ///
8204    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
8205    Stop { responder: PacketStreamControlStopResponder },
8206    /// An interaction was received which does not match any known method.
8207    #[non_exhaustive]
8208    _UnknownMethod {
8209        /// Ordinal of the method that was called.
8210        ordinal: u64,
8211        control_handle: PacketStreamControlControlHandle,
8212        method_type: fidl::MethodType,
8213    },
8214}
8215
8216impl PacketStreamControlRequest {
8217    #[allow(irrefutable_let_patterns)]
8218    pub fn into_get_properties(self) -> Option<(PacketStreamControlGetPropertiesResponder)> {
8219        if let PacketStreamControlRequest::GetProperties { responder } = self {
8220            Some((responder))
8221        } else {
8222            None
8223        }
8224    }
8225
8226    #[allow(irrefutable_let_patterns)]
8227    pub fn into_allocate_vmos(
8228        self,
8229    ) -> Option<(AllocateVmosConfig, PacketStreamControlAllocateVmosResponder)> {
8230        if let PacketStreamControlRequest::AllocateVmos { payload, responder } = self {
8231            Some((payload, responder))
8232        } else {
8233            None
8234        }
8235    }
8236
8237    #[allow(irrefutable_let_patterns)]
8238    pub fn into_deallocate_vmos(self) -> Option<(PacketStreamControlDeallocateVmosResponder)> {
8239        if let PacketStreamControlRequest::DeallocateVmos { responder } = self {
8240            Some((responder))
8241        } else {
8242            None
8243        }
8244    }
8245
8246    #[allow(irrefutable_let_patterns)]
8247    pub fn into_register_vmos(
8248        self,
8249    ) -> Option<(RegisterVmosConfig, PacketStreamControlRegisterVmosResponder)> {
8250        if let PacketStreamControlRequest::RegisterVmos { payload, responder } = self {
8251            Some((payload, responder))
8252        } else {
8253            None
8254        }
8255    }
8256
8257    #[allow(irrefutable_let_patterns)]
8258    pub fn into_unregister_vmos(self) -> Option<(PacketStreamControlUnregisterVmosResponder)> {
8259        if let PacketStreamControlRequest::UnregisterVmos { responder } = self {
8260            Some((responder))
8261        } else {
8262            None
8263        }
8264    }
8265
8266    #[allow(irrefutable_let_patterns)]
8267    pub fn into_get_packet_stream_sink(
8268        self,
8269    ) -> Option<(PacketStreamControlGetPacketStreamSinkResponder)> {
8270        if let PacketStreamControlRequest::GetPacketStreamSink { responder } = self {
8271            Some((responder))
8272        } else {
8273            None
8274        }
8275    }
8276
8277    #[allow(irrefutable_let_patterns)]
8278    pub fn into_set_packet_stream_sink(
8279        self,
8280    ) -> Option<(
8281        PacketStreamControlSetPacketStreamSinkRequest,
8282        PacketStreamControlSetPacketStreamSinkResponder,
8283    )> {
8284        if let PacketStreamControlRequest::SetPacketStreamSink { payload, responder } = self {
8285            Some((payload, responder))
8286        } else {
8287            None
8288        }
8289    }
8290
8291    #[allow(irrefutable_let_patterns)]
8292    pub fn into_start(self) -> Option<(PacketStreamControlStartResponder)> {
8293        if let PacketStreamControlRequest::Start { responder } = self {
8294            Some((responder))
8295        } else {
8296            None
8297        }
8298    }
8299
8300    #[allow(irrefutable_let_patterns)]
8301    pub fn into_stop(self) -> Option<(PacketStreamControlStopResponder)> {
8302        if let PacketStreamControlRequest::Stop { responder } = self {
8303            Some((responder))
8304        } else {
8305            None
8306        }
8307    }
8308
8309    /// Name of the method defined in FIDL
8310    pub fn method_name(&self) -> &'static str {
8311        match *self {
8312            PacketStreamControlRequest::GetProperties { .. } => "get_properties",
8313            PacketStreamControlRequest::AllocateVmos { .. } => "allocate_vmos",
8314            PacketStreamControlRequest::DeallocateVmos { .. } => "deallocate_vmos",
8315            PacketStreamControlRequest::RegisterVmos { .. } => "register_vmos",
8316            PacketStreamControlRequest::UnregisterVmos { .. } => "unregister_vmos",
8317            PacketStreamControlRequest::GetPacketStreamSink { .. } => "get_packet_stream_sink",
8318            PacketStreamControlRequest::SetPacketStreamSink { .. } => "set_packet_stream_sink",
8319            PacketStreamControlRequest::Start { .. } => "start",
8320            PacketStreamControlRequest::Stop { .. } => "stop",
8321            PacketStreamControlRequest::_UnknownMethod {
8322                method_type: fidl::MethodType::OneWay,
8323                ..
8324            } => "unknown one-way method",
8325            PacketStreamControlRequest::_UnknownMethod {
8326                method_type: fidl::MethodType::TwoWay,
8327                ..
8328            } => "unknown two-way method",
8329        }
8330    }
8331}
8332
8333#[derive(Debug, Clone)]
8334pub struct PacketStreamControlControlHandle {
8335    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8336}
8337
8338impl PacketStreamControlControlHandle {
8339    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8340        self.inner.shutdown_with_epitaph(status.into())
8341    }
8342}
8343
8344impl fidl::endpoints::ControlHandle for PacketStreamControlControlHandle {
8345    fn shutdown(&self) {
8346        self.inner.shutdown()
8347    }
8348
8349    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8350        self.inner.shutdown_with_epitaph(status)
8351    }
8352
8353    fn is_closed(&self) -> bool {
8354        self.inner.channel().is_closed()
8355    }
8356    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8357        self.inner.channel().on_closed()
8358    }
8359
8360    #[cfg(target_os = "fuchsia")]
8361    fn signal_peer(
8362        &self,
8363        clear_mask: zx::Signals,
8364        set_mask: zx::Signals,
8365    ) -> Result<(), zx_status::Status> {
8366        use fidl::Peered;
8367        self.inner.channel().signal_peer(clear_mask, set_mask)
8368    }
8369}
8370
8371impl PacketStreamControlControlHandle {}
8372
8373#[must_use = "FIDL methods require a response to be sent"]
8374#[derive(Debug)]
8375pub struct PacketStreamControlGetPropertiesResponder {
8376    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8377    tx_id: u32,
8378}
8379
8380/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8381/// if the responder is dropped without sending a response, so that the client
8382/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8383impl std::ops::Drop for PacketStreamControlGetPropertiesResponder {
8384    fn drop(&mut self) {
8385        self.control_handle.shutdown();
8386        // Safety: drops once, never accessed again
8387        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8388    }
8389}
8390
8391impl fidl::endpoints::Responder for PacketStreamControlGetPropertiesResponder {
8392    type ControlHandle = PacketStreamControlControlHandle;
8393
8394    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8395        &self.control_handle
8396    }
8397
8398    fn drop_without_shutdown(mut self) {
8399        // Safety: drops once, never accessed again due to mem::forget
8400        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8401        // Prevent Drop from running (which would shut down the channel)
8402        std::mem::forget(self);
8403    }
8404}
8405
8406impl PacketStreamControlGetPropertiesResponder {
8407    /// Sends a response to the FIDL transaction.
8408    ///
8409    /// Sets the channel to shutdown if an error occurs.
8410    pub fn send(self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
8411        let _result = self.send_raw(properties);
8412        if _result.is_err() {
8413            self.control_handle.shutdown();
8414        }
8415        self.drop_without_shutdown();
8416        _result
8417    }
8418
8419    /// Similar to "send" but does not shutdown the channel if an error occurs.
8420    pub fn send_no_shutdown_on_err(
8421        self,
8422        mut properties: &PacketStreamProperties,
8423    ) -> Result<(), fidl::Error> {
8424        let _result = self.send_raw(properties);
8425        self.drop_without_shutdown();
8426        _result
8427    }
8428
8429    fn send_raw(&self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
8430        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
8431            PacketStreamControlGetPropertiesResponse,
8432        >>(
8433            fidl::encoding::Flexible::new((properties,)),
8434            self.tx_id,
8435            0x586cf4f0f8d2771f,
8436            fidl::encoding::DynamicFlags::FLEXIBLE,
8437        )
8438    }
8439}
8440
8441#[must_use = "FIDL methods require a response to be sent"]
8442#[derive(Debug)]
8443pub struct PacketStreamControlAllocateVmosResponder {
8444    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8445    tx_id: u32,
8446}
8447
8448/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8449/// if the responder is dropped without sending a response, so that the client
8450/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8451impl std::ops::Drop for PacketStreamControlAllocateVmosResponder {
8452    fn drop(&mut self) {
8453        self.control_handle.shutdown();
8454        // Safety: drops once, never accessed again
8455        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8456    }
8457}
8458
8459impl fidl::endpoints::Responder for PacketStreamControlAllocateVmosResponder {
8460    type ControlHandle = PacketStreamControlControlHandle;
8461
8462    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8463        &self.control_handle
8464    }
8465
8466    fn drop_without_shutdown(mut self) {
8467        // Safety: drops once, never accessed again due to mem::forget
8468        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8469        // Prevent Drop from running (which would shut down the channel)
8470        std::mem::forget(self);
8471    }
8472}
8473
8474impl PacketStreamControlAllocateVmosResponder {
8475    /// Sends a response to the FIDL transaction.
8476    ///
8477    /// Sets the channel to shutdown if an error occurs.
8478    pub fn send(self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
8479        let _result = self.send_raw(result);
8480        if _result.is_err() {
8481            self.control_handle.shutdown();
8482        }
8483        self.drop_without_shutdown();
8484        _result
8485    }
8486
8487    /// Similar to "send" but does not shutdown the channel if an error occurs.
8488    pub fn send_no_shutdown_on_err(
8489        self,
8490        mut result: Result<Vec<VmoInfo>, i32>,
8491    ) -> Result<(), fidl::Error> {
8492        let _result = self.send_raw(result);
8493        self.drop_without_shutdown();
8494        _result
8495    }
8496
8497    fn send_raw(&self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
8498        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8499            PacketStreamControlAllocateVmosResponse,
8500            i32,
8501        >>(
8502            fidl::encoding::FlexibleResult::new(
8503                result.as_mut().map_err(|e| *e).map(|vmos| (vmos.as_mut_slice(),)),
8504            ),
8505            self.tx_id,
8506            0x7ff1473165ed344b,
8507            fidl::encoding::DynamicFlags::FLEXIBLE,
8508        )
8509    }
8510}
8511
8512#[must_use = "FIDL methods require a response to be sent"]
8513#[derive(Debug)]
8514pub struct PacketStreamControlDeallocateVmosResponder {
8515    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8516    tx_id: u32,
8517}
8518
8519/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8520/// if the responder is dropped without sending a response, so that the client
8521/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8522impl std::ops::Drop for PacketStreamControlDeallocateVmosResponder {
8523    fn drop(&mut self) {
8524        self.control_handle.shutdown();
8525        // Safety: drops once, never accessed again
8526        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8527    }
8528}
8529
8530impl fidl::endpoints::Responder for PacketStreamControlDeallocateVmosResponder {
8531    type ControlHandle = PacketStreamControlControlHandle;
8532
8533    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8534        &self.control_handle
8535    }
8536
8537    fn drop_without_shutdown(mut self) {
8538        // Safety: drops once, never accessed again due to mem::forget
8539        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8540        // Prevent Drop from running (which would shut down the channel)
8541        std::mem::forget(self);
8542    }
8543}
8544
8545impl PacketStreamControlDeallocateVmosResponder {
8546    /// Sends a response to the FIDL transaction.
8547    ///
8548    /// Sets the channel to shutdown if an error occurs.
8549    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8550        let _result = self.send_raw(result);
8551        if _result.is_err() {
8552            self.control_handle.shutdown();
8553        }
8554        self.drop_without_shutdown();
8555        _result
8556    }
8557
8558    /// Similar to "send" but does not shutdown the channel if an error occurs.
8559    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8560        let _result = self.send_raw(result);
8561        self.drop_without_shutdown();
8562        _result
8563    }
8564
8565    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8566        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8567            fidl::encoding::EmptyStruct,
8568            i32,
8569        >>(
8570            fidl::encoding::FlexibleResult::new(result),
8571            self.tx_id,
8572            0x4db5cc85a7b8405b,
8573            fidl::encoding::DynamicFlags::FLEXIBLE,
8574        )
8575    }
8576}
8577
8578#[must_use = "FIDL methods require a response to be sent"]
8579#[derive(Debug)]
8580pub struct PacketStreamControlRegisterVmosResponder {
8581    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8582    tx_id: u32,
8583}
8584
8585/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8586/// if the responder is dropped without sending a response, so that the client
8587/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8588impl std::ops::Drop for PacketStreamControlRegisterVmosResponder {
8589    fn drop(&mut self) {
8590        self.control_handle.shutdown();
8591        // Safety: drops once, never accessed again
8592        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8593    }
8594}
8595
8596impl fidl::endpoints::Responder for PacketStreamControlRegisterVmosResponder {
8597    type ControlHandle = PacketStreamControlControlHandle;
8598
8599    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8600        &self.control_handle
8601    }
8602
8603    fn drop_without_shutdown(mut self) {
8604        // Safety: drops once, never accessed again due to mem::forget
8605        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8606        // Prevent Drop from running (which would shut down the channel)
8607        std::mem::forget(self);
8608    }
8609}
8610
8611impl PacketStreamControlRegisterVmosResponder {
8612    /// Sends a response to the FIDL transaction.
8613    ///
8614    /// Sets the channel to shutdown if an error occurs.
8615    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8616        let _result = self.send_raw(result);
8617        if _result.is_err() {
8618            self.control_handle.shutdown();
8619        }
8620        self.drop_without_shutdown();
8621        _result
8622    }
8623
8624    /// Similar to "send" but does not shutdown the channel if an error occurs.
8625    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8626        let _result = self.send_raw(result);
8627        self.drop_without_shutdown();
8628        _result
8629    }
8630
8631    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8632        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8633            fidl::encoding::EmptyStruct,
8634            i32,
8635        >>(
8636            fidl::encoding::FlexibleResult::new(result),
8637            self.tx_id,
8638            0x29c3b656a1020bfd,
8639            fidl::encoding::DynamicFlags::FLEXIBLE,
8640        )
8641    }
8642}
8643
8644#[must_use = "FIDL methods require a response to be sent"]
8645#[derive(Debug)]
8646pub struct PacketStreamControlUnregisterVmosResponder {
8647    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8648    tx_id: u32,
8649}
8650
8651/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8652/// if the responder is dropped without sending a response, so that the client
8653/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8654impl std::ops::Drop for PacketStreamControlUnregisterVmosResponder {
8655    fn drop(&mut self) {
8656        self.control_handle.shutdown();
8657        // Safety: drops once, never accessed again
8658        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8659    }
8660}
8661
8662impl fidl::endpoints::Responder for PacketStreamControlUnregisterVmosResponder {
8663    type ControlHandle = PacketStreamControlControlHandle;
8664
8665    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8666        &self.control_handle
8667    }
8668
8669    fn drop_without_shutdown(mut self) {
8670        // Safety: drops once, never accessed again due to mem::forget
8671        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8672        // Prevent Drop from running (which would shut down the channel)
8673        std::mem::forget(self);
8674    }
8675}
8676
8677impl PacketStreamControlUnregisterVmosResponder {
8678    /// Sends a response to the FIDL transaction.
8679    ///
8680    /// Sets the channel to shutdown if an error occurs.
8681    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8682        let _result = self.send_raw(result);
8683        if _result.is_err() {
8684            self.control_handle.shutdown();
8685        }
8686        self.drop_without_shutdown();
8687        _result
8688    }
8689
8690    /// Similar to "send" but does not shutdown the channel if an error occurs.
8691    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8692        let _result = self.send_raw(result);
8693        self.drop_without_shutdown();
8694        _result
8695    }
8696
8697    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8698        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8699            fidl::encoding::EmptyStruct,
8700            i32,
8701        >>(
8702            fidl::encoding::FlexibleResult::new(result),
8703            self.tx_id,
8704            0x3e3b4dbfe26b6094,
8705            fidl::encoding::DynamicFlags::FLEXIBLE,
8706        )
8707    }
8708}
8709
8710#[must_use = "FIDL methods require a response to be sent"]
8711#[derive(Debug)]
8712pub struct PacketStreamControlGetPacketStreamSinkResponder {
8713    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8714    tx_id: u32,
8715}
8716
8717/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8718/// if the responder is dropped without sending a response, so that the client
8719/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8720impl std::ops::Drop for PacketStreamControlGetPacketStreamSinkResponder {
8721    fn drop(&mut self) {
8722        self.control_handle.shutdown();
8723        // Safety: drops once, never accessed again
8724        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8725    }
8726}
8727
8728impl fidl::endpoints::Responder for PacketStreamControlGetPacketStreamSinkResponder {
8729    type ControlHandle = PacketStreamControlControlHandle;
8730
8731    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8732        &self.control_handle
8733    }
8734
8735    fn drop_without_shutdown(mut self) {
8736        // Safety: drops once, never accessed again due to mem::forget
8737        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8738        // Prevent Drop from running (which would shut down the channel)
8739        std::mem::forget(self);
8740    }
8741}
8742
8743impl PacketStreamControlGetPacketStreamSinkResponder {
8744    /// Sends a response to the FIDL transaction.
8745    ///
8746    /// Sets the channel to shutdown if an error occurs.
8747    pub fn send(
8748        self,
8749        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8750    ) -> Result<(), fidl::Error> {
8751        let _result = self.send_raw(result);
8752        if _result.is_err() {
8753            self.control_handle.shutdown();
8754        }
8755        self.drop_without_shutdown();
8756        _result
8757    }
8758
8759    /// Similar to "send" but does not shutdown the channel if an error occurs.
8760    pub fn send_no_shutdown_on_err(
8761        self,
8762        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8763    ) -> Result<(), fidl::Error> {
8764        let _result = self.send_raw(result);
8765        self.drop_without_shutdown();
8766        _result
8767    }
8768
8769    fn send_raw(
8770        &self,
8771        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
8772    ) -> Result<(), fidl::Error> {
8773        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8774            PacketStreamControlGetPacketStreamSinkResponse,
8775            i32,
8776        >>(
8777            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
8778            self.tx_id,
8779            0x7394726463ebbc6a,
8780            fidl::encoding::DynamicFlags::FLEXIBLE,
8781        )
8782    }
8783}
8784
8785#[must_use = "FIDL methods require a response to be sent"]
8786#[derive(Debug)]
8787pub struct PacketStreamControlSetPacketStreamSinkResponder {
8788    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8789    tx_id: u32,
8790}
8791
8792/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8793/// if the responder is dropped without sending a response, so that the client
8794/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8795impl std::ops::Drop for PacketStreamControlSetPacketStreamSinkResponder {
8796    fn drop(&mut self) {
8797        self.control_handle.shutdown();
8798        // Safety: drops once, never accessed again
8799        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8800    }
8801}
8802
8803impl fidl::endpoints::Responder for PacketStreamControlSetPacketStreamSinkResponder {
8804    type ControlHandle = PacketStreamControlControlHandle;
8805
8806    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8807        &self.control_handle
8808    }
8809
8810    fn drop_without_shutdown(mut self) {
8811        // Safety: drops once, never accessed again due to mem::forget
8812        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8813        // Prevent Drop from running (which would shut down the channel)
8814        std::mem::forget(self);
8815    }
8816}
8817
8818impl PacketStreamControlSetPacketStreamSinkResponder {
8819    /// Sends a response to the FIDL transaction.
8820    ///
8821    /// Sets the channel to shutdown if an error occurs.
8822    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8823        let _result = self.send_raw(result);
8824        if _result.is_err() {
8825            self.control_handle.shutdown();
8826        }
8827        self.drop_without_shutdown();
8828        _result
8829    }
8830
8831    /// Similar to "send" but does not shutdown the channel if an error occurs.
8832    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8833        let _result = self.send_raw(result);
8834        self.drop_without_shutdown();
8835        _result
8836    }
8837
8838    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8839        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8840            fidl::encoding::EmptyStruct,
8841            i32,
8842        >>(
8843            fidl::encoding::FlexibleResult::new(result),
8844            self.tx_id,
8845            0xab88800e31dc0e4,
8846            fidl::encoding::DynamicFlags::FLEXIBLE,
8847        )
8848    }
8849}
8850
8851#[must_use = "FIDL methods require a response to be sent"]
8852#[derive(Debug)]
8853pub struct PacketStreamControlStartResponder {
8854    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8855    tx_id: u32,
8856}
8857
8858/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8859/// if the responder is dropped without sending a response, so that the client
8860/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8861impl std::ops::Drop for PacketStreamControlStartResponder {
8862    fn drop(&mut self) {
8863        self.control_handle.shutdown();
8864        // Safety: drops once, never accessed again
8865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8866    }
8867}
8868
8869impl fidl::endpoints::Responder for PacketStreamControlStartResponder {
8870    type ControlHandle = PacketStreamControlControlHandle;
8871
8872    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8873        &self.control_handle
8874    }
8875
8876    fn drop_without_shutdown(mut self) {
8877        // Safety: drops once, never accessed again due to mem::forget
8878        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8879        // Prevent Drop from running (which would shut down the channel)
8880        std::mem::forget(self);
8881    }
8882}
8883
8884impl PacketStreamControlStartResponder {
8885    /// Sends a response to the FIDL transaction.
8886    ///
8887    /// Sets the channel to shutdown if an error occurs.
8888    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8889        let _result = self.send_raw(result);
8890        if _result.is_err() {
8891            self.control_handle.shutdown();
8892        }
8893        self.drop_without_shutdown();
8894        _result
8895    }
8896
8897    /// Similar to "send" but does not shutdown the channel if an error occurs.
8898    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8899        let _result = self.send_raw(result);
8900        self.drop_without_shutdown();
8901        _result
8902    }
8903
8904    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8905        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8906            fidl::encoding::EmptyStruct,
8907            i32,
8908        >>(
8909            fidl::encoding::FlexibleResult::new(result),
8910            self.tx_id,
8911            0x3a584b94d8a6bfd0,
8912            fidl::encoding::DynamicFlags::FLEXIBLE,
8913        )
8914    }
8915}
8916
8917#[must_use = "FIDL methods require a response to be sent"]
8918#[derive(Debug)]
8919pub struct PacketStreamControlStopResponder {
8920    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
8921    tx_id: u32,
8922}
8923
8924/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
8925/// if the responder is dropped without sending a response, so that the client
8926/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8927impl std::ops::Drop for PacketStreamControlStopResponder {
8928    fn drop(&mut self) {
8929        self.control_handle.shutdown();
8930        // Safety: drops once, never accessed again
8931        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8932    }
8933}
8934
8935impl fidl::endpoints::Responder for PacketStreamControlStopResponder {
8936    type ControlHandle = PacketStreamControlControlHandle;
8937
8938    fn control_handle(&self) -> &PacketStreamControlControlHandle {
8939        &self.control_handle
8940    }
8941
8942    fn drop_without_shutdown(mut self) {
8943        // Safety: drops once, never accessed again due to mem::forget
8944        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8945        // Prevent Drop from running (which would shut down the channel)
8946        std::mem::forget(self);
8947    }
8948}
8949
8950impl PacketStreamControlStopResponder {
8951    /// Sends a response to the FIDL transaction.
8952    ///
8953    /// Sets the channel to shutdown if an error occurs.
8954    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8955        let _result = self.send_raw(result);
8956        if _result.is_err() {
8957            self.control_handle.shutdown();
8958        }
8959        self.drop_without_shutdown();
8960        _result
8961    }
8962
8963    /// Similar to "send" but does not shutdown the channel if an error occurs.
8964    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8965        let _result = self.send_raw(result);
8966        self.drop_without_shutdown();
8967        _result
8968    }
8969
8970    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8971        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8972            fidl::encoding::EmptyStruct,
8973            i32,
8974        >>(
8975            fidl::encoding::FlexibleResult::new(result),
8976            self.tx_id,
8977            0x703e4fafcdd7ef32,
8978            fidl::encoding::DynamicFlags::FLEXIBLE,
8979        )
8980    }
8981}
8982
8983#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8984pub struct PacketStreamSinkMarker;
8985
8986impl fidl::endpoints::ProtocolMarker for PacketStreamSinkMarker {
8987    type Proxy = PacketStreamSinkProxy;
8988    type RequestStream = PacketStreamSinkRequestStream;
8989    #[cfg(target_os = "fuchsia")]
8990    type SynchronousProxy = PacketStreamSinkSynchronousProxy;
8991
8992    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamSink";
8993}
8994pub type PacketStreamSinkPutPacketResult = Result<PacketStreamSinkPutPacketResponse, i32>;
8995pub type PacketStreamSinkFlushPacketsResult = Result<(), i32>;
8996
8997pub trait PacketStreamSinkProxyInterface: Send + Sync {
8998    type PutPacketResponseFut: std::future::Future<Output = Result<PacketStreamSinkPutPacketResult, fidl::Error>>
8999        + Send;
9000    fn r#put_packet(&self, payload: PacketStreamSinkPutPacketRequest)
9001    -> Self::PutPacketResponseFut;
9002    type FlushPacketsResponseFut: std::future::Future<Output = Result<PacketStreamSinkFlushPacketsResult, fidl::Error>>
9003        + Send;
9004    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut;
9005}
9006#[derive(Debug)]
9007#[cfg(target_os = "fuchsia")]
9008pub struct PacketStreamSinkSynchronousProxy {
9009    client: fidl::client::sync::Client,
9010}
9011
9012#[cfg(target_os = "fuchsia")]
9013impl fidl::endpoints::SynchronousProxy for PacketStreamSinkSynchronousProxy {
9014    type Proxy = PacketStreamSinkProxy;
9015    type Protocol = PacketStreamSinkMarker;
9016
9017    fn from_channel(inner: fidl::Channel) -> Self {
9018        Self::new(inner)
9019    }
9020
9021    fn into_channel(self) -> fidl::Channel {
9022        self.client.into_channel()
9023    }
9024
9025    fn as_channel(&self) -> &fidl::Channel {
9026        self.client.as_channel()
9027    }
9028}
9029
9030#[cfg(target_os = "fuchsia")]
9031impl PacketStreamSinkSynchronousProxy {
9032    pub fn new(channel: fidl::Channel) -> Self {
9033        Self { client: fidl::client::sync::Client::new(channel) }
9034    }
9035
9036    pub fn into_channel(self) -> fidl::Channel {
9037        self.client.into_channel()
9038    }
9039
9040    /// Waits until an event arrives and returns it. It is safe for other
9041    /// threads to make concurrent requests while waiting for an event.
9042    pub fn wait_for_event(
9043        &self,
9044        deadline: zx::MonotonicInstant,
9045    ) -> Result<PacketStreamSinkEvent, fidl::Error> {
9046        PacketStreamSinkEvent::decode(
9047            self.client.wait_for_event::<PacketStreamSinkMarker>(deadline)?,
9048        )
9049    }
9050
9051    /// Submits a packet to be processed by the server.
9052    ///
9053    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
9054    /// Packets are processed in the order they were submitted. This call
9055    /// blocks until the payload is processed. When this call returns, the
9056    /// buffer region is guaranteed to be available for reuse.
9057    ///
9058    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
9059    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
9060    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
9061    /// * The payload is missing.
9062    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
9063    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
9064    ///   `DRIVER_OWNED`.
9065    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
9066    ///
9067    /// Note: The server is not required to detect if a VMO region is currently in use by a
9068    /// previous pending packet. Clients are responsible for managing buffer usage.
9069    pub fn r#put_packet(
9070        &self,
9071        mut payload: PacketStreamSinkPutPacketRequest,
9072        ___deadline: zx::MonotonicInstant,
9073    ) -> Result<PacketStreamSinkPutPacketResult, fidl::Error> {
9074        let _response = self.client.send_query::<
9075            PacketStreamSinkPutPacketRequest,
9076            fidl::encoding::FlexibleResultType<PacketStreamSinkPutPacketResponse, i32>,
9077            PacketStreamSinkMarker,
9078        >(
9079            &mut payload,
9080            0x25a8e35efba81f2b,
9081            fidl::encoding::DynamicFlags::FLEXIBLE,
9082            ___deadline,
9083        )?
9084        .into_result::<PacketStreamSinkMarker>("put_packet")?;
9085        Ok(_response.map(|x| x))
9086    }
9087
9088    /// Flushes all packets currently pending without processing them.
9089    /// This call waits until all pending packets are completed or canceled.
9090    ///
9091    /// Note: A packet may be partially processed (e.g. if it contains multiple
9092    /// audio frames, or if the data does not align with encoded frame boundaries)
9093    /// before it is canceled.
9094    pub fn r#flush_packets(
9095        &self,
9096        ___deadline: zx::MonotonicInstant,
9097    ) -> Result<PacketStreamSinkFlushPacketsResult, fidl::Error> {
9098        let _response = self.client.send_query::<
9099            fidl::encoding::EmptyPayload,
9100            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
9101            PacketStreamSinkMarker,
9102        >(
9103            (),
9104            0x13f16ca37ede8a4,
9105            fidl::encoding::DynamicFlags::FLEXIBLE,
9106            ___deadline,
9107        )?
9108        .into_result::<PacketStreamSinkMarker>("flush_packets")?;
9109        Ok(_response.map(|x| x))
9110    }
9111}
9112
9113#[cfg(target_os = "fuchsia")]
9114impl From<PacketStreamSinkSynchronousProxy> for zx::NullableHandle {
9115    fn from(value: PacketStreamSinkSynchronousProxy) -> Self {
9116        value.into_channel().into()
9117    }
9118}
9119
9120#[cfg(target_os = "fuchsia")]
9121impl From<fidl::Channel> for PacketStreamSinkSynchronousProxy {
9122    fn from(value: fidl::Channel) -> Self {
9123        Self::new(value)
9124    }
9125}
9126
9127#[cfg(target_os = "fuchsia")]
9128impl fidl::endpoints::FromClient for PacketStreamSinkSynchronousProxy {
9129    type Protocol = PacketStreamSinkMarker;
9130
9131    fn from_client(value: fidl::endpoints::ClientEnd<PacketStreamSinkMarker>) -> Self {
9132        Self::new(value.into_channel())
9133    }
9134}
9135
9136#[derive(Debug, Clone)]
9137pub struct PacketStreamSinkProxy {
9138    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9139}
9140
9141impl fidl::endpoints::Proxy for PacketStreamSinkProxy {
9142    type Protocol = PacketStreamSinkMarker;
9143
9144    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9145        Self::new(inner)
9146    }
9147
9148    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9149        self.client.into_channel().map_err(|client| Self { client })
9150    }
9151
9152    fn as_channel(&self) -> &::fidl::AsyncChannel {
9153        self.client.as_channel()
9154    }
9155}
9156
9157impl PacketStreamSinkProxy {
9158    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamSink.
9159    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9160        let protocol_name = <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9161        Self { client: fidl::client::Client::new(channel, protocol_name) }
9162    }
9163
9164    /// Get a Stream of events from the remote end of the protocol.
9165    ///
9166    /// # Panics
9167    ///
9168    /// Panics if the event stream was already taken.
9169    pub fn take_event_stream(&self) -> PacketStreamSinkEventStream {
9170        PacketStreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
9171    }
9172
9173    /// Submits a packet to be processed by the server.
9174    ///
9175    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
9176    /// Packets are processed in the order they were submitted. This call
9177    /// blocks until the payload is processed. When this call returns, the
9178    /// buffer region is guaranteed to be available for reuse.
9179    ///
9180    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
9181    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
9182    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
9183    /// * The payload is missing.
9184    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
9185    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
9186    ///   `DRIVER_OWNED`.
9187    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
9188    ///
9189    /// Note: The server is not required to detect if a VMO region is currently in use by a
9190    /// previous pending packet. Clients are responsible for managing buffer usage.
9191    pub fn r#put_packet(
9192        &self,
9193        mut payload: PacketStreamSinkPutPacketRequest,
9194    ) -> fidl::client::QueryResponseFut<
9195        PacketStreamSinkPutPacketResult,
9196        fidl::encoding::DefaultFuchsiaResourceDialect,
9197    > {
9198        PacketStreamSinkProxyInterface::r#put_packet(self, payload)
9199    }
9200
9201    /// Flushes all packets currently pending without processing them.
9202    /// This call waits until all pending packets are completed or canceled.
9203    ///
9204    /// Note: A packet may be partially processed (e.g. if it contains multiple
9205    /// audio frames, or if the data does not align with encoded frame boundaries)
9206    /// before it is canceled.
9207    pub fn r#flush_packets(
9208        &self,
9209    ) -> fidl::client::QueryResponseFut<
9210        PacketStreamSinkFlushPacketsResult,
9211        fidl::encoding::DefaultFuchsiaResourceDialect,
9212    > {
9213        PacketStreamSinkProxyInterface::r#flush_packets(self)
9214    }
9215}
9216
9217impl PacketStreamSinkProxyInterface for PacketStreamSinkProxy {
9218    type PutPacketResponseFut = fidl::client::QueryResponseFut<
9219        PacketStreamSinkPutPacketResult,
9220        fidl::encoding::DefaultFuchsiaResourceDialect,
9221    >;
9222    fn r#put_packet(
9223        &self,
9224        mut payload: PacketStreamSinkPutPacketRequest,
9225    ) -> Self::PutPacketResponseFut {
9226        fn _decode(
9227            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9228        ) -> Result<PacketStreamSinkPutPacketResult, fidl::Error> {
9229            let _response = fidl::client::decode_transaction_body::<
9230                fidl::encoding::FlexibleResultType<PacketStreamSinkPutPacketResponse, i32>,
9231                fidl::encoding::DefaultFuchsiaResourceDialect,
9232                0x25a8e35efba81f2b,
9233            >(_buf?)?
9234            .into_result::<PacketStreamSinkMarker>("put_packet")?;
9235            Ok(_response.map(|x| x))
9236        }
9237        self.client.send_query_and_decode::<
9238            PacketStreamSinkPutPacketRequest,
9239            PacketStreamSinkPutPacketResult,
9240        >(
9241            &mut payload,
9242            0x25a8e35efba81f2b,
9243            fidl::encoding::DynamicFlags::FLEXIBLE,
9244            _decode,
9245        )
9246    }
9247
9248    type FlushPacketsResponseFut = fidl::client::QueryResponseFut<
9249        PacketStreamSinkFlushPacketsResult,
9250        fidl::encoding::DefaultFuchsiaResourceDialect,
9251    >;
9252    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut {
9253        fn _decode(
9254            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9255        ) -> Result<PacketStreamSinkFlushPacketsResult, fidl::Error> {
9256            let _response = fidl::client::decode_transaction_body::<
9257                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
9258                fidl::encoding::DefaultFuchsiaResourceDialect,
9259                0x13f16ca37ede8a4,
9260            >(_buf?)?
9261            .into_result::<PacketStreamSinkMarker>("flush_packets")?;
9262            Ok(_response.map(|x| x))
9263        }
9264        self.client.send_query_and_decode::<
9265            fidl::encoding::EmptyPayload,
9266            PacketStreamSinkFlushPacketsResult,
9267        >(
9268            (),
9269            0x13f16ca37ede8a4,
9270            fidl::encoding::DynamicFlags::FLEXIBLE,
9271            _decode,
9272        )
9273    }
9274}
9275
9276pub struct PacketStreamSinkEventStream {
9277    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9278}
9279
9280impl std::marker::Unpin for PacketStreamSinkEventStream {}
9281
9282impl futures::stream::FusedStream for PacketStreamSinkEventStream {
9283    fn is_terminated(&self) -> bool {
9284        self.event_receiver.is_terminated()
9285    }
9286}
9287
9288impl futures::Stream for PacketStreamSinkEventStream {
9289    type Item = Result<PacketStreamSinkEvent, fidl::Error>;
9290
9291    fn poll_next(
9292        mut self: std::pin::Pin<&mut Self>,
9293        cx: &mut std::task::Context<'_>,
9294    ) -> std::task::Poll<Option<Self::Item>> {
9295        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9296            &mut self.event_receiver,
9297            cx
9298        )?) {
9299            Some(buf) => std::task::Poll::Ready(Some(PacketStreamSinkEvent::decode(buf))),
9300            None => std::task::Poll::Ready(None),
9301        }
9302    }
9303}
9304
9305#[derive(Debug)]
9306pub enum PacketStreamSinkEvent {
9307    #[non_exhaustive]
9308    _UnknownEvent {
9309        /// Ordinal of the event that was sent.
9310        ordinal: u64,
9311    },
9312}
9313
9314impl PacketStreamSinkEvent {
9315    /// Decodes a message buffer as a [`PacketStreamSinkEvent`].
9316    fn decode(
9317        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9318    ) -> Result<PacketStreamSinkEvent, fidl::Error> {
9319        let (bytes, _handles) = buf.split_mut();
9320        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9321        debug_assert_eq!(tx_header.tx_id, 0);
9322        match tx_header.ordinal {
9323            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
9324                Ok(PacketStreamSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
9325            }
9326            _ => Err(fidl::Error::UnknownOrdinal {
9327                ordinal: tx_header.ordinal,
9328                protocol_name:
9329                    <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9330            }),
9331        }
9332    }
9333}
9334
9335/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamSink.
9336pub struct PacketStreamSinkRequestStream {
9337    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9338    is_terminated: bool,
9339}
9340
9341impl std::marker::Unpin for PacketStreamSinkRequestStream {}
9342
9343impl futures::stream::FusedStream for PacketStreamSinkRequestStream {
9344    fn is_terminated(&self) -> bool {
9345        self.is_terminated
9346    }
9347}
9348
9349impl fidl::endpoints::RequestStream for PacketStreamSinkRequestStream {
9350    type Protocol = PacketStreamSinkMarker;
9351    type ControlHandle = PacketStreamSinkControlHandle;
9352
9353    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9354        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9355    }
9356
9357    fn control_handle(&self) -> Self::ControlHandle {
9358        PacketStreamSinkControlHandle { inner: self.inner.clone() }
9359    }
9360
9361    fn into_inner(
9362        self,
9363    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9364    {
9365        (self.inner, self.is_terminated)
9366    }
9367
9368    fn from_inner(
9369        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9370        is_terminated: bool,
9371    ) -> Self {
9372        Self { inner, is_terminated }
9373    }
9374}
9375
9376impl futures::Stream for PacketStreamSinkRequestStream {
9377    type Item = Result<PacketStreamSinkRequest, fidl::Error>;
9378
9379    fn poll_next(
9380        mut self: std::pin::Pin<&mut Self>,
9381        cx: &mut std::task::Context<'_>,
9382    ) -> std::task::Poll<Option<Self::Item>> {
9383        let this = &mut *self;
9384        if this.inner.check_shutdown(cx) {
9385            this.is_terminated = true;
9386            return std::task::Poll::Ready(None);
9387        }
9388        if this.is_terminated {
9389            panic!("polled PacketStreamSinkRequestStream after completion");
9390        }
9391        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9392            |bytes, handles| {
9393                match this.inner.channel().read_etc(cx, bytes, handles) {
9394                    std::task::Poll::Ready(Ok(())) => {}
9395                    std::task::Poll::Pending => return std::task::Poll::Pending,
9396                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9397                        this.is_terminated = true;
9398                        return std::task::Poll::Ready(None);
9399                    }
9400                    std::task::Poll::Ready(Err(e)) => {
9401                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9402                            e.into(),
9403                        ))));
9404                    }
9405                }
9406
9407                // A message has been received from the channel
9408                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9409
9410                std::task::Poll::Ready(Some(match header.ordinal {
9411                    0x25a8e35efba81f2b => {
9412                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9413                        let mut req = fidl::new_empty!(
9414                            PacketStreamSinkPutPacketRequest,
9415                            fidl::encoding::DefaultFuchsiaResourceDialect
9416                        );
9417                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PacketStreamSinkPutPacketRequest>(&header, _body_bytes, handles, &mut req)?;
9418                        let control_handle =
9419                            PacketStreamSinkControlHandle { inner: this.inner.clone() };
9420                        Ok(PacketStreamSinkRequest::PutPacket {
9421                            payload: req,
9422                            responder: PacketStreamSinkPutPacketResponder {
9423                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9424                                tx_id: header.tx_id,
9425                            },
9426                        })
9427                    }
9428                    0x13f16ca37ede8a4 => {
9429                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9430                        let mut req = fidl::new_empty!(
9431                            fidl::encoding::EmptyPayload,
9432                            fidl::encoding::DefaultFuchsiaResourceDialect
9433                        );
9434                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9435                        let control_handle =
9436                            PacketStreamSinkControlHandle { inner: this.inner.clone() };
9437                        Ok(PacketStreamSinkRequest::FlushPackets {
9438                            responder: PacketStreamSinkFlushPacketsResponder {
9439                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9440                                tx_id: header.tx_id,
9441                            },
9442                        })
9443                    }
9444                    _ if header.tx_id == 0
9445                        && header
9446                            .dynamic_flags()
9447                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9448                    {
9449                        Ok(PacketStreamSinkRequest::_UnknownMethod {
9450                            ordinal: header.ordinal,
9451                            control_handle: PacketStreamSinkControlHandle {
9452                                inner: this.inner.clone(),
9453                            },
9454                            method_type: fidl::MethodType::OneWay,
9455                        })
9456                    }
9457                    _ if header
9458                        .dynamic_flags()
9459                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9460                    {
9461                        this.inner.send_framework_err(
9462                            fidl::encoding::FrameworkErr::UnknownMethod,
9463                            header.tx_id,
9464                            header.ordinal,
9465                            header.dynamic_flags(),
9466                            (bytes, handles),
9467                        )?;
9468                        Ok(PacketStreamSinkRequest::_UnknownMethod {
9469                            ordinal: header.ordinal,
9470                            control_handle: PacketStreamSinkControlHandle {
9471                                inner: this.inner.clone(),
9472                            },
9473                            method_type: fidl::MethodType::TwoWay,
9474                        })
9475                    }
9476                    _ => Err(fidl::Error::UnknownOrdinal {
9477                        ordinal: header.ordinal,
9478                        protocol_name:
9479                            <PacketStreamSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9480                    }),
9481                }))
9482            },
9483        )
9484    }
9485}
9486
9487/// The protocol for streaming packet-based audio data.
9488/// This protocol functions as a data sink. The "server" of this protocol consumes packets,
9489/// and the "client" produces packets.
9490///
9491/// This protocol can be used in two directions:
9492/// 1. **Output (Client -> Driver)**: The Driver implements `PacketStreamSink`. The Client (App)
9493///    calls `PutPacket`.
9494/// 2. **Input (Driver -> Client)**: The Client (App) implements `PacketStreamSink`. The Driver
9495///    calls `PutPacket`.
9496#[derive(Debug)]
9497pub enum PacketStreamSinkRequest {
9498    /// Submits a packet to be processed by the server.
9499    ///
9500    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
9501    /// Packets are processed in the order they were submitted. This call
9502    /// blocks until the payload is processed. When this call returns, the
9503    /// buffer region is guaranteed to be available for reuse.
9504    ///
9505    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
9506    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
9507    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
9508    /// * The payload is missing.
9509    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
9510    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
9511    ///   `DRIVER_OWNED`.
9512    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
9513    ///
9514    /// Note: The server is not required to detect if a VMO region is currently in use by a
9515    /// previous pending packet. Clients are responsible for managing buffer usage.
9516    PutPacket {
9517        payload: PacketStreamSinkPutPacketRequest,
9518        responder: PacketStreamSinkPutPacketResponder,
9519    },
9520    /// Flushes all packets currently pending without processing them.
9521    /// This call waits until all pending packets are completed or canceled.
9522    ///
9523    /// Note: A packet may be partially processed (e.g. if it contains multiple
9524    /// audio frames, or if the data does not align with encoded frame boundaries)
9525    /// before it is canceled.
9526    FlushPackets { responder: PacketStreamSinkFlushPacketsResponder },
9527    /// An interaction was received which does not match any known method.
9528    #[non_exhaustive]
9529    _UnknownMethod {
9530        /// Ordinal of the method that was called.
9531        ordinal: u64,
9532        control_handle: PacketStreamSinkControlHandle,
9533        method_type: fidl::MethodType,
9534    },
9535}
9536
9537impl PacketStreamSinkRequest {
9538    #[allow(irrefutable_let_patterns)]
9539    pub fn into_put_packet(
9540        self,
9541    ) -> Option<(PacketStreamSinkPutPacketRequest, PacketStreamSinkPutPacketResponder)> {
9542        if let PacketStreamSinkRequest::PutPacket { payload, responder } = self {
9543            Some((payload, responder))
9544        } else {
9545            None
9546        }
9547    }
9548
9549    #[allow(irrefutable_let_patterns)]
9550    pub fn into_flush_packets(self) -> Option<(PacketStreamSinkFlushPacketsResponder)> {
9551        if let PacketStreamSinkRequest::FlushPackets { responder } = self {
9552            Some((responder))
9553        } else {
9554            None
9555        }
9556    }
9557
9558    /// Name of the method defined in FIDL
9559    pub fn method_name(&self) -> &'static str {
9560        match *self {
9561            PacketStreamSinkRequest::PutPacket { .. } => "put_packet",
9562            PacketStreamSinkRequest::FlushPackets { .. } => "flush_packets",
9563            PacketStreamSinkRequest::_UnknownMethod {
9564                method_type: fidl::MethodType::OneWay,
9565                ..
9566            } => "unknown one-way method",
9567            PacketStreamSinkRequest::_UnknownMethod {
9568                method_type: fidl::MethodType::TwoWay,
9569                ..
9570            } => "unknown two-way method",
9571        }
9572    }
9573}
9574
9575#[derive(Debug, Clone)]
9576pub struct PacketStreamSinkControlHandle {
9577    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9578}
9579
9580impl PacketStreamSinkControlHandle {
9581    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9582        self.inner.shutdown_with_epitaph(status.into())
9583    }
9584}
9585
9586impl fidl::endpoints::ControlHandle for PacketStreamSinkControlHandle {
9587    fn shutdown(&self) {
9588        self.inner.shutdown()
9589    }
9590
9591    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9592        self.inner.shutdown_with_epitaph(status)
9593    }
9594
9595    fn is_closed(&self) -> bool {
9596        self.inner.channel().is_closed()
9597    }
9598    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9599        self.inner.channel().on_closed()
9600    }
9601
9602    #[cfg(target_os = "fuchsia")]
9603    fn signal_peer(
9604        &self,
9605        clear_mask: zx::Signals,
9606        set_mask: zx::Signals,
9607    ) -> Result<(), zx_status::Status> {
9608        use fidl::Peered;
9609        self.inner.channel().signal_peer(clear_mask, set_mask)
9610    }
9611}
9612
9613impl PacketStreamSinkControlHandle {}
9614
9615#[must_use = "FIDL methods require a response to be sent"]
9616#[derive(Debug)]
9617pub struct PacketStreamSinkPutPacketResponder {
9618    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
9619    tx_id: u32,
9620}
9621
9622/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
9623/// if the responder is dropped without sending a response, so that the client
9624/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9625impl std::ops::Drop for PacketStreamSinkPutPacketResponder {
9626    fn drop(&mut self) {
9627        self.control_handle.shutdown();
9628        // Safety: drops once, never accessed again
9629        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9630    }
9631}
9632
9633impl fidl::endpoints::Responder for PacketStreamSinkPutPacketResponder {
9634    type ControlHandle = PacketStreamSinkControlHandle;
9635
9636    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
9637        &self.control_handle
9638    }
9639
9640    fn drop_without_shutdown(mut self) {
9641        // Safety: drops once, never accessed again due to mem::forget
9642        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9643        // Prevent Drop from running (which would shut down the channel)
9644        std::mem::forget(self);
9645    }
9646}
9647
9648impl PacketStreamSinkPutPacketResponder {
9649    /// Sends a response to the FIDL transaction.
9650    ///
9651    /// Sets the channel to shutdown if an error occurs.
9652    pub fn send(
9653        self,
9654        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9655    ) -> Result<(), fidl::Error> {
9656        let _result = self.send_raw(result);
9657        if _result.is_err() {
9658            self.control_handle.shutdown();
9659        }
9660        self.drop_without_shutdown();
9661        _result
9662    }
9663
9664    /// Similar to "send" but does not shutdown the channel if an error occurs.
9665    pub fn send_no_shutdown_on_err(
9666        self,
9667        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9668    ) -> Result<(), fidl::Error> {
9669        let _result = self.send_raw(result);
9670        self.drop_without_shutdown();
9671        _result
9672    }
9673
9674    fn send_raw(
9675        &self,
9676        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
9677    ) -> Result<(), fidl::Error> {
9678        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
9679            PacketStreamSinkPutPacketResponse,
9680            i32,
9681        >>(
9682            fidl::encoding::FlexibleResult::new(result),
9683            self.tx_id,
9684            0x25a8e35efba81f2b,
9685            fidl::encoding::DynamicFlags::FLEXIBLE,
9686        )
9687    }
9688}
9689
9690#[must_use = "FIDL methods require a response to be sent"]
9691#[derive(Debug)]
9692pub struct PacketStreamSinkFlushPacketsResponder {
9693    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
9694    tx_id: u32,
9695}
9696
9697/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
9698/// if the responder is dropped without sending a response, so that the client
9699/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9700impl std::ops::Drop for PacketStreamSinkFlushPacketsResponder {
9701    fn drop(&mut self) {
9702        self.control_handle.shutdown();
9703        // Safety: drops once, never accessed again
9704        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9705    }
9706}
9707
9708impl fidl::endpoints::Responder for PacketStreamSinkFlushPacketsResponder {
9709    type ControlHandle = PacketStreamSinkControlHandle;
9710
9711    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
9712        &self.control_handle
9713    }
9714
9715    fn drop_without_shutdown(mut self) {
9716        // Safety: drops once, never accessed again due to mem::forget
9717        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9718        // Prevent Drop from running (which would shut down the channel)
9719        std::mem::forget(self);
9720    }
9721}
9722
9723impl PacketStreamSinkFlushPacketsResponder {
9724    /// Sends a response to the FIDL transaction.
9725    ///
9726    /// Sets the channel to shutdown if an error occurs.
9727    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9728        let _result = self.send_raw(result);
9729        if _result.is_err() {
9730            self.control_handle.shutdown();
9731        }
9732        self.drop_without_shutdown();
9733        _result
9734    }
9735
9736    /// Similar to "send" but does not shutdown the channel if an error occurs.
9737    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9738        let _result = self.send_raw(result);
9739        self.drop_without_shutdown();
9740        _result
9741    }
9742
9743    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9744        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
9745            fidl::encoding::EmptyStruct,
9746            i32,
9747        >>(
9748            fidl::encoding::FlexibleResult::new(result),
9749            self.tx_id,
9750            0x13f16ca37ede8a4,
9751            fidl::encoding::DynamicFlags::FLEXIBLE,
9752        )
9753    }
9754}
9755
9756#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9757pub struct RingBufferMarker;
9758
9759impl fidl::endpoints::ProtocolMarker for RingBufferMarker {
9760    type Proxy = RingBufferProxy;
9761    type RequestStream = RingBufferRequestStream;
9762    #[cfg(target_os = "fuchsia")]
9763    type SynchronousProxy = RingBufferSynchronousProxy;
9764
9765    const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
9766}
9767pub type RingBufferGetVmoResult = Result<(u32, fidl::Vmo), GetVmoError>;
9768pub type RingBufferSetActiveChannelsResult = Result<i64, i32>;
9769
9770pub trait RingBufferProxyInterface: Send + Sync {
9771    type GetPropertiesResponseFut: std::future::Future<Output = Result<RingBufferProperties, fidl::Error>>
9772        + Send;
9773    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
9774    type WatchClockRecoveryPositionInfoResponseFut: std::future::Future<Output = Result<RingBufferPositionInfo, fidl::Error>>
9775        + Send;
9776    fn r#watch_clock_recovery_position_info(
9777        &self,
9778    ) -> Self::WatchClockRecoveryPositionInfoResponseFut;
9779    type GetVmoResponseFut: std::future::Future<Output = Result<RingBufferGetVmoResult, fidl::Error>>
9780        + Send;
9781    fn r#get_vmo(
9782        &self,
9783        min_frames: u32,
9784        clock_recovery_notifications_per_ring: u32,
9785    ) -> Self::GetVmoResponseFut;
9786    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
9787    fn r#start(&self) -> Self::StartResponseFut;
9788    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
9789    fn r#stop(&self) -> Self::StopResponseFut;
9790    type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
9791        + Send;
9792    fn r#set_active_channels(
9793        &self,
9794        active_channels_bitmask: u64,
9795    ) -> Self::SetActiveChannelsResponseFut;
9796    type WatchDelayInfoResponseFut: std::future::Future<Output = Result<DelayInfo, fidl::Error>>
9797        + Send;
9798    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
9799}
9800#[derive(Debug)]
9801#[cfg(target_os = "fuchsia")]
9802pub struct RingBufferSynchronousProxy {
9803    client: fidl::client::sync::Client,
9804}
9805
9806#[cfg(target_os = "fuchsia")]
9807impl fidl::endpoints::SynchronousProxy for RingBufferSynchronousProxy {
9808    type Proxy = RingBufferProxy;
9809    type Protocol = RingBufferMarker;
9810
9811    fn from_channel(inner: fidl::Channel) -> Self {
9812        Self::new(inner)
9813    }
9814
9815    fn into_channel(self) -> fidl::Channel {
9816        self.client.into_channel()
9817    }
9818
9819    fn as_channel(&self) -> &fidl::Channel {
9820        self.client.as_channel()
9821    }
9822}
9823
9824#[cfg(target_os = "fuchsia")]
9825impl RingBufferSynchronousProxy {
9826    pub fn new(channel: fidl::Channel) -> Self {
9827        Self { client: fidl::client::sync::Client::new(channel) }
9828    }
9829
9830    pub fn into_channel(self) -> fidl::Channel {
9831        self.client.into_channel()
9832    }
9833
9834    /// Waits until an event arrives and returns it. It is safe for other
9835    /// threads to make concurrent requests while waiting for an event.
9836    pub fn wait_for_event(
9837        &self,
9838        deadline: zx::MonotonicInstant,
9839    ) -> Result<RingBufferEvent, fidl::Error> {
9840        RingBufferEvent::decode(self.client.wait_for_event::<RingBufferMarker>(deadline)?)
9841    }
9842
9843    /// Accessor for top level static properties.
9844    pub fn r#get_properties(
9845        &self,
9846        ___deadline: zx::MonotonicInstant,
9847    ) -> Result<RingBufferProperties, fidl::Error> {
9848        let _response = self.client.send_query::<
9849            fidl::encoding::EmptyPayload,
9850            RingBufferGetPropertiesResponse,
9851            RingBufferMarker,
9852        >(
9853            (),
9854            0x12947f061a8fe1,
9855            fidl::encoding::DynamicFlags::empty(),
9856            ___deadline,
9857        )?;
9858        Ok(_response.properties)
9859    }
9860
9861    /// Gets the ring buffer current position via a hanging get.
9862    ///
9863    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
9864    /// `clock_recovery_notifications_per_ring` was specified.
9865    ///
9866    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
9867    /// not respond to subsequent client calls until the position information has changed from what
9868    /// was most recently provided to that client.
9869    ///
9870    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
9871    /// to the `Start` command.
9872    ///
9873    /// At the `start_time` returned by `Start`, position is always 0. From there, it
9874    /// progresses at the rate specified by the rate, sample format (and clock domain,
9875    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
9876    ///
9877    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
9878    /// estimated position to be used for clock recovery at most at
9879    /// `clock_recovery_notifications_per_ring` frequency.
9880    ///
9881    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
9882    /// increasing.
9883    ///
9884    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
9885    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
9886    pub fn r#watch_clock_recovery_position_info(
9887        &self,
9888        ___deadline: zx::MonotonicInstant,
9889    ) -> Result<RingBufferPositionInfo, fidl::Error> {
9890        let _response = self.client.send_query::<
9891            fidl::encoding::EmptyPayload,
9892            RingBufferWatchClockRecoveryPositionInfoResponse,
9893            RingBufferMarker,
9894        >(
9895            (),
9896            0x694d5b898a4167e5,
9897            fidl::encoding::DynamicFlags::empty(),
9898            ___deadline,
9899        )?;
9900        Ok(_response.position_info)
9901    }
9902
9903    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
9904    ///
9905    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
9906    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
9907    ///
9908    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
9909    /// that ring buffer contents can be transfered in and out, or else the call must be failed
9910    /// with GetVmoError.INVALID_ARGS.
9911    ///
9912    /// The driver may increase the ring buffer size beyond `min_frames` plus
9913    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
9914    /// alignment.
9915    ///
9916    /// Clients can treat the entire returned ring buffer as safe to access, except for the
9917    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
9918    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
9919    ///
9920    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
9921    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
9922    /// handle must also include ZX_RIGHT_WRITE.
9923    ///
9924    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
9925    /// `WatchClockRecoveryPositionInfo` client requests at most at
9926    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
9927    /// for clock recovery.
9928    pub fn r#get_vmo(
9929        &self,
9930        mut min_frames: u32,
9931        mut clock_recovery_notifications_per_ring: u32,
9932        ___deadline: zx::MonotonicInstant,
9933    ) -> Result<RingBufferGetVmoResult, fidl::Error> {
9934        let _response = self.client.send_query::<
9935            RingBufferGetVmoRequest,
9936            fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
9937            RingBufferMarker,
9938        >(
9939            (min_frames, clock_recovery_notifications_per_ring,),
9940            0x44c8f4f5680e853a,
9941            fidl::encoding::DynamicFlags::empty(),
9942            ___deadline,
9943        )?;
9944        Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
9945    }
9946
9947    /// Start the ring buffer.
9948    ///
9949    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
9950    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
9951    /// write from or to the ring buffer position 0, subject to the overall position and buffering
9952    /// behavior described in 'Ring buffer behavior' below.
9953    ///
9954    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
9955    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
9956    /// a second time before the first call has completed, then the channel must be closed with an
9957    /// error `ZX_ERR_BAD_STATE` returned.
9958    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
9959    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
9960        let _response = self
9961            .client
9962            .send_query::<fidl::encoding::EmptyPayload, RingBufferStartResponse, RingBufferMarker>(
9963                (),
9964                0x5dd780a769a8892d,
9965                fidl::encoding::DynamicFlags::empty(),
9966                ___deadline,
9967            )?;
9968        Ok(_response.start_time)
9969    }
9970
9971    /// Stop the ring buffer.
9972    ///
9973    /// Once this call's response is received, no further position notifications will be sent until
9974    /// `Start` is called again.
9975    ///
9976    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
9977    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
9978        let _response = self.client.send_query::<
9979            fidl::encoding::EmptyPayload,
9980            fidl::encoding::EmptyPayload,
9981            RingBufferMarker,
9982        >(
9983            (),
9984            0x49a73d9cf1d4e110,
9985            fidl::encoding::DynamicFlags::empty(),
9986            ___deadline,
9987        )?;
9988        Ok(_response)
9989    }
9990
9991    /// Sets which channels are active via a bitmask.
9992    ///
9993    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
9994    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
9995    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
9996    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
9997    /// turns on the hardware associated for all channels.
9998    ///
9999    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
10000    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
10001    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
10002    ///
10003    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
10004    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
10005    /// buffer's position advances (and position notifications sent as needed) regardless of the
10006    /// number of active channels, including if no channels are active. This means that the format
10007    /// in the ring buffer is not changed.
10008    ///
10009    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
10010    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
10011    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
10012    ///
10013    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
10014    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
10015    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
10016    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
10017    /// hardware configuration was completed. If the requested channel configuration is already
10018    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
10019    /// before the reply is sent. If called again with the same configuration, the reply must
10020    /// include the same `set_time` value as was previously returned.
10021    ///
10022    /// For input channels, it is not required that the driver zero-out inactive channels.
10023    ///
10024    /// If `SetActiveChannels` is called for a second time before the first call has completed,
10025    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10026    pub fn r#set_active_channels(
10027        &self,
10028        mut active_channels_bitmask: u64,
10029        ___deadline: zx::MonotonicInstant,
10030    ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
10031        let _response = self.client.send_query::<
10032            RingBufferSetActiveChannelsRequest,
10033            fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
10034            RingBufferMarker,
10035        >(
10036            (active_channels_bitmask,),
10037            0x605464c1d384f309,
10038            fidl::encoding::DynamicFlags::empty(),
10039            ___deadline,
10040        )?;
10041        Ok(_response.map(|x| x.set_time))
10042    }
10043
10044    /// Get information about delays via a hanging get.
10045    ///
10046    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
10047    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
10048    /// changes from what was most recently reported.
10049    ///
10050    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
10051    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10052    pub fn r#watch_delay_info(
10053        &self,
10054        ___deadline: zx::MonotonicInstant,
10055    ) -> Result<DelayInfo, fidl::Error> {
10056        let _response = self.client.send_query::<
10057            fidl::encoding::EmptyPayload,
10058            fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
10059            RingBufferMarker,
10060        >(
10061            (),
10062            0x6c1248db213fcf9f,
10063            fidl::encoding::DynamicFlags::FLEXIBLE,
10064            ___deadline,
10065        )?
10066        .into_result::<RingBufferMarker>("watch_delay_info")?;
10067        Ok(_response.delay_info)
10068    }
10069}
10070
10071#[cfg(target_os = "fuchsia")]
10072impl From<RingBufferSynchronousProxy> for zx::NullableHandle {
10073    fn from(value: RingBufferSynchronousProxy) -> Self {
10074        value.into_channel().into()
10075    }
10076}
10077
10078#[cfg(target_os = "fuchsia")]
10079impl From<fidl::Channel> for RingBufferSynchronousProxy {
10080    fn from(value: fidl::Channel) -> Self {
10081        Self::new(value)
10082    }
10083}
10084
10085#[cfg(target_os = "fuchsia")]
10086impl fidl::endpoints::FromClient for RingBufferSynchronousProxy {
10087    type Protocol = RingBufferMarker;
10088
10089    fn from_client(value: fidl::endpoints::ClientEnd<RingBufferMarker>) -> Self {
10090        Self::new(value.into_channel())
10091    }
10092}
10093
10094#[derive(Debug, Clone)]
10095pub struct RingBufferProxy {
10096    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10097}
10098
10099impl fidl::endpoints::Proxy for RingBufferProxy {
10100    type Protocol = RingBufferMarker;
10101
10102    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10103        Self::new(inner)
10104    }
10105
10106    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10107        self.client.into_channel().map_err(|client| Self { client })
10108    }
10109
10110    fn as_channel(&self) -> &::fidl::AsyncChannel {
10111        self.client.as_channel()
10112    }
10113}
10114
10115impl RingBufferProxy {
10116    /// Create a new Proxy for fuchsia.hardware.audio/RingBuffer.
10117    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10118        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10119        Self { client: fidl::client::Client::new(channel, protocol_name) }
10120    }
10121
10122    /// Get a Stream of events from the remote end of the protocol.
10123    ///
10124    /// # Panics
10125    ///
10126    /// Panics if the event stream was already taken.
10127    pub fn take_event_stream(&self) -> RingBufferEventStream {
10128        RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
10129    }
10130
10131    /// Accessor for top level static properties.
10132    pub fn r#get_properties(
10133        &self,
10134    ) -> fidl::client::QueryResponseFut<
10135        RingBufferProperties,
10136        fidl::encoding::DefaultFuchsiaResourceDialect,
10137    > {
10138        RingBufferProxyInterface::r#get_properties(self)
10139    }
10140
10141    /// Gets the ring buffer current position via a hanging get.
10142    ///
10143    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
10144    /// `clock_recovery_notifications_per_ring` was specified.
10145    ///
10146    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
10147    /// not respond to subsequent client calls until the position information has changed from what
10148    /// was most recently provided to that client.
10149    ///
10150    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
10151    /// to the `Start` command.
10152    ///
10153    /// At the `start_time` returned by `Start`, position is always 0. From there, it
10154    /// progresses at the rate specified by the rate, sample format (and clock domain,
10155    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
10156    ///
10157    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
10158    /// estimated position to be used for clock recovery at most at
10159    /// `clock_recovery_notifications_per_ring` frequency.
10160    ///
10161    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
10162    /// increasing.
10163    ///
10164    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
10165    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
10166    pub fn r#watch_clock_recovery_position_info(
10167        &self,
10168    ) -> fidl::client::QueryResponseFut<
10169        RingBufferPositionInfo,
10170        fidl::encoding::DefaultFuchsiaResourceDialect,
10171    > {
10172        RingBufferProxyInterface::r#watch_clock_recovery_position_info(self)
10173    }
10174
10175    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
10176    ///
10177    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
10178    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
10179    ///
10180    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
10181    /// that ring buffer contents can be transfered in and out, or else the call must be failed
10182    /// with GetVmoError.INVALID_ARGS.
10183    ///
10184    /// The driver may increase the ring buffer size beyond `min_frames` plus
10185    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
10186    /// alignment.
10187    ///
10188    /// Clients can treat the entire returned ring buffer as safe to access, except for the
10189    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
10190    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
10191    ///
10192    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
10193    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
10194    /// handle must also include ZX_RIGHT_WRITE.
10195    ///
10196    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
10197    /// `WatchClockRecoveryPositionInfo` client requests at most at
10198    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
10199    /// for clock recovery.
10200    pub fn r#get_vmo(
10201        &self,
10202        mut min_frames: u32,
10203        mut clock_recovery_notifications_per_ring: u32,
10204    ) -> fidl::client::QueryResponseFut<
10205        RingBufferGetVmoResult,
10206        fidl::encoding::DefaultFuchsiaResourceDialect,
10207    > {
10208        RingBufferProxyInterface::r#get_vmo(self, min_frames, clock_recovery_notifications_per_ring)
10209    }
10210
10211    /// Start the ring buffer.
10212    ///
10213    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
10214    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
10215    /// write from or to the ring buffer position 0, subject to the overall position and buffering
10216    /// behavior described in 'Ring buffer behavior' below.
10217    ///
10218    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10219    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
10220    /// a second time before the first call has completed, then the channel must be closed with an
10221    /// error `ZX_ERR_BAD_STATE` returned.
10222    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
10223    pub fn r#start(
10224        &self,
10225    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
10226        RingBufferProxyInterface::r#start(self)
10227    }
10228
10229    /// Stop the ring buffer.
10230    ///
10231    /// Once this call's response is received, no further position notifications will be sent until
10232    /// `Start` is called again.
10233    ///
10234    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10235    pub fn r#stop(
10236        &self,
10237    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
10238        RingBufferProxyInterface::r#stop(self)
10239    }
10240
10241    /// Sets which channels are active via a bitmask.
10242    ///
10243    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
10244    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
10245    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
10246    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
10247    /// turns on the hardware associated for all channels.
10248    ///
10249    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
10250    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
10251    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
10252    ///
10253    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
10254    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
10255    /// buffer's position advances (and position notifications sent as needed) regardless of the
10256    /// number of active channels, including if no channels are active. This means that the format
10257    /// in the ring buffer is not changed.
10258    ///
10259    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
10260    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
10261    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
10262    ///
10263    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
10264    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
10265    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
10266    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
10267    /// hardware configuration was completed. If the requested channel configuration is already
10268    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
10269    /// before the reply is sent. If called again with the same configuration, the reply must
10270    /// include the same `set_time` value as was previously returned.
10271    ///
10272    /// For input channels, it is not required that the driver zero-out inactive channels.
10273    ///
10274    /// If `SetActiveChannels` is called for a second time before the first call has completed,
10275    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10276    pub fn r#set_active_channels(
10277        &self,
10278        mut active_channels_bitmask: u64,
10279    ) -> fidl::client::QueryResponseFut<
10280        RingBufferSetActiveChannelsResult,
10281        fidl::encoding::DefaultFuchsiaResourceDialect,
10282    > {
10283        RingBufferProxyInterface::r#set_active_channels(self, active_channels_bitmask)
10284    }
10285
10286    /// Get information about delays via a hanging get.
10287    ///
10288    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
10289    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
10290    /// changes from what was most recently reported.
10291    ///
10292    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
10293    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10294    pub fn r#watch_delay_info(
10295        &self,
10296    ) -> fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
10297    {
10298        RingBufferProxyInterface::r#watch_delay_info(self)
10299    }
10300}
10301
10302impl RingBufferProxyInterface for RingBufferProxy {
10303    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
10304        RingBufferProperties,
10305        fidl::encoding::DefaultFuchsiaResourceDialect,
10306    >;
10307    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
10308        fn _decode(
10309            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10310        ) -> Result<RingBufferProperties, fidl::Error> {
10311            let _response = fidl::client::decode_transaction_body::<
10312                RingBufferGetPropertiesResponse,
10313                fidl::encoding::DefaultFuchsiaResourceDialect,
10314                0x12947f061a8fe1,
10315            >(_buf?)?;
10316            Ok(_response.properties)
10317        }
10318        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferProperties>(
10319            (),
10320            0x12947f061a8fe1,
10321            fidl::encoding::DynamicFlags::empty(),
10322            _decode,
10323        )
10324    }
10325
10326    type WatchClockRecoveryPositionInfoResponseFut = fidl::client::QueryResponseFut<
10327        RingBufferPositionInfo,
10328        fidl::encoding::DefaultFuchsiaResourceDialect,
10329    >;
10330    fn r#watch_clock_recovery_position_info(
10331        &self,
10332    ) -> Self::WatchClockRecoveryPositionInfoResponseFut {
10333        fn _decode(
10334            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10335        ) -> Result<RingBufferPositionInfo, fidl::Error> {
10336            let _response = fidl::client::decode_transaction_body::<
10337                RingBufferWatchClockRecoveryPositionInfoResponse,
10338                fidl::encoding::DefaultFuchsiaResourceDialect,
10339                0x694d5b898a4167e5,
10340            >(_buf?)?;
10341            Ok(_response.position_info)
10342        }
10343        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferPositionInfo>(
10344            (),
10345            0x694d5b898a4167e5,
10346            fidl::encoding::DynamicFlags::empty(),
10347            _decode,
10348        )
10349    }
10350
10351    type GetVmoResponseFut = fidl::client::QueryResponseFut<
10352        RingBufferGetVmoResult,
10353        fidl::encoding::DefaultFuchsiaResourceDialect,
10354    >;
10355    fn r#get_vmo(
10356        &self,
10357        mut min_frames: u32,
10358        mut clock_recovery_notifications_per_ring: u32,
10359    ) -> Self::GetVmoResponseFut {
10360        fn _decode(
10361            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10362        ) -> Result<RingBufferGetVmoResult, fidl::Error> {
10363            let _response = fidl::client::decode_transaction_body::<
10364                fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
10365                fidl::encoding::DefaultFuchsiaResourceDialect,
10366                0x44c8f4f5680e853a,
10367            >(_buf?)?;
10368            Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
10369        }
10370        self.client.send_query_and_decode::<RingBufferGetVmoRequest, RingBufferGetVmoResult>(
10371            (min_frames, clock_recovery_notifications_per_ring),
10372            0x44c8f4f5680e853a,
10373            fidl::encoding::DynamicFlags::empty(),
10374            _decode,
10375        )
10376    }
10377
10378    type StartResponseFut =
10379        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
10380    fn r#start(&self) -> Self::StartResponseFut {
10381        fn _decode(
10382            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10383        ) -> Result<i64, fidl::Error> {
10384            let _response = fidl::client::decode_transaction_body::<
10385                RingBufferStartResponse,
10386                fidl::encoding::DefaultFuchsiaResourceDialect,
10387                0x5dd780a769a8892d,
10388            >(_buf?)?;
10389            Ok(_response.start_time)
10390        }
10391        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
10392            (),
10393            0x5dd780a769a8892d,
10394            fidl::encoding::DynamicFlags::empty(),
10395            _decode,
10396        )
10397    }
10398
10399    type StopResponseFut =
10400        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
10401    fn r#stop(&self) -> Self::StopResponseFut {
10402        fn _decode(
10403            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10404        ) -> Result<(), fidl::Error> {
10405            let _response = fidl::client::decode_transaction_body::<
10406                fidl::encoding::EmptyPayload,
10407                fidl::encoding::DefaultFuchsiaResourceDialect,
10408                0x49a73d9cf1d4e110,
10409            >(_buf?)?;
10410            Ok(_response)
10411        }
10412        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
10413            (),
10414            0x49a73d9cf1d4e110,
10415            fidl::encoding::DynamicFlags::empty(),
10416            _decode,
10417        )
10418    }
10419
10420    type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
10421        RingBufferSetActiveChannelsResult,
10422        fidl::encoding::DefaultFuchsiaResourceDialect,
10423    >;
10424    fn r#set_active_channels(
10425        &self,
10426        mut active_channels_bitmask: u64,
10427    ) -> Self::SetActiveChannelsResponseFut {
10428        fn _decode(
10429            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10430        ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
10431            let _response = fidl::client::decode_transaction_body::<
10432                fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
10433                fidl::encoding::DefaultFuchsiaResourceDialect,
10434                0x605464c1d384f309,
10435            >(_buf?)?;
10436            Ok(_response.map(|x| x.set_time))
10437        }
10438        self.client.send_query_and_decode::<
10439            RingBufferSetActiveChannelsRequest,
10440            RingBufferSetActiveChannelsResult,
10441        >(
10442            (active_channels_bitmask,),
10443            0x605464c1d384f309,
10444            fidl::encoding::DynamicFlags::empty(),
10445            _decode,
10446        )
10447    }
10448
10449    type WatchDelayInfoResponseFut =
10450        fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
10451    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
10452        fn _decode(
10453            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10454        ) -> Result<DelayInfo, fidl::Error> {
10455            let _response = fidl::client::decode_transaction_body::<
10456                fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
10457                fidl::encoding::DefaultFuchsiaResourceDialect,
10458                0x6c1248db213fcf9f,
10459            >(_buf?)?
10460            .into_result::<RingBufferMarker>("watch_delay_info")?;
10461            Ok(_response.delay_info)
10462        }
10463        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelayInfo>(
10464            (),
10465            0x6c1248db213fcf9f,
10466            fidl::encoding::DynamicFlags::FLEXIBLE,
10467            _decode,
10468        )
10469    }
10470}
10471
10472pub struct RingBufferEventStream {
10473    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10474}
10475
10476impl std::marker::Unpin for RingBufferEventStream {}
10477
10478impl futures::stream::FusedStream for RingBufferEventStream {
10479    fn is_terminated(&self) -> bool {
10480        self.event_receiver.is_terminated()
10481    }
10482}
10483
10484impl futures::Stream for RingBufferEventStream {
10485    type Item = Result<RingBufferEvent, fidl::Error>;
10486
10487    fn poll_next(
10488        mut self: std::pin::Pin<&mut Self>,
10489        cx: &mut std::task::Context<'_>,
10490    ) -> std::task::Poll<Option<Self::Item>> {
10491        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10492            &mut self.event_receiver,
10493            cx
10494        )?) {
10495            Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
10496            None => std::task::Poll::Ready(None),
10497        }
10498    }
10499}
10500
10501#[derive(Debug)]
10502pub enum RingBufferEvent {
10503    #[non_exhaustive]
10504    _UnknownEvent {
10505        /// Ordinal of the event that was sent.
10506        ordinal: u64,
10507    },
10508}
10509
10510impl RingBufferEvent {
10511    /// Decodes a message buffer as a [`RingBufferEvent`].
10512    fn decode(
10513        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10514    ) -> Result<RingBufferEvent, fidl::Error> {
10515        let (bytes, _handles) = buf.split_mut();
10516        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10517        debug_assert_eq!(tx_header.tx_id, 0);
10518        match tx_header.ordinal {
10519            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
10520                Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
10521            }
10522            _ => Err(fidl::Error::UnknownOrdinal {
10523                ordinal: tx_header.ordinal,
10524                protocol_name: <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10525            }),
10526        }
10527    }
10528}
10529
10530/// A Stream of incoming requests for fuchsia.hardware.audio/RingBuffer.
10531pub struct RingBufferRequestStream {
10532    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10533    is_terminated: bool,
10534}
10535
10536impl std::marker::Unpin for RingBufferRequestStream {}
10537
10538impl futures::stream::FusedStream for RingBufferRequestStream {
10539    fn is_terminated(&self) -> bool {
10540        self.is_terminated
10541    }
10542}
10543
10544impl fidl::endpoints::RequestStream for RingBufferRequestStream {
10545    type Protocol = RingBufferMarker;
10546    type ControlHandle = RingBufferControlHandle;
10547
10548    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10549        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10550    }
10551
10552    fn control_handle(&self) -> Self::ControlHandle {
10553        RingBufferControlHandle { inner: self.inner.clone() }
10554    }
10555
10556    fn into_inner(
10557        self,
10558    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10559    {
10560        (self.inner, self.is_terminated)
10561    }
10562
10563    fn from_inner(
10564        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10565        is_terminated: bool,
10566    ) -> Self {
10567        Self { inner, is_terminated }
10568    }
10569}
10570
10571impl futures::Stream for RingBufferRequestStream {
10572    type Item = Result<RingBufferRequest, fidl::Error>;
10573
10574    fn poll_next(
10575        mut self: std::pin::Pin<&mut Self>,
10576        cx: &mut std::task::Context<'_>,
10577    ) -> std::task::Poll<Option<Self::Item>> {
10578        let this = &mut *self;
10579        if this.inner.check_shutdown(cx) {
10580            this.is_terminated = true;
10581            return std::task::Poll::Ready(None);
10582        }
10583        if this.is_terminated {
10584            panic!("polled RingBufferRequestStream after completion");
10585        }
10586        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10587            |bytes, handles| {
10588                match this.inner.channel().read_etc(cx, bytes, handles) {
10589                    std::task::Poll::Ready(Ok(())) => {}
10590                    std::task::Poll::Pending => return std::task::Poll::Pending,
10591                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10592                        this.is_terminated = true;
10593                        return std::task::Poll::Ready(None);
10594                    }
10595                    std::task::Poll::Ready(Err(e)) => {
10596                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10597                            e.into(),
10598                        ))));
10599                    }
10600                }
10601
10602                // A message has been received from the channel
10603                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10604
10605                std::task::Poll::Ready(Some(match header.ordinal {
10606                    0x12947f061a8fe1 => {
10607                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10608                        let mut req = fidl::new_empty!(
10609                            fidl::encoding::EmptyPayload,
10610                            fidl::encoding::DefaultFuchsiaResourceDialect
10611                        );
10612                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10613                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10614                        Ok(RingBufferRequest::GetProperties {
10615                            responder: RingBufferGetPropertiesResponder {
10616                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10617                                tx_id: header.tx_id,
10618                            },
10619                        })
10620                    }
10621                    0x694d5b898a4167e5 => {
10622                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10623                        let mut req = fidl::new_empty!(
10624                            fidl::encoding::EmptyPayload,
10625                            fidl::encoding::DefaultFuchsiaResourceDialect
10626                        );
10627                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10628                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10629                        Ok(RingBufferRequest::WatchClockRecoveryPositionInfo {
10630                            responder: RingBufferWatchClockRecoveryPositionInfoResponder {
10631                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10632                                tx_id: header.tx_id,
10633                            },
10634                        })
10635                    }
10636                    0x44c8f4f5680e853a => {
10637                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10638                        let mut req = fidl::new_empty!(
10639                            RingBufferGetVmoRequest,
10640                            fidl::encoding::DefaultFuchsiaResourceDialect
10641                        );
10642                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
10643                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10644                        Ok(RingBufferRequest::GetVmo {
10645                            min_frames: req.min_frames,
10646                            clock_recovery_notifications_per_ring: req
10647                                .clock_recovery_notifications_per_ring,
10648
10649                            responder: RingBufferGetVmoResponder {
10650                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10651                                tx_id: header.tx_id,
10652                            },
10653                        })
10654                    }
10655                    0x5dd780a769a8892d => {
10656                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10657                        let mut req = fidl::new_empty!(
10658                            fidl::encoding::EmptyPayload,
10659                            fidl::encoding::DefaultFuchsiaResourceDialect
10660                        );
10661                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10662                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10663                        Ok(RingBufferRequest::Start {
10664                            responder: RingBufferStartResponder {
10665                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10666                                tx_id: header.tx_id,
10667                            },
10668                        })
10669                    }
10670                    0x49a73d9cf1d4e110 => {
10671                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10672                        let mut req = fidl::new_empty!(
10673                            fidl::encoding::EmptyPayload,
10674                            fidl::encoding::DefaultFuchsiaResourceDialect
10675                        );
10676                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10677                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10678                        Ok(RingBufferRequest::Stop {
10679                            responder: RingBufferStopResponder {
10680                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10681                                tx_id: header.tx_id,
10682                            },
10683                        })
10684                    }
10685                    0x605464c1d384f309 => {
10686                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10687                        let mut req = fidl::new_empty!(
10688                            RingBufferSetActiveChannelsRequest,
10689                            fidl::encoding::DefaultFuchsiaResourceDialect
10690                        );
10691                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
10692                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10693                        Ok(RingBufferRequest::SetActiveChannels {
10694                            active_channels_bitmask: req.active_channels_bitmask,
10695
10696                            responder: RingBufferSetActiveChannelsResponder {
10697                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10698                                tx_id: header.tx_id,
10699                            },
10700                        })
10701                    }
10702                    0x6c1248db213fcf9f => {
10703                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10704                        let mut req = fidl::new_empty!(
10705                            fidl::encoding::EmptyPayload,
10706                            fidl::encoding::DefaultFuchsiaResourceDialect
10707                        );
10708                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10709                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
10710                        Ok(RingBufferRequest::WatchDelayInfo {
10711                            responder: RingBufferWatchDelayInfoResponder {
10712                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10713                                tx_id: header.tx_id,
10714                            },
10715                        })
10716                    }
10717                    _ if header.tx_id == 0
10718                        && header
10719                            .dynamic_flags()
10720                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
10721                    {
10722                        Ok(RingBufferRequest::_UnknownMethod {
10723                            ordinal: header.ordinal,
10724                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
10725                            method_type: fidl::MethodType::OneWay,
10726                        })
10727                    }
10728                    _ if header
10729                        .dynamic_flags()
10730                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
10731                    {
10732                        this.inner.send_framework_err(
10733                            fidl::encoding::FrameworkErr::UnknownMethod,
10734                            header.tx_id,
10735                            header.ordinal,
10736                            header.dynamic_flags(),
10737                            (bytes, handles),
10738                        )?;
10739                        Ok(RingBufferRequest::_UnknownMethod {
10740                            ordinal: header.ordinal,
10741                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
10742                            method_type: fidl::MethodType::TwoWay,
10743                        })
10744                    }
10745                    _ => Err(fidl::Error::UnknownOrdinal {
10746                        ordinal: header.ordinal,
10747                        protocol_name:
10748                            <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10749                    }),
10750                }))
10751            },
10752        )
10753    }
10754}
10755
10756/// Ring buffers are used to convey audio between parties (usually in different processes), allowing
10757/// concurrent, asynchronous data access without requiring locks. This pattern works because both
10758/// parties share an understanding of which buffer areas are safe to access, and how those areas
10759/// change over time.
10760///
10761/// For in-depth description of the responsibilities for both _producers_ and _consumers_,
10762/// before the ring buffer is started as well as while it is active, please see
10763/// [Ring Buffer Behavior](https://fuchsia.dev/fuchsia-src/development/audio/ring_buffer.md).
10764#[derive(Debug)]
10765pub enum RingBufferRequest {
10766    /// Accessor for top level static properties.
10767    GetProperties { responder: RingBufferGetPropertiesResponder },
10768    /// Gets the ring buffer current position via a hanging get.
10769    ///
10770    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
10771    /// `clock_recovery_notifications_per_ring` was specified.
10772    ///
10773    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
10774    /// not respond to subsequent client calls until the position information has changed from what
10775    /// was most recently provided to that client.
10776    ///
10777    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
10778    /// to the `Start` command.
10779    ///
10780    /// At the `start_time` returned by `Start`, position is always 0. From there, it
10781    /// progresses at the rate specified by the rate, sample format (and clock domain,
10782    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
10783    ///
10784    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
10785    /// estimated position to be used for clock recovery at most at
10786    /// `clock_recovery_notifications_per_ring` frequency.
10787    ///
10788    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
10789    /// increasing.
10790    ///
10791    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
10792    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
10793    WatchClockRecoveryPositionInfo { responder: RingBufferWatchClockRecoveryPositionInfoResponder },
10794    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
10795    ///
10796    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
10797    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
10798    ///
10799    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
10800    /// that ring buffer contents can be transfered in and out, or else the call must be failed
10801    /// with GetVmoError.INVALID_ARGS.
10802    ///
10803    /// The driver may increase the ring buffer size beyond `min_frames` plus
10804    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
10805    /// alignment.
10806    ///
10807    /// Clients can treat the entire returned ring buffer as safe to access, except for the
10808    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
10809    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
10810    ///
10811    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
10812    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
10813    /// handle must also include ZX_RIGHT_WRITE.
10814    ///
10815    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
10816    /// `WatchClockRecoveryPositionInfo` client requests at most at
10817    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
10818    /// for clock recovery.
10819    GetVmo {
10820        min_frames: u32,
10821        clock_recovery_notifications_per_ring: u32,
10822        responder: RingBufferGetVmoResponder,
10823    },
10824    /// Start the ring buffer.
10825    ///
10826    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
10827    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
10828    /// write from or to the ring buffer position 0, subject to the overall position and buffering
10829    /// behavior described in 'Ring buffer behavior' below.
10830    ///
10831    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10832    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
10833    /// a second time before the first call has completed, then the channel must be closed with an
10834    /// error `ZX_ERR_BAD_STATE` returned.
10835    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
10836    Start { responder: RingBufferStartResponder },
10837    /// Stop the ring buffer.
10838    ///
10839    /// Once this call's response is received, no further position notifications will be sent until
10840    /// `Start` is called again.
10841    ///
10842    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
10843    Stop { responder: RingBufferStopResponder },
10844    /// Sets which channels are active via a bitmask.
10845    ///
10846    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
10847    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
10848    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
10849    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
10850    /// turns on the hardware associated for all channels.
10851    ///
10852    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
10853    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
10854    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
10855    ///
10856    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
10857    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
10858    /// buffer's position advances (and position notifications sent as needed) regardless of the
10859    /// number of active channels, including if no channels are active. This means that the format
10860    /// in the ring buffer is not changed.
10861    ///
10862    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
10863    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
10864    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
10865    ///
10866    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
10867    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
10868    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
10869    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
10870    /// hardware configuration was completed. If the requested channel configuration is already
10871    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
10872    /// before the reply is sent. If called again with the same configuration, the reply must
10873    /// include the same `set_time` value as was previously returned.
10874    ///
10875    /// For input channels, it is not required that the driver zero-out inactive channels.
10876    ///
10877    /// If `SetActiveChannels` is called for a second time before the first call has completed,
10878    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10879    SetActiveChannels {
10880        active_channels_bitmask: u64,
10881        responder: RingBufferSetActiveChannelsResponder,
10882    },
10883    /// Get information about delays via a hanging get.
10884    ///
10885    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
10886    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
10887    /// changes from what was most recently reported.
10888    ///
10889    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
10890    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
10891    WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
10892    /// An interaction was received which does not match any known method.
10893    #[non_exhaustive]
10894    _UnknownMethod {
10895        /// Ordinal of the method that was called.
10896        ordinal: u64,
10897        control_handle: RingBufferControlHandle,
10898        method_type: fidl::MethodType,
10899    },
10900}
10901
10902impl RingBufferRequest {
10903    #[allow(irrefutable_let_patterns)]
10904    pub fn into_get_properties(self) -> Option<(RingBufferGetPropertiesResponder)> {
10905        if let RingBufferRequest::GetProperties { responder } = self {
10906            Some((responder))
10907        } else {
10908            None
10909        }
10910    }
10911
10912    #[allow(irrefutable_let_patterns)]
10913    pub fn into_watch_clock_recovery_position_info(
10914        self,
10915    ) -> Option<(RingBufferWatchClockRecoveryPositionInfoResponder)> {
10916        if let RingBufferRequest::WatchClockRecoveryPositionInfo { responder } = self {
10917            Some((responder))
10918        } else {
10919            None
10920        }
10921    }
10922
10923    #[allow(irrefutable_let_patterns)]
10924    pub fn into_get_vmo(self) -> Option<(u32, u32, RingBufferGetVmoResponder)> {
10925        if let RingBufferRequest::GetVmo {
10926            min_frames,
10927            clock_recovery_notifications_per_ring,
10928            responder,
10929        } = self
10930        {
10931            Some((min_frames, clock_recovery_notifications_per_ring, responder))
10932        } else {
10933            None
10934        }
10935    }
10936
10937    #[allow(irrefutable_let_patterns)]
10938    pub fn into_start(self) -> Option<(RingBufferStartResponder)> {
10939        if let RingBufferRequest::Start { responder } = self { Some((responder)) } else { None }
10940    }
10941
10942    #[allow(irrefutable_let_patterns)]
10943    pub fn into_stop(self) -> Option<(RingBufferStopResponder)> {
10944        if let RingBufferRequest::Stop { responder } = self { Some((responder)) } else { None }
10945    }
10946
10947    #[allow(irrefutable_let_patterns)]
10948    pub fn into_set_active_channels(self) -> Option<(u64, RingBufferSetActiveChannelsResponder)> {
10949        if let RingBufferRequest::SetActiveChannels { active_channels_bitmask, responder } = self {
10950            Some((active_channels_bitmask, responder))
10951        } else {
10952            None
10953        }
10954    }
10955
10956    #[allow(irrefutable_let_patterns)]
10957    pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
10958        if let RingBufferRequest::WatchDelayInfo { responder } = self {
10959            Some((responder))
10960        } else {
10961            None
10962        }
10963    }
10964
10965    /// Name of the method defined in FIDL
10966    pub fn method_name(&self) -> &'static str {
10967        match *self {
10968            RingBufferRequest::GetProperties { .. } => "get_properties",
10969            RingBufferRequest::WatchClockRecoveryPositionInfo { .. } => {
10970                "watch_clock_recovery_position_info"
10971            }
10972            RingBufferRequest::GetVmo { .. } => "get_vmo",
10973            RingBufferRequest::Start { .. } => "start",
10974            RingBufferRequest::Stop { .. } => "stop",
10975            RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
10976            RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
10977            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
10978                "unknown one-way method"
10979            }
10980            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
10981                "unknown two-way method"
10982            }
10983        }
10984    }
10985}
10986
10987#[derive(Debug, Clone)]
10988pub struct RingBufferControlHandle {
10989    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10990}
10991
10992impl RingBufferControlHandle {
10993    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
10994        self.inner.shutdown_with_epitaph(status.into())
10995    }
10996}
10997
10998impl fidl::endpoints::ControlHandle for RingBufferControlHandle {
10999    fn shutdown(&self) {
11000        self.inner.shutdown()
11001    }
11002
11003    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
11004        self.inner.shutdown_with_epitaph(status)
11005    }
11006
11007    fn is_closed(&self) -> bool {
11008        self.inner.channel().is_closed()
11009    }
11010    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11011        self.inner.channel().on_closed()
11012    }
11013
11014    #[cfg(target_os = "fuchsia")]
11015    fn signal_peer(
11016        &self,
11017        clear_mask: zx::Signals,
11018        set_mask: zx::Signals,
11019    ) -> Result<(), zx_status::Status> {
11020        use fidl::Peered;
11021        self.inner.channel().signal_peer(clear_mask, set_mask)
11022    }
11023}
11024
11025impl RingBufferControlHandle {}
11026
11027#[must_use = "FIDL methods require a response to be sent"]
11028#[derive(Debug)]
11029pub struct RingBufferGetPropertiesResponder {
11030    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11031    tx_id: u32,
11032}
11033
11034/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11035/// if the responder is dropped without sending a response, so that the client
11036/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11037impl std::ops::Drop for RingBufferGetPropertiesResponder {
11038    fn drop(&mut self) {
11039        self.control_handle.shutdown();
11040        // Safety: drops once, never accessed again
11041        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11042    }
11043}
11044
11045impl fidl::endpoints::Responder for RingBufferGetPropertiesResponder {
11046    type ControlHandle = RingBufferControlHandle;
11047
11048    fn control_handle(&self) -> &RingBufferControlHandle {
11049        &self.control_handle
11050    }
11051
11052    fn drop_without_shutdown(mut self) {
11053        // Safety: drops once, never accessed again due to mem::forget
11054        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11055        // Prevent Drop from running (which would shut down the channel)
11056        std::mem::forget(self);
11057    }
11058}
11059
11060impl RingBufferGetPropertiesResponder {
11061    /// Sends a response to the FIDL transaction.
11062    ///
11063    /// Sets the channel to shutdown if an error occurs.
11064    pub fn send(self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
11065        let _result = self.send_raw(properties);
11066        if _result.is_err() {
11067            self.control_handle.shutdown();
11068        }
11069        self.drop_without_shutdown();
11070        _result
11071    }
11072
11073    /// Similar to "send" but does not shutdown the channel if an error occurs.
11074    pub fn send_no_shutdown_on_err(
11075        self,
11076        mut properties: &RingBufferProperties,
11077    ) -> Result<(), fidl::Error> {
11078        let _result = self.send_raw(properties);
11079        self.drop_without_shutdown();
11080        _result
11081    }
11082
11083    fn send_raw(&self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
11084        self.control_handle.inner.send::<RingBufferGetPropertiesResponse>(
11085            (properties,),
11086            self.tx_id,
11087            0x12947f061a8fe1,
11088            fidl::encoding::DynamicFlags::empty(),
11089        )
11090    }
11091}
11092
11093#[must_use = "FIDL methods require a response to be sent"]
11094#[derive(Debug)]
11095pub struct RingBufferWatchClockRecoveryPositionInfoResponder {
11096    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11097    tx_id: u32,
11098}
11099
11100/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11101/// if the responder is dropped without sending a response, so that the client
11102/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11103impl std::ops::Drop for RingBufferWatchClockRecoveryPositionInfoResponder {
11104    fn drop(&mut self) {
11105        self.control_handle.shutdown();
11106        // Safety: drops once, never accessed again
11107        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11108    }
11109}
11110
11111impl fidl::endpoints::Responder for RingBufferWatchClockRecoveryPositionInfoResponder {
11112    type ControlHandle = RingBufferControlHandle;
11113
11114    fn control_handle(&self) -> &RingBufferControlHandle {
11115        &self.control_handle
11116    }
11117
11118    fn drop_without_shutdown(mut self) {
11119        // Safety: drops once, never accessed again due to mem::forget
11120        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11121        // Prevent Drop from running (which would shut down the channel)
11122        std::mem::forget(self);
11123    }
11124}
11125
11126impl RingBufferWatchClockRecoveryPositionInfoResponder {
11127    /// Sends a response to the FIDL transaction.
11128    ///
11129    /// Sets the channel to shutdown if an error occurs.
11130    pub fn send(self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
11131        let _result = self.send_raw(position_info);
11132        if _result.is_err() {
11133            self.control_handle.shutdown();
11134        }
11135        self.drop_without_shutdown();
11136        _result
11137    }
11138
11139    /// Similar to "send" but does not shutdown the channel if an error occurs.
11140    pub fn send_no_shutdown_on_err(
11141        self,
11142        mut position_info: &RingBufferPositionInfo,
11143    ) -> Result<(), fidl::Error> {
11144        let _result = self.send_raw(position_info);
11145        self.drop_without_shutdown();
11146        _result
11147    }
11148
11149    fn send_raw(&self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
11150        self.control_handle.inner.send::<RingBufferWatchClockRecoveryPositionInfoResponse>(
11151            (position_info,),
11152            self.tx_id,
11153            0x694d5b898a4167e5,
11154            fidl::encoding::DynamicFlags::empty(),
11155        )
11156    }
11157}
11158
11159#[must_use = "FIDL methods require a response to be sent"]
11160#[derive(Debug)]
11161pub struct RingBufferGetVmoResponder {
11162    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11163    tx_id: u32,
11164}
11165
11166/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11167/// if the responder is dropped without sending a response, so that the client
11168/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11169impl std::ops::Drop for RingBufferGetVmoResponder {
11170    fn drop(&mut self) {
11171        self.control_handle.shutdown();
11172        // Safety: drops once, never accessed again
11173        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11174    }
11175}
11176
11177impl fidl::endpoints::Responder for RingBufferGetVmoResponder {
11178    type ControlHandle = RingBufferControlHandle;
11179
11180    fn control_handle(&self) -> &RingBufferControlHandle {
11181        &self.control_handle
11182    }
11183
11184    fn drop_without_shutdown(mut self) {
11185        // Safety: drops once, never accessed again due to mem::forget
11186        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11187        // Prevent Drop from running (which would shut down the channel)
11188        std::mem::forget(self);
11189    }
11190}
11191
11192impl RingBufferGetVmoResponder {
11193    /// Sends a response to the FIDL transaction.
11194    ///
11195    /// Sets the channel to shutdown if an error occurs.
11196    pub fn send(
11197        self,
11198        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11199    ) -> Result<(), fidl::Error> {
11200        let _result = self.send_raw(result);
11201        if _result.is_err() {
11202            self.control_handle.shutdown();
11203        }
11204        self.drop_without_shutdown();
11205        _result
11206    }
11207
11208    /// Similar to "send" but does not shutdown the channel if an error occurs.
11209    pub fn send_no_shutdown_on_err(
11210        self,
11211        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11212    ) -> Result<(), fidl::Error> {
11213        let _result = self.send_raw(result);
11214        self.drop_without_shutdown();
11215        _result
11216    }
11217
11218    fn send_raw(
11219        &self,
11220        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
11221    ) -> Result<(), fidl::Error> {
11222        self.control_handle
11223            .inner
11224            .send::<fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>>(
11225                result,
11226                self.tx_id,
11227                0x44c8f4f5680e853a,
11228                fidl::encoding::DynamicFlags::empty(),
11229            )
11230    }
11231}
11232
11233#[must_use = "FIDL methods require a response to be sent"]
11234#[derive(Debug)]
11235pub struct RingBufferStartResponder {
11236    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11237    tx_id: u32,
11238}
11239
11240/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11241/// if the responder is dropped without sending a response, so that the client
11242/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11243impl std::ops::Drop for RingBufferStartResponder {
11244    fn drop(&mut self) {
11245        self.control_handle.shutdown();
11246        // Safety: drops once, never accessed again
11247        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11248    }
11249}
11250
11251impl fidl::endpoints::Responder for RingBufferStartResponder {
11252    type ControlHandle = RingBufferControlHandle;
11253
11254    fn control_handle(&self) -> &RingBufferControlHandle {
11255        &self.control_handle
11256    }
11257
11258    fn drop_without_shutdown(mut self) {
11259        // Safety: drops once, never accessed again due to mem::forget
11260        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11261        // Prevent Drop from running (which would shut down the channel)
11262        std::mem::forget(self);
11263    }
11264}
11265
11266impl RingBufferStartResponder {
11267    /// Sends a response to the FIDL transaction.
11268    ///
11269    /// Sets the channel to shutdown if an error occurs.
11270    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
11271        let _result = self.send_raw(start_time);
11272        if _result.is_err() {
11273            self.control_handle.shutdown();
11274        }
11275        self.drop_without_shutdown();
11276        _result
11277    }
11278
11279    /// Similar to "send" but does not shutdown the channel if an error occurs.
11280    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
11281        let _result = self.send_raw(start_time);
11282        self.drop_without_shutdown();
11283        _result
11284    }
11285
11286    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
11287        self.control_handle.inner.send::<RingBufferStartResponse>(
11288            (start_time,),
11289            self.tx_id,
11290            0x5dd780a769a8892d,
11291            fidl::encoding::DynamicFlags::empty(),
11292        )
11293    }
11294}
11295
11296#[must_use = "FIDL methods require a response to be sent"]
11297#[derive(Debug)]
11298pub struct RingBufferStopResponder {
11299    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11300    tx_id: u32,
11301}
11302
11303/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11304/// if the responder is dropped without sending a response, so that the client
11305/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11306impl std::ops::Drop for RingBufferStopResponder {
11307    fn drop(&mut self) {
11308        self.control_handle.shutdown();
11309        // Safety: drops once, never accessed again
11310        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11311    }
11312}
11313
11314impl fidl::endpoints::Responder for RingBufferStopResponder {
11315    type ControlHandle = RingBufferControlHandle;
11316
11317    fn control_handle(&self) -> &RingBufferControlHandle {
11318        &self.control_handle
11319    }
11320
11321    fn drop_without_shutdown(mut self) {
11322        // Safety: drops once, never accessed again due to mem::forget
11323        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11324        // Prevent Drop from running (which would shut down the channel)
11325        std::mem::forget(self);
11326    }
11327}
11328
11329impl RingBufferStopResponder {
11330    /// Sends a response to the FIDL transaction.
11331    ///
11332    /// Sets the channel to shutdown if an error occurs.
11333    pub fn send(self) -> Result<(), fidl::Error> {
11334        let _result = self.send_raw();
11335        if _result.is_err() {
11336            self.control_handle.shutdown();
11337        }
11338        self.drop_without_shutdown();
11339        _result
11340    }
11341
11342    /// Similar to "send" but does not shutdown the channel if an error occurs.
11343    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11344        let _result = self.send_raw();
11345        self.drop_without_shutdown();
11346        _result
11347    }
11348
11349    fn send_raw(&self) -> Result<(), fidl::Error> {
11350        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11351            (),
11352            self.tx_id,
11353            0x49a73d9cf1d4e110,
11354            fidl::encoding::DynamicFlags::empty(),
11355        )
11356    }
11357}
11358
11359#[must_use = "FIDL methods require a response to be sent"]
11360#[derive(Debug)]
11361pub struct RingBufferSetActiveChannelsResponder {
11362    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11363    tx_id: u32,
11364}
11365
11366/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11367/// if the responder is dropped without sending a response, so that the client
11368/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11369impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
11370    fn drop(&mut self) {
11371        self.control_handle.shutdown();
11372        // Safety: drops once, never accessed again
11373        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11374    }
11375}
11376
11377impl fidl::endpoints::Responder for RingBufferSetActiveChannelsResponder {
11378    type ControlHandle = RingBufferControlHandle;
11379
11380    fn control_handle(&self) -> &RingBufferControlHandle {
11381        &self.control_handle
11382    }
11383
11384    fn drop_without_shutdown(mut self) {
11385        // Safety: drops once, never accessed again due to mem::forget
11386        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11387        // Prevent Drop from running (which would shut down the channel)
11388        std::mem::forget(self);
11389    }
11390}
11391
11392impl RingBufferSetActiveChannelsResponder {
11393    /// Sends a response to the FIDL transaction.
11394    ///
11395    /// Sets the channel to shutdown if an error occurs.
11396    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11397        let _result = self.send_raw(result);
11398        if _result.is_err() {
11399            self.control_handle.shutdown();
11400        }
11401        self.drop_without_shutdown();
11402        _result
11403    }
11404
11405    /// Similar to "send" but does not shutdown the channel if an error occurs.
11406    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11407        let _result = self.send_raw(result);
11408        self.drop_without_shutdown();
11409        _result
11410    }
11411
11412    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
11413        self.control_handle.inner.send::<fidl::encoding::ResultType<
11414            RingBufferSetActiveChannelsResponse,
11415            i32,
11416        >>(
11417            result.map(|set_time| (set_time,)),
11418            self.tx_id,
11419            0x605464c1d384f309,
11420            fidl::encoding::DynamicFlags::empty(),
11421        )
11422    }
11423}
11424
11425#[must_use = "FIDL methods require a response to be sent"]
11426#[derive(Debug)]
11427pub struct RingBufferWatchDelayInfoResponder {
11428    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
11429    tx_id: u32,
11430}
11431
11432/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
11433/// if the responder is dropped without sending a response, so that the client
11434/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11435impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
11436    fn drop(&mut self) {
11437        self.control_handle.shutdown();
11438        // Safety: drops once, never accessed again
11439        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11440    }
11441}
11442
11443impl fidl::endpoints::Responder for RingBufferWatchDelayInfoResponder {
11444    type ControlHandle = RingBufferControlHandle;
11445
11446    fn control_handle(&self) -> &RingBufferControlHandle {
11447        &self.control_handle
11448    }
11449
11450    fn drop_without_shutdown(mut self) {
11451        // Safety: drops once, never accessed again due to mem::forget
11452        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11453        // Prevent Drop from running (which would shut down the channel)
11454        std::mem::forget(self);
11455    }
11456}
11457
11458impl RingBufferWatchDelayInfoResponder {
11459    /// Sends a response to the FIDL transaction.
11460    ///
11461    /// Sets the channel to shutdown if an error occurs.
11462    pub fn send(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11463        let _result = self.send_raw(delay_info);
11464        if _result.is_err() {
11465            self.control_handle.shutdown();
11466        }
11467        self.drop_without_shutdown();
11468        _result
11469    }
11470
11471    /// Similar to "send" but does not shutdown the channel if an error occurs.
11472    pub fn send_no_shutdown_on_err(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11473        let _result = self.send_raw(delay_info);
11474        self.drop_without_shutdown();
11475        _result
11476    }
11477
11478    fn send_raw(&self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
11479        self.control_handle
11480            .inner
11481            .send::<fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>>(
11482                fidl::encoding::Flexible::new((delay_info,)),
11483                self.tx_id,
11484                0x6c1248db213fcf9f,
11485                fidl::encoding::DynamicFlags::FLEXIBLE,
11486            )
11487    }
11488}
11489
11490#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11491pub struct StreamConfigMarker;
11492
11493impl fidl::endpoints::ProtocolMarker for StreamConfigMarker {
11494    type Proxy = StreamConfigProxy;
11495    type RequestStream = StreamConfigRequestStream;
11496    #[cfg(target_os = "fuchsia")]
11497    type SynchronousProxy = StreamConfigSynchronousProxy;
11498
11499    const DEBUG_NAME: &'static str = "(anonymous) StreamConfig";
11500}
11501
11502pub trait StreamConfigProxyInterface: Send + Sync {
11503    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
11504        + Send;
11505    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
11506    fn r#signal_processing_connect(
11507        &self,
11508        protocol: fidl::endpoints::ServerEnd<
11509            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11510        >,
11511    ) -> Result<(), fidl::Error>;
11512    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
11513        + Send;
11514    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
11515    type GetSupportedFormatsResponseFut: std::future::Future<Output = Result<Vec<SupportedFormats>, fidl::Error>>
11516        + Send;
11517    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut;
11518    fn r#create_ring_buffer(
11519        &self,
11520        format: &Format,
11521        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11522    ) -> Result<(), fidl::Error>;
11523    type WatchGainStateResponseFut: std::future::Future<Output = Result<GainState, fidl::Error>>
11524        + Send;
11525    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut;
11526    fn r#set_gain(&self, target_state: &GainState) -> Result<(), fidl::Error>;
11527    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
11528        + Send;
11529    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
11530}
11531#[derive(Debug)]
11532#[cfg(target_os = "fuchsia")]
11533pub struct StreamConfigSynchronousProxy {
11534    client: fidl::client::sync::Client,
11535}
11536
11537#[cfg(target_os = "fuchsia")]
11538impl fidl::endpoints::SynchronousProxy for StreamConfigSynchronousProxy {
11539    type Proxy = StreamConfigProxy;
11540    type Protocol = StreamConfigMarker;
11541
11542    fn from_channel(inner: fidl::Channel) -> Self {
11543        Self::new(inner)
11544    }
11545
11546    fn into_channel(self) -> fidl::Channel {
11547        self.client.into_channel()
11548    }
11549
11550    fn as_channel(&self) -> &fidl::Channel {
11551        self.client.as_channel()
11552    }
11553}
11554
11555#[cfg(target_os = "fuchsia")]
11556impl StreamConfigSynchronousProxy {
11557    pub fn new(channel: fidl::Channel) -> Self {
11558        Self { client: fidl::client::sync::Client::new(channel) }
11559    }
11560
11561    pub fn into_channel(self) -> fidl::Channel {
11562        self.client.into_channel()
11563    }
11564
11565    /// Waits until an event arrives and returns it. It is safe for other
11566    /// threads to make concurrent requests while waiting for an event.
11567    pub fn wait_for_event(
11568        &self,
11569        deadline: zx::MonotonicInstant,
11570    ) -> Result<StreamConfigEvent, fidl::Error> {
11571        StreamConfigEvent::decode(self.client.wait_for_event::<StreamConfigMarker>(deadline)?)
11572    }
11573
11574    /// Retrieves top level health state.
11575    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
11576    pub fn r#get_health_state(
11577        &self,
11578        ___deadline: zx::MonotonicInstant,
11579    ) -> Result<HealthState, fidl::Error> {
11580        let _response = self.client.send_query::<
11581            fidl::encoding::EmptyPayload,
11582            HealthGetHealthStateResponse,
11583            StreamConfigMarker,
11584        >(
11585            (),
11586            0x4e146d6bca733a84,
11587            fidl::encoding::DynamicFlags::empty(),
11588            ___deadline,
11589        )?;
11590        Ok(_response.state)
11591    }
11592
11593    /// Connect to a `SignalProcessing` protocol.
11594    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
11595    /// the maximum number of connections have already been created, for instance one, then the
11596    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
11597    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
11598    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
11599    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
11600    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
11601    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
11602    /// is intended to be composed, and hence the more verbose name allows differentiation and
11603    /// improved clarity.
11604    pub fn r#signal_processing_connect(
11605        &self,
11606        mut protocol: fidl::endpoints::ServerEnd<
11607            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11608        >,
11609    ) -> Result<(), fidl::Error> {
11610        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
11611            (protocol,),
11612            0xa81907ce6066295,
11613            fidl::encoding::DynamicFlags::empty(),
11614        )
11615    }
11616
11617    /// Retrieves top level static properties.
11618    pub fn r#get_properties(
11619        &self,
11620        ___deadline: zx::MonotonicInstant,
11621    ) -> Result<StreamProperties, fidl::Error> {
11622        let _response = self.client.send_query::<
11623            fidl::encoding::EmptyPayload,
11624            StreamConfigGetPropertiesResponse,
11625            StreamConfigMarker,
11626        >(
11627            (),
11628            0x7d89c02f3e2d3c01,
11629            fidl::encoding::DynamicFlags::empty(),
11630            ___deadline,
11631        )?;
11632        Ok(_response.properties)
11633    }
11634
11635    /// Gets formats supported by a given driver. When not all combinations supported by the
11636    /// driver can be described with one `SupportedFormats`, the driver returns more than one
11637    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
11638    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
11639    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
11640    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
11641    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
11642    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
11643    /// <<16bits,32bits>,<48KHz,96KHz>>.
11644    pub fn r#get_supported_formats(
11645        &self,
11646        ___deadline: zx::MonotonicInstant,
11647    ) -> Result<Vec<SupportedFormats>, fidl::Error> {
11648        let _response = self.client.send_query::<
11649            fidl::encoding::EmptyPayload,
11650            StreamConfigGetSupportedFormatsResponse,
11651            StreamConfigMarker,
11652        >(
11653            (),
11654            0x448efa7850cafe7e,
11655            fidl::encoding::DynamicFlags::empty(),
11656            ___deadline,
11657        )?;
11658        Ok(_response.supported_formats)
11659    }
11660
11661    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
11662    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
11663    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
11664    /// ring buffer channel had been established and was still active, the driver must close that
11665    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
11666    /// operations in the process.
11667    pub fn r#create_ring_buffer(
11668        &self,
11669        mut format: &Format,
11670        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11671    ) -> Result<(), fidl::Error> {
11672        self.client.send::<StreamConfigCreateRingBufferRequest>(
11673            (format, ring_buffer),
11674            0x2afb19dd13faa1ba,
11675            fidl::encoding::DynamicFlags::empty(),
11676        )
11677    }
11678
11679    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
11680    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
11681    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
11682    /// from what was most recently reported.
11683    /// If `WatchGainState` is called for a second time before the first call has completed, then
11684    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11685    pub fn r#watch_gain_state(
11686        &self,
11687        ___deadline: zx::MonotonicInstant,
11688    ) -> Result<GainState, fidl::Error> {
11689        let _response = self.client.send_query::<
11690            fidl::encoding::EmptyPayload,
11691            StreamConfigWatchGainStateResponse,
11692            StreamConfigMarker,
11693        >(
11694            (),
11695            0x4772506136ab65c1,
11696            fidl::encoding::DynamicFlags::empty(),
11697            ___deadline,
11698        )?;
11699        Ok(_response.gain_state)
11700    }
11701
11702    /// Client update of the gain state.
11703    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
11704        self.client.send::<StreamConfigSetGainRequest>(
11705            (target_state,),
11706            0x3943b41498c6a384,
11707            fidl::encoding::DynamicFlags::empty(),
11708        )
11709    }
11710
11711    /// Get the plug detect state via a hanging get. The driver will reply to the first
11712    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
11713    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
11714    /// If `WatchPlugState` is called for a second time before the first call has completed, then
11715    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11716    pub fn r#watch_plug_state(
11717        &self,
11718        ___deadline: zx::MonotonicInstant,
11719    ) -> Result<PlugState, fidl::Error> {
11720        let _response = self.client.send_query::<
11721            fidl::encoding::EmptyPayload,
11722            StreamConfigWatchPlugStateResponse,
11723            StreamConfigMarker,
11724        >(
11725            (),
11726            0x497345a6f048b2a6,
11727            fidl::encoding::DynamicFlags::empty(),
11728            ___deadline,
11729        )?;
11730        Ok(_response.plug_state)
11731    }
11732}
11733
11734#[cfg(target_os = "fuchsia")]
11735impl From<StreamConfigSynchronousProxy> for zx::NullableHandle {
11736    fn from(value: StreamConfigSynchronousProxy) -> Self {
11737        value.into_channel().into()
11738    }
11739}
11740
11741#[cfg(target_os = "fuchsia")]
11742impl From<fidl::Channel> for StreamConfigSynchronousProxy {
11743    fn from(value: fidl::Channel) -> Self {
11744        Self::new(value)
11745    }
11746}
11747
11748#[cfg(target_os = "fuchsia")]
11749impl fidl::endpoints::FromClient for StreamConfigSynchronousProxy {
11750    type Protocol = StreamConfigMarker;
11751
11752    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigMarker>) -> Self {
11753        Self::new(value.into_channel())
11754    }
11755}
11756
11757#[derive(Debug, Clone)]
11758pub struct StreamConfigProxy {
11759    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11760}
11761
11762impl fidl::endpoints::Proxy for StreamConfigProxy {
11763    type Protocol = StreamConfigMarker;
11764
11765    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11766        Self::new(inner)
11767    }
11768
11769    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11770        self.client.into_channel().map_err(|client| Self { client })
11771    }
11772
11773    fn as_channel(&self) -> &::fidl::AsyncChannel {
11774        self.client.as_channel()
11775    }
11776}
11777
11778impl StreamConfigProxy {
11779    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfig.
11780    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11781        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11782        Self { client: fidl::client::Client::new(channel, protocol_name) }
11783    }
11784
11785    /// Get a Stream of events from the remote end of the protocol.
11786    ///
11787    /// # Panics
11788    ///
11789    /// Panics if the event stream was already taken.
11790    pub fn take_event_stream(&self) -> StreamConfigEventStream {
11791        StreamConfigEventStream { event_receiver: self.client.take_event_receiver() }
11792    }
11793
11794    /// Retrieves top level health state.
11795    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
11796    pub fn r#get_health_state(
11797        &self,
11798    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
11799    {
11800        StreamConfigProxyInterface::r#get_health_state(self)
11801    }
11802
11803    /// Connect to a `SignalProcessing` protocol.
11804    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
11805    /// the maximum number of connections have already been created, for instance one, then the
11806    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
11807    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
11808    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
11809    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
11810    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
11811    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
11812    /// is intended to be composed, and hence the more verbose name allows differentiation and
11813    /// improved clarity.
11814    pub fn r#signal_processing_connect(
11815        &self,
11816        mut protocol: fidl::endpoints::ServerEnd<
11817            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11818        >,
11819    ) -> Result<(), fidl::Error> {
11820        StreamConfigProxyInterface::r#signal_processing_connect(self, protocol)
11821    }
11822
11823    /// Retrieves top level static properties.
11824    pub fn r#get_properties(
11825        &self,
11826    ) -> fidl::client::QueryResponseFut<
11827        StreamProperties,
11828        fidl::encoding::DefaultFuchsiaResourceDialect,
11829    > {
11830        StreamConfigProxyInterface::r#get_properties(self)
11831    }
11832
11833    /// Gets formats supported by a given driver. When not all combinations supported by the
11834    /// driver can be described with one `SupportedFormats`, the driver returns more than one
11835    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
11836    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
11837    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
11838    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
11839    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
11840    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
11841    /// <<16bits,32bits>,<48KHz,96KHz>>.
11842    pub fn r#get_supported_formats(
11843        &self,
11844    ) -> fidl::client::QueryResponseFut<
11845        Vec<SupportedFormats>,
11846        fidl::encoding::DefaultFuchsiaResourceDialect,
11847    > {
11848        StreamConfigProxyInterface::r#get_supported_formats(self)
11849    }
11850
11851    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
11852    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
11853    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
11854    /// ring buffer channel had been established and was still active, the driver must close that
11855    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
11856    /// operations in the process.
11857    pub fn r#create_ring_buffer(
11858        &self,
11859        mut format: &Format,
11860        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11861    ) -> Result<(), fidl::Error> {
11862        StreamConfigProxyInterface::r#create_ring_buffer(self, format, ring_buffer)
11863    }
11864
11865    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
11866    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
11867    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
11868    /// from what was most recently reported.
11869    /// If `WatchGainState` is called for a second time before the first call has completed, then
11870    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11871    pub fn r#watch_gain_state(
11872        &self,
11873    ) -> fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>
11874    {
11875        StreamConfigProxyInterface::r#watch_gain_state(self)
11876    }
11877
11878    /// Client update of the gain state.
11879    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
11880        StreamConfigProxyInterface::r#set_gain(self, target_state)
11881    }
11882
11883    /// Get the plug detect state via a hanging get. The driver will reply to the first
11884    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
11885    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
11886    /// If `WatchPlugState` is called for a second time before the first call has completed, then
11887    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
11888    pub fn r#watch_plug_state(
11889        &self,
11890    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
11891    {
11892        StreamConfigProxyInterface::r#watch_plug_state(self)
11893    }
11894}
11895
11896impl StreamConfigProxyInterface for StreamConfigProxy {
11897    type GetHealthStateResponseFut =
11898        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
11899    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
11900        fn _decode(
11901            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11902        ) -> Result<HealthState, fidl::Error> {
11903            let _response = fidl::client::decode_transaction_body::<
11904                HealthGetHealthStateResponse,
11905                fidl::encoding::DefaultFuchsiaResourceDialect,
11906                0x4e146d6bca733a84,
11907            >(_buf?)?;
11908            Ok(_response.state)
11909        }
11910        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
11911            (),
11912            0x4e146d6bca733a84,
11913            fidl::encoding::DynamicFlags::empty(),
11914            _decode,
11915        )
11916    }
11917
11918    fn r#signal_processing_connect(
11919        &self,
11920        mut protocol: fidl::endpoints::ServerEnd<
11921            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
11922        >,
11923    ) -> Result<(), fidl::Error> {
11924        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
11925            (protocol,),
11926            0xa81907ce6066295,
11927            fidl::encoding::DynamicFlags::empty(),
11928        )
11929    }
11930
11931    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
11932        StreamProperties,
11933        fidl::encoding::DefaultFuchsiaResourceDialect,
11934    >;
11935    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
11936        fn _decode(
11937            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11938        ) -> Result<StreamProperties, fidl::Error> {
11939            let _response = fidl::client::decode_transaction_body::<
11940                StreamConfigGetPropertiesResponse,
11941                fidl::encoding::DefaultFuchsiaResourceDialect,
11942                0x7d89c02f3e2d3c01,
11943            >(_buf?)?;
11944            Ok(_response.properties)
11945        }
11946        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
11947            (),
11948            0x7d89c02f3e2d3c01,
11949            fidl::encoding::DynamicFlags::empty(),
11950            _decode,
11951        )
11952    }
11953
11954    type GetSupportedFormatsResponseFut = fidl::client::QueryResponseFut<
11955        Vec<SupportedFormats>,
11956        fidl::encoding::DefaultFuchsiaResourceDialect,
11957    >;
11958    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut {
11959        fn _decode(
11960            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11961        ) -> Result<Vec<SupportedFormats>, fidl::Error> {
11962            let _response = fidl::client::decode_transaction_body::<
11963                StreamConfigGetSupportedFormatsResponse,
11964                fidl::encoding::DefaultFuchsiaResourceDialect,
11965                0x448efa7850cafe7e,
11966            >(_buf?)?;
11967            Ok(_response.supported_formats)
11968        }
11969        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<SupportedFormats>>(
11970            (),
11971            0x448efa7850cafe7e,
11972            fidl::encoding::DynamicFlags::empty(),
11973            _decode,
11974        )
11975    }
11976
11977    fn r#create_ring_buffer(
11978        &self,
11979        mut format: &Format,
11980        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
11981    ) -> Result<(), fidl::Error> {
11982        self.client.send::<StreamConfigCreateRingBufferRequest>(
11983            (format, ring_buffer),
11984            0x2afb19dd13faa1ba,
11985            fidl::encoding::DynamicFlags::empty(),
11986        )
11987    }
11988
11989    type WatchGainStateResponseFut =
11990        fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>;
11991    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut {
11992        fn _decode(
11993            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11994        ) -> Result<GainState, fidl::Error> {
11995            let _response = fidl::client::decode_transaction_body::<
11996                StreamConfigWatchGainStateResponse,
11997                fidl::encoding::DefaultFuchsiaResourceDialect,
11998                0x4772506136ab65c1,
11999            >(_buf?)?;
12000            Ok(_response.gain_state)
12001        }
12002        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GainState>(
12003            (),
12004            0x4772506136ab65c1,
12005            fidl::encoding::DynamicFlags::empty(),
12006            _decode,
12007        )
12008    }
12009
12010    fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
12011        self.client.send::<StreamConfigSetGainRequest>(
12012            (target_state,),
12013            0x3943b41498c6a384,
12014            fidl::encoding::DynamicFlags::empty(),
12015        )
12016    }
12017
12018    type WatchPlugStateResponseFut =
12019        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
12020    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
12021        fn _decode(
12022            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12023        ) -> Result<PlugState, fidl::Error> {
12024            let _response = fidl::client::decode_transaction_body::<
12025                StreamConfigWatchPlugStateResponse,
12026                fidl::encoding::DefaultFuchsiaResourceDialect,
12027                0x497345a6f048b2a6,
12028            >(_buf?)?;
12029            Ok(_response.plug_state)
12030        }
12031        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
12032            (),
12033            0x497345a6f048b2a6,
12034            fidl::encoding::DynamicFlags::empty(),
12035            _decode,
12036        )
12037    }
12038}
12039
12040pub struct StreamConfigEventStream {
12041    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12042}
12043
12044impl std::marker::Unpin for StreamConfigEventStream {}
12045
12046impl futures::stream::FusedStream for StreamConfigEventStream {
12047    fn is_terminated(&self) -> bool {
12048        self.event_receiver.is_terminated()
12049    }
12050}
12051
12052impl futures::Stream for StreamConfigEventStream {
12053    type Item = Result<StreamConfigEvent, fidl::Error>;
12054
12055    fn poll_next(
12056        mut self: std::pin::Pin<&mut Self>,
12057        cx: &mut std::task::Context<'_>,
12058    ) -> std::task::Poll<Option<Self::Item>> {
12059        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12060            &mut self.event_receiver,
12061            cx
12062        )?) {
12063            Some(buf) => std::task::Poll::Ready(Some(StreamConfigEvent::decode(buf))),
12064            None => std::task::Poll::Ready(None),
12065        }
12066    }
12067}
12068
12069#[derive(Debug)]
12070pub enum StreamConfigEvent {}
12071
12072impl StreamConfigEvent {
12073    /// Decodes a message buffer as a [`StreamConfigEvent`].
12074    fn decode(
12075        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12076    ) -> Result<StreamConfigEvent, fidl::Error> {
12077        let (bytes, _handles) = buf.split_mut();
12078        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12079        debug_assert_eq!(tx_header.tx_id, 0);
12080        match tx_header.ordinal {
12081            _ => Err(fidl::Error::UnknownOrdinal {
12082                ordinal: tx_header.ordinal,
12083                protocol_name: <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12084            }),
12085        }
12086    }
12087}
12088
12089/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfig.
12090pub struct StreamConfigRequestStream {
12091    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12092    is_terminated: bool,
12093}
12094
12095impl std::marker::Unpin for StreamConfigRequestStream {}
12096
12097impl futures::stream::FusedStream for StreamConfigRequestStream {
12098    fn is_terminated(&self) -> bool {
12099        self.is_terminated
12100    }
12101}
12102
12103impl fidl::endpoints::RequestStream for StreamConfigRequestStream {
12104    type Protocol = StreamConfigMarker;
12105    type ControlHandle = StreamConfigControlHandle;
12106
12107    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12108        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12109    }
12110
12111    fn control_handle(&self) -> Self::ControlHandle {
12112        StreamConfigControlHandle { inner: self.inner.clone() }
12113    }
12114
12115    fn into_inner(
12116        self,
12117    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12118    {
12119        (self.inner, self.is_terminated)
12120    }
12121
12122    fn from_inner(
12123        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12124        is_terminated: bool,
12125    ) -> Self {
12126        Self { inner, is_terminated }
12127    }
12128}
12129
12130impl futures::Stream for StreamConfigRequestStream {
12131    type Item = Result<StreamConfigRequest, fidl::Error>;
12132
12133    fn poll_next(
12134        mut self: std::pin::Pin<&mut Self>,
12135        cx: &mut std::task::Context<'_>,
12136    ) -> std::task::Poll<Option<Self::Item>> {
12137        let this = &mut *self;
12138        if this.inner.check_shutdown(cx) {
12139            this.is_terminated = true;
12140            return std::task::Poll::Ready(None);
12141        }
12142        if this.is_terminated {
12143            panic!("polled StreamConfigRequestStream after completion");
12144        }
12145        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12146            |bytes, handles| {
12147                match this.inner.channel().read_etc(cx, bytes, handles) {
12148                    std::task::Poll::Ready(Ok(())) => {}
12149                    std::task::Poll::Pending => return std::task::Poll::Pending,
12150                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12151                        this.is_terminated = true;
12152                        return std::task::Poll::Ready(None);
12153                    }
12154                    std::task::Poll::Ready(Err(e)) => {
12155                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12156                            e.into(),
12157                        ))));
12158                    }
12159                }
12160
12161                // A message has been received from the channel
12162                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12163
12164                std::task::Poll::Ready(Some(match header.ordinal {
12165                    0x4e146d6bca733a84 => {
12166                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12167                        let mut req = fidl::new_empty!(
12168                            fidl::encoding::EmptyPayload,
12169                            fidl::encoding::DefaultFuchsiaResourceDialect
12170                        );
12171                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12172                        let control_handle =
12173                            StreamConfigControlHandle { inner: this.inner.clone() };
12174                        Ok(StreamConfigRequest::GetHealthState {
12175                            responder: StreamConfigGetHealthStateResponder {
12176                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12177                                tx_id: header.tx_id,
12178                            },
12179                        })
12180                    }
12181                    0xa81907ce6066295 => {
12182                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12183                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12184                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
12185                        let control_handle =
12186                            StreamConfigControlHandle { inner: this.inner.clone() };
12187                        Ok(StreamConfigRequest::SignalProcessingConnect {
12188                            protocol: req.protocol,
12189
12190                            control_handle,
12191                        })
12192                    }
12193                    0x7d89c02f3e2d3c01 => {
12194                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12195                        let mut req = fidl::new_empty!(
12196                            fidl::encoding::EmptyPayload,
12197                            fidl::encoding::DefaultFuchsiaResourceDialect
12198                        );
12199                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12200                        let control_handle =
12201                            StreamConfigControlHandle { inner: this.inner.clone() };
12202                        Ok(StreamConfigRequest::GetProperties {
12203                            responder: StreamConfigGetPropertiesResponder {
12204                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12205                                tx_id: header.tx_id,
12206                            },
12207                        })
12208                    }
12209                    0x448efa7850cafe7e => {
12210                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12211                        let mut req = fidl::new_empty!(
12212                            fidl::encoding::EmptyPayload,
12213                            fidl::encoding::DefaultFuchsiaResourceDialect
12214                        );
12215                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12216                        let control_handle =
12217                            StreamConfigControlHandle { inner: this.inner.clone() };
12218                        Ok(StreamConfigRequest::GetSupportedFormats {
12219                            responder: StreamConfigGetSupportedFormatsResponder {
12220                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12221                                tx_id: header.tx_id,
12222                            },
12223                        })
12224                    }
12225                    0x2afb19dd13faa1ba => {
12226                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12227                        let mut req = fidl::new_empty!(
12228                            StreamConfigCreateRingBufferRequest,
12229                            fidl::encoding::DefaultFuchsiaResourceDialect
12230                        );
12231                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
12232                        let control_handle =
12233                            StreamConfigControlHandle { inner: this.inner.clone() };
12234                        Ok(StreamConfigRequest::CreateRingBuffer {
12235                            format: req.format,
12236                            ring_buffer: req.ring_buffer,
12237
12238                            control_handle,
12239                        })
12240                    }
12241                    0x4772506136ab65c1 => {
12242                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12243                        let mut req = fidl::new_empty!(
12244                            fidl::encoding::EmptyPayload,
12245                            fidl::encoding::DefaultFuchsiaResourceDialect
12246                        );
12247                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12248                        let control_handle =
12249                            StreamConfigControlHandle { inner: this.inner.clone() };
12250                        Ok(StreamConfigRequest::WatchGainState {
12251                            responder: StreamConfigWatchGainStateResponder {
12252                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12253                                tx_id: header.tx_id,
12254                            },
12255                        })
12256                    }
12257                    0x3943b41498c6a384 => {
12258                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
12259                        let mut req = fidl::new_empty!(
12260                            StreamConfigSetGainRequest,
12261                            fidl::encoding::DefaultFuchsiaResourceDialect
12262                        );
12263                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
12264                        let control_handle =
12265                            StreamConfigControlHandle { inner: this.inner.clone() };
12266                        Ok(StreamConfigRequest::SetGain {
12267                            target_state: req.target_state,
12268
12269                            control_handle,
12270                        })
12271                    }
12272                    0x497345a6f048b2a6 => {
12273                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12274                        let mut req = fidl::new_empty!(
12275                            fidl::encoding::EmptyPayload,
12276                            fidl::encoding::DefaultFuchsiaResourceDialect
12277                        );
12278                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
12279                        let control_handle =
12280                            StreamConfigControlHandle { inner: this.inner.clone() };
12281                        Ok(StreamConfigRequest::WatchPlugState {
12282                            responder: StreamConfigWatchPlugStateResponder {
12283                                control_handle: std::mem::ManuallyDrop::new(control_handle),
12284                                tx_id: header.tx_id,
12285                            },
12286                        })
12287                    }
12288                    _ => Err(fidl::Error::UnknownOrdinal {
12289                        ordinal: header.ordinal,
12290                        protocol_name:
12291                            <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12292                    }),
12293                }))
12294            },
12295        )
12296    }
12297}
12298
12299/// For an overview see
12300/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming)
12301/// # Deprecation
12302///
12303/// Not supported anymore, instead use an
12304/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
12305/// with one Ring Buffer, see
12306/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
12307#[derive(Debug)]
12308pub enum StreamConfigRequest {
12309    /// Retrieves top level health state.
12310    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
12311    GetHealthState { responder: StreamConfigGetHealthStateResponder },
12312    /// Connect to a `SignalProcessing` protocol.
12313    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
12314    /// the maximum number of connections have already been created, for instance one, then the
12315    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
12316    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
12317    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
12318    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
12319    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
12320    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
12321    /// is intended to be composed, and hence the more verbose name allows differentiation and
12322    /// improved clarity.
12323    SignalProcessingConnect {
12324        protocol: fidl::endpoints::ServerEnd<
12325            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
12326        >,
12327        control_handle: StreamConfigControlHandle,
12328    },
12329    /// Retrieves top level static properties.
12330    GetProperties { responder: StreamConfigGetPropertiesResponder },
12331    /// Gets formats supported by a given driver. When not all combinations supported by the
12332    /// driver can be described with one `SupportedFormats`, the driver returns more than one
12333    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
12334    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
12335    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
12336    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
12337    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
12338    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
12339    /// <<16bits,32bits>,<48KHz,96KHz>>.
12340    GetSupportedFormats { responder: StreamConfigGetSupportedFormatsResponder },
12341    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
12342    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
12343    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
12344    /// ring buffer channel had been established and was still active, the driver must close that
12345    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
12346    /// operations in the process.
12347    CreateRingBuffer {
12348        format: Format,
12349        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
12350        control_handle: StreamConfigControlHandle,
12351    },
12352    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
12353    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
12354    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
12355    /// from what was most recently reported.
12356    /// If `WatchGainState` is called for a second time before the first call has completed, then
12357    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
12358    WatchGainState { responder: StreamConfigWatchGainStateResponder },
12359    /// Client update of the gain state.
12360    SetGain { target_state: GainState, control_handle: StreamConfigControlHandle },
12361    /// Get the plug detect state via a hanging get. The driver will reply to the first
12362    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
12363    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
12364    /// If `WatchPlugState` is called for a second time before the first call has completed, then
12365    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
12366    WatchPlugState { responder: StreamConfigWatchPlugStateResponder },
12367}
12368
12369impl StreamConfigRequest {
12370    #[allow(irrefutable_let_patterns)]
12371    pub fn into_get_health_state(self) -> Option<(StreamConfigGetHealthStateResponder)> {
12372        if let StreamConfigRequest::GetHealthState { responder } = self {
12373            Some((responder))
12374        } else {
12375            None
12376        }
12377    }
12378
12379    #[allow(irrefutable_let_patterns)]
12380    pub fn into_signal_processing_connect(
12381        self,
12382    ) -> Option<(
12383        fidl::endpoints::ServerEnd<
12384            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
12385        >,
12386        StreamConfigControlHandle,
12387    )> {
12388        if let StreamConfigRequest::SignalProcessingConnect { protocol, control_handle } = self {
12389            Some((protocol, control_handle))
12390        } else {
12391            None
12392        }
12393    }
12394
12395    #[allow(irrefutable_let_patterns)]
12396    pub fn into_get_properties(self) -> Option<(StreamConfigGetPropertiesResponder)> {
12397        if let StreamConfigRequest::GetProperties { responder } = self {
12398            Some((responder))
12399        } else {
12400            None
12401        }
12402    }
12403
12404    #[allow(irrefutable_let_patterns)]
12405    pub fn into_get_supported_formats(self) -> Option<(StreamConfigGetSupportedFormatsResponder)> {
12406        if let StreamConfigRequest::GetSupportedFormats { responder } = self {
12407            Some((responder))
12408        } else {
12409            None
12410        }
12411    }
12412
12413    #[allow(irrefutable_let_patterns)]
12414    pub fn into_create_ring_buffer(
12415        self,
12416    ) -> Option<(Format, fidl::endpoints::ServerEnd<RingBufferMarker>, StreamConfigControlHandle)>
12417    {
12418        if let StreamConfigRequest::CreateRingBuffer { format, ring_buffer, control_handle } = self
12419        {
12420            Some((format, ring_buffer, control_handle))
12421        } else {
12422            None
12423        }
12424    }
12425
12426    #[allow(irrefutable_let_patterns)]
12427    pub fn into_watch_gain_state(self) -> Option<(StreamConfigWatchGainStateResponder)> {
12428        if let StreamConfigRequest::WatchGainState { responder } = self {
12429            Some((responder))
12430        } else {
12431            None
12432        }
12433    }
12434
12435    #[allow(irrefutable_let_patterns)]
12436    pub fn into_set_gain(self) -> Option<(GainState, StreamConfigControlHandle)> {
12437        if let StreamConfigRequest::SetGain { target_state, control_handle } = self {
12438            Some((target_state, control_handle))
12439        } else {
12440            None
12441        }
12442    }
12443
12444    #[allow(irrefutable_let_patterns)]
12445    pub fn into_watch_plug_state(self) -> Option<(StreamConfigWatchPlugStateResponder)> {
12446        if let StreamConfigRequest::WatchPlugState { responder } = self {
12447            Some((responder))
12448        } else {
12449            None
12450        }
12451    }
12452
12453    /// Name of the method defined in FIDL
12454    pub fn method_name(&self) -> &'static str {
12455        match *self {
12456            StreamConfigRequest::GetHealthState { .. } => "get_health_state",
12457            StreamConfigRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
12458            StreamConfigRequest::GetProperties { .. } => "get_properties",
12459            StreamConfigRequest::GetSupportedFormats { .. } => "get_supported_formats",
12460            StreamConfigRequest::CreateRingBuffer { .. } => "create_ring_buffer",
12461            StreamConfigRequest::WatchGainState { .. } => "watch_gain_state",
12462            StreamConfigRequest::SetGain { .. } => "set_gain",
12463            StreamConfigRequest::WatchPlugState { .. } => "watch_plug_state",
12464        }
12465    }
12466}
12467
12468#[derive(Debug, Clone)]
12469pub struct StreamConfigControlHandle {
12470    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12471}
12472
12473impl StreamConfigControlHandle {
12474    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
12475        self.inner.shutdown_with_epitaph(status.into())
12476    }
12477}
12478
12479impl fidl::endpoints::ControlHandle for StreamConfigControlHandle {
12480    fn shutdown(&self) {
12481        self.inner.shutdown()
12482    }
12483
12484    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
12485        self.inner.shutdown_with_epitaph(status)
12486    }
12487
12488    fn is_closed(&self) -> bool {
12489        self.inner.channel().is_closed()
12490    }
12491    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12492        self.inner.channel().on_closed()
12493    }
12494
12495    #[cfg(target_os = "fuchsia")]
12496    fn signal_peer(
12497        &self,
12498        clear_mask: zx::Signals,
12499        set_mask: zx::Signals,
12500    ) -> Result<(), zx_status::Status> {
12501        use fidl::Peered;
12502        self.inner.channel().signal_peer(clear_mask, set_mask)
12503    }
12504}
12505
12506impl StreamConfigControlHandle {}
12507
12508#[must_use = "FIDL methods require a response to be sent"]
12509#[derive(Debug)]
12510pub struct StreamConfigGetHealthStateResponder {
12511    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12512    tx_id: u32,
12513}
12514
12515/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12516/// if the responder is dropped without sending a response, so that the client
12517/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12518impl std::ops::Drop for StreamConfigGetHealthStateResponder {
12519    fn drop(&mut self) {
12520        self.control_handle.shutdown();
12521        // Safety: drops once, never accessed again
12522        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12523    }
12524}
12525
12526impl fidl::endpoints::Responder for StreamConfigGetHealthStateResponder {
12527    type ControlHandle = StreamConfigControlHandle;
12528
12529    fn control_handle(&self) -> &StreamConfigControlHandle {
12530        &self.control_handle
12531    }
12532
12533    fn drop_without_shutdown(mut self) {
12534        // Safety: drops once, never accessed again due to mem::forget
12535        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12536        // Prevent Drop from running (which would shut down the channel)
12537        std::mem::forget(self);
12538    }
12539}
12540
12541impl StreamConfigGetHealthStateResponder {
12542    /// Sends a response to the FIDL transaction.
12543    ///
12544    /// Sets the channel to shutdown if an error occurs.
12545    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
12546        let _result = self.send_raw(state);
12547        if _result.is_err() {
12548            self.control_handle.shutdown();
12549        }
12550        self.drop_without_shutdown();
12551        _result
12552    }
12553
12554    /// Similar to "send" but does not shutdown the channel if an error occurs.
12555    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
12556        let _result = self.send_raw(state);
12557        self.drop_without_shutdown();
12558        _result
12559    }
12560
12561    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
12562        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
12563            (state,),
12564            self.tx_id,
12565            0x4e146d6bca733a84,
12566            fidl::encoding::DynamicFlags::empty(),
12567        )
12568    }
12569}
12570
12571#[must_use = "FIDL methods require a response to be sent"]
12572#[derive(Debug)]
12573pub struct StreamConfigGetPropertiesResponder {
12574    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12575    tx_id: u32,
12576}
12577
12578/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12579/// if the responder is dropped without sending a response, so that the client
12580/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12581impl std::ops::Drop for StreamConfigGetPropertiesResponder {
12582    fn drop(&mut self) {
12583        self.control_handle.shutdown();
12584        // Safety: drops once, never accessed again
12585        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12586    }
12587}
12588
12589impl fidl::endpoints::Responder for StreamConfigGetPropertiesResponder {
12590    type ControlHandle = StreamConfigControlHandle;
12591
12592    fn control_handle(&self) -> &StreamConfigControlHandle {
12593        &self.control_handle
12594    }
12595
12596    fn drop_without_shutdown(mut self) {
12597        // Safety: drops once, never accessed again due to mem::forget
12598        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12599        // Prevent Drop from running (which would shut down the channel)
12600        std::mem::forget(self);
12601    }
12602}
12603
12604impl StreamConfigGetPropertiesResponder {
12605    /// Sends a response to the FIDL transaction.
12606    ///
12607    /// Sets the channel to shutdown if an error occurs.
12608    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
12609        let _result = self.send_raw(properties);
12610        if _result.is_err() {
12611            self.control_handle.shutdown();
12612        }
12613        self.drop_without_shutdown();
12614        _result
12615    }
12616
12617    /// Similar to "send" but does not shutdown the channel if an error occurs.
12618    pub fn send_no_shutdown_on_err(
12619        self,
12620        mut properties: &StreamProperties,
12621    ) -> Result<(), fidl::Error> {
12622        let _result = self.send_raw(properties);
12623        self.drop_without_shutdown();
12624        _result
12625    }
12626
12627    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
12628        self.control_handle.inner.send::<StreamConfigGetPropertiesResponse>(
12629            (properties,),
12630            self.tx_id,
12631            0x7d89c02f3e2d3c01,
12632            fidl::encoding::DynamicFlags::empty(),
12633        )
12634    }
12635}
12636
12637#[must_use = "FIDL methods require a response to be sent"]
12638#[derive(Debug)]
12639pub struct StreamConfigGetSupportedFormatsResponder {
12640    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12641    tx_id: u32,
12642}
12643
12644/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12645/// if the responder is dropped without sending a response, so that the client
12646/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12647impl std::ops::Drop for StreamConfigGetSupportedFormatsResponder {
12648    fn drop(&mut self) {
12649        self.control_handle.shutdown();
12650        // Safety: drops once, never accessed again
12651        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12652    }
12653}
12654
12655impl fidl::endpoints::Responder for StreamConfigGetSupportedFormatsResponder {
12656    type ControlHandle = StreamConfigControlHandle;
12657
12658    fn control_handle(&self) -> &StreamConfigControlHandle {
12659        &self.control_handle
12660    }
12661
12662    fn drop_without_shutdown(mut self) {
12663        // Safety: drops once, never accessed again due to mem::forget
12664        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12665        // Prevent Drop from running (which would shut down the channel)
12666        std::mem::forget(self);
12667    }
12668}
12669
12670impl StreamConfigGetSupportedFormatsResponder {
12671    /// Sends a response to the FIDL transaction.
12672    ///
12673    /// Sets the channel to shutdown if an error occurs.
12674    pub fn send(self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
12675        let _result = self.send_raw(supported_formats);
12676        if _result.is_err() {
12677            self.control_handle.shutdown();
12678        }
12679        self.drop_without_shutdown();
12680        _result
12681    }
12682
12683    /// Similar to "send" but does not shutdown the channel if an error occurs.
12684    pub fn send_no_shutdown_on_err(
12685        self,
12686        mut supported_formats: &[SupportedFormats],
12687    ) -> Result<(), fidl::Error> {
12688        let _result = self.send_raw(supported_formats);
12689        self.drop_without_shutdown();
12690        _result
12691    }
12692
12693    fn send_raw(&self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
12694        self.control_handle.inner.send::<StreamConfigGetSupportedFormatsResponse>(
12695            (supported_formats,),
12696            self.tx_id,
12697            0x448efa7850cafe7e,
12698            fidl::encoding::DynamicFlags::empty(),
12699        )
12700    }
12701}
12702
12703#[must_use = "FIDL methods require a response to be sent"]
12704#[derive(Debug)]
12705pub struct StreamConfigWatchGainStateResponder {
12706    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12707    tx_id: u32,
12708}
12709
12710/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12711/// if the responder is dropped without sending a response, so that the client
12712/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12713impl std::ops::Drop for StreamConfigWatchGainStateResponder {
12714    fn drop(&mut self) {
12715        self.control_handle.shutdown();
12716        // Safety: drops once, never accessed again
12717        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12718    }
12719}
12720
12721impl fidl::endpoints::Responder for StreamConfigWatchGainStateResponder {
12722    type ControlHandle = StreamConfigControlHandle;
12723
12724    fn control_handle(&self) -> &StreamConfigControlHandle {
12725        &self.control_handle
12726    }
12727
12728    fn drop_without_shutdown(mut self) {
12729        // Safety: drops once, never accessed again due to mem::forget
12730        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12731        // Prevent Drop from running (which would shut down the channel)
12732        std::mem::forget(self);
12733    }
12734}
12735
12736impl StreamConfigWatchGainStateResponder {
12737    /// Sends a response to the FIDL transaction.
12738    ///
12739    /// Sets the channel to shutdown if an error occurs.
12740    pub fn send(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12741        let _result = self.send_raw(gain_state);
12742        if _result.is_err() {
12743            self.control_handle.shutdown();
12744        }
12745        self.drop_without_shutdown();
12746        _result
12747    }
12748
12749    /// Similar to "send" but does not shutdown the channel if an error occurs.
12750    pub fn send_no_shutdown_on_err(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12751        let _result = self.send_raw(gain_state);
12752        self.drop_without_shutdown();
12753        _result
12754    }
12755
12756    fn send_raw(&self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
12757        self.control_handle.inner.send::<StreamConfigWatchGainStateResponse>(
12758            (gain_state,),
12759            self.tx_id,
12760            0x4772506136ab65c1,
12761            fidl::encoding::DynamicFlags::empty(),
12762        )
12763    }
12764}
12765
12766#[must_use = "FIDL methods require a response to be sent"]
12767#[derive(Debug)]
12768pub struct StreamConfigWatchPlugStateResponder {
12769    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
12770    tx_id: u32,
12771}
12772
12773/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
12774/// if the responder is dropped without sending a response, so that the client
12775/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
12776impl std::ops::Drop for StreamConfigWatchPlugStateResponder {
12777    fn drop(&mut self) {
12778        self.control_handle.shutdown();
12779        // Safety: drops once, never accessed again
12780        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12781    }
12782}
12783
12784impl fidl::endpoints::Responder for StreamConfigWatchPlugStateResponder {
12785    type ControlHandle = StreamConfigControlHandle;
12786
12787    fn control_handle(&self) -> &StreamConfigControlHandle {
12788        &self.control_handle
12789    }
12790
12791    fn drop_without_shutdown(mut self) {
12792        // Safety: drops once, never accessed again due to mem::forget
12793        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12794        // Prevent Drop from running (which would shut down the channel)
12795        std::mem::forget(self);
12796    }
12797}
12798
12799impl StreamConfigWatchPlugStateResponder {
12800    /// Sends a response to the FIDL transaction.
12801    ///
12802    /// Sets the channel to shutdown if an error occurs.
12803    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12804        let _result = self.send_raw(plug_state);
12805        if _result.is_err() {
12806            self.control_handle.shutdown();
12807        }
12808        self.drop_without_shutdown();
12809        _result
12810    }
12811
12812    /// Similar to "send" but does not shutdown the channel if an error occurs.
12813    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12814        let _result = self.send_raw(plug_state);
12815        self.drop_without_shutdown();
12816        _result
12817    }
12818
12819    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
12820        self.control_handle.inner.send::<StreamConfigWatchPlugStateResponse>(
12821            (plug_state,),
12822            self.tx_id,
12823            0x497345a6f048b2a6,
12824            fidl::encoding::DynamicFlags::empty(),
12825        )
12826    }
12827}
12828
12829#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
12830pub struct StreamConfigConnectorMarker;
12831
12832impl fidl::endpoints::ProtocolMarker for StreamConfigConnectorMarker {
12833    type Proxy = StreamConfigConnectorProxy;
12834    type RequestStream = StreamConfigConnectorRequestStream;
12835    #[cfg(target_os = "fuchsia")]
12836    type SynchronousProxy = StreamConfigConnectorSynchronousProxy;
12837
12838    const DEBUG_NAME: &'static str = "(anonymous) StreamConfigConnector";
12839}
12840
12841pub trait StreamConfigConnectorProxyInterface: Send + Sync {
12842    fn r#connect(
12843        &self,
12844        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12845    ) -> Result<(), fidl::Error>;
12846}
12847#[derive(Debug)]
12848#[cfg(target_os = "fuchsia")]
12849pub struct StreamConfigConnectorSynchronousProxy {
12850    client: fidl::client::sync::Client,
12851}
12852
12853#[cfg(target_os = "fuchsia")]
12854impl fidl::endpoints::SynchronousProxy for StreamConfigConnectorSynchronousProxy {
12855    type Proxy = StreamConfigConnectorProxy;
12856    type Protocol = StreamConfigConnectorMarker;
12857
12858    fn from_channel(inner: fidl::Channel) -> Self {
12859        Self::new(inner)
12860    }
12861
12862    fn into_channel(self) -> fidl::Channel {
12863        self.client.into_channel()
12864    }
12865
12866    fn as_channel(&self) -> &fidl::Channel {
12867        self.client.as_channel()
12868    }
12869}
12870
12871#[cfg(target_os = "fuchsia")]
12872impl StreamConfigConnectorSynchronousProxy {
12873    pub fn new(channel: fidl::Channel) -> Self {
12874        Self { client: fidl::client::sync::Client::new(channel) }
12875    }
12876
12877    pub fn into_channel(self) -> fidl::Channel {
12878        self.client.into_channel()
12879    }
12880
12881    /// Waits until an event arrives and returns it. It is safe for other
12882    /// threads to make concurrent requests while waiting for an event.
12883    pub fn wait_for_event(
12884        &self,
12885        deadline: zx::MonotonicInstant,
12886    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
12887        StreamConfigConnectorEvent::decode(
12888            self.client.wait_for_event::<StreamConfigConnectorMarker>(deadline)?,
12889        )
12890    }
12891
12892    /// Connect to a `StreamConfig` protocol.
12893    /// This method allows a component to serve FIDL outside the devhost's control.
12894    pub fn r#connect(
12895        &self,
12896        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12897    ) -> Result<(), fidl::Error> {
12898        self.client.send::<StreamConfigConnectorConnectRequest>(
12899            (protocol,),
12900            0x22051ff3021eafec,
12901            fidl::encoding::DynamicFlags::empty(),
12902        )
12903    }
12904}
12905
12906#[cfg(target_os = "fuchsia")]
12907impl From<StreamConfigConnectorSynchronousProxy> for zx::NullableHandle {
12908    fn from(value: StreamConfigConnectorSynchronousProxy) -> Self {
12909        value.into_channel().into()
12910    }
12911}
12912
12913#[cfg(target_os = "fuchsia")]
12914impl From<fidl::Channel> for StreamConfigConnectorSynchronousProxy {
12915    fn from(value: fidl::Channel) -> Self {
12916        Self::new(value)
12917    }
12918}
12919
12920#[cfg(target_os = "fuchsia")]
12921impl fidl::endpoints::FromClient for StreamConfigConnectorSynchronousProxy {
12922    type Protocol = StreamConfigConnectorMarker;
12923
12924    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigConnectorMarker>) -> Self {
12925        Self::new(value.into_channel())
12926    }
12927}
12928
12929#[derive(Debug, Clone)]
12930pub struct StreamConfigConnectorProxy {
12931    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
12932}
12933
12934impl fidl::endpoints::Proxy for StreamConfigConnectorProxy {
12935    type Protocol = StreamConfigConnectorMarker;
12936
12937    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
12938        Self::new(inner)
12939    }
12940
12941    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
12942        self.client.into_channel().map_err(|client| Self { client })
12943    }
12944
12945    fn as_channel(&self) -> &::fidl::AsyncChannel {
12946        self.client.as_channel()
12947    }
12948}
12949
12950impl StreamConfigConnectorProxy {
12951    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfigConnector.
12952    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
12953        let protocol_name =
12954            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12955        Self { client: fidl::client::Client::new(channel, protocol_name) }
12956    }
12957
12958    /// Get a Stream of events from the remote end of the protocol.
12959    ///
12960    /// # Panics
12961    ///
12962    /// Panics if the event stream was already taken.
12963    pub fn take_event_stream(&self) -> StreamConfigConnectorEventStream {
12964        StreamConfigConnectorEventStream { event_receiver: self.client.take_event_receiver() }
12965    }
12966
12967    /// Connect to a `StreamConfig` protocol.
12968    /// This method allows a component to serve FIDL outside the devhost's control.
12969    pub fn r#connect(
12970        &self,
12971        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12972    ) -> Result<(), fidl::Error> {
12973        StreamConfigConnectorProxyInterface::r#connect(self, protocol)
12974    }
12975}
12976
12977impl StreamConfigConnectorProxyInterface for StreamConfigConnectorProxy {
12978    fn r#connect(
12979        &self,
12980        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
12981    ) -> Result<(), fidl::Error> {
12982        self.client.send::<StreamConfigConnectorConnectRequest>(
12983            (protocol,),
12984            0x22051ff3021eafec,
12985            fidl::encoding::DynamicFlags::empty(),
12986        )
12987    }
12988}
12989
12990pub struct StreamConfigConnectorEventStream {
12991    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12992}
12993
12994impl std::marker::Unpin for StreamConfigConnectorEventStream {}
12995
12996impl futures::stream::FusedStream for StreamConfigConnectorEventStream {
12997    fn is_terminated(&self) -> bool {
12998        self.event_receiver.is_terminated()
12999    }
13000}
13001
13002impl futures::Stream for StreamConfigConnectorEventStream {
13003    type Item = Result<StreamConfigConnectorEvent, fidl::Error>;
13004
13005    fn poll_next(
13006        mut self: std::pin::Pin<&mut Self>,
13007        cx: &mut std::task::Context<'_>,
13008    ) -> std::task::Poll<Option<Self::Item>> {
13009        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
13010            &mut self.event_receiver,
13011            cx
13012        )?) {
13013            Some(buf) => std::task::Poll::Ready(Some(StreamConfigConnectorEvent::decode(buf))),
13014            None => std::task::Poll::Ready(None),
13015        }
13016    }
13017}
13018
13019#[derive(Debug)]
13020pub enum StreamConfigConnectorEvent {}
13021
13022impl StreamConfigConnectorEvent {
13023    /// Decodes a message buffer as a [`StreamConfigConnectorEvent`].
13024    fn decode(
13025        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
13026    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
13027        let (bytes, _handles) = buf.split_mut();
13028        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
13029        debug_assert_eq!(tx_header.tx_id, 0);
13030        match tx_header.ordinal {
13031            _ => Err(fidl::Error::UnknownOrdinal {
13032                ordinal: tx_header.ordinal,
13033                protocol_name:
13034                    <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13035            }),
13036        }
13037    }
13038}
13039
13040/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfigConnector.
13041pub struct StreamConfigConnectorRequestStream {
13042    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13043    is_terminated: bool,
13044}
13045
13046impl std::marker::Unpin for StreamConfigConnectorRequestStream {}
13047
13048impl futures::stream::FusedStream for StreamConfigConnectorRequestStream {
13049    fn is_terminated(&self) -> bool {
13050        self.is_terminated
13051    }
13052}
13053
13054impl fidl::endpoints::RequestStream for StreamConfigConnectorRequestStream {
13055    type Protocol = StreamConfigConnectorMarker;
13056    type ControlHandle = StreamConfigConnectorControlHandle;
13057
13058    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
13059        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
13060    }
13061
13062    fn control_handle(&self) -> Self::ControlHandle {
13063        StreamConfigConnectorControlHandle { inner: self.inner.clone() }
13064    }
13065
13066    fn into_inner(
13067        self,
13068    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
13069    {
13070        (self.inner, self.is_terminated)
13071    }
13072
13073    fn from_inner(
13074        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13075        is_terminated: bool,
13076    ) -> Self {
13077        Self { inner, is_terminated }
13078    }
13079}
13080
13081impl futures::Stream for StreamConfigConnectorRequestStream {
13082    type Item = Result<StreamConfigConnectorRequest, fidl::Error>;
13083
13084    fn poll_next(
13085        mut self: std::pin::Pin<&mut Self>,
13086        cx: &mut std::task::Context<'_>,
13087    ) -> std::task::Poll<Option<Self::Item>> {
13088        let this = &mut *self;
13089        if this.inner.check_shutdown(cx) {
13090            this.is_terminated = true;
13091            return std::task::Poll::Ready(None);
13092        }
13093        if this.is_terminated {
13094            panic!("polled StreamConfigConnectorRequestStream after completion");
13095        }
13096        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
13097            |bytes, handles| {
13098                match this.inner.channel().read_etc(cx, bytes, handles) {
13099                    std::task::Poll::Ready(Ok(())) => {}
13100                    std::task::Poll::Pending => return std::task::Poll::Pending,
13101                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
13102                        this.is_terminated = true;
13103                        return std::task::Poll::Ready(None);
13104                    }
13105                    std::task::Poll::Ready(Err(e)) => {
13106                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
13107                            e.into(),
13108                        ))));
13109                    }
13110                }
13111
13112                // A message has been received from the channel
13113                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
13114
13115                std::task::Poll::Ready(Some(match header.ordinal {
13116                0x22051ff3021eafec => {
13117                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
13118                    let mut req = fidl::new_empty!(StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
13119                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
13120                    let control_handle = StreamConfigConnectorControlHandle {
13121                        inner: this.inner.clone(),
13122                    };
13123                    Ok(StreamConfigConnectorRequest::Connect {protocol: req.protocol,
13124
13125                        control_handle,
13126                    })
13127                }
13128                _ => Err(fidl::Error::UnknownOrdinal {
13129                    ordinal: header.ordinal,
13130                    protocol_name: <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13131                }),
13132            }))
13133            },
13134        )
13135    }
13136}
13137
13138/// For an overview see
13139/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming).
13140/// # Deprecation
13141///
13142/// Not supported anymore, instead use an
13143/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13144/// with one Ring Buffer, see
13145/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13146#[derive(Debug)]
13147pub enum StreamConfigConnectorRequest {
13148    /// Connect to a `StreamConfig` protocol.
13149    /// This method allows a component to serve FIDL outside the devhost's control.
13150    Connect {
13151        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
13152        control_handle: StreamConfigConnectorControlHandle,
13153    },
13154}
13155
13156impl StreamConfigConnectorRequest {
13157    #[allow(irrefutable_let_patterns)]
13158    pub fn into_connect(
13159        self,
13160    ) -> Option<(fidl::endpoints::ServerEnd<StreamConfigMarker>, StreamConfigConnectorControlHandle)>
13161    {
13162        if let StreamConfigConnectorRequest::Connect { protocol, control_handle } = self {
13163            Some((protocol, control_handle))
13164        } else {
13165            None
13166        }
13167    }
13168
13169    /// Name of the method defined in FIDL
13170    pub fn method_name(&self) -> &'static str {
13171        match *self {
13172            StreamConfigConnectorRequest::Connect { .. } => "connect",
13173        }
13174    }
13175}
13176
13177#[derive(Debug, Clone)]
13178pub struct StreamConfigConnectorControlHandle {
13179    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13180}
13181
13182impl StreamConfigConnectorControlHandle {
13183    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
13184        self.inner.shutdown_with_epitaph(status.into())
13185    }
13186}
13187
13188impl fidl::endpoints::ControlHandle for StreamConfigConnectorControlHandle {
13189    fn shutdown(&self) {
13190        self.inner.shutdown()
13191    }
13192
13193    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
13194        self.inner.shutdown_with_epitaph(status)
13195    }
13196
13197    fn is_closed(&self) -> bool {
13198        self.inner.channel().is_closed()
13199    }
13200    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
13201        self.inner.channel().on_closed()
13202    }
13203
13204    #[cfg(target_os = "fuchsia")]
13205    fn signal_peer(
13206        &self,
13207        clear_mask: zx::Signals,
13208        set_mask: zx::Signals,
13209    ) -> Result<(), zx_status::Status> {
13210        use fidl::Peered;
13211        self.inner.channel().signal_peer(clear_mask, set_mask)
13212    }
13213}
13214
13215impl StreamConfigConnectorControlHandle {}
13216
13217#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13218pub struct CodecConnectorServiceMarker;
13219
13220#[cfg(target_os = "fuchsia")]
13221impl fidl::endpoints::ServiceMarker for CodecConnectorServiceMarker {
13222    type Proxy = CodecConnectorServiceProxy;
13223    type Request = CodecConnectorServiceRequest;
13224    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecConnectorService";
13225}
13226
13227/// A request for one of the member protocols of CodecConnectorService.
13228///
13229/// # Deprecation
13230///
13231/// Not supported anymore, instead use an
13232/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13233/// with one DAI and no Ring Buffer, see
13234/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13235#[cfg(target_os = "fuchsia")]
13236pub enum CodecConnectorServiceRequest {
13237    CodecConnector(CodecConnectorRequestStream),
13238}
13239
13240#[cfg(target_os = "fuchsia")]
13241impl fidl::endpoints::ServiceRequest for CodecConnectorServiceRequest {
13242    type Service = CodecConnectorServiceMarker;
13243
13244    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13245        match name {
13246            "codec_connector" => Self::CodecConnector(
13247                <CodecConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13248                    _channel,
13249                ),
13250            ),
13251            _ => panic!("no such member protocol name for service CodecConnectorService"),
13252        }
13253    }
13254
13255    fn member_names() -> &'static [&'static str] {
13256        &["codec_connector"]
13257    }
13258}
13259/// # Deprecation
13260///
13261/// Not supported anymore, instead use an
13262/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13263/// with one DAI and no Ring Buffer, see
13264/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13265#[cfg(target_os = "fuchsia")]
13266pub struct CodecConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13267
13268#[cfg(target_os = "fuchsia")]
13269impl fidl::endpoints::ServiceProxy for CodecConnectorServiceProxy {
13270    type Service = CodecConnectorServiceMarker;
13271
13272    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13273        Self(opener)
13274    }
13275}
13276
13277#[cfg(target_os = "fuchsia")]
13278impl CodecConnectorServiceProxy {
13279    pub fn connect_to_codec_connector(&self) -> Result<CodecConnectorProxy, fidl::Error> {
13280        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecConnectorMarker>();
13281        self.connect_channel_to_codec_connector(server_end)?;
13282        Ok(proxy)
13283    }
13284
13285    /// Like `connect_to_codec_connector`, but returns a sync proxy.
13286    /// See [`Self::connect_to_codec_connector`] for more details.
13287    pub fn connect_to_codec_connector_sync(
13288        &self,
13289    ) -> Result<CodecConnectorSynchronousProxy, fidl::Error> {
13290        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecConnectorMarker>();
13291        self.connect_channel_to_codec_connector(server_end)?;
13292        Ok(proxy)
13293    }
13294
13295    /// Like `connect_to_codec_connector`, but accepts a server end.
13296    /// See [`Self::connect_to_codec_connector`] for more details.
13297    pub fn connect_channel_to_codec_connector(
13298        &self,
13299        server_end: fidl::endpoints::ServerEnd<CodecConnectorMarker>,
13300    ) -> Result<(), fidl::Error> {
13301        self.0.open_member("codec_connector", server_end.into_channel())
13302    }
13303
13304    pub fn instance_name(&self) -> &str {
13305        self.0.instance_name()
13306    }
13307}
13308
13309#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13310pub struct CodecServiceMarker;
13311
13312#[cfg(target_os = "fuchsia")]
13313impl fidl::endpoints::ServiceMarker for CodecServiceMarker {
13314    type Proxy = CodecServiceProxy;
13315    type Request = CodecServiceRequest;
13316    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecService";
13317}
13318
13319/// A request for one of the member protocols of CodecService.
13320///
13321/// # Deprecation
13322///
13323/// Not supported anymore, instead use an
13324/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13325/// with one DAI and no Ring Buffer, see
13326/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13327#[cfg(target_os = "fuchsia")]
13328pub enum CodecServiceRequest {
13329    Codec(CodecRequestStream),
13330}
13331
13332#[cfg(target_os = "fuchsia")]
13333impl fidl::endpoints::ServiceRequest for CodecServiceRequest {
13334    type Service = CodecServiceMarker;
13335
13336    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13337        match name {
13338            "codec" => Self::Codec(
13339                <CodecRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13340            ),
13341            _ => panic!("no such member protocol name for service CodecService"),
13342        }
13343    }
13344
13345    fn member_names() -> &'static [&'static str] {
13346        &["codec"]
13347    }
13348}
13349/// # Deprecation
13350///
13351/// Not supported anymore, instead use an
13352/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13353/// with one DAI and no Ring Buffer, see
13354/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13355#[cfg(target_os = "fuchsia")]
13356pub struct CodecServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13357
13358#[cfg(target_os = "fuchsia")]
13359impl fidl::endpoints::ServiceProxy for CodecServiceProxy {
13360    type Service = CodecServiceMarker;
13361
13362    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13363        Self(opener)
13364    }
13365}
13366
13367#[cfg(target_os = "fuchsia")]
13368impl CodecServiceProxy {
13369    pub fn connect_to_codec(&self) -> Result<CodecProxy, fidl::Error> {
13370        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecMarker>();
13371        self.connect_channel_to_codec(server_end)?;
13372        Ok(proxy)
13373    }
13374
13375    /// Like `connect_to_codec`, but returns a sync proxy.
13376    /// See [`Self::connect_to_codec`] for more details.
13377    pub fn connect_to_codec_sync(&self) -> Result<CodecSynchronousProxy, fidl::Error> {
13378        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecMarker>();
13379        self.connect_channel_to_codec(server_end)?;
13380        Ok(proxy)
13381    }
13382
13383    /// Like `connect_to_codec`, but accepts a server end.
13384    /// See [`Self::connect_to_codec`] for more details.
13385    pub fn connect_channel_to_codec(
13386        &self,
13387        server_end: fidl::endpoints::ServerEnd<CodecMarker>,
13388    ) -> Result<(), fidl::Error> {
13389        self.0.open_member("codec", server_end.into_channel())
13390    }
13391
13392    pub fn instance_name(&self) -> &str {
13393        self.0.instance_name()
13394    }
13395}
13396
13397#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13398pub struct CompositeConnectorServiceMarker;
13399
13400#[cfg(target_os = "fuchsia")]
13401impl fidl::endpoints::ServiceMarker for CompositeConnectorServiceMarker {
13402    type Proxy = CompositeConnectorServiceProxy;
13403    type Request = CompositeConnectorServiceRequest;
13404    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CompositeConnectorService";
13405}
13406
13407/// A request for one of the member protocols of CompositeConnectorService.
13408///
13409#[cfg(target_os = "fuchsia")]
13410pub enum CompositeConnectorServiceRequest {
13411    CompositeConnector(CompositeConnectorRequestStream),
13412}
13413
13414#[cfg(target_os = "fuchsia")]
13415impl fidl::endpoints::ServiceRequest for CompositeConnectorServiceRequest {
13416    type Service = CompositeConnectorServiceMarker;
13417
13418    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13419        match name {
13420            "composite_connector" => Self::CompositeConnector(
13421                <CompositeConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13422                    _channel,
13423                ),
13424            ),
13425            _ => panic!("no such member protocol name for service CompositeConnectorService"),
13426        }
13427    }
13428
13429    fn member_names() -> &'static [&'static str] {
13430        &["composite_connector"]
13431    }
13432}
13433#[cfg(target_os = "fuchsia")]
13434pub struct CompositeConnectorServiceProxy(
13435    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13436);
13437
13438#[cfg(target_os = "fuchsia")]
13439impl fidl::endpoints::ServiceProxy for CompositeConnectorServiceProxy {
13440    type Service = CompositeConnectorServiceMarker;
13441
13442    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13443        Self(opener)
13444    }
13445}
13446
13447#[cfg(target_os = "fuchsia")]
13448impl CompositeConnectorServiceProxy {
13449    pub fn connect_to_composite_connector(&self) -> Result<CompositeConnectorProxy, fidl::Error> {
13450        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeConnectorMarker>();
13451        self.connect_channel_to_composite_connector(server_end)?;
13452        Ok(proxy)
13453    }
13454
13455    /// Like `connect_to_composite_connector`, but returns a sync proxy.
13456    /// See [`Self::connect_to_composite_connector`] for more details.
13457    pub fn connect_to_composite_connector_sync(
13458        &self,
13459    ) -> Result<CompositeConnectorSynchronousProxy, fidl::Error> {
13460        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeConnectorMarker>();
13461        self.connect_channel_to_composite_connector(server_end)?;
13462        Ok(proxy)
13463    }
13464
13465    /// Like `connect_to_composite_connector`, but accepts a server end.
13466    /// See [`Self::connect_to_composite_connector`] for more details.
13467    pub fn connect_channel_to_composite_connector(
13468        &self,
13469        server_end: fidl::endpoints::ServerEnd<CompositeConnectorMarker>,
13470    ) -> Result<(), fidl::Error> {
13471        self.0.open_member("composite_connector", server_end.into_channel())
13472    }
13473
13474    pub fn instance_name(&self) -> &str {
13475        self.0.instance_name()
13476    }
13477}
13478
13479#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13480pub struct DaiConnectorServiceMarker;
13481
13482#[cfg(target_os = "fuchsia")]
13483impl fidl::endpoints::ServiceMarker for DaiConnectorServiceMarker {
13484    type Proxy = DaiConnectorServiceProxy;
13485    type Request = DaiConnectorServiceRequest;
13486    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiConnectorService";
13487}
13488
13489/// A request for one of the member protocols of DaiConnectorService.
13490///
13491/// # Deprecation
13492///
13493/// Not supported anymore, instead use an
13494/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13495/// with one DAI and one Ring Buffer, see
13496/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13497#[cfg(target_os = "fuchsia")]
13498pub enum DaiConnectorServiceRequest {
13499    DaiConnector(DaiConnectorRequestStream),
13500}
13501
13502#[cfg(target_os = "fuchsia")]
13503impl fidl::endpoints::ServiceRequest for DaiConnectorServiceRequest {
13504    type Service = DaiConnectorServiceMarker;
13505
13506    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13507        match name {
13508            "dai_connector" => Self::DaiConnector(
13509                <DaiConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
13510                    _channel,
13511                ),
13512            ),
13513            _ => panic!("no such member protocol name for service DaiConnectorService"),
13514        }
13515    }
13516
13517    fn member_names() -> &'static [&'static str] {
13518        &["dai_connector"]
13519    }
13520}
13521/// # Deprecation
13522///
13523/// Not supported anymore, instead use an
13524/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13525/// with one DAI and one Ring Buffer, see
13526/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13527#[cfg(target_os = "fuchsia")]
13528pub struct DaiConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13529
13530#[cfg(target_os = "fuchsia")]
13531impl fidl::endpoints::ServiceProxy for DaiConnectorServiceProxy {
13532    type Service = DaiConnectorServiceMarker;
13533
13534    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13535        Self(opener)
13536    }
13537}
13538
13539#[cfg(target_os = "fuchsia")]
13540impl DaiConnectorServiceProxy {
13541    pub fn connect_to_dai_connector(&self) -> Result<DaiConnectorProxy, fidl::Error> {
13542        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiConnectorMarker>();
13543        self.connect_channel_to_dai_connector(server_end)?;
13544        Ok(proxy)
13545    }
13546
13547    /// Like `connect_to_dai_connector`, but returns a sync proxy.
13548    /// See [`Self::connect_to_dai_connector`] for more details.
13549    pub fn connect_to_dai_connector_sync(
13550        &self,
13551    ) -> Result<DaiConnectorSynchronousProxy, fidl::Error> {
13552        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiConnectorMarker>();
13553        self.connect_channel_to_dai_connector(server_end)?;
13554        Ok(proxy)
13555    }
13556
13557    /// Like `connect_to_dai_connector`, but accepts a server end.
13558    /// See [`Self::connect_to_dai_connector`] for more details.
13559    pub fn connect_channel_to_dai_connector(
13560        &self,
13561        server_end: fidl::endpoints::ServerEnd<DaiConnectorMarker>,
13562    ) -> Result<(), fidl::Error> {
13563        self.0.open_member("dai_connector", server_end.into_channel())
13564    }
13565
13566    pub fn instance_name(&self) -> &str {
13567        self.0.instance_name()
13568    }
13569}
13570
13571#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13572pub struct DaiServiceMarker;
13573
13574#[cfg(target_os = "fuchsia")]
13575impl fidl::endpoints::ServiceMarker for DaiServiceMarker {
13576    type Proxy = DaiServiceProxy;
13577    type Request = DaiServiceRequest;
13578    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiService";
13579}
13580
13581/// A request for one of the member protocols of DaiService.
13582///
13583/// # Deprecation
13584///
13585/// Not supported anymore, instead use an
13586/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13587/// with one DAI and one Ring Buffer, see
13588/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13589#[cfg(target_os = "fuchsia")]
13590pub enum DaiServiceRequest {
13591    Dai(DaiRequestStream),
13592}
13593
13594#[cfg(target_os = "fuchsia")]
13595impl fidl::endpoints::ServiceRequest for DaiServiceRequest {
13596    type Service = DaiServiceMarker;
13597
13598    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13599        match name {
13600            "dai" => Self::Dai(<DaiRequestStream as fidl::endpoints::RequestStream>::from_channel(
13601                _channel,
13602            )),
13603            _ => panic!("no such member protocol name for service DaiService"),
13604        }
13605    }
13606
13607    fn member_names() -> &'static [&'static str] {
13608        &["dai"]
13609    }
13610}
13611/// # Deprecation
13612///
13613/// Not supported anymore, instead use an
13614/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13615/// with one DAI and one Ring Buffer, see
13616/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13617#[cfg(target_os = "fuchsia")]
13618pub struct DaiServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13619
13620#[cfg(target_os = "fuchsia")]
13621impl fidl::endpoints::ServiceProxy for DaiServiceProxy {
13622    type Service = DaiServiceMarker;
13623
13624    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13625        Self(opener)
13626    }
13627}
13628
13629#[cfg(target_os = "fuchsia")]
13630impl DaiServiceProxy {
13631    pub fn connect_to_dai(&self) -> Result<DaiProxy, fidl::Error> {
13632        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiMarker>();
13633        self.connect_channel_to_dai(server_end)?;
13634        Ok(proxy)
13635    }
13636
13637    /// Like `connect_to_dai`, but returns a sync proxy.
13638    /// See [`Self::connect_to_dai`] for more details.
13639    pub fn connect_to_dai_sync(&self) -> Result<DaiSynchronousProxy, fidl::Error> {
13640        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiMarker>();
13641        self.connect_channel_to_dai(server_end)?;
13642        Ok(proxy)
13643    }
13644
13645    /// Like `connect_to_dai`, but accepts a server end.
13646    /// See [`Self::connect_to_dai`] for more details.
13647    pub fn connect_channel_to_dai(
13648        &self,
13649        server_end: fidl::endpoints::ServerEnd<DaiMarker>,
13650    ) -> Result<(), fidl::Error> {
13651        self.0.open_member("dai", server_end.into_channel())
13652    }
13653
13654    pub fn instance_name(&self) -> &str {
13655        self.0.instance_name()
13656    }
13657}
13658
13659#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13660pub struct DeviceServiceMarker;
13661
13662#[cfg(target_os = "fuchsia")]
13663impl fidl::endpoints::ServiceMarker for DeviceServiceMarker {
13664    type Proxy = DeviceServiceProxy;
13665    type Request = DeviceServiceRequest;
13666    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DeviceService";
13667}
13668
13669/// A request for one of the member protocols of DeviceService.
13670///
13671#[cfg(target_os = "fuchsia")]
13672pub enum DeviceServiceRequest {
13673    Device(CompositeRequestStream),
13674}
13675
13676#[cfg(target_os = "fuchsia")]
13677impl fidl::endpoints::ServiceRequest for DeviceServiceRequest {
13678    type Service = DeviceServiceMarker;
13679
13680    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13681        match name {
13682            "device" => Self::Device(
13683                <CompositeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13684            ),
13685            _ => panic!("no such member protocol name for service DeviceService"),
13686        }
13687    }
13688
13689    fn member_names() -> &'static [&'static str] {
13690        &["device"]
13691    }
13692}
13693#[cfg(target_os = "fuchsia")]
13694pub struct DeviceServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
13695
13696#[cfg(target_os = "fuchsia")]
13697impl fidl::endpoints::ServiceProxy for DeviceServiceProxy {
13698    type Service = DeviceServiceMarker;
13699
13700    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13701        Self(opener)
13702    }
13703}
13704
13705#[cfg(target_os = "fuchsia")]
13706impl DeviceServiceProxy {
13707    pub fn connect_to_device(&self) -> Result<CompositeProxy, fidl::Error> {
13708        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeMarker>();
13709        self.connect_channel_to_device(server_end)?;
13710        Ok(proxy)
13711    }
13712
13713    /// Like `connect_to_device`, but returns a sync proxy.
13714    /// See [`Self::connect_to_device`] for more details.
13715    pub fn connect_to_device_sync(&self) -> Result<CompositeSynchronousProxy, fidl::Error> {
13716        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeMarker>();
13717        self.connect_channel_to_device(server_end)?;
13718        Ok(proxy)
13719    }
13720
13721    /// Like `connect_to_device`, but accepts a server end.
13722    /// See [`Self::connect_to_device`] for more details.
13723    pub fn connect_channel_to_device(
13724        &self,
13725        server_end: fidl::endpoints::ServerEnd<CompositeMarker>,
13726    ) -> Result<(), fidl::Error> {
13727        self.0.open_member("device", server_end.into_channel())
13728    }
13729
13730    pub fn instance_name(&self) -> &str {
13731        self.0.instance_name()
13732    }
13733}
13734
13735#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13736pub struct StreamConfigConnectorInputServiceMarker;
13737
13738#[cfg(target_os = "fuchsia")]
13739impl fidl::endpoints::ServiceMarker for StreamConfigConnectorInputServiceMarker {
13740    type Proxy = StreamConfigConnectorInputServiceProxy;
13741    type Request = StreamConfigConnectorInputServiceRequest;
13742    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorInputService";
13743}
13744
13745/// A request for one of the member protocols of StreamConfigConnectorInputService.
13746///
13747#[cfg(target_os = "fuchsia")]
13748pub enum StreamConfigConnectorInputServiceRequest {
13749    StreamConfigConnector(StreamConfigConnectorRequestStream),
13750}
13751
13752#[cfg(target_os = "fuchsia")]
13753impl fidl::endpoints::ServiceRequest for StreamConfigConnectorInputServiceRequest {
13754    type Service = StreamConfigConnectorInputServiceMarker;
13755
13756    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13757        match name {
13758            "stream_config_connector" => Self::StreamConfigConnector(
13759                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13760            ),
13761            _ => panic!("no such member protocol name for service StreamConfigConnectorInputService"),
13762        }
13763    }
13764
13765    fn member_names() -> &'static [&'static str] {
13766        &["stream_config_connector"]
13767    }
13768}
13769#[cfg(target_os = "fuchsia")]
13770pub struct StreamConfigConnectorInputServiceProxy(
13771    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13772);
13773
13774#[cfg(target_os = "fuchsia")]
13775impl fidl::endpoints::ServiceProxy for StreamConfigConnectorInputServiceProxy {
13776    type Service = StreamConfigConnectorInputServiceMarker;
13777
13778    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13779        Self(opener)
13780    }
13781}
13782
13783#[cfg(target_os = "fuchsia")]
13784impl StreamConfigConnectorInputServiceProxy {
13785    pub fn connect_to_stream_config_connector(
13786        &self,
13787    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13788        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13789        self.connect_channel_to_stream_config_connector(server_end)?;
13790        Ok(proxy)
13791    }
13792
13793    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13794    /// See [`Self::connect_to_stream_config_connector`] for more details.
13795    pub fn connect_to_stream_config_connector_sync(
13796        &self,
13797    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13798        let (proxy, server_end) =
13799            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13800        self.connect_channel_to_stream_config_connector(server_end)?;
13801        Ok(proxy)
13802    }
13803
13804    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13805    /// See [`Self::connect_to_stream_config_connector`] for more details.
13806    pub fn connect_channel_to_stream_config_connector(
13807        &self,
13808        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13809    ) -> Result<(), fidl::Error> {
13810        self.0.open_member("stream_config_connector", server_end.into_channel())
13811    }
13812
13813    pub fn instance_name(&self) -> &str {
13814        self.0.instance_name()
13815    }
13816}
13817
13818#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13819pub struct StreamConfigConnectorOutputServiceMarker;
13820
13821#[cfg(target_os = "fuchsia")]
13822impl fidl::endpoints::ServiceMarker for StreamConfigConnectorOutputServiceMarker {
13823    type Proxy = StreamConfigConnectorOutputServiceProxy;
13824    type Request = StreamConfigConnectorOutputServiceRequest;
13825    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorOutputService";
13826}
13827
13828/// A request for one of the member protocols of StreamConfigConnectorOutputService.
13829///
13830#[cfg(target_os = "fuchsia")]
13831pub enum StreamConfigConnectorOutputServiceRequest {
13832    StreamConfigConnector(StreamConfigConnectorRequestStream),
13833}
13834
13835#[cfg(target_os = "fuchsia")]
13836impl fidl::endpoints::ServiceRequest for StreamConfigConnectorOutputServiceRequest {
13837    type Service = StreamConfigConnectorOutputServiceMarker;
13838
13839    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13840        match name {
13841            "stream_config_connector" => Self::StreamConfigConnector(
13842                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13843            ),
13844            _ => panic!("no such member protocol name for service StreamConfigConnectorOutputService"),
13845        }
13846    }
13847
13848    fn member_names() -> &'static [&'static str] {
13849        &["stream_config_connector"]
13850    }
13851}
13852#[cfg(target_os = "fuchsia")]
13853pub struct StreamConfigConnectorOutputServiceProxy(
13854    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13855);
13856
13857#[cfg(target_os = "fuchsia")]
13858impl fidl::endpoints::ServiceProxy for StreamConfigConnectorOutputServiceProxy {
13859    type Service = StreamConfigConnectorOutputServiceMarker;
13860
13861    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13862        Self(opener)
13863    }
13864}
13865
13866#[cfg(target_os = "fuchsia")]
13867impl StreamConfigConnectorOutputServiceProxy {
13868    pub fn connect_to_stream_config_connector(
13869        &self,
13870    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13871        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13872        self.connect_channel_to_stream_config_connector(server_end)?;
13873        Ok(proxy)
13874    }
13875
13876    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13877    /// See [`Self::connect_to_stream_config_connector`] for more details.
13878    pub fn connect_to_stream_config_connector_sync(
13879        &self,
13880    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13881        let (proxy, server_end) =
13882            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13883        self.connect_channel_to_stream_config_connector(server_end)?;
13884        Ok(proxy)
13885    }
13886
13887    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13888    /// See [`Self::connect_to_stream_config_connector`] for more details.
13889    pub fn connect_channel_to_stream_config_connector(
13890        &self,
13891        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13892    ) -> Result<(), fidl::Error> {
13893        self.0.open_member("stream_config_connector", server_end.into_channel())
13894    }
13895
13896    pub fn instance_name(&self) -> &str {
13897        self.0.instance_name()
13898    }
13899}
13900
13901#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13902pub struct StreamConfigConnectorServiceMarker;
13903
13904#[cfg(target_os = "fuchsia")]
13905impl fidl::endpoints::ServiceMarker for StreamConfigConnectorServiceMarker {
13906    type Proxy = StreamConfigConnectorServiceProxy;
13907    type Request = StreamConfigConnectorServiceRequest;
13908    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorService";
13909}
13910
13911/// A request for one of the member protocols of StreamConfigConnectorService.
13912///
13913/// # Deprecation
13914///
13915/// Not supported anymore, instead use an
13916/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13917/// with one Ring Buffer, see
13918/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13919#[cfg(target_os = "fuchsia")]
13920pub enum StreamConfigConnectorServiceRequest {
13921    StreamConfigConnector(StreamConfigConnectorRequestStream),
13922}
13923
13924#[cfg(target_os = "fuchsia")]
13925impl fidl::endpoints::ServiceRequest for StreamConfigConnectorServiceRequest {
13926    type Service = StreamConfigConnectorServiceMarker;
13927
13928    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
13929        match name {
13930            "stream_config_connector" => Self::StreamConfigConnector(
13931                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
13932            ),
13933            _ => panic!("no such member protocol name for service StreamConfigConnectorService"),
13934        }
13935    }
13936
13937    fn member_names() -> &'static [&'static str] {
13938        &["stream_config_connector"]
13939    }
13940}
13941/// # Deprecation
13942///
13943/// Not supported anymore, instead use an
13944/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
13945/// with one Ring Buffer, see
13946/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
13947#[cfg(target_os = "fuchsia")]
13948pub struct StreamConfigConnectorServiceProxy(
13949    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
13950);
13951
13952#[cfg(target_os = "fuchsia")]
13953impl fidl::endpoints::ServiceProxy for StreamConfigConnectorServiceProxy {
13954    type Service = StreamConfigConnectorServiceMarker;
13955
13956    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
13957        Self(opener)
13958    }
13959}
13960
13961#[cfg(target_os = "fuchsia")]
13962impl StreamConfigConnectorServiceProxy {
13963    pub fn connect_to_stream_config_connector(
13964        &self,
13965    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
13966        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
13967        self.connect_channel_to_stream_config_connector(server_end)?;
13968        Ok(proxy)
13969    }
13970
13971    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
13972    /// See [`Self::connect_to_stream_config_connector`] for more details.
13973    pub fn connect_to_stream_config_connector_sync(
13974        &self,
13975    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
13976        let (proxy, server_end) =
13977            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
13978        self.connect_channel_to_stream_config_connector(server_end)?;
13979        Ok(proxy)
13980    }
13981
13982    /// Like `connect_to_stream_config_connector`, but accepts a server end.
13983    /// See [`Self::connect_to_stream_config_connector`] for more details.
13984    pub fn connect_channel_to_stream_config_connector(
13985        &self,
13986        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
13987    ) -> Result<(), fidl::Error> {
13988        self.0.open_member("stream_config_connector", server_end.into_channel())
13989    }
13990
13991    pub fn instance_name(&self) -> &str {
13992        self.0.instance_name()
13993    }
13994}
13995
13996#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13997pub struct StreamConfigServiceMarker;
13998
13999#[cfg(target_os = "fuchsia")]
14000impl fidl::endpoints::ServiceMarker for StreamConfigServiceMarker {
14001    type Proxy = StreamConfigServiceProxy;
14002    type Request = StreamConfigServiceRequest;
14003    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigService";
14004}
14005
14006/// A request for one of the member protocols of StreamConfigService.
14007///
14008/// # Deprecation
14009///
14010/// Not supported anymore, instead use an
14011/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
14012/// with one Ring Buffer, see
14013/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
14014#[cfg(target_os = "fuchsia")]
14015pub enum StreamConfigServiceRequest {
14016    StreamConfig(StreamConfigRequestStream),
14017}
14018
14019#[cfg(target_os = "fuchsia")]
14020impl fidl::endpoints::ServiceRequest for StreamConfigServiceRequest {
14021    type Service = StreamConfigServiceMarker;
14022
14023    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
14024        match name {
14025            "stream_config" => Self::StreamConfig(
14026                <StreamConfigRequestStream as fidl::endpoints::RequestStream>::from_channel(
14027                    _channel,
14028                ),
14029            ),
14030            _ => panic!("no such member protocol name for service StreamConfigService"),
14031        }
14032    }
14033
14034    fn member_names() -> &'static [&'static str] {
14035        &["stream_config"]
14036    }
14037}
14038/// # Deprecation
14039///
14040/// Not supported anymore, instead use an
14041/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
14042/// with one Ring Buffer, see
14043/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
14044#[cfg(target_os = "fuchsia")]
14045pub struct StreamConfigServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
14046
14047#[cfg(target_os = "fuchsia")]
14048impl fidl::endpoints::ServiceProxy for StreamConfigServiceProxy {
14049    type Service = StreamConfigServiceMarker;
14050
14051    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
14052        Self(opener)
14053    }
14054}
14055
14056#[cfg(target_os = "fuchsia")]
14057impl StreamConfigServiceProxy {
14058    pub fn connect_to_stream_config(&self) -> Result<StreamConfigProxy, fidl::Error> {
14059        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigMarker>();
14060        self.connect_channel_to_stream_config(server_end)?;
14061        Ok(proxy)
14062    }
14063
14064    /// Like `connect_to_stream_config`, but returns a sync proxy.
14065    /// See [`Self::connect_to_stream_config`] for more details.
14066    pub fn connect_to_stream_config_sync(
14067        &self,
14068    ) -> Result<StreamConfigSynchronousProxy, fidl::Error> {
14069        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<StreamConfigMarker>();
14070        self.connect_channel_to_stream_config(server_end)?;
14071        Ok(proxy)
14072    }
14073
14074    /// Like `connect_to_stream_config`, but accepts a server end.
14075    /// See [`Self::connect_to_stream_config`] for more details.
14076    pub fn connect_channel_to_stream_config(
14077        &self,
14078        server_end: fidl::endpoints::ServerEnd<StreamConfigMarker>,
14079    ) -> Result<(), fidl::Error> {
14080        self.0.open_member("stream_config", server_end.into_channel())
14081    }
14082
14083    pub fn instance_name(&self) -> &str {
14084        self.0.instance_name()
14085    }
14086}
14087
14088mod internal {
14089    use super::*;
14090
14091    impl fidl::encoding::ResourceTypeMarker for CodecConnectorConnectRequest {
14092        type Borrowed<'a> = &'a mut Self;
14093        fn take_or_borrow<'a>(
14094            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14095        ) -> Self::Borrowed<'a> {
14096            value
14097        }
14098    }
14099
14100    unsafe impl fidl::encoding::TypeMarker for CodecConnectorConnectRequest {
14101        type Owned = Self;
14102
14103        #[inline(always)]
14104        fn inline_align(_context: fidl::encoding::Context) -> usize {
14105            4
14106        }
14107
14108        #[inline(always)]
14109        fn inline_size(_context: fidl::encoding::Context) -> usize {
14110            4
14111        }
14112    }
14113
14114    unsafe impl
14115        fidl::encoding::Encode<
14116            CodecConnectorConnectRequest,
14117            fidl::encoding::DefaultFuchsiaResourceDialect,
14118        > for &mut CodecConnectorConnectRequest
14119    {
14120        #[inline]
14121        unsafe fn encode(
14122            self,
14123            encoder: &mut fidl::encoding::Encoder<
14124                '_,
14125                fidl::encoding::DefaultFuchsiaResourceDialect,
14126            >,
14127            offset: usize,
14128            _depth: fidl::encoding::Depth,
14129        ) -> fidl::Result<()> {
14130            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
14131            // Delegate to tuple encoding.
14132            fidl::encoding::Encode::<CodecConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14133                (
14134                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.codec_protocol),
14135                ),
14136                encoder, offset, _depth
14137            )
14138        }
14139    }
14140    unsafe impl<
14141        T0: fidl::encoding::Encode<
14142                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14143                fidl::encoding::DefaultFuchsiaResourceDialect,
14144            >,
14145    >
14146        fidl::encoding::Encode<
14147            CodecConnectorConnectRequest,
14148            fidl::encoding::DefaultFuchsiaResourceDialect,
14149        > for (T0,)
14150    {
14151        #[inline]
14152        unsafe fn encode(
14153            self,
14154            encoder: &mut fidl::encoding::Encoder<
14155                '_,
14156                fidl::encoding::DefaultFuchsiaResourceDialect,
14157            >,
14158            offset: usize,
14159            depth: fidl::encoding::Depth,
14160        ) -> fidl::Result<()> {
14161            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
14162            // Zero out padding regions. There's no need to apply masks
14163            // because the unmasked parts will be overwritten by fields.
14164            // Write the fields.
14165            self.0.encode(encoder, offset + 0, depth)?;
14166            Ok(())
14167        }
14168    }
14169
14170    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14171        for CodecConnectorConnectRequest
14172    {
14173        #[inline(always)]
14174        fn new_empty() -> Self {
14175            Self {
14176                codec_protocol: fidl::new_empty!(
14177                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14178                    fidl::encoding::DefaultFuchsiaResourceDialect
14179                ),
14180            }
14181        }
14182
14183        #[inline]
14184        unsafe fn decode(
14185            &mut self,
14186            decoder: &mut fidl::encoding::Decoder<
14187                '_,
14188                fidl::encoding::DefaultFuchsiaResourceDialect,
14189            >,
14190            offset: usize,
14191            _depth: fidl::encoding::Depth,
14192        ) -> fidl::Result<()> {
14193            decoder.debug_check_bounds::<Self>(offset);
14194            // Verify that padding bytes are zero.
14195            fidl::decode!(
14196                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
14197                fidl::encoding::DefaultFuchsiaResourceDialect,
14198                &mut self.codec_protocol,
14199                decoder,
14200                offset + 0,
14201                _depth
14202            )?;
14203            Ok(())
14204        }
14205    }
14206
14207    impl fidl::encoding::ResourceTypeMarker for CompositeConnectorConnectRequest {
14208        type Borrowed<'a> = &'a mut Self;
14209        fn take_or_borrow<'a>(
14210            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14211        ) -> Self::Borrowed<'a> {
14212            value
14213        }
14214    }
14215
14216    unsafe impl fidl::encoding::TypeMarker for CompositeConnectorConnectRequest {
14217        type Owned = Self;
14218
14219        #[inline(always)]
14220        fn inline_align(_context: fidl::encoding::Context) -> usize {
14221            4
14222        }
14223
14224        #[inline(always)]
14225        fn inline_size(_context: fidl::encoding::Context) -> usize {
14226            4
14227        }
14228    }
14229
14230    unsafe impl
14231        fidl::encoding::Encode<
14232            CompositeConnectorConnectRequest,
14233            fidl::encoding::DefaultFuchsiaResourceDialect,
14234        > for &mut CompositeConnectorConnectRequest
14235    {
14236        #[inline]
14237        unsafe fn encode(
14238            self,
14239            encoder: &mut fidl::encoding::Encoder<
14240                '_,
14241                fidl::encoding::DefaultFuchsiaResourceDialect,
14242            >,
14243            offset: usize,
14244            _depth: fidl::encoding::Depth,
14245        ) -> fidl::Result<()> {
14246            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
14247            // Delegate to tuple encoding.
14248            fidl::encoding::Encode::<CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14249                (
14250                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.composite_protocol),
14251                ),
14252                encoder, offset, _depth
14253            )
14254        }
14255    }
14256    unsafe impl<
14257        T0: fidl::encoding::Encode<
14258                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14259                fidl::encoding::DefaultFuchsiaResourceDialect,
14260            >,
14261    >
14262        fidl::encoding::Encode<
14263            CompositeConnectorConnectRequest,
14264            fidl::encoding::DefaultFuchsiaResourceDialect,
14265        > for (T0,)
14266    {
14267        #[inline]
14268        unsafe fn encode(
14269            self,
14270            encoder: &mut fidl::encoding::Encoder<
14271                '_,
14272                fidl::encoding::DefaultFuchsiaResourceDialect,
14273            >,
14274            offset: usize,
14275            depth: fidl::encoding::Depth,
14276        ) -> fidl::Result<()> {
14277            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
14278            // Zero out padding regions. There's no need to apply masks
14279            // because the unmasked parts will be overwritten by fields.
14280            // Write the fields.
14281            self.0.encode(encoder, offset + 0, depth)?;
14282            Ok(())
14283        }
14284    }
14285
14286    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14287        for CompositeConnectorConnectRequest
14288    {
14289        #[inline(always)]
14290        fn new_empty() -> Self {
14291            Self {
14292                composite_protocol: fidl::new_empty!(
14293                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14294                    fidl::encoding::DefaultFuchsiaResourceDialect
14295                ),
14296            }
14297        }
14298
14299        #[inline]
14300        unsafe fn decode(
14301            &mut self,
14302            decoder: &mut fidl::encoding::Decoder<
14303                '_,
14304                fidl::encoding::DefaultFuchsiaResourceDialect,
14305            >,
14306            offset: usize,
14307            _depth: fidl::encoding::Depth,
14308        ) -> fidl::Result<()> {
14309            decoder.debug_check_bounds::<Self>(offset);
14310            // Verify that padding bytes are zero.
14311            fidl::decode!(
14312                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
14313                fidl::encoding::DefaultFuchsiaResourceDialect,
14314                &mut self.composite_protocol,
14315                decoder,
14316                offset + 0,
14317                _depth
14318            )?;
14319            Ok(())
14320        }
14321    }
14322
14323    impl fidl::encoding::ResourceTypeMarker for CompositeCreatePacketStreamRequest {
14324        type Borrowed<'a> = &'a mut Self;
14325        fn take_or_borrow<'a>(
14326            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14327        ) -> Self::Borrowed<'a> {
14328            value
14329        }
14330    }
14331
14332    unsafe impl fidl::encoding::TypeMarker for CompositeCreatePacketStreamRequest {
14333        type Owned = Self;
14334
14335        #[inline(always)]
14336        fn inline_align(_context: fidl::encoding::Context) -> usize {
14337            8
14338        }
14339
14340        #[inline(always)]
14341        fn inline_size(_context: fidl::encoding::Context) -> usize {
14342            32
14343        }
14344    }
14345
14346    unsafe impl
14347        fidl::encoding::Encode<
14348            CompositeCreatePacketStreamRequest,
14349            fidl::encoding::DefaultFuchsiaResourceDialect,
14350        > for &mut CompositeCreatePacketStreamRequest
14351    {
14352        #[inline]
14353        unsafe fn encode(
14354            self,
14355            encoder: &mut fidl::encoding::Encoder<
14356                '_,
14357                fidl::encoding::DefaultFuchsiaResourceDialect,
14358            >,
14359            offset: usize,
14360            _depth: fidl::encoding::Depth,
14361        ) -> fidl::Result<()> {
14362            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
14363            // Delegate to tuple encoding.
14364            fidl::encoding::Encode::<CompositeCreatePacketStreamRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14365                (
14366                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
14367                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
14368                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.packet_stream_control),
14369                ),
14370                encoder, offset, _depth
14371            )
14372        }
14373    }
14374    unsafe impl<
14375        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
14376        T1: fidl::encoding::Encode<Format2, fidl::encoding::DefaultFuchsiaResourceDialect>,
14377        T2: fidl::encoding::Encode<
14378                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14379                fidl::encoding::DefaultFuchsiaResourceDialect,
14380            >,
14381    >
14382        fidl::encoding::Encode<
14383            CompositeCreatePacketStreamRequest,
14384            fidl::encoding::DefaultFuchsiaResourceDialect,
14385        > for (T0, T1, T2)
14386    {
14387        #[inline]
14388        unsafe fn encode(
14389            self,
14390            encoder: &mut fidl::encoding::Encoder<
14391                '_,
14392                fidl::encoding::DefaultFuchsiaResourceDialect,
14393            >,
14394            offset: usize,
14395            depth: fidl::encoding::Depth,
14396        ) -> fidl::Result<()> {
14397            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
14398            // Zero out padding regions. There's no need to apply masks
14399            // because the unmasked parts will be overwritten by fields.
14400            unsafe {
14401                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
14402                (ptr as *mut u64).write_unaligned(0);
14403            }
14404            // Write the fields.
14405            self.0.encode(encoder, offset + 0, depth)?;
14406            self.1.encode(encoder, offset + 8, depth)?;
14407            self.2.encode(encoder, offset + 24, depth)?;
14408            Ok(())
14409        }
14410    }
14411
14412    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14413        for CompositeCreatePacketStreamRequest
14414    {
14415        #[inline(always)]
14416        fn new_empty() -> Self {
14417            Self {
14418                processing_element_id: fidl::new_empty!(
14419                    u64,
14420                    fidl::encoding::DefaultFuchsiaResourceDialect
14421                ),
14422                format: fidl::new_empty!(Format2, fidl::encoding::DefaultFuchsiaResourceDialect),
14423                packet_stream_control: fidl::new_empty!(
14424                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14425                    fidl::encoding::DefaultFuchsiaResourceDialect
14426                ),
14427            }
14428        }
14429
14430        #[inline]
14431        unsafe fn decode(
14432            &mut self,
14433            decoder: &mut fidl::encoding::Decoder<
14434                '_,
14435                fidl::encoding::DefaultFuchsiaResourceDialect,
14436            >,
14437            offset: usize,
14438            _depth: fidl::encoding::Depth,
14439        ) -> fidl::Result<()> {
14440            decoder.debug_check_bounds::<Self>(offset);
14441            // Verify that padding bytes are zero.
14442            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
14443            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14444            let mask = 0xffffffff00000000u64;
14445            let maskedval = padval & mask;
14446            if maskedval != 0 {
14447                return Err(fidl::Error::NonZeroPadding {
14448                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
14449                });
14450            }
14451            fidl::decode!(
14452                u64,
14453                fidl::encoding::DefaultFuchsiaResourceDialect,
14454                &mut self.processing_element_id,
14455                decoder,
14456                offset + 0,
14457                _depth
14458            )?;
14459            fidl::decode!(
14460                Format2,
14461                fidl::encoding::DefaultFuchsiaResourceDialect,
14462                &mut self.format,
14463                decoder,
14464                offset + 8,
14465                _depth
14466            )?;
14467            fidl::decode!(
14468                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PacketStreamControlMarker>>,
14469                fidl::encoding::DefaultFuchsiaResourceDialect,
14470                &mut self.packet_stream_control,
14471                decoder,
14472                offset + 24,
14473                _depth
14474            )?;
14475            Ok(())
14476        }
14477    }
14478
14479    impl fidl::encoding::ResourceTypeMarker for CompositeCreateRingBufferRequest {
14480        type Borrowed<'a> = &'a mut Self;
14481        fn take_or_borrow<'a>(
14482            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14483        ) -> Self::Borrowed<'a> {
14484            value
14485        }
14486    }
14487
14488    unsafe impl fidl::encoding::TypeMarker for CompositeCreateRingBufferRequest {
14489        type Owned = Self;
14490
14491        #[inline(always)]
14492        fn inline_align(_context: fidl::encoding::Context) -> usize {
14493            8
14494        }
14495
14496        #[inline(always)]
14497        fn inline_size(_context: fidl::encoding::Context) -> usize {
14498            32
14499        }
14500    }
14501
14502    unsafe impl
14503        fidl::encoding::Encode<
14504            CompositeCreateRingBufferRequest,
14505            fidl::encoding::DefaultFuchsiaResourceDialect,
14506        > for &mut CompositeCreateRingBufferRequest
14507    {
14508        #[inline]
14509        unsafe fn encode(
14510            self,
14511            encoder: &mut fidl::encoding::Encoder<
14512                '_,
14513                fidl::encoding::DefaultFuchsiaResourceDialect,
14514            >,
14515            offset: usize,
14516            _depth: fidl::encoding::Depth,
14517        ) -> fidl::Result<()> {
14518            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
14519            // Delegate to tuple encoding.
14520            fidl::encoding::Encode::<CompositeCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14521                (
14522                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
14523                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
14524                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
14525                ),
14526                encoder, offset, _depth
14527            )
14528        }
14529    }
14530    unsafe impl<
14531        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
14532        T1: fidl::encoding::Encode<Format2, fidl::encoding::DefaultFuchsiaResourceDialect>,
14533        T2: fidl::encoding::Encode<
14534                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14535                fidl::encoding::DefaultFuchsiaResourceDialect,
14536            >,
14537    >
14538        fidl::encoding::Encode<
14539            CompositeCreateRingBufferRequest,
14540            fidl::encoding::DefaultFuchsiaResourceDialect,
14541        > for (T0, T1, T2)
14542    {
14543        #[inline]
14544        unsafe fn encode(
14545            self,
14546            encoder: &mut fidl::encoding::Encoder<
14547                '_,
14548                fidl::encoding::DefaultFuchsiaResourceDialect,
14549            >,
14550            offset: usize,
14551            depth: fidl::encoding::Depth,
14552        ) -> fidl::Result<()> {
14553            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
14554            // Zero out padding regions. There's no need to apply masks
14555            // because the unmasked parts will be overwritten by fields.
14556            unsafe {
14557                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
14558                (ptr as *mut u64).write_unaligned(0);
14559            }
14560            // Write the fields.
14561            self.0.encode(encoder, offset + 0, depth)?;
14562            self.1.encode(encoder, offset + 8, depth)?;
14563            self.2.encode(encoder, offset + 24, depth)?;
14564            Ok(())
14565        }
14566    }
14567
14568    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14569        for CompositeCreateRingBufferRequest
14570    {
14571        #[inline(always)]
14572        fn new_empty() -> Self {
14573            Self {
14574                processing_element_id: fidl::new_empty!(
14575                    u64,
14576                    fidl::encoding::DefaultFuchsiaResourceDialect
14577                ),
14578                format: fidl::new_empty!(Format2, fidl::encoding::DefaultFuchsiaResourceDialect),
14579                ring_buffer: fidl::new_empty!(
14580                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14581                    fidl::encoding::DefaultFuchsiaResourceDialect
14582                ),
14583            }
14584        }
14585
14586        #[inline]
14587        unsafe fn decode(
14588            &mut self,
14589            decoder: &mut fidl::encoding::Decoder<
14590                '_,
14591                fidl::encoding::DefaultFuchsiaResourceDialect,
14592            >,
14593            offset: usize,
14594            _depth: fidl::encoding::Depth,
14595        ) -> fidl::Result<()> {
14596            decoder.debug_check_bounds::<Self>(offset);
14597            // Verify that padding bytes are zero.
14598            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
14599            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14600            let mask = 0xffffffff00000000u64;
14601            let maskedval = padval & mask;
14602            if maskedval != 0 {
14603                return Err(fidl::Error::NonZeroPadding {
14604                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
14605                });
14606            }
14607            fidl::decode!(
14608                u64,
14609                fidl::encoding::DefaultFuchsiaResourceDialect,
14610                &mut self.processing_element_id,
14611                decoder,
14612                offset + 0,
14613                _depth
14614            )?;
14615            fidl::decode!(
14616                Format2,
14617                fidl::encoding::DefaultFuchsiaResourceDialect,
14618                &mut self.format,
14619                decoder,
14620                offset + 8,
14621                _depth
14622            )?;
14623            fidl::decode!(
14624                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14625                fidl::encoding::DefaultFuchsiaResourceDialect,
14626                &mut self.ring_buffer,
14627                decoder,
14628                offset + 24,
14629                _depth
14630            )?;
14631            Ok(())
14632        }
14633    }
14634
14635    impl fidl::encoding::ResourceTypeMarker for DaiConnectorConnectRequest {
14636        type Borrowed<'a> = &'a mut Self;
14637        fn take_or_borrow<'a>(
14638            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14639        ) -> Self::Borrowed<'a> {
14640            value
14641        }
14642    }
14643
14644    unsafe impl fidl::encoding::TypeMarker for DaiConnectorConnectRequest {
14645        type Owned = Self;
14646
14647        #[inline(always)]
14648        fn inline_align(_context: fidl::encoding::Context) -> usize {
14649            4
14650        }
14651
14652        #[inline(always)]
14653        fn inline_size(_context: fidl::encoding::Context) -> usize {
14654            4
14655        }
14656    }
14657
14658    unsafe impl
14659        fidl::encoding::Encode<
14660            DaiConnectorConnectRequest,
14661            fidl::encoding::DefaultFuchsiaResourceDialect,
14662        > for &mut DaiConnectorConnectRequest
14663    {
14664        #[inline]
14665        unsafe fn encode(
14666            self,
14667            encoder: &mut fidl::encoding::Encoder<
14668                '_,
14669                fidl::encoding::DefaultFuchsiaResourceDialect,
14670            >,
14671            offset: usize,
14672            _depth: fidl::encoding::Depth,
14673        ) -> fidl::Result<()> {
14674            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
14675            // Delegate to tuple encoding.
14676            fidl::encoding::Encode::<DaiConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14677                (
14678                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dai_protocol),
14679                ),
14680                encoder, offset, _depth
14681            )
14682        }
14683    }
14684    unsafe impl<
14685        T0: fidl::encoding::Encode<
14686                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14687                fidl::encoding::DefaultFuchsiaResourceDialect,
14688            >,
14689    >
14690        fidl::encoding::Encode<
14691            DaiConnectorConnectRequest,
14692            fidl::encoding::DefaultFuchsiaResourceDialect,
14693        > for (T0,)
14694    {
14695        #[inline]
14696        unsafe fn encode(
14697            self,
14698            encoder: &mut fidl::encoding::Encoder<
14699                '_,
14700                fidl::encoding::DefaultFuchsiaResourceDialect,
14701            >,
14702            offset: usize,
14703            depth: fidl::encoding::Depth,
14704        ) -> fidl::Result<()> {
14705            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
14706            // Zero out padding regions. There's no need to apply masks
14707            // because the unmasked parts will be overwritten by fields.
14708            // Write the fields.
14709            self.0.encode(encoder, offset + 0, depth)?;
14710            Ok(())
14711        }
14712    }
14713
14714    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14715        for DaiConnectorConnectRequest
14716    {
14717        #[inline(always)]
14718        fn new_empty() -> Self {
14719            Self {
14720                dai_protocol: fidl::new_empty!(
14721                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14722                    fidl::encoding::DefaultFuchsiaResourceDialect
14723                ),
14724            }
14725        }
14726
14727        #[inline]
14728        unsafe fn decode(
14729            &mut self,
14730            decoder: &mut fidl::encoding::Decoder<
14731                '_,
14732                fidl::encoding::DefaultFuchsiaResourceDialect,
14733            >,
14734            offset: usize,
14735            _depth: fidl::encoding::Depth,
14736        ) -> fidl::Result<()> {
14737            decoder.debug_check_bounds::<Self>(offset);
14738            // Verify that padding bytes are zero.
14739            fidl::decode!(
14740                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
14741                fidl::encoding::DefaultFuchsiaResourceDialect,
14742                &mut self.dai_protocol,
14743                decoder,
14744                offset + 0,
14745                _depth
14746            )?;
14747            Ok(())
14748        }
14749    }
14750
14751    impl fidl::encoding::ResourceTypeMarker for DaiCreateRingBufferRequest {
14752        type Borrowed<'a> = &'a mut Self;
14753        fn take_or_borrow<'a>(
14754            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14755        ) -> Self::Borrowed<'a> {
14756            value
14757        }
14758    }
14759
14760    unsafe impl fidl::encoding::TypeMarker for DaiCreateRingBufferRequest {
14761        type Owned = Self;
14762
14763        #[inline(always)]
14764        fn inline_align(_context: fidl::encoding::Context) -> usize {
14765            8
14766        }
14767
14768        #[inline(always)]
14769        fn inline_size(_context: fidl::encoding::Context) -> usize {
14770            72
14771        }
14772    }
14773
14774    unsafe impl
14775        fidl::encoding::Encode<
14776            DaiCreateRingBufferRequest,
14777            fidl::encoding::DefaultFuchsiaResourceDialect,
14778        > for &mut DaiCreateRingBufferRequest
14779    {
14780        #[inline]
14781        unsafe fn encode(
14782            self,
14783            encoder: &mut fidl::encoding::Encoder<
14784                '_,
14785                fidl::encoding::DefaultFuchsiaResourceDialect,
14786            >,
14787            offset: usize,
14788            _depth: fidl::encoding::Depth,
14789        ) -> fidl::Result<()> {
14790            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
14791            // Delegate to tuple encoding.
14792            fidl::encoding::Encode::<DaiCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14793                (
14794                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_format),
14795                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_format),
14796                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
14797                ),
14798                encoder, offset, _depth
14799            )
14800        }
14801    }
14802    unsafe impl<
14803        T0: fidl::encoding::Encode<DaiFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
14804        T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
14805        T2: fidl::encoding::Encode<
14806                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14807                fidl::encoding::DefaultFuchsiaResourceDialect,
14808            >,
14809    >
14810        fidl::encoding::Encode<
14811            DaiCreateRingBufferRequest,
14812            fidl::encoding::DefaultFuchsiaResourceDialect,
14813        > for (T0, T1, T2)
14814    {
14815        #[inline]
14816        unsafe fn encode(
14817            self,
14818            encoder: &mut fidl::encoding::Encoder<
14819                '_,
14820                fidl::encoding::DefaultFuchsiaResourceDialect,
14821            >,
14822            offset: usize,
14823            depth: fidl::encoding::Depth,
14824        ) -> fidl::Result<()> {
14825            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
14826            // Zero out padding regions. There's no need to apply masks
14827            // because the unmasked parts will be overwritten by fields.
14828            unsafe {
14829                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
14830                (ptr as *mut u64).write_unaligned(0);
14831            }
14832            // Write the fields.
14833            self.0.encode(encoder, offset + 0, depth)?;
14834            self.1.encode(encoder, offset + 48, depth)?;
14835            self.2.encode(encoder, offset + 64, depth)?;
14836            Ok(())
14837        }
14838    }
14839
14840    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14841        for DaiCreateRingBufferRequest
14842    {
14843        #[inline(always)]
14844        fn new_empty() -> Self {
14845            Self {
14846                dai_format: fidl::new_empty!(
14847                    DaiFormat,
14848                    fidl::encoding::DefaultFuchsiaResourceDialect
14849                ),
14850                ring_buffer_format: fidl::new_empty!(
14851                    Format,
14852                    fidl::encoding::DefaultFuchsiaResourceDialect
14853                ),
14854                ring_buffer: fidl::new_empty!(
14855                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14856                    fidl::encoding::DefaultFuchsiaResourceDialect
14857                ),
14858            }
14859        }
14860
14861        #[inline]
14862        unsafe fn decode(
14863            &mut self,
14864            decoder: &mut fidl::encoding::Decoder<
14865                '_,
14866                fidl::encoding::DefaultFuchsiaResourceDialect,
14867            >,
14868            offset: usize,
14869            _depth: fidl::encoding::Depth,
14870        ) -> fidl::Result<()> {
14871            decoder.debug_check_bounds::<Self>(offset);
14872            // Verify that padding bytes are zero.
14873            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
14874            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14875            let mask = 0xffffffff00000000u64;
14876            let maskedval = padval & mask;
14877            if maskedval != 0 {
14878                return Err(fidl::Error::NonZeroPadding {
14879                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
14880                });
14881            }
14882            fidl::decode!(
14883                DaiFormat,
14884                fidl::encoding::DefaultFuchsiaResourceDialect,
14885                &mut self.dai_format,
14886                decoder,
14887                offset + 0,
14888                _depth
14889            )?;
14890            fidl::decode!(
14891                Format,
14892                fidl::encoding::DefaultFuchsiaResourceDialect,
14893                &mut self.ring_buffer_format,
14894                decoder,
14895                offset + 48,
14896                _depth
14897            )?;
14898            fidl::decode!(
14899                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
14900                fidl::encoding::DefaultFuchsiaResourceDialect,
14901                &mut self.ring_buffer,
14902                decoder,
14903                offset + 64,
14904                _depth
14905            )?;
14906            Ok(())
14907        }
14908    }
14909
14910    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlAllocateVmosResponse {
14911        type Borrowed<'a> = &'a mut Self;
14912        fn take_or_borrow<'a>(
14913            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14914        ) -> Self::Borrowed<'a> {
14915            value
14916        }
14917    }
14918
14919    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlAllocateVmosResponse {
14920        type Owned = Self;
14921
14922        #[inline(always)]
14923        fn inline_align(_context: fidl::encoding::Context) -> usize {
14924            8
14925        }
14926
14927        #[inline(always)]
14928        fn inline_size(_context: fidl::encoding::Context) -> usize {
14929            16
14930        }
14931    }
14932
14933    unsafe impl
14934        fidl::encoding::Encode<
14935            PacketStreamControlAllocateVmosResponse,
14936            fidl::encoding::DefaultFuchsiaResourceDialect,
14937        > for &mut PacketStreamControlAllocateVmosResponse
14938    {
14939        #[inline]
14940        unsafe fn encode(
14941            self,
14942            encoder: &mut fidl::encoding::Encoder<
14943                '_,
14944                fidl::encoding::DefaultFuchsiaResourceDialect,
14945            >,
14946            offset: usize,
14947            _depth: fidl::encoding::Depth,
14948        ) -> fidl::Result<()> {
14949            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
14950            // Delegate to tuple encoding.
14951            fidl::encoding::Encode::<PacketStreamControlAllocateVmosResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14952                (
14953                    <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmos),
14954                ),
14955                encoder, offset, _depth
14956            )
14957        }
14958    }
14959    unsafe impl<
14960        T0: fidl::encoding::Encode<
14961                fidl::encoding::Vector<VmoInfo, 256>,
14962                fidl::encoding::DefaultFuchsiaResourceDialect,
14963            >,
14964    >
14965        fidl::encoding::Encode<
14966            PacketStreamControlAllocateVmosResponse,
14967            fidl::encoding::DefaultFuchsiaResourceDialect,
14968        > for (T0,)
14969    {
14970        #[inline]
14971        unsafe fn encode(
14972            self,
14973            encoder: &mut fidl::encoding::Encoder<
14974                '_,
14975                fidl::encoding::DefaultFuchsiaResourceDialect,
14976            >,
14977            offset: usize,
14978            depth: fidl::encoding::Depth,
14979        ) -> fidl::Result<()> {
14980            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
14981            // Zero out padding regions. There's no need to apply masks
14982            // because the unmasked parts will be overwritten by fields.
14983            // Write the fields.
14984            self.0.encode(encoder, offset + 0, depth)?;
14985            Ok(())
14986        }
14987    }
14988
14989    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14990        for PacketStreamControlAllocateVmosResponse
14991    {
14992        #[inline(always)]
14993        fn new_empty() -> Self {
14994            Self {
14995                vmos: fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect),
14996            }
14997        }
14998
14999        #[inline]
15000        unsafe fn decode(
15001            &mut self,
15002            decoder: &mut fidl::encoding::Decoder<
15003                '_,
15004                fidl::encoding::DefaultFuchsiaResourceDialect,
15005            >,
15006            offset: usize,
15007            _depth: fidl::encoding::Depth,
15008        ) -> fidl::Result<()> {
15009            decoder.debug_check_bounds::<Self>(offset);
15010            // Verify that padding bytes are zero.
15011            fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmos, decoder, offset + 0, _depth)?;
15012            Ok(())
15013        }
15014    }
15015
15016    impl fidl::encoding::ResourceTypeMarker for RingBufferGetVmoResponse {
15017        type Borrowed<'a> = &'a mut Self;
15018        fn take_or_borrow<'a>(
15019            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15020        ) -> Self::Borrowed<'a> {
15021            value
15022        }
15023    }
15024
15025    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoResponse {
15026        type Owned = Self;
15027
15028        #[inline(always)]
15029        fn inline_align(_context: fidl::encoding::Context) -> usize {
15030            4
15031        }
15032
15033        #[inline(always)]
15034        fn inline_size(_context: fidl::encoding::Context) -> usize {
15035            8
15036        }
15037    }
15038
15039    unsafe impl
15040        fidl::encoding::Encode<
15041            RingBufferGetVmoResponse,
15042            fidl::encoding::DefaultFuchsiaResourceDialect,
15043        > for &mut RingBufferGetVmoResponse
15044    {
15045        #[inline]
15046        unsafe fn encode(
15047            self,
15048            encoder: &mut fidl::encoding::Encoder<
15049                '_,
15050                fidl::encoding::DefaultFuchsiaResourceDialect,
15051            >,
15052            offset: usize,
15053            _depth: fidl::encoding::Depth,
15054        ) -> fidl::Result<()> {
15055            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
15056            // Delegate to tuple encoding.
15057            fidl::encoding::Encode::<
15058                RingBufferGetVmoResponse,
15059                fidl::encoding::DefaultFuchsiaResourceDialect,
15060            >::encode(
15061                (
15062                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_frames),
15063                    <fidl::encoding::HandleType<
15064                        fidl::Vmo,
15065                        { fidl::ObjectType::VMO.into_raw() },
15066                        2147483648,
15067                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
15068                        &mut self.ring_buffer
15069                    ),
15070                ),
15071                encoder,
15072                offset,
15073                _depth,
15074            )
15075        }
15076    }
15077    unsafe impl<
15078        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
15079        T1: fidl::encoding::Encode<
15080                fidl::encoding::HandleType<
15081                    fidl::Vmo,
15082                    { fidl::ObjectType::VMO.into_raw() },
15083                    2147483648,
15084                >,
15085                fidl::encoding::DefaultFuchsiaResourceDialect,
15086            >,
15087    >
15088        fidl::encoding::Encode<
15089            RingBufferGetVmoResponse,
15090            fidl::encoding::DefaultFuchsiaResourceDialect,
15091        > for (T0, T1)
15092    {
15093        #[inline]
15094        unsafe fn encode(
15095            self,
15096            encoder: &mut fidl::encoding::Encoder<
15097                '_,
15098                fidl::encoding::DefaultFuchsiaResourceDialect,
15099            >,
15100            offset: usize,
15101            depth: fidl::encoding::Depth,
15102        ) -> fidl::Result<()> {
15103            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
15104            // Zero out padding regions. There's no need to apply masks
15105            // because the unmasked parts will be overwritten by fields.
15106            // Write the fields.
15107            self.0.encode(encoder, offset + 0, depth)?;
15108            self.1.encode(encoder, offset + 4, depth)?;
15109            Ok(())
15110        }
15111    }
15112
15113    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15114        for RingBufferGetVmoResponse
15115    {
15116        #[inline(always)]
15117        fn new_empty() -> Self {
15118            Self {
15119                num_frames: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
15120                ring_buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
15121            }
15122        }
15123
15124        #[inline]
15125        unsafe fn decode(
15126            &mut self,
15127            decoder: &mut fidl::encoding::Decoder<
15128                '_,
15129                fidl::encoding::DefaultFuchsiaResourceDialect,
15130            >,
15131            offset: usize,
15132            _depth: fidl::encoding::Depth,
15133        ) -> fidl::Result<()> {
15134            decoder.debug_check_bounds::<Self>(offset);
15135            // Verify that padding bytes are zero.
15136            fidl::decode!(
15137                u32,
15138                fidl::encoding::DefaultFuchsiaResourceDialect,
15139                &mut self.num_frames,
15140                decoder,
15141                offset + 0,
15142                _depth
15143            )?;
15144            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.ring_buffer, decoder, offset + 4, _depth)?;
15145            Ok(())
15146        }
15147    }
15148
15149    impl fidl::encoding::ResourceTypeMarker for StreamConfigConnectorConnectRequest {
15150        type Borrowed<'a> = &'a mut Self;
15151        fn take_or_borrow<'a>(
15152            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15153        ) -> Self::Borrowed<'a> {
15154            value
15155        }
15156    }
15157
15158    unsafe impl fidl::encoding::TypeMarker for StreamConfigConnectorConnectRequest {
15159        type Owned = Self;
15160
15161        #[inline(always)]
15162        fn inline_align(_context: fidl::encoding::Context) -> usize {
15163            4
15164        }
15165
15166        #[inline(always)]
15167        fn inline_size(_context: fidl::encoding::Context) -> usize {
15168            4
15169        }
15170    }
15171
15172    unsafe impl
15173        fidl::encoding::Encode<
15174            StreamConfigConnectorConnectRequest,
15175            fidl::encoding::DefaultFuchsiaResourceDialect,
15176        > for &mut StreamConfigConnectorConnectRequest
15177    {
15178        #[inline]
15179        unsafe fn encode(
15180            self,
15181            encoder: &mut fidl::encoding::Encoder<
15182                '_,
15183                fidl::encoding::DefaultFuchsiaResourceDialect,
15184            >,
15185            offset: usize,
15186            _depth: fidl::encoding::Depth,
15187        ) -> fidl::Result<()> {
15188            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
15189            // Delegate to tuple encoding.
15190            fidl::encoding::Encode::<StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15191                (
15192                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
15193                ),
15194                encoder, offset, _depth
15195            )
15196        }
15197    }
15198    unsafe impl<
15199        T0: fidl::encoding::Encode<
15200                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15201                fidl::encoding::DefaultFuchsiaResourceDialect,
15202            >,
15203    >
15204        fidl::encoding::Encode<
15205            StreamConfigConnectorConnectRequest,
15206            fidl::encoding::DefaultFuchsiaResourceDialect,
15207        > for (T0,)
15208    {
15209        #[inline]
15210        unsafe fn encode(
15211            self,
15212            encoder: &mut fidl::encoding::Encoder<
15213                '_,
15214                fidl::encoding::DefaultFuchsiaResourceDialect,
15215            >,
15216            offset: usize,
15217            depth: fidl::encoding::Depth,
15218        ) -> fidl::Result<()> {
15219            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
15220            // Zero out padding regions. There's no need to apply masks
15221            // because the unmasked parts will be overwritten by fields.
15222            // Write the fields.
15223            self.0.encode(encoder, offset + 0, depth)?;
15224            Ok(())
15225        }
15226    }
15227
15228    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15229        for StreamConfigConnectorConnectRequest
15230    {
15231        #[inline(always)]
15232        fn new_empty() -> Self {
15233            Self {
15234                protocol: fidl::new_empty!(
15235                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15236                    fidl::encoding::DefaultFuchsiaResourceDialect
15237                ),
15238            }
15239        }
15240
15241        #[inline]
15242        unsafe fn decode(
15243            &mut self,
15244            decoder: &mut fidl::encoding::Decoder<
15245                '_,
15246                fidl::encoding::DefaultFuchsiaResourceDialect,
15247            >,
15248            offset: usize,
15249            _depth: fidl::encoding::Depth,
15250        ) -> fidl::Result<()> {
15251            decoder.debug_check_bounds::<Self>(offset);
15252            // Verify that padding bytes are zero.
15253            fidl::decode!(
15254                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
15255                fidl::encoding::DefaultFuchsiaResourceDialect,
15256                &mut self.protocol,
15257                decoder,
15258                offset + 0,
15259                _depth
15260            )?;
15261            Ok(())
15262        }
15263    }
15264
15265    impl fidl::encoding::ResourceTypeMarker for StreamConfigCreateRingBufferRequest {
15266        type Borrowed<'a> = &'a mut Self;
15267        fn take_or_borrow<'a>(
15268            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15269        ) -> Self::Borrowed<'a> {
15270            value
15271        }
15272    }
15273
15274    unsafe impl fidl::encoding::TypeMarker for StreamConfigCreateRingBufferRequest {
15275        type Owned = Self;
15276
15277        #[inline(always)]
15278        fn inline_align(_context: fidl::encoding::Context) -> usize {
15279            8
15280        }
15281
15282        #[inline(always)]
15283        fn inline_size(_context: fidl::encoding::Context) -> usize {
15284            24
15285        }
15286    }
15287
15288    unsafe impl
15289        fidl::encoding::Encode<
15290            StreamConfigCreateRingBufferRequest,
15291            fidl::encoding::DefaultFuchsiaResourceDialect,
15292        > for &mut StreamConfigCreateRingBufferRequest
15293    {
15294        #[inline]
15295        unsafe fn encode(
15296            self,
15297            encoder: &mut fidl::encoding::Encoder<
15298                '_,
15299                fidl::encoding::DefaultFuchsiaResourceDialect,
15300            >,
15301            offset: usize,
15302            _depth: fidl::encoding::Depth,
15303        ) -> fidl::Result<()> {
15304            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
15305            // Delegate to tuple encoding.
15306            fidl::encoding::Encode::<StreamConfigCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
15307                (
15308                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
15309                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
15310                ),
15311                encoder, offset, _depth
15312            )
15313        }
15314    }
15315    unsafe impl<
15316        T0: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
15317        T1: fidl::encoding::Encode<
15318                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15319                fidl::encoding::DefaultFuchsiaResourceDialect,
15320            >,
15321    >
15322        fidl::encoding::Encode<
15323            StreamConfigCreateRingBufferRequest,
15324            fidl::encoding::DefaultFuchsiaResourceDialect,
15325        > for (T0, T1)
15326    {
15327        #[inline]
15328        unsafe fn encode(
15329            self,
15330            encoder: &mut fidl::encoding::Encoder<
15331                '_,
15332                fidl::encoding::DefaultFuchsiaResourceDialect,
15333            >,
15334            offset: usize,
15335            depth: fidl::encoding::Depth,
15336        ) -> fidl::Result<()> {
15337            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
15338            // Zero out padding regions. There's no need to apply masks
15339            // because the unmasked parts will be overwritten by fields.
15340            unsafe {
15341                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
15342                (ptr as *mut u64).write_unaligned(0);
15343            }
15344            // Write the fields.
15345            self.0.encode(encoder, offset + 0, depth)?;
15346            self.1.encode(encoder, offset + 16, depth)?;
15347            Ok(())
15348        }
15349    }
15350
15351    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15352        for StreamConfigCreateRingBufferRequest
15353    {
15354        #[inline(always)]
15355        fn new_empty() -> Self {
15356            Self {
15357                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
15358                ring_buffer: fidl::new_empty!(
15359                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15360                    fidl::encoding::DefaultFuchsiaResourceDialect
15361                ),
15362            }
15363        }
15364
15365        #[inline]
15366        unsafe fn decode(
15367            &mut self,
15368            decoder: &mut fidl::encoding::Decoder<
15369                '_,
15370                fidl::encoding::DefaultFuchsiaResourceDialect,
15371            >,
15372            offset: usize,
15373            _depth: fidl::encoding::Depth,
15374        ) -> fidl::Result<()> {
15375            decoder.debug_check_bounds::<Self>(offset);
15376            // Verify that padding bytes are zero.
15377            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
15378            let padval = unsafe { (ptr as *const u64).read_unaligned() };
15379            let mask = 0xffffffff00000000u64;
15380            let maskedval = padval & mask;
15381            if maskedval != 0 {
15382                return Err(fidl::Error::NonZeroPadding {
15383                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
15384                });
15385            }
15386            fidl::decode!(
15387                Format,
15388                fidl::encoding::DefaultFuchsiaResourceDialect,
15389                &mut self.format,
15390                decoder,
15391                offset + 0,
15392                _depth
15393            )?;
15394            fidl::decode!(
15395                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
15396                fidl::encoding::DefaultFuchsiaResourceDialect,
15397                &mut self.ring_buffer,
15398                decoder,
15399                offset + 16,
15400                _depth
15401            )?;
15402            Ok(())
15403        }
15404    }
15405
15406    impl PacketStreamControlSetPacketStreamSinkRequest {
15407        #[inline(always)]
15408        fn max_ordinal_present(&self) -> u64 {
15409            if let Some(_) = self.stream {
15410                return 1;
15411            }
15412            0
15413        }
15414    }
15415
15416    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
15417        type Borrowed<'a> = &'a mut Self;
15418        fn take_or_borrow<'a>(
15419            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15420        ) -> Self::Borrowed<'a> {
15421            value
15422        }
15423    }
15424
15425    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
15426        type Owned = Self;
15427
15428        #[inline(always)]
15429        fn inline_align(_context: fidl::encoding::Context) -> usize {
15430            8
15431        }
15432
15433        #[inline(always)]
15434        fn inline_size(_context: fidl::encoding::Context) -> usize {
15435            16
15436        }
15437    }
15438
15439    unsafe impl
15440        fidl::encoding::Encode<
15441            PacketStreamControlSetPacketStreamSinkRequest,
15442            fidl::encoding::DefaultFuchsiaResourceDialect,
15443        > for &mut PacketStreamControlSetPacketStreamSinkRequest
15444    {
15445        unsafe fn encode(
15446            self,
15447            encoder: &mut fidl::encoding::Encoder<
15448                '_,
15449                fidl::encoding::DefaultFuchsiaResourceDialect,
15450            >,
15451            offset: usize,
15452            mut depth: fidl::encoding::Depth,
15453        ) -> fidl::Result<()> {
15454            encoder.debug_check_bounds::<PacketStreamControlSetPacketStreamSinkRequest>(offset);
15455            // Vector header
15456            let max_ordinal: u64 = self.max_ordinal_present();
15457            encoder.write_num(max_ordinal, offset);
15458            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15459            // Calling encoder.out_of_line_offset(0) is not allowed.
15460            if max_ordinal == 0 {
15461                return Ok(());
15462            }
15463            depth.increment()?;
15464            let envelope_size = 8;
15465            let bytes_len = max_ordinal as usize * envelope_size;
15466            #[allow(unused_variables)]
15467            let offset = encoder.out_of_line_offset(bytes_len);
15468            let mut _prev_end_offset: usize = 0;
15469            if 1 > max_ordinal {
15470                return Ok(());
15471            }
15472
15473            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15474            // are envelope_size bytes.
15475            let cur_offset: usize = (1 - 1) * envelope_size;
15476
15477            // Zero reserved fields.
15478            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15479
15480            // Safety:
15481            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15482            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15483            //   envelope_size bytes, there is always sufficient room.
15484            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15485            self.stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15486            encoder, offset + cur_offset, depth
15487        )?;
15488
15489            _prev_end_offset = cur_offset + envelope_size;
15490
15491            Ok(())
15492        }
15493    }
15494
15495    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15496        for PacketStreamControlSetPacketStreamSinkRequest
15497    {
15498        #[inline(always)]
15499        fn new_empty() -> Self {
15500            Self::default()
15501        }
15502
15503        unsafe fn decode(
15504            &mut self,
15505            decoder: &mut fidl::encoding::Decoder<
15506                '_,
15507                fidl::encoding::DefaultFuchsiaResourceDialect,
15508            >,
15509            offset: usize,
15510            mut depth: fidl::encoding::Depth,
15511        ) -> fidl::Result<()> {
15512            decoder.debug_check_bounds::<Self>(offset);
15513            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15514                None => return Err(fidl::Error::NotNullable),
15515                Some(len) => len,
15516            };
15517            // Calling decoder.out_of_line_offset(0) is not allowed.
15518            if len == 0 {
15519                return Ok(());
15520            };
15521            depth.increment()?;
15522            let envelope_size = 8;
15523            let bytes_len = len * envelope_size;
15524            let offset = decoder.out_of_line_offset(bytes_len)?;
15525            // Decode the envelope for each type.
15526            let mut _next_ordinal_to_read = 0;
15527            let mut next_offset = offset;
15528            let end_offset = offset + bytes_len;
15529            _next_ordinal_to_read += 1;
15530            if next_offset >= end_offset {
15531                return Ok(());
15532            }
15533
15534            // Decode unknown envelopes for gaps in ordinals.
15535            while _next_ordinal_to_read < 1 {
15536                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15537                _next_ordinal_to_read += 1;
15538                next_offset += envelope_size;
15539            }
15540
15541            let next_out_of_line = decoder.next_out_of_line();
15542            let handles_before = decoder.remaining_handles();
15543            if let Some((inlined, num_bytes, num_handles)) =
15544                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15545            {
15546                let member_inline_size = <fidl::encoding::Endpoint<
15547                    fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15548                > as fidl::encoding::TypeMarker>::inline_size(
15549                    decoder.context
15550                );
15551                if inlined != (member_inline_size <= 4) {
15552                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15553                }
15554                let inner_offset;
15555                let mut inner_depth = depth.clone();
15556                if inlined {
15557                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15558                    inner_offset = next_offset;
15559                } else {
15560                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15561                    inner_depth.increment()?;
15562                }
15563                let val_ref = self.stream.get_or_insert_with(|| {
15564                    fidl::new_empty!(
15565                        fidl::encoding::Endpoint<
15566                            fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15567                        >,
15568                        fidl::encoding::DefaultFuchsiaResourceDialect
15569                    )
15570                });
15571                fidl::decode!(
15572                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>,
15573                    fidl::encoding::DefaultFuchsiaResourceDialect,
15574                    val_ref,
15575                    decoder,
15576                    inner_offset,
15577                    inner_depth
15578                )?;
15579                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15580                {
15581                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15582                }
15583                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15584                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15585                }
15586            }
15587
15588            next_offset += envelope_size;
15589
15590            // Decode the remaining unknown envelopes.
15591            while next_offset < end_offset {
15592                _next_ordinal_to_read += 1;
15593                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15594                next_offset += envelope_size;
15595            }
15596
15597            Ok(())
15598        }
15599    }
15600
15601    impl PacketStreamControlGetPacketStreamSinkResponse {
15602        #[inline(always)]
15603        fn max_ordinal_present(&self) -> u64 {
15604            if let Some(_) = self.stream {
15605                return 1;
15606            }
15607            0
15608        }
15609    }
15610
15611    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
15612        type Borrowed<'a> = &'a mut Self;
15613        fn take_or_borrow<'a>(
15614            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15615        ) -> Self::Borrowed<'a> {
15616            value
15617        }
15618    }
15619
15620    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
15621        type Owned = Self;
15622
15623        #[inline(always)]
15624        fn inline_align(_context: fidl::encoding::Context) -> usize {
15625            8
15626        }
15627
15628        #[inline(always)]
15629        fn inline_size(_context: fidl::encoding::Context) -> usize {
15630            16
15631        }
15632    }
15633
15634    unsafe impl
15635        fidl::encoding::Encode<
15636            PacketStreamControlGetPacketStreamSinkResponse,
15637            fidl::encoding::DefaultFuchsiaResourceDialect,
15638        > for &mut PacketStreamControlGetPacketStreamSinkResponse
15639    {
15640        unsafe fn encode(
15641            self,
15642            encoder: &mut fidl::encoding::Encoder<
15643                '_,
15644                fidl::encoding::DefaultFuchsiaResourceDialect,
15645            >,
15646            offset: usize,
15647            mut depth: fidl::encoding::Depth,
15648        ) -> fidl::Result<()> {
15649            encoder.debug_check_bounds::<PacketStreamControlGetPacketStreamSinkResponse>(offset);
15650            // Vector header
15651            let max_ordinal: u64 = self.max_ordinal_present();
15652            encoder.write_num(max_ordinal, offset);
15653            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15654            // Calling encoder.out_of_line_offset(0) is not allowed.
15655            if max_ordinal == 0 {
15656                return Ok(());
15657            }
15658            depth.increment()?;
15659            let envelope_size = 8;
15660            let bytes_len = max_ordinal as usize * envelope_size;
15661            #[allow(unused_variables)]
15662            let offset = encoder.out_of_line_offset(bytes_len);
15663            let mut _prev_end_offset: usize = 0;
15664            if 1 > max_ordinal {
15665                return Ok(());
15666            }
15667
15668            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15669            // are envelope_size bytes.
15670            let cur_offset: usize = (1 - 1) * envelope_size;
15671
15672            // Zero reserved fields.
15673            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15674
15675            // Safety:
15676            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15677            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15678            //   envelope_size bytes, there is always sufficient room.
15679            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15680            self.stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15681            encoder, offset + cur_offset, depth
15682        )?;
15683
15684            _prev_end_offset = cur_offset + envelope_size;
15685
15686            Ok(())
15687        }
15688    }
15689
15690    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15691        for PacketStreamControlGetPacketStreamSinkResponse
15692    {
15693        #[inline(always)]
15694        fn new_empty() -> Self {
15695            Self::default()
15696        }
15697
15698        unsafe fn decode(
15699            &mut self,
15700            decoder: &mut fidl::encoding::Decoder<
15701                '_,
15702                fidl::encoding::DefaultFuchsiaResourceDialect,
15703            >,
15704            offset: usize,
15705            mut depth: fidl::encoding::Depth,
15706        ) -> fidl::Result<()> {
15707            decoder.debug_check_bounds::<Self>(offset);
15708            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15709                None => return Err(fidl::Error::NotNullable),
15710                Some(len) => len,
15711            };
15712            // Calling decoder.out_of_line_offset(0) is not allowed.
15713            if len == 0 {
15714                return Ok(());
15715            };
15716            depth.increment()?;
15717            let envelope_size = 8;
15718            let bytes_len = len * envelope_size;
15719            let offset = decoder.out_of_line_offset(bytes_len)?;
15720            // Decode the envelope for each type.
15721            let mut _next_ordinal_to_read = 0;
15722            let mut next_offset = offset;
15723            let end_offset = offset + bytes_len;
15724            _next_ordinal_to_read += 1;
15725            if next_offset >= end_offset {
15726                return Ok(());
15727            }
15728
15729            // Decode unknown envelopes for gaps in ordinals.
15730            while _next_ordinal_to_read < 1 {
15731                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15732                _next_ordinal_to_read += 1;
15733                next_offset += envelope_size;
15734            }
15735
15736            let next_out_of_line = decoder.next_out_of_line();
15737            let handles_before = decoder.remaining_handles();
15738            if let Some((inlined, num_bytes, num_handles)) =
15739                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15740            {
15741                let member_inline_size = <fidl::encoding::Endpoint<
15742                    fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15743                > as fidl::encoding::TypeMarker>::inline_size(
15744                    decoder.context
15745                );
15746                if inlined != (member_inline_size <= 4) {
15747                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15748                }
15749                let inner_offset;
15750                let mut inner_depth = depth.clone();
15751                if inlined {
15752                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15753                    inner_offset = next_offset;
15754                } else {
15755                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15756                    inner_depth.increment()?;
15757                }
15758                let val_ref = self.stream.get_or_insert_with(|| {
15759                    fidl::new_empty!(
15760                        fidl::encoding::Endpoint<
15761                            fidl::endpoints::ClientEnd<PacketStreamSinkMarker>,
15762                        >,
15763                        fidl::encoding::DefaultFuchsiaResourceDialect
15764                    )
15765                });
15766                fidl::decode!(
15767                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PacketStreamSinkMarker>>,
15768                    fidl::encoding::DefaultFuchsiaResourceDialect,
15769                    val_ref,
15770                    decoder,
15771                    inner_offset,
15772                    inner_depth
15773                )?;
15774                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15775                {
15776                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15777                }
15778                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15779                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15780                }
15781            }
15782
15783            next_offset += envelope_size;
15784
15785            // Decode the remaining unknown envelopes.
15786            while next_offset < end_offset {
15787                _next_ordinal_to_read += 1;
15788                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15789                next_offset += envelope_size;
15790            }
15791
15792            Ok(())
15793        }
15794    }
15795
15796    impl PacketStreamSinkPutPacketRequest {
15797        #[inline(always)]
15798        fn max_ordinal_present(&self) -> u64 {
15799            if let Some(_) = self.payload {
15800                return 1;
15801            }
15802            0
15803        }
15804    }
15805
15806    impl fidl::encoding::ResourceTypeMarker for PacketStreamSinkPutPacketRequest {
15807        type Borrowed<'a> = &'a mut Self;
15808        fn take_or_borrow<'a>(
15809            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15810        ) -> Self::Borrowed<'a> {
15811            value
15812        }
15813    }
15814
15815    unsafe impl fidl::encoding::TypeMarker for PacketStreamSinkPutPacketRequest {
15816        type Owned = Self;
15817
15818        #[inline(always)]
15819        fn inline_align(_context: fidl::encoding::Context) -> usize {
15820            8
15821        }
15822
15823        #[inline(always)]
15824        fn inline_size(_context: fidl::encoding::Context) -> usize {
15825            16
15826        }
15827    }
15828
15829    unsafe impl
15830        fidl::encoding::Encode<
15831            PacketStreamSinkPutPacketRequest,
15832            fidl::encoding::DefaultFuchsiaResourceDialect,
15833        > for &mut PacketStreamSinkPutPacketRequest
15834    {
15835        unsafe fn encode(
15836            self,
15837            encoder: &mut fidl::encoding::Encoder<
15838                '_,
15839                fidl::encoding::DefaultFuchsiaResourceDialect,
15840            >,
15841            offset: usize,
15842            mut depth: fidl::encoding::Depth,
15843        ) -> fidl::Result<()> {
15844            encoder.debug_check_bounds::<PacketStreamSinkPutPacketRequest>(offset);
15845            // Vector header
15846            let max_ordinal: u64 = self.max_ordinal_present();
15847            encoder.write_num(max_ordinal, offset);
15848            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15849            // Calling encoder.out_of_line_offset(0) is not allowed.
15850            if max_ordinal == 0 {
15851                return Ok(());
15852            }
15853            depth.increment()?;
15854            let envelope_size = 8;
15855            let bytes_len = max_ordinal as usize * envelope_size;
15856            #[allow(unused_variables)]
15857            let offset = encoder.out_of_line_offset(bytes_len);
15858            let mut _prev_end_offset: usize = 0;
15859            if 1 > max_ordinal {
15860                return Ok(());
15861            }
15862
15863            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15864            // are envelope_size bytes.
15865            let cur_offset: usize = (1 - 1) * envelope_size;
15866
15867            // Zero reserved fields.
15868            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15869
15870            // Safety:
15871            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15872            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15873            //   envelope_size bytes, there is always sufficient room.
15874            fidl::encoding::encode_in_envelope_optional::<
15875                DataTransfer,
15876                fidl::encoding::DefaultFuchsiaResourceDialect,
15877            >(
15878                self.payload
15879                    .as_mut()
15880                    .map(<DataTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15881                encoder,
15882                offset + cur_offset,
15883                depth,
15884            )?;
15885
15886            _prev_end_offset = cur_offset + envelope_size;
15887
15888            Ok(())
15889        }
15890    }
15891
15892    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15893        for PacketStreamSinkPutPacketRequest
15894    {
15895        #[inline(always)]
15896        fn new_empty() -> Self {
15897            Self::default()
15898        }
15899
15900        unsafe fn decode(
15901            &mut self,
15902            decoder: &mut fidl::encoding::Decoder<
15903                '_,
15904                fidl::encoding::DefaultFuchsiaResourceDialect,
15905            >,
15906            offset: usize,
15907            mut depth: fidl::encoding::Depth,
15908        ) -> fidl::Result<()> {
15909            decoder.debug_check_bounds::<Self>(offset);
15910            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15911                None => return Err(fidl::Error::NotNullable),
15912                Some(len) => len,
15913            };
15914            // Calling decoder.out_of_line_offset(0) is not allowed.
15915            if len == 0 {
15916                return Ok(());
15917            };
15918            depth.increment()?;
15919            let envelope_size = 8;
15920            let bytes_len = len * envelope_size;
15921            let offset = decoder.out_of_line_offset(bytes_len)?;
15922            // Decode the envelope for each type.
15923            let mut _next_ordinal_to_read = 0;
15924            let mut next_offset = offset;
15925            let end_offset = offset + bytes_len;
15926            _next_ordinal_to_read += 1;
15927            if next_offset >= end_offset {
15928                return Ok(());
15929            }
15930
15931            // Decode unknown envelopes for gaps in ordinals.
15932            while _next_ordinal_to_read < 1 {
15933                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15934                _next_ordinal_to_read += 1;
15935                next_offset += envelope_size;
15936            }
15937
15938            let next_out_of_line = decoder.next_out_of_line();
15939            let handles_before = decoder.remaining_handles();
15940            if let Some((inlined, num_bytes, num_handles)) =
15941                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15942            {
15943                let member_inline_size =
15944                    <DataTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15945                if inlined != (member_inline_size <= 4) {
15946                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15947                }
15948                let inner_offset;
15949                let mut inner_depth = depth.clone();
15950                if inlined {
15951                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15952                    inner_offset = next_offset;
15953                } else {
15954                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15955                    inner_depth.increment()?;
15956                }
15957                let val_ref = self.payload.get_or_insert_with(|| {
15958                    fidl::new_empty!(DataTransfer, fidl::encoding::DefaultFuchsiaResourceDialect)
15959                });
15960                fidl::decode!(
15961                    DataTransfer,
15962                    fidl::encoding::DefaultFuchsiaResourceDialect,
15963                    val_ref,
15964                    decoder,
15965                    inner_offset,
15966                    inner_depth
15967                )?;
15968                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15969                {
15970                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15971                }
15972                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15973                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15974                }
15975            }
15976
15977            next_offset += envelope_size;
15978
15979            // Decode the remaining unknown envelopes.
15980            while next_offset < end_offset {
15981                _next_ordinal_to_read += 1;
15982                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15983                next_offset += envelope_size;
15984            }
15985
15986            Ok(())
15987        }
15988    }
15989
15990    impl RegisterVmosConfig {
15991        #[inline(always)]
15992        fn max_ordinal_present(&self) -> u64 {
15993            if let Some(_) = self.vmo_infos {
15994                return 1;
15995            }
15996            0
15997        }
15998    }
15999
16000    impl fidl::encoding::ResourceTypeMarker for RegisterVmosConfig {
16001        type Borrowed<'a> = &'a mut Self;
16002        fn take_or_borrow<'a>(
16003            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16004        ) -> Self::Borrowed<'a> {
16005            value
16006        }
16007    }
16008
16009    unsafe impl fidl::encoding::TypeMarker for RegisterVmosConfig {
16010        type Owned = Self;
16011
16012        #[inline(always)]
16013        fn inline_align(_context: fidl::encoding::Context) -> usize {
16014            8
16015        }
16016
16017        #[inline(always)]
16018        fn inline_size(_context: fidl::encoding::Context) -> usize {
16019            16
16020        }
16021    }
16022
16023    unsafe impl
16024        fidl::encoding::Encode<RegisterVmosConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
16025        for &mut RegisterVmosConfig
16026    {
16027        unsafe fn encode(
16028            self,
16029            encoder: &mut fidl::encoding::Encoder<
16030                '_,
16031                fidl::encoding::DefaultFuchsiaResourceDialect,
16032            >,
16033            offset: usize,
16034            mut depth: fidl::encoding::Depth,
16035        ) -> fidl::Result<()> {
16036            encoder.debug_check_bounds::<RegisterVmosConfig>(offset);
16037            // Vector header
16038            let max_ordinal: u64 = self.max_ordinal_present();
16039            encoder.write_num(max_ordinal, offset);
16040            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16041            // Calling encoder.out_of_line_offset(0) is not allowed.
16042            if max_ordinal == 0 {
16043                return Ok(());
16044            }
16045            depth.increment()?;
16046            let envelope_size = 8;
16047            let bytes_len = max_ordinal as usize * envelope_size;
16048            #[allow(unused_variables)]
16049            let offset = encoder.out_of_line_offset(bytes_len);
16050            let mut _prev_end_offset: usize = 0;
16051            if 1 > max_ordinal {
16052                return Ok(());
16053            }
16054
16055            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16056            // are envelope_size bytes.
16057            let cur_offset: usize = (1 - 1) * envelope_size;
16058
16059            // Zero reserved fields.
16060            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16061
16062            // Safety:
16063            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16064            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16065            //   envelope_size bytes, there is always sufficient room.
16066            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect>(
16067            self.vmo_infos.as_mut().map(<fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16068            encoder, offset + cur_offset, depth
16069        )?;
16070
16071            _prev_end_offset = cur_offset + envelope_size;
16072
16073            Ok(())
16074        }
16075    }
16076
16077    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16078        for RegisterVmosConfig
16079    {
16080        #[inline(always)]
16081        fn new_empty() -> Self {
16082            Self::default()
16083        }
16084
16085        unsafe fn decode(
16086            &mut self,
16087            decoder: &mut fidl::encoding::Decoder<
16088                '_,
16089                fidl::encoding::DefaultFuchsiaResourceDialect,
16090            >,
16091            offset: usize,
16092            mut depth: fidl::encoding::Depth,
16093        ) -> fidl::Result<()> {
16094            decoder.debug_check_bounds::<Self>(offset);
16095            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16096                None => return Err(fidl::Error::NotNullable),
16097                Some(len) => len,
16098            };
16099            // Calling decoder.out_of_line_offset(0) is not allowed.
16100            if len == 0 {
16101                return Ok(());
16102            };
16103            depth.increment()?;
16104            let envelope_size = 8;
16105            let bytes_len = len * envelope_size;
16106            let offset = decoder.out_of_line_offset(bytes_len)?;
16107            // Decode the envelope for each type.
16108            let mut _next_ordinal_to_read = 0;
16109            let mut next_offset = offset;
16110            let end_offset = offset + bytes_len;
16111            _next_ordinal_to_read += 1;
16112            if next_offset >= end_offset {
16113                return Ok(());
16114            }
16115
16116            // Decode unknown envelopes for gaps in ordinals.
16117            while _next_ordinal_to_read < 1 {
16118                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16119                _next_ordinal_to_read += 1;
16120                next_offset += envelope_size;
16121            }
16122
16123            let next_out_of_line = decoder.next_out_of_line();
16124            let handles_before = decoder.remaining_handles();
16125            if let Some((inlined, num_bytes, num_handles)) =
16126                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16127            {
16128                let member_inline_size = <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16129                if inlined != (member_inline_size <= 4) {
16130                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16131                }
16132                let inner_offset;
16133                let mut inner_depth = depth.clone();
16134                if inlined {
16135                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16136                    inner_offset = next_offset;
16137                } else {
16138                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16139                    inner_depth.increment()?;
16140                }
16141                let val_ref =
16142                self.vmo_infos.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect));
16143                fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
16144                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16145                {
16146                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16147                }
16148                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16149                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16150                }
16151            }
16152
16153            next_offset += envelope_size;
16154
16155            // Decode the remaining unknown envelopes.
16156            while next_offset < end_offset {
16157                _next_ordinal_to_read += 1;
16158                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16159                next_offset += envelope_size;
16160            }
16161
16162            Ok(())
16163        }
16164    }
16165
16166    impl VmoInfo {
16167        #[inline(always)]
16168        fn max_ordinal_present(&self) -> u64 {
16169            if let Some(_) = self.vmo {
16170                return 2;
16171            }
16172            if let Some(_) = self.id {
16173                return 1;
16174            }
16175            0
16176        }
16177    }
16178
16179    impl fidl::encoding::ResourceTypeMarker for VmoInfo {
16180        type Borrowed<'a> = &'a mut Self;
16181        fn take_or_borrow<'a>(
16182            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16183        ) -> Self::Borrowed<'a> {
16184            value
16185        }
16186    }
16187
16188    unsafe impl fidl::encoding::TypeMarker for VmoInfo {
16189        type Owned = Self;
16190
16191        #[inline(always)]
16192        fn inline_align(_context: fidl::encoding::Context) -> usize {
16193            8
16194        }
16195
16196        #[inline(always)]
16197        fn inline_size(_context: fidl::encoding::Context) -> usize {
16198            16
16199        }
16200    }
16201
16202    unsafe impl fidl::encoding::Encode<VmoInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
16203        for &mut VmoInfo
16204    {
16205        unsafe fn encode(
16206            self,
16207            encoder: &mut fidl::encoding::Encoder<
16208                '_,
16209                fidl::encoding::DefaultFuchsiaResourceDialect,
16210            >,
16211            offset: usize,
16212            mut depth: fidl::encoding::Depth,
16213        ) -> fidl::Result<()> {
16214            encoder.debug_check_bounds::<VmoInfo>(offset);
16215            // Vector header
16216            let max_ordinal: u64 = self.max_ordinal_present();
16217            encoder.write_num(max_ordinal, offset);
16218            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16219            // Calling encoder.out_of_line_offset(0) is not allowed.
16220            if max_ordinal == 0 {
16221                return Ok(());
16222            }
16223            depth.increment()?;
16224            let envelope_size = 8;
16225            let bytes_len = max_ordinal as usize * envelope_size;
16226            #[allow(unused_variables)]
16227            let offset = encoder.out_of_line_offset(bytes_len);
16228            let mut _prev_end_offset: usize = 0;
16229            if 1 > max_ordinal {
16230                return Ok(());
16231            }
16232
16233            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16234            // are envelope_size bytes.
16235            let cur_offset: usize = (1 - 1) * envelope_size;
16236
16237            // Zero reserved fields.
16238            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16239
16240            // Safety:
16241            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16242            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16243            //   envelope_size bytes, there is always sufficient room.
16244            fidl::encoding::encode_in_envelope_optional::<
16245                u64,
16246                fidl::encoding::DefaultFuchsiaResourceDialect,
16247            >(
16248                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16249                encoder,
16250                offset + cur_offset,
16251                depth,
16252            )?;
16253
16254            _prev_end_offset = cur_offset + envelope_size;
16255            if 2 > max_ordinal {
16256                return Ok(());
16257            }
16258
16259            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16260            // are envelope_size bytes.
16261            let cur_offset: usize = (2 - 1) * envelope_size;
16262
16263            // Zero reserved fields.
16264            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16265
16266            // Safety:
16267            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16268            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16269            //   envelope_size bytes, there is always sufficient room.
16270            fidl::encoding::encode_in_envelope_optional::<
16271                fidl::encoding::HandleType<
16272                    fidl::Vmo,
16273                    { fidl::ObjectType::VMO.into_raw() },
16274                    2147483648,
16275                >,
16276                fidl::encoding::DefaultFuchsiaResourceDialect,
16277            >(
16278                self.vmo.as_mut().map(
16279                    <fidl::encoding::HandleType<
16280                        fidl::Vmo,
16281                        { fidl::ObjectType::VMO.into_raw() },
16282                        2147483648,
16283                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16284                ),
16285                encoder,
16286                offset + cur_offset,
16287                depth,
16288            )?;
16289
16290            _prev_end_offset = cur_offset + envelope_size;
16291
16292            Ok(())
16293        }
16294    }
16295
16296    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for VmoInfo {
16297        #[inline(always)]
16298        fn new_empty() -> Self {
16299            Self::default()
16300        }
16301
16302        unsafe fn decode(
16303            &mut self,
16304            decoder: &mut fidl::encoding::Decoder<
16305                '_,
16306                fidl::encoding::DefaultFuchsiaResourceDialect,
16307            >,
16308            offset: usize,
16309            mut depth: fidl::encoding::Depth,
16310        ) -> fidl::Result<()> {
16311            decoder.debug_check_bounds::<Self>(offset);
16312            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16313                None => return Err(fidl::Error::NotNullable),
16314                Some(len) => len,
16315            };
16316            // Calling decoder.out_of_line_offset(0) is not allowed.
16317            if len == 0 {
16318                return Ok(());
16319            };
16320            depth.increment()?;
16321            let envelope_size = 8;
16322            let bytes_len = len * envelope_size;
16323            let offset = decoder.out_of_line_offset(bytes_len)?;
16324            // Decode the envelope for each type.
16325            let mut _next_ordinal_to_read = 0;
16326            let mut next_offset = offset;
16327            let end_offset = offset + bytes_len;
16328            _next_ordinal_to_read += 1;
16329            if next_offset >= end_offset {
16330                return Ok(());
16331            }
16332
16333            // Decode unknown envelopes for gaps in ordinals.
16334            while _next_ordinal_to_read < 1 {
16335                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16336                _next_ordinal_to_read += 1;
16337                next_offset += envelope_size;
16338            }
16339
16340            let next_out_of_line = decoder.next_out_of_line();
16341            let handles_before = decoder.remaining_handles();
16342            if let Some((inlined, num_bytes, num_handles)) =
16343                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16344            {
16345                let member_inline_size =
16346                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16347                if inlined != (member_inline_size <= 4) {
16348                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16349                }
16350                let inner_offset;
16351                let mut inner_depth = depth.clone();
16352                if inlined {
16353                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16354                    inner_offset = next_offset;
16355                } else {
16356                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16357                    inner_depth.increment()?;
16358                }
16359                let val_ref = self.id.get_or_insert_with(|| {
16360                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16361                });
16362                fidl::decode!(
16363                    u64,
16364                    fidl::encoding::DefaultFuchsiaResourceDialect,
16365                    val_ref,
16366                    decoder,
16367                    inner_offset,
16368                    inner_depth
16369                )?;
16370                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16371                {
16372                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16373                }
16374                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16375                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16376                }
16377            }
16378
16379            next_offset += envelope_size;
16380            _next_ordinal_to_read += 1;
16381            if next_offset >= end_offset {
16382                return Ok(());
16383            }
16384
16385            // Decode unknown envelopes for gaps in ordinals.
16386            while _next_ordinal_to_read < 2 {
16387                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16388                _next_ordinal_to_read += 1;
16389                next_offset += envelope_size;
16390            }
16391
16392            let next_out_of_line = decoder.next_out_of_line();
16393            let handles_before = decoder.remaining_handles();
16394            if let Some((inlined, num_bytes, num_handles)) =
16395                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16396            {
16397                let member_inline_size = <fidl::encoding::HandleType<
16398                    fidl::Vmo,
16399                    { fidl::ObjectType::VMO.into_raw() },
16400                    2147483648,
16401                > as fidl::encoding::TypeMarker>::inline_size(
16402                    decoder.context
16403                );
16404                if inlined != (member_inline_size <= 4) {
16405                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16406                }
16407                let inner_offset;
16408                let mut inner_depth = depth.clone();
16409                if inlined {
16410                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16411                    inner_offset = next_offset;
16412                } else {
16413                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16414                    inner_depth.increment()?;
16415                }
16416                let val_ref =
16417                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
16418                fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
16419                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16420                {
16421                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16422                }
16423                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16424                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16425                }
16426            }
16427
16428            next_offset += envelope_size;
16429
16430            // Decode the remaining unknown envelopes.
16431            while next_offset < end_offset {
16432                _next_ordinal_to_read += 1;
16433                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16434                next_offset += envelope_size;
16435            }
16436
16437            Ok(())
16438        }
16439    }
16440
16441    impl VmoTransfer {
16442        #[inline(always)]
16443        fn max_ordinal_present(&self) -> u64 {
16444            if let Some(_) = self.payload_size {
16445                return 3;
16446            }
16447            if let Some(_) = self.vmo_offset {
16448                return 2;
16449            }
16450            if let Some(_) = self.vmo_id {
16451                return 1;
16452            }
16453            0
16454        }
16455    }
16456
16457    impl fidl::encoding::ResourceTypeMarker for VmoTransfer {
16458        type Borrowed<'a> = &'a mut Self;
16459        fn take_or_borrow<'a>(
16460            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16461        ) -> Self::Borrowed<'a> {
16462            value
16463        }
16464    }
16465
16466    unsafe impl fidl::encoding::TypeMarker for VmoTransfer {
16467        type Owned = Self;
16468
16469        #[inline(always)]
16470        fn inline_align(_context: fidl::encoding::Context) -> usize {
16471            8
16472        }
16473
16474        #[inline(always)]
16475        fn inline_size(_context: fidl::encoding::Context) -> usize {
16476            16
16477        }
16478    }
16479
16480    unsafe impl fidl::encoding::Encode<VmoTransfer, fidl::encoding::DefaultFuchsiaResourceDialect>
16481        for &mut VmoTransfer
16482    {
16483        unsafe fn encode(
16484            self,
16485            encoder: &mut fidl::encoding::Encoder<
16486                '_,
16487                fidl::encoding::DefaultFuchsiaResourceDialect,
16488            >,
16489            offset: usize,
16490            mut depth: fidl::encoding::Depth,
16491        ) -> fidl::Result<()> {
16492            encoder.debug_check_bounds::<VmoTransfer>(offset);
16493            // Vector header
16494            let max_ordinal: u64 = self.max_ordinal_present();
16495            encoder.write_num(max_ordinal, offset);
16496            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16497            // Calling encoder.out_of_line_offset(0) is not allowed.
16498            if max_ordinal == 0 {
16499                return Ok(());
16500            }
16501            depth.increment()?;
16502            let envelope_size = 8;
16503            let bytes_len = max_ordinal as usize * envelope_size;
16504            #[allow(unused_variables)]
16505            let offset = encoder.out_of_line_offset(bytes_len);
16506            let mut _prev_end_offset: usize = 0;
16507            if 1 > max_ordinal {
16508                return Ok(());
16509            }
16510
16511            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16512            // are envelope_size bytes.
16513            let cur_offset: usize = (1 - 1) * envelope_size;
16514
16515            // Zero reserved fields.
16516            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16517
16518            // Safety:
16519            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16520            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16521            //   envelope_size bytes, there is always sufficient room.
16522            fidl::encoding::encode_in_envelope_optional::<
16523                u64,
16524                fidl::encoding::DefaultFuchsiaResourceDialect,
16525            >(
16526                self.vmo_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16527                encoder,
16528                offset + cur_offset,
16529                depth,
16530            )?;
16531
16532            _prev_end_offset = cur_offset + envelope_size;
16533            if 2 > max_ordinal {
16534                return Ok(());
16535            }
16536
16537            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16538            // are envelope_size bytes.
16539            let cur_offset: usize = (2 - 1) * envelope_size;
16540
16541            // Zero reserved fields.
16542            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16543
16544            // Safety:
16545            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16546            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16547            //   envelope_size bytes, there is always sufficient room.
16548            fidl::encoding::encode_in_envelope_optional::<
16549                u64,
16550                fidl::encoding::DefaultFuchsiaResourceDialect,
16551            >(
16552                self.vmo_offset.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16553                encoder,
16554                offset + cur_offset,
16555                depth,
16556            )?;
16557
16558            _prev_end_offset = cur_offset + envelope_size;
16559            if 3 > max_ordinal {
16560                return Ok(());
16561            }
16562
16563            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16564            // are envelope_size bytes.
16565            let cur_offset: usize = (3 - 1) * envelope_size;
16566
16567            // Zero reserved fields.
16568            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16569
16570            // Safety:
16571            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16572            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16573            //   envelope_size bytes, there is always sufficient room.
16574            fidl::encoding::encode_in_envelope_optional::<
16575                u64,
16576                fidl::encoding::DefaultFuchsiaResourceDialect,
16577            >(
16578                self.payload_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
16579                encoder,
16580                offset + cur_offset,
16581                depth,
16582            )?;
16583
16584            _prev_end_offset = cur_offset + envelope_size;
16585
16586            Ok(())
16587        }
16588    }
16589
16590    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for VmoTransfer {
16591        #[inline(always)]
16592        fn new_empty() -> Self {
16593            Self::default()
16594        }
16595
16596        unsafe fn decode(
16597            &mut self,
16598            decoder: &mut fidl::encoding::Decoder<
16599                '_,
16600                fidl::encoding::DefaultFuchsiaResourceDialect,
16601            >,
16602            offset: usize,
16603            mut depth: fidl::encoding::Depth,
16604        ) -> fidl::Result<()> {
16605            decoder.debug_check_bounds::<Self>(offset);
16606            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16607                None => return Err(fidl::Error::NotNullable),
16608                Some(len) => len,
16609            };
16610            // Calling decoder.out_of_line_offset(0) is not allowed.
16611            if len == 0 {
16612                return Ok(());
16613            };
16614            depth.increment()?;
16615            let envelope_size = 8;
16616            let bytes_len = len * envelope_size;
16617            let offset = decoder.out_of_line_offset(bytes_len)?;
16618            // Decode the envelope for each type.
16619            let mut _next_ordinal_to_read = 0;
16620            let mut next_offset = offset;
16621            let end_offset = offset + bytes_len;
16622            _next_ordinal_to_read += 1;
16623            if next_offset >= end_offset {
16624                return Ok(());
16625            }
16626
16627            // Decode unknown envelopes for gaps in ordinals.
16628            while _next_ordinal_to_read < 1 {
16629                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16630                _next_ordinal_to_read += 1;
16631                next_offset += envelope_size;
16632            }
16633
16634            let next_out_of_line = decoder.next_out_of_line();
16635            let handles_before = decoder.remaining_handles();
16636            if let Some((inlined, num_bytes, num_handles)) =
16637                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16638            {
16639                let member_inline_size =
16640                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16641                if inlined != (member_inline_size <= 4) {
16642                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16643                }
16644                let inner_offset;
16645                let mut inner_depth = depth.clone();
16646                if inlined {
16647                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16648                    inner_offset = next_offset;
16649                } else {
16650                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16651                    inner_depth.increment()?;
16652                }
16653                let val_ref = self.vmo_id.get_or_insert_with(|| {
16654                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16655                });
16656                fidl::decode!(
16657                    u64,
16658                    fidl::encoding::DefaultFuchsiaResourceDialect,
16659                    val_ref,
16660                    decoder,
16661                    inner_offset,
16662                    inner_depth
16663                )?;
16664                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16665                {
16666                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16667                }
16668                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16669                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16670                }
16671            }
16672
16673            next_offset += envelope_size;
16674            _next_ordinal_to_read += 1;
16675            if next_offset >= end_offset {
16676                return Ok(());
16677            }
16678
16679            // Decode unknown envelopes for gaps in ordinals.
16680            while _next_ordinal_to_read < 2 {
16681                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16682                _next_ordinal_to_read += 1;
16683                next_offset += envelope_size;
16684            }
16685
16686            let next_out_of_line = decoder.next_out_of_line();
16687            let handles_before = decoder.remaining_handles();
16688            if let Some((inlined, num_bytes, num_handles)) =
16689                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16690            {
16691                let member_inline_size =
16692                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16693                if inlined != (member_inline_size <= 4) {
16694                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16695                }
16696                let inner_offset;
16697                let mut inner_depth = depth.clone();
16698                if inlined {
16699                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16700                    inner_offset = next_offset;
16701                } else {
16702                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16703                    inner_depth.increment()?;
16704                }
16705                let val_ref = self.vmo_offset.get_or_insert_with(|| {
16706                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16707                });
16708                fidl::decode!(
16709                    u64,
16710                    fidl::encoding::DefaultFuchsiaResourceDialect,
16711                    val_ref,
16712                    decoder,
16713                    inner_offset,
16714                    inner_depth
16715                )?;
16716                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16717                {
16718                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16719                }
16720                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16721                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16722                }
16723            }
16724
16725            next_offset += envelope_size;
16726            _next_ordinal_to_read += 1;
16727            if next_offset >= end_offset {
16728                return Ok(());
16729            }
16730
16731            // Decode unknown envelopes for gaps in ordinals.
16732            while _next_ordinal_to_read < 3 {
16733                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16734                _next_ordinal_to_read += 1;
16735                next_offset += envelope_size;
16736            }
16737
16738            let next_out_of_line = decoder.next_out_of_line();
16739            let handles_before = decoder.remaining_handles();
16740            if let Some((inlined, num_bytes, num_handles)) =
16741                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16742            {
16743                let member_inline_size =
16744                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16745                if inlined != (member_inline_size <= 4) {
16746                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16747                }
16748                let inner_offset;
16749                let mut inner_depth = depth.clone();
16750                if inlined {
16751                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16752                    inner_offset = next_offset;
16753                } else {
16754                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16755                    inner_depth.increment()?;
16756                }
16757                let val_ref = self.payload_size.get_or_insert_with(|| {
16758                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16759                });
16760                fidl::decode!(
16761                    u64,
16762                    fidl::encoding::DefaultFuchsiaResourceDialect,
16763                    val_ref,
16764                    decoder,
16765                    inner_offset,
16766                    inner_depth
16767                )?;
16768                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16769                {
16770                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16771                }
16772                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16773                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16774                }
16775            }
16776
16777            next_offset += envelope_size;
16778
16779            // Decode the remaining unknown envelopes.
16780            while next_offset < end_offset {
16781                _next_ordinal_to_read += 1;
16782                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16783                next_offset += envelope_size;
16784            }
16785
16786            Ok(())
16787        }
16788    }
16789
16790    impl fidl::encoding::ResourceTypeMarker for DataTransfer {
16791        type Borrowed<'a> = &'a mut Self;
16792        fn take_or_borrow<'a>(
16793            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16794        ) -> Self::Borrowed<'a> {
16795            value
16796        }
16797    }
16798
16799    unsafe impl fidl::encoding::TypeMarker for DataTransfer {
16800        type Owned = Self;
16801
16802        #[inline(always)]
16803        fn inline_align(_context: fidl::encoding::Context) -> usize {
16804            8
16805        }
16806
16807        #[inline(always)]
16808        fn inline_size(_context: fidl::encoding::Context) -> usize {
16809            16
16810        }
16811    }
16812
16813    unsafe impl fidl::encoding::Encode<DataTransfer, fidl::encoding::DefaultFuchsiaResourceDialect>
16814        for &mut DataTransfer
16815    {
16816        #[inline]
16817        unsafe fn encode(
16818            self,
16819            encoder: &mut fidl::encoding::Encoder<
16820                '_,
16821                fidl::encoding::DefaultFuchsiaResourceDialect,
16822            >,
16823            offset: usize,
16824            _depth: fidl::encoding::Depth,
16825        ) -> fidl::Result<()> {
16826            encoder.debug_check_bounds::<DataTransfer>(offset);
16827            encoder.write_num::<u64>(self.ordinal(), offset);
16828            match self {
16829                DataTransfer::VmoTransfer(ref mut val) => fidl::encoding::encode_in_envelope::<
16830                    VmoTransfer,
16831                    fidl::encoding::DefaultFuchsiaResourceDialect,
16832                >(
16833                    <VmoTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
16834                    encoder,
16835                    offset + 8,
16836                    _depth,
16837                ),
16838                DataTransfer::InlineData(ref val) => fidl::encoding::encode_in_envelope::<
16839                    fidl::encoding::Vector<u8, 8192>,
16840                    fidl::encoding::DefaultFuchsiaResourceDialect,
16841                >(
16842                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
16843                        val,
16844                    ),
16845                    encoder,
16846                    offset + 8,
16847                    _depth,
16848                ),
16849                DataTransfer::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
16850            }
16851        }
16852    }
16853
16854    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DataTransfer {
16855        #[inline(always)]
16856        fn new_empty() -> Self {
16857            Self::__SourceBreaking { unknown_ordinal: 0 }
16858        }
16859
16860        #[inline]
16861        unsafe fn decode(
16862            &mut self,
16863            decoder: &mut fidl::encoding::Decoder<
16864                '_,
16865                fidl::encoding::DefaultFuchsiaResourceDialect,
16866            >,
16867            offset: usize,
16868            mut depth: fidl::encoding::Depth,
16869        ) -> fidl::Result<()> {
16870            decoder.debug_check_bounds::<Self>(offset);
16871            #[allow(unused_variables)]
16872            let next_out_of_line = decoder.next_out_of_line();
16873            let handles_before = decoder.remaining_handles();
16874            let (ordinal, inlined, num_bytes, num_handles) =
16875                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
16876
16877            let member_inline_size = match ordinal {
16878                1 => <VmoTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context),
16879                2 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
16880                    decoder.context,
16881                ),
16882                0 => return Err(fidl::Error::UnknownUnionTag),
16883                _ => num_bytes as usize,
16884            };
16885
16886            if inlined != (member_inline_size <= 4) {
16887                return Err(fidl::Error::InvalidInlineBitInEnvelope);
16888            }
16889            let _inner_offset;
16890            if inlined {
16891                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
16892                _inner_offset = offset + 8;
16893            } else {
16894                depth.increment()?;
16895                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16896            }
16897            match ordinal {
16898                1 => {
16899                    #[allow(irrefutable_let_patterns)]
16900                    if let DataTransfer::VmoTransfer(_) = self {
16901                        // Do nothing, read the value into the object
16902                    } else {
16903                        // Initialize `self` to the right variant
16904                        *self = DataTransfer::VmoTransfer(fidl::new_empty!(
16905                            VmoTransfer,
16906                            fidl::encoding::DefaultFuchsiaResourceDialect
16907                        ));
16908                    }
16909                    #[allow(irrefutable_let_patterns)]
16910                    if let DataTransfer::VmoTransfer(ref mut val) = self {
16911                        fidl::decode!(
16912                            VmoTransfer,
16913                            fidl::encoding::DefaultFuchsiaResourceDialect,
16914                            val,
16915                            decoder,
16916                            _inner_offset,
16917                            depth
16918                        )?;
16919                    } else {
16920                        unreachable!()
16921                    }
16922                }
16923                2 => {
16924                    #[allow(irrefutable_let_patterns)]
16925                    if let DataTransfer::InlineData(_) = self {
16926                        // Do nothing, read the value into the object
16927                    } else {
16928                        // Initialize `self` to the right variant
16929                        *self = DataTransfer::InlineData(
16930                            fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect),
16931                        );
16932                    }
16933                    #[allow(irrefutable_let_patterns)]
16934                    if let DataTransfer::InlineData(ref mut val) = self {
16935                        fidl::decode!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
16936                    } else {
16937                        unreachable!()
16938                    }
16939                }
16940                #[allow(deprecated)]
16941                ordinal => {
16942                    for _ in 0..num_handles {
16943                        decoder.drop_next_handle()?;
16944                    }
16945                    *self = DataTransfer::__SourceBreaking { unknown_ordinal: ordinal };
16946                }
16947            }
16948            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
16949                return Err(fidl::Error::InvalidNumBytesInEnvelope);
16950            }
16951            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16952                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16953            }
16954            Ok(())
16955        }
16956    }
16957}