Skip to main content

fdomain_fuchsia_hardware_audio/
fdomain_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 fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_hardware_audio__common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13pub type VmoInfos = Vec<VmoInfo>;
14
15#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct CodecConnectorConnectRequest {
17    pub codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
18}
19
20impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
21    for CodecConnectorConnectRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct CompositeConnectorConnectRequest {
27    pub composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
28}
29
30impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
31    for CompositeConnectorConnectRequest
32{
33}
34
35#[derive(Debug, PartialEq)]
36pub struct CompositeCreatePacketStreamRequest {
37    pub processing_element_id: u64,
38    pub format: Format2,
39    pub packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
40}
41
42impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
43    for CompositeCreatePacketStreamRequest
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct CompositeCreateRingBufferRequest {
49    pub processing_element_id: u64,
50    pub format: Format2,
51    pub ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
52}
53
54impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
55    for CompositeCreateRingBufferRequest
56{
57}
58
59#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
60pub struct DaiConnectorConnectRequest {
61    pub dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
62}
63
64impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for DaiConnectorConnectRequest {}
65
66#[derive(Debug, PartialEq)]
67pub struct DaiCreateRingBufferRequest {
68    pub dai_format: DaiFormat,
69    pub ring_buffer_format: Format,
70    pub ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
71}
72
73impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for DaiCreateRingBufferRequest {}
74
75#[derive(Debug, PartialEq)]
76pub struct PacketStreamControlAllocateVmosResponse {
77    pub vmos: Vec<VmoInfo>,
78}
79
80impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
81    for PacketStreamControlAllocateVmosResponse
82{
83}
84
85#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86pub struct RingBufferGetVmoResponse {
87    pub num_frames: u32,
88    pub ring_buffer: fdomain_client::Vmo,
89}
90
91impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RingBufferGetVmoResponse {}
92
93#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
94pub struct StreamConfigConnectorConnectRequest {
95    pub protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
96}
97
98impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
99    for StreamConfigConnectorConnectRequest
100{
101}
102
103#[derive(Debug, PartialEq)]
104pub struct StreamConfigCreateRingBufferRequest {
105    pub format: Format,
106    pub ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
107}
108
109impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
110    for StreamConfigCreateRingBufferRequest
111{
112}
113
114#[derive(Debug, Default, PartialEq)]
115pub struct PacketStreamControlSetPacketStreamSinkRequest {
116    pub stream: Option<fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>>,
117    #[doc(hidden)]
118    pub __source_breaking: fidl::marker::SourceBreaking,
119}
120
121impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
122    for PacketStreamControlSetPacketStreamSinkRequest
123{
124}
125
126#[derive(Debug, Default, PartialEq)]
127pub struct PacketStreamControlGetPacketStreamSinkResponse {
128    pub stream: Option<fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>>,
129    #[doc(hidden)]
130    pub __source_breaking: fidl::marker::SourceBreaking,
131}
132
133impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
134    for PacketStreamControlGetPacketStreamSinkResponse
135{
136}
137
138#[derive(Debug, Default, PartialEq)]
139pub struct PacketStreamSinkPutPacketRequest {
140    /// Location of the payload for this packet.
141    ///
142    /// Required.
143    pub payload: Option<DataTransfer>,
144    #[doc(hidden)]
145    pub __source_breaking: fidl::marker::SourceBreaking,
146}
147
148impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
149    for PacketStreamSinkPutPacketRequest
150{
151}
152
153#[derive(Debug, Default, PartialEq)]
154pub struct RegisterVmosConfig {
155    /// The list of VMOs to register with the driver.
156    ///
157    /// Required.
158    pub vmo_infos: Option<Vec<VmoInfo>>,
159    #[doc(hidden)]
160    pub __source_breaking: fidl::marker::SourceBreaking,
161}
162
163impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RegisterVmosConfig {}
164
165/// VMO information for registering VMOs. Used in `RegisterVmos` and `AllocateVmos` to pair
166/// a VMO handle with a unique ID.
167#[derive(Debug, Default, PartialEq)]
168pub struct VmoInfo {
169    /// ID corresponding to the VMO.
170    ///
171    /// Required.
172    pub id: Option<u64>,
173    /// Handle to the VMO.
174    ///
175    /// Required.
176    pub vmo: Option<fdomain_client::Vmo>,
177    #[doc(hidden)]
178    pub __source_breaking: fidl::marker::SourceBreaking,
179}
180
181impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for VmoInfo {}
182
183/// This describes a VMO section containing audio data.
184#[derive(Debug, Default, PartialEq)]
185pub struct VmoTransfer {
186    /// ID of a VMO that was previously registered or allocated.
187    ///
188    /// Required.
189    pub vmo_id: Option<u64>,
190    /// Offset into the VMO to start reading or writing.
191    /// This is relative to the start of that VMO.
192    ///
193    /// Required.
194    pub vmo_offset: Option<u64>,
195    /// Number of bytes to read/write from/to this VMO region.
196    ///
197    /// Required.
198    pub payload_size: Option<u64>,
199    #[doc(hidden)]
200    pub __source_breaking: fidl::marker::SourceBreaking,
201}
202
203impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for VmoTransfer {}
204
205/// Data to be transferred. There are two supported ways data may be conveyed, corresponding to the
206/// two members of the DataTransfer union:
207///
208/// 1) vmo_transfer: A region within a VMO previously known to the driver. This VMO must have been
209///    established via `PacketStreamControl.RegisterVmos` (if client-allocated) or
210///    `PacketStreamControl.AllocateVmos` (if driver-allocated). Future requests refer to this
211///    buffer by the unique `vmo_id`. Because VMOs are reused across requests, the one-time
212///    cost of pinning/mapping is amortized.
213///
214/// 2) data: The payload is provided directly within the message. This mode is intended for
215///    small transfers or control information, not high-throughput streaming.
216#[derive(Debug)]
217pub enum DataTransfer {
218    /// Data is stored in a region of a registered VMO.
219    /// Requires `PacketStreamProperties.supported_buffer_types` to include `CLIENT_OWNED`
220    /// or `DRIVER_OWNED`.
221    VmoTransfer(VmoTransfer),
222    /// Embedded data buffer.
223    /// Requires `PacketStreamProperties.supported_buffer_types` to include `INLINE`.
224    InlineData(Vec<u8>),
225    #[doc(hidden)]
226    __SourceBreaking { unknown_ordinal: u64 },
227}
228
229/// Pattern that matches an unknown `DataTransfer` member.
230#[macro_export]
231macro_rules! DataTransferUnknown {
232    () => {
233        _
234    };
235}
236
237// Custom PartialEq so that unknown variants are not equal to themselves.
238impl PartialEq for DataTransfer {
239    fn eq(&self, other: &Self) -> bool {
240        match (self, other) {
241            (Self::VmoTransfer(x), Self::VmoTransfer(y)) => *x == *y,
242            (Self::InlineData(x), Self::InlineData(y)) => *x == *y,
243            _ => false,
244        }
245    }
246}
247
248impl DataTransfer {
249    #[inline]
250    pub fn ordinal(&self) -> u64 {
251        match *self {
252            Self::VmoTransfer(_) => 1,
253            Self::InlineData(_) => 2,
254            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
255        }
256    }
257
258    #[inline]
259    pub fn unknown_variant_for_testing() -> Self {
260        Self::__SourceBreaking { unknown_ordinal: 0 }
261    }
262
263    #[inline]
264    pub fn is_unknown(&self) -> bool {
265        match self {
266            Self::__SourceBreaking { .. } => true,
267            _ => false,
268        }
269    }
270}
271
272impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for DataTransfer {}
273
274#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
275pub struct CodecMarker;
276
277impl fdomain_client::fidl::ProtocolMarker for CodecMarker {
278    type Proxy = CodecProxy;
279    type RequestStream = CodecRequestStream;
280
281    const DEBUG_NAME: &'static str = "(anonymous) Codec";
282}
283pub type CodecGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
284pub type CodecSetDaiFormatResult = Result<CodecFormatInfo, i32>;
285
286pub trait CodecProxyInterface: Send + Sync {
287    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
288        + Send;
289    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
290    fn r#signal_processing_connect(
291        &self,
292        protocol: fdomain_client::fidl::ServerEnd<
293            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
294        >,
295    ) -> Result<(), fidl::Error>;
296    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
297    fn r#reset(&self) -> Self::ResetResponseFut;
298    type GetPropertiesResponseFut: std::future::Future<Output = Result<CodecProperties, fidl::Error>>
299        + Send;
300    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
301    type StopResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
302    fn r#stop(&self) -> Self::StopResponseFut;
303    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
304    fn r#start(&self) -> Self::StartResponseFut;
305    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CodecGetDaiFormatsResult, fidl::Error>>
306        + Send;
307    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
308    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CodecSetDaiFormatResult, fidl::Error>>
309        + Send;
310    fn r#set_dai_format(&self, format: &DaiFormat) -> Self::SetDaiFormatResponseFut;
311    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
312        + Send;
313    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
314}
315
316#[derive(Debug, Clone)]
317pub struct CodecProxy {
318    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
319}
320
321impl fdomain_client::fidl::Proxy for CodecProxy {
322    type Protocol = CodecMarker;
323
324    fn from_channel(inner: fdomain_client::Channel) -> Self {
325        Self::new(inner)
326    }
327
328    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
329        self.client.into_channel().map_err(|client| Self { client })
330    }
331
332    fn as_channel(&self) -> &fdomain_client::Channel {
333        self.client.as_channel()
334    }
335}
336
337impl CodecProxy {
338    /// Create a new Proxy for fuchsia.hardware.audio/Codec.
339    pub fn new(channel: fdomain_client::Channel) -> Self {
340        let protocol_name = <CodecMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
341        Self { client: fidl::client::Client::new(channel, protocol_name) }
342    }
343
344    /// Get a Stream of events from the remote end of the protocol.
345    ///
346    /// # Panics
347    ///
348    /// Panics if the event stream was already taken.
349    pub fn take_event_stream(&self) -> CodecEventStream {
350        CodecEventStream { event_receiver: self.client.take_event_receiver() }
351    }
352
353    /// Retrieves top level health state.
354    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
355    pub fn r#get_health_state(
356        &self,
357    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
358    {
359        CodecProxyInterface::r#get_health_state(self)
360    }
361
362    /// Connect to a `SignalProcessing` protocol.
363    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
364    /// the maximum number of connections have already been created, for instance one, then the
365    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
366    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
367    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
368    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
369    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
370    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
371    /// is intended to be composed, and hence the more verbose name allows differentiation and
372    /// improved clarity.
373    pub fn r#signal_processing_connect(
374        &self,
375        mut protocol: fdomain_client::fidl::ServerEnd<
376            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
377        >,
378    ) -> Result<(), fidl::Error> {
379        CodecProxyInterface::r#signal_processing_connect(self, protocol)
380    }
381
382    /// Resets the codec.
383    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
384    /// codec it will close the codec protocol channel, in this case the client may obtain a new
385    /// codec protocol channel and retry.
386    pub fn r#reset(
387        &self,
388    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
389        CodecProxyInterface::r#reset(self)
390    }
391
392    /// Retrieves top level static properties.
393    pub fn r#get_properties(
394        &self,
395    ) -> fidl::client::QueryResponseFut<CodecProperties, fdomain_client::fidl::FDomainResourceDialect>
396    {
397        CodecProxyInterface::r#get_properties(self)
398    }
399
400    /// Stops the codec operation.
401    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
402    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
403    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
404    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
405    /// in the CLOCK_MONOTONIC timeline.
406    /// If the driver cannot successfully configure the codec to stop, it will close the codec
407    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
408    pub fn r#stop(
409        &self,
410    ) -> fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect> {
411        CodecProxyInterface::r#stop(self)
412    }
413
414    /// Start/Re-start the codec operation.
415    /// `Start` returns when configuring the codec to start is completed. This method does not wait
416    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
417    /// into account), nor is any such delay reflected in the returned `start_time`.
418    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
419    /// in the CLOCK_MONOTONIC timeline.
420    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
421    /// in which case the client may obtain a new codec protocol channel and retry.
422    pub fn r#start(
423        &self,
424    ) -> fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect> {
425        CodecProxyInterface::r#start(self)
426    }
427
428    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
429    /// may reply with an error status and the controller may retry at a later time.
430    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
431    /// combinations of the parameters in DaiSupportedFormats may be supported.
432    pub fn r#get_dai_formats(
433        &self,
434    ) -> fidl::client::QueryResponseFut<
435        CodecGetDaiFormatsResult,
436        fdomain_client::fidl::FDomainResourceDialect,
437    > {
438        CodecProxyInterface::r#get_dai_formats(self)
439    }
440
441    /// Sets the DAI format to be used in the interface between the controller and codec.
442    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
443    pub fn r#set_dai_format(
444        &self,
445        mut format: &DaiFormat,
446    ) -> fidl::client::QueryResponseFut<
447        CodecSetDaiFormatResult,
448        fdomain_client::fidl::FDomainResourceDialect,
449    > {
450        CodecProxyInterface::r#set_dai_format(self, format)
451    }
452
453    /// Get the plug detect state via a hanging get. The driver will reply to the first
454    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
455    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
456    pub fn r#watch_plug_state(
457        &self,
458    ) -> fidl::client::QueryResponseFut<PlugState, fdomain_client::fidl::FDomainResourceDialect>
459    {
460        CodecProxyInterface::r#watch_plug_state(self)
461    }
462}
463
464impl CodecProxyInterface for CodecProxy {
465    type GetHealthStateResponseFut =
466        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
467    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
468        fn _decode(
469            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
470        ) -> Result<HealthState, fidl::Error> {
471            let _response = fidl::client::decode_transaction_body::<
472                HealthGetHealthStateResponse,
473                fdomain_client::fidl::FDomainResourceDialect,
474                0x4e146d6bca733a84,
475            >(_buf?)?;
476            Ok(_response.state)
477        }
478        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
479            (),
480            0x4e146d6bca733a84,
481            fidl::encoding::DynamicFlags::empty(),
482            _decode,
483        )
484    }
485
486    fn r#signal_processing_connect(
487        &self,
488        mut protocol: fdomain_client::fidl::ServerEnd<
489            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
490        >,
491    ) -> Result<(), fidl::Error> {
492        self.client.send::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
493            (protocol,),
494            0xa81907ce6066295,
495            fidl::encoding::DynamicFlags::empty(),
496        )
497    }
498
499    type ResetResponseFut =
500        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
501    fn r#reset(&self) -> Self::ResetResponseFut {
502        fn _decode(
503            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
504        ) -> Result<(), fidl::Error> {
505            let _response = fidl::client::decode_transaction_body::<
506                fidl::encoding::EmptyPayload,
507                fdomain_client::fidl::FDomainResourceDialect,
508                0x50757ae579a7bd6b,
509            >(_buf?)?;
510            Ok(_response)
511        }
512        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
513            (),
514            0x50757ae579a7bd6b,
515            fidl::encoding::DynamicFlags::empty(),
516            _decode,
517        )
518    }
519
520    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
521        CodecProperties,
522        fdomain_client::fidl::FDomainResourceDialect,
523    >;
524    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
525        fn _decode(
526            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
527        ) -> Result<CodecProperties, fidl::Error> {
528            let _response = fidl::client::decode_transaction_body::<
529                CodecGetPropertiesResponse,
530                fdomain_client::fidl::FDomainResourceDialect,
531                0x7a0d138a6a1d9d90,
532            >(_buf?)?;
533            Ok(_response.properties)
534        }
535        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecProperties>(
536            (),
537            0x7a0d138a6a1d9d90,
538            fidl::encoding::DynamicFlags::empty(),
539            _decode,
540        )
541    }
542
543    type StopResponseFut =
544        fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect>;
545    fn r#stop(&self) -> Self::StopResponseFut {
546        fn _decode(
547            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
548        ) -> Result<i64, fidl::Error> {
549            let _response = fidl::client::decode_transaction_body::<
550                CodecStopResponse,
551                fdomain_client::fidl::FDomainResourceDialect,
552                0x5c2e380df1332dbd,
553            >(_buf?)?;
554            Ok(_response.stop_time)
555        }
556        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
557            (),
558            0x5c2e380df1332dbd,
559            fidl::encoding::DynamicFlags::empty(),
560            _decode,
561        )
562    }
563
564    type StartResponseFut =
565        fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect>;
566    fn r#start(&self) -> Self::StartResponseFut {
567        fn _decode(
568            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
569        ) -> Result<i64, fidl::Error> {
570            let _response = fidl::client::decode_transaction_body::<
571                CodecStartResponse,
572                fdomain_client::fidl::FDomainResourceDialect,
573                0x329cdacb286ab00,
574            >(_buf?)?;
575            Ok(_response.start_time)
576        }
577        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
578            (),
579            0x329cdacb286ab00,
580            fidl::encoding::DynamicFlags::empty(),
581            _decode,
582        )
583    }
584
585    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
586        CodecGetDaiFormatsResult,
587        fdomain_client::fidl::FDomainResourceDialect,
588    >;
589    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
590        fn _decode(
591            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
592        ) -> Result<CodecGetDaiFormatsResult, fidl::Error> {
593            let _response = fidl::client::decode_transaction_body::<
594                fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>,
595                fdomain_client::fidl::FDomainResourceDialect,
596                0xf8bbc46b4ba6a52,
597            >(_buf?)?;
598            Ok(_response.map(|x| x.formats))
599        }
600        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecGetDaiFormatsResult>(
601            (),
602            0xf8bbc46b4ba6a52,
603            fidl::encoding::DynamicFlags::empty(),
604            _decode,
605        )
606    }
607
608    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
609        CodecSetDaiFormatResult,
610        fdomain_client::fidl::FDomainResourceDialect,
611    >;
612    fn r#set_dai_format(&self, mut format: &DaiFormat) -> Self::SetDaiFormatResponseFut {
613        fn _decode(
614            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
615        ) -> Result<CodecSetDaiFormatResult, fidl::Error> {
616            let _response = fidl::client::decode_transaction_body::<
617                fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>,
618                fdomain_client::fidl::FDomainResourceDialect,
619                0x2f829df9e5a7a1ea,
620            >(_buf?)?;
621            Ok(_response.map(|x| x.state))
622        }
623        self.client.send_query_and_decode::<CodecSetDaiFormatRequest, CodecSetDaiFormatResult>(
624            (format,),
625            0x2f829df9e5a7a1ea,
626            fidl::encoding::DynamicFlags::empty(),
627            _decode,
628        )
629    }
630
631    type WatchPlugStateResponseFut =
632        fidl::client::QueryResponseFut<PlugState, fdomain_client::fidl::FDomainResourceDialect>;
633    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
634        fn _decode(
635            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
636        ) -> Result<PlugState, fidl::Error> {
637            let _response = fidl::client::decode_transaction_body::<
638                CodecWatchPlugStateResponse,
639                fdomain_client::fidl::FDomainResourceDialect,
640                0x182b87f935ca7326,
641            >(_buf?)?;
642            Ok(_response.plug_state)
643        }
644        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
645            (),
646            0x182b87f935ca7326,
647            fidl::encoding::DynamicFlags::empty(),
648            _decode,
649        )
650    }
651}
652
653pub struct CodecEventStream {
654    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
655}
656
657impl std::marker::Unpin for CodecEventStream {}
658
659impl futures::stream::FusedStream for CodecEventStream {
660    fn is_terminated(&self) -> bool {
661        self.event_receiver.is_terminated()
662    }
663}
664
665impl futures::Stream for CodecEventStream {
666    type Item = Result<CodecEvent, fidl::Error>;
667
668    fn poll_next(
669        mut self: std::pin::Pin<&mut Self>,
670        cx: &mut std::task::Context<'_>,
671    ) -> std::task::Poll<Option<Self::Item>> {
672        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
673            &mut self.event_receiver,
674            cx
675        )?) {
676            Some(buf) => std::task::Poll::Ready(Some(CodecEvent::decode(buf))),
677            None => std::task::Poll::Ready(None),
678        }
679    }
680}
681
682#[derive(Debug)]
683pub enum CodecEvent {}
684
685impl CodecEvent {
686    /// Decodes a message buffer as a [`CodecEvent`].
687    fn decode(
688        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
689    ) -> Result<CodecEvent, fidl::Error> {
690        let (bytes, _handles) = buf.split_mut();
691        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
692        debug_assert_eq!(tx_header.tx_id, 0);
693        match tx_header.ordinal {
694            _ => Err(fidl::Error::UnknownOrdinal {
695                ordinal: tx_header.ordinal,
696                protocol_name: <CodecMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
697            }),
698        }
699    }
700}
701
702/// A Stream of incoming requests for fuchsia.hardware.audio/Codec.
703pub struct CodecRequestStream {
704    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
705    is_terminated: bool,
706}
707
708impl std::marker::Unpin for CodecRequestStream {}
709
710impl futures::stream::FusedStream for CodecRequestStream {
711    fn is_terminated(&self) -> bool {
712        self.is_terminated
713    }
714}
715
716impl fdomain_client::fidl::RequestStream for CodecRequestStream {
717    type Protocol = CodecMarker;
718    type ControlHandle = CodecControlHandle;
719
720    fn from_channel(channel: fdomain_client::Channel) -> Self {
721        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
722    }
723
724    fn control_handle(&self) -> Self::ControlHandle {
725        CodecControlHandle { inner: self.inner.clone() }
726    }
727
728    fn into_inner(
729        self,
730    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
731    {
732        (self.inner, self.is_terminated)
733    }
734
735    fn from_inner(
736        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
737        is_terminated: bool,
738    ) -> Self {
739        Self { inner, is_terminated }
740    }
741}
742
743impl futures::Stream for CodecRequestStream {
744    type Item = Result<CodecRequest, fidl::Error>;
745
746    fn poll_next(
747        mut self: std::pin::Pin<&mut Self>,
748        cx: &mut std::task::Context<'_>,
749    ) -> std::task::Poll<Option<Self::Item>> {
750        let this = &mut *self;
751        if this.inner.check_shutdown(cx) {
752            this.is_terminated = true;
753            return std::task::Poll::Ready(None);
754        }
755        if this.is_terminated {
756            panic!("polled CodecRequestStream after completion");
757        }
758        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
759            |bytes, handles| {
760                match this.inner.channel().read_etc(cx, bytes, handles) {
761                    std::task::Poll::Ready(Ok(())) => {}
762                    std::task::Poll::Pending => return std::task::Poll::Pending,
763                    std::task::Poll::Ready(Err(None)) => {
764                        this.is_terminated = true;
765                        return std::task::Poll::Ready(None);
766                    }
767                    std::task::Poll::Ready(Err(Some(e))) => {
768                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
769                            e.into(),
770                        ))));
771                    }
772                }
773
774                // A message has been received from the channel
775                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
776
777                std::task::Poll::Ready(Some(match header.ordinal {
778                    0x4e146d6bca733a84 => {
779                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
780                        let mut req = fidl::new_empty!(
781                            fidl::encoding::EmptyPayload,
782                            fdomain_client::fidl::FDomainResourceDialect
783                        );
784                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
785                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
786                        Ok(CodecRequest::GetHealthState {
787                            responder: CodecGetHealthStateResponder {
788                                control_handle: std::mem::ManuallyDrop::new(control_handle),
789                                tx_id: header.tx_id,
790                            },
791                        })
792                    }
793                    0xa81907ce6066295 => {
794                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
795                        let mut req = fidl::new_empty!(fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
796                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
797                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
798                        Ok(CodecRequest::SignalProcessingConnect {
799                            protocol: req.protocol,
800
801                            control_handle,
802                        })
803                    }
804                    0x50757ae579a7bd6b => {
805                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
806                        let mut req = fidl::new_empty!(
807                            fidl::encoding::EmptyPayload,
808                            fdomain_client::fidl::FDomainResourceDialect
809                        );
810                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
811                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
812                        Ok(CodecRequest::Reset {
813                            responder: CodecResetResponder {
814                                control_handle: std::mem::ManuallyDrop::new(control_handle),
815                                tx_id: header.tx_id,
816                            },
817                        })
818                    }
819                    0x7a0d138a6a1d9d90 => {
820                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
821                        let mut req = fidl::new_empty!(
822                            fidl::encoding::EmptyPayload,
823                            fdomain_client::fidl::FDomainResourceDialect
824                        );
825                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
826                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
827                        Ok(CodecRequest::GetProperties {
828                            responder: CodecGetPropertiesResponder {
829                                control_handle: std::mem::ManuallyDrop::new(control_handle),
830                                tx_id: header.tx_id,
831                            },
832                        })
833                    }
834                    0x5c2e380df1332dbd => {
835                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
836                        let mut req = fidl::new_empty!(
837                            fidl::encoding::EmptyPayload,
838                            fdomain_client::fidl::FDomainResourceDialect
839                        );
840                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
841                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
842                        Ok(CodecRequest::Stop {
843                            responder: CodecStopResponder {
844                                control_handle: std::mem::ManuallyDrop::new(control_handle),
845                                tx_id: header.tx_id,
846                            },
847                        })
848                    }
849                    0x329cdacb286ab00 => {
850                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
851                        let mut req = fidl::new_empty!(
852                            fidl::encoding::EmptyPayload,
853                            fdomain_client::fidl::FDomainResourceDialect
854                        );
855                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
856                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
857                        Ok(CodecRequest::Start {
858                            responder: CodecStartResponder {
859                                control_handle: std::mem::ManuallyDrop::new(control_handle),
860                                tx_id: header.tx_id,
861                            },
862                        })
863                    }
864                    0xf8bbc46b4ba6a52 => {
865                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
866                        let mut req = fidl::new_empty!(
867                            fidl::encoding::EmptyPayload,
868                            fdomain_client::fidl::FDomainResourceDialect
869                        );
870                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
871                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
872                        Ok(CodecRequest::GetDaiFormats {
873                            responder: CodecGetDaiFormatsResponder {
874                                control_handle: std::mem::ManuallyDrop::new(control_handle),
875                                tx_id: header.tx_id,
876                            },
877                        })
878                    }
879                    0x2f829df9e5a7a1ea => {
880                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
881                        let mut req = fidl::new_empty!(
882                            CodecSetDaiFormatRequest,
883                            fdomain_client::fidl::FDomainResourceDialect
884                        );
885                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CodecSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
886                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
887                        Ok(CodecRequest::SetDaiFormat {
888                            format: req.format,
889
890                            responder: CodecSetDaiFormatResponder {
891                                control_handle: std::mem::ManuallyDrop::new(control_handle),
892                                tx_id: header.tx_id,
893                            },
894                        })
895                    }
896                    0x182b87f935ca7326 => {
897                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
898                        let mut req = fidl::new_empty!(
899                            fidl::encoding::EmptyPayload,
900                            fdomain_client::fidl::FDomainResourceDialect
901                        );
902                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
903                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
904                        Ok(CodecRequest::WatchPlugState {
905                            responder: CodecWatchPlugStateResponder {
906                                control_handle: std::mem::ManuallyDrop::new(control_handle),
907                                tx_id: header.tx_id,
908                            },
909                        })
910                    }
911                    _ => Err(fidl::Error::UnknownOrdinal {
912                        ordinal: header.ordinal,
913                        protocol_name:
914                            <CodecMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
915                    }),
916                }))
917            },
918        )
919    }
920}
921
922/// For an overview see
923/// [[Audio Codec Interface]](https://fuchsia.dev/fuchsia-src/development/audio/drivers/codec).
924/// # Deprecation
925///
926/// Not supported anymore, instead use an
927/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
928/// with one DAI and no Ring Buffer, see
929/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
930#[derive(Debug)]
931pub enum CodecRequest {
932    /// Retrieves top level health state.
933    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
934    GetHealthState { responder: CodecGetHealthStateResponder },
935    /// Connect to a `SignalProcessing` protocol.
936    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
937    /// the maximum number of connections have already been created, for instance one, then the
938    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
939    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
940    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
941    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
942    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
943    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
944    /// is intended to be composed, and hence the more verbose name allows differentiation and
945    /// improved clarity.
946    SignalProcessingConnect {
947        protocol: fdomain_client::fidl::ServerEnd<
948            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
949        >,
950        control_handle: CodecControlHandle,
951    },
952    /// Resets the codec.
953    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
954    /// codec it will close the codec protocol channel, in this case the client may obtain a new
955    /// codec protocol channel and retry.
956    Reset { responder: CodecResetResponder },
957    /// Retrieves top level static properties.
958    GetProperties { responder: CodecGetPropertiesResponder },
959    /// Stops the codec operation.
960    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
961    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
962    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
963    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
964    /// in the CLOCK_MONOTONIC timeline.
965    /// If the driver cannot successfully configure the codec to stop, it will close the codec
966    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
967    Stop { responder: CodecStopResponder },
968    /// Start/Re-start the codec operation.
969    /// `Start` returns when configuring the codec to start is completed. This method does not wait
970    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
971    /// into account), nor is any such delay reflected in the returned `start_time`.
972    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
973    /// in the CLOCK_MONOTONIC timeline.
974    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
975    /// in which case the client may obtain a new codec protocol channel and retry.
976    Start { responder: CodecStartResponder },
977    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
978    /// may reply with an error status and the controller may retry at a later time.
979    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
980    /// combinations of the parameters in DaiSupportedFormats may be supported.
981    GetDaiFormats { responder: CodecGetDaiFormatsResponder },
982    /// Sets the DAI format to be used in the interface between the controller and codec.
983    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
984    SetDaiFormat { format: DaiFormat, responder: CodecSetDaiFormatResponder },
985    /// Get the plug detect state via a hanging get. The driver will reply to the first
986    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
987    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
988    WatchPlugState { responder: CodecWatchPlugStateResponder },
989}
990
991impl CodecRequest {
992    #[allow(irrefutable_let_patterns)]
993    pub fn into_get_health_state(self) -> Option<(CodecGetHealthStateResponder)> {
994        if let CodecRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
995    }
996
997    #[allow(irrefutable_let_patterns)]
998    pub fn into_signal_processing_connect(
999        self,
1000    ) -> Option<(
1001        fdomain_client::fidl::ServerEnd<
1002            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1003        >,
1004        CodecControlHandle,
1005    )> {
1006        if let CodecRequest::SignalProcessingConnect { protocol, control_handle } = self {
1007            Some((protocol, control_handle))
1008        } else {
1009            None
1010        }
1011    }
1012
1013    #[allow(irrefutable_let_patterns)]
1014    pub fn into_reset(self) -> Option<(CodecResetResponder)> {
1015        if let CodecRequest::Reset { responder } = self { Some((responder)) } else { None }
1016    }
1017
1018    #[allow(irrefutable_let_patterns)]
1019    pub fn into_get_properties(self) -> Option<(CodecGetPropertiesResponder)> {
1020        if let CodecRequest::GetProperties { responder } = self { Some((responder)) } else { None }
1021    }
1022
1023    #[allow(irrefutable_let_patterns)]
1024    pub fn into_stop(self) -> Option<(CodecStopResponder)> {
1025        if let CodecRequest::Stop { responder } = self { Some((responder)) } else { None }
1026    }
1027
1028    #[allow(irrefutable_let_patterns)]
1029    pub fn into_start(self) -> Option<(CodecStartResponder)> {
1030        if let CodecRequest::Start { responder } = self { Some((responder)) } else { None }
1031    }
1032
1033    #[allow(irrefutable_let_patterns)]
1034    pub fn into_get_dai_formats(self) -> Option<(CodecGetDaiFormatsResponder)> {
1035        if let CodecRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
1036    }
1037
1038    #[allow(irrefutable_let_patterns)]
1039    pub fn into_set_dai_format(self) -> Option<(DaiFormat, CodecSetDaiFormatResponder)> {
1040        if let CodecRequest::SetDaiFormat { format, responder } = self {
1041            Some((format, responder))
1042        } else {
1043            None
1044        }
1045    }
1046
1047    #[allow(irrefutable_let_patterns)]
1048    pub fn into_watch_plug_state(self) -> Option<(CodecWatchPlugStateResponder)> {
1049        if let CodecRequest::WatchPlugState { responder } = self { Some((responder)) } else { None }
1050    }
1051
1052    /// Name of the method defined in FIDL
1053    pub fn method_name(&self) -> &'static str {
1054        match *self {
1055            CodecRequest::GetHealthState { .. } => "get_health_state",
1056            CodecRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
1057            CodecRequest::Reset { .. } => "reset",
1058            CodecRequest::GetProperties { .. } => "get_properties",
1059            CodecRequest::Stop { .. } => "stop",
1060            CodecRequest::Start { .. } => "start",
1061            CodecRequest::GetDaiFormats { .. } => "get_dai_formats",
1062            CodecRequest::SetDaiFormat { .. } => "set_dai_format",
1063            CodecRequest::WatchPlugState { .. } => "watch_plug_state",
1064        }
1065    }
1066}
1067
1068#[derive(Debug, Clone)]
1069pub struct CodecControlHandle {
1070    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1071}
1072
1073impl fdomain_client::fidl::ControlHandle for CodecControlHandle {
1074    fn shutdown(&self) {
1075        self.inner.shutdown()
1076    }
1077
1078    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1079        self.inner.shutdown_with_epitaph(status)
1080    }
1081
1082    fn is_closed(&self) -> bool {
1083        self.inner.channel().is_closed()
1084    }
1085    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1086        self.inner.channel().on_closed()
1087    }
1088}
1089
1090impl CodecControlHandle {}
1091
1092#[must_use = "FIDL methods require a response to be sent"]
1093#[derive(Debug)]
1094pub struct CodecGetHealthStateResponder {
1095    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1096    tx_id: u32,
1097}
1098
1099/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1100/// if the responder is dropped without sending a response, so that the client
1101/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1102impl std::ops::Drop for CodecGetHealthStateResponder {
1103    fn drop(&mut self) {
1104        self.control_handle.shutdown();
1105        // Safety: drops once, never accessed again
1106        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1107    }
1108}
1109
1110impl fdomain_client::fidl::Responder for CodecGetHealthStateResponder {
1111    type ControlHandle = CodecControlHandle;
1112
1113    fn control_handle(&self) -> &CodecControlHandle {
1114        &self.control_handle
1115    }
1116
1117    fn drop_without_shutdown(mut self) {
1118        // Safety: drops once, never accessed again due to mem::forget
1119        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1120        // Prevent Drop from running (which would shut down the channel)
1121        std::mem::forget(self);
1122    }
1123}
1124
1125impl CodecGetHealthStateResponder {
1126    /// Sends a response to the FIDL transaction.
1127    ///
1128    /// Sets the channel to shutdown if an error occurs.
1129    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1130        let _result = self.send_raw(state);
1131        if _result.is_err() {
1132            self.control_handle.shutdown();
1133        }
1134        self.drop_without_shutdown();
1135        _result
1136    }
1137
1138    /// Similar to "send" but does not shutdown the channel if an error occurs.
1139    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1140        let _result = self.send_raw(state);
1141        self.drop_without_shutdown();
1142        _result
1143    }
1144
1145    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
1146        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
1147            (state,),
1148            self.tx_id,
1149            0x4e146d6bca733a84,
1150            fidl::encoding::DynamicFlags::empty(),
1151        )
1152    }
1153}
1154
1155#[must_use = "FIDL methods require a response to be sent"]
1156#[derive(Debug)]
1157pub struct CodecResetResponder {
1158    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1159    tx_id: u32,
1160}
1161
1162/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1163/// if the responder is dropped without sending a response, so that the client
1164/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1165impl std::ops::Drop for CodecResetResponder {
1166    fn drop(&mut self) {
1167        self.control_handle.shutdown();
1168        // Safety: drops once, never accessed again
1169        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1170    }
1171}
1172
1173impl fdomain_client::fidl::Responder for CodecResetResponder {
1174    type ControlHandle = CodecControlHandle;
1175
1176    fn control_handle(&self) -> &CodecControlHandle {
1177        &self.control_handle
1178    }
1179
1180    fn drop_without_shutdown(mut self) {
1181        // Safety: drops once, never accessed again due to mem::forget
1182        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1183        // Prevent Drop from running (which would shut down the channel)
1184        std::mem::forget(self);
1185    }
1186}
1187
1188impl CodecResetResponder {
1189    /// Sends a response to the FIDL transaction.
1190    ///
1191    /// Sets the channel to shutdown if an error occurs.
1192    pub fn send(self) -> Result<(), fidl::Error> {
1193        let _result = self.send_raw();
1194        if _result.is_err() {
1195            self.control_handle.shutdown();
1196        }
1197        self.drop_without_shutdown();
1198        _result
1199    }
1200
1201    /// Similar to "send" but does not shutdown the channel if an error occurs.
1202    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1203        let _result = self.send_raw();
1204        self.drop_without_shutdown();
1205        _result
1206    }
1207
1208    fn send_raw(&self) -> Result<(), fidl::Error> {
1209        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1210            (),
1211            self.tx_id,
1212            0x50757ae579a7bd6b,
1213            fidl::encoding::DynamicFlags::empty(),
1214        )
1215    }
1216}
1217
1218#[must_use = "FIDL methods require a response to be sent"]
1219#[derive(Debug)]
1220pub struct CodecGetPropertiesResponder {
1221    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1222    tx_id: u32,
1223}
1224
1225/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1226/// if the responder is dropped without sending a response, so that the client
1227/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1228impl std::ops::Drop for CodecGetPropertiesResponder {
1229    fn drop(&mut self) {
1230        self.control_handle.shutdown();
1231        // Safety: drops once, never accessed again
1232        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1233    }
1234}
1235
1236impl fdomain_client::fidl::Responder for CodecGetPropertiesResponder {
1237    type ControlHandle = CodecControlHandle;
1238
1239    fn control_handle(&self) -> &CodecControlHandle {
1240        &self.control_handle
1241    }
1242
1243    fn drop_without_shutdown(mut self) {
1244        // Safety: drops once, never accessed again due to mem::forget
1245        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1246        // Prevent Drop from running (which would shut down the channel)
1247        std::mem::forget(self);
1248    }
1249}
1250
1251impl CodecGetPropertiesResponder {
1252    /// Sends a response to the FIDL transaction.
1253    ///
1254    /// Sets the channel to shutdown if an error occurs.
1255    pub fn send(self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1256        let _result = self.send_raw(properties);
1257        if _result.is_err() {
1258            self.control_handle.shutdown();
1259        }
1260        self.drop_without_shutdown();
1261        _result
1262    }
1263
1264    /// Similar to "send" but does not shutdown the channel if an error occurs.
1265    pub fn send_no_shutdown_on_err(
1266        self,
1267        mut properties: &CodecProperties,
1268    ) -> Result<(), fidl::Error> {
1269        let _result = self.send_raw(properties);
1270        self.drop_without_shutdown();
1271        _result
1272    }
1273
1274    fn send_raw(&self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1275        self.control_handle.inner.send::<CodecGetPropertiesResponse>(
1276            (properties,),
1277            self.tx_id,
1278            0x7a0d138a6a1d9d90,
1279            fidl::encoding::DynamicFlags::empty(),
1280        )
1281    }
1282}
1283
1284#[must_use = "FIDL methods require a response to be sent"]
1285#[derive(Debug)]
1286pub struct CodecStopResponder {
1287    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1288    tx_id: u32,
1289}
1290
1291/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1292/// if the responder is dropped without sending a response, so that the client
1293/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1294impl std::ops::Drop for CodecStopResponder {
1295    fn drop(&mut self) {
1296        self.control_handle.shutdown();
1297        // Safety: drops once, never accessed again
1298        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1299    }
1300}
1301
1302impl fdomain_client::fidl::Responder for CodecStopResponder {
1303    type ControlHandle = CodecControlHandle;
1304
1305    fn control_handle(&self) -> &CodecControlHandle {
1306        &self.control_handle
1307    }
1308
1309    fn drop_without_shutdown(mut self) {
1310        // Safety: drops once, never accessed again due to mem::forget
1311        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1312        // Prevent Drop from running (which would shut down the channel)
1313        std::mem::forget(self);
1314    }
1315}
1316
1317impl CodecStopResponder {
1318    /// Sends a response to the FIDL transaction.
1319    ///
1320    /// Sets the channel to shutdown if an error occurs.
1321    pub fn send(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1322        let _result = self.send_raw(stop_time);
1323        if _result.is_err() {
1324            self.control_handle.shutdown();
1325        }
1326        self.drop_without_shutdown();
1327        _result
1328    }
1329
1330    /// Similar to "send" but does not shutdown the channel if an error occurs.
1331    pub fn send_no_shutdown_on_err(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1332        let _result = self.send_raw(stop_time);
1333        self.drop_without_shutdown();
1334        _result
1335    }
1336
1337    fn send_raw(&self, mut stop_time: i64) -> Result<(), fidl::Error> {
1338        self.control_handle.inner.send::<CodecStopResponse>(
1339            (stop_time,),
1340            self.tx_id,
1341            0x5c2e380df1332dbd,
1342            fidl::encoding::DynamicFlags::empty(),
1343        )
1344    }
1345}
1346
1347#[must_use = "FIDL methods require a response to be sent"]
1348#[derive(Debug)]
1349pub struct CodecStartResponder {
1350    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1351    tx_id: u32,
1352}
1353
1354/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1355/// if the responder is dropped without sending a response, so that the client
1356/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1357impl std::ops::Drop for CodecStartResponder {
1358    fn drop(&mut self) {
1359        self.control_handle.shutdown();
1360        // Safety: drops once, never accessed again
1361        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1362    }
1363}
1364
1365impl fdomain_client::fidl::Responder for CodecStartResponder {
1366    type ControlHandle = CodecControlHandle;
1367
1368    fn control_handle(&self) -> &CodecControlHandle {
1369        &self.control_handle
1370    }
1371
1372    fn drop_without_shutdown(mut self) {
1373        // Safety: drops once, never accessed again due to mem::forget
1374        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1375        // Prevent Drop from running (which would shut down the channel)
1376        std::mem::forget(self);
1377    }
1378}
1379
1380impl CodecStartResponder {
1381    /// Sends a response to the FIDL transaction.
1382    ///
1383    /// Sets the channel to shutdown if an error occurs.
1384    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
1385        let _result = self.send_raw(start_time);
1386        if _result.is_err() {
1387            self.control_handle.shutdown();
1388        }
1389        self.drop_without_shutdown();
1390        _result
1391    }
1392
1393    /// Similar to "send" but does not shutdown the channel if an error occurs.
1394    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
1395        let _result = self.send_raw(start_time);
1396        self.drop_without_shutdown();
1397        _result
1398    }
1399
1400    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
1401        self.control_handle.inner.send::<CodecStartResponse>(
1402            (start_time,),
1403            self.tx_id,
1404            0x329cdacb286ab00,
1405            fidl::encoding::DynamicFlags::empty(),
1406        )
1407    }
1408}
1409
1410#[must_use = "FIDL methods require a response to be sent"]
1411#[derive(Debug)]
1412pub struct CodecGetDaiFormatsResponder {
1413    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1414    tx_id: u32,
1415}
1416
1417/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1418/// if the responder is dropped without sending a response, so that the client
1419/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1420impl std::ops::Drop for CodecGetDaiFormatsResponder {
1421    fn drop(&mut self) {
1422        self.control_handle.shutdown();
1423        // Safety: drops once, never accessed again
1424        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1425    }
1426}
1427
1428impl fdomain_client::fidl::Responder for CodecGetDaiFormatsResponder {
1429    type ControlHandle = CodecControlHandle;
1430
1431    fn control_handle(&self) -> &CodecControlHandle {
1432        &self.control_handle
1433    }
1434
1435    fn drop_without_shutdown(mut self) {
1436        // Safety: drops once, never accessed again due to mem::forget
1437        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1438        // Prevent Drop from running (which would shut down the channel)
1439        std::mem::forget(self);
1440    }
1441}
1442
1443impl CodecGetDaiFormatsResponder {
1444    /// Sends a response to the FIDL transaction.
1445    ///
1446    /// Sets the channel to shutdown if an error occurs.
1447    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1448        let _result = self.send_raw(result);
1449        if _result.is_err() {
1450            self.control_handle.shutdown();
1451        }
1452        self.drop_without_shutdown();
1453        _result
1454    }
1455
1456    /// Similar to "send" but does not shutdown the channel if an error occurs.
1457    pub fn send_no_shutdown_on_err(
1458        self,
1459        mut result: Result<&[DaiSupportedFormats], i32>,
1460    ) -> Result<(), fidl::Error> {
1461        let _result = self.send_raw(result);
1462        self.drop_without_shutdown();
1463        _result
1464    }
1465
1466    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1467        self.control_handle
1468            .inner
1469            .send::<fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>>(
1470                result.map(|formats| (formats,)),
1471                self.tx_id,
1472                0xf8bbc46b4ba6a52,
1473                fidl::encoding::DynamicFlags::empty(),
1474            )
1475    }
1476}
1477
1478#[must_use = "FIDL methods require a response to be sent"]
1479#[derive(Debug)]
1480pub struct CodecSetDaiFormatResponder {
1481    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1482    tx_id: u32,
1483}
1484
1485/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1486/// if the responder is dropped without sending a response, so that the client
1487/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1488impl std::ops::Drop for CodecSetDaiFormatResponder {
1489    fn drop(&mut self) {
1490        self.control_handle.shutdown();
1491        // Safety: drops once, never accessed again
1492        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1493    }
1494}
1495
1496impl fdomain_client::fidl::Responder for CodecSetDaiFormatResponder {
1497    type ControlHandle = CodecControlHandle;
1498
1499    fn control_handle(&self) -> &CodecControlHandle {
1500        &self.control_handle
1501    }
1502
1503    fn drop_without_shutdown(mut self) {
1504        // Safety: drops once, never accessed again due to mem::forget
1505        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1506        // Prevent Drop from running (which would shut down the channel)
1507        std::mem::forget(self);
1508    }
1509}
1510
1511impl CodecSetDaiFormatResponder {
1512    /// Sends a response to the FIDL transaction.
1513    ///
1514    /// Sets the channel to shutdown if an error occurs.
1515    pub fn send(self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1516        let _result = self.send_raw(result);
1517        if _result.is_err() {
1518            self.control_handle.shutdown();
1519        }
1520        self.drop_without_shutdown();
1521        _result
1522    }
1523
1524    /// Similar to "send" but does not shutdown the channel if an error occurs.
1525    pub fn send_no_shutdown_on_err(
1526        self,
1527        mut result: Result<&CodecFormatInfo, i32>,
1528    ) -> Result<(), fidl::Error> {
1529        let _result = self.send_raw(result);
1530        self.drop_without_shutdown();
1531        _result
1532    }
1533
1534    fn send_raw(&self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1535        self.control_handle
1536            .inner
1537            .send::<fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>>(
1538                result.map(|state| (state,)),
1539                self.tx_id,
1540                0x2f829df9e5a7a1ea,
1541                fidl::encoding::DynamicFlags::empty(),
1542            )
1543    }
1544}
1545
1546#[must_use = "FIDL methods require a response to be sent"]
1547#[derive(Debug)]
1548pub struct CodecWatchPlugStateResponder {
1549    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1550    tx_id: u32,
1551}
1552
1553/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1554/// if the responder is dropped without sending a response, so that the client
1555/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1556impl std::ops::Drop for CodecWatchPlugStateResponder {
1557    fn drop(&mut self) {
1558        self.control_handle.shutdown();
1559        // Safety: drops once, never accessed again
1560        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1561    }
1562}
1563
1564impl fdomain_client::fidl::Responder for CodecWatchPlugStateResponder {
1565    type ControlHandle = CodecControlHandle;
1566
1567    fn control_handle(&self) -> &CodecControlHandle {
1568        &self.control_handle
1569    }
1570
1571    fn drop_without_shutdown(mut self) {
1572        // Safety: drops once, never accessed again due to mem::forget
1573        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1574        // Prevent Drop from running (which would shut down the channel)
1575        std::mem::forget(self);
1576    }
1577}
1578
1579impl CodecWatchPlugStateResponder {
1580    /// Sends a response to the FIDL transaction.
1581    ///
1582    /// Sets the channel to shutdown if an error occurs.
1583    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1584        let _result = self.send_raw(plug_state);
1585        if _result.is_err() {
1586            self.control_handle.shutdown();
1587        }
1588        self.drop_without_shutdown();
1589        _result
1590    }
1591
1592    /// Similar to "send" but does not shutdown the channel if an error occurs.
1593    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1594        let _result = self.send_raw(plug_state);
1595        self.drop_without_shutdown();
1596        _result
1597    }
1598
1599    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1600        self.control_handle.inner.send::<CodecWatchPlugStateResponse>(
1601            (plug_state,),
1602            self.tx_id,
1603            0x182b87f935ca7326,
1604            fidl::encoding::DynamicFlags::empty(),
1605        )
1606    }
1607}
1608
1609#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1610pub struct CodecConnectorMarker;
1611
1612impl fdomain_client::fidl::ProtocolMarker for CodecConnectorMarker {
1613    type Proxy = CodecConnectorProxy;
1614    type RequestStream = CodecConnectorRequestStream;
1615
1616    const DEBUG_NAME: &'static str = "(anonymous) CodecConnector";
1617}
1618
1619pub trait CodecConnectorProxyInterface: Send + Sync {
1620    fn r#connect(
1621        &self,
1622        codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1623    ) -> Result<(), fidl::Error>;
1624}
1625
1626#[derive(Debug, Clone)]
1627pub struct CodecConnectorProxy {
1628    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1629}
1630
1631impl fdomain_client::fidl::Proxy for CodecConnectorProxy {
1632    type Protocol = CodecConnectorMarker;
1633
1634    fn from_channel(inner: fdomain_client::Channel) -> Self {
1635        Self::new(inner)
1636    }
1637
1638    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1639        self.client.into_channel().map_err(|client| Self { client })
1640    }
1641
1642    fn as_channel(&self) -> &fdomain_client::Channel {
1643        self.client.as_channel()
1644    }
1645}
1646
1647impl CodecConnectorProxy {
1648    /// Create a new Proxy for fuchsia.hardware.audio/CodecConnector.
1649    pub fn new(channel: fdomain_client::Channel) -> Self {
1650        let protocol_name =
1651            <CodecConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1652        Self { client: fidl::client::Client::new(channel, protocol_name) }
1653    }
1654
1655    /// Get a Stream of events from the remote end of the protocol.
1656    ///
1657    /// # Panics
1658    ///
1659    /// Panics if the event stream was already taken.
1660    pub fn take_event_stream(&self) -> CodecConnectorEventStream {
1661        CodecConnectorEventStream { event_receiver: self.client.take_event_receiver() }
1662    }
1663
1664    /// Connect to a Codec protocol server.
1665    /// This indirection into the Codec protocol allows us to support independent codec client
1666    /// connections.
1667    pub fn r#connect(
1668        &self,
1669        mut codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1670    ) -> Result<(), fidl::Error> {
1671        CodecConnectorProxyInterface::r#connect(self, codec_protocol)
1672    }
1673}
1674
1675impl CodecConnectorProxyInterface for CodecConnectorProxy {
1676    fn r#connect(
1677        &self,
1678        mut codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1679    ) -> Result<(), fidl::Error> {
1680        self.client.send::<CodecConnectorConnectRequest>(
1681            (codec_protocol,),
1682            0x1413f551544026c9,
1683            fidl::encoding::DynamicFlags::empty(),
1684        )
1685    }
1686}
1687
1688pub struct CodecConnectorEventStream {
1689    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1690}
1691
1692impl std::marker::Unpin for CodecConnectorEventStream {}
1693
1694impl futures::stream::FusedStream for CodecConnectorEventStream {
1695    fn is_terminated(&self) -> bool {
1696        self.event_receiver.is_terminated()
1697    }
1698}
1699
1700impl futures::Stream for CodecConnectorEventStream {
1701    type Item = Result<CodecConnectorEvent, fidl::Error>;
1702
1703    fn poll_next(
1704        mut self: std::pin::Pin<&mut Self>,
1705        cx: &mut std::task::Context<'_>,
1706    ) -> std::task::Poll<Option<Self::Item>> {
1707        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1708            &mut self.event_receiver,
1709            cx
1710        )?) {
1711            Some(buf) => std::task::Poll::Ready(Some(CodecConnectorEvent::decode(buf))),
1712            None => std::task::Poll::Ready(None),
1713        }
1714    }
1715}
1716
1717#[derive(Debug)]
1718pub enum CodecConnectorEvent {}
1719
1720impl CodecConnectorEvent {
1721    /// Decodes a message buffer as a [`CodecConnectorEvent`].
1722    fn decode(
1723        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1724    ) -> Result<CodecConnectorEvent, fidl::Error> {
1725        let (bytes, _handles) = buf.split_mut();
1726        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1727        debug_assert_eq!(tx_header.tx_id, 0);
1728        match tx_header.ordinal {
1729            _ => Err(fidl::Error::UnknownOrdinal {
1730                ordinal: tx_header.ordinal,
1731                protocol_name:
1732                    <CodecConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1733            }),
1734        }
1735    }
1736}
1737
1738/// A Stream of incoming requests for fuchsia.hardware.audio/CodecConnector.
1739pub struct CodecConnectorRequestStream {
1740    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1741    is_terminated: bool,
1742}
1743
1744impl std::marker::Unpin for CodecConnectorRequestStream {}
1745
1746impl futures::stream::FusedStream for CodecConnectorRequestStream {
1747    fn is_terminated(&self) -> bool {
1748        self.is_terminated
1749    }
1750}
1751
1752impl fdomain_client::fidl::RequestStream for CodecConnectorRequestStream {
1753    type Protocol = CodecConnectorMarker;
1754    type ControlHandle = CodecConnectorControlHandle;
1755
1756    fn from_channel(channel: fdomain_client::Channel) -> Self {
1757        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1758    }
1759
1760    fn control_handle(&self) -> Self::ControlHandle {
1761        CodecConnectorControlHandle { inner: self.inner.clone() }
1762    }
1763
1764    fn into_inner(
1765        self,
1766    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1767    {
1768        (self.inner, self.is_terminated)
1769    }
1770
1771    fn from_inner(
1772        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1773        is_terminated: bool,
1774    ) -> Self {
1775        Self { inner, is_terminated }
1776    }
1777}
1778
1779impl futures::Stream for CodecConnectorRequestStream {
1780    type Item = Result<CodecConnectorRequest, fidl::Error>;
1781
1782    fn poll_next(
1783        mut self: std::pin::Pin<&mut Self>,
1784        cx: &mut std::task::Context<'_>,
1785    ) -> std::task::Poll<Option<Self::Item>> {
1786        let this = &mut *self;
1787        if this.inner.check_shutdown(cx) {
1788            this.is_terminated = true;
1789            return std::task::Poll::Ready(None);
1790        }
1791        if this.is_terminated {
1792            panic!("polled CodecConnectorRequestStream after completion");
1793        }
1794        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1795            |bytes, handles| {
1796                match this.inner.channel().read_etc(cx, bytes, handles) {
1797                    std::task::Poll::Ready(Ok(())) => {}
1798                    std::task::Poll::Pending => return std::task::Poll::Pending,
1799                    std::task::Poll::Ready(Err(None)) => {
1800                        this.is_terminated = true;
1801                        return std::task::Poll::Ready(None);
1802                    }
1803                    std::task::Poll::Ready(Err(Some(e))) => {
1804                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1805                            e.into(),
1806                        ))));
1807                    }
1808                }
1809
1810                // A message has been received from the channel
1811                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1812
1813                std::task::Poll::Ready(Some(match header.ordinal {
1814                0x1413f551544026c9 => {
1815                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1816                    let mut req = fidl::new_empty!(CodecConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
1817                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CodecConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1818                    let control_handle = CodecConnectorControlHandle {
1819                        inner: this.inner.clone(),
1820                    };
1821                    Ok(CodecConnectorRequest::Connect {codec_protocol: req.codec_protocol,
1822
1823                        control_handle,
1824                    })
1825                }
1826                _ => Err(fidl::Error::UnknownOrdinal {
1827                    ordinal: header.ordinal,
1828                    protocol_name: <CodecConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1829                }),
1830            }))
1831            },
1832        )
1833    }
1834}
1835
1836/// For an overview of the Codec protocols see
1837/// [Codec Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_codec.md)
1838/// # Deprecation
1839///
1840/// Not supported anymore, instead use an
1841/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
1842/// with one DAI and no Ring Buffer, see
1843/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
1844#[derive(Debug)]
1845pub enum CodecConnectorRequest {
1846    /// Connect to a Codec protocol server.
1847    /// This indirection into the Codec protocol allows us to support independent codec client
1848    /// connections.
1849    Connect {
1850        codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1851        control_handle: CodecConnectorControlHandle,
1852    },
1853}
1854
1855impl CodecConnectorRequest {
1856    #[allow(irrefutable_let_patterns)]
1857    pub fn into_connect(
1858        self,
1859    ) -> Option<(fdomain_client::fidl::ServerEnd<CodecMarker>, CodecConnectorControlHandle)> {
1860        if let CodecConnectorRequest::Connect { codec_protocol, control_handle } = self {
1861            Some((codec_protocol, control_handle))
1862        } else {
1863            None
1864        }
1865    }
1866
1867    /// Name of the method defined in FIDL
1868    pub fn method_name(&self) -> &'static str {
1869        match *self {
1870            CodecConnectorRequest::Connect { .. } => "connect",
1871        }
1872    }
1873}
1874
1875#[derive(Debug, Clone)]
1876pub struct CodecConnectorControlHandle {
1877    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1878}
1879
1880impl fdomain_client::fidl::ControlHandle for CodecConnectorControlHandle {
1881    fn shutdown(&self) {
1882        self.inner.shutdown()
1883    }
1884
1885    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1886        self.inner.shutdown_with_epitaph(status)
1887    }
1888
1889    fn is_closed(&self) -> bool {
1890        self.inner.channel().is_closed()
1891    }
1892    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1893        self.inner.channel().on_closed()
1894    }
1895}
1896
1897impl CodecConnectorControlHandle {}
1898
1899#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1900pub struct CompositeMarker;
1901
1902impl fdomain_client::fidl::ProtocolMarker for CompositeMarker {
1903    type Proxy = CompositeProxy;
1904    type RequestStream = CompositeRequestStream;
1905
1906    const DEBUG_NAME: &'static str = "(anonymous) Composite";
1907}
1908pub type CompositeResetResult = Result<(), DriverError>;
1909pub type CompositeGetRingBufferFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
1910pub type CompositeCreateRingBufferResult = Result<(), DriverError>;
1911pub type CompositeGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, DriverError>;
1912pub type CompositeSetDaiFormatResult = Result<(), DriverError>;
1913pub type CompositeGetPacketStreamFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
1914pub type CompositeCreatePacketStreamResult = Result<(), DriverError>;
1915
1916pub trait CompositeProxyInterface: Send + Sync {
1917    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
1918        + Send;
1919    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
1920    fn r#signal_processing_connect(
1921        &self,
1922        protocol: fdomain_client::fidl::ServerEnd<
1923            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1924        >,
1925    ) -> Result<(), fidl::Error>;
1926    type ResetResponseFut: std::future::Future<Output = Result<CompositeResetResult, fidl::Error>>
1927        + Send;
1928    fn r#reset(&self) -> Self::ResetResponseFut;
1929    type GetPropertiesResponseFut: std::future::Future<Output = Result<CompositeProperties, fidl::Error>>
1930        + Send;
1931    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
1932    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<CompositeGetRingBufferFormatsResult, fidl::Error>>
1933        + Send;
1934    fn r#get_ring_buffer_formats(
1935        &self,
1936        processing_element_id: u64,
1937    ) -> Self::GetRingBufferFormatsResponseFut;
1938    type CreateRingBufferResponseFut: std::future::Future<Output = Result<CompositeCreateRingBufferResult, fidl::Error>>
1939        + Send;
1940    fn r#create_ring_buffer(
1941        &self,
1942        processing_element_id: u64,
1943        format: &Format2,
1944        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
1945    ) -> Self::CreateRingBufferResponseFut;
1946    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CompositeGetDaiFormatsResult, fidl::Error>>
1947        + Send;
1948    fn r#get_dai_formats(&self, processing_element_id: u64) -> Self::GetDaiFormatsResponseFut;
1949    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CompositeSetDaiFormatResult, fidl::Error>>
1950        + Send;
1951    fn r#set_dai_format(
1952        &self,
1953        processing_element_id: u64,
1954        format: &DaiFormat,
1955    ) -> Self::SetDaiFormatResponseFut;
1956    type GetPacketStreamFormatsResponseFut: std::future::Future<Output = Result<CompositeGetPacketStreamFormatsResult, fidl::Error>>
1957        + Send;
1958    fn r#get_packet_stream_formats(
1959        &self,
1960        processing_element_id: u64,
1961    ) -> Self::GetPacketStreamFormatsResponseFut;
1962    type CreatePacketStreamResponseFut: std::future::Future<Output = Result<CompositeCreatePacketStreamResult, fidl::Error>>
1963        + Send;
1964    fn r#create_packet_stream(
1965        &self,
1966        processing_element_id: u64,
1967        format: &Format2,
1968        packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
1969    ) -> Self::CreatePacketStreamResponseFut;
1970}
1971
1972#[derive(Debug, Clone)]
1973pub struct CompositeProxy {
1974    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1975}
1976
1977impl fdomain_client::fidl::Proxy for CompositeProxy {
1978    type Protocol = CompositeMarker;
1979
1980    fn from_channel(inner: fdomain_client::Channel) -> Self {
1981        Self::new(inner)
1982    }
1983
1984    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1985        self.client.into_channel().map_err(|client| Self { client })
1986    }
1987
1988    fn as_channel(&self) -> &fdomain_client::Channel {
1989        self.client.as_channel()
1990    }
1991}
1992
1993impl CompositeProxy {
1994    /// Create a new Proxy for fuchsia.hardware.audio/Composite.
1995    pub fn new(channel: fdomain_client::Channel) -> Self {
1996        let protocol_name = <CompositeMarker as fdomain_client::fidl::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) -> CompositeEventStream {
2006        CompositeEventStream { event_receiver: self.client.take_event_receiver() }
2007    }
2008
2009    /// Retrieves top level health state.
2010    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2011    pub fn r#get_health_state(
2012        &self,
2013    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
2014    {
2015        CompositeProxyInterface::r#get_health_state(self)
2016    }
2017
2018    /// Connect to a `SignalProcessing` protocol.
2019    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2020    /// the maximum number of connections have already been created, for instance one, then the
2021    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2022    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2023    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2024    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2025    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2026    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2027    /// is intended to be composed, and hence the more verbose name allows differentiation and
2028    /// improved clarity.
2029    pub fn r#signal_processing_connect(
2030        &self,
2031        mut protocol: fdomain_client::fidl::ServerEnd<
2032            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2033        >,
2034    ) -> Result<(), fidl::Error> {
2035        CompositeProxyInterface::r#signal_processing_connect(self, protocol)
2036    }
2037
2038    /// Resets the hardware including all DAI interconnects and signal processing.
2039    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2040    ///
2041    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2042    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2043    /// any processing elements, and reconstruct any ring buffers.
2044    ///
2045    /// If the driver can't successfully reset the hardware, it will return an error and then close
2046    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2047    pub fn r#reset(
2048        &self,
2049    ) -> fidl::client::QueryResponseFut<
2050        CompositeResetResult,
2051        fdomain_client::fidl::FDomainResourceDialect,
2052    > {
2053        CompositeProxyInterface::r#reset(self)
2054    }
2055
2056    /// Retrieves top level static properties.
2057    pub fn r#get_properties(
2058        &self,
2059    ) -> fidl::client::QueryResponseFut<
2060        CompositeProperties,
2061        fdomain_client::fidl::FDomainResourceDialect,
2062    > {
2063        CompositeProxyInterface::r#get_properties(self)
2064    }
2065
2066    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2067    /// in the topology supported by this driver as returned by `GetElements` from
2068    /// fuchsia.hardware.audio.signalprocessing.
2069    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2070    /// client may retry at a later time.
2071    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2072    /// by `GetElements`.
2073    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2074    /// `RING_BUFFER`.
2075    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2076    /// the parameters in `SupportedFormats2` may be supported.
2077    /// The vector returned to the caller must contain at least one entry.
2078    pub fn r#get_ring_buffer_formats(
2079        &self,
2080        mut processing_element_id: u64,
2081    ) -> fidl::client::QueryResponseFut<
2082        CompositeGetRingBufferFormatsResult,
2083        fdomain_client::fidl::FDomainResourceDialect,
2084    > {
2085        CompositeProxyInterface::r#get_ring_buffer_formats(self, processing_element_id)
2086    }
2087
2088    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2089    /// processing element specified by `processing_element_id`. The format is based on information
2090    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2091    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2092    /// audio buffer provided by the driver.
2093    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2094    /// by `GetElements`.
2095    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2096    /// `RING_BUFFER`.
2097    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2098    /// `format` is not supported.
2099    pub fn r#create_ring_buffer(
2100        &self,
2101        mut processing_element_id: u64,
2102        mut format: &Format2,
2103        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
2104    ) -> fidl::client::QueryResponseFut<
2105        CompositeCreateRingBufferResult,
2106        fdomain_client::fidl::FDomainResourceDialect,
2107    > {
2108        CompositeProxyInterface::r#create_ring_buffer(
2109            self,
2110            processing_element_id,
2111            format,
2112            ring_buffer,
2113        )
2114    }
2115
2116    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2117    /// in the topology supported by this driver as returned by `GetElements` from
2118    /// fuchsia.hardware.audio.signalprocessing.
2119    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2120    /// may retry at a later time.
2121    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2122    /// by `GetElements`.
2123    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2124    /// `DAI_INTERCONNECT`.
2125    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2126    /// the parameters in DaiSupportedFormats may be supported.
2127    /// The vector returned to the caller must contain at least one entry.
2128    pub fn r#get_dai_formats(
2129        &self,
2130        mut processing_element_id: u64,
2131    ) -> fidl::client::QueryResponseFut<
2132        CompositeGetDaiFormatsResult,
2133        fdomain_client::fidl::FDomainResourceDialect,
2134    > {
2135        CompositeProxyInterface::r#get_dai_formats(self, processing_element_id)
2136    }
2137
2138    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2139    /// processing element specified by `processing_element_id`. The format is based on information
2140    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2141    /// requirement.
2142    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2143    /// by `GetElements`.
2144    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2145    /// `DAI_INTERCONNECT`.
2146    pub fn r#set_dai_format(
2147        &self,
2148        mut processing_element_id: u64,
2149        mut format: &DaiFormat,
2150    ) -> fidl::client::QueryResponseFut<
2151        CompositeSetDaiFormatResult,
2152        fdomain_client::fidl::FDomainResourceDialect,
2153    > {
2154        CompositeProxyInterface::r#set_dai_format(self, processing_element_id, format)
2155    }
2156
2157    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2158    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2159    /// from fuchsia.hardware.audio.signalprocessing.
2160    ///
2161    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2162    /// client may retry this request at a later time.
2163    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2164    /// `GetElements`.
2165    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2166    /// `PACKET_STREAM`.
2167    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2168    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2169    /// combinations of the parameters in `SupportedFormats2` may be supported.
2170    /// The vector returned to the caller must contain at least one entry.
2171    pub fn r#get_packet_stream_formats(
2172        &self,
2173        mut processing_element_id: u64,
2174    ) -> fidl::client::QueryResponseFut<
2175        CompositeGetPacketStreamFormatsResult,
2176        fdomain_client::fidl::FDomainResourceDialect,
2177    > {
2178        CompositeProxyInterface::r#get_packet_stream_formats(self, processing_element_id)
2179    }
2180
2181    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2182    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
2183    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
2184    /// the client, and any other requirement. The returned `packet_stream` channel is used to
2185    /// access and control the packet stream protocol served by the driver.
2186    ///
2187    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2188    /// `GetElements`.
2189    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2190    /// `PACKET_STREAM`.
2191    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2192    /// at this time, but it should be able to at some future time. This request can be retried.
2193    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2194    ///`format` is not supported.
2195    pub fn r#create_packet_stream(
2196        &self,
2197        mut processing_element_id: u64,
2198        mut format: &Format2,
2199        mut packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
2200    ) -> fidl::client::QueryResponseFut<
2201        CompositeCreatePacketStreamResult,
2202        fdomain_client::fidl::FDomainResourceDialect,
2203    > {
2204        CompositeProxyInterface::r#create_packet_stream(
2205            self,
2206            processing_element_id,
2207            format,
2208            packet_stream_control,
2209        )
2210    }
2211}
2212
2213impl CompositeProxyInterface for CompositeProxy {
2214    type GetHealthStateResponseFut =
2215        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
2216    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
2217        fn _decode(
2218            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2219        ) -> Result<HealthState, fidl::Error> {
2220            let _response = fidl::client::decode_transaction_body::<
2221                HealthGetHealthStateResponse,
2222                fdomain_client::fidl::FDomainResourceDialect,
2223                0x4e146d6bca733a84,
2224            >(_buf?)?;
2225            Ok(_response.state)
2226        }
2227        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
2228            (),
2229            0x4e146d6bca733a84,
2230            fidl::encoding::DynamicFlags::empty(),
2231            _decode,
2232        )
2233    }
2234
2235    fn r#signal_processing_connect(
2236        &self,
2237        mut protocol: fdomain_client::fidl::ServerEnd<
2238            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2239        >,
2240    ) -> Result<(), fidl::Error> {
2241        self.client.send::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2242            (protocol,),
2243            0xa81907ce6066295,
2244            fidl::encoding::DynamicFlags::empty(),
2245        )
2246    }
2247
2248    type ResetResponseFut = fidl::client::QueryResponseFut<
2249        CompositeResetResult,
2250        fdomain_client::fidl::FDomainResourceDialect,
2251    >;
2252    fn r#reset(&self) -> Self::ResetResponseFut {
2253        fn _decode(
2254            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2255        ) -> Result<CompositeResetResult, fidl::Error> {
2256            let _response = fidl::client::decode_transaction_body::<
2257                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2258                fdomain_client::fidl::FDomainResourceDialect,
2259                0xac355fb98341996,
2260            >(_buf?)?
2261            .into_result_fdomain::<CompositeMarker>("reset")?;
2262            Ok(_response.map(|x| x))
2263        }
2264        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeResetResult>(
2265            (),
2266            0xac355fb98341996,
2267            fidl::encoding::DynamicFlags::FLEXIBLE,
2268            _decode,
2269        )
2270    }
2271
2272    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2273        CompositeProperties,
2274        fdomain_client::fidl::FDomainResourceDialect,
2275    >;
2276    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2277        fn _decode(
2278            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2279        ) -> Result<CompositeProperties, fidl::Error> {
2280            let _response = fidl::client::decode_transaction_body::<
2281                fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>,
2282                fdomain_client::fidl::FDomainResourceDialect,
2283                0x31846fa0a459942b,
2284            >(_buf?)?
2285            .into_result_fdomain::<CompositeMarker>("get_properties")?;
2286            Ok(_response.properties)
2287        }
2288        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeProperties>(
2289            (),
2290            0x31846fa0a459942b,
2291            fidl::encoding::DynamicFlags::FLEXIBLE,
2292            _decode,
2293        )
2294    }
2295
2296    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
2297        CompositeGetRingBufferFormatsResult,
2298        fdomain_client::fidl::FDomainResourceDialect,
2299    >;
2300    fn r#get_ring_buffer_formats(
2301        &self,
2302        mut processing_element_id: u64,
2303    ) -> Self::GetRingBufferFormatsResponseFut {
2304        fn _decode(
2305            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2306        ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2307            let _response = fidl::client::decode_transaction_body::<
2308                fidl::encoding::FlexibleResultType<
2309                    CompositeGetRingBufferFormatsResponse,
2310                    DriverError,
2311                >,
2312                fdomain_client::fidl::FDomainResourceDialect,
2313                0x1d89b701b6816ac4,
2314            >(_buf?)?
2315            .into_result_fdomain::<CompositeMarker>("get_ring_buffer_formats")?;
2316            Ok(_response.map(|x| x.ring_buffer_formats))
2317        }
2318        self.client.send_query_and_decode::<
2319            CompositeGetRingBufferFormatsRequest,
2320            CompositeGetRingBufferFormatsResult,
2321        >(
2322            (processing_element_id,),
2323            0x1d89b701b6816ac4,
2324            fidl::encoding::DynamicFlags::FLEXIBLE,
2325            _decode,
2326        )
2327    }
2328
2329    type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
2330        CompositeCreateRingBufferResult,
2331        fdomain_client::fidl::FDomainResourceDialect,
2332    >;
2333    fn r#create_ring_buffer(
2334        &self,
2335        mut processing_element_id: u64,
2336        mut format: &Format2,
2337        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
2338    ) -> Self::CreateRingBufferResponseFut {
2339        fn _decode(
2340            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2341        ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2342            let _response = fidl::client::decode_transaction_body::<
2343                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2344                fdomain_client::fidl::FDomainResourceDialect,
2345                0x28c5685f85262033,
2346            >(_buf?)?
2347            .into_result_fdomain::<CompositeMarker>("create_ring_buffer")?;
2348            Ok(_response.map(|x| x))
2349        }
2350        self.client.send_query_and_decode::<
2351            CompositeCreateRingBufferRequest,
2352            CompositeCreateRingBufferResult,
2353        >(
2354            (processing_element_id, format, ring_buffer,),
2355            0x28c5685f85262033,
2356            fidl::encoding::DynamicFlags::FLEXIBLE,
2357            _decode,
2358        )
2359    }
2360
2361    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
2362        CompositeGetDaiFormatsResult,
2363        fdomain_client::fidl::FDomainResourceDialect,
2364    >;
2365    fn r#get_dai_formats(&self, mut processing_element_id: u64) -> Self::GetDaiFormatsResponseFut {
2366        fn _decode(
2367            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2368        ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2369            let _response = fidl::client::decode_transaction_body::<
2370                fidl::encoding::FlexibleResultType<CompositeGetDaiFormatsResponse, DriverError>,
2371                fdomain_client::fidl::FDomainResourceDialect,
2372                0x3cbeaed59c8f69b,
2373            >(_buf?)?
2374            .into_result_fdomain::<CompositeMarker>("get_dai_formats")?;
2375            Ok(_response.map(|x| x.dai_formats))
2376        }
2377        self.client
2378            .send_query_and_decode::<CompositeGetDaiFormatsRequest, CompositeGetDaiFormatsResult>(
2379                (processing_element_id,),
2380                0x3cbeaed59c8f69b,
2381                fidl::encoding::DynamicFlags::FLEXIBLE,
2382                _decode,
2383            )
2384    }
2385
2386    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
2387        CompositeSetDaiFormatResult,
2388        fdomain_client::fidl::FDomainResourceDialect,
2389    >;
2390    fn r#set_dai_format(
2391        &self,
2392        mut processing_element_id: u64,
2393        mut format: &DaiFormat,
2394    ) -> Self::SetDaiFormatResponseFut {
2395        fn _decode(
2396            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2397        ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2398            let _response = fidl::client::decode_transaction_body::<
2399                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2400                fdomain_client::fidl::FDomainResourceDialect,
2401                0x155acf5cc0dc8a84,
2402            >(_buf?)?
2403            .into_result_fdomain::<CompositeMarker>("set_dai_format")?;
2404            Ok(_response.map(|x| x))
2405        }
2406        self.client
2407            .send_query_and_decode::<CompositeSetDaiFormatRequest, CompositeSetDaiFormatResult>(
2408                (processing_element_id, format),
2409                0x155acf5cc0dc8a84,
2410                fidl::encoding::DynamicFlags::FLEXIBLE,
2411                _decode,
2412            )
2413    }
2414
2415    type GetPacketStreamFormatsResponseFut = fidl::client::QueryResponseFut<
2416        CompositeGetPacketStreamFormatsResult,
2417        fdomain_client::fidl::FDomainResourceDialect,
2418    >;
2419    fn r#get_packet_stream_formats(
2420        &self,
2421        mut processing_element_id: u64,
2422    ) -> Self::GetPacketStreamFormatsResponseFut {
2423        fn _decode(
2424            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2425        ) -> Result<CompositeGetPacketStreamFormatsResult, fidl::Error> {
2426            let _response = fidl::client::decode_transaction_body::<
2427                fidl::encoding::FlexibleResultType<
2428                    CompositeGetPacketStreamFormatsResponse,
2429                    DriverError,
2430                >,
2431                fdomain_client::fidl::FDomainResourceDialect,
2432                0x73cc47c6ad39bca7,
2433            >(_buf?)?
2434            .into_result_fdomain::<CompositeMarker>("get_packet_stream_formats")?;
2435            Ok(_response.map(|x| x.packet_stream_formats))
2436        }
2437        self.client.send_query_and_decode::<
2438            CompositeGetPacketStreamFormatsRequest,
2439            CompositeGetPacketStreamFormatsResult,
2440        >(
2441            (processing_element_id,),
2442            0x73cc47c6ad39bca7,
2443            fidl::encoding::DynamicFlags::FLEXIBLE,
2444            _decode,
2445        )
2446    }
2447
2448    type CreatePacketStreamResponseFut = fidl::client::QueryResponseFut<
2449        CompositeCreatePacketStreamResult,
2450        fdomain_client::fidl::FDomainResourceDialect,
2451    >;
2452    fn r#create_packet_stream(
2453        &self,
2454        mut processing_element_id: u64,
2455        mut format: &Format2,
2456        mut packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
2457    ) -> Self::CreatePacketStreamResponseFut {
2458        fn _decode(
2459            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2460        ) -> Result<CompositeCreatePacketStreamResult, fidl::Error> {
2461            let _response = fidl::client::decode_transaction_body::<
2462                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2463                fdomain_client::fidl::FDomainResourceDialect,
2464                0x50e8902b756c707c,
2465            >(_buf?)?
2466            .into_result_fdomain::<CompositeMarker>("create_packet_stream")?;
2467            Ok(_response.map(|x| x))
2468        }
2469        self.client.send_query_and_decode::<
2470            CompositeCreatePacketStreamRequest,
2471            CompositeCreatePacketStreamResult,
2472        >(
2473            (processing_element_id, format, packet_stream_control,),
2474            0x50e8902b756c707c,
2475            fidl::encoding::DynamicFlags::FLEXIBLE,
2476            _decode,
2477        )
2478    }
2479}
2480
2481pub struct CompositeEventStream {
2482    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2483}
2484
2485impl std::marker::Unpin for CompositeEventStream {}
2486
2487impl futures::stream::FusedStream for CompositeEventStream {
2488    fn is_terminated(&self) -> bool {
2489        self.event_receiver.is_terminated()
2490    }
2491}
2492
2493impl futures::Stream for CompositeEventStream {
2494    type Item = Result<CompositeEvent, fidl::Error>;
2495
2496    fn poll_next(
2497        mut self: std::pin::Pin<&mut Self>,
2498        cx: &mut std::task::Context<'_>,
2499    ) -> std::task::Poll<Option<Self::Item>> {
2500        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2501            &mut self.event_receiver,
2502            cx
2503        )?) {
2504            Some(buf) => std::task::Poll::Ready(Some(CompositeEvent::decode(buf))),
2505            None => std::task::Poll::Ready(None),
2506        }
2507    }
2508}
2509
2510#[derive(Debug)]
2511pub enum CompositeEvent {
2512    #[non_exhaustive]
2513    _UnknownEvent {
2514        /// Ordinal of the event that was sent.
2515        ordinal: u64,
2516    },
2517}
2518
2519impl CompositeEvent {
2520    /// Decodes a message buffer as a [`CompositeEvent`].
2521    fn decode(
2522        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2523    ) -> Result<CompositeEvent, fidl::Error> {
2524        let (bytes, _handles) = buf.split_mut();
2525        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2526        debug_assert_eq!(tx_header.tx_id, 0);
2527        match tx_header.ordinal {
2528            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2529                Ok(CompositeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2530            }
2531            _ => Err(fidl::Error::UnknownOrdinal {
2532                ordinal: tx_header.ordinal,
2533                protocol_name:
2534                    <CompositeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2535            }),
2536        }
2537    }
2538}
2539
2540/// A Stream of incoming requests for fuchsia.hardware.audio/Composite.
2541pub struct CompositeRequestStream {
2542    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2543    is_terminated: bool,
2544}
2545
2546impl std::marker::Unpin for CompositeRequestStream {}
2547
2548impl futures::stream::FusedStream for CompositeRequestStream {
2549    fn is_terminated(&self) -> bool {
2550        self.is_terminated
2551    }
2552}
2553
2554impl fdomain_client::fidl::RequestStream for CompositeRequestStream {
2555    type Protocol = CompositeMarker;
2556    type ControlHandle = CompositeControlHandle;
2557
2558    fn from_channel(channel: fdomain_client::Channel) -> Self {
2559        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2560    }
2561
2562    fn control_handle(&self) -> Self::ControlHandle {
2563        CompositeControlHandle { inner: self.inner.clone() }
2564    }
2565
2566    fn into_inner(
2567        self,
2568    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2569    {
2570        (self.inner, self.is_terminated)
2571    }
2572
2573    fn from_inner(
2574        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2575        is_terminated: bool,
2576    ) -> Self {
2577        Self { inner, is_terminated }
2578    }
2579}
2580
2581impl futures::Stream for CompositeRequestStream {
2582    type Item = Result<CompositeRequest, fidl::Error>;
2583
2584    fn poll_next(
2585        mut self: std::pin::Pin<&mut Self>,
2586        cx: &mut std::task::Context<'_>,
2587    ) -> std::task::Poll<Option<Self::Item>> {
2588        let this = &mut *self;
2589        if this.inner.check_shutdown(cx) {
2590            this.is_terminated = true;
2591            return std::task::Poll::Ready(None);
2592        }
2593        if this.is_terminated {
2594            panic!("polled CompositeRequestStream after completion");
2595        }
2596        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2597            |bytes, handles| {
2598                match this.inner.channel().read_etc(cx, bytes, handles) {
2599                    std::task::Poll::Ready(Ok(())) => {}
2600                    std::task::Poll::Pending => return std::task::Poll::Pending,
2601                    std::task::Poll::Ready(Err(None)) => {
2602                        this.is_terminated = true;
2603                        return std::task::Poll::Ready(None);
2604                    }
2605                    std::task::Poll::Ready(Err(Some(e))) => {
2606                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2607                            e.into(),
2608                        ))));
2609                    }
2610                }
2611
2612                // A message has been received from the channel
2613                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2614
2615                std::task::Poll::Ready(Some(match header.ordinal {
2616                    0x4e146d6bca733a84 => {
2617                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2618                        let mut req = fidl::new_empty!(
2619                            fidl::encoding::EmptyPayload,
2620                            fdomain_client::fidl::FDomainResourceDialect
2621                        );
2622                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2623                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2624                        Ok(CompositeRequest::GetHealthState {
2625                            responder: CompositeGetHealthStateResponder {
2626                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2627                                tx_id: header.tx_id,
2628                            },
2629                        })
2630                    }
2631                    0xa81907ce6066295 => {
2632                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2633                        let mut req = fidl::new_empty!(fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
2634                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2635                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2636                        Ok(CompositeRequest::SignalProcessingConnect {
2637                            protocol: req.protocol,
2638
2639                            control_handle,
2640                        })
2641                    }
2642                    0xac355fb98341996 => {
2643                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2644                        let mut req = fidl::new_empty!(
2645                            fidl::encoding::EmptyPayload,
2646                            fdomain_client::fidl::FDomainResourceDialect
2647                        );
2648                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2649                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2650                        Ok(CompositeRequest::Reset {
2651                            responder: CompositeResetResponder {
2652                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2653                                tx_id: header.tx_id,
2654                            },
2655                        })
2656                    }
2657                    0x31846fa0a459942b => {
2658                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2659                        let mut req = fidl::new_empty!(
2660                            fidl::encoding::EmptyPayload,
2661                            fdomain_client::fidl::FDomainResourceDialect
2662                        );
2663                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2664                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2665                        Ok(CompositeRequest::GetProperties {
2666                            responder: CompositeGetPropertiesResponder {
2667                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2668                                tx_id: header.tx_id,
2669                            },
2670                        })
2671                    }
2672                    0x1d89b701b6816ac4 => {
2673                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2674                        let mut req = fidl::new_empty!(
2675                            CompositeGetRingBufferFormatsRequest,
2676                            fdomain_client::fidl::FDomainResourceDialect
2677                        );
2678                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeGetRingBufferFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2679                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2680                        Ok(CompositeRequest::GetRingBufferFormats {
2681                            processing_element_id: req.processing_element_id,
2682
2683                            responder: CompositeGetRingBufferFormatsResponder {
2684                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2685                                tx_id: header.tx_id,
2686                            },
2687                        })
2688                    }
2689                    0x28c5685f85262033 => {
2690                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2691                        let mut req = fidl::new_empty!(
2692                            CompositeCreateRingBufferRequest,
2693                            fdomain_client::fidl::FDomainResourceDialect
2694                        );
2695                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
2696                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2697                        Ok(CompositeRequest::CreateRingBuffer {
2698                            processing_element_id: req.processing_element_id,
2699                            format: req.format,
2700                            ring_buffer: req.ring_buffer,
2701
2702                            responder: CompositeCreateRingBufferResponder {
2703                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2704                                tx_id: header.tx_id,
2705                            },
2706                        })
2707                    }
2708                    0x3cbeaed59c8f69b => {
2709                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2710                        let mut req = fidl::new_empty!(
2711                            CompositeGetDaiFormatsRequest,
2712                            fdomain_client::fidl::FDomainResourceDialect
2713                        );
2714                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeGetDaiFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2715                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2716                        Ok(CompositeRequest::GetDaiFormats {
2717                            processing_element_id: req.processing_element_id,
2718
2719                            responder: CompositeGetDaiFormatsResponder {
2720                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2721                                tx_id: header.tx_id,
2722                            },
2723                        })
2724                    }
2725                    0x155acf5cc0dc8a84 => {
2726                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2727                        let mut req = fidl::new_empty!(
2728                            CompositeSetDaiFormatRequest,
2729                            fdomain_client::fidl::FDomainResourceDialect
2730                        );
2731                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
2732                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2733                        Ok(CompositeRequest::SetDaiFormat {
2734                            processing_element_id: req.processing_element_id,
2735                            format: req.format,
2736
2737                            responder: CompositeSetDaiFormatResponder {
2738                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2739                                tx_id: header.tx_id,
2740                            },
2741                        })
2742                    }
2743                    0x73cc47c6ad39bca7 => {
2744                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2745                        let mut req = fidl::new_empty!(
2746                            CompositeGetPacketStreamFormatsRequest,
2747                            fdomain_client::fidl::FDomainResourceDialect
2748                        );
2749                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeGetPacketStreamFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2750                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2751                        Ok(CompositeRequest::GetPacketStreamFormats {
2752                            processing_element_id: req.processing_element_id,
2753
2754                            responder: CompositeGetPacketStreamFormatsResponder {
2755                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2756                                tx_id: header.tx_id,
2757                            },
2758                        })
2759                    }
2760                    0x50e8902b756c707c => {
2761                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2762                        let mut req = fidl::new_empty!(
2763                            CompositeCreatePacketStreamRequest,
2764                            fdomain_client::fidl::FDomainResourceDialect
2765                        );
2766                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeCreatePacketStreamRequest>(&header, _body_bytes, handles, &mut req)?;
2767                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2768                        Ok(CompositeRequest::CreatePacketStream {
2769                            processing_element_id: req.processing_element_id,
2770                            format: req.format,
2771                            packet_stream_control: req.packet_stream_control,
2772
2773                            responder: CompositeCreatePacketStreamResponder {
2774                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2775                                tx_id: header.tx_id,
2776                            },
2777                        })
2778                    }
2779                    _ if header.tx_id == 0
2780                        && header
2781                            .dynamic_flags()
2782                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2783                    {
2784                        Ok(CompositeRequest::_UnknownMethod {
2785                            ordinal: header.ordinal,
2786                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
2787                            method_type: fidl::MethodType::OneWay,
2788                        })
2789                    }
2790                    _ if header
2791                        .dynamic_flags()
2792                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2793                    {
2794                        this.inner.send_framework_err(
2795                            fidl::encoding::FrameworkErr::UnknownMethod,
2796                            header.tx_id,
2797                            header.ordinal,
2798                            header.dynamic_flags(),
2799                            (bytes, handles),
2800                        )?;
2801                        Ok(CompositeRequest::_UnknownMethod {
2802                            ordinal: header.ordinal,
2803                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
2804                            method_type: fidl::MethodType::TwoWay,
2805                        })
2806                    }
2807                    _ => Err(fidl::Error::UnknownOrdinal {
2808                        ordinal: header.ordinal,
2809                        protocol_name:
2810                            <CompositeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2811                    }),
2812                }))
2813            },
2814        )
2815    }
2816}
2817
2818#[derive(Debug)]
2819pub enum CompositeRequest {
2820    /// Retrieves top level health state.
2821    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2822    GetHealthState { responder: CompositeGetHealthStateResponder },
2823    /// Connect to a `SignalProcessing` protocol.
2824    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2825    /// the maximum number of connections have already been created, for instance one, then the
2826    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2827    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2828    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2829    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2830    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2831    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2832    /// is intended to be composed, and hence the more verbose name allows differentiation and
2833    /// improved clarity.
2834    SignalProcessingConnect {
2835        protocol: fdomain_client::fidl::ServerEnd<
2836            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2837        >,
2838        control_handle: CompositeControlHandle,
2839    },
2840    /// Resets the hardware including all DAI interconnects and signal processing.
2841    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2842    ///
2843    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2844    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2845    /// any processing elements, and reconstruct any ring buffers.
2846    ///
2847    /// If the driver can't successfully reset the hardware, it will return an error and then close
2848    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2849    Reset { responder: CompositeResetResponder },
2850    /// Retrieves top level static properties.
2851    GetProperties { responder: CompositeGetPropertiesResponder },
2852    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2853    /// in the topology supported by this driver as returned by `GetElements` from
2854    /// fuchsia.hardware.audio.signalprocessing.
2855    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2856    /// client may retry at a later time.
2857    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2858    /// by `GetElements`.
2859    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2860    /// `RING_BUFFER`.
2861    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2862    /// the parameters in `SupportedFormats2` may be supported.
2863    /// The vector returned to the caller must contain at least one entry.
2864    GetRingBufferFormats {
2865        processing_element_id: u64,
2866        responder: CompositeGetRingBufferFormatsResponder,
2867    },
2868    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2869    /// processing element specified by `processing_element_id`. The format is based on information
2870    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2871    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2872    /// audio buffer provided by the driver.
2873    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2874    /// by `GetElements`.
2875    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2876    /// `RING_BUFFER`.
2877    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2878    /// `format` is not supported.
2879    CreateRingBuffer {
2880        processing_element_id: u64,
2881        format: Format2,
2882        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
2883        responder: CompositeCreateRingBufferResponder,
2884    },
2885    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2886    /// in the topology supported by this driver as returned by `GetElements` from
2887    /// fuchsia.hardware.audio.signalprocessing.
2888    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2889    /// may retry at a later time.
2890    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2891    /// by `GetElements`.
2892    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2893    /// `DAI_INTERCONNECT`.
2894    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2895    /// the parameters in DaiSupportedFormats may be supported.
2896    /// The vector returned to the caller must contain at least one entry.
2897    GetDaiFormats { processing_element_id: u64, responder: CompositeGetDaiFormatsResponder },
2898    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2899    /// processing element specified by `processing_element_id`. The format is based on information
2900    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2901    /// requirement.
2902    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2903    /// by `GetElements`.
2904    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2905    /// `DAI_INTERCONNECT`.
2906    SetDaiFormat {
2907        processing_element_id: u64,
2908        format: DaiFormat,
2909        responder: CompositeSetDaiFormatResponder,
2910    },
2911    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2912    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2913    /// from fuchsia.hardware.audio.signalprocessing.
2914    ///
2915    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2916    /// client may retry this request at a later time.
2917    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2918    /// `GetElements`.
2919    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2920    /// `PACKET_STREAM`.
2921    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2922    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2923    /// combinations of the parameters in `SupportedFormats2` may be supported.
2924    /// The vector returned to the caller must contain at least one entry.
2925    GetPacketStreamFormats {
2926        processing_element_id: u64,
2927        responder: CompositeGetPacketStreamFormatsResponder,
2928    },
2929    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2930    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is based
2931    /// on information that the driver provides in `GetPacketStreamFormats`, what is supported by
2932    /// the client, and any other requirement. The returned `packet_stream` channel is used to
2933    /// access and control the packet stream protocol served by the driver.
2934    ///
2935    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2936    /// `GetElements`.
2937    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2938    /// `PACKET_STREAM`.
2939    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2940    /// at this time, but it should be able to at some future time. This request can be retried.
2941    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2942    ///`format` is not supported.
2943    CreatePacketStream {
2944        processing_element_id: u64,
2945        format: Format2,
2946        packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
2947        responder: CompositeCreatePacketStreamResponder,
2948    },
2949    /// An interaction was received which does not match any known method.
2950    #[non_exhaustive]
2951    _UnknownMethod {
2952        /// Ordinal of the method that was called.
2953        ordinal: u64,
2954        control_handle: CompositeControlHandle,
2955        method_type: fidl::MethodType,
2956    },
2957}
2958
2959impl CompositeRequest {
2960    #[allow(irrefutable_let_patterns)]
2961    pub fn into_get_health_state(self) -> Option<(CompositeGetHealthStateResponder)> {
2962        if let CompositeRequest::GetHealthState { responder } = self {
2963            Some((responder))
2964        } else {
2965            None
2966        }
2967    }
2968
2969    #[allow(irrefutable_let_patterns)]
2970    pub fn into_signal_processing_connect(
2971        self,
2972    ) -> Option<(
2973        fdomain_client::fidl::ServerEnd<
2974            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2975        >,
2976        CompositeControlHandle,
2977    )> {
2978        if let CompositeRequest::SignalProcessingConnect { protocol, control_handle } = self {
2979            Some((protocol, control_handle))
2980        } else {
2981            None
2982        }
2983    }
2984
2985    #[allow(irrefutable_let_patterns)]
2986    pub fn into_reset(self) -> Option<(CompositeResetResponder)> {
2987        if let CompositeRequest::Reset { responder } = self { Some((responder)) } else { None }
2988    }
2989
2990    #[allow(irrefutable_let_patterns)]
2991    pub fn into_get_properties(self) -> Option<(CompositeGetPropertiesResponder)> {
2992        if let CompositeRequest::GetProperties { responder } = self {
2993            Some((responder))
2994        } else {
2995            None
2996        }
2997    }
2998
2999    #[allow(irrefutable_let_patterns)]
3000    pub fn into_get_ring_buffer_formats(
3001        self,
3002    ) -> Option<(u64, CompositeGetRingBufferFormatsResponder)> {
3003        if let CompositeRequest::GetRingBufferFormats { processing_element_id, responder } = self {
3004            Some((processing_element_id, responder))
3005        } else {
3006            None
3007        }
3008    }
3009
3010    #[allow(irrefutable_let_patterns)]
3011    pub fn into_create_ring_buffer(
3012        self,
3013    ) -> Option<(
3014        u64,
3015        Format2,
3016        fdomain_client::fidl::ServerEnd<RingBufferMarker>,
3017        CompositeCreateRingBufferResponder,
3018    )> {
3019        if let CompositeRequest::CreateRingBuffer {
3020            processing_element_id,
3021            format,
3022            ring_buffer,
3023            responder,
3024        } = self
3025        {
3026            Some((processing_element_id, format, ring_buffer, responder))
3027        } else {
3028            None
3029        }
3030    }
3031
3032    #[allow(irrefutable_let_patterns)]
3033    pub fn into_get_dai_formats(self) -> Option<(u64, CompositeGetDaiFormatsResponder)> {
3034        if let CompositeRequest::GetDaiFormats { processing_element_id, responder } = self {
3035            Some((processing_element_id, responder))
3036        } else {
3037            None
3038        }
3039    }
3040
3041    #[allow(irrefutable_let_patterns)]
3042    pub fn into_set_dai_format(self) -> Option<(u64, DaiFormat, CompositeSetDaiFormatResponder)> {
3043        if let CompositeRequest::SetDaiFormat { processing_element_id, format, responder } = self {
3044            Some((processing_element_id, format, responder))
3045        } else {
3046            None
3047        }
3048    }
3049
3050    #[allow(irrefutable_let_patterns)]
3051    pub fn into_get_packet_stream_formats(
3052        self,
3053    ) -> Option<(u64, CompositeGetPacketStreamFormatsResponder)> {
3054        if let CompositeRequest::GetPacketStreamFormats { processing_element_id, responder } = self
3055        {
3056            Some((processing_element_id, responder))
3057        } else {
3058            None
3059        }
3060    }
3061
3062    #[allow(irrefutable_let_patterns)]
3063    pub fn into_create_packet_stream(
3064        self,
3065    ) -> Option<(
3066        u64,
3067        Format2,
3068        fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
3069        CompositeCreatePacketStreamResponder,
3070    )> {
3071        if let CompositeRequest::CreatePacketStream {
3072            processing_element_id,
3073            format,
3074            packet_stream_control,
3075            responder,
3076        } = self
3077        {
3078            Some((processing_element_id, format, packet_stream_control, responder))
3079        } else {
3080            None
3081        }
3082    }
3083
3084    /// Name of the method defined in FIDL
3085    pub fn method_name(&self) -> &'static str {
3086        match *self {
3087            CompositeRequest::GetHealthState { .. } => "get_health_state",
3088            CompositeRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
3089            CompositeRequest::Reset { .. } => "reset",
3090            CompositeRequest::GetProperties { .. } => "get_properties",
3091            CompositeRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
3092            CompositeRequest::CreateRingBuffer { .. } => "create_ring_buffer",
3093            CompositeRequest::GetDaiFormats { .. } => "get_dai_formats",
3094            CompositeRequest::SetDaiFormat { .. } => "set_dai_format",
3095            CompositeRequest::GetPacketStreamFormats { .. } => "get_packet_stream_formats",
3096            CompositeRequest::CreatePacketStream { .. } => "create_packet_stream",
3097            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3098                "unknown one-way method"
3099            }
3100            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3101                "unknown two-way method"
3102            }
3103        }
3104    }
3105}
3106
3107#[derive(Debug, Clone)]
3108pub struct CompositeControlHandle {
3109    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3110}
3111
3112impl fdomain_client::fidl::ControlHandle for CompositeControlHandle {
3113    fn shutdown(&self) {
3114        self.inner.shutdown()
3115    }
3116
3117    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3118        self.inner.shutdown_with_epitaph(status)
3119    }
3120
3121    fn is_closed(&self) -> bool {
3122        self.inner.channel().is_closed()
3123    }
3124    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
3125        self.inner.channel().on_closed()
3126    }
3127}
3128
3129impl CompositeControlHandle {}
3130
3131#[must_use = "FIDL methods require a response to be sent"]
3132#[derive(Debug)]
3133pub struct CompositeGetHealthStateResponder {
3134    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3135    tx_id: u32,
3136}
3137
3138/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3139/// if the responder is dropped without sending a response, so that the client
3140/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3141impl std::ops::Drop for CompositeGetHealthStateResponder {
3142    fn drop(&mut self) {
3143        self.control_handle.shutdown();
3144        // Safety: drops once, never accessed again
3145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3146    }
3147}
3148
3149impl fdomain_client::fidl::Responder for CompositeGetHealthStateResponder {
3150    type ControlHandle = CompositeControlHandle;
3151
3152    fn control_handle(&self) -> &CompositeControlHandle {
3153        &self.control_handle
3154    }
3155
3156    fn drop_without_shutdown(mut self) {
3157        // Safety: drops once, never accessed again due to mem::forget
3158        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3159        // Prevent Drop from running (which would shut down the channel)
3160        std::mem::forget(self);
3161    }
3162}
3163
3164impl CompositeGetHealthStateResponder {
3165    /// Sends a response to the FIDL transaction.
3166    ///
3167    /// Sets the channel to shutdown if an error occurs.
3168    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3169        let _result = self.send_raw(state);
3170        if _result.is_err() {
3171            self.control_handle.shutdown();
3172        }
3173        self.drop_without_shutdown();
3174        _result
3175    }
3176
3177    /// Similar to "send" but does not shutdown the channel if an error occurs.
3178    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3179        let _result = self.send_raw(state);
3180        self.drop_without_shutdown();
3181        _result
3182    }
3183
3184    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
3185        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
3186            (state,),
3187            self.tx_id,
3188            0x4e146d6bca733a84,
3189            fidl::encoding::DynamicFlags::empty(),
3190        )
3191    }
3192}
3193
3194#[must_use = "FIDL methods require a response to be sent"]
3195#[derive(Debug)]
3196pub struct CompositeResetResponder {
3197    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3198    tx_id: u32,
3199}
3200
3201/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3202/// if the responder is dropped without sending a response, so that the client
3203/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3204impl std::ops::Drop for CompositeResetResponder {
3205    fn drop(&mut self) {
3206        self.control_handle.shutdown();
3207        // Safety: drops once, never accessed again
3208        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3209    }
3210}
3211
3212impl fdomain_client::fidl::Responder for CompositeResetResponder {
3213    type ControlHandle = CompositeControlHandle;
3214
3215    fn control_handle(&self) -> &CompositeControlHandle {
3216        &self.control_handle
3217    }
3218
3219    fn drop_without_shutdown(mut self) {
3220        // Safety: drops once, never accessed again due to mem::forget
3221        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3222        // Prevent Drop from running (which would shut down the channel)
3223        std::mem::forget(self);
3224    }
3225}
3226
3227impl CompositeResetResponder {
3228    /// Sends a response to the FIDL transaction.
3229    ///
3230    /// Sets the channel to shutdown if an error occurs.
3231    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3232        let _result = self.send_raw(result);
3233        if _result.is_err() {
3234            self.control_handle.shutdown();
3235        }
3236        self.drop_without_shutdown();
3237        _result
3238    }
3239
3240    /// Similar to "send" but does not shutdown the channel if an error occurs.
3241    pub fn send_no_shutdown_on_err(
3242        self,
3243        mut result: Result<(), DriverError>,
3244    ) -> Result<(), fidl::Error> {
3245        let _result = self.send_raw(result);
3246        self.drop_without_shutdown();
3247        _result
3248    }
3249
3250    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3251        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3252            fidl::encoding::EmptyStruct,
3253            DriverError,
3254        >>(
3255            fidl::encoding::FlexibleResult::new(result),
3256            self.tx_id,
3257            0xac355fb98341996,
3258            fidl::encoding::DynamicFlags::FLEXIBLE,
3259        )
3260    }
3261}
3262
3263#[must_use = "FIDL methods require a response to be sent"]
3264#[derive(Debug)]
3265pub struct CompositeGetPropertiesResponder {
3266    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3267    tx_id: u32,
3268}
3269
3270/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3271/// if the responder is dropped without sending a response, so that the client
3272/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3273impl std::ops::Drop for CompositeGetPropertiesResponder {
3274    fn drop(&mut self) {
3275        self.control_handle.shutdown();
3276        // Safety: drops once, never accessed again
3277        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3278    }
3279}
3280
3281impl fdomain_client::fidl::Responder for CompositeGetPropertiesResponder {
3282    type ControlHandle = CompositeControlHandle;
3283
3284    fn control_handle(&self) -> &CompositeControlHandle {
3285        &self.control_handle
3286    }
3287
3288    fn drop_without_shutdown(mut self) {
3289        // Safety: drops once, never accessed again due to mem::forget
3290        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3291        // Prevent Drop from running (which would shut down the channel)
3292        std::mem::forget(self);
3293    }
3294}
3295
3296impl CompositeGetPropertiesResponder {
3297    /// Sends a response to the FIDL transaction.
3298    ///
3299    /// Sets the channel to shutdown if an error occurs.
3300    pub fn send(self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3301        let _result = self.send_raw(properties);
3302        if _result.is_err() {
3303            self.control_handle.shutdown();
3304        }
3305        self.drop_without_shutdown();
3306        _result
3307    }
3308
3309    /// Similar to "send" but does not shutdown the channel if an error occurs.
3310    pub fn send_no_shutdown_on_err(
3311        self,
3312        mut properties: &CompositeProperties,
3313    ) -> Result<(), fidl::Error> {
3314        let _result = self.send_raw(properties);
3315        self.drop_without_shutdown();
3316        _result
3317    }
3318
3319    fn send_raw(&self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3320        self.control_handle
3321            .inner
3322            .send::<fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>>(
3323                fidl::encoding::Flexible::new((properties,)),
3324                self.tx_id,
3325                0x31846fa0a459942b,
3326                fidl::encoding::DynamicFlags::FLEXIBLE,
3327            )
3328    }
3329}
3330
3331#[must_use = "FIDL methods require a response to be sent"]
3332#[derive(Debug)]
3333pub struct CompositeGetRingBufferFormatsResponder {
3334    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3335    tx_id: u32,
3336}
3337
3338/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3339/// if the responder is dropped without sending a response, so that the client
3340/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3341impl std::ops::Drop for CompositeGetRingBufferFormatsResponder {
3342    fn drop(&mut self) {
3343        self.control_handle.shutdown();
3344        // Safety: drops once, never accessed again
3345        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3346    }
3347}
3348
3349impl fdomain_client::fidl::Responder for CompositeGetRingBufferFormatsResponder {
3350    type ControlHandle = CompositeControlHandle;
3351
3352    fn control_handle(&self) -> &CompositeControlHandle {
3353        &self.control_handle
3354    }
3355
3356    fn drop_without_shutdown(mut self) {
3357        // Safety: drops once, never accessed again due to mem::forget
3358        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3359        // Prevent Drop from running (which would shut down the channel)
3360        std::mem::forget(self);
3361    }
3362}
3363
3364impl CompositeGetRingBufferFormatsResponder {
3365    /// Sends a response to the FIDL transaction.
3366    ///
3367    /// Sets the channel to shutdown if an error occurs.
3368    pub fn send(
3369        self,
3370        mut result: Result<&[SupportedFormats2], DriverError>,
3371    ) -> Result<(), fidl::Error> {
3372        let _result = self.send_raw(result);
3373        if _result.is_err() {
3374            self.control_handle.shutdown();
3375        }
3376        self.drop_without_shutdown();
3377        _result
3378    }
3379
3380    /// Similar to "send" but does not shutdown the channel if an error occurs.
3381    pub fn send_no_shutdown_on_err(
3382        self,
3383        mut result: Result<&[SupportedFormats2], DriverError>,
3384    ) -> Result<(), fidl::Error> {
3385        let _result = self.send_raw(result);
3386        self.drop_without_shutdown();
3387        _result
3388    }
3389
3390    fn send_raw(
3391        &self,
3392        mut result: Result<&[SupportedFormats2], DriverError>,
3393    ) -> Result<(), fidl::Error> {
3394        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3395            CompositeGetRingBufferFormatsResponse,
3396            DriverError,
3397        >>(
3398            fidl::encoding::FlexibleResult::new(
3399                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
3400            ),
3401            self.tx_id,
3402            0x1d89b701b6816ac4,
3403            fidl::encoding::DynamicFlags::FLEXIBLE,
3404        )
3405    }
3406}
3407
3408#[must_use = "FIDL methods require a response to be sent"]
3409#[derive(Debug)]
3410pub struct CompositeCreateRingBufferResponder {
3411    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3412    tx_id: u32,
3413}
3414
3415/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3416/// if the responder is dropped without sending a response, so that the client
3417/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3418impl std::ops::Drop for CompositeCreateRingBufferResponder {
3419    fn drop(&mut self) {
3420        self.control_handle.shutdown();
3421        // Safety: drops once, never accessed again
3422        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3423    }
3424}
3425
3426impl fdomain_client::fidl::Responder for CompositeCreateRingBufferResponder {
3427    type ControlHandle = CompositeControlHandle;
3428
3429    fn control_handle(&self) -> &CompositeControlHandle {
3430        &self.control_handle
3431    }
3432
3433    fn drop_without_shutdown(mut self) {
3434        // Safety: drops once, never accessed again due to mem::forget
3435        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3436        // Prevent Drop from running (which would shut down the channel)
3437        std::mem::forget(self);
3438    }
3439}
3440
3441impl CompositeCreateRingBufferResponder {
3442    /// Sends a response to the FIDL transaction.
3443    ///
3444    /// Sets the channel to shutdown if an error occurs.
3445    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3446        let _result = self.send_raw(result);
3447        if _result.is_err() {
3448            self.control_handle.shutdown();
3449        }
3450        self.drop_without_shutdown();
3451        _result
3452    }
3453
3454    /// Similar to "send" but does not shutdown the channel if an error occurs.
3455    pub fn send_no_shutdown_on_err(
3456        self,
3457        mut result: Result<(), DriverError>,
3458    ) -> Result<(), fidl::Error> {
3459        let _result = self.send_raw(result);
3460        self.drop_without_shutdown();
3461        _result
3462    }
3463
3464    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3465        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3466            fidl::encoding::EmptyStruct,
3467            DriverError,
3468        >>(
3469            fidl::encoding::FlexibleResult::new(result),
3470            self.tx_id,
3471            0x28c5685f85262033,
3472            fidl::encoding::DynamicFlags::FLEXIBLE,
3473        )
3474    }
3475}
3476
3477#[must_use = "FIDL methods require a response to be sent"]
3478#[derive(Debug)]
3479pub struct CompositeGetDaiFormatsResponder {
3480    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3481    tx_id: u32,
3482}
3483
3484/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3485/// if the responder is dropped without sending a response, so that the client
3486/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3487impl std::ops::Drop for CompositeGetDaiFormatsResponder {
3488    fn drop(&mut self) {
3489        self.control_handle.shutdown();
3490        // Safety: drops once, never accessed again
3491        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3492    }
3493}
3494
3495impl fdomain_client::fidl::Responder for CompositeGetDaiFormatsResponder {
3496    type ControlHandle = CompositeControlHandle;
3497
3498    fn control_handle(&self) -> &CompositeControlHandle {
3499        &self.control_handle
3500    }
3501
3502    fn drop_without_shutdown(mut self) {
3503        // Safety: drops once, never accessed again due to mem::forget
3504        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3505        // Prevent Drop from running (which would shut down the channel)
3506        std::mem::forget(self);
3507    }
3508}
3509
3510impl CompositeGetDaiFormatsResponder {
3511    /// Sends a response to the FIDL transaction.
3512    ///
3513    /// Sets the channel to shutdown if an error occurs.
3514    pub fn send(
3515        self,
3516        mut result: Result<&[DaiSupportedFormats], DriverError>,
3517    ) -> Result<(), fidl::Error> {
3518        let _result = self.send_raw(result);
3519        if _result.is_err() {
3520            self.control_handle.shutdown();
3521        }
3522        self.drop_without_shutdown();
3523        _result
3524    }
3525
3526    /// Similar to "send" but does not shutdown the channel if an error occurs.
3527    pub fn send_no_shutdown_on_err(
3528        self,
3529        mut result: Result<&[DaiSupportedFormats], DriverError>,
3530    ) -> Result<(), fidl::Error> {
3531        let _result = self.send_raw(result);
3532        self.drop_without_shutdown();
3533        _result
3534    }
3535
3536    fn send_raw(
3537        &self,
3538        mut result: Result<&[DaiSupportedFormats], DriverError>,
3539    ) -> Result<(), fidl::Error> {
3540        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3541            CompositeGetDaiFormatsResponse,
3542            DriverError,
3543        >>(
3544            fidl::encoding::FlexibleResult::new(result.map(|dai_formats| (dai_formats,))),
3545            self.tx_id,
3546            0x3cbeaed59c8f69b,
3547            fidl::encoding::DynamicFlags::FLEXIBLE,
3548        )
3549    }
3550}
3551
3552#[must_use = "FIDL methods require a response to be sent"]
3553#[derive(Debug)]
3554pub struct CompositeSetDaiFormatResponder {
3555    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3556    tx_id: u32,
3557}
3558
3559/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3560/// if the responder is dropped without sending a response, so that the client
3561/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3562impl std::ops::Drop for CompositeSetDaiFormatResponder {
3563    fn drop(&mut self) {
3564        self.control_handle.shutdown();
3565        // Safety: drops once, never accessed again
3566        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3567    }
3568}
3569
3570impl fdomain_client::fidl::Responder for CompositeSetDaiFormatResponder {
3571    type ControlHandle = CompositeControlHandle;
3572
3573    fn control_handle(&self) -> &CompositeControlHandle {
3574        &self.control_handle
3575    }
3576
3577    fn drop_without_shutdown(mut self) {
3578        // Safety: drops once, never accessed again due to mem::forget
3579        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3580        // Prevent Drop from running (which would shut down the channel)
3581        std::mem::forget(self);
3582    }
3583}
3584
3585impl CompositeSetDaiFormatResponder {
3586    /// Sends a response to the FIDL transaction.
3587    ///
3588    /// Sets the channel to shutdown if an error occurs.
3589    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3590        let _result = self.send_raw(result);
3591        if _result.is_err() {
3592            self.control_handle.shutdown();
3593        }
3594        self.drop_without_shutdown();
3595        _result
3596    }
3597
3598    /// Similar to "send" but does not shutdown the channel if an error occurs.
3599    pub fn send_no_shutdown_on_err(
3600        self,
3601        mut result: Result<(), DriverError>,
3602    ) -> Result<(), fidl::Error> {
3603        let _result = self.send_raw(result);
3604        self.drop_without_shutdown();
3605        _result
3606    }
3607
3608    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3609        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3610            fidl::encoding::EmptyStruct,
3611            DriverError,
3612        >>(
3613            fidl::encoding::FlexibleResult::new(result),
3614            self.tx_id,
3615            0x155acf5cc0dc8a84,
3616            fidl::encoding::DynamicFlags::FLEXIBLE,
3617        )
3618    }
3619}
3620
3621#[must_use = "FIDL methods require a response to be sent"]
3622#[derive(Debug)]
3623pub struct CompositeGetPacketStreamFormatsResponder {
3624    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3625    tx_id: u32,
3626}
3627
3628/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3629/// if the responder is dropped without sending a response, so that the client
3630/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3631impl std::ops::Drop for CompositeGetPacketStreamFormatsResponder {
3632    fn drop(&mut self) {
3633        self.control_handle.shutdown();
3634        // Safety: drops once, never accessed again
3635        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3636    }
3637}
3638
3639impl fdomain_client::fidl::Responder for CompositeGetPacketStreamFormatsResponder {
3640    type ControlHandle = CompositeControlHandle;
3641
3642    fn control_handle(&self) -> &CompositeControlHandle {
3643        &self.control_handle
3644    }
3645
3646    fn drop_without_shutdown(mut self) {
3647        // Safety: drops once, never accessed again due to mem::forget
3648        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3649        // Prevent Drop from running (which would shut down the channel)
3650        std::mem::forget(self);
3651    }
3652}
3653
3654impl CompositeGetPacketStreamFormatsResponder {
3655    /// Sends a response to the FIDL transaction.
3656    ///
3657    /// Sets the channel to shutdown if an error occurs.
3658    pub fn send(
3659        self,
3660        mut result: Result<&[SupportedFormats2], DriverError>,
3661    ) -> Result<(), fidl::Error> {
3662        let _result = self.send_raw(result);
3663        if _result.is_err() {
3664            self.control_handle.shutdown();
3665        }
3666        self.drop_without_shutdown();
3667        _result
3668    }
3669
3670    /// Similar to "send" but does not shutdown the channel if an error occurs.
3671    pub fn send_no_shutdown_on_err(
3672        self,
3673        mut result: Result<&[SupportedFormats2], DriverError>,
3674    ) -> Result<(), fidl::Error> {
3675        let _result = self.send_raw(result);
3676        self.drop_without_shutdown();
3677        _result
3678    }
3679
3680    fn send_raw(
3681        &self,
3682        mut result: Result<&[SupportedFormats2], DriverError>,
3683    ) -> Result<(), fidl::Error> {
3684        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3685            CompositeGetPacketStreamFormatsResponse,
3686            DriverError,
3687        >>(
3688            fidl::encoding::FlexibleResult::new(
3689                result.map(|packet_stream_formats| (packet_stream_formats,)),
3690            ),
3691            self.tx_id,
3692            0x73cc47c6ad39bca7,
3693            fidl::encoding::DynamicFlags::FLEXIBLE,
3694        )
3695    }
3696}
3697
3698#[must_use = "FIDL methods require a response to be sent"]
3699#[derive(Debug)]
3700pub struct CompositeCreatePacketStreamResponder {
3701    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3702    tx_id: u32,
3703}
3704
3705/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3706/// if the responder is dropped without sending a response, so that the client
3707/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3708impl std::ops::Drop for CompositeCreatePacketStreamResponder {
3709    fn drop(&mut self) {
3710        self.control_handle.shutdown();
3711        // Safety: drops once, never accessed again
3712        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3713    }
3714}
3715
3716impl fdomain_client::fidl::Responder for CompositeCreatePacketStreamResponder {
3717    type ControlHandle = CompositeControlHandle;
3718
3719    fn control_handle(&self) -> &CompositeControlHandle {
3720        &self.control_handle
3721    }
3722
3723    fn drop_without_shutdown(mut self) {
3724        // Safety: drops once, never accessed again due to mem::forget
3725        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3726        // Prevent Drop from running (which would shut down the channel)
3727        std::mem::forget(self);
3728    }
3729}
3730
3731impl CompositeCreatePacketStreamResponder {
3732    /// Sends a response to the FIDL transaction.
3733    ///
3734    /// Sets the channel to shutdown if an error occurs.
3735    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3736        let _result = self.send_raw(result);
3737        if _result.is_err() {
3738            self.control_handle.shutdown();
3739        }
3740        self.drop_without_shutdown();
3741        _result
3742    }
3743
3744    /// Similar to "send" but does not shutdown the channel if an error occurs.
3745    pub fn send_no_shutdown_on_err(
3746        self,
3747        mut result: Result<(), DriverError>,
3748    ) -> Result<(), fidl::Error> {
3749        let _result = self.send_raw(result);
3750        self.drop_without_shutdown();
3751        _result
3752    }
3753
3754    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3755        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3756            fidl::encoding::EmptyStruct,
3757            DriverError,
3758        >>(
3759            fidl::encoding::FlexibleResult::new(result),
3760            self.tx_id,
3761            0x50e8902b756c707c,
3762            fidl::encoding::DynamicFlags::FLEXIBLE,
3763        )
3764    }
3765}
3766
3767#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3768pub struct CompositeConnectorMarker;
3769
3770impl fdomain_client::fidl::ProtocolMarker for CompositeConnectorMarker {
3771    type Proxy = CompositeConnectorProxy;
3772    type RequestStream = CompositeConnectorRequestStream;
3773
3774    const DEBUG_NAME: &'static str = "(anonymous) CompositeConnector";
3775}
3776
3777pub trait CompositeConnectorProxyInterface: Send + Sync {
3778    fn r#connect(
3779        &self,
3780        composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
3781    ) -> Result<(), fidl::Error>;
3782}
3783
3784#[derive(Debug, Clone)]
3785pub struct CompositeConnectorProxy {
3786    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
3787}
3788
3789impl fdomain_client::fidl::Proxy for CompositeConnectorProxy {
3790    type Protocol = CompositeConnectorMarker;
3791
3792    fn from_channel(inner: fdomain_client::Channel) -> Self {
3793        Self::new(inner)
3794    }
3795
3796    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
3797        self.client.into_channel().map_err(|client| Self { client })
3798    }
3799
3800    fn as_channel(&self) -> &fdomain_client::Channel {
3801        self.client.as_channel()
3802    }
3803}
3804
3805impl CompositeConnectorProxy {
3806    /// Create a new Proxy for fuchsia.hardware.audio/CompositeConnector.
3807    pub fn new(channel: fdomain_client::Channel) -> Self {
3808        let protocol_name =
3809            <CompositeConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
3810        Self { client: fidl::client::Client::new(channel, protocol_name) }
3811    }
3812
3813    /// Get a Stream of events from the remote end of the protocol.
3814    ///
3815    /// # Panics
3816    ///
3817    /// Panics if the event stream was already taken.
3818    pub fn take_event_stream(&self) -> CompositeConnectorEventStream {
3819        CompositeConnectorEventStream { event_receiver: self.client.take_event_receiver() }
3820    }
3821
3822    /// Connect to a `Device` protocol.
3823    /// This method allows a component to serve FIDL outside the devhost's control.
3824    pub fn r#connect(
3825        &self,
3826        mut composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
3827    ) -> Result<(), fidl::Error> {
3828        CompositeConnectorProxyInterface::r#connect(self, composite_protocol)
3829    }
3830}
3831
3832impl CompositeConnectorProxyInterface for CompositeConnectorProxy {
3833    fn r#connect(
3834        &self,
3835        mut composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
3836    ) -> Result<(), fidl::Error> {
3837        self.client.send::<CompositeConnectorConnectRequest>(
3838            (composite_protocol,),
3839            0x7ee557529079e466,
3840            fidl::encoding::DynamicFlags::empty(),
3841        )
3842    }
3843}
3844
3845pub struct CompositeConnectorEventStream {
3846    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
3847}
3848
3849impl std::marker::Unpin for CompositeConnectorEventStream {}
3850
3851impl futures::stream::FusedStream for CompositeConnectorEventStream {
3852    fn is_terminated(&self) -> bool {
3853        self.event_receiver.is_terminated()
3854    }
3855}
3856
3857impl futures::Stream for CompositeConnectorEventStream {
3858    type Item = Result<CompositeConnectorEvent, fidl::Error>;
3859
3860    fn poll_next(
3861        mut self: std::pin::Pin<&mut Self>,
3862        cx: &mut std::task::Context<'_>,
3863    ) -> std::task::Poll<Option<Self::Item>> {
3864        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3865            &mut self.event_receiver,
3866            cx
3867        )?) {
3868            Some(buf) => std::task::Poll::Ready(Some(CompositeConnectorEvent::decode(buf))),
3869            None => std::task::Poll::Ready(None),
3870        }
3871    }
3872}
3873
3874#[derive(Debug)]
3875pub enum CompositeConnectorEvent {}
3876
3877impl CompositeConnectorEvent {
3878    /// Decodes a message buffer as a [`CompositeConnectorEvent`].
3879    fn decode(
3880        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3881    ) -> Result<CompositeConnectorEvent, fidl::Error> {
3882        let (bytes, _handles) = buf.split_mut();
3883        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3884        debug_assert_eq!(tx_header.tx_id, 0);
3885        match tx_header.ordinal {
3886            _ => Err(fidl::Error::UnknownOrdinal {
3887                ordinal: tx_header.ordinal,
3888                protocol_name:
3889                    <CompositeConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3890            }),
3891        }
3892    }
3893}
3894
3895/// A Stream of incoming requests for fuchsia.hardware.audio/CompositeConnector.
3896pub struct CompositeConnectorRequestStream {
3897    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3898    is_terminated: bool,
3899}
3900
3901impl std::marker::Unpin for CompositeConnectorRequestStream {}
3902
3903impl futures::stream::FusedStream for CompositeConnectorRequestStream {
3904    fn is_terminated(&self) -> bool {
3905        self.is_terminated
3906    }
3907}
3908
3909impl fdomain_client::fidl::RequestStream for CompositeConnectorRequestStream {
3910    type Protocol = CompositeConnectorMarker;
3911    type ControlHandle = CompositeConnectorControlHandle;
3912
3913    fn from_channel(channel: fdomain_client::Channel) -> Self {
3914        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3915    }
3916
3917    fn control_handle(&self) -> Self::ControlHandle {
3918        CompositeConnectorControlHandle { inner: self.inner.clone() }
3919    }
3920
3921    fn into_inner(
3922        self,
3923    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
3924    {
3925        (self.inner, self.is_terminated)
3926    }
3927
3928    fn from_inner(
3929        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3930        is_terminated: bool,
3931    ) -> Self {
3932        Self { inner, is_terminated }
3933    }
3934}
3935
3936impl futures::Stream for CompositeConnectorRequestStream {
3937    type Item = Result<CompositeConnectorRequest, fidl::Error>;
3938
3939    fn poll_next(
3940        mut self: std::pin::Pin<&mut Self>,
3941        cx: &mut std::task::Context<'_>,
3942    ) -> std::task::Poll<Option<Self::Item>> {
3943        let this = &mut *self;
3944        if this.inner.check_shutdown(cx) {
3945            this.is_terminated = true;
3946            return std::task::Poll::Ready(None);
3947        }
3948        if this.is_terminated {
3949            panic!("polled CompositeConnectorRequestStream after completion");
3950        }
3951        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
3952            |bytes, handles| {
3953                match this.inner.channel().read_etc(cx, bytes, handles) {
3954                    std::task::Poll::Ready(Ok(())) => {}
3955                    std::task::Poll::Pending => return std::task::Poll::Pending,
3956                    std::task::Poll::Ready(Err(None)) => {
3957                        this.is_terminated = true;
3958                        return std::task::Poll::Ready(None);
3959                    }
3960                    std::task::Poll::Ready(Err(Some(e))) => {
3961                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3962                            e.into(),
3963                        ))));
3964                    }
3965                }
3966
3967                // A message has been received from the channel
3968                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3969
3970                std::task::Poll::Ready(Some(match header.ordinal {
3971                0x7ee557529079e466 => {
3972                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3973                    let mut req = fidl::new_empty!(CompositeConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
3974                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3975                    let control_handle = CompositeConnectorControlHandle {
3976                        inner: this.inner.clone(),
3977                    };
3978                    Ok(CompositeConnectorRequest::Connect {composite_protocol: req.composite_protocol,
3979
3980                        control_handle,
3981                    })
3982                }
3983                _ => Err(fidl::Error::UnknownOrdinal {
3984                    ordinal: header.ordinal,
3985                    protocol_name: <CompositeConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3986                }),
3987            }))
3988            },
3989        )
3990    }
3991}
3992
3993/// For an overview see
3994/// [Audio Composite Devices](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md).
3995#[derive(Debug)]
3996pub enum CompositeConnectorRequest {
3997    /// Connect to a `Device` protocol.
3998    /// This method allows a component to serve FIDL outside the devhost's control.
3999    Connect {
4000        composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
4001        control_handle: CompositeConnectorControlHandle,
4002    },
4003}
4004
4005impl CompositeConnectorRequest {
4006    #[allow(irrefutable_let_patterns)]
4007    pub fn into_connect(
4008        self,
4009    ) -> Option<(fdomain_client::fidl::ServerEnd<CompositeMarker>, CompositeConnectorControlHandle)>
4010    {
4011        if let CompositeConnectorRequest::Connect { composite_protocol, control_handle } = self {
4012            Some((composite_protocol, control_handle))
4013        } else {
4014            None
4015        }
4016    }
4017
4018    /// Name of the method defined in FIDL
4019    pub fn method_name(&self) -> &'static str {
4020        match *self {
4021            CompositeConnectorRequest::Connect { .. } => "connect",
4022        }
4023    }
4024}
4025
4026#[derive(Debug, Clone)]
4027pub struct CompositeConnectorControlHandle {
4028    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4029}
4030
4031impl fdomain_client::fidl::ControlHandle for CompositeConnectorControlHandle {
4032    fn shutdown(&self) {
4033        self.inner.shutdown()
4034    }
4035
4036    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4037        self.inner.shutdown_with_epitaph(status)
4038    }
4039
4040    fn is_closed(&self) -> bool {
4041        self.inner.channel().is_closed()
4042    }
4043    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
4044        self.inner.channel().on_closed()
4045    }
4046}
4047
4048impl CompositeConnectorControlHandle {}
4049
4050#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4051pub struct DaiMarker;
4052
4053impl fdomain_client::fidl::ProtocolMarker for DaiMarker {
4054    type Proxy = DaiProxy;
4055    type RequestStream = DaiRequestStream;
4056
4057    const DEBUG_NAME: &'static str = "(anonymous) Dai";
4058}
4059pub type DaiGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
4060pub type DaiGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, i32>;
4061
4062pub trait DaiProxyInterface: Send + Sync {
4063    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
4064        + Send;
4065    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
4066    fn r#signal_processing_connect(
4067        &self,
4068        protocol: fdomain_client::fidl::ServerEnd<
4069            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4070        >,
4071    ) -> Result<(), fidl::Error>;
4072    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4073    fn r#reset(&self) -> Self::ResetResponseFut;
4074    type GetPropertiesResponseFut: std::future::Future<Output = Result<DaiProperties, fidl::Error>>
4075        + Send;
4076    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
4077    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<DaiGetDaiFormatsResult, fidl::Error>>
4078        + Send;
4079    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
4080    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<DaiGetRingBufferFormatsResult, fidl::Error>>
4081        + Send;
4082    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut;
4083    fn r#create_ring_buffer(
4084        &self,
4085        dai_format: &DaiFormat,
4086        ring_buffer_format: &Format,
4087        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4088    ) -> Result<(), fidl::Error>;
4089}
4090
4091#[derive(Debug, Clone)]
4092pub struct DaiProxy {
4093    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
4094}
4095
4096impl fdomain_client::fidl::Proxy for DaiProxy {
4097    type Protocol = DaiMarker;
4098
4099    fn from_channel(inner: fdomain_client::Channel) -> Self {
4100        Self::new(inner)
4101    }
4102
4103    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
4104        self.client.into_channel().map_err(|client| Self { client })
4105    }
4106
4107    fn as_channel(&self) -> &fdomain_client::Channel {
4108        self.client.as_channel()
4109    }
4110}
4111
4112impl DaiProxy {
4113    /// Create a new Proxy for fuchsia.hardware.audio/Dai.
4114    pub fn new(channel: fdomain_client::Channel) -> Self {
4115        let protocol_name = <DaiMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
4116        Self { client: fidl::client::Client::new(channel, protocol_name) }
4117    }
4118
4119    /// Get a Stream of events from the remote end of the protocol.
4120    ///
4121    /// # Panics
4122    ///
4123    /// Panics if the event stream was already taken.
4124    pub fn take_event_stream(&self) -> DaiEventStream {
4125        DaiEventStream { event_receiver: self.client.take_event_receiver() }
4126    }
4127
4128    /// Retrieves top level health state.
4129    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4130    pub fn r#get_health_state(
4131        &self,
4132    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
4133    {
4134        DaiProxyInterface::r#get_health_state(self)
4135    }
4136
4137    /// Connect to a `SignalProcessing` protocol.
4138    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4139    /// the maximum number of connections have already been created, for instance one, then the
4140    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4141    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4142    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4143    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4144    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4145    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4146    /// is intended to be composed, and hence the more verbose name allows differentiation and
4147    /// improved clarity.
4148    pub fn r#signal_processing_connect(
4149        &self,
4150        mut protocol: fdomain_client::fidl::ServerEnd<
4151            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4152        >,
4153    ) -> Result<(), fidl::Error> {
4154        DaiProxyInterface::r#signal_processing_connect(self, protocol)
4155    }
4156
4157    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4158    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4159    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4160    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4161    /// protocol channel and retry.
4162    pub fn r#reset(
4163        &self,
4164    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
4165        DaiProxyInterface::r#reset(self)
4166    }
4167
4168    /// Retrieves top level static properties.
4169    pub fn r#get_properties(
4170        &self,
4171    ) -> fidl::client::QueryResponseFut<DaiProperties, fdomain_client::fidl::FDomainResourceDialect>
4172    {
4173        DaiProxyInterface::r#get_properties(self)
4174    }
4175
4176    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4177    /// may reply with an error status and the client may retry at a later time.
4178    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4179    /// the parameters in SupportedFormats may be supported.
4180    pub fn r#get_dai_formats(
4181        &self,
4182    ) -> fidl::client::QueryResponseFut<
4183        DaiGetDaiFormatsResult,
4184        fdomain_client::fidl::FDomainResourceDialect,
4185    > {
4186        DaiProxyInterface::r#get_dai_formats(self)
4187    }
4188
4189    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4190    /// may reply with an error status and the client may retry at a later time.
4191    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4192    /// the parameters in `SupportedFormats` may be supported.
4193    pub fn r#get_ring_buffer_formats(
4194        &self,
4195    ) -> fidl::client::QueryResponseFut<
4196        DaiGetRingBufferFormatsResult,
4197        fdomain_client::fidl::FDomainResourceDialect,
4198    > {
4199        DaiProxyInterface::r#get_ring_buffer_formats(self)
4200    }
4201
4202    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4203    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4204    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4205    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4206    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4207    /// gracefully quiesce any on-going streaming operations in the process.
4208    pub fn r#create_ring_buffer(
4209        &self,
4210        mut dai_format: &DaiFormat,
4211        mut ring_buffer_format: &Format,
4212        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4213    ) -> Result<(), fidl::Error> {
4214        DaiProxyInterface::r#create_ring_buffer(self, dai_format, ring_buffer_format, ring_buffer)
4215    }
4216}
4217
4218impl DaiProxyInterface for DaiProxy {
4219    type GetHealthStateResponseFut =
4220        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
4221    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
4222        fn _decode(
4223            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4224        ) -> Result<HealthState, fidl::Error> {
4225            let _response = fidl::client::decode_transaction_body::<
4226                HealthGetHealthStateResponse,
4227                fdomain_client::fidl::FDomainResourceDialect,
4228                0x4e146d6bca733a84,
4229            >(_buf?)?;
4230            Ok(_response.state)
4231        }
4232        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
4233            (),
4234            0x4e146d6bca733a84,
4235            fidl::encoding::DynamicFlags::empty(),
4236            _decode,
4237        )
4238    }
4239
4240    fn r#signal_processing_connect(
4241        &self,
4242        mut protocol: fdomain_client::fidl::ServerEnd<
4243            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4244        >,
4245    ) -> Result<(), fidl::Error> {
4246        self.client.send::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4247            (protocol,),
4248            0xa81907ce6066295,
4249            fidl::encoding::DynamicFlags::empty(),
4250        )
4251    }
4252
4253    type ResetResponseFut =
4254        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
4255    fn r#reset(&self) -> Self::ResetResponseFut {
4256        fn _decode(
4257            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4258        ) -> Result<(), fidl::Error> {
4259            let _response = fidl::client::decode_transaction_body::<
4260                fidl::encoding::EmptyPayload,
4261                fdomain_client::fidl::FDomainResourceDialect,
4262                0x69e5fa9fa2f78c14,
4263            >(_buf?)?;
4264            Ok(_response)
4265        }
4266        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4267            (),
4268            0x69e5fa9fa2f78c14,
4269            fidl::encoding::DynamicFlags::empty(),
4270            _decode,
4271        )
4272    }
4273
4274    type GetPropertiesResponseFut =
4275        fidl::client::QueryResponseFut<DaiProperties, fdomain_client::fidl::FDomainResourceDialect>;
4276    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
4277        fn _decode(
4278            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4279        ) -> Result<DaiProperties, fidl::Error> {
4280            let _response = fidl::client::decode_transaction_body::<
4281                DaiGetPropertiesResponse,
4282                fdomain_client::fidl::FDomainResourceDialect,
4283                0x2c25a1a66149510b,
4284            >(_buf?)?;
4285            Ok(_response.properties)
4286        }
4287        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiProperties>(
4288            (),
4289            0x2c25a1a66149510b,
4290            fidl::encoding::DynamicFlags::empty(),
4291            _decode,
4292        )
4293    }
4294
4295    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
4296        DaiGetDaiFormatsResult,
4297        fdomain_client::fidl::FDomainResourceDialect,
4298    >;
4299    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
4300        fn _decode(
4301            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4302        ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4303            let _response = fidl::client::decode_transaction_body::<
4304                fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
4305                fdomain_client::fidl::FDomainResourceDialect,
4306                0x1eb37b0cddf79d69,
4307            >(_buf?)?;
4308            Ok(_response.map(|x| x.dai_formats))
4309        }
4310        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetDaiFormatsResult>(
4311            (),
4312            0x1eb37b0cddf79d69,
4313            fidl::encoding::DynamicFlags::empty(),
4314            _decode,
4315        )
4316    }
4317
4318    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
4319        DaiGetRingBufferFormatsResult,
4320        fdomain_client::fidl::FDomainResourceDialect,
4321    >;
4322    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut {
4323        fn _decode(
4324            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4325        ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
4326            let _response = fidl::client::decode_transaction_body::<
4327                fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
4328                fdomain_client::fidl::FDomainResourceDialect,
4329                0x760371081d8c92e4,
4330            >(_buf?)?;
4331            Ok(_response.map(|x| x.ring_buffer_formats))
4332        }
4333        self.client
4334            .send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetRingBufferFormatsResult>(
4335                (),
4336                0x760371081d8c92e4,
4337                fidl::encoding::DynamicFlags::empty(),
4338                _decode,
4339            )
4340    }
4341
4342    fn r#create_ring_buffer(
4343        &self,
4344        mut dai_format: &DaiFormat,
4345        mut ring_buffer_format: &Format,
4346        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4347    ) -> Result<(), fidl::Error> {
4348        self.client.send::<DaiCreateRingBufferRequest>(
4349            (dai_format, ring_buffer_format, ring_buffer),
4350            0x5af9760589a75257,
4351            fidl::encoding::DynamicFlags::empty(),
4352        )
4353    }
4354}
4355
4356pub struct DaiEventStream {
4357    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
4358}
4359
4360impl std::marker::Unpin for DaiEventStream {}
4361
4362impl futures::stream::FusedStream for DaiEventStream {
4363    fn is_terminated(&self) -> bool {
4364        self.event_receiver.is_terminated()
4365    }
4366}
4367
4368impl futures::Stream for DaiEventStream {
4369    type Item = Result<DaiEvent, fidl::Error>;
4370
4371    fn poll_next(
4372        mut self: std::pin::Pin<&mut Self>,
4373        cx: &mut std::task::Context<'_>,
4374    ) -> std::task::Poll<Option<Self::Item>> {
4375        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4376            &mut self.event_receiver,
4377            cx
4378        )?) {
4379            Some(buf) => std::task::Poll::Ready(Some(DaiEvent::decode(buf))),
4380            None => std::task::Poll::Ready(None),
4381        }
4382    }
4383}
4384
4385#[derive(Debug)]
4386pub enum DaiEvent {}
4387
4388impl DaiEvent {
4389    /// Decodes a message buffer as a [`DaiEvent`].
4390    fn decode(
4391        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4392    ) -> Result<DaiEvent, fidl::Error> {
4393        let (bytes, _handles) = buf.split_mut();
4394        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4395        debug_assert_eq!(tx_header.tx_id, 0);
4396        match tx_header.ordinal {
4397            _ => Err(fidl::Error::UnknownOrdinal {
4398                ordinal: tx_header.ordinal,
4399                protocol_name: <DaiMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4400            }),
4401        }
4402    }
4403}
4404
4405/// A Stream of incoming requests for fuchsia.hardware.audio/Dai.
4406pub struct DaiRequestStream {
4407    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4408    is_terminated: bool,
4409}
4410
4411impl std::marker::Unpin for DaiRequestStream {}
4412
4413impl futures::stream::FusedStream for DaiRequestStream {
4414    fn is_terminated(&self) -> bool {
4415        self.is_terminated
4416    }
4417}
4418
4419impl fdomain_client::fidl::RequestStream for DaiRequestStream {
4420    type Protocol = DaiMarker;
4421    type ControlHandle = DaiControlHandle;
4422
4423    fn from_channel(channel: fdomain_client::Channel) -> Self {
4424        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4425    }
4426
4427    fn control_handle(&self) -> Self::ControlHandle {
4428        DaiControlHandle { inner: self.inner.clone() }
4429    }
4430
4431    fn into_inner(
4432        self,
4433    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
4434    {
4435        (self.inner, self.is_terminated)
4436    }
4437
4438    fn from_inner(
4439        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4440        is_terminated: bool,
4441    ) -> Self {
4442        Self { inner, is_terminated }
4443    }
4444}
4445
4446impl futures::Stream for DaiRequestStream {
4447    type Item = Result<DaiRequest, fidl::Error>;
4448
4449    fn poll_next(
4450        mut self: std::pin::Pin<&mut Self>,
4451        cx: &mut std::task::Context<'_>,
4452    ) -> std::task::Poll<Option<Self::Item>> {
4453        let this = &mut *self;
4454        if this.inner.check_shutdown(cx) {
4455            this.is_terminated = true;
4456            return std::task::Poll::Ready(None);
4457        }
4458        if this.is_terminated {
4459            panic!("polled DaiRequestStream after completion");
4460        }
4461        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
4462            |bytes, handles| {
4463                match this.inner.channel().read_etc(cx, bytes, handles) {
4464                    std::task::Poll::Ready(Ok(())) => {}
4465                    std::task::Poll::Pending => return std::task::Poll::Pending,
4466                    std::task::Poll::Ready(Err(None)) => {
4467                        this.is_terminated = true;
4468                        return std::task::Poll::Ready(None);
4469                    }
4470                    std::task::Poll::Ready(Err(Some(e))) => {
4471                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4472                            e.into(),
4473                        ))));
4474                    }
4475                }
4476
4477                // A message has been received from the channel
4478                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4479
4480                std::task::Poll::Ready(Some(match header.ordinal {
4481                    0x4e146d6bca733a84 => {
4482                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4483                        let mut req = fidl::new_empty!(
4484                            fidl::encoding::EmptyPayload,
4485                            fdomain_client::fidl::FDomainResourceDialect
4486                        );
4487                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4488                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4489                        Ok(DaiRequest::GetHealthState {
4490                            responder: DaiGetHealthStateResponder {
4491                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4492                                tx_id: header.tx_id,
4493                            },
4494                        })
4495                    }
4496                    0xa81907ce6066295 => {
4497                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4498                        let mut req = fidl::new_empty!(fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
4499                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4500                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4501                        Ok(DaiRequest::SignalProcessingConnect {
4502                            protocol: req.protocol,
4503
4504                            control_handle,
4505                        })
4506                    }
4507                    0x69e5fa9fa2f78c14 => {
4508                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4509                        let mut req = fidl::new_empty!(
4510                            fidl::encoding::EmptyPayload,
4511                            fdomain_client::fidl::FDomainResourceDialect
4512                        );
4513                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4514                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4515                        Ok(DaiRequest::Reset {
4516                            responder: DaiResetResponder {
4517                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4518                                tx_id: header.tx_id,
4519                            },
4520                        })
4521                    }
4522                    0x2c25a1a66149510b => {
4523                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4524                        let mut req = fidl::new_empty!(
4525                            fidl::encoding::EmptyPayload,
4526                            fdomain_client::fidl::FDomainResourceDialect
4527                        );
4528                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4529                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4530                        Ok(DaiRequest::GetProperties {
4531                            responder: DaiGetPropertiesResponder {
4532                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4533                                tx_id: header.tx_id,
4534                            },
4535                        })
4536                    }
4537                    0x1eb37b0cddf79d69 => {
4538                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4539                        let mut req = fidl::new_empty!(
4540                            fidl::encoding::EmptyPayload,
4541                            fdomain_client::fidl::FDomainResourceDialect
4542                        );
4543                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4544                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4545                        Ok(DaiRequest::GetDaiFormats {
4546                            responder: DaiGetDaiFormatsResponder {
4547                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4548                                tx_id: header.tx_id,
4549                            },
4550                        })
4551                    }
4552                    0x760371081d8c92e4 => {
4553                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4554                        let mut req = fidl::new_empty!(
4555                            fidl::encoding::EmptyPayload,
4556                            fdomain_client::fidl::FDomainResourceDialect
4557                        );
4558                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4559                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4560                        Ok(DaiRequest::GetRingBufferFormats {
4561                            responder: DaiGetRingBufferFormatsResponder {
4562                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4563                                tx_id: header.tx_id,
4564                            },
4565                        })
4566                    }
4567                    0x5af9760589a75257 => {
4568                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4569                        let mut req = fidl::new_empty!(
4570                            DaiCreateRingBufferRequest,
4571                            fdomain_client::fidl::FDomainResourceDialect
4572                        );
4573                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<DaiCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
4574                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4575                        Ok(DaiRequest::CreateRingBuffer {
4576                            dai_format: req.dai_format,
4577                            ring_buffer_format: req.ring_buffer_format,
4578                            ring_buffer: req.ring_buffer,
4579
4580                            control_handle,
4581                        })
4582                    }
4583                    _ => Err(fidl::Error::UnknownOrdinal {
4584                        ordinal: header.ordinal,
4585                        protocol_name:
4586                            <DaiMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4587                    }),
4588                }))
4589            },
4590        )
4591    }
4592}
4593
4594/// For an overview see
4595/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_dai).
4596/// # Deprecation
4597///
4598/// Not supported anymore, instead use an
4599/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
4600/// with one DAI and one Ring Buffer, see
4601/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
4602#[derive(Debug)]
4603pub enum DaiRequest {
4604    /// Retrieves top level health state.
4605    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4606    GetHealthState { responder: DaiGetHealthStateResponder },
4607    /// Connect to a `SignalProcessing` protocol.
4608    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4609    /// the maximum number of connections have already been created, for instance one, then the
4610    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4611    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4612    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4613    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4614    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4615    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4616    /// is intended to be composed, and hence the more verbose name allows differentiation and
4617    /// improved clarity.
4618    SignalProcessingConnect {
4619        protocol: fdomain_client::fidl::ServerEnd<
4620            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4621        >,
4622        control_handle: DaiControlHandle,
4623    },
4624    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4625    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4626    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4627    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4628    /// protocol channel and retry.
4629    Reset { responder: DaiResetResponder },
4630    /// Retrieves top level static properties.
4631    GetProperties { responder: DaiGetPropertiesResponder },
4632    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4633    /// may reply with an error status and the client may retry at a later time.
4634    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4635    /// the parameters in SupportedFormats may be supported.
4636    GetDaiFormats { responder: DaiGetDaiFormatsResponder },
4637    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4638    /// may reply with an error status and the client may retry at a later time.
4639    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4640    /// the parameters in `SupportedFormats` may be supported.
4641    GetRingBufferFormats { responder: DaiGetRingBufferFormatsResponder },
4642    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4643    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4644    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4645    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4646    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4647    /// gracefully quiesce any on-going streaming operations in the process.
4648    CreateRingBuffer {
4649        dai_format: DaiFormat,
4650        ring_buffer_format: Format,
4651        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4652        control_handle: DaiControlHandle,
4653    },
4654}
4655
4656impl DaiRequest {
4657    #[allow(irrefutable_let_patterns)]
4658    pub fn into_get_health_state(self) -> Option<(DaiGetHealthStateResponder)> {
4659        if let DaiRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
4660    }
4661
4662    #[allow(irrefutable_let_patterns)]
4663    pub fn into_signal_processing_connect(
4664        self,
4665    ) -> Option<(
4666        fdomain_client::fidl::ServerEnd<
4667            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4668        >,
4669        DaiControlHandle,
4670    )> {
4671        if let DaiRequest::SignalProcessingConnect { protocol, control_handle } = self {
4672            Some((protocol, control_handle))
4673        } else {
4674            None
4675        }
4676    }
4677
4678    #[allow(irrefutable_let_patterns)]
4679    pub fn into_reset(self) -> Option<(DaiResetResponder)> {
4680        if let DaiRequest::Reset { responder } = self { Some((responder)) } else { None }
4681    }
4682
4683    #[allow(irrefutable_let_patterns)]
4684    pub fn into_get_properties(self) -> Option<(DaiGetPropertiesResponder)> {
4685        if let DaiRequest::GetProperties { responder } = self { Some((responder)) } else { None }
4686    }
4687
4688    #[allow(irrefutable_let_patterns)]
4689    pub fn into_get_dai_formats(self) -> Option<(DaiGetDaiFormatsResponder)> {
4690        if let DaiRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
4691    }
4692
4693    #[allow(irrefutable_let_patterns)]
4694    pub fn into_get_ring_buffer_formats(self) -> Option<(DaiGetRingBufferFormatsResponder)> {
4695        if let DaiRequest::GetRingBufferFormats { responder } = self {
4696            Some((responder))
4697        } else {
4698            None
4699        }
4700    }
4701
4702    #[allow(irrefutable_let_patterns)]
4703    pub fn into_create_ring_buffer(
4704        self,
4705    ) -> Option<(
4706        DaiFormat,
4707        Format,
4708        fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4709        DaiControlHandle,
4710    )> {
4711        if let DaiRequest::CreateRingBuffer {
4712            dai_format,
4713            ring_buffer_format,
4714            ring_buffer,
4715            control_handle,
4716        } = self
4717        {
4718            Some((dai_format, ring_buffer_format, ring_buffer, control_handle))
4719        } else {
4720            None
4721        }
4722    }
4723
4724    /// Name of the method defined in FIDL
4725    pub fn method_name(&self) -> &'static str {
4726        match *self {
4727            DaiRequest::GetHealthState { .. } => "get_health_state",
4728            DaiRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
4729            DaiRequest::Reset { .. } => "reset",
4730            DaiRequest::GetProperties { .. } => "get_properties",
4731            DaiRequest::GetDaiFormats { .. } => "get_dai_formats",
4732            DaiRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
4733            DaiRequest::CreateRingBuffer { .. } => "create_ring_buffer",
4734        }
4735    }
4736}
4737
4738#[derive(Debug, Clone)]
4739pub struct DaiControlHandle {
4740    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4741}
4742
4743impl fdomain_client::fidl::ControlHandle for DaiControlHandle {
4744    fn shutdown(&self) {
4745        self.inner.shutdown()
4746    }
4747
4748    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4749        self.inner.shutdown_with_epitaph(status)
4750    }
4751
4752    fn is_closed(&self) -> bool {
4753        self.inner.channel().is_closed()
4754    }
4755    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
4756        self.inner.channel().on_closed()
4757    }
4758}
4759
4760impl DaiControlHandle {}
4761
4762#[must_use = "FIDL methods require a response to be sent"]
4763#[derive(Debug)]
4764pub struct DaiGetHealthStateResponder {
4765    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4766    tx_id: u32,
4767}
4768
4769/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4770/// if the responder is dropped without sending a response, so that the client
4771/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4772impl std::ops::Drop for DaiGetHealthStateResponder {
4773    fn drop(&mut self) {
4774        self.control_handle.shutdown();
4775        // Safety: drops once, never accessed again
4776        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4777    }
4778}
4779
4780impl fdomain_client::fidl::Responder for DaiGetHealthStateResponder {
4781    type ControlHandle = DaiControlHandle;
4782
4783    fn control_handle(&self) -> &DaiControlHandle {
4784        &self.control_handle
4785    }
4786
4787    fn drop_without_shutdown(mut self) {
4788        // Safety: drops once, never accessed again due to mem::forget
4789        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4790        // Prevent Drop from running (which would shut down the channel)
4791        std::mem::forget(self);
4792    }
4793}
4794
4795impl DaiGetHealthStateResponder {
4796    /// Sends a response to the FIDL transaction.
4797    ///
4798    /// Sets the channel to shutdown if an error occurs.
4799    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
4800        let _result = self.send_raw(state);
4801        if _result.is_err() {
4802            self.control_handle.shutdown();
4803        }
4804        self.drop_without_shutdown();
4805        _result
4806    }
4807
4808    /// Similar to "send" but does not shutdown the channel if an error occurs.
4809    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
4810        let _result = self.send_raw(state);
4811        self.drop_without_shutdown();
4812        _result
4813    }
4814
4815    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
4816        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
4817            (state,),
4818            self.tx_id,
4819            0x4e146d6bca733a84,
4820            fidl::encoding::DynamicFlags::empty(),
4821        )
4822    }
4823}
4824
4825#[must_use = "FIDL methods require a response to be sent"]
4826#[derive(Debug)]
4827pub struct DaiResetResponder {
4828    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4829    tx_id: u32,
4830}
4831
4832/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4833/// if the responder is dropped without sending a response, so that the client
4834/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4835impl std::ops::Drop for DaiResetResponder {
4836    fn drop(&mut self) {
4837        self.control_handle.shutdown();
4838        // Safety: drops once, never accessed again
4839        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4840    }
4841}
4842
4843impl fdomain_client::fidl::Responder for DaiResetResponder {
4844    type ControlHandle = DaiControlHandle;
4845
4846    fn control_handle(&self) -> &DaiControlHandle {
4847        &self.control_handle
4848    }
4849
4850    fn drop_without_shutdown(mut self) {
4851        // Safety: drops once, never accessed again due to mem::forget
4852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4853        // Prevent Drop from running (which would shut down the channel)
4854        std::mem::forget(self);
4855    }
4856}
4857
4858impl DaiResetResponder {
4859    /// Sends a response to the FIDL transaction.
4860    ///
4861    /// Sets the channel to shutdown if an error occurs.
4862    pub fn send(self) -> Result<(), fidl::Error> {
4863        let _result = self.send_raw();
4864        if _result.is_err() {
4865            self.control_handle.shutdown();
4866        }
4867        self.drop_without_shutdown();
4868        _result
4869    }
4870
4871    /// Similar to "send" but does not shutdown the channel if an error occurs.
4872    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4873        let _result = self.send_raw();
4874        self.drop_without_shutdown();
4875        _result
4876    }
4877
4878    fn send_raw(&self) -> Result<(), fidl::Error> {
4879        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4880            (),
4881            self.tx_id,
4882            0x69e5fa9fa2f78c14,
4883            fidl::encoding::DynamicFlags::empty(),
4884        )
4885    }
4886}
4887
4888#[must_use = "FIDL methods require a response to be sent"]
4889#[derive(Debug)]
4890pub struct DaiGetPropertiesResponder {
4891    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4892    tx_id: u32,
4893}
4894
4895/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4896/// if the responder is dropped without sending a response, so that the client
4897/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4898impl std::ops::Drop for DaiGetPropertiesResponder {
4899    fn drop(&mut self) {
4900        self.control_handle.shutdown();
4901        // Safety: drops once, never accessed again
4902        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4903    }
4904}
4905
4906impl fdomain_client::fidl::Responder for DaiGetPropertiesResponder {
4907    type ControlHandle = DaiControlHandle;
4908
4909    fn control_handle(&self) -> &DaiControlHandle {
4910        &self.control_handle
4911    }
4912
4913    fn drop_without_shutdown(mut self) {
4914        // Safety: drops once, never accessed again due to mem::forget
4915        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4916        // Prevent Drop from running (which would shut down the channel)
4917        std::mem::forget(self);
4918    }
4919}
4920
4921impl DaiGetPropertiesResponder {
4922    /// Sends a response to the FIDL transaction.
4923    ///
4924    /// Sets the channel to shutdown if an error occurs.
4925    pub fn send(self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
4926        let _result = self.send_raw(properties);
4927        if _result.is_err() {
4928            self.control_handle.shutdown();
4929        }
4930        self.drop_without_shutdown();
4931        _result
4932    }
4933
4934    /// Similar to "send" but does not shutdown the channel if an error occurs.
4935    pub fn send_no_shutdown_on_err(
4936        self,
4937        mut properties: &DaiProperties,
4938    ) -> Result<(), fidl::Error> {
4939        let _result = self.send_raw(properties);
4940        self.drop_without_shutdown();
4941        _result
4942    }
4943
4944    fn send_raw(&self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
4945        self.control_handle.inner.send::<DaiGetPropertiesResponse>(
4946            (properties,),
4947            self.tx_id,
4948            0x2c25a1a66149510b,
4949            fidl::encoding::DynamicFlags::empty(),
4950        )
4951    }
4952}
4953
4954#[must_use = "FIDL methods require a response to be sent"]
4955#[derive(Debug)]
4956pub struct DaiGetDaiFormatsResponder {
4957    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4958    tx_id: u32,
4959}
4960
4961/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4962/// if the responder is dropped without sending a response, so that the client
4963/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4964impl std::ops::Drop for DaiGetDaiFormatsResponder {
4965    fn drop(&mut self) {
4966        self.control_handle.shutdown();
4967        // Safety: drops once, never accessed again
4968        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4969    }
4970}
4971
4972impl fdomain_client::fidl::Responder for DaiGetDaiFormatsResponder {
4973    type ControlHandle = DaiControlHandle;
4974
4975    fn control_handle(&self) -> &DaiControlHandle {
4976        &self.control_handle
4977    }
4978
4979    fn drop_without_shutdown(mut self) {
4980        // Safety: drops once, never accessed again due to mem::forget
4981        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4982        // Prevent Drop from running (which would shut down the channel)
4983        std::mem::forget(self);
4984    }
4985}
4986
4987impl DaiGetDaiFormatsResponder {
4988    /// Sends a response to the FIDL transaction.
4989    ///
4990    /// Sets the channel to shutdown if an error occurs.
4991    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
4992        let _result = self.send_raw(result);
4993        if _result.is_err() {
4994            self.control_handle.shutdown();
4995        }
4996        self.drop_without_shutdown();
4997        _result
4998    }
4999
5000    /// Similar to "send" but does not shutdown the channel if an error occurs.
5001    pub fn send_no_shutdown_on_err(
5002        self,
5003        mut result: Result<&[DaiSupportedFormats], i32>,
5004    ) -> Result<(), fidl::Error> {
5005        let _result = self.send_raw(result);
5006        self.drop_without_shutdown();
5007        _result
5008    }
5009
5010    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5011        self.control_handle.inner.send::<fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>>(
5012            result.map(|dai_formats| (dai_formats,)),
5013            self.tx_id,
5014            0x1eb37b0cddf79d69,
5015            fidl::encoding::DynamicFlags::empty(),
5016        )
5017    }
5018}
5019
5020#[must_use = "FIDL methods require a response to be sent"]
5021#[derive(Debug)]
5022pub struct DaiGetRingBufferFormatsResponder {
5023    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5024    tx_id: u32,
5025}
5026
5027/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5028/// if the responder is dropped without sending a response, so that the client
5029/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5030impl std::ops::Drop for DaiGetRingBufferFormatsResponder {
5031    fn drop(&mut self) {
5032        self.control_handle.shutdown();
5033        // Safety: drops once, never accessed again
5034        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5035    }
5036}
5037
5038impl fdomain_client::fidl::Responder for DaiGetRingBufferFormatsResponder {
5039    type ControlHandle = DaiControlHandle;
5040
5041    fn control_handle(&self) -> &DaiControlHandle {
5042        &self.control_handle
5043    }
5044
5045    fn drop_without_shutdown(mut self) {
5046        // Safety: drops once, never accessed again due to mem::forget
5047        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5048        // Prevent Drop from running (which would shut down the channel)
5049        std::mem::forget(self);
5050    }
5051}
5052
5053impl DaiGetRingBufferFormatsResponder {
5054    /// Sends a response to the FIDL transaction.
5055    ///
5056    /// Sets the channel to shutdown if an error occurs.
5057    pub fn send(self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5058        let _result = self.send_raw(result);
5059        if _result.is_err() {
5060            self.control_handle.shutdown();
5061        }
5062        self.drop_without_shutdown();
5063        _result
5064    }
5065
5066    /// Similar to "send" but does not shutdown the channel if an error occurs.
5067    pub fn send_no_shutdown_on_err(
5068        self,
5069        mut result: Result<&[SupportedFormats], i32>,
5070    ) -> Result<(), fidl::Error> {
5071        let _result = self.send_raw(result);
5072        self.drop_without_shutdown();
5073        _result
5074    }
5075
5076    fn send_raw(&self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5077        self.control_handle
5078            .inner
5079            .send::<fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>>(
5080                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
5081                self.tx_id,
5082                0x760371081d8c92e4,
5083                fidl::encoding::DynamicFlags::empty(),
5084            )
5085    }
5086}
5087
5088#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5089pub struct DaiConnectorMarker;
5090
5091impl fdomain_client::fidl::ProtocolMarker for DaiConnectorMarker {
5092    type Proxy = DaiConnectorProxy;
5093    type RequestStream = DaiConnectorRequestStream;
5094
5095    const DEBUG_NAME: &'static str = "(anonymous) DaiConnector";
5096}
5097
5098pub trait DaiConnectorProxyInterface: Send + Sync {
5099    fn r#connect(
5100        &self,
5101        dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5102    ) -> Result<(), fidl::Error>;
5103}
5104
5105#[derive(Debug, Clone)]
5106pub struct DaiConnectorProxy {
5107    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
5108}
5109
5110impl fdomain_client::fidl::Proxy for DaiConnectorProxy {
5111    type Protocol = DaiConnectorMarker;
5112
5113    fn from_channel(inner: fdomain_client::Channel) -> Self {
5114        Self::new(inner)
5115    }
5116
5117    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
5118        self.client.into_channel().map_err(|client| Self { client })
5119    }
5120
5121    fn as_channel(&self) -> &fdomain_client::Channel {
5122        self.client.as_channel()
5123    }
5124}
5125
5126impl DaiConnectorProxy {
5127    /// Create a new Proxy for fuchsia.hardware.audio/DaiConnector.
5128    pub fn new(channel: fdomain_client::Channel) -> Self {
5129        let protocol_name =
5130            <DaiConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
5131        Self { client: fidl::client::Client::new(channel, protocol_name) }
5132    }
5133
5134    /// Get a Stream of events from the remote end of the protocol.
5135    ///
5136    /// # Panics
5137    ///
5138    /// Panics if the event stream was already taken.
5139    pub fn take_event_stream(&self) -> DaiConnectorEventStream {
5140        DaiConnectorEventStream { event_receiver: self.client.take_event_receiver() }
5141    }
5142
5143    /// This connects to a DAI protocol server.
5144    pub fn r#connect(
5145        &self,
5146        mut dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5147    ) -> Result<(), fidl::Error> {
5148        DaiConnectorProxyInterface::r#connect(self, dai_protocol)
5149    }
5150}
5151
5152impl DaiConnectorProxyInterface for DaiConnectorProxy {
5153    fn r#connect(
5154        &self,
5155        mut dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5156    ) -> Result<(), fidl::Error> {
5157        self.client.send::<DaiConnectorConnectRequest>(
5158            (dai_protocol,),
5159            0x4e4db05c2eca1450,
5160            fidl::encoding::DynamicFlags::empty(),
5161        )
5162    }
5163}
5164
5165pub struct DaiConnectorEventStream {
5166    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
5167}
5168
5169impl std::marker::Unpin for DaiConnectorEventStream {}
5170
5171impl futures::stream::FusedStream for DaiConnectorEventStream {
5172    fn is_terminated(&self) -> bool {
5173        self.event_receiver.is_terminated()
5174    }
5175}
5176
5177impl futures::Stream for DaiConnectorEventStream {
5178    type Item = Result<DaiConnectorEvent, fidl::Error>;
5179
5180    fn poll_next(
5181        mut self: std::pin::Pin<&mut Self>,
5182        cx: &mut std::task::Context<'_>,
5183    ) -> std::task::Poll<Option<Self::Item>> {
5184        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5185            &mut self.event_receiver,
5186            cx
5187        )?) {
5188            Some(buf) => std::task::Poll::Ready(Some(DaiConnectorEvent::decode(buf))),
5189            None => std::task::Poll::Ready(None),
5190        }
5191    }
5192}
5193
5194#[derive(Debug)]
5195pub enum DaiConnectorEvent {}
5196
5197impl DaiConnectorEvent {
5198    /// Decodes a message buffer as a [`DaiConnectorEvent`].
5199    fn decode(
5200        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5201    ) -> Result<DaiConnectorEvent, fidl::Error> {
5202        let (bytes, _handles) = buf.split_mut();
5203        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5204        debug_assert_eq!(tx_header.tx_id, 0);
5205        match tx_header.ordinal {
5206            _ => Err(fidl::Error::UnknownOrdinal {
5207                ordinal: tx_header.ordinal,
5208                protocol_name:
5209                    <DaiConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5210            }),
5211        }
5212    }
5213}
5214
5215/// A Stream of incoming requests for fuchsia.hardware.audio/DaiConnector.
5216pub struct DaiConnectorRequestStream {
5217    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5218    is_terminated: bool,
5219}
5220
5221impl std::marker::Unpin for DaiConnectorRequestStream {}
5222
5223impl futures::stream::FusedStream for DaiConnectorRequestStream {
5224    fn is_terminated(&self) -> bool {
5225        self.is_terminated
5226    }
5227}
5228
5229impl fdomain_client::fidl::RequestStream for DaiConnectorRequestStream {
5230    type Protocol = DaiConnectorMarker;
5231    type ControlHandle = DaiConnectorControlHandle;
5232
5233    fn from_channel(channel: fdomain_client::Channel) -> Self {
5234        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5235    }
5236
5237    fn control_handle(&self) -> Self::ControlHandle {
5238        DaiConnectorControlHandle { inner: self.inner.clone() }
5239    }
5240
5241    fn into_inner(
5242        self,
5243    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
5244    {
5245        (self.inner, self.is_terminated)
5246    }
5247
5248    fn from_inner(
5249        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5250        is_terminated: bool,
5251    ) -> Self {
5252        Self { inner, is_terminated }
5253    }
5254}
5255
5256impl futures::Stream for DaiConnectorRequestStream {
5257    type Item = Result<DaiConnectorRequest, fidl::Error>;
5258
5259    fn poll_next(
5260        mut self: std::pin::Pin<&mut Self>,
5261        cx: &mut std::task::Context<'_>,
5262    ) -> std::task::Poll<Option<Self::Item>> {
5263        let this = &mut *self;
5264        if this.inner.check_shutdown(cx) {
5265            this.is_terminated = true;
5266            return std::task::Poll::Ready(None);
5267        }
5268        if this.is_terminated {
5269            panic!("polled DaiConnectorRequestStream after completion");
5270        }
5271        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
5272            |bytes, handles| {
5273                match this.inner.channel().read_etc(cx, bytes, handles) {
5274                    std::task::Poll::Ready(Ok(())) => {}
5275                    std::task::Poll::Pending => return std::task::Poll::Pending,
5276                    std::task::Poll::Ready(Err(None)) => {
5277                        this.is_terminated = true;
5278                        return std::task::Poll::Ready(None);
5279                    }
5280                    std::task::Poll::Ready(Err(Some(e))) => {
5281                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5282                            e.into(),
5283                        ))));
5284                    }
5285                }
5286
5287                // A message has been received from the channel
5288                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5289
5290                std::task::Poll::Ready(Some(match header.ordinal {
5291                    0x4e4db05c2eca1450 => {
5292                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5293                        let mut req = fidl::new_empty!(
5294                            DaiConnectorConnectRequest,
5295                            fdomain_client::fidl::FDomainResourceDialect
5296                        );
5297                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<DaiConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5298                        let control_handle =
5299                            DaiConnectorControlHandle { inner: this.inner.clone() };
5300                        Ok(DaiConnectorRequest::Connect {
5301                            dai_protocol: req.dai_protocol,
5302
5303                            control_handle,
5304                        })
5305                    }
5306                    _ => Err(fidl::Error::UnknownOrdinal {
5307                        ordinal: header.ordinal,
5308                        protocol_name:
5309                            <DaiConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5310                    }),
5311                }))
5312            },
5313        )
5314    }
5315}
5316
5317/// For an overview of the DAI protocols see
5318/// [Digital Audio Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_dai.md)
5319/// # Deprecation
5320///
5321/// Not supported anymore, instead use an
5322/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5323/// with one DAI and one Ring Buffer, see
5324/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5325#[derive(Debug)]
5326pub enum DaiConnectorRequest {
5327    /// This connects to a DAI protocol server.
5328    Connect {
5329        dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5330        control_handle: DaiConnectorControlHandle,
5331    },
5332}
5333
5334impl DaiConnectorRequest {
5335    #[allow(irrefutable_let_patterns)]
5336    pub fn into_connect(
5337        self,
5338    ) -> Option<(fdomain_client::fidl::ServerEnd<DaiMarker>, DaiConnectorControlHandle)> {
5339        if let DaiConnectorRequest::Connect { dai_protocol, control_handle } = self {
5340            Some((dai_protocol, control_handle))
5341        } else {
5342            None
5343        }
5344    }
5345
5346    /// Name of the method defined in FIDL
5347    pub fn method_name(&self) -> &'static str {
5348        match *self {
5349            DaiConnectorRequest::Connect { .. } => "connect",
5350        }
5351    }
5352}
5353
5354#[derive(Debug, Clone)]
5355pub struct DaiConnectorControlHandle {
5356    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5357}
5358
5359impl fdomain_client::fidl::ControlHandle for DaiConnectorControlHandle {
5360    fn shutdown(&self) {
5361        self.inner.shutdown()
5362    }
5363
5364    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5365        self.inner.shutdown_with_epitaph(status)
5366    }
5367
5368    fn is_closed(&self) -> bool {
5369        self.inner.channel().is_closed()
5370    }
5371    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
5372        self.inner.channel().on_closed()
5373    }
5374}
5375
5376impl DaiConnectorControlHandle {}
5377
5378#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5379pub struct HealthMarker;
5380
5381impl fdomain_client::fidl::ProtocolMarker for HealthMarker {
5382    type Proxy = HealthProxy;
5383    type RequestStream = HealthRequestStream;
5384
5385    const DEBUG_NAME: &'static str = "(anonymous) Health";
5386}
5387
5388pub trait HealthProxyInterface: Send + Sync {
5389    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
5390        + Send;
5391    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
5392}
5393
5394#[derive(Debug, Clone)]
5395pub struct HealthProxy {
5396    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
5397}
5398
5399impl fdomain_client::fidl::Proxy for HealthProxy {
5400    type Protocol = HealthMarker;
5401
5402    fn from_channel(inner: fdomain_client::Channel) -> Self {
5403        Self::new(inner)
5404    }
5405
5406    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
5407        self.client.into_channel().map_err(|client| Self { client })
5408    }
5409
5410    fn as_channel(&self) -> &fdomain_client::Channel {
5411        self.client.as_channel()
5412    }
5413}
5414
5415impl HealthProxy {
5416    /// Create a new Proxy for fuchsia.hardware.audio/Health.
5417    pub fn new(channel: fdomain_client::Channel) -> Self {
5418        let protocol_name = <HealthMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
5419        Self { client: fidl::client::Client::new(channel, protocol_name) }
5420    }
5421
5422    /// Get a Stream of events from the remote end of the protocol.
5423    ///
5424    /// # Panics
5425    ///
5426    /// Panics if the event stream was already taken.
5427    pub fn take_event_stream(&self) -> HealthEventStream {
5428        HealthEventStream { event_receiver: self.client.take_event_receiver() }
5429    }
5430
5431    /// Retrieves top level health state.
5432    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5433    pub fn r#get_health_state(
5434        &self,
5435    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
5436    {
5437        HealthProxyInterface::r#get_health_state(self)
5438    }
5439}
5440
5441impl HealthProxyInterface for HealthProxy {
5442    type GetHealthStateResponseFut =
5443        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
5444    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
5445        fn _decode(
5446            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5447        ) -> Result<HealthState, fidl::Error> {
5448            let _response = fidl::client::decode_transaction_body::<
5449                HealthGetHealthStateResponse,
5450                fdomain_client::fidl::FDomainResourceDialect,
5451                0x4e146d6bca733a84,
5452            >(_buf?)?;
5453            Ok(_response.state)
5454        }
5455        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
5456            (),
5457            0x4e146d6bca733a84,
5458            fidl::encoding::DynamicFlags::empty(),
5459            _decode,
5460        )
5461    }
5462}
5463
5464pub struct HealthEventStream {
5465    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
5466}
5467
5468impl std::marker::Unpin for HealthEventStream {}
5469
5470impl futures::stream::FusedStream for HealthEventStream {
5471    fn is_terminated(&self) -> bool {
5472        self.event_receiver.is_terminated()
5473    }
5474}
5475
5476impl futures::Stream for HealthEventStream {
5477    type Item = Result<HealthEvent, fidl::Error>;
5478
5479    fn poll_next(
5480        mut self: std::pin::Pin<&mut Self>,
5481        cx: &mut std::task::Context<'_>,
5482    ) -> std::task::Poll<Option<Self::Item>> {
5483        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5484            &mut self.event_receiver,
5485            cx
5486        )?) {
5487            Some(buf) => std::task::Poll::Ready(Some(HealthEvent::decode(buf))),
5488            None => std::task::Poll::Ready(None),
5489        }
5490    }
5491}
5492
5493#[derive(Debug)]
5494pub enum HealthEvent {}
5495
5496impl HealthEvent {
5497    /// Decodes a message buffer as a [`HealthEvent`].
5498    fn decode(
5499        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5500    ) -> Result<HealthEvent, fidl::Error> {
5501        let (bytes, _handles) = buf.split_mut();
5502        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5503        debug_assert_eq!(tx_header.tx_id, 0);
5504        match tx_header.ordinal {
5505            _ => Err(fidl::Error::UnknownOrdinal {
5506                ordinal: tx_header.ordinal,
5507                protocol_name: <HealthMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5508            }),
5509        }
5510    }
5511}
5512
5513/// A Stream of incoming requests for fuchsia.hardware.audio/Health.
5514pub struct HealthRequestStream {
5515    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5516    is_terminated: bool,
5517}
5518
5519impl std::marker::Unpin for HealthRequestStream {}
5520
5521impl futures::stream::FusedStream for HealthRequestStream {
5522    fn is_terminated(&self) -> bool {
5523        self.is_terminated
5524    }
5525}
5526
5527impl fdomain_client::fidl::RequestStream for HealthRequestStream {
5528    type Protocol = HealthMarker;
5529    type ControlHandle = HealthControlHandle;
5530
5531    fn from_channel(channel: fdomain_client::Channel) -> Self {
5532        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5533    }
5534
5535    fn control_handle(&self) -> Self::ControlHandle {
5536        HealthControlHandle { inner: self.inner.clone() }
5537    }
5538
5539    fn into_inner(
5540        self,
5541    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
5542    {
5543        (self.inner, self.is_terminated)
5544    }
5545
5546    fn from_inner(
5547        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5548        is_terminated: bool,
5549    ) -> Self {
5550        Self { inner, is_terminated }
5551    }
5552}
5553
5554impl futures::Stream for HealthRequestStream {
5555    type Item = Result<HealthRequest, fidl::Error>;
5556
5557    fn poll_next(
5558        mut self: std::pin::Pin<&mut Self>,
5559        cx: &mut std::task::Context<'_>,
5560    ) -> std::task::Poll<Option<Self::Item>> {
5561        let this = &mut *self;
5562        if this.inner.check_shutdown(cx) {
5563            this.is_terminated = true;
5564            return std::task::Poll::Ready(None);
5565        }
5566        if this.is_terminated {
5567            panic!("polled HealthRequestStream after completion");
5568        }
5569        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
5570            |bytes, handles| {
5571                match this.inner.channel().read_etc(cx, bytes, handles) {
5572                    std::task::Poll::Ready(Ok(())) => {}
5573                    std::task::Poll::Pending => return std::task::Poll::Pending,
5574                    std::task::Poll::Ready(Err(None)) => {
5575                        this.is_terminated = true;
5576                        return std::task::Poll::Ready(None);
5577                    }
5578                    std::task::Poll::Ready(Err(Some(e))) => {
5579                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5580                            e.into(),
5581                        ))));
5582                    }
5583                }
5584
5585                // A message has been received from the channel
5586                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5587
5588                std::task::Poll::Ready(Some(match header.ordinal {
5589                    0x4e146d6bca733a84 => {
5590                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5591                        let mut req = fidl::new_empty!(
5592                            fidl::encoding::EmptyPayload,
5593                            fdomain_client::fidl::FDomainResourceDialect
5594                        );
5595                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5596                        let control_handle = HealthControlHandle { inner: this.inner.clone() };
5597                        Ok(HealthRequest::GetHealthState {
5598                            responder: HealthGetHealthStateResponder {
5599                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5600                                tx_id: header.tx_id,
5601                            },
5602                        })
5603                    }
5604                    _ => Err(fidl::Error::UnknownOrdinal {
5605                        ordinal: header.ordinal,
5606                        protocol_name:
5607                            <HealthMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5608                    }),
5609                }))
5610            },
5611        )
5612    }
5613}
5614
5615#[derive(Debug)]
5616pub enum HealthRequest {
5617    /// Retrieves top level health state.
5618    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5619    GetHealthState { responder: HealthGetHealthStateResponder },
5620}
5621
5622impl HealthRequest {
5623    #[allow(irrefutable_let_patterns)]
5624    pub fn into_get_health_state(self) -> Option<(HealthGetHealthStateResponder)> {
5625        if let HealthRequest::GetHealthState { responder } = self {
5626            Some((responder))
5627        } else {
5628            None
5629        }
5630    }
5631
5632    /// Name of the method defined in FIDL
5633    pub fn method_name(&self) -> &'static str {
5634        match *self {
5635            HealthRequest::GetHealthState { .. } => "get_health_state",
5636        }
5637    }
5638}
5639
5640#[derive(Debug, Clone)]
5641pub struct HealthControlHandle {
5642    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5643}
5644
5645impl fdomain_client::fidl::ControlHandle for HealthControlHandle {
5646    fn shutdown(&self) {
5647        self.inner.shutdown()
5648    }
5649
5650    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5651        self.inner.shutdown_with_epitaph(status)
5652    }
5653
5654    fn is_closed(&self) -> bool {
5655        self.inner.channel().is_closed()
5656    }
5657    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
5658        self.inner.channel().on_closed()
5659    }
5660}
5661
5662impl HealthControlHandle {}
5663
5664#[must_use = "FIDL methods require a response to be sent"]
5665#[derive(Debug)]
5666pub struct HealthGetHealthStateResponder {
5667    control_handle: std::mem::ManuallyDrop<HealthControlHandle>,
5668    tx_id: u32,
5669}
5670
5671/// Set the the channel to be shutdown (see [`HealthControlHandle::shutdown`])
5672/// if the responder is dropped without sending a response, so that the client
5673/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5674impl std::ops::Drop for HealthGetHealthStateResponder {
5675    fn drop(&mut self) {
5676        self.control_handle.shutdown();
5677        // Safety: drops once, never accessed again
5678        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5679    }
5680}
5681
5682impl fdomain_client::fidl::Responder for HealthGetHealthStateResponder {
5683    type ControlHandle = HealthControlHandle;
5684
5685    fn control_handle(&self) -> &HealthControlHandle {
5686        &self.control_handle
5687    }
5688
5689    fn drop_without_shutdown(mut self) {
5690        // Safety: drops once, never accessed again due to mem::forget
5691        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5692        // Prevent Drop from running (which would shut down the channel)
5693        std::mem::forget(self);
5694    }
5695}
5696
5697impl HealthGetHealthStateResponder {
5698    /// Sends a response to the FIDL transaction.
5699    ///
5700    /// Sets the channel to shutdown if an error occurs.
5701    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5702        let _result = self.send_raw(state);
5703        if _result.is_err() {
5704            self.control_handle.shutdown();
5705        }
5706        self.drop_without_shutdown();
5707        _result
5708    }
5709
5710    /// Similar to "send" but does not shutdown the channel if an error occurs.
5711    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5712        let _result = self.send_raw(state);
5713        self.drop_without_shutdown();
5714        _result
5715    }
5716
5717    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
5718        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
5719            (state,),
5720            self.tx_id,
5721            0x4e146d6bca733a84,
5722            fidl::encoding::DynamicFlags::empty(),
5723        )
5724    }
5725}
5726
5727#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5728pub struct PacketStreamControlMarker;
5729
5730impl fdomain_client::fidl::ProtocolMarker for PacketStreamControlMarker {
5731    type Proxy = PacketStreamControlProxy;
5732    type RequestStream = PacketStreamControlRequestStream;
5733
5734    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamControl";
5735}
5736pub type PacketStreamControlAllocateVmosResult = Result<Vec<VmoInfo>, i32>;
5737pub type PacketStreamControlDeallocateVmosResult = Result<(), i32>;
5738pub type PacketStreamControlRegisterVmosResult = Result<(), i32>;
5739pub type PacketStreamControlUnregisterVmosResult = Result<(), i32>;
5740pub type PacketStreamControlGetPacketStreamSinkResult =
5741    Result<PacketStreamControlGetPacketStreamSinkResponse, i32>;
5742pub type PacketStreamControlSetPacketStreamSinkResult = Result<(), i32>;
5743pub type PacketStreamControlStartResult = Result<(), i32>;
5744pub type PacketStreamControlStopResult = Result<(), i32>;
5745
5746pub trait PacketStreamControlProxyInterface: Send + Sync {
5747    type GetPropertiesResponseFut: std::future::Future<Output = Result<PacketStreamProperties, fidl::Error>>
5748        + Send;
5749    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
5750    type AllocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlAllocateVmosResult, fidl::Error>>
5751        + Send;
5752    fn r#allocate_vmos(&self, payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut;
5753    type DeallocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlDeallocateVmosResult, fidl::Error>>
5754        + Send;
5755    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut;
5756    type RegisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlRegisterVmosResult, fidl::Error>>
5757        + Send;
5758    fn r#register_vmos(&self, payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut;
5759    type UnregisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlUnregisterVmosResult, fidl::Error>>
5760        + Send;
5761    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut;
5762    type GetPacketStreamSinkResponseFut: std::future::Future<
5763            Output = Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error>,
5764        > + Send;
5765    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut;
5766    type SetPacketStreamSinkResponseFut: std::future::Future<
5767            Output = Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error>,
5768        > + Send;
5769    fn r#set_packet_stream_sink(
5770        &self,
5771        payload: PacketStreamControlSetPacketStreamSinkRequest,
5772    ) -> Self::SetPacketStreamSinkResponseFut;
5773    type StartResponseFut: std::future::Future<Output = Result<PacketStreamControlStartResult, fidl::Error>>
5774        + Send;
5775    fn r#start(&self) -> Self::StartResponseFut;
5776    type StopResponseFut: std::future::Future<Output = Result<PacketStreamControlStopResult, fidl::Error>>
5777        + Send;
5778    fn r#stop(&self) -> Self::StopResponseFut;
5779}
5780
5781#[derive(Debug, Clone)]
5782pub struct PacketStreamControlProxy {
5783    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
5784}
5785
5786impl fdomain_client::fidl::Proxy for PacketStreamControlProxy {
5787    type Protocol = PacketStreamControlMarker;
5788
5789    fn from_channel(inner: fdomain_client::Channel) -> Self {
5790        Self::new(inner)
5791    }
5792
5793    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
5794        self.client.into_channel().map_err(|client| Self { client })
5795    }
5796
5797    fn as_channel(&self) -> &fdomain_client::Channel {
5798        self.client.as_channel()
5799    }
5800}
5801
5802impl PacketStreamControlProxy {
5803    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamControl.
5804    pub fn new(channel: fdomain_client::Channel) -> Self {
5805        let protocol_name =
5806            <PacketStreamControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
5807        Self { client: fidl::client::Client::new(channel, protocol_name) }
5808    }
5809
5810    /// Get a Stream of events from the remote end of the protocol.
5811    ///
5812    /// # Panics
5813    ///
5814    /// Panics if the event stream was already taken.
5815    pub fn take_event_stream(&self) -> PacketStreamControlEventStream {
5816        PacketStreamControlEventStream { event_receiver: self.client.take_event_receiver() }
5817    }
5818
5819    /// Accessor for top level static properties.
5820    pub fn r#get_properties(
5821        &self,
5822    ) -> fidl::client::QueryResponseFut<
5823        PacketStreamProperties,
5824        fdomain_client::fidl::FDomainResourceDialect,
5825    > {
5826        PacketStreamControlProxyInterface::r#get_properties(self)
5827    }
5828
5829    /// Request the driver to allocate VMOs for data transfer.
5830    /// Returns the allocated VMOs and their assigned IDs.
5831    ///
5832    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
5833    /// If the packet stream is an output stream, then the handle must also include
5834    /// ZX_RIGHT_WRITE.
5835    ///
5836    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
5837    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
5838    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
5839    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
5840    /// reconfigure.
5841    pub fn r#allocate_vmos(
5842        &self,
5843        mut payload: &AllocateVmosConfig,
5844    ) -> fidl::client::QueryResponseFut<
5845        PacketStreamControlAllocateVmosResult,
5846        fdomain_client::fidl::FDomainResourceDialect,
5847    > {
5848        PacketStreamControlProxyInterface::r#allocate_vmos(self, payload)
5849    }
5850
5851    /// Releases all VMOs previously allocated via `AllocateVmos`.
5852    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
5853    ///
5854    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
5855    /// not stopped.
5856    pub fn r#deallocate_vmos(
5857        &self,
5858    ) -> fidl::client::QueryResponseFut<
5859        PacketStreamControlDeallocateVmosResult,
5860        fdomain_client::fidl::FDomainResourceDialect,
5861    > {
5862        PacketStreamControlProxyInterface::r#deallocate_vmos(self)
5863    }
5864
5865    /// Registers client-allocated VMOs with the driver.
5866    ///
5867    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
5868    /// If the packet stream is an input stream, then the handle must also include
5869    /// ZX_RIGHT_WRITE.
5870    ///
5871    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
5872    /// or if duplicate `vmo_id`s are found.
5873    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
5874    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
5875    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
5876    /// reconfigure.
5877    pub fn r#register_vmos(
5878        &self,
5879        mut payload: RegisterVmosConfig,
5880    ) -> fidl::client::QueryResponseFut<
5881        PacketStreamControlRegisterVmosResult,
5882        fdomain_client::fidl::FDomainResourceDialect,
5883    > {
5884        PacketStreamControlProxyInterface::r#register_vmos(self, payload)
5885    }
5886
5887    /// Unregisters all VMOs previously registered via `RegisterVmos`.
5888    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
5889    ///
5890    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
5891    /// not stopped.
5892    pub fn r#unregister_vmos(
5893        &self,
5894    ) -> fidl::client::QueryResponseFut<
5895        PacketStreamControlUnregisterVmosResult,
5896        fdomain_client::fidl::FDomainResourceDialect,
5897    > {
5898        PacketStreamControlProxyInterface::r#unregister_vmos(self)
5899    }
5900
5901    /// Connects to the data sink implemented by the driver.
5902    /// This is used for audio **Output** where the driver consumes data.
5903    ///
5904    /// Flow:
5905    /// 1. App writes audio data to a registered VMO.
5906    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
5907    ///    true).
5908    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
5909    /// 4. Driver consumes the data.
5910    ///
5911    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
5912    /// and any pending requests on that channel are discarded. The new channel replaces the old
5913    /// one.
5914    ///
5915    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
5916    /// not support this method.
5917    pub fn r#get_packet_stream_sink(
5918        &self,
5919    ) -> fidl::client::QueryResponseFut<
5920        PacketStreamControlGetPacketStreamSinkResult,
5921        fdomain_client::fidl::FDomainResourceDialect,
5922    > {
5923        PacketStreamControlProxyInterface::r#get_packet_stream_sink(self)
5924    }
5925
5926    /// Provides a data sink to the driver.
5927    /// This is used for audio **Input** where the driver produces data.
5928    ///
5929    /// Flow:
5930    /// 1. Driver writes audio data to a registered VMO.
5931    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
5932    /// 3. App receives `PutPacket`.
5933    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
5934    ///    true).
5935    /// 5. App reads the data.
5936    ///
5937    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
5938    /// channel. The new channel replaces the old one.
5939    ///
5940    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
5941    /// not support this method.
5942    pub fn r#set_packet_stream_sink(
5943        &self,
5944        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
5945    ) -> fidl::client::QueryResponseFut<
5946        PacketStreamControlSetPacketStreamSinkResult,
5947        fdomain_client::fidl::FDomainResourceDialect,
5948    > {
5949        PacketStreamControlProxyInterface::r#set_packet_stream_sink(self, payload)
5950    }
5951
5952    /// Start the packet-stream.
5953    ///
5954    /// Returns `ZX_ERR_BAD_STATE` if:
5955    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
5956    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
5957    ///   `INLINE` is supported.
5958    /// * The stream is already started.
5959    pub fn r#start(
5960        &self,
5961    ) -> fidl::client::QueryResponseFut<
5962        PacketStreamControlStartResult,
5963        fdomain_client::fidl::FDomainResourceDialect,
5964    > {
5965        PacketStreamControlProxyInterface::r#start(self)
5966    }
5967
5968    /// Stop the packet-stream.
5969    ///
5970    /// Once the response is received, the stream is halted.
5971    ///
5972    /// Behavior depends on the stream direction:
5973    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
5974    ///   requests will remain pending until `Start` is called again. Clients may call
5975    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
5976    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
5977    ///   calls will be made by the driver until `Start` is called again.
5978    ///
5979    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
5980    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
5981    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
5982    ///   complete successfully after `Stop` has returned.
5983    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
5984    ///   arrive at the client after `Stop` has returned.
5985    ///
5986    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
5987    pub fn r#stop(
5988        &self,
5989    ) -> fidl::client::QueryResponseFut<
5990        PacketStreamControlStopResult,
5991        fdomain_client::fidl::FDomainResourceDialect,
5992    > {
5993        PacketStreamControlProxyInterface::r#stop(self)
5994    }
5995}
5996
5997impl PacketStreamControlProxyInterface for PacketStreamControlProxy {
5998    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
5999        PacketStreamProperties,
6000        fdomain_client::fidl::FDomainResourceDialect,
6001    >;
6002    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
6003        fn _decode(
6004            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6005        ) -> Result<PacketStreamProperties, fidl::Error> {
6006            let _response = fidl::client::decode_transaction_body::<
6007                fidl::encoding::FlexibleType<PacketStreamControlGetPropertiesResponse>,
6008                fdomain_client::fidl::FDomainResourceDialect,
6009                0x586cf4f0f8d2771f,
6010            >(_buf?)?
6011            .into_result_fdomain::<PacketStreamControlMarker>("get_properties")?;
6012            Ok(_response.properties)
6013        }
6014        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamProperties>(
6015            (),
6016            0x586cf4f0f8d2771f,
6017            fidl::encoding::DynamicFlags::FLEXIBLE,
6018            _decode,
6019        )
6020    }
6021
6022    type AllocateVmosResponseFut = fidl::client::QueryResponseFut<
6023        PacketStreamControlAllocateVmosResult,
6024        fdomain_client::fidl::FDomainResourceDialect,
6025    >;
6026    fn r#allocate_vmos(&self, mut payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut {
6027        fn _decode(
6028            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6029        ) -> Result<PacketStreamControlAllocateVmosResult, fidl::Error> {
6030            let _response = fidl::client::decode_transaction_body::<
6031                fidl::encoding::FlexibleResultType<PacketStreamControlAllocateVmosResponse, i32>,
6032                fdomain_client::fidl::FDomainResourceDialect,
6033                0x7ff1473165ed344b,
6034            >(_buf?)?
6035            .into_result_fdomain::<PacketStreamControlMarker>("allocate_vmos")?;
6036            Ok(_response.map(|x| x.vmos))
6037        }
6038        self.client
6039            .send_query_and_decode::<AllocateVmosConfig, PacketStreamControlAllocateVmosResult>(
6040                payload,
6041                0x7ff1473165ed344b,
6042                fidl::encoding::DynamicFlags::FLEXIBLE,
6043                _decode,
6044            )
6045    }
6046
6047    type DeallocateVmosResponseFut = fidl::client::QueryResponseFut<
6048        PacketStreamControlDeallocateVmosResult,
6049        fdomain_client::fidl::FDomainResourceDialect,
6050    >;
6051    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut {
6052        fn _decode(
6053            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6054        ) -> Result<PacketStreamControlDeallocateVmosResult, fidl::Error> {
6055            let _response = fidl::client::decode_transaction_body::<
6056                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6057                fdomain_client::fidl::FDomainResourceDialect,
6058                0x4db5cc85a7b8405b,
6059            >(_buf?)?
6060            .into_result_fdomain::<PacketStreamControlMarker>("deallocate_vmos")?;
6061            Ok(_response.map(|x| x))
6062        }
6063        self.client.send_query_and_decode::<
6064            fidl::encoding::EmptyPayload,
6065            PacketStreamControlDeallocateVmosResult,
6066        >(
6067            (),
6068            0x4db5cc85a7b8405b,
6069            fidl::encoding::DynamicFlags::FLEXIBLE,
6070            _decode,
6071        )
6072    }
6073
6074    type RegisterVmosResponseFut = fidl::client::QueryResponseFut<
6075        PacketStreamControlRegisterVmosResult,
6076        fdomain_client::fidl::FDomainResourceDialect,
6077    >;
6078    fn r#register_vmos(&self, mut payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut {
6079        fn _decode(
6080            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6081        ) -> Result<PacketStreamControlRegisterVmosResult, fidl::Error> {
6082            let _response = fidl::client::decode_transaction_body::<
6083                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6084                fdomain_client::fidl::FDomainResourceDialect,
6085                0x29c3b656a1020bfd,
6086            >(_buf?)?
6087            .into_result_fdomain::<PacketStreamControlMarker>("register_vmos")?;
6088            Ok(_response.map(|x| x))
6089        }
6090        self.client
6091            .send_query_and_decode::<RegisterVmosConfig, PacketStreamControlRegisterVmosResult>(
6092                &mut payload,
6093                0x29c3b656a1020bfd,
6094                fidl::encoding::DynamicFlags::FLEXIBLE,
6095                _decode,
6096            )
6097    }
6098
6099    type UnregisterVmosResponseFut = fidl::client::QueryResponseFut<
6100        PacketStreamControlUnregisterVmosResult,
6101        fdomain_client::fidl::FDomainResourceDialect,
6102    >;
6103    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut {
6104        fn _decode(
6105            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6106        ) -> Result<PacketStreamControlUnregisterVmosResult, fidl::Error> {
6107            let _response = fidl::client::decode_transaction_body::<
6108                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6109                fdomain_client::fidl::FDomainResourceDialect,
6110                0x3e3b4dbfe26b6094,
6111            >(_buf?)?
6112            .into_result_fdomain::<PacketStreamControlMarker>("unregister_vmos")?;
6113            Ok(_response.map(|x| x))
6114        }
6115        self.client.send_query_and_decode::<
6116            fidl::encoding::EmptyPayload,
6117            PacketStreamControlUnregisterVmosResult,
6118        >(
6119            (),
6120            0x3e3b4dbfe26b6094,
6121            fidl::encoding::DynamicFlags::FLEXIBLE,
6122            _decode,
6123        )
6124    }
6125
6126    type GetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
6127        PacketStreamControlGetPacketStreamSinkResult,
6128        fdomain_client::fidl::FDomainResourceDialect,
6129    >;
6130    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut {
6131        fn _decode(
6132            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6133        ) -> Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error> {
6134            let _response = fidl::client::decode_transaction_body::<
6135                fidl::encoding::FlexibleResultType<
6136                    PacketStreamControlGetPacketStreamSinkResponse,
6137                    i32,
6138                >,
6139                fdomain_client::fidl::FDomainResourceDialect,
6140                0x7394726463ebbc6a,
6141            >(_buf?)?
6142            .into_result_fdomain::<PacketStreamControlMarker>("get_packet_stream_sink")?;
6143            Ok(_response.map(|x| x))
6144        }
6145        self.client.send_query_and_decode::<
6146            fidl::encoding::EmptyPayload,
6147            PacketStreamControlGetPacketStreamSinkResult,
6148        >(
6149            (),
6150            0x7394726463ebbc6a,
6151            fidl::encoding::DynamicFlags::FLEXIBLE,
6152            _decode,
6153        )
6154    }
6155
6156    type SetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
6157        PacketStreamControlSetPacketStreamSinkResult,
6158        fdomain_client::fidl::FDomainResourceDialect,
6159    >;
6160    fn r#set_packet_stream_sink(
6161        &self,
6162        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
6163    ) -> Self::SetPacketStreamSinkResponseFut {
6164        fn _decode(
6165            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6166        ) -> Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error> {
6167            let _response = fidl::client::decode_transaction_body::<
6168                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6169                fdomain_client::fidl::FDomainResourceDialect,
6170                0xab88800e31dc0e4,
6171            >(_buf?)?
6172            .into_result_fdomain::<PacketStreamControlMarker>("set_packet_stream_sink")?;
6173            Ok(_response.map(|x| x))
6174        }
6175        self.client.send_query_and_decode::<
6176            PacketStreamControlSetPacketStreamSinkRequest,
6177            PacketStreamControlSetPacketStreamSinkResult,
6178        >(
6179            &mut payload,
6180            0xab88800e31dc0e4,
6181            fidl::encoding::DynamicFlags::FLEXIBLE,
6182            _decode,
6183        )
6184    }
6185
6186    type StartResponseFut = fidl::client::QueryResponseFut<
6187        PacketStreamControlStartResult,
6188        fdomain_client::fidl::FDomainResourceDialect,
6189    >;
6190    fn r#start(&self) -> Self::StartResponseFut {
6191        fn _decode(
6192            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6193        ) -> Result<PacketStreamControlStartResult, fidl::Error> {
6194            let _response = fidl::client::decode_transaction_body::<
6195                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6196                fdomain_client::fidl::FDomainResourceDialect,
6197                0x3a584b94d8a6bfd0,
6198            >(_buf?)?
6199            .into_result_fdomain::<PacketStreamControlMarker>("start")?;
6200            Ok(_response.map(|x| x))
6201        }
6202        self.client
6203            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStartResult>(
6204                (),
6205                0x3a584b94d8a6bfd0,
6206                fidl::encoding::DynamicFlags::FLEXIBLE,
6207                _decode,
6208            )
6209    }
6210
6211    type StopResponseFut = fidl::client::QueryResponseFut<
6212        PacketStreamControlStopResult,
6213        fdomain_client::fidl::FDomainResourceDialect,
6214    >;
6215    fn r#stop(&self) -> Self::StopResponseFut {
6216        fn _decode(
6217            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6218        ) -> Result<PacketStreamControlStopResult, fidl::Error> {
6219            let _response = fidl::client::decode_transaction_body::<
6220                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6221                fdomain_client::fidl::FDomainResourceDialect,
6222                0x703e4fafcdd7ef32,
6223            >(_buf?)?
6224            .into_result_fdomain::<PacketStreamControlMarker>("stop")?;
6225            Ok(_response.map(|x| x))
6226        }
6227        self.client
6228            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStopResult>(
6229                (),
6230                0x703e4fafcdd7ef32,
6231                fidl::encoding::DynamicFlags::FLEXIBLE,
6232                _decode,
6233            )
6234    }
6235}
6236
6237pub struct PacketStreamControlEventStream {
6238    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
6239}
6240
6241impl std::marker::Unpin for PacketStreamControlEventStream {}
6242
6243impl futures::stream::FusedStream for PacketStreamControlEventStream {
6244    fn is_terminated(&self) -> bool {
6245        self.event_receiver.is_terminated()
6246    }
6247}
6248
6249impl futures::Stream for PacketStreamControlEventStream {
6250    type Item = Result<PacketStreamControlEvent, fidl::Error>;
6251
6252    fn poll_next(
6253        mut self: std::pin::Pin<&mut Self>,
6254        cx: &mut std::task::Context<'_>,
6255    ) -> std::task::Poll<Option<Self::Item>> {
6256        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6257            &mut self.event_receiver,
6258            cx
6259        )?) {
6260            Some(buf) => std::task::Poll::Ready(Some(PacketStreamControlEvent::decode(buf))),
6261            None => std::task::Poll::Ready(None),
6262        }
6263    }
6264}
6265
6266#[derive(Debug)]
6267pub enum PacketStreamControlEvent {
6268    #[non_exhaustive]
6269    _UnknownEvent {
6270        /// Ordinal of the event that was sent.
6271        ordinal: u64,
6272    },
6273}
6274
6275impl PacketStreamControlEvent {
6276    /// Decodes a message buffer as a [`PacketStreamControlEvent`].
6277    fn decode(
6278        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6279    ) -> Result<PacketStreamControlEvent, fidl::Error> {
6280        let (bytes, _handles) = buf.split_mut();
6281        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6282        debug_assert_eq!(tx_header.tx_id, 0);
6283        match tx_header.ordinal {
6284            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6285                Ok(PacketStreamControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6286            }
6287            _ => Err(fidl::Error::UnknownOrdinal {
6288                ordinal: tx_header.ordinal,
6289                protocol_name:
6290                    <PacketStreamControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
6291            }),
6292        }
6293    }
6294}
6295
6296/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamControl.
6297pub struct PacketStreamControlRequestStream {
6298    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6299    is_terminated: bool,
6300}
6301
6302impl std::marker::Unpin for PacketStreamControlRequestStream {}
6303
6304impl futures::stream::FusedStream for PacketStreamControlRequestStream {
6305    fn is_terminated(&self) -> bool {
6306        self.is_terminated
6307    }
6308}
6309
6310impl fdomain_client::fidl::RequestStream for PacketStreamControlRequestStream {
6311    type Protocol = PacketStreamControlMarker;
6312    type ControlHandle = PacketStreamControlControlHandle;
6313
6314    fn from_channel(channel: fdomain_client::Channel) -> Self {
6315        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6316    }
6317
6318    fn control_handle(&self) -> Self::ControlHandle {
6319        PacketStreamControlControlHandle { inner: self.inner.clone() }
6320    }
6321
6322    fn into_inner(
6323        self,
6324    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
6325    {
6326        (self.inner, self.is_terminated)
6327    }
6328
6329    fn from_inner(
6330        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6331        is_terminated: bool,
6332    ) -> Self {
6333        Self { inner, is_terminated }
6334    }
6335}
6336
6337impl futures::Stream for PacketStreamControlRequestStream {
6338    type Item = Result<PacketStreamControlRequest, fidl::Error>;
6339
6340    fn poll_next(
6341        mut self: std::pin::Pin<&mut Self>,
6342        cx: &mut std::task::Context<'_>,
6343    ) -> std::task::Poll<Option<Self::Item>> {
6344        let this = &mut *self;
6345        if this.inner.check_shutdown(cx) {
6346            this.is_terminated = true;
6347            return std::task::Poll::Ready(None);
6348        }
6349        if this.is_terminated {
6350            panic!("polled PacketStreamControlRequestStream after completion");
6351        }
6352        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
6353            |bytes, handles| {
6354                match this.inner.channel().read_etc(cx, bytes, handles) {
6355                    std::task::Poll::Ready(Ok(())) => {}
6356                    std::task::Poll::Pending => return std::task::Poll::Pending,
6357                    std::task::Poll::Ready(Err(None)) => {
6358                        this.is_terminated = true;
6359                        return std::task::Poll::Ready(None);
6360                    }
6361                    std::task::Poll::Ready(Err(Some(e))) => {
6362                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6363                            e.into(),
6364                        ))));
6365                    }
6366                }
6367
6368                // A message has been received from the channel
6369                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6370
6371                std::task::Poll::Ready(Some(match header.ordinal {
6372                0x586cf4f0f8d2771f => {
6373                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6374                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6375                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6376                    let control_handle = PacketStreamControlControlHandle {
6377                        inner: this.inner.clone(),
6378                    };
6379                    Ok(PacketStreamControlRequest::GetProperties {
6380                        responder: PacketStreamControlGetPropertiesResponder {
6381                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6382                            tx_id: header.tx_id,
6383                        },
6384                    })
6385                }
6386                0x7ff1473165ed344b => {
6387                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6388                    let mut req = fidl::new_empty!(AllocateVmosConfig, fdomain_client::fidl::FDomainResourceDialect);
6389                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<AllocateVmosConfig>(&header, _body_bytes, handles, &mut req)?;
6390                    let control_handle = PacketStreamControlControlHandle {
6391                        inner: this.inner.clone(),
6392                    };
6393                    Ok(PacketStreamControlRequest::AllocateVmos {payload: req,
6394                        responder: PacketStreamControlAllocateVmosResponder {
6395                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6396                            tx_id: header.tx_id,
6397                        },
6398                    })
6399                }
6400                0x4db5cc85a7b8405b => {
6401                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6402                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6403                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6404                    let control_handle = PacketStreamControlControlHandle {
6405                        inner: this.inner.clone(),
6406                    };
6407                    Ok(PacketStreamControlRequest::DeallocateVmos {
6408                        responder: PacketStreamControlDeallocateVmosResponder {
6409                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6410                            tx_id: header.tx_id,
6411                        },
6412                    })
6413                }
6414                0x29c3b656a1020bfd => {
6415                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6416                    let mut req = fidl::new_empty!(RegisterVmosConfig, fdomain_client::fidl::FDomainResourceDialect);
6417                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RegisterVmosConfig>(&header, _body_bytes, handles, &mut req)?;
6418                    let control_handle = PacketStreamControlControlHandle {
6419                        inner: this.inner.clone(),
6420                    };
6421                    Ok(PacketStreamControlRequest::RegisterVmos {payload: req,
6422                        responder: PacketStreamControlRegisterVmosResponder {
6423                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6424                            tx_id: header.tx_id,
6425                        },
6426                    })
6427                }
6428                0x3e3b4dbfe26b6094 => {
6429                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6430                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6431                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6432                    let control_handle = PacketStreamControlControlHandle {
6433                        inner: this.inner.clone(),
6434                    };
6435                    Ok(PacketStreamControlRequest::UnregisterVmos {
6436                        responder: PacketStreamControlUnregisterVmosResponder {
6437                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6438                            tx_id: header.tx_id,
6439                        },
6440                    })
6441                }
6442                0x7394726463ebbc6a => {
6443                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6444                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6445                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6446                    let control_handle = PacketStreamControlControlHandle {
6447                        inner: this.inner.clone(),
6448                    };
6449                    Ok(PacketStreamControlRequest::GetPacketStreamSink {
6450                        responder: PacketStreamControlGetPacketStreamSinkResponder {
6451                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6452                            tx_id: header.tx_id,
6453                        },
6454                    })
6455                }
6456                0xab88800e31dc0e4 => {
6457                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6458                    let mut req = fidl::new_empty!(PacketStreamControlSetPacketStreamSinkRequest, fdomain_client::fidl::FDomainResourceDialect);
6459                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<PacketStreamControlSetPacketStreamSinkRequest>(&header, _body_bytes, handles, &mut req)?;
6460                    let control_handle = PacketStreamControlControlHandle {
6461                        inner: this.inner.clone(),
6462                    };
6463                    Ok(PacketStreamControlRequest::SetPacketStreamSink {payload: req,
6464                        responder: PacketStreamControlSetPacketStreamSinkResponder {
6465                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6466                            tx_id: header.tx_id,
6467                        },
6468                    })
6469                }
6470                0x3a584b94d8a6bfd0 => {
6471                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6472                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6473                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6474                    let control_handle = PacketStreamControlControlHandle {
6475                        inner: this.inner.clone(),
6476                    };
6477                    Ok(PacketStreamControlRequest::Start {
6478                        responder: PacketStreamControlStartResponder {
6479                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6480                            tx_id: header.tx_id,
6481                        },
6482                    })
6483                }
6484                0x703e4fafcdd7ef32 => {
6485                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6486                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6487                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6488                    let control_handle = PacketStreamControlControlHandle {
6489                        inner: this.inner.clone(),
6490                    };
6491                    Ok(PacketStreamControlRequest::Stop {
6492                        responder: PacketStreamControlStopResponder {
6493                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6494                            tx_id: header.tx_id,
6495                        },
6496                    })
6497                }
6498                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6499                    Ok(PacketStreamControlRequest::_UnknownMethod {
6500                        ordinal: header.ordinal,
6501                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
6502                        method_type: fidl::MethodType::OneWay,
6503                    })
6504                }
6505                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6506                    this.inner.send_framework_err(
6507                        fidl::encoding::FrameworkErr::UnknownMethod,
6508                        header.tx_id,
6509                        header.ordinal,
6510                        header.dynamic_flags(),
6511                        (bytes, handles),
6512                    )?;
6513                    Ok(PacketStreamControlRequest::_UnknownMethod {
6514                        ordinal: header.ordinal,
6515                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
6516                        method_type: fidl::MethodType::TwoWay,
6517                    })
6518                }
6519                _ => Err(fidl::Error::UnknownOrdinal {
6520                    ordinal: header.ordinal,
6521                    protocol_name: <PacketStreamControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
6522                }),
6523            }))
6524            },
6525        )
6526    }
6527}
6528
6529/// Control protocol for establishing and managing the packet stream.
6530#[derive(Debug)]
6531pub enum PacketStreamControlRequest {
6532    /// Accessor for top level static properties.
6533    GetProperties { responder: PacketStreamControlGetPropertiesResponder },
6534    /// Request the driver to allocate VMOs for data transfer.
6535    /// Returns the allocated VMOs and their assigned IDs.
6536    ///
6537    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6538    /// If the packet stream is an output stream, then the handle must also include
6539    /// ZX_RIGHT_WRITE.
6540    ///
6541    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
6542    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
6543    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
6544    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
6545    /// reconfigure.
6546    AllocateVmos {
6547        payload: AllocateVmosConfig,
6548        responder: PacketStreamControlAllocateVmosResponder,
6549    },
6550    /// Releases all VMOs previously allocated via `AllocateVmos`.
6551    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
6552    ///
6553    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
6554    /// not stopped.
6555    DeallocateVmos { responder: PacketStreamControlDeallocateVmosResponder },
6556    /// Registers client-allocated VMOs with the driver.
6557    ///
6558    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6559    /// If the packet stream is an input stream, then the handle must also include
6560    /// ZX_RIGHT_WRITE.
6561    ///
6562    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
6563    /// or if duplicate `vmo_id`s are found.
6564    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
6565    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
6566    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
6567    /// reconfigure.
6568    RegisterVmos {
6569        payload: RegisterVmosConfig,
6570        responder: PacketStreamControlRegisterVmosResponder,
6571    },
6572    /// Unregisters all VMOs previously registered via `RegisterVmos`.
6573    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
6574    ///
6575    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
6576    /// not stopped.
6577    UnregisterVmos { responder: PacketStreamControlUnregisterVmosResponder },
6578    /// Connects to the data sink implemented by the driver.
6579    /// This is used for audio **Output** where the driver consumes data.
6580    ///
6581    /// Flow:
6582    /// 1. App writes audio data to a registered VMO.
6583    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
6584    ///    true).
6585    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
6586    /// 4. Driver consumes the data.
6587    ///
6588    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
6589    /// and any pending requests on that channel are discarded. The new channel replaces the old
6590    /// one.
6591    ///
6592    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
6593    /// not support this method.
6594    GetPacketStreamSink { responder: PacketStreamControlGetPacketStreamSinkResponder },
6595    /// Provides a data sink to the driver.
6596    /// This is used for audio **Input** where the driver produces data.
6597    ///
6598    /// Flow:
6599    /// 1. Driver writes audio data to a registered VMO.
6600    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
6601    /// 3. App receives `PutPacket`.
6602    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
6603    ///    true).
6604    /// 5. App reads the data.
6605    ///
6606    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
6607    /// channel. The new channel replaces the old one.
6608    ///
6609    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
6610    /// not support this method.
6611    SetPacketStreamSink {
6612        payload: PacketStreamControlSetPacketStreamSinkRequest,
6613        responder: PacketStreamControlSetPacketStreamSinkResponder,
6614    },
6615    /// Start the packet-stream.
6616    ///
6617    /// Returns `ZX_ERR_BAD_STATE` if:
6618    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
6619    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
6620    ///   `INLINE` is supported.
6621    /// * The stream is already started.
6622    Start { responder: PacketStreamControlStartResponder },
6623    /// Stop the packet-stream.
6624    ///
6625    /// Once the response is received, the stream is halted.
6626    ///
6627    /// Behavior depends on the stream direction:
6628    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
6629    ///   requests will remain pending until `Start` is called again. Clients may call
6630    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
6631    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
6632    ///   calls will be made by the driver until `Start` is called again.
6633    ///
6634    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
6635    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
6636    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
6637    ///   complete successfully after `Stop` has returned.
6638    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
6639    ///   arrive at the client after `Stop` has returned.
6640    ///
6641    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
6642    Stop { responder: PacketStreamControlStopResponder },
6643    /// An interaction was received which does not match any known method.
6644    #[non_exhaustive]
6645    _UnknownMethod {
6646        /// Ordinal of the method that was called.
6647        ordinal: u64,
6648        control_handle: PacketStreamControlControlHandle,
6649        method_type: fidl::MethodType,
6650    },
6651}
6652
6653impl PacketStreamControlRequest {
6654    #[allow(irrefutable_let_patterns)]
6655    pub fn into_get_properties(self) -> Option<(PacketStreamControlGetPropertiesResponder)> {
6656        if let PacketStreamControlRequest::GetProperties { responder } = self {
6657            Some((responder))
6658        } else {
6659            None
6660        }
6661    }
6662
6663    #[allow(irrefutable_let_patterns)]
6664    pub fn into_allocate_vmos(
6665        self,
6666    ) -> Option<(AllocateVmosConfig, PacketStreamControlAllocateVmosResponder)> {
6667        if let PacketStreamControlRequest::AllocateVmos { payload, responder } = self {
6668            Some((payload, responder))
6669        } else {
6670            None
6671        }
6672    }
6673
6674    #[allow(irrefutable_let_patterns)]
6675    pub fn into_deallocate_vmos(self) -> Option<(PacketStreamControlDeallocateVmosResponder)> {
6676        if let PacketStreamControlRequest::DeallocateVmos { responder } = self {
6677            Some((responder))
6678        } else {
6679            None
6680        }
6681    }
6682
6683    #[allow(irrefutable_let_patterns)]
6684    pub fn into_register_vmos(
6685        self,
6686    ) -> Option<(RegisterVmosConfig, PacketStreamControlRegisterVmosResponder)> {
6687        if let PacketStreamControlRequest::RegisterVmos { payload, responder } = self {
6688            Some((payload, responder))
6689        } else {
6690            None
6691        }
6692    }
6693
6694    #[allow(irrefutable_let_patterns)]
6695    pub fn into_unregister_vmos(self) -> Option<(PacketStreamControlUnregisterVmosResponder)> {
6696        if let PacketStreamControlRequest::UnregisterVmos { responder } = self {
6697            Some((responder))
6698        } else {
6699            None
6700        }
6701    }
6702
6703    #[allow(irrefutable_let_patterns)]
6704    pub fn into_get_packet_stream_sink(
6705        self,
6706    ) -> Option<(PacketStreamControlGetPacketStreamSinkResponder)> {
6707        if let PacketStreamControlRequest::GetPacketStreamSink { responder } = self {
6708            Some((responder))
6709        } else {
6710            None
6711        }
6712    }
6713
6714    #[allow(irrefutable_let_patterns)]
6715    pub fn into_set_packet_stream_sink(
6716        self,
6717    ) -> Option<(
6718        PacketStreamControlSetPacketStreamSinkRequest,
6719        PacketStreamControlSetPacketStreamSinkResponder,
6720    )> {
6721        if let PacketStreamControlRequest::SetPacketStreamSink { payload, responder } = self {
6722            Some((payload, responder))
6723        } else {
6724            None
6725        }
6726    }
6727
6728    #[allow(irrefutable_let_patterns)]
6729    pub fn into_start(self) -> Option<(PacketStreamControlStartResponder)> {
6730        if let PacketStreamControlRequest::Start { responder } = self {
6731            Some((responder))
6732        } else {
6733            None
6734        }
6735    }
6736
6737    #[allow(irrefutable_let_patterns)]
6738    pub fn into_stop(self) -> Option<(PacketStreamControlStopResponder)> {
6739        if let PacketStreamControlRequest::Stop { responder } = self {
6740            Some((responder))
6741        } else {
6742            None
6743        }
6744    }
6745
6746    /// Name of the method defined in FIDL
6747    pub fn method_name(&self) -> &'static str {
6748        match *self {
6749            PacketStreamControlRequest::GetProperties { .. } => "get_properties",
6750            PacketStreamControlRequest::AllocateVmos { .. } => "allocate_vmos",
6751            PacketStreamControlRequest::DeallocateVmos { .. } => "deallocate_vmos",
6752            PacketStreamControlRequest::RegisterVmos { .. } => "register_vmos",
6753            PacketStreamControlRequest::UnregisterVmos { .. } => "unregister_vmos",
6754            PacketStreamControlRequest::GetPacketStreamSink { .. } => "get_packet_stream_sink",
6755            PacketStreamControlRequest::SetPacketStreamSink { .. } => "set_packet_stream_sink",
6756            PacketStreamControlRequest::Start { .. } => "start",
6757            PacketStreamControlRequest::Stop { .. } => "stop",
6758            PacketStreamControlRequest::_UnknownMethod {
6759                method_type: fidl::MethodType::OneWay,
6760                ..
6761            } => "unknown one-way method",
6762            PacketStreamControlRequest::_UnknownMethod {
6763                method_type: fidl::MethodType::TwoWay,
6764                ..
6765            } => "unknown two-way method",
6766        }
6767    }
6768}
6769
6770#[derive(Debug, Clone)]
6771pub struct PacketStreamControlControlHandle {
6772    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6773}
6774
6775impl fdomain_client::fidl::ControlHandle for PacketStreamControlControlHandle {
6776    fn shutdown(&self) {
6777        self.inner.shutdown()
6778    }
6779
6780    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6781        self.inner.shutdown_with_epitaph(status)
6782    }
6783
6784    fn is_closed(&self) -> bool {
6785        self.inner.channel().is_closed()
6786    }
6787    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
6788        self.inner.channel().on_closed()
6789    }
6790}
6791
6792impl PacketStreamControlControlHandle {}
6793
6794#[must_use = "FIDL methods require a response to be sent"]
6795#[derive(Debug)]
6796pub struct PacketStreamControlGetPropertiesResponder {
6797    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
6798    tx_id: u32,
6799}
6800
6801/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
6802/// if the responder is dropped without sending a response, so that the client
6803/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6804impl std::ops::Drop for PacketStreamControlGetPropertiesResponder {
6805    fn drop(&mut self) {
6806        self.control_handle.shutdown();
6807        // Safety: drops once, never accessed again
6808        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6809    }
6810}
6811
6812impl fdomain_client::fidl::Responder for PacketStreamControlGetPropertiesResponder {
6813    type ControlHandle = PacketStreamControlControlHandle;
6814
6815    fn control_handle(&self) -> &PacketStreamControlControlHandle {
6816        &self.control_handle
6817    }
6818
6819    fn drop_without_shutdown(mut self) {
6820        // Safety: drops once, never accessed again due to mem::forget
6821        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6822        // Prevent Drop from running (which would shut down the channel)
6823        std::mem::forget(self);
6824    }
6825}
6826
6827impl PacketStreamControlGetPropertiesResponder {
6828    /// Sends a response to the FIDL transaction.
6829    ///
6830    /// Sets the channel to shutdown if an error occurs.
6831    pub fn send(self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
6832        let _result = self.send_raw(properties);
6833        if _result.is_err() {
6834            self.control_handle.shutdown();
6835        }
6836        self.drop_without_shutdown();
6837        _result
6838    }
6839
6840    /// Similar to "send" but does not shutdown the channel if an error occurs.
6841    pub fn send_no_shutdown_on_err(
6842        self,
6843        mut properties: &PacketStreamProperties,
6844    ) -> Result<(), fidl::Error> {
6845        let _result = self.send_raw(properties);
6846        self.drop_without_shutdown();
6847        _result
6848    }
6849
6850    fn send_raw(&self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
6851        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
6852            PacketStreamControlGetPropertiesResponse,
6853        >>(
6854            fidl::encoding::Flexible::new((properties,)),
6855            self.tx_id,
6856            0x586cf4f0f8d2771f,
6857            fidl::encoding::DynamicFlags::FLEXIBLE,
6858        )
6859    }
6860}
6861
6862#[must_use = "FIDL methods require a response to be sent"]
6863#[derive(Debug)]
6864pub struct PacketStreamControlAllocateVmosResponder {
6865    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
6866    tx_id: u32,
6867}
6868
6869/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
6870/// if the responder is dropped without sending a response, so that the client
6871/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6872impl std::ops::Drop for PacketStreamControlAllocateVmosResponder {
6873    fn drop(&mut self) {
6874        self.control_handle.shutdown();
6875        // Safety: drops once, never accessed again
6876        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6877    }
6878}
6879
6880impl fdomain_client::fidl::Responder for PacketStreamControlAllocateVmosResponder {
6881    type ControlHandle = PacketStreamControlControlHandle;
6882
6883    fn control_handle(&self) -> &PacketStreamControlControlHandle {
6884        &self.control_handle
6885    }
6886
6887    fn drop_without_shutdown(mut self) {
6888        // Safety: drops once, never accessed again due to mem::forget
6889        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6890        // Prevent Drop from running (which would shut down the channel)
6891        std::mem::forget(self);
6892    }
6893}
6894
6895impl PacketStreamControlAllocateVmosResponder {
6896    /// Sends a response to the FIDL transaction.
6897    ///
6898    /// Sets the channel to shutdown if an error occurs.
6899    pub fn send(self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
6900        let _result = self.send_raw(result);
6901        if _result.is_err() {
6902            self.control_handle.shutdown();
6903        }
6904        self.drop_without_shutdown();
6905        _result
6906    }
6907
6908    /// Similar to "send" but does not shutdown the channel if an error occurs.
6909    pub fn send_no_shutdown_on_err(
6910        self,
6911        mut result: Result<Vec<VmoInfo>, i32>,
6912    ) -> Result<(), fidl::Error> {
6913        let _result = self.send_raw(result);
6914        self.drop_without_shutdown();
6915        _result
6916    }
6917
6918    fn send_raw(&self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
6919        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6920            PacketStreamControlAllocateVmosResponse,
6921            i32,
6922        >>(
6923            fidl::encoding::FlexibleResult::new(
6924                result.as_mut().map_err(|e| *e).map(|vmos| (vmos.as_mut_slice(),)),
6925            ),
6926            self.tx_id,
6927            0x7ff1473165ed344b,
6928            fidl::encoding::DynamicFlags::FLEXIBLE,
6929        )
6930    }
6931}
6932
6933#[must_use = "FIDL methods require a response to be sent"]
6934#[derive(Debug)]
6935pub struct PacketStreamControlDeallocateVmosResponder {
6936    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
6937    tx_id: u32,
6938}
6939
6940/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
6941/// if the responder is dropped without sending a response, so that the client
6942/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6943impl std::ops::Drop for PacketStreamControlDeallocateVmosResponder {
6944    fn drop(&mut self) {
6945        self.control_handle.shutdown();
6946        // Safety: drops once, never accessed again
6947        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6948    }
6949}
6950
6951impl fdomain_client::fidl::Responder for PacketStreamControlDeallocateVmosResponder {
6952    type ControlHandle = PacketStreamControlControlHandle;
6953
6954    fn control_handle(&self) -> &PacketStreamControlControlHandle {
6955        &self.control_handle
6956    }
6957
6958    fn drop_without_shutdown(mut self) {
6959        // Safety: drops once, never accessed again due to mem::forget
6960        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6961        // Prevent Drop from running (which would shut down the channel)
6962        std::mem::forget(self);
6963    }
6964}
6965
6966impl PacketStreamControlDeallocateVmosResponder {
6967    /// Sends a response to the FIDL transaction.
6968    ///
6969    /// Sets the channel to shutdown if an error occurs.
6970    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6971        let _result = self.send_raw(result);
6972        if _result.is_err() {
6973            self.control_handle.shutdown();
6974        }
6975        self.drop_without_shutdown();
6976        _result
6977    }
6978
6979    /// Similar to "send" but does not shutdown the channel if an error occurs.
6980    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6981        let _result = self.send_raw(result);
6982        self.drop_without_shutdown();
6983        _result
6984    }
6985
6986    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6987        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6988            fidl::encoding::EmptyStruct,
6989            i32,
6990        >>(
6991            fidl::encoding::FlexibleResult::new(result),
6992            self.tx_id,
6993            0x4db5cc85a7b8405b,
6994            fidl::encoding::DynamicFlags::FLEXIBLE,
6995        )
6996    }
6997}
6998
6999#[must_use = "FIDL methods require a response to be sent"]
7000#[derive(Debug)]
7001pub struct PacketStreamControlRegisterVmosResponder {
7002    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7003    tx_id: u32,
7004}
7005
7006/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7007/// if the responder is dropped without sending a response, so that the client
7008/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7009impl std::ops::Drop for PacketStreamControlRegisterVmosResponder {
7010    fn drop(&mut self) {
7011        self.control_handle.shutdown();
7012        // Safety: drops once, never accessed again
7013        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7014    }
7015}
7016
7017impl fdomain_client::fidl::Responder for PacketStreamControlRegisterVmosResponder {
7018    type ControlHandle = PacketStreamControlControlHandle;
7019
7020    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7021        &self.control_handle
7022    }
7023
7024    fn drop_without_shutdown(mut self) {
7025        // Safety: drops once, never accessed again due to mem::forget
7026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7027        // Prevent Drop from running (which would shut down the channel)
7028        std::mem::forget(self);
7029    }
7030}
7031
7032impl PacketStreamControlRegisterVmosResponder {
7033    /// Sends a response to the FIDL transaction.
7034    ///
7035    /// Sets the channel to shutdown if an error occurs.
7036    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7037        let _result = self.send_raw(result);
7038        if _result.is_err() {
7039            self.control_handle.shutdown();
7040        }
7041        self.drop_without_shutdown();
7042        _result
7043    }
7044
7045    /// Similar to "send" but does not shutdown the channel if an error occurs.
7046    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7047        let _result = self.send_raw(result);
7048        self.drop_without_shutdown();
7049        _result
7050    }
7051
7052    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7053        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7054            fidl::encoding::EmptyStruct,
7055            i32,
7056        >>(
7057            fidl::encoding::FlexibleResult::new(result),
7058            self.tx_id,
7059            0x29c3b656a1020bfd,
7060            fidl::encoding::DynamicFlags::FLEXIBLE,
7061        )
7062    }
7063}
7064
7065#[must_use = "FIDL methods require a response to be sent"]
7066#[derive(Debug)]
7067pub struct PacketStreamControlUnregisterVmosResponder {
7068    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7069    tx_id: u32,
7070}
7071
7072/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7073/// if the responder is dropped without sending a response, so that the client
7074/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7075impl std::ops::Drop for PacketStreamControlUnregisterVmosResponder {
7076    fn drop(&mut self) {
7077        self.control_handle.shutdown();
7078        // Safety: drops once, never accessed again
7079        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7080    }
7081}
7082
7083impl fdomain_client::fidl::Responder for PacketStreamControlUnregisterVmosResponder {
7084    type ControlHandle = PacketStreamControlControlHandle;
7085
7086    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7087        &self.control_handle
7088    }
7089
7090    fn drop_without_shutdown(mut self) {
7091        // Safety: drops once, never accessed again due to mem::forget
7092        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7093        // Prevent Drop from running (which would shut down the channel)
7094        std::mem::forget(self);
7095    }
7096}
7097
7098impl PacketStreamControlUnregisterVmosResponder {
7099    /// Sends a response to the FIDL transaction.
7100    ///
7101    /// Sets the channel to shutdown if an error occurs.
7102    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7103        let _result = self.send_raw(result);
7104        if _result.is_err() {
7105            self.control_handle.shutdown();
7106        }
7107        self.drop_without_shutdown();
7108        _result
7109    }
7110
7111    /// Similar to "send" but does not shutdown the channel if an error occurs.
7112    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7113        let _result = self.send_raw(result);
7114        self.drop_without_shutdown();
7115        _result
7116    }
7117
7118    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7119        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7120            fidl::encoding::EmptyStruct,
7121            i32,
7122        >>(
7123            fidl::encoding::FlexibleResult::new(result),
7124            self.tx_id,
7125            0x3e3b4dbfe26b6094,
7126            fidl::encoding::DynamicFlags::FLEXIBLE,
7127        )
7128    }
7129}
7130
7131#[must_use = "FIDL methods require a response to be sent"]
7132#[derive(Debug)]
7133pub struct PacketStreamControlGetPacketStreamSinkResponder {
7134    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7135    tx_id: u32,
7136}
7137
7138/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7139/// if the responder is dropped without sending a response, so that the client
7140/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7141impl std::ops::Drop for PacketStreamControlGetPacketStreamSinkResponder {
7142    fn drop(&mut self) {
7143        self.control_handle.shutdown();
7144        // Safety: drops once, never accessed again
7145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7146    }
7147}
7148
7149impl fdomain_client::fidl::Responder for PacketStreamControlGetPacketStreamSinkResponder {
7150    type ControlHandle = PacketStreamControlControlHandle;
7151
7152    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7153        &self.control_handle
7154    }
7155
7156    fn drop_without_shutdown(mut self) {
7157        // Safety: drops once, never accessed again due to mem::forget
7158        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7159        // Prevent Drop from running (which would shut down the channel)
7160        std::mem::forget(self);
7161    }
7162}
7163
7164impl PacketStreamControlGetPacketStreamSinkResponder {
7165    /// Sends a response to the FIDL transaction.
7166    ///
7167    /// Sets the channel to shutdown if an error occurs.
7168    pub fn send(
7169        self,
7170        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
7171    ) -> Result<(), fidl::Error> {
7172        let _result = self.send_raw(result);
7173        if _result.is_err() {
7174            self.control_handle.shutdown();
7175        }
7176        self.drop_without_shutdown();
7177        _result
7178    }
7179
7180    /// Similar to "send" but does not shutdown the channel if an error occurs.
7181    pub fn send_no_shutdown_on_err(
7182        self,
7183        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
7184    ) -> Result<(), fidl::Error> {
7185        let _result = self.send_raw(result);
7186        self.drop_without_shutdown();
7187        _result
7188    }
7189
7190    fn send_raw(
7191        &self,
7192        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
7193    ) -> Result<(), fidl::Error> {
7194        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7195            PacketStreamControlGetPacketStreamSinkResponse,
7196            i32,
7197        >>(
7198            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
7199            self.tx_id,
7200            0x7394726463ebbc6a,
7201            fidl::encoding::DynamicFlags::FLEXIBLE,
7202        )
7203    }
7204}
7205
7206#[must_use = "FIDL methods require a response to be sent"]
7207#[derive(Debug)]
7208pub struct PacketStreamControlSetPacketStreamSinkResponder {
7209    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7210    tx_id: u32,
7211}
7212
7213/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7214/// if the responder is dropped without sending a response, so that the client
7215/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7216impl std::ops::Drop for PacketStreamControlSetPacketStreamSinkResponder {
7217    fn drop(&mut self) {
7218        self.control_handle.shutdown();
7219        // Safety: drops once, never accessed again
7220        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7221    }
7222}
7223
7224impl fdomain_client::fidl::Responder for PacketStreamControlSetPacketStreamSinkResponder {
7225    type ControlHandle = PacketStreamControlControlHandle;
7226
7227    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7228        &self.control_handle
7229    }
7230
7231    fn drop_without_shutdown(mut self) {
7232        // Safety: drops once, never accessed again due to mem::forget
7233        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7234        // Prevent Drop from running (which would shut down the channel)
7235        std::mem::forget(self);
7236    }
7237}
7238
7239impl PacketStreamControlSetPacketStreamSinkResponder {
7240    /// Sends a response to the FIDL transaction.
7241    ///
7242    /// Sets the channel to shutdown if an error occurs.
7243    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7244        let _result = self.send_raw(result);
7245        if _result.is_err() {
7246            self.control_handle.shutdown();
7247        }
7248        self.drop_without_shutdown();
7249        _result
7250    }
7251
7252    /// Similar to "send" but does not shutdown the channel if an error occurs.
7253    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7254        let _result = self.send_raw(result);
7255        self.drop_without_shutdown();
7256        _result
7257    }
7258
7259    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7260        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7261            fidl::encoding::EmptyStruct,
7262            i32,
7263        >>(
7264            fidl::encoding::FlexibleResult::new(result),
7265            self.tx_id,
7266            0xab88800e31dc0e4,
7267            fidl::encoding::DynamicFlags::FLEXIBLE,
7268        )
7269    }
7270}
7271
7272#[must_use = "FIDL methods require a response to be sent"]
7273#[derive(Debug)]
7274pub struct PacketStreamControlStartResponder {
7275    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7276    tx_id: u32,
7277}
7278
7279/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7280/// if the responder is dropped without sending a response, so that the client
7281/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7282impl std::ops::Drop for PacketStreamControlStartResponder {
7283    fn drop(&mut self) {
7284        self.control_handle.shutdown();
7285        // Safety: drops once, never accessed again
7286        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7287    }
7288}
7289
7290impl fdomain_client::fidl::Responder for PacketStreamControlStartResponder {
7291    type ControlHandle = PacketStreamControlControlHandle;
7292
7293    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7294        &self.control_handle
7295    }
7296
7297    fn drop_without_shutdown(mut self) {
7298        // Safety: drops once, never accessed again due to mem::forget
7299        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7300        // Prevent Drop from running (which would shut down the channel)
7301        std::mem::forget(self);
7302    }
7303}
7304
7305impl PacketStreamControlStartResponder {
7306    /// Sends a response to the FIDL transaction.
7307    ///
7308    /// Sets the channel to shutdown if an error occurs.
7309    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7310        let _result = self.send_raw(result);
7311        if _result.is_err() {
7312            self.control_handle.shutdown();
7313        }
7314        self.drop_without_shutdown();
7315        _result
7316    }
7317
7318    /// Similar to "send" but does not shutdown the channel if an error occurs.
7319    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7320        let _result = self.send_raw(result);
7321        self.drop_without_shutdown();
7322        _result
7323    }
7324
7325    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7326        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7327            fidl::encoding::EmptyStruct,
7328            i32,
7329        >>(
7330            fidl::encoding::FlexibleResult::new(result),
7331            self.tx_id,
7332            0x3a584b94d8a6bfd0,
7333            fidl::encoding::DynamicFlags::FLEXIBLE,
7334        )
7335    }
7336}
7337
7338#[must_use = "FIDL methods require a response to be sent"]
7339#[derive(Debug)]
7340pub struct PacketStreamControlStopResponder {
7341    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7342    tx_id: u32,
7343}
7344
7345/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7346/// if the responder is dropped without sending a response, so that the client
7347/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7348impl std::ops::Drop for PacketStreamControlStopResponder {
7349    fn drop(&mut self) {
7350        self.control_handle.shutdown();
7351        // Safety: drops once, never accessed again
7352        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7353    }
7354}
7355
7356impl fdomain_client::fidl::Responder for PacketStreamControlStopResponder {
7357    type ControlHandle = PacketStreamControlControlHandle;
7358
7359    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7360        &self.control_handle
7361    }
7362
7363    fn drop_without_shutdown(mut self) {
7364        // Safety: drops once, never accessed again due to mem::forget
7365        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7366        // Prevent Drop from running (which would shut down the channel)
7367        std::mem::forget(self);
7368    }
7369}
7370
7371impl PacketStreamControlStopResponder {
7372    /// Sends a response to the FIDL transaction.
7373    ///
7374    /// Sets the channel to shutdown if an error occurs.
7375    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7376        let _result = self.send_raw(result);
7377        if _result.is_err() {
7378            self.control_handle.shutdown();
7379        }
7380        self.drop_without_shutdown();
7381        _result
7382    }
7383
7384    /// Similar to "send" but does not shutdown the channel if an error occurs.
7385    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7386        let _result = self.send_raw(result);
7387        self.drop_without_shutdown();
7388        _result
7389    }
7390
7391    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7392        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7393            fidl::encoding::EmptyStruct,
7394            i32,
7395        >>(
7396            fidl::encoding::FlexibleResult::new(result),
7397            self.tx_id,
7398            0x703e4fafcdd7ef32,
7399            fidl::encoding::DynamicFlags::FLEXIBLE,
7400        )
7401    }
7402}
7403
7404#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7405pub struct PacketStreamSinkMarker;
7406
7407impl fdomain_client::fidl::ProtocolMarker for PacketStreamSinkMarker {
7408    type Proxy = PacketStreamSinkProxy;
7409    type RequestStream = PacketStreamSinkRequestStream;
7410
7411    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamSink";
7412}
7413pub type PacketStreamSinkPutPacketResult = Result<PacketStreamSinkPutPacketResponse, i32>;
7414pub type PacketStreamSinkFlushPacketsResult = Result<(), i32>;
7415
7416pub trait PacketStreamSinkProxyInterface: Send + Sync {
7417    type PutPacketResponseFut: std::future::Future<Output = Result<PacketStreamSinkPutPacketResult, fidl::Error>>
7418        + Send;
7419    fn r#put_packet(&self, payload: PacketStreamSinkPutPacketRequest)
7420    -> Self::PutPacketResponseFut;
7421    type FlushPacketsResponseFut: std::future::Future<Output = Result<PacketStreamSinkFlushPacketsResult, fidl::Error>>
7422        + Send;
7423    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut;
7424}
7425
7426#[derive(Debug, Clone)]
7427pub struct PacketStreamSinkProxy {
7428    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
7429}
7430
7431impl fdomain_client::fidl::Proxy for PacketStreamSinkProxy {
7432    type Protocol = PacketStreamSinkMarker;
7433
7434    fn from_channel(inner: fdomain_client::Channel) -> Self {
7435        Self::new(inner)
7436    }
7437
7438    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
7439        self.client.into_channel().map_err(|client| Self { client })
7440    }
7441
7442    fn as_channel(&self) -> &fdomain_client::Channel {
7443        self.client.as_channel()
7444    }
7445}
7446
7447impl PacketStreamSinkProxy {
7448    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamSink.
7449    pub fn new(channel: fdomain_client::Channel) -> Self {
7450        let protocol_name =
7451            <PacketStreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
7452        Self { client: fidl::client::Client::new(channel, protocol_name) }
7453    }
7454
7455    /// Get a Stream of events from the remote end of the protocol.
7456    ///
7457    /// # Panics
7458    ///
7459    /// Panics if the event stream was already taken.
7460    pub fn take_event_stream(&self) -> PacketStreamSinkEventStream {
7461        PacketStreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
7462    }
7463
7464    /// Submits a packet to be processed by the server.
7465    ///
7466    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
7467    /// Packets are processed in the order they were submitted. This call
7468    /// blocks until the payload is processed. When this call returns, the
7469    /// buffer region is guaranteed to be available for reuse.
7470    ///
7471    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
7472    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
7473    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
7474    /// * The payload is missing.
7475    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
7476    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
7477    ///   `DRIVER_OWNED`.
7478    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
7479    ///
7480    /// Note: The server is not required to detect if a VMO region is currently in use by a
7481    /// previous pending packet. Clients are responsible for managing buffer usage.
7482    pub fn r#put_packet(
7483        &self,
7484        mut payload: PacketStreamSinkPutPacketRequest,
7485    ) -> fidl::client::QueryResponseFut<
7486        PacketStreamSinkPutPacketResult,
7487        fdomain_client::fidl::FDomainResourceDialect,
7488    > {
7489        PacketStreamSinkProxyInterface::r#put_packet(self, payload)
7490    }
7491
7492    /// Flushes all packets currently pending without processing them.
7493    /// This call waits until all pending packets are completed or canceled.
7494    ///
7495    /// Note: A packet may be partially processed (e.g. if it contains multiple
7496    /// audio frames, or if the data does not align with encoded frame boundaries)
7497    /// before it is canceled.
7498    pub fn r#flush_packets(
7499        &self,
7500    ) -> fidl::client::QueryResponseFut<
7501        PacketStreamSinkFlushPacketsResult,
7502        fdomain_client::fidl::FDomainResourceDialect,
7503    > {
7504        PacketStreamSinkProxyInterface::r#flush_packets(self)
7505    }
7506}
7507
7508impl PacketStreamSinkProxyInterface for PacketStreamSinkProxy {
7509    type PutPacketResponseFut = fidl::client::QueryResponseFut<
7510        PacketStreamSinkPutPacketResult,
7511        fdomain_client::fidl::FDomainResourceDialect,
7512    >;
7513    fn r#put_packet(
7514        &self,
7515        mut payload: PacketStreamSinkPutPacketRequest,
7516    ) -> Self::PutPacketResponseFut {
7517        fn _decode(
7518            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7519        ) -> Result<PacketStreamSinkPutPacketResult, fidl::Error> {
7520            let _response = fidl::client::decode_transaction_body::<
7521                fidl::encoding::FlexibleResultType<PacketStreamSinkPutPacketResponse, i32>,
7522                fdomain_client::fidl::FDomainResourceDialect,
7523                0x25a8e35efba81f2b,
7524            >(_buf?)?
7525            .into_result_fdomain::<PacketStreamSinkMarker>("put_packet")?;
7526            Ok(_response.map(|x| x))
7527        }
7528        self.client.send_query_and_decode::<
7529            PacketStreamSinkPutPacketRequest,
7530            PacketStreamSinkPutPacketResult,
7531        >(
7532            &mut payload,
7533            0x25a8e35efba81f2b,
7534            fidl::encoding::DynamicFlags::FLEXIBLE,
7535            _decode,
7536        )
7537    }
7538
7539    type FlushPacketsResponseFut = fidl::client::QueryResponseFut<
7540        PacketStreamSinkFlushPacketsResult,
7541        fdomain_client::fidl::FDomainResourceDialect,
7542    >;
7543    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut {
7544        fn _decode(
7545            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7546        ) -> Result<PacketStreamSinkFlushPacketsResult, fidl::Error> {
7547            let _response = fidl::client::decode_transaction_body::<
7548                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7549                fdomain_client::fidl::FDomainResourceDialect,
7550                0x13f16ca37ede8a4,
7551            >(_buf?)?
7552            .into_result_fdomain::<PacketStreamSinkMarker>("flush_packets")?;
7553            Ok(_response.map(|x| x))
7554        }
7555        self.client.send_query_and_decode::<
7556            fidl::encoding::EmptyPayload,
7557            PacketStreamSinkFlushPacketsResult,
7558        >(
7559            (),
7560            0x13f16ca37ede8a4,
7561            fidl::encoding::DynamicFlags::FLEXIBLE,
7562            _decode,
7563        )
7564    }
7565}
7566
7567pub struct PacketStreamSinkEventStream {
7568    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
7569}
7570
7571impl std::marker::Unpin for PacketStreamSinkEventStream {}
7572
7573impl futures::stream::FusedStream for PacketStreamSinkEventStream {
7574    fn is_terminated(&self) -> bool {
7575        self.event_receiver.is_terminated()
7576    }
7577}
7578
7579impl futures::Stream for PacketStreamSinkEventStream {
7580    type Item = Result<PacketStreamSinkEvent, fidl::Error>;
7581
7582    fn poll_next(
7583        mut self: std::pin::Pin<&mut Self>,
7584        cx: &mut std::task::Context<'_>,
7585    ) -> std::task::Poll<Option<Self::Item>> {
7586        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7587            &mut self.event_receiver,
7588            cx
7589        )?) {
7590            Some(buf) => std::task::Poll::Ready(Some(PacketStreamSinkEvent::decode(buf))),
7591            None => std::task::Poll::Ready(None),
7592        }
7593    }
7594}
7595
7596#[derive(Debug)]
7597pub enum PacketStreamSinkEvent {
7598    #[non_exhaustive]
7599    _UnknownEvent {
7600        /// Ordinal of the event that was sent.
7601        ordinal: u64,
7602    },
7603}
7604
7605impl PacketStreamSinkEvent {
7606    /// Decodes a message buffer as a [`PacketStreamSinkEvent`].
7607    fn decode(
7608        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7609    ) -> Result<PacketStreamSinkEvent, fidl::Error> {
7610        let (bytes, _handles) = buf.split_mut();
7611        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7612        debug_assert_eq!(tx_header.tx_id, 0);
7613        match tx_header.ordinal {
7614            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7615                Ok(PacketStreamSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7616            }
7617            _ => Err(fidl::Error::UnknownOrdinal {
7618                ordinal: tx_header.ordinal,
7619                protocol_name:
7620                    <PacketStreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7621            }),
7622        }
7623    }
7624}
7625
7626/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamSink.
7627pub struct PacketStreamSinkRequestStream {
7628    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7629    is_terminated: bool,
7630}
7631
7632impl std::marker::Unpin for PacketStreamSinkRequestStream {}
7633
7634impl futures::stream::FusedStream for PacketStreamSinkRequestStream {
7635    fn is_terminated(&self) -> bool {
7636        self.is_terminated
7637    }
7638}
7639
7640impl fdomain_client::fidl::RequestStream for PacketStreamSinkRequestStream {
7641    type Protocol = PacketStreamSinkMarker;
7642    type ControlHandle = PacketStreamSinkControlHandle;
7643
7644    fn from_channel(channel: fdomain_client::Channel) -> Self {
7645        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7646    }
7647
7648    fn control_handle(&self) -> Self::ControlHandle {
7649        PacketStreamSinkControlHandle { inner: self.inner.clone() }
7650    }
7651
7652    fn into_inner(
7653        self,
7654    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
7655    {
7656        (self.inner, self.is_terminated)
7657    }
7658
7659    fn from_inner(
7660        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7661        is_terminated: bool,
7662    ) -> Self {
7663        Self { inner, is_terminated }
7664    }
7665}
7666
7667impl futures::Stream for PacketStreamSinkRequestStream {
7668    type Item = Result<PacketStreamSinkRequest, fidl::Error>;
7669
7670    fn poll_next(
7671        mut self: std::pin::Pin<&mut Self>,
7672        cx: &mut std::task::Context<'_>,
7673    ) -> std::task::Poll<Option<Self::Item>> {
7674        let this = &mut *self;
7675        if this.inner.check_shutdown(cx) {
7676            this.is_terminated = true;
7677            return std::task::Poll::Ready(None);
7678        }
7679        if this.is_terminated {
7680            panic!("polled PacketStreamSinkRequestStream after completion");
7681        }
7682        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
7683            |bytes, handles| {
7684                match this.inner.channel().read_etc(cx, bytes, handles) {
7685                    std::task::Poll::Ready(Ok(())) => {}
7686                    std::task::Poll::Pending => return std::task::Poll::Pending,
7687                    std::task::Poll::Ready(Err(None)) => {
7688                        this.is_terminated = true;
7689                        return std::task::Poll::Ready(None);
7690                    }
7691                    std::task::Poll::Ready(Err(Some(e))) => {
7692                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7693                            e.into(),
7694                        ))));
7695                    }
7696                }
7697
7698                // A message has been received from the channel
7699                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7700
7701                std::task::Poll::Ready(Some(match header.ordinal {
7702                0x25a8e35efba81f2b => {
7703                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7704                    let mut req = fidl::new_empty!(PacketStreamSinkPutPacketRequest, fdomain_client::fidl::FDomainResourceDialect);
7705                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<PacketStreamSinkPutPacketRequest>(&header, _body_bytes, handles, &mut req)?;
7706                    let control_handle = PacketStreamSinkControlHandle {
7707                        inner: this.inner.clone(),
7708                    };
7709                    Ok(PacketStreamSinkRequest::PutPacket {payload: req,
7710                        responder: PacketStreamSinkPutPacketResponder {
7711                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7712                            tx_id: header.tx_id,
7713                        },
7714                    })
7715                }
7716                0x13f16ca37ede8a4 => {
7717                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7718                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
7719                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7720                    let control_handle = PacketStreamSinkControlHandle {
7721                        inner: this.inner.clone(),
7722                    };
7723                    Ok(PacketStreamSinkRequest::FlushPackets {
7724                        responder: PacketStreamSinkFlushPacketsResponder {
7725                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7726                            tx_id: header.tx_id,
7727                        },
7728                    })
7729                }
7730                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7731                    Ok(PacketStreamSinkRequest::_UnknownMethod {
7732                        ordinal: header.ordinal,
7733                        control_handle: PacketStreamSinkControlHandle { inner: this.inner.clone() },
7734                        method_type: fidl::MethodType::OneWay,
7735                    })
7736                }
7737                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7738                    this.inner.send_framework_err(
7739                        fidl::encoding::FrameworkErr::UnknownMethod,
7740                        header.tx_id,
7741                        header.ordinal,
7742                        header.dynamic_flags(),
7743                        (bytes, handles),
7744                    )?;
7745                    Ok(PacketStreamSinkRequest::_UnknownMethod {
7746                        ordinal: header.ordinal,
7747                        control_handle: PacketStreamSinkControlHandle { inner: this.inner.clone() },
7748                        method_type: fidl::MethodType::TwoWay,
7749                    })
7750                }
7751                _ => Err(fidl::Error::UnknownOrdinal {
7752                    ordinal: header.ordinal,
7753                    protocol_name: <PacketStreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7754                }),
7755            }))
7756            },
7757        )
7758    }
7759}
7760
7761/// The protocol for streaming packet-based audio data.
7762/// This protocol functions as a data sink. The "server" of this protocol consumes packets,
7763/// and the "client" produces packets.
7764///
7765/// This protocol can be used in two directions:
7766/// 1. **Output (Client -> Driver)**: The Driver implements `PacketStreamSink`. The Client (App)
7767///    calls `PutPacket`.
7768/// 2. **Input (Driver -> Client)**: The Client (App) implements `PacketStreamSink`. The Driver
7769///    calls `PutPacket`.
7770#[derive(Debug)]
7771pub enum PacketStreamSinkRequest {
7772    /// Submits a packet to be processed by the server.
7773    ///
7774    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
7775    /// Packets are processed in the order they were submitted. This call
7776    /// blocks until the payload is processed. When this call returns, the
7777    /// buffer region is guaranteed to be available for reuse.
7778    ///
7779    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
7780    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
7781    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
7782    /// * The payload is missing.
7783    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
7784    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
7785    ///   `DRIVER_OWNED`.
7786    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
7787    ///
7788    /// Note: The server is not required to detect if a VMO region is currently in use by a
7789    /// previous pending packet. Clients are responsible for managing buffer usage.
7790    PutPacket {
7791        payload: PacketStreamSinkPutPacketRequest,
7792        responder: PacketStreamSinkPutPacketResponder,
7793    },
7794    /// Flushes all packets currently pending without processing them.
7795    /// This call waits until all pending packets are completed or canceled.
7796    ///
7797    /// Note: A packet may be partially processed (e.g. if it contains multiple
7798    /// audio frames, or if the data does not align with encoded frame boundaries)
7799    /// before it is canceled.
7800    FlushPackets { responder: PacketStreamSinkFlushPacketsResponder },
7801    /// An interaction was received which does not match any known method.
7802    #[non_exhaustive]
7803    _UnknownMethod {
7804        /// Ordinal of the method that was called.
7805        ordinal: u64,
7806        control_handle: PacketStreamSinkControlHandle,
7807        method_type: fidl::MethodType,
7808    },
7809}
7810
7811impl PacketStreamSinkRequest {
7812    #[allow(irrefutable_let_patterns)]
7813    pub fn into_put_packet(
7814        self,
7815    ) -> Option<(PacketStreamSinkPutPacketRequest, PacketStreamSinkPutPacketResponder)> {
7816        if let PacketStreamSinkRequest::PutPacket { payload, responder } = self {
7817            Some((payload, responder))
7818        } else {
7819            None
7820        }
7821    }
7822
7823    #[allow(irrefutable_let_patterns)]
7824    pub fn into_flush_packets(self) -> Option<(PacketStreamSinkFlushPacketsResponder)> {
7825        if let PacketStreamSinkRequest::FlushPackets { responder } = self {
7826            Some((responder))
7827        } else {
7828            None
7829        }
7830    }
7831
7832    /// Name of the method defined in FIDL
7833    pub fn method_name(&self) -> &'static str {
7834        match *self {
7835            PacketStreamSinkRequest::PutPacket { .. } => "put_packet",
7836            PacketStreamSinkRequest::FlushPackets { .. } => "flush_packets",
7837            PacketStreamSinkRequest::_UnknownMethod {
7838                method_type: fidl::MethodType::OneWay,
7839                ..
7840            } => "unknown one-way method",
7841            PacketStreamSinkRequest::_UnknownMethod {
7842                method_type: fidl::MethodType::TwoWay,
7843                ..
7844            } => "unknown two-way method",
7845        }
7846    }
7847}
7848
7849#[derive(Debug, Clone)]
7850pub struct PacketStreamSinkControlHandle {
7851    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7852}
7853
7854impl fdomain_client::fidl::ControlHandle for PacketStreamSinkControlHandle {
7855    fn shutdown(&self) {
7856        self.inner.shutdown()
7857    }
7858
7859    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7860        self.inner.shutdown_with_epitaph(status)
7861    }
7862
7863    fn is_closed(&self) -> bool {
7864        self.inner.channel().is_closed()
7865    }
7866    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
7867        self.inner.channel().on_closed()
7868    }
7869}
7870
7871impl PacketStreamSinkControlHandle {}
7872
7873#[must_use = "FIDL methods require a response to be sent"]
7874#[derive(Debug)]
7875pub struct PacketStreamSinkPutPacketResponder {
7876    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
7877    tx_id: u32,
7878}
7879
7880/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
7881/// if the responder is dropped without sending a response, so that the client
7882/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7883impl std::ops::Drop for PacketStreamSinkPutPacketResponder {
7884    fn drop(&mut self) {
7885        self.control_handle.shutdown();
7886        // Safety: drops once, never accessed again
7887        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7888    }
7889}
7890
7891impl fdomain_client::fidl::Responder for PacketStreamSinkPutPacketResponder {
7892    type ControlHandle = PacketStreamSinkControlHandle;
7893
7894    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
7895        &self.control_handle
7896    }
7897
7898    fn drop_without_shutdown(mut self) {
7899        // Safety: drops once, never accessed again due to mem::forget
7900        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7901        // Prevent Drop from running (which would shut down the channel)
7902        std::mem::forget(self);
7903    }
7904}
7905
7906impl PacketStreamSinkPutPacketResponder {
7907    /// Sends a response to the FIDL transaction.
7908    ///
7909    /// Sets the channel to shutdown if an error occurs.
7910    pub fn send(
7911        self,
7912        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
7913    ) -> Result<(), fidl::Error> {
7914        let _result = self.send_raw(result);
7915        if _result.is_err() {
7916            self.control_handle.shutdown();
7917        }
7918        self.drop_without_shutdown();
7919        _result
7920    }
7921
7922    /// Similar to "send" but does not shutdown the channel if an error occurs.
7923    pub fn send_no_shutdown_on_err(
7924        self,
7925        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
7926    ) -> Result<(), fidl::Error> {
7927        let _result = self.send_raw(result);
7928        self.drop_without_shutdown();
7929        _result
7930    }
7931
7932    fn send_raw(
7933        &self,
7934        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
7935    ) -> Result<(), fidl::Error> {
7936        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7937            PacketStreamSinkPutPacketResponse,
7938            i32,
7939        >>(
7940            fidl::encoding::FlexibleResult::new(result),
7941            self.tx_id,
7942            0x25a8e35efba81f2b,
7943            fidl::encoding::DynamicFlags::FLEXIBLE,
7944        )
7945    }
7946}
7947
7948#[must_use = "FIDL methods require a response to be sent"]
7949#[derive(Debug)]
7950pub struct PacketStreamSinkFlushPacketsResponder {
7951    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
7952    tx_id: u32,
7953}
7954
7955/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
7956/// if the responder is dropped without sending a response, so that the client
7957/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7958impl std::ops::Drop for PacketStreamSinkFlushPacketsResponder {
7959    fn drop(&mut self) {
7960        self.control_handle.shutdown();
7961        // Safety: drops once, never accessed again
7962        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7963    }
7964}
7965
7966impl fdomain_client::fidl::Responder for PacketStreamSinkFlushPacketsResponder {
7967    type ControlHandle = PacketStreamSinkControlHandle;
7968
7969    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
7970        &self.control_handle
7971    }
7972
7973    fn drop_without_shutdown(mut self) {
7974        // Safety: drops once, never accessed again due to mem::forget
7975        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7976        // Prevent Drop from running (which would shut down the channel)
7977        std::mem::forget(self);
7978    }
7979}
7980
7981impl PacketStreamSinkFlushPacketsResponder {
7982    /// Sends a response to the FIDL transaction.
7983    ///
7984    /// Sets the channel to shutdown if an error occurs.
7985    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7986        let _result = self.send_raw(result);
7987        if _result.is_err() {
7988            self.control_handle.shutdown();
7989        }
7990        self.drop_without_shutdown();
7991        _result
7992    }
7993
7994    /// Similar to "send" but does not shutdown the channel if an error occurs.
7995    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7996        let _result = self.send_raw(result);
7997        self.drop_without_shutdown();
7998        _result
7999    }
8000
8001    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8002        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8003            fidl::encoding::EmptyStruct,
8004            i32,
8005        >>(
8006            fidl::encoding::FlexibleResult::new(result),
8007            self.tx_id,
8008            0x13f16ca37ede8a4,
8009            fidl::encoding::DynamicFlags::FLEXIBLE,
8010        )
8011    }
8012}
8013
8014#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8015pub struct RingBufferMarker;
8016
8017impl fdomain_client::fidl::ProtocolMarker for RingBufferMarker {
8018    type Proxy = RingBufferProxy;
8019    type RequestStream = RingBufferRequestStream;
8020
8021    const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
8022}
8023pub type RingBufferGetVmoResult = Result<(u32, fdomain_client::Vmo), GetVmoError>;
8024pub type RingBufferSetActiveChannelsResult = Result<i64, i32>;
8025
8026pub trait RingBufferProxyInterface: Send + Sync {
8027    type GetPropertiesResponseFut: std::future::Future<Output = Result<RingBufferProperties, fidl::Error>>
8028        + Send;
8029    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
8030    type WatchClockRecoveryPositionInfoResponseFut: std::future::Future<Output = Result<RingBufferPositionInfo, fidl::Error>>
8031        + Send;
8032    fn r#watch_clock_recovery_position_info(
8033        &self,
8034    ) -> Self::WatchClockRecoveryPositionInfoResponseFut;
8035    type GetVmoResponseFut: std::future::Future<Output = Result<RingBufferGetVmoResult, fidl::Error>>
8036        + Send;
8037    fn r#get_vmo(
8038        &self,
8039        min_frames: u32,
8040        clock_recovery_notifications_per_ring: u32,
8041    ) -> Self::GetVmoResponseFut;
8042    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
8043    fn r#start(&self) -> Self::StartResponseFut;
8044    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8045    fn r#stop(&self) -> Self::StopResponseFut;
8046    type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
8047        + Send;
8048    fn r#set_active_channels(
8049        &self,
8050        active_channels_bitmask: u64,
8051    ) -> Self::SetActiveChannelsResponseFut;
8052    type WatchDelayInfoResponseFut: std::future::Future<Output = Result<DelayInfo, fidl::Error>>
8053        + Send;
8054    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
8055}
8056
8057#[derive(Debug, Clone)]
8058pub struct RingBufferProxy {
8059    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
8060}
8061
8062impl fdomain_client::fidl::Proxy for RingBufferProxy {
8063    type Protocol = RingBufferMarker;
8064
8065    fn from_channel(inner: fdomain_client::Channel) -> Self {
8066        Self::new(inner)
8067    }
8068
8069    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
8070        self.client.into_channel().map_err(|client| Self { client })
8071    }
8072
8073    fn as_channel(&self) -> &fdomain_client::Channel {
8074        self.client.as_channel()
8075    }
8076}
8077
8078impl RingBufferProxy {
8079    /// Create a new Proxy for fuchsia.hardware.audio/RingBuffer.
8080    pub fn new(channel: fdomain_client::Channel) -> Self {
8081        let protocol_name = <RingBufferMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
8082        Self { client: fidl::client::Client::new(channel, protocol_name) }
8083    }
8084
8085    /// Get a Stream of events from the remote end of the protocol.
8086    ///
8087    /// # Panics
8088    ///
8089    /// Panics if the event stream was already taken.
8090    pub fn take_event_stream(&self) -> RingBufferEventStream {
8091        RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
8092    }
8093
8094    /// Accessor for top level static properties.
8095    pub fn r#get_properties(
8096        &self,
8097    ) -> fidl::client::QueryResponseFut<
8098        RingBufferProperties,
8099        fdomain_client::fidl::FDomainResourceDialect,
8100    > {
8101        RingBufferProxyInterface::r#get_properties(self)
8102    }
8103
8104    /// Gets the ring buffer current position via a hanging get.
8105    ///
8106    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
8107    /// `clock_recovery_notifications_per_ring` was specified.
8108    ///
8109    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
8110    /// not respond to subsequent client calls until the position information has changed from what
8111    /// was most recently provided to that client.
8112    ///
8113    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
8114    /// to the `Start` command.
8115    ///
8116    /// At the `start_time` returned by `Start`, position is always 0. From there, it
8117    /// progresses at the rate specified by the rate, sample format (and clock domain,
8118    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
8119    ///
8120    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
8121    /// estimated position to be used for clock recovery at most at
8122    /// `clock_recovery_notifications_per_ring` frequency.
8123    ///
8124    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
8125    /// increasing.
8126    ///
8127    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
8128    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
8129    pub fn r#watch_clock_recovery_position_info(
8130        &self,
8131    ) -> fidl::client::QueryResponseFut<
8132        RingBufferPositionInfo,
8133        fdomain_client::fidl::FDomainResourceDialect,
8134    > {
8135        RingBufferProxyInterface::r#watch_clock_recovery_position_info(self)
8136    }
8137
8138    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
8139    ///
8140    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
8141    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
8142    ///
8143    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
8144    /// that ring buffer contents can be transfered in and out, or else the call must be failed
8145    /// with GetVmoError.INVALID_ARGS.
8146    ///
8147    /// The driver may increase the ring buffer size beyond `min_frames` plus
8148    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
8149    /// alignment.
8150    ///
8151    /// Clients can treat the entire returned ring buffer as safe to access, except for the
8152    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
8153    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
8154    ///
8155    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8156    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
8157    /// handle must also include ZX_RIGHT_WRITE.
8158    ///
8159    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
8160    /// `WatchClockRecoveryPositionInfo` client requests at most at
8161    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
8162    /// for clock recovery.
8163    pub fn r#get_vmo(
8164        &self,
8165        mut min_frames: u32,
8166        mut clock_recovery_notifications_per_ring: u32,
8167    ) -> fidl::client::QueryResponseFut<
8168        RingBufferGetVmoResult,
8169        fdomain_client::fidl::FDomainResourceDialect,
8170    > {
8171        RingBufferProxyInterface::r#get_vmo(self, min_frames, clock_recovery_notifications_per_ring)
8172    }
8173
8174    /// Start the ring buffer.
8175    ///
8176    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
8177    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
8178    /// write from or to the ring buffer position 0, subject to the overall position and buffering
8179    /// behavior described in 'Ring buffer behavior' below.
8180    ///
8181    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8182    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
8183    /// a second time before the first call has completed, then the channel must be closed with an
8184    /// error `ZX_ERR_BAD_STATE` returned.
8185    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
8186    pub fn r#start(
8187        &self,
8188    ) -> fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect> {
8189        RingBufferProxyInterface::r#start(self)
8190    }
8191
8192    /// Stop the ring buffer.
8193    ///
8194    /// Once this call's response is received, no further position notifications will be sent until
8195    /// `Start` is called again.
8196    ///
8197    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8198    pub fn r#stop(
8199        &self,
8200    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
8201        RingBufferProxyInterface::r#stop(self)
8202    }
8203
8204    /// Sets which channels are active via a bitmask.
8205    ///
8206    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
8207    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
8208    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
8209    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
8210    /// turns on the hardware associated for all channels.
8211    ///
8212    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
8213    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
8214    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
8215    ///
8216    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
8217    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
8218    /// buffer's position advances (and position notifications sent as needed) regardless of the
8219    /// number of active channels, including if no channels are active. This means that the format
8220    /// in the ring buffer is not changed.
8221    ///
8222    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
8223    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
8224    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
8225    ///
8226    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
8227    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
8228    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
8229    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
8230    /// hardware configuration was completed. If the requested channel configuration is already
8231    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
8232    /// before the reply is sent. If called again with the same configuration, the reply must
8233    /// include the same `set_time` value as was previously returned.
8234    ///
8235    /// For input channels, it is not required that the driver zero-out inactive channels.
8236    ///
8237    /// If `SetActiveChannels` is called for a second time before the first call has completed,
8238    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8239    pub fn r#set_active_channels(
8240        &self,
8241        mut active_channels_bitmask: u64,
8242    ) -> fidl::client::QueryResponseFut<
8243        RingBufferSetActiveChannelsResult,
8244        fdomain_client::fidl::FDomainResourceDialect,
8245    > {
8246        RingBufferProxyInterface::r#set_active_channels(self, active_channels_bitmask)
8247    }
8248
8249    /// Get information about delays via a hanging get.
8250    ///
8251    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
8252    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
8253    /// changes from what was most recently reported.
8254    ///
8255    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
8256    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8257    pub fn r#watch_delay_info(
8258        &self,
8259    ) -> fidl::client::QueryResponseFut<DelayInfo, fdomain_client::fidl::FDomainResourceDialect>
8260    {
8261        RingBufferProxyInterface::r#watch_delay_info(self)
8262    }
8263}
8264
8265impl RingBufferProxyInterface for RingBufferProxy {
8266    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
8267        RingBufferProperties,
8268        fdomain_client::fidl::FDomainResourceDialect,
8269    >;
8270    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
8271        fn _decode(
8272            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8273        ) -> Result<RingBufferProperties, fidl::Error> {
8274            let _response = fidl::client::decode_transaction_body::<
8275                RingBufferGetPropertiesResponse,
8276                fdomain_client::fidl::FDomainResourceDialect,
8277                0x12947f061a8fe1,
8278            >(_buf?)?;
8279            Ok(_response.properties)
8280        }
8281        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferProperties>(
8282            (),
8283            0x12947f061a8fe1,
8284            fidl::encoding::DynamicFlags::empty(),
8285            _decode,
8286        )
8287    }
8288
8289    type WatchClockRecoveryPositionInfoResponseFut = fidl::client::QueryResponseFut<
8290        RingBufferPositionInfo,
8291        fdomain_client::fidl::FDomainResourceDialect,
8292    >;
8293    fn r#watch_clock_recovery_position_info(
8294        &self,
8295    ) -> Self::WatchClockRecoveryPositionInfoResponseFut {
8296        fn _decode(
8297            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8298        ) -> Result<RingBufferPositionInfo, fidl::Error> {
8299            let _response = fidl::client::decode_transaction_body::<
8300                RingBufferWatchClockRecoveryPositionInfoResponse,
8301                fdomain_client::fidl::FDomainResourceDialect,
8302                0x694d5b898a4167e5,
8303            >(_buf?)?;
8304            Ok(_response.position_info)
8305        }
8306        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferPositionInfo>(
8307            (),
8308            0x694d5b898a4167e5,
8309            fidl::encoding::DynamicFlags::empty(),
8310            _decode,
8311        )
8312    }
8313
8314    type GetVmoResponseFut = fidl::client::QueryResponseFut<
8315        RingBufferGetVmoResult,
8316        fdomain_client::fidl::FDomainResourceDialect,
8317    >;
8318    fn r#get_vmo(
8319        &self,
8320        mut min_frames: u32,
8321        mut clock_recovery_notifications_per_ring: u32,
8322    ) -> Self::GetVmoResponseFut {
8323        fn _decode(
8324            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8325        ) -> Result<RingBufferGetVmoResult, fidl::Error> {
8326            let _response = fidl::client::decode_transaction_body::<
8327                fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
8328                fdomain_client::fidl::FDomainResourceDialect,
8329                0x44c8f4f5680e853a,
8330            >(_buf?)?;
8331            Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
8332        }
8333        self.client.send_query_and_decode::<RingBufferGetVmoRequest, RingBufferGetVmoResult>(
8334            (min_frames, clock_recovery_notifications_per_ring),
8335            0x44c8f4f5680e853a,
8336            fidl::encoding::DynamicFlags::empty(),
8337            _decode,
8338        )
8339    }
8340
8341    type StartResponseFut =
8342        fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect>;
8343    fn r#start(&self) -> Self::StartResponseFut {
8344        fn _decode(
8345            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8346        ) -> Result<i64, fidl::Error> {
8347            let _response = fidl::client::decode_transaction_body::<
8348                RingBufferStartResponse,
8349                fdomain_client::fidl::FDomainResourceDialect,
8350                0x5dd780a769a8892d,
8351            >(_buf?)?;
8352            Ok(_response.start_time)
8353        }
8354        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
8355            (),
8356            0x5dd780a769a8892d,
8357            fidl::encoding::DynamicFlags::empty(),
8358            _decode,
8359        )
8360    }
8361
8362    type StopResponseFut =
8363        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
8364    fn r#stop(&self) -> Self::StopResponseFut {
8365        fn _decode(
8366            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8367        ) -> Result<(), fidl::Error> {
8368            let _response = fidl::client::decode_transaction_body::<
8369                fidl::encoding::EmptyPayload,
8370                fdomain_client::fidl::FDomainResourceDialect,
8371                0x49a73d9cf1d4e110,
8372            >(_buf?)?;
8373            Ok(_response)
8374        }
8375        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
8376            (),
8377            0x49a73d9cf1d4e110,
8378            fidl::encoding::DynamicFlags::empty(),
8379            _decode,
8380        )
8381    }
8382
8383    type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
8384        RingBufferSetActiveChannelsResult,
8385        fdomain_client::fidl::FDomainResourceDialect,
8386    >;
8387    fn r#set_active_channels(
8388        &self,
8389        mut active_channels_bitmask: u64,
8390    ) -> Self::SetActiveChannelsResponseFut {
8391        fn _decode(
8392            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8393        ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
8394            let _response = fidl::client::decode_transaction_body::<
8395                fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
8396                fdomain_client::fidl::FDomainResourceDialect,
8397                0x605464c1d384f309,
8398            >(_buf?)?;
8399            Ok(_response.map(|x| x.set_time))
8400        }
8401        self.client.send_query_and_decode::<
8402            RingBufferSetActiveChannelsRequest,
8403            RingBufferSetActiveChannelsResult,
8404        >(
8405            (active_channels_bitmask,),
8406            0x605464c1d384f309,
8407            fidl::encoding::DynamicFlags::empty(),
8408            _decode,
8409        )
8410    }
8411
8412    type WatchDelayInfoResponseFut =
8413        fidl::client::QueryResponseFut<DelayInfo, fdomain_client::fidl::FDomainResourceDialect>;
8414    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
8415        fn _decode(
8416            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8417        ) -> Result<DelayInfo, fidl::Error> {
8418            let _response = fidl::client::decode_transaction_body::<
8419                fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
8420                fdomain_client::fidl::FDomainResourceDialect,
8421                0x6c1248db213fcf9f,
8422            >(_buf?)?
8423            .into_result_fdomain::<RingBufferMarker>("watch_delay_info")?;
8424            Ok(_response.delay_info)
8425        }
8426        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelayInfo>(
8427            (),
8428            0x6c1248db213fcf9f,
8429            fidl::encoding::DynamicFlags::FLEXIBLE,
8430            _decode,
8431        )
8432    }
8433}
8434
8435pub struct RingBufferEventStream {
8436    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
8437}
8438
8439impl std::marker::Unpin for RingBufferEventStream {}
8440
8441impl futures::stream::FusedStream for RingBufferEventStream {
8442    fn is_terminated(&self) -> bool {
8443        self.event_receiver.is_terminated()
8444    }
8445}
8446
8447impl futures::Stream for RingBufferEventStream {
8448    type Item = Result<RingBufferEvent, fidl::Error>;
8449
8450    fn poll_next(
8451        mut self: std::pin::Pin<&mut Self>,
8452        cx: &mut std::task::Context<'_>,
8453    ) -> std::task::Poll<Option<Self::Item>> {
8454        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8455            &mut self.event_receiver,
8456            cx
8457        )?) {
8458            Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
8459            None => std::task::Poll::Ready(None),
8460        }
8461    }
8462}
8463
8464#[derive(Debug)]
8465pub enum RingBufferEvent {
8466    #[non_exhaustive]
8467    _UnknownEvent {
8468        /// Ordinal of the event that was sent.
8469        ordinal: u64,
8470    },
8471}
8472
8473impl RingBufferEvent {
8474    /// Decodes a message buffer as a [`RingBufferEvent`].
8475    fn decode(
8476        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8477    ) -> Result<RingBufferEvent, fidl::Error> {
8478        let (bytes, _handles) = buf.split_mut();
8479        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8480        debug_assert_eq!(tx_header.tx_id, 0);
8481        match tx_header.ordinal {
8482            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8483                Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
8484            }
8485            _ => Err(fidl::Error::UnknownOrdinal {
8486                ordinal: tx_header.ordinal,
8487                protocol_name:
8488                    <RingBufferMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
8489            }),
8490        }
8491    }
8492}
8493
8494/// A Stream of incoming requests for fuchsia.hardware.audio/RingBuffer.
8495pub struct RingBufferRequestStream {
8496    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
8497    is_terminated: bool,
8498}
8499
8500impl std::marker::Unpin for RingBufferRequestStream {}
8501
8502impl futures::stream::FusedStream for RingBufferRequestStream {
8503    fn is_terminated(&self) -> bool {
8504        self.is_terminated
8505    }
8506}
8507
8508impl fdomain_client::fidl::RequestStream for RingBufferRequestStream {
8509    type Protocol = RingBufferMarker;
8510    type ControlHandle = RingBufferControlHandle;
8511
8512    fn from_channel(channel: fdomain_client::Channel) -> Self {
8513        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8514    }
8515
8516    fn control_handle(&self) -> Self::ControlHandle {
8517        RingBufferControlHandle { inner: self.inner.clone() }
8518    }
8519
8520    fn into_inner(
8521        self,
8522    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
8523    {
8524        (self.inner, self.is_terminated)
8525    }
8526
8527    fn from_inner(
8528        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
8529        is_terminated: bool,
8530    ) -> Self {
8531        Self { inner, is_terminated }
8532    }
8533}
8534
8535impl futures::Stream for RingBufferRequestStream {
8536    type Item = Result<RingBufferRequest, fidl::Error>;
8537
8538    fn poll_next(
8539        mut self: std::pin::Pin<&mut Self>,
8540        cx: &mut std::task::Context<'_>,
8541    ) -> std::task::Poll<Option<Self::Item>> {
8542        let this = &mut *self;
8543        if this.inner.check_shutdown(cx) {
8544            this.is_terminated = true;
8545            return std::task::Poll::Ready(None);
8546        }
8547        if this.is_terminated {
8548            panic!("polled RingBufferRequestStream after completion");
8549        }
8550        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
8551            |bytes, handles| {
8552                match this.inner.channel().read_etc(cx, bytes, handles) {
8553                    std::task::Poll::Ready(Ok(())) => {}
8554                    std::task::Poll::Pending => return std::task::Poll::Pending,
8555                    std::task::Poll::Ready(Err(None)) => {
8556                        this.is_terminated = true;
8557                        return std::task::Poll::Ready(None);
8558                    }
8559                    std::task::Poll::Ready(Err(Some(e))) => {
8560                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8561                            e.into(),
8562                        ))));
8563                    }
8564                }
8565
8566                // A message has been received from the channel
8567                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8568
8569                std::task::Poll::Ready(Some(match header.ordinal {
8570                    0x12947f061a8fe1 => {
8571                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8572                        let mut req = fidl::new_empty!(
8573                            fidl::encoding::EmptyPayload,
8574                            fdomain_client::fidl::FDomainResourceDialect
8575                        );
8576                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8577                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8578                        Ok(RingBufferRequest::GetProperties {
8579                            responder: RingBufferGetPropertiesResponder {
8580                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8581                                tx_id: header.tx_id,
8582                            },
8583                        })
8584                    }
8585                    0x694d5b898a4167e5 => {
8586                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8587                        let mut req = fidl::new_empty!(
8588                            fidl::encoding::EmptyPayload,
8589                            fdomain_client::fidl::FDomainResourceDialect
8590                        );
8591                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8592                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8593                        Ok(RingBufferRequest::WatchClockRecoveryPositionInfo {
8594                            responder: RingBufferWatchClockRecoveryPositionInfoResponder {
8595                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8596                                tx_id: header.tx_id,
8597                            },
8598                        })
8599                    }
8600                    0x44c8f4f5680e853a => {
8601                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8602                        let mut req = fidl::new_empty!(
8603                            RingBufferGetVmoRequest,
8604                            fdomain_client::fidl::FDomainResourceDialect
8605                        );
8606                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RingBufferGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
8607                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8608                        Ok(RingBufferRequest::GetVmo {
8609                            min_frames: req.min_frames,
8610                            clock_recovery_notifications_per_ring: req
8611                                .clock_recovery_notifications_per_ring,
8612
8613                            responder: RingBufferGetVmoResponder {
8614                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8615                                tx_id: header.tx_id,
8616                            },
8617                        })
8618                    }
8619                    0x5dd780a769a8892d => {
8620                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8621                        let mut req = fidl::new_empty!(
8622                            fidl::encoding::EmptyPayload,
8623                            fdomain_client::fidl::FDomainResourceDialect
8624                        );
8625                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8626                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8627                        Ok(RingBufferRequest::Start {
8628                            responder: RingBufferStartResponder {
8629                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8630                                tx_id: header.tx_id,
8631                            },
8632                        })
8633                    }
8634                    0x49a73d9cf1d4e110 => {
8635                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8636                        let mut req = fidl::new_empty!(
8637                            fidl::encoding::EmptyPayload,
8638                            fdomain_client::fidl::FDomainResourceDialect
8639                        );
8640                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8641                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8642                        Ok(RingBufferRequest::Stop {
8643                            responder: RingBufferStopResponder {
8644                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8645                                tx_id: header.tx_id,
8646                            },
8647                        })
8648                    }
8649                    0x605464c1d384f309 => {
8650                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8651                        let mut req = fidl::new_empty!(
8652                            RingBufferSetActiveChannelsRequest,
8653                            fdomain_client::fidl::FDomainResourceDialect
8654                        );
8655                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
8656                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8657                        Ok(RingBufferRequest::SetActiveChannels {
8658                            active_channels_bitmask: req.active_channels_bitmask,
8659
8660                            responder: RingBufferSetActiveChannelsResponder {
8661                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8662                                tx_id: header.tx_id,
8663                            },
8664                        })
8665                    }
8666                    0x6c1248db213fcf9f => {
8667                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8668                        let mut req = fidl::new_empty!(
8669                            fidl::encoding::EmptyPayload,
8670                            fdomain_client::fidl::FDomainResourceDialect
8671                        );
8672                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8673                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8674                        Ok(RingBufferRequest::WatchDelayInfo {
8675                            responder: RingBufferWatchDelayInfoResponder {
8676                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8677                                tx_id: header.tx_id,
8678                            },
8679                        })
8680                    }
8681                    _ if header.tx_id == 0
8682                        && header
8683                            .dynamic_flags()
8684                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8685                    {
8686                        Ok(RingBufferRequest::_UnknownMethod {
8687                            ordinal: header.ordinal,
8688                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
8689                            method_type: fidl::MethodType::OneWay,
8690                        })
8691                    }
8692                    _ if header
8693                        .dynamic_flags()
8694                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8695                    {
8696                        this.inner.send_framework_err(
8697                            fidl::encoding::FrameworkErr::UnknownMethod,
8698                            header.tx_id,
8699                            header.ordinal,
8700                            header.dynamic_flags(),
8701                            (bytes, handles),
8702                        )?;
8703                        Ok(RingBufferRequest::_UnknownMethod {
8704                            ordinal: header.ordinal,
8705                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
8706                            method_type: fidl::MethodType::TwoWay,
8707                        })
8708                    }
8709                    _ => Err(fidl::Error::UnknownOrdinal {
8710                        ordinal: header.ordinal,
8711                        protocol_name:
8712                            <RingBufferMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
8713                    }),
8714                }))
8715            },
8716        )
8717    }
8718}
8719
8720/// Ring buffers are used to convey audio between parties (usually in different processes), allowing
8721/// concurrent, asynchronous data access without requiring locks. This pattern works because both
8722/// parties share an understanding of which buffer areas are safe to access, and how those areas
8723/// change over time.
8724///
8725/// For in-depth description of the responsibilities for both _producers_ and _consumers_,
8726/// before the ring buffer is started as well as while it is active, please see
8727/// [Ring Buffer Behavior](https://fuchsia.dev/fuchsia-src/development/audio/ring_buffer.md).
8728#[derive(Debug)]
8729pub enum RingBufferRequest {
8730    /// Accessor for top level static properties.
8731    GetProperties { responder: RingBufferGetPropertiesResponder },
8732    /// Gets the ring buffer current position via a hanging get.
8733    ///
8734    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
8735    /// `clock_recovery_notifications_per_ring` was specified.
8736    ///
8737    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
8738    /// not respond to subsequent client calls until the position information has changed from what
8739    /// was most recently provided to that client.
8740    ///
8741    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
8742    /// to the `Start` command.
8743    ///
8744    /// At the `start_time` returned by `Start`, position is always 0. From there, it
8745    /// progresses at the rate specified by the rate, sample format (and clock domain,
8746    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
8747    ///
8748    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
8749    /// estimated position to be used for clock recovery at most at
8750    /// `clock_recovery_notifications_per_ring` frequency.
8751    ///
8752    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
8753    /// increasing.
8754    ///
8755    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
8756    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
8757    WatchClockRecoveryPositionInfo { responder: RingBufferWatchClockRecoveryPositionInfoResponder },
8758    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
8759    ///
8760    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
8761    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
8762    ///
8763    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
8764    /// that ring buffer contents can be transfered in and out, or else the call must be failed
8765    /// with GetVmoError.INVALID_ARGS.
8766    ///
8767    /// The driver may increase the ring buffer size beyond `min_frames` plus
8768    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
8769    /// alignment.
8770    ///
8771    /// Clients can treat the entire returned ring buffer as safe to access, except for the
8772    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
8773    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
8774    ///
8775    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8776    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
8777    /// handle must also include ZX_RIGHT_WRITE.
8778    ///
8779    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
8780    /// `WatchClockRecoveryPositionInfo` client requests at most at
8781    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
8782    /// for clock recovery.
8783    GetVmo {
8784        min_frames: u32,
8785        clock_recovery_notifications_per_ring: u32,
8786        responder: RingBufferGetVmoResponder,
8787    },
8788    /// Start the ring buffer.
8789    ///
8790    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
8791    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
8792    /// write from or to the ring buffer position 0, subject to the overall position and buffering
8793    /// behavior described in 'Ring buffer behavior' below.
8794    ///
8795    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8796    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
8797    /// a second time before the first call has completed, then the channel must be closed with an
8798    /// error `ZX_ERR_BAD_STATE` returned.
8799    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
8800    Start { responder: RingBufferStartResponder },
8801    /// Stop the ring buffer.
8802    ///
8803    /// Once this call's response is received, no further position notifications will be sent until
8804    /// `Start` is called again.
8805    ///
8806    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8807    Stop { responder: RingBufferStopResponder },
8808    /// Sets which channels are active via a bitmask.
8809    ///
8810    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
8811    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
8812    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
8813    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
8814    /// turns on the hardware associated for all channels.
8815    ///
8816    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
8817    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
8818    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
8819    ///
8820    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
8821    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
8822    /// buffer's position advances (and position notifications sent as needed) regardless of the
8823    /// number of active channels, including if no channels are active. This means that the format
8824    /// in the ring buffer is not changed.
8825    ///
8826    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
8827    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
8828    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
8829    ///
8830    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
8831    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
8832    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
8833    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
8834    /// hardware configuration was completed. If the requested channel configuration is already
8835    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
8836    /// before the reply is sent. If called again with the same configuration, the reply must
8837    /// include the same `set_time` value as was previously returned.
8838    ///
8839    /// For input channels, it is not required that the driver zero-out inactive channels.
8840    ///
8841    /// If `SetActiveChannels` is called for a second time before the first call has completed,
8842    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8843    SetActiveChannels {
8844        active_channels_bitmask: u64,
8845        responder: RingBufferSetActiveChannelsResponder,
8846    },
8847    /// Get information about delays via a hanging get.
8848    ///
8849    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
8850    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
8851    /// changes from what was most recently reported.
8852    ///
8853    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
8854    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8855    WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
8856    /// An interaction was received which does not match any known method.
8857    #[non_exhaustive]
8858    _UnknownMethod {
8859        /// Ordinal of the method that was called.
8860        ordinal: u64,
8861        control_handle: RingBufferControlHandle,
8862        method_type: fidl::MethodType,
8863    },
8864}
8865
8866impl RingBufferRequest {
8867    #[allow(irrefutable_let_patterns)]
8868    pub fn into_get_properties(self) -> Option<(RingBufferGetPropertiesResponder)> {
8869        if let RingBufferRequest::GetProperties { responder } = self {
8870            Some((responder))
8871        } else {
8872            None
8873        }
8874    }
8875
8876    #[allow(irrefutable_let_patterns)]
8877    pub fn into_watch_clock_recovery_position_info(
8878        self,
8879    ) -> Option<(RingBufferWatchClockRecoveryPositionInfoResponder)> {
8880        if let RingBufferRequest::WatchClockRecoveryPositionInfo { responder } = self {
8881            Some((responder))
8882        } else {
8883            None
8884        }
8885    }
8886
8887    #[allow(irrefutable_let_patterns)]
8888    pub fn into_get_vmo(self) -> Option<(u32, u32, RingBufferGetVmoResponder)> {
8889        if let RingBufferRequest::GetVmo {
8890            min_frames,
8891            clock_recovery_notifications_per_ring,
8892            responder,
8893        } = self
8894        {
8895            Some((min_frames, clock_recovery_notifications_per_ring, responder))
8896        } else {
8897            None
8898        }
8899    }
8900
8901    #[allow(irrefutable_let_patterns)]
8902    pub fn into_start(self) -> Option<(RingBufferStartResponder)> {
8903        if let RingBufferRequest::Start { responder } = self { Some((responder)) } else { None }
8904    }
8905
8906    #[allow(irrefutable_let_patterns)]
8907    pub fn into_stop(self) -> Option<(RingBufferStopResponder)> {
8908        if let RingBufferRequest::Stop { responder } = self { Some((responder)) } else { None }
8909    }
8910
8911    #[allow(irrefutable_let_patterns)]
8912    pub fn into_set_active_channels(self) -> Option<(u64, RingBufferSetActiveChannelsResponder)> {
8913        if let RingBufferRequest::SetActiveChannels { active_channels_bitmask, responder } = self {
8914            Some((active_channels_bitmask, responder))
8915        } else {
8916            None
8917        }
8918    }
8919
8920    #[allow(irrefutable_let_patterns)]
8921    pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
8922        if let RingBufferRequest::WatchDelayInfo { responder } = self {
8923            Some((responder))
8924        } else {
8925            None
8926        }
8927    }
8928
8929    /// Name of the method defined in FIDL
8930    pub fn method_name(&self) -> &'static str {
8931        match *self {
8932            RingBufferRequest::GetProperties { .. } => "get_properties",
8933            RingBufferRequest::WatchClockRecoveryPositionInfo { .. } => {
8934                "watch_clock_recovery_position_info"
8935            }
8936            RingBufferRequest::GetVmo { .. } => "get_vmo",
8937            RingBufferRequest::Start { .. } => "start",
8938            RingBufferRequest::Stop { .. } => "stop",
8939            RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
8940            RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
8941            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
8942                "unknown one-way method"
8943            }
8944            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
8945                "unknown two-way method"
8946            }
8947        }
8948    }
8949}
8950
8951#[derive(Debug, Clone)]
8952pub struct RingBufferControlHandle {
8953    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
8954}
8955
8956impl fdomain_client::fidl::ControlHandle for RingBufferControlHandle {
8957    fn shutdown(&self) {
8958        self.inner.shutdown()
8959    }
8960
8961    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8962        self.inner.shutdown_with_epitaph(status)
8963    }
8964
8965    fn is_closed(&self) -> bool {
8966        self.inner.channel().is_closed()
8967    }
8968    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
8969        self.inner.channel().on_closed()
8970    }
8971}
8972
8973impl RingBufferControlHandle {}
8974
8975#[must_use = "FIDL methods require a response to be sent"]
8976#[derive(Debug)]
8977pub struct RingBufferGetPropertiesResponder {
8978    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
8979    tx_id: u32,
8980}
8981
8982/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
8983/// if the responder is dropped without sending a response, so that the client
8984/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8985impl std::ops::Drop for RingBufferGetPropertiesResponder {
8986    fn drop(&mut self) {
8987        self.control_handle.shutdown();
8988        // Safety: drops once, never accessed again
8989        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8990    }
8991}
8992
8993impl fdomain_client::fidl::Responder for RingBufferGetPropertiesResponder {
8994    type ControlHandle = RingBufferControlHandle;
8995
8996    fn control_handle(&self) -> &RingBufferControlHandle {
8997        &self.control_handle
8998    }
8999
9000    fn drop_without_shutdown(mut self) {
9001        // Safety: drops once, never accessed again due to mem::forget
9002        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9003        // Prevent Drop from running (which would shut down the channel)
9004        std::mem::forget(self);
9005    }
9006}
9007
9008impl RingBufferGetPropertiesResponder {
9009    /// Sends a response to the FIDL transaction.
9010    ///
9011    /// Sets the channel to shutdown if an error occurs.
9012    pub fn send(self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
9013        let _result = self.send_raw(properties);
9014        if _result.is_err() {
9015            self.control_handle.shutdown();
9016        }
9017        self.drop_without_shutdown();
9018        _result
9019    }
9020
9021    /// Similar to "send" but does not shutdown the channel if an error occurs.
9022    pub fn send_no_shutdown_on_err(
9023        self,
9024        mut properties: &RingBufferProperties,
9025    ) -> Result<(), fidl::Error> {
9026        let _result = self.send_raw(properties);
9027        self.drop_without_shutdown();
9028        _result
9029    }
9030
9031    fn send_raw(&self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
9032        self.control_handle.inner.send::<RingBufferGetPropertiesResponse>(
9033            (properties,),
9034            self.tx_id,
9035            0x12947f061a8fe1,
9036            fidl::encoding::DynamicFlags::empty(),
9037        )
9038    }
9039}
9040
9041#[must_use = "FIDL methods require a response to be sent"]
9042#[derive(Debug)]
9043pub struct RingBufferWatchClockRecoveryPositionInfoResponder {
9044    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9045    tx_id: u32,
9046}
9047
9048/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9049/// if the responder is dropped without sending a response, so that the client
9050/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9051impl std::ops::Drop for RingBufferWatchClockRecoveryPositionInfoResponder {
9052    fn drop(&mut self) {
9053        self.control_handle.shutdown();
9054        // Safety: drops once, never accessed again
9055        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9056    }
9057}
9058
9059impl fdomain_client::fidl::Responder for RingBufferWatchClockRecoveryPositionInfoResponder {
9060    type ControlHandle = RingBufferControlHandle;
9061
9062    fn control_handle(&self) -> &RingBufferControlHandle {
9063        &self.control_handle
9064    }
9065
9066    fn drop_without_shutdown(mut self) {
9067        // Safety: drops once, never accessed again due to mem::forget
9068        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9069        // Prevent Drop from running (which would shut down the channel)
9070        std::mem::forget(self);
9071    }
9072}
9073
9074impl RingBufferWatchClockRecoveryPositionInfoResponder {
9075    /// Sends a response to the FIDL transaction.
9076    ///
9077    /// Sets the channel to shutdown if an error occurs.
9078    pub fn send(self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
9079        let _result = self.send_raw(position_info);
9080        if _result.is_err() {
9081            self.control_handle.shutdown();
9082        }
9083        self.drop_without_shutdown();
9084        _result
9085    }
9086
9087    /// Similar to "send" but does not shutdown the channel if an error occurs.
9088    pub fn send_no_shutdown_on_err(
9089        self,
9090        mut position_info: &RingBufferPositionInfo,
9091    ) -> Result<(), fidl::Error> {
9092        let _result = self.send_raw(position_info);
9093        self.drop_without_shutdown();
9094        _result
9095    }
9096
9097    fn send_raw(&self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
9098        self.control_handle.inner.send::<RingBufferWatchClockRecoveryPositionInfoResponse>(
9099            (position_info,),
9100            self.tx_id,
9101            0x694d5b898a4167e5,
9102            fidl::encoding::DynamicFlags::empty(),
9103        )
9104    }
9105}
9106
9107#[must_use = "FIDL methods require a response to be sent"]
9108#[derive(Debug)]
9109pub struct RingBufferGetVmoResponder {
9110    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9111    tx_id: u32,
9112}
9113
9114/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9115/// if the responder is dropped without sending a response, so that the client
9116/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9117impl std::ops::Drop for RingBufferGetVmoResponder {
9118    fn drop(&mut self) {
9119        self.control_handle.shutdown();
9120        // Safety: drops once, never accessed again
9121        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9122    }
9123}
9124
9125impl fdomain_client::fidl::Responder for RingBufferGetVmoResponder {
9126    type ControlHandle = RingBufferControlHandle;
9127
9128    fn control_handle(&self) -> &RingBufferControlHandle {
9129        &self.control_handle
9130    }
9131
9132    fn drop_without_shutdown(mut self) {
9133        // Safety: drops once, never accessed again due to mem::forget
9134        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9135        // Prevent Drop from running (which would shut down the channel)
9136        std::mem::forget(self);
9137    }
9138}
9139
9140impl RingBufferGetVmoResponder {
9141    /// Sends a response to the FIDL transaction.
9142    ///
9143    /// Sets the channel to shutdown if an error occurs.
9144    pub fn send(
9145        self,
9146        mut result: Result<(u32, fdomain_client::Vmo), GetVmoError>,
9147    ) -> Result<(), fidl::Error> {
9148        let _result = self.send_raw(result);
9149        if _result.is_err() {
9150            self.control_handle.shutdown();
9151        }
9152        self.drop_without_shutdown();
9153        _result
9154    }
9155
9156    /// Similar to "send" but does not shutdown the channel if an error occurs.
9157    pub fn send_no_shutdown_on_err(
9158        self,
9159        mut result: Result<(u32, fdomain_client::Vmo), GetVmoError>,
9160    ) -> Result<(), fidl::Error> {
9161        let _result = self.send_raw(result);
9162        self.drop_without_shutdown();
9163        _result
9164    }
9165
9166    fn send_raw(
9167        &self,
9168        mut result: Result<(u32, fdomain_client::Vmo), GetVmoError>,
9169    ) -> Result<(), fidl::Error> {
9170        self.control_handle
9171            .inner
9172            .send::<fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>>(
9173                result,
9174                self.tx_id,
9175                0x44c8f4f5680e853a,
9176                fidl::encoding::DynamicFlags::empty(),
9177            )
9178    }
9179}
9180
9181#[must_use = "FIDL methods require a response to be sent"]
9182#[derive(Debug)]
9183pub struct RingBufferStartResponder {
9184    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9185    tx_id: u32,
9186}
9187
9188/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9189/// if the responder is dropped without sending a response, so that the client
9190/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9191impl std::ops::Drop for RingBufferStartResponder {
9192    fn drop(&mut self) {
9193        self.control_handle.shutdown();
9194        // Safety: drops once, never accessed again
9195        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9196    }
9197}
9198
9199impl fdomain_client::fidl::Responder for RingBufferStartResponder {
9200    type ControlHandle = RingBufferControlHandle;
9201
9202    fn control_handle(&self) -> &RingBufferControlHandle {
9203        &self.control_handle
9204    }
9205
9206    fn drop_without_shutdown(mut self) {
9207        // Safety: drops once, never accessed again due to mem::forget
9208        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9209        // Prevent Drop from running (which would shut down the channel)
9210        std::mem::forget(self);
9211    }
9212}
9213
9214impl RingBufferStartResponder {
9215    /// Sends a response to the FIDL transaction.
9216    ///
9217    /// Sets the channel to shutdown if an error occurs.
9218    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
9219        let _result = self.send_raw(start_time);
9220        if _result.is_err() {
9221            self.control_handle.shutdown();
9222        }
9223        self.drop_without_shutdown();
9224        _result
9225    }
9226
9227    /// Similar to "send" but does not shutdown the channel if an error occurs.
9228    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
9229        let _result = self.send_raw(start_time);
9230        self.drop_without_shutdown();
9231        _result
9232    }
9233
9234    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
9235        self.control_handle.inner.send::<RingBufferStartResponse>(
9236            (start_time,),
9237            self.tx_id,
9238            0x5dd780a769a8892d,
9239            fidl::encoding::DynamicFlags::empty(),
9240        )
9241    }
9242}
9243
9244#[must_use = "FIDL methods require a response to be sent"]
9245#[derive(Debug)]
9246pub struct RingBufferStopResponder {
9247    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9248    tx_id: u32,
9249}
9250
9251/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9252/// if the responder is dropped without sending a response, so that the client
9253/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9254impl std::ops::Drop for RingBufferStopResponder {
9255    fn drop(&mut self) {
9256        self.control_handle.shutdown();
9257        // Safety: drops once, never accessed again
9258        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9259    }
9260}
9261
9262impl fdomain_client::fidl::Responder for RingBufferStopResponder {
9263    type ControlHandle = RingBufferControlHandle;
9264
9265    fn control_handle(&self) -> &RingBufferControlHandle {
9266        &self.control_handle
9267    }
9268
9269    fn drop_without_shutdown(mut self) {
9270        // Safety: drops once, never accessed again due to mem::forget
9271        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9272        // Prevent Drop from running (which would shut down the channel)
9273        std::mem::forget(self);
9274    }
9275}
9276
9277impl RingBufferStopResponder {
9278    /// Sends a response to the FIDL transaction.
9279    ///
9280    /// Sets the channel to shutdown if an error occurs.
9281    pub fn send(self) -> Result<(), fidl::Error> {
9282        let _result = self.send_raw();
9283        if _result.is_err() {
9284            self.control_handle.shutdown();
9285        }
9286        self.drop_without_shutdown();
9287        _result
9288    }
9289
9290    /// Similar to "send" but does not shutdown the channel if an error occurs.
9291    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9292        let _result = self.send_raw();
9293        self.drop_without_shutdown();
9294        _result
9295    }
9296
9297    fn send_raw(&self) -> Result<(), fidl::Error> {
9298        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9299            (),
9300            self.tx_id,
9301            0x49a73d9cf1d4e110,
9302            fidl::encoding::DynamicFlags::empty(),
9303        )
9304    }
9305}
9306
9307#[must_use = "FIDL methods require a response to be sent"]
9308#[derive(Debug)]
9309pub struct RingBufferSetActiveChannelsResponder {
9310    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9311    tx_id: u32,
9312}
9313
9314/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9315/// if the responder is dropped without sending a response, so that the client
9316/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9317impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
9318    fn drop(&mut self) {
9319        self.control_handle.shutdown();
9320        // Safety: drops once, never accessed again
9321        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9322    }
9323}
9324
9325impl fdomain_client::fidl::Responder for RingBufferSetActiveChannelsResponder {
9326    type ControlHandle = RingBufferControlHandle;
9327
9328    fn control_handle(&self) -> &RingBufferControlHandle {
9329        &self.control_handle
9330    }
9331
9332    fn drop_without_shutdown(mut self) {
9333        // Safety: drops once, never accessed again due to mem::forget
9334        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9335        // Prevent Drop from running (which would shut down the channel)
9336        std::mem::forget(self);
9337    }
9338}
9339
9340impl RingBufferSetActiveChannelsResponder {
9341    /// Sends a response to the FIDL transaction.
9342    ///
9343    /// Sets the channel to shutdown if an error occurs.
9344    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
9345        let _result = self.send_raw(result);
9346        if _result.is_err() {
9347            self.control_handle.shutdown();
9348        }
9349        self.drop_without_shutdown();
9350        _result
9351    }
9352
9353    /// Similar to "send" but does not shutdown the channel if an error occurs.
9354    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
9355        let _result = self.send_raw(result);
9356        self.drop_without_shutdown();
9357        _result
9358    }
9359
9360    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
9361        self.control_handle.inner.send::<fidl::encoding::ResultType<
9362            RingBufferSetActiveChannelsResponse,
9363            i32,
9364        >>(
9365            result.map(|set_time| (set_time,)),
9366            self.tx_id,
9367            0x605464c1d384f309,
9368            fidl::encoding::DynamicFlags::empty(),
9369        )
9370    }
9371}
9372
9373#[must_use = "FIDL methods require a response to be sent"]
9374#[derive(Debug)]
9375pub struct RingBufferWatchDelayInfoResponder {
9376    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9377    tx_id: u32,
9378}
9379
9380/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9381/// if the responder is dropped without sending a response, so that the client
9382/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9383impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
9384    fn drop(&mut self) {
9385        self.control_handle.shutdown();
9386        // Safety: drops once, never accessed again
9387        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9388    }
9389}
9390
9391impl fdomain_client::fidl::Responder for RingBufferWatchDelayInfoResponder {
9392    type ControlHandle = RingBufferControlHandle;
9393
9394    fn control_handle(&self) -> &RingBufferControlHandle {
9395        &self.control_handle
9396    }
9397
9398    fn drop_without_shutdown(mut self) {
9399        // Safety: drops once, never accessed again due to mem::forget
9400        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9401        // Prevent Drop from running (which would shut down the channel)
9402        std::mem::forget(self);
9403    }
9404}
9405
9406impl RingBufferWatchDelayInfoResponder {
9407    /// Sends a response to the FIDL transaction.
9408    ///
9409    /// Sets the channel to shutdown if an error occurs.
9410    pub fn send(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
9411        let _result = self.send_raw(delay_info);
9412        if _result.is_err() {
9413            self.control_handle.shutdown();
9414        }
9415        self.drop_without_shutdown();
9416        _result
9417    }
9418
9419    /// Similar to "send" but does not shutdown the channel if an error occurs.
9420    pub fn send_no_shutdown_on_err(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
9421        let _result = self.send_raw(delay_info);
9422        self.drop_without_shutdown();
9423        _result
9424    }
9425
9426    fn send_raw(&self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
9427        self.control_handle
9428            .inner
9429            .send::<fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>>(
9430                fidl::encoding::Flexible::new((delay_info,)),
9431                self.tx_id,
9432                0x6c1248db213fcf9f,
9433                fidl::encoding::DynamicFlags::FLEXIBLE,
9434            )
9435    }
9436}
9437
9438#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9439pub struct StreamConfigMarker;
9440
9441impl fdomain_client::fidl::ProtocolMarker for StreamConfigMarker {
9442    type Proxy = StreamConfigProxy;
9443    type RequestStream = StreamConfigRequestStream;
9444
9445    const DEBUG_NAME: &'static str = "(anonymous) StreamConfig";
9446}
9447
9448pub trait StreamConfigProxyInterface: Send + Sync {
9449    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
9450        + Send;
9451    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
9452    fn r#signal_processing_connect(
9453        &self,
9454        protocol: fdomain_client::fidl::ServerEnd<
9455            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
9456        >,
9457    ) -> Result<(), fidl::Error>;
9458    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
9459        + Send;
9460    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
9461    type GetSupportedFormatsResponseFut: std::future::Future<Output = Result<Vec<SupportedFormats>, fidl::Error>>
9462        + Send;
9463    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut;
9464    fn r#create_ring_buffer(
9465        &self,
9466        format: &Format,
9467        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
9468    ) -> Result<(), fidl::Error>;
9469    type WatchGainStateResponseFut: std::future::Future<Output = Result<GainState, fidl::Error>>
9470        + Send;
9471    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut;
9472    fn r#set_gain(&self, target_state: &GainState) -> Result<(), fidl::Error>;
9473    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
9474        + Send;
9475    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
9476}
9477
9478#[derive(Debug, Clone)]
9479pub struct StreamConfigProxy {
9480    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
9481}
9482
9483impl fdomain_client::fidl::Proxy for StreamConfigProxy {
9484    type Protocol = StreamConfigMarker;
9485
9486    fn from_channel(inner: fdomain_client::Channel) -> Self {
9487        Self::new(inner)
9488    }
9489
9490    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
9491        self.client.into_channel().map_err(|client| Self { client })
9492    }
9493
9494    fn as_channel(&self) -> &fdomain_client::Channel {
9495        self.client.as_channel()
9496    }
9497}
9498
9499impl StreamConfigProxy {
9500    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfig.
9501    pub fn new(channel: fdomain_client::Channel) -> Self {
9502        let protocol_name =
9503            <StreamConfigMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
9504        Self { client: fidl::client::Client::new(channel, protocol_name) }
9505    }
9506
9507    /// Get a Stream of events from the remote end of the protocol.
9508    ///
9509    /// # Panics
9510    ///
9511    /// Panics if the event stream was already taken.
9512    pub fn take_event_stream(&self) -> StreamConfigEventStream {
9513        StreamConfigEventStream { event_receiver: self.client.take_event_receiver() }
9514    }
9515
9516    /// Retrieves top level health state.
9517    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
9518    pub fn r#get_health_state(
9519        &self,
9520    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
9521    {
9522        StreamConfigProxyInterface::r#get_health_state(self)
9523    }
9524
9525    /// Connect to a `SignalProcessing` protocol.
9526    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
9527    /// the maximum number of connections have already been created, for instance one, then the
9528    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
9529    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
9530    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
9531    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
9532    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
9533    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
9534    /// is intended to be composed, and hence the more verbose name allows differentiation and
9535    /// improved clarity.
9536    pub fn r#signal_processing_connect(
9537        &self,
9538        mut protocol: fdomain_client::fidl::ServerEnd<
9539            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
9540        >,
9541    ) -> Result<(), fidl::Error> {
9542        StreamConfigProxyInterface::r#signal_processing_connect(self, protocol)
9543    }
9544
9545    /// Retrieves top level static properties.
9546    pub fn r#get_properties(
9547        &self,
9548    ) -> fidl::client::QueryResponseFut<
9549        StreamProperties,
9550        fdomain_client::fidl::FDomainResourceDialect,
9551    > {
9552        StreamConfigProxyInterface::r#get_properties(self)
9553    }
9554
9555    /// Gets formats supported by a given driver. When not all combinations supported by the
9556    /// driver can be described with one `SupportedFormats`, the driver returns more than one
9557    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
9558    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
9559    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
9560    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
9561    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
9562    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
9563    /// <<16bits,32bits>,<48KHz,96KHz>>.
9564    pub fn r#get_supported_formats(
9565        &self,
9566    ) -> fidl::client::QueryResponseFut<
9567        Vec<SupportedFormats>,
9568        fdomain_client::fidl::FDomainResourceDialect,
9569    > {
9570        StreamConfigProxyInterface::r#get_supported_formats(self)
9571    }
9572
9573    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
9574    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
9575    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
9576    /// ring buffer channel had been established and was still active, the driver must close that
9577    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
9578    /// operations in the process.
9579    pub fn r#create_ring_buffer(
9580        &self,
9581        mut format: &Format,
9582        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
9583    ) -> Result<(), fidl::Error> {
9584        StreamConfigProxyInterface::r#create_ring_buffer(self, format, ring_buffer)
9585    }
9586
9587    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
9588    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
9589    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
9590    /// from what was most recently reported.
9591    /// If `WatchGainState` is called for a second time before the first call has completed, then
9592    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
9593    pub fn r#watch_gain_state(
9594        &self,
9595    ) -> fidl::client::QueryResponseFut<GainState, fdomain_client::fidl::FDomainResourceDialect>
9596    {
9597        StreamConfigProxyInterface::r#watch_gain_state(self)
9598    }
9599
9600    /// Client update of the gain state.
9601    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
9602        StreamConfigProxyInterface::r#set_gain(self, target_state)
9603    }
9604
9605    /// Get the plug detect state via a hanging get. The driver will reply to the first
9606    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
9607    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
9608    /// If `WatchPlugState` is called for a second time before the first call has completed, then
9609    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
9610    pub fn r#watch_plug_state(
9611        &self,
9612    ) -> fidl::client::QueryResponseFut<PlugState, fdomain_client::fidl::FDomainResourceDialect>
9613    {
9614        StreamConfigProxyInterface::r#watch_plug_state(self)
9615    }
9616}
9617
9618impl StreamConfigProxyInterface for StreamConfigProxy {
9619    type GetHealthStateResponseFut =
9620        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
9621    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
9622        fn _decode(
9623            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9624        ) -> Result<HealthState, fidl::Error> {
9625            let _response = fidl::client::decode_transaction_body::<
9626                HealthGetHealthStateResponse,
9627                fdomain_client::fidl::FDomainResourceDialect,
9628                0x4e146d6bca733a84,
9629            >(_buf?)?;
9630            Ok(_response.state)
9631        }
9632        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
9633            (),
9634            0x4e146d6bca733a84,
9635            fidl::encoding::DynamicFlags::empty(),
9636            _decode,
9637        )
9638    }
9639
9640    fn r#signal_processing_connect(
9641        &self,
9642        mut protocol: fdomain_client::fidl::ServerEnd<
9643            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
9644        >,
9645    ) -> Result<(), fidl::Error> {
9646        self.client.send::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
9647            (protocol,),
9648            0xa81907ce6066295,
9649            fidl::encoding::DynamicFlags::empty(),
9650        )
9651    }
9652
9653    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
9654        StreamProperties,
9655        fdomain_client::fidl::FDomainResourceDialect,
9656    >;
9657    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
9658        fn _decode(
9659            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9660        ) -> Result<StreamProperties, fidl::Error> {
9661            let _response = fidl::client::decode_transaction_body::<
9662                StreamConfigGetPropertiesResponse,
9663                fdomain_client::fidl::FDomainResourceDialect,
9664                0x7d89c02f3e2d3c01,
9665            >(_buf?)?;
9666            Ok(_response.properties)
9667        }
9668        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
9669            (),
9670            0x7d89c02f3e2d3c01,
9671            fidl::encoding::DynamicFlags::empty(),
9672            _decode,
9673        )
9674    }
9675
9676    type GetSupportedFormatsResponseFut = fidl::client::QueryResponseFut<
9677        Vec<SupportedFormats>,
9678        fdomain_client::fidl::FDomainResourceDialect,
9679    >;
9680    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut {
9681        fn _decode(
9682            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9683        ) -> Result<Vec<SupportedFormats>, fidl::Error> {
9684            let _response = fidl::client::decode_transaction_body::<
9685                StreamConfigGetSupportedFormatsResponse,
9686                fdomain_client::fidl::FDomainResourceDialect,
9687                0x448efa7850cafe7e,
9688            >(_buf?)?;
9689            Ok(_response.supported_formats)
9690        }
9691        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<SupportedFormats>>(
9692            (),
9693            0x448efa7850cafe7e,
9694            fidl::encoding::DynamicFlags::empty(),
9695            _decode,
9696        )
9697    }
9698
9699    fn r#create_ring_buffer(
9700        &self,
9701        mut format: &Format,
9702        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
9703    ) -> Result<(), fidl::Error> {
9704        self.client.send::<StreamConfigCreateRingBufferRequest>(
9705            (format, ring_buffer),
9706            0x2afb19dd13faa1ba,
9707            fidl::encoding::DynamicFlags::empty(),
9708        )
9709    }
9710
9711    type WatchGainStateResponseFut =
9712        fidl::client::QueryResponseFut<GainState, fdomain_client::fidl::FDomainResourceDialect>;
9713    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut {
9714        fn _decode(
9715            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9716        ) -> Result<GainState, fidl::Error> {
9717            let _response = fidl::client::decode_transaction_body::<
9718                StreamConfigWatchGainStateResponse,
9719                fdomain_client::fidl::FDomainResourceDialect,
9720                0x4772506136ab65c1,
9721            >(_buf?)?;
9722            Ok(_response.gain_state)
9723        }
9724        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GainState>(
9725            (),
9726            0x4772506136ab65c1,
9727            fidl::encoding::DynamicFlags::empty(),
9728            _decode,
9729        )
9730    }
9731
9732    fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
9733        self.client.send::<StreamConfigSetGainRequest>(
9734            (target_state,),
9735            0x3943b41498c6a384,
9736            fidl::encoding::DynamicFlags::empty(),
9737        )
9738    }
9739
9740    type WatchPlugStateResponseFut =
9741        fidl::client::QueryResponseFut<PlugState, fdomain_client::fidl::FDomainResourceDialect>;
9742    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
9743        fn _decode(
9744            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9745        ) -> Result<PlugState, fidl::Error> {
9746            let _response = fidl::client::decode_transaction_body::<
9747                StreamConfigWatchPlugStateResponse,
9748                fdomain_client::fidl::FDomainResourceDialect,
9749                0x497345a6f048b2a6,
9750            >(_buf?)?;
9751            Ok(_response.plug_state)
9752        }
9753        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
9754            (),
9755            0x497345a6f048b2a6,
9756            fidl::encoding::DynamicFlags::empty(),
9757            _decode,
9758        )
9759    }
9760}
9761
9762pub struct StreamConfigEventStream {
9763    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
9764}
9765
9766impl std::marker::Unpin for StreamConfigEventStream {}
9767
9768impl futures::stream::FusedStream for StreamConfigEventStream {
9769    fn is_terminated(&self) -> bool {
9770        self.event_receiver.is_terminated()
9771    }
9772}
9773
9774impl futures::Stream for StreamConfigEventStream {
9775    type Item = Result<StreamConfigEvent, fidl::Error>;
9776
9777    fn poll_next(
9778        mut self: std::pin::Pin<&mut Self>,
9779        cx: &mut std::task::Context<'_>,
9780    ) -> std::task::Poll<Option<Self::Item>> {
9781        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9782            &mut self.event_receiver,
9783            cx
9784        )?) {
9785            Some(buf) => std::task::Poll::Ready(Some(StreamConfigEvent::decode(buf))),
9786            None => std::task::Poll::Ready(None),
9787        }
9788    }
9789}
9790
9791#[derive(Debug)]
9792pub enum StreamConfigEvent {}
9793
9794impl StreamConfigEvent {
9795    /// Decodes a message buffer as a [`StreamConfigEvent`].
9796    fn decode(
9797        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9798    ) -> Result<StreamConfigEvent, fidl::Error> {
9799        let (bytes, _handles) = buf.split_mut();
9800        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9801        debug_assert_eq!(tx_header.tx_id, 0);
9802        match tx_header.ordinal {
9803            _ => Err(fidl::Error::UnknownOrdinal {
9804                ordinal: tx_header.ordinal,
9805                protocol_name:
9806                    <StreamConfigMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
9807            }),
9808        }
9809    }
9810}
9811
9812/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfig.
9813pub struct StreamConfigRequestStream {
9814    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
9815    is_terminated: bool,
9816}
9817
9818impl std::marker::Unpin for StreamConfigRequestStream {}
9819
9820impl futures::stream::FusedStream for StreamConfigRequestStream {
9821    fn is_terminated(&self) -> bool {
9822        self.is_terminated
9823    }
9824}
9825
9826impl fdomain_client::fidl::RequestStream for StreamConfigRequestStream {
9827    type Protocol = StreamConfigMarker;
9828    type ControlHandle = StreamConfigControlHandle;
9829
9830    fn from_channel(channel: fdomain_client::Channel) -> Self {
9831        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9832    }
9833
9834    fn control_handle(&self) -> Self::ControlHandle {
9835        StreamConfigControlHandle { inner: self.inner.clone() }
9836    }
9837
9838    fn into_inner(
9839        self,
9840    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
9841    {
9842        (self.inner, self.is_terminated)
9843    }
9844
9845    fn from_inner(
9846        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
9847        is_terminated: bool,
9848    ) -> Self {
9849        Self { inner, is_terminated }
9850    }
9851}
9852
9853impl futures::Stream for StreamConfigRequestStream {
9854    type Item = Result<StreamConfigRequest, fidl::Error>;
9855
9856    fn poll_next(
9857        mut self: std::pin::Pin<&mut Self>,
9858        cx: &mut std::task::Context<'_>,
9859    ) -> std::task::Poll<Option<Self::Item>> {
9860        let this = &mut *self;
9861        if this.inner.check_shutdown(cx) {
9862            this.is_terminated = true;
9863            return std::task::Poll::Ready(None);
9864        }
9865        if this.is_terminated {
9866            panic!("polled StreamConfigRequestStream after completion");
9867        }
9868        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
9869            |bytes, handles| {
9870                match this.inner.channel().read_etc(cx, bytes, handles) {
9871                    std::task::Poll::Ready(Ok(())) => {}
9872                    std::task::Poll::Pending => return std::task::Poll::Pending,
9873                    std::task::Poll::Ready(Err(None)) => {
9874                        this.is_terminated = true;
9875                        return std::task::Poll::Ready(None);
9876                    }
9877                    std::task::Poll::Ready(Err(Some(e))) => {
9878                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9879                            e.into(),
9880                        ))));
9881                    }
9882                }
9883
9884                // A message has been received from the channel
9885                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9886
9887                std::task::Poll::Ready(Some(match header.ordinal {
9888                    0x4e146d6bca733a84 => {
9889                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9890                        let mut req = fidl::new_empty!(
9891                            fidl::encoding::EmptyPayload,
9892                            fdomain_client::fidl::FDomainResourceDialect
9893                        );
9894                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9895                        let control_handle =
9896                            StreamConfigControlHandle { inner: this.inner.clone() };
9897                        Ok(StreamConfigRequest::GetHealthState {
9898                            responder: StreamConfigGetHealthStateResponder {
9899                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9900                                tx_id: header.tx_id,
9901                            },
9902                        })
9903                    }
9904                    0xa81907ce6066295 => {
9905                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9906                        let mut req = fidl::new_empty!(fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
9907                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
9908                        let control_handle =
9909                            StreamConfigControlHandle { inner: this.inner.clone() };
9910                        Ok(StreamConfigRequest::SignalProcessingConnect {
9911                            protocol: req.protocol,
9912
9913                            control_handle,
9914                        })
9915                    }
9916                    0x7d89c02f3e2d3c01 => {
9917                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9918                        let mut req = fidl::new_empty!(
9919                            fidl::encoding::EmptyPayload,
9920                            fdomain_client::fidl::FDomainResourceDialect
9921                        );
9922                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9923                        let control_handle =
9924                            StreamConfigControlHandle { inner: this.inner.clone() };
9925                        Ok(StreamConfigRequest::GetProperties {
9926                            responder: StreamConfigGetPropertiesResponder {
9927                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9928                                tx_id: header.tx_id,
9929                            },
9930                        })
9931                    }
9932                    0x448efa7850cafe7e => {
9933                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9934                        let mut req = fidl::new_empty!(
9935                            fidl::encoding::EmptyPayload,
9936                            fdomain_client::fidl::FDomainResourceDialect
9937                        );
9938                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9939                        let control_handle =
9940                            StreamConfigControlHandle { inner: this.inner.clone() };
9941                        Ok(StreamConfigRequest::GetSupportedFormats {
9942                            responder: StreamConfigGetSupportedFormatsResponder {
9943                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9944                                tx_id: header.tx_id,
9945                            },
9946                        })
9947                    }
9948                    0x2afb19dd13faa1ba => {
9949                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9950                        let mut req = fidl::new_empty!(
9951                            StreamConfigCreateRingBufferRequest,
9952                            fdomain_client::fidl::FDomainResourceDialect
9953                        );
9954                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamConfigCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
9955                        let control_handle =
9956                            StreamConfigControlHandle { inner: this.inner.clone() };
9957                        Ok(StreamConfigRequest::CreateRingBuffer {
9958                            format: req.format,
9959                            ring_buffer: req.ring_buffer,
9960
9961                            control_handle,
9962                        })
9963                    }
9964                    0x4772506136ab65c1 => {
9965                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9966                        let mut req = fidl::new_empty!(
9967                            fidl::encoding::EmptyPayload,
9968                            fdomain_client::fidl::FDomainResourceDialect
9969                        );
9970                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9971                        let control_handle =
9972                            StreamConfigControlHandle { inner: this.inner.clone() };
9973                        Ok(StreamConfigRequest::WatchGainState {
9974                            responder: StreamConfigWatchGainStateResponder {
9975                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9976                                tx_id: header.tx_id,
9977                            },
9978                        })
9979                    }
9980                    0x3943b41498c6a384 => {
9981                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9982                        let mut req = fidl::new_empty!(
9983                            StreamConfigSetGainRequest,
9984                            fdomain_client::fidl::FDomainResourceDialect
9985                        );
9986                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamConfigSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
9987                        let control_handle =
9988                            StreamConfigControlHandle { inner: this.inner.clone() };
9989                        Ok(StreamConfigRequest::SetGain {
9990                            target_state: req.target_state,
9991
9992                            control_handle,
9993                        })
9994                    }
9995                    0x497345a6f048b2a6 => {
9996                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9997                        let mut req = fidl::new_empty!(
9998                            fidl::encoding::EmptyPayload,
9999                            fdomain_client::fidl::FDomainResourceDialect
10000                        );
10001                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10002                        let control_handle =
10003                            StreamConfigControlHandle { inner: this.inner.clone() };
10004                        Ok(StreamConfigRequest::WatchPlugState {
10005                            responder: StreamConfigWatchPlugStateResponder {
10006                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10007                                tx_id: header.tx_id,
10008                            },
10009                        })
10010                    }
10011                    _ => Err(fidl::Error::UnknownOrdinal {
10012                        ordinal: header.ordinal,
10013                        protocol_name:
10014                            <StreamConfigMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
10015                    }),
10016                }))
10017            },
10018        )
10019    }
10020}
10021
10022/// For an overview see
10023/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming)
10024/// # Deprecation
10025///
10026/// Not supported anymore, instead use an
10027/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10028/// with one Ring Buffer, see
10029/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10030#[derive(Debug)]
10031pub enum StreamConfigRequest {
10032    /// Retrieves top level health state.
10033    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
10034    GetHealthState { responder: StreamConfigGetHealthStateResponder },
10035    /// Connect to a `SignalProcessing` protocol.
10036    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
10037    /// the maximum number of connections have already been created, for instance one, then the
10038    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
10039    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
10040    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
10041    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
10042    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
10043    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
10044    /// is intended to be composed, and hence the more verbose name allows differentiation and
10045    /// improved clarity.
10046    SignalProcessingConnect {
10047        protocol: fdomain_client::fidl::ServerEnd<
10048            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
10049        >,
10050        control_handle: StreamConfigControlHandle,
10051    },
10052    /// Retrieves top level static properties.
10053    GetProperties { responder: StreamConfigGetPropertiesResponder },
10054    /// Gets formats supported by a given driver. When not all combinations supported by the
10055    /// driver can be described with one `SupportedFormats`, the driver returns more than one
10056    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
10057    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
10058    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
10059    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
10060    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
10061    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
10062    /// <<16bits,32bits>,<48KHz,96KHz>>.
10063    GetSupportedFormats { responder: StreamConfigGetSupportedFormatsResponder },
10064    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
10065    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
10066    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
10067    /// ring buffer channel had been established and was still active, the driver must close that
10068    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
10069    /// operations in the process.
10070    CreateRingBuffer {
10071        format: Format,
10072        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
10073        control_handle: StreamConfigControlHandle,
10074    },
10075    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
10076    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
10077    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
10078    /// from what was most recently reported.
10079    /// If `WatchGainState` is called for a second time before the first call has completed, then
10080    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
10081    WatchGainState { responder: StreamConfigWatchGainStateResponder },
10082    /// Client update of the gain state.
10083    SetGain { target_state: GainState, control_handle: StreamConfigControlHandle },
10084    /// Get the plug detect state via a hanging get. The driver will reply to the first
10085    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
10086    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
10087    /// If `WatchPlugState` is called for a second time before the first call has completed, then
10088    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
10089    WatchPlugState { responder: StreamConfigWatchPlugStateResponder },
10090}
10091
10092impl StreamConfigRequest {
10093    #[allow(irrefutable_let_patterns)]
10094    pub fn into_get_health_state(self) -> Option<(StreamConfigGetHealthStateResponder)> {
10095        if let StreamConfigRequest::GetHealthState { responder } = self {
10096            Some((responder))
10097        } else {
10098            None
10099        }
10100    }
10101
10102    #[allow(irrefutable_let_patterns)]
10103    pub fn into_signal_processing_connect(
10104        self,
10105    ) -> Option<(
10106        fdomain_client::fidl::ServerEnd<
10107            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
10108        >,
10109        StreamConfigControlHandle,
10110    )> {
10111        if let StreamConfigRequest::SignalProcessingConnect { protocol, control_handle } = self {
10112            Some((protocol, control_handle))
10113        } else {
10114            None
10115        }
10116    }
10117
10118    #[allow(irrefutable_let_patterns)]
10119    pub fn into_get_properties(self) -> Option<(StreamConfigGetPropertiesResponder)> {
10120        if let StreamConfigRequest::GetProperties { responder } = self {
10121            Some((responder))
10122        } else {
10123            None
10124        }
10125    }
10126
10127    #[allow(irrefutable_let_patterns)]
10128    pub fn into_get_supported_formats(self) -> Option<(StreamConfigGetSupportedFormatsResponder)> {
10129        if let StreamConfigRequest::GetSupportedFormats { responder } = self {
10130            Some((responder))
10131        } else {
10132            None
10133        }
10134    }
10135
10136    #[allow(irrefutable_let_patterns)]
10137    pub fn into_create_ring_buffer(
10138        self,
10139    ) -> Option<(
10140        Format,
10141        fdomain_client::fidl::ServerEnd<RingBufferMarker>,
10142        StreamConfigControlHandle,
10143    )> {
10144        if let StreamConfigRequest::CreateRingBuffer { format, ring_buffer, control_handle } = self
10145        {
10146            Some((format, ring_buffer, control_handle))
10147        } else {
10148            None
10149        }
10150    }
10151
10152    #[allow(irrefutable_let_patterns)]
10153    pub fn into_watch_gain_state(self) -> Option<(StreamConfigWatchGainStateResponder)> {
10154        if let StreamConfigRequest::WatchGainState { responder } = self {
10155            Some((responder))
10156        } else {
10157            None
10158        }
10159    }
10160
10161    #[allow(irrefutable_let_patterns)]
10162    pub fn into_set_gain(self) -> Option<(GainState, StreamConfigControlHandle)> {
10163        if let StreamConfigRequest::SetGain { target_state, control_handle } = self {
10164            Some((target_state, control_handle))
10165        } else {
10166            None
10167        }
10168    }
10169
10170    #[allow(irrefutable_let_patterns)]
10171    pub fn into_watch_plug_state(self) -> Option<(StreamConfigWatchPlugStateResponder)> {
10172        if let StreamConfigRequest::WatchPlugState { responder } = self {
10173            Some((responder))
10174        } else {
10175            None
10176        }
10177    }
10178
10179    /// Name of the method defined in FIDL
10180    pub fn method_name(&self) -> &'static str {
10181        match *self {
10182            StreamConfigRequest::GetHealthState { .. } => "get_health_state",
10183            StreamConfigRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
10184            StreamConfigRequest::GetProperties { .. } => "get_properties",
10185            StreamConfigRequest::GetSupportedFormats { .. } => "get_supported_formats",
10186            StreamConfigRequest::CreateRingBuffer { .. } => "create_ring_buffer",
10187            StreamConfigRequest::WatchGainState { .. } => "watch_gain_state",
10188            StreamConfigRequest::SetGain { .. } => "set_gain",
10189            StreamConfigRequest::WatchPlugState { .. } => "watch_plug_state",
10190        }
10191    }
10192}
10193
10194#[derive(Debug, Clone)]
10195pub struct StreamConfigControlHandle {
10196    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10197}
10198
10199impl fdomain_client::fidl::ControlHandle for StreamConfigControlHandle {
10200    fn shutdown(&self) {
10201        self.inner.shutdown()
10202    }
10203
10204    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10205        self.inner.shutdown_with_epitaph(status)
10206    }
10207
10208    fn is_closed(&self) -> bool {
10209        self.inner.channel().is_closed()
10210    }
10211    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
10212        self.inner.channel().on_closed()
10213    }
10214}
10215
10216impl StreamConfigControlHandle {}
10217
10218#[must_use = "FIDL methods require a response to be sent"]
10219#[derive(Debug)]
10220pub struct StreamConfigGetHealthStateResponder {
10221    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10222    tx_id: u32,
10223}
10224
10225/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10226/// if the responder is dropped without sending a response, so that the client
10227/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10228impl std::ops::Drop for StreamConfigGetHealthStateResponder {
10229    fn drop(&mut self) {
10230        self.control_handle.shutdown();
10231        // Safety: drops once, never accessed again
10232        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10233    }
10234}
10235
10236impl fdomain_client::fidl::Responder for StreamConfigGetHealthStateResponder {
10237    type ControlHandle = StreamConfigControlHandle;
10238
10239    fn control_handle(&self) -> &StreamConfigControlHandle {
10240        &self.control_handle
10241    }
10242
10243    fn drop_without_shutdown(mut self) {
10244        // Safety: drops once, never accessed again due to mem::forget
10245        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10246        // Prevent Drop from running (which would shut down the channel)
10247        std::mem::forget(self);
10248    }
10249}
10250
10251impl StreamConfigGetHealthStateResponder {
10252    /// Sends a response to the FIDL transaction.
10253    ///
10254    /// Sets the channel to shutdown if an error occurs.
10255    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
10256        let _result = self.send_raw(state);
10257        if _result.is_err() {
10258            self.control_handle.shutdown();
10259        }
10260        self.drop_without_shutdown();
10261        _result
10262    }
10263
10264    /// Similar to "send" but does not shutdown the channel if an error occurs.
10265    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
10266        let _result = self.send_raw(state);
10267        self.drop_without_shutdown();
10268        _result
10269    }
10270
10271    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
10272        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
10273            (state,),
10274            self.tx_id,
10275            0x4e146d6bca733a84,
10276            fidl::encoding::DynamicFlags::empty(),
10277        )
10278    }
10279}
10280
10281#[must_use = "FIDL methods require a response to be sent"]
10282#[derive(Debug)]
10283pub struct StreamConfigGetPropertiesResponder {
10284    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10285    tx_id: u32,
10286}
10287
10288/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10289/// if the responder is dropped without sending a response, so that the client
10290/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10291impl std::ops::Drop for StreamConfigGetPropertiesResponder {
10292    fn drop(&mut self) {
10293        self.control_handle.shutdown();
10294        // Safety: drops once, never accessed again
10295        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10296    }
10297}
10298
10299impl fdomain_client::fidl::Responder for StreamConfigGetPropertiesResponder {
10300    type ControlHandle = StreamConfigControlHandle;
10301
10302    fn control_handle(&self) -> &StreamConfigControlHandle {
10303        &self.control_handle
10304    }
10305
10306    fn drop_without_shutdown(mut self) {
10307        // Safety: drops once, never accessed again due to mem::forget
10308        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10309        // Prevent Drop from running (which would shut down the channel)
10310        std::mem::forget(self);
10311    }
10312}
10313
10314impl StreamConfigGetPropertiesResponder {
10315    /// Sends a response to the FIDL transaction.
10316    ///
10317    /// Sets the channel to shutdown if an error occurs.
10318    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
10319        let _result = self.send_raw(properties);
10320        if _result.is_err() {
10321            self.control_handle.shutdown();
10322        }
10323        self.drop_without_shutdown();
10324        _result
10325    }
10326
10327    /// Similar to "send" but does not shutdown the channel if an error occurs.
10328    pub fn send_no_shutdown_on_err(
10329        self,
10330        mut properties: &StreamProperties,
10331    ) -> Result<(), fidl::Error> {
10332        let _result = self.send_raw(properties);
10333        self.drop_without_shutdown();
10334        _result
10335    }
10336
10337    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
10338        self.control_handle.inner.send::<StreamConfigGetPropertiesResponse>(
10339            (properties,),
10340            self.tx_id,
10341            0x7d89c02f3e2d3c01,
10342            fidl::encoding::DynamicFlags::empty(),
10343        )
10344    }
10345}
10346
10347#[must_use = "FIDL methods require a response to be sent"]
10348#[derive(Debug)]
10349pub struct StreamConfigGetSupportedFormatsResponder {
10350    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10351    tx_id: u32,
10352}
10353
10354/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10355/// if the responder is dropped without sending a response, so that the client
10356/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10357impl std::ops::Drop for StreamConfigGetSupportedFormatsResponder {
10358    fn drop(&mut self) {
10359        self.control_handle.shutdown();
10360        // Safety: drops once, never accessed again
10361        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10362    }
10363}
10364
10365impl fdomain_client::fidl::Responder for StreamConfigGetSupportedFormatsResponder {
10366    type ControlHandle = StreamConfigControlHandle;
10367
10368    fn control_handle(&self) -> &StreamConfigControlHandle {
10369        &self.control_handle
10370    }
10371
10372    fn drop_without_shutdown(mut self) {
10373        // Safety: drops once, never accessed again due to mem::forget
10374        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10375        // Prevent Drop from running (which would shut down the channel)
10376        std::mem::forget(self);
10377    }
10378}
10379
10380impl StreamConfigGetSupportedFormatsResponder {
10381    /// Sends a response to the FIDL transaction.
10382    ///
10383    /// Sets the channel to shutdown if an error occurs.
10384    pub fn send(self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
10385        let _result = self.send_raw(supported_formats);
10386        if _result.is_err() {
10387            self.control_handle.shutdown();
10388        }
10389        self.drop_without_shutdown();
10390        _result
10391    }
10392
10393    /// Similar to "send" but does not shutdown the channel if an error occurs.
10394    pub fn send_no_shutdown_on_err(
10395        self,
10396        mut supported_formats: &[SupportedFormats],
10397    ) -> Result<(), fidl::Error> {
10398        let _result = self.send_raw(supported_formats);
10399        self.drop_without_shutdown();
10400        _result
10401    }
10402
10403    fn send_raw(&self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
10404        self.control_handle.inner.send::<StreamConfigGetSupportedFormatsResponse>(
10405            (supported_formats,),
10406            self.tx_id,
10407            0x448efa7850cafe7e,
10408            fidl::encoding::DynamicFlags::empty(),
10409        )
10410    }
10411}
10412
10413#[must_use = "FIDL methods require a response to be sent"]
10414#[derive(Debug)]
10415pub struct StreamConfigWatchGainStateResponder {
10416    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10417    tx_id: u32,
10418}
10419
10420/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10421/// if the responder is dropped without sending a response, so that the client
10422/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10423impl std::ops::Drop for StreamConfigWatchGainStateResponder {
10424    fn drop(&mut self) {
10425        self.control_handle.shutdown();
10426        // Safety: drops once, never accessed again
10427        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10428    }
10429}
10430
10431impl fdomain_client::fidl::Responder for StreamConfigWatchGainStateResponder {
10432    type ControlHandle = StreamConfigControlHandle;
10433
10434    fn control_handle(&self) -> &StreamConfigControlHandle {
10435        &self.control_handle
10436    }
10437
10438    fn drop_without_shutdown(mut self) {
10439        // Safety: drops once, never accessed again due to mem::forget
10440        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10441        // Prevent Drop from running (which would shut down the channel)
10442        std::mem::forget(self);
10443    }
10444}
10445
10446impl StreamConfigWatchGainStateResponder {
10447    /// Sends a response to the FIDL transaction.
10448    ///
10449    /// Sets the channel to shutdown if an error occurs.
10450    pub fn send(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
10451        let _result = self.send_raw(gain_state);
10452        if _result.is_err() {
10453            self.control_handle.shutdown();
10454        }
10455        self.drop_without_shutdown();
10456        _result
10457    }
10458
10459    /// Similar to "send" but does not shutdown the channel if an error occurs.
10460    pub fn send_no_shutdown_on_err(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
10461        let _result = self.send_raw(gain_state);
10462        self.drop_without_shutdown();
10463        _result
10464    }
10465
10466    fn send_raw(&self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
10467        self.control_handle.inner.send::<StreamConfigWatchGainStateResponse>(
10468            (gain_state,),
10469            self.tx_id,
10470            0x4772506136ab65c1,
10471            fidl::encoding::DynamicFlags::empty(),
10472        )
10473    }
10474}
10475
10476#[must_use = "FIDL methods require a response to be sent"]
10477#[derive(Debug)]
10478pub struct StreamConfigWatchPlugStateResponder {
10479    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10480    tx_id: u32,
10481}
10482
10483/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10484/// if the responder is dropped without sending a response, so that the client
10485/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10486impl std::ops::Drop for StreamConfigWatchPlugStateResponder {
10487    fn drop(&mut self) {
10488        self.control_handle.shutdown();
10489        // Safety: drops once, never accessed again
10490        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10491    }
10492}
10493
10494impl fdomain_client::fidl::Responder for StreamConfigWatchPlugStateResponder {
10495    type ControlHandle = StreamConfigControlHandle;
10496
10497    fn control_handle(&self) -> &StreamConfigControlHandle {
10498        &self.control_handle
10499    }
10500
10501    fn drop_without_shutdown(mut self) {
10502        // Safety: drops once, never accessed again due to mem::forget
10503        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10504        // Prevent Drop from running (which would shut down the channel)
10505        std::mem::forget(self);
10506    }
10507}
10508
10509impl StreamConfigWatchPlugStateResponder {
10510    /// Sends a response to the FIDL transaction.
10511    ///
10512    /// Sets the channel to shutdown if an error occurs.
10513    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
10514        let _result = self.send_raw(plug_state);
10515        if _result.is_err() {
10516            self.control_handle.shutdown();
10517        }
10518        self.drop_without_shutdown();
10519        _result
10520    }
10521
10522    /// Similar to "send" but does not shutdown the channel if an error occurs.
10523    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
10524        let _result = self.send_raw(plug_state);
10525        self.drop_without_shutdown();
10526        _result
10527    }
10528
10529    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
10530        self.control_handle.inner.send::<StreamConfigWatchPlugStateResponse>(
10531            (plug_state,),
10532            self.tx_id,
10533            0x497345a6f048b2a6,
10534            fidl::encoding::DynamicFlags::empty(),
10535        )
10536    }
10537}
10538
10539#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10540pub struct StreamConfigConnectorMarker;
10541
10542impl fdomain_client::fidl::ProtocolMarker for StreamConfigConnectorMarker {
10543    type Proxy = StreamConfigConnectorProxy;
10544    type RequestStream = StreamConfigConnectorRequestStream;
10545
10546    const DEBUG_NAME: &'static str = "(anonymous) StreamConfigConnector";
10547}
10548
10549pub trait StreamConfigConnectorProxyInterface: Send + Sync {
10550    fn r#connect(
10551        &self,
10552        protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10553    ) -> Result<(), fidl::Error>;
10554}
10555
10556#[derive(Debug, Clone)]
10557pub struct StreamConfigConnectorProxy {
10558    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
10559}
10560
10561impl fdomain_client::fidl::Proxy for StreamConfigConnectorProxy {
10562    type Protocol = StreamConfigConnectorMarker;
10563
10564    fn from_channel(inner: fdomain_client::Channel) -> Self {
10565        Self::new(inner)
10566    }
10567
10568    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
10569        self.client.into_channel().map_err(|client| Self { client })
10570    }
10571
10572    fn as_channel(&self) -> &fdomain_client::Channel {
10573        self.client.as_channel()
10574    }
10575}
10576
10577impl StreamConfigConnectorProxy {
10578    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfigConnector.
10579    pub fn new(channel: fdomain_client::Channel) -> Self {
10580        let protocol_name =
10581            <StreamConfigConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
10582        Self { client: fidl::client::Client::new(channel, protocol_name) }
10583    }
10584
10585    /// Get a Stream of events from the remote end of the protocol.
10586    ///
10587    /// # Panics
10588    ///
10589    /// Panics if the event stream was already taken.
10590    pub fn take_event_stream(&self) -> StreamConfigConnectorEventStream {
10591        StreamConfigConnectorEventStream { event_receiver: self.client.take_event_receiver() }
10592    }
10593
10594    /// Connect to a `StreamConfig` protocol.
10595    /// This method allows a component to serve FIDL outside the devhost's control.
10596    pub fn r#connect(
10597        &self,
10598        mut protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10599    ) -> Result<(), fidl::Error> {
10600        StreamConfigConnectorProxyInterface::r#connect(self, protocol)
10601    }
10602}
10603
10604impl StreamConfigConnectorProxyInterface for StreamConfigConnectorProxy {
10605    fn r#connect(
10606        &self,
10607        mut protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10608    ) -> Result<(), fidl::Error> {
10609        self.client.send::<StreamConfigConnectorConnectRequest>(
10610            (protocol,),
10611            0x22051ff3021eafec,
10612            fidl::encoding::DynamicFlags::empty(),
10613        )
10614    }
10615}
10616
10617pub struct StreamConfigConnectorEventStream {
10618    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
10619}
10620
10621impl std::marker::Unpin for StreamConfigConnectorEventStream {}
10622
10623impl futures::stream::FusedStream for StreamConfigConnectorEventStream {
10624    fn is_terminated(&self) -> bool {
10625        self.event_receiver.is_terminated()
10626    }
10627}
10628
10629impl futures::Stream for StreamConfigConnectorEventStream {
10630    type Item = Result<StreamConfigConnectorEvent, fidl::Error>;
10631
10632    fn poll_next(
10633        mut self: std::pin::Pin<&mut Self>,
10634        cx: &mut std::task::Context<'_>,
10635    ) -> std::task::Poll<Option<Self::Item>> {
10636        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10637            &mut self.event_receiver,
10638            cx
10639        )?) {
10640            Some(buf) => std::task::Poll::Ready(Some(StreamConfigConnectorEvent::decode(buf))),
10641            None => std::task::Poll::Ready(None),
10642        }
10643    }
10644}
10645
10646#[derive(Debug)]
10647pub enum StreamConfigConnectorEvent {}
10648
10649impl StreamConfigConnectorEvent {
10650    /// Decodes a message buffer as a [`StreamConfigConnectorEvent`].
10651    fn decode(
10652        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10653    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
10654        let (bytes, _handles) = buf.split_mut();
10655        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10656        debug_assert_eq!(tx_header.tx_id, 0);
10657        match tx_header.ordinal {
10658            _ => Err(fidl::Error::UnknownOrdinal {
10659                ordinal: tx_header.ordinal,
10660                protocol_name: <StreamConfigConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
10661            })
10662        }
10663    }
10664}
10665
10666/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfigConnector.
10667pub struct StreamConfigConnectorRequestStream {
10668    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10669    is_terminated: bool,
10670}
10671
10672impl std::marker::Unpin for StreamConfigConnectorRequestStream {}
10673
10674impl futures::stream::FusedStream for StreamConfigConnectorRequestStream {
10675    fn is_terminated(&self) -> bool {
10676        self.is_terminated
10677    }
10678}
10679
10680impl fdomain_client::fidl::RequestStream for StreamConfigConnectorRequestStream {
10681    type Protocol = StreamConfigConnectorMarker;
10682    type ControlHandle = StreamConfigConnectorControlHandle;
10683
10684    fn from_channel(channel: fdomain_client::Channel) -> Self {
10685        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10686    }
10687
10688    fn control_handle(&self) -> Self::ControlHandle {
10689        StreamConfigConnectorControlHandle { inner: self.inner.clone() }
10690    }
10691
10692    fn into_inner(
10693        self,
10694    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
10695    {
10696        (self.inner, self.is_terminated)
10697    }
10698
10699    fn from_inner(
10700        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10701        is_terminated: bool,
10702    ) -> Self {
10703        Self { inner, is_terminated }
10704    }
10705}
10706
10707impl futures::Stream for StreamConfigConnectorRequestStream {
10708    type Item = Result<StreamConfigConnectorRequest, fidl::Error>;
10709
10710    fn poll_next(
10711        mut self: std::pin::Pin<&mut Self>,
10712        cx: &mut std::task::Context<'_>,
10713    ) -> std::task::Poll<Option<Self::Item>> {
10714        let this = &mut *self;
10715        if this.inner.check_shutdown(cx) {
10716            this.is_terminated = true;
10717            return std::task::Poll::Ready(None);
10718        }
10719        if this.is_terminated {
10720            panic!("polled StreamConfigConnectorRequestStream after completion");
10721        }
10722        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
10723            |bytes, handles| {
10724                match this.inner.channel().read_etc(cx, bytes, handles) {
10725                    std::task::Poll::Ready(Ok(())) => {}
10726                    std::task::Poll::Pending => return std::task::Poll::Pending,
10727                    std::task::Poll::Ready(Err(None)) => {
10728                        this.is_terminated = true;
10729                        return std::task::Poll::Ready(None);
10730                    }
10731                    std::task::Poll::Ready(Err(Some(e))) => {
10732                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10733                            e.into(),
10734                        ))));
10735                    }
10736                }
10737
10738                // A message has been received from the channel
10739                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10740
10741                std::task::Poll::Ready(Some(match header.ordinal {
10742                0x22051ff3021eafec => {
10743                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10744                    let mut req = fidl::new_empty!(StreamConfigConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
10745                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamConfigConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
10746                    let control_handle = StreamConfigConnectorControlHandle {
10747                        inner: this.inner.clone(),
10748                    };
10749                    Ok(StreamConfigConnectorRequest::Connect {protocol: req.protocol,
10750
10751                        control_handle,
10752                    })
10753                }
10754                _ => Err(fidl::Error::UnknownOrdinal {
10755                    ordinal: header.ordinal,
10756                    protocol_name: <StreamConfigConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
10757                }),
10758            }))
10759            },
10760        )
10761    }
10762}
10763
10764/// For an overview see
10765/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming).
10766/// # Deprecation
10767///
10768/// Not supported anymore, instead use an
10769/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10770/// with one Ring Buffer, see
10771/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10772#[derive(Debug)]
10773pub enum StreamConfigConnectorRequest {
10774    /// Connect to a `StreamConfig` protocol.
10775    /// This method allows a component to serve FIDL outside the devhost's control.
10776    Connect {
10777        protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10778        control_handle: StreamConfigConnectorControlHandle,
10779    },
10780}
10781
10782impl StreamConfigConnectorRequest {
10783    #[allow(irrefutable_let_patterns)]
10784    pub fn into_connect(
10785        self,
10786    ) -> Option<(
10787        fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10788        StreamConfigConnectorControlHandle,
10789    )> {
10790        if let StreamConfigConnectorRequest::Connect { protocol, control_handle } = self {
10791            Some((protocol, control_handle))
10792        } else {
10793            None
10794        }
10795    }
10796
10797    /// Name of the method defined in FIDL
10798    pub fn method_name(&self) -> &'static str {
10799        match *self {
10800            StreamConfigConnectorRequest::Connect { .. } => "connect",
10801        }
10802    }
10803}
10804
10805#[derive(Debug, Clone)]
10806pub struct StreamConfigConnectorControlHandle {
10807    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10808}
10809
10810impl fdomain_client::fidl::ControlHandle for StreamConfigConnectorControlHandle {
10811    fn shutdown(&self) {
10812        self.inner.shutdown()
10813    }
10814
10815    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10816        self.inner.shutdown_with_epitaph(status)
10817    }
10818
10819    fn is_closed(&self) -> bool {
10820        self.inner.channel().is_closed()
10821    }
10822    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
10823        self.inner.channel().on_closed()
10824    }
10825}
10826
10827impl StreamConfigConnectorControlHandle {}
10828
10829mod internal {
10830    use super::*;
10831
10832    impl fidl::encoding::ResourceTypeMarker for CodecConnectorConnectRequest {
10833        type Borrowed<'a> = &'a mut Self;
10834        fn take_or_borrow<'a>(
10835            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10836        ) -> Self::Borrowed<'a> {
10837            value
10838        }
10839    }
10840
10841    unsafe impl fidl::encoding::TypeMarker for CodecConnectorConnectRequest {
10842        type Owned = Self;
10843
10844        #[inline(always)]
10845        fn inline_align(_context: fidl::encoding::Context) -> usize {
10846            4
10847        }
10848
10849        #[inline(always)]
10850        fn inline_size(_context: fidl::encoding::Context) -> usize {
10851            4
10852        }
10853    }
10854
10855    unsafe impl
10856        fidl::encoding::Encode<
10857            CodecConnectorConnectRequest,
10858            fdomain_client::fidl::FDomainResourceDialect,
10859        > for &mut CodecConnectorConnectRequest
10860    {
10861        #[inline]
10862        unsafe fn encode(
10863            self,
10864            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10865            offset: usize,
10866            _depth: fidl::encoding::Depth,
10867        ) -> fidl::Result<()> {
10868            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10869            // Delegate to tuple encoding.
10870            fidl::encoding::Encode::<CodecConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
10871                (
10872                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.codec_protocol),
10873                ),
10874                encoder, offset, _depth
10875            )
10876        }
10877    }
10878    unsafe impl<
10879        T0: fidl::encoding::Encode<
10880                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>>,
10881                fdomain_client::fidl::FDomainResourceDialect,
10882            >,
10883    >
10884        fidl::encoding::Encode<
10885            CodecConnectorConnectRequest,
10886            fdomain_client::fidl::FDomainResourceDialect,
10887        > for (T0,)
10888    {
10889        #[inline]
10890        unsafe fn encode(
10891            self,
10892            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10893            offset: usize,
10894            depth: fidl::encoding::Depth,
10895        ) -> fidl::Result<()> {
10896            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10897            // Zero out padding regions. There's no need to apply masks
10898            // because the unmasked parts will be overwritten by fields.
10899            // Write the fields.
10900            self.0.encode(encoder, offset + 0, depth)?;
10901            Ok(())
10902        }
10903    }
10904
10905    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
10906        for CodecConnectorConnectRequest
10907    {
10908        #[inline(always)]
10909        fn new_empty() -> Self {
10910            Self {
10911                codec_protocol: fidl::new_empty!(
10912                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>>,
10913                    fdomain_client::fidl::FDomainResourceDialect
10914                ),
10915            }
10916        }
10917
10918        #[inline]
10919        unsafe fn decode(
10920            &mut self,
10921            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10922            offset: usize,
10923            _depth: fidl::encoding::Depth,
10924        ) -> fidl::Result<()> {
10925            decoder.debug_check_bounds::<Self>(offset);
10926            // Verify that padding bytes are zero.
10927            fidl::decode!(
10928                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>>,
10929                fdomain_client::fidl::FDomainResourceDialect,
10930                &mut self.codec_protocol,
10931                decoder,
10932                offset + 0,
10933                _depth
10934            )?;
10935            Ok(())
10936        }
10937    }
10938
10939    impl fidl::encoding::ResourceTypeMarker for CompositeConnectorConnectRequest {
10940        type Borrowed<'a> = &'a mut Self;
10941        fn take_or_borrow<'a>(
10942            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10943        ) -> Self::Borrowed<'a> {
10944            value
10945        }
10946    }
10947
10948    unsafe impl fidl::encoding::TypeMarker for CompositeConnectorConnectRequest {
10949        type Owned = Self;
10950
10951        #[inline(always)]
10952        fn inline_align(_context: fidl::encoding::Context) -> usize {
10953            4
10954        }
10955
10956        #[inline(always)]
10957        fn inline_size(_context: fidl::encoding::Context) -> usize {
10958            4
10959        }
10960    }
10961
10962    unsafe impl
10963        fidl::encoding::Encode<
10964            CompositeConnectorConnectRequest,
10965            fdomain_client::fidl::FDomainResourceDialect,
10966        > for &mut CompositeConnectorConnectRequest
10967    {
10968        #[inline]
10969        unsafe fn encode(
10970            self,
10971            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10972            offset: usize,
10973            _depth: fidl::encoding::Depth,
10974        ) -> fidl::Result<()> {
10975            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
10976            // Delegate to tuple encoding.
10977            fidl::encoding::Encode::<CompositeConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
10978                (
10979                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.composite_protocol),
10980                ),
10981                encoder, offset, _depth
10982            )
10983        }
10984    }
10985    unsafe impl<
10986        T0: fidl::encoding::Encode<
10987                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>>,
10988                fdomain_client::fidl::FDomainResourceDialect,
10989            >,
10990    >
10991        fidl::encoding::Encode<
10992            CompositeConnectorConnectRequest,
10993            fdomain_client::fidl::FDomainResourceDialect,
10994        > for (T0,)
10995    {
10996        #[inline]
10997        unsafe fn encode(
10998            self,
10999            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11000            offset: usize,
11001            depth: fidl::encoding::Depth,
11002        ) -> fidl::Result<()> {
11003            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
11004            // Zero out padding regions. There's no need to apply masks
11005            // because the unmasked parts will be overwritten by fields.
11006            // Write the fields.
11007            self.0.encode(encoder, offset + 0, depth)?;
11008            Ok(())
11009        }
11010    }
11011
11012    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11013        for CompositeConnectorConnectRequest
11014    {
11015        #[inline(always)]
11016        fn new_empty() -> Self {
11017            Self {
11018                composite_protocol: fidl::new_empty!(
11019                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>>,
11020                    fdomain_client::fidl::FDomainResourceDialect
11021                ),
11022            }
11023        }
11024
11025        #[inline]
11026        unsafe fn decode(
11027            &mut self,
11028            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11029            offset: usize,
11030            _depth: fidl::encoding::Depth,
11031        ) -> fidl::Result<()> {
11032            decoder.debug_check_bounds::<Self>(offset);
11033            // Verify that padding bytes are zero.
11034            fidl::decode!(
11035                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>>,
11036                fdomain_client::fidl::FDomainResourceDialect,
11037                &mut self.composite_protocol,
11038                decoder,
11039                offset + 0,
11040                _depth
11041            )?;
11042            Ok(())
11043        }
11044    }
11045
11046    impl fidl::encoding::ResourceTypeMarker for CompositeCreatePacketStreamRequest {
11047        type Borrowed<'a> = &'a mut Self;
11048        fn take_or_borrow<'a>(
11049            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11050        ) -> Self::Borrowed<'a> {
11051            value
11052        }
11053    }
11054
11055    unsafe impl fidl::encoding::TypeMarker for CompositeCreatePacketStreamRequest {
11056        type Owned = Self;
11057
11058        #[inline(always)]
11059        fn inline_align(_context: fidl::encoding::Context) -> usize {
11060            8
11061        }
11062
11063        #[inline(always)]
11064        fn inline_size(_context: fidl::encoding::Context) -> usize {
11065            32
11066        }
11067    }
11068
11069    unsafe impl
11070        fidl::encoding::Encode<
11071            CompositeCreatePacketStreamRequest,
11072            fdomain_client::fidl::FDomainResourceDialect,
11073        > for &mut CompositeCreatePacketStreamRequest
11074    {
11075        #[inline]
11076        unsafe fn encode(
11077            self,
11078            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11079            offset: usize,
11080            _depth: fidl::encoding::Depth,
11081        ) -> fidl::Result<()> {
11082            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
11083            // Delegate to tuple encoding.
11084            fidl::encoding::Encode::<
11085                CompositeCreatePacketStreamRequest,
11086                fdomain_client::fidl::FDomainResourceDialect,
11087            >::encode(
11088                (
11089                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
11090                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
11091                    <fidl::encoding::Endpoint<
11092                        fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11093                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11094                        &mut self.packet_stream_control,
11095                    ),
11096                ),
11097                encoder,
11098                offset,
11099                _depth,
11100            )
11101        }
11102    }
11103    unsafe impl<
11104        T0: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
11105        T1: fidl::encoding::Encode<Format2, fdomain_client::fidl::FDomainResourceDialect>,
11106        T2: fidl::encoding::Encode<
11107                fidl::encoding::Endpoint<
11108                    fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11109                >,
11110                fdomain_client::fidl::FDomainResourceDialect,
11111            >,
11112    >
11113        fidl::encoding::Encode<
11114            CompositeCreatePacketStreamRequest,
11115            fdomain_client::fidl::FDomainResourceDialect,
11116        > for (T0, T1, T2)
11117    {
11118        #[inline]
11119        unsafe fn encode(
11120            self,
11121            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11122            offset: usize,
11123            depth: fidl::encoding::Depth,
11124        ) -> fidl::Result<()> {
11125            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
11126            // Zero out padding regions. There's no need to apply masks
11127            // because the unmasked parts will be overwritten by fields.
11128            unsafe {
11129                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
11130                (ptr as *mut u64).write_unaligned(0);
11131            }
11132            // Write the fields.
11133            self.0.encode(encoder, offset + 0, depth)?;
11134            self.1.encode(encoder, offset + 8, depth)?;
11135            self.2.encode(encoder, offset + 24, depth)?;
11136            Ok(())
11137        }
11138    }
11139
11140    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11141        for CompositeCreatePacketStreamRequest
11142    {
11143        #[inline(always)]
11144        fn new_empty() -> Self {
11145            Self {
11146                processing_element_id: fidl::new_empty!(
11147                    u64,
11148                    fdomain_client::fidl::FDomainResourceDialect
11149                ),
11150                format: fidl::new_empty!(Format2, fdomain_client::fidl::FDomainResourceDialect),
11151                packet_stream_control: fidl::new_empty!(
11152                    fidl::encoding::Endpoint<
11153                        fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11154                    >,
11155                    fdomain_client::fidl::FDomainResourceDialect
11156                ),
11157            }
11158        }
11159
11160        #[inline]
11161        unsafe fn decode(
11162            &mut self,
11163            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11164            offset: usize,
11165            _depth: fidl::encoding::Depth,
11166        ) -> fidl::Result<()> {
11167            decoder.debug_check_bounds::<Self>(offset);
11168            // Verify that padding bytes are zero.
11169            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
11170            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11171            let mask = 0xffffffff00000000u64;
11172            let maskedval = padval & mask;
11173            if maskedval != 0 {
11174                return Err(fidl::Error::NonZeroPadding {
11175                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
11176                });
11177            }
11178            fidl::decode!(
11179                u64,
11180                fdomain_client::fidl::FDomainResourceDialect,
11181                &mut self.processing_element_id,
11182                decoder,
11183                offset + 0,
11184                _depth
11185            )?;
11186            fidl::decode!(
11187                Format2,
11188                fdomain_client::fidl::FDomainResourceDialect,
11189                &mut self.format,
11190                decoder,
11191                offset + 8,
11192                _depth
11193            )?;
11194            fidl::decode!(
11195                fidl::encoding::Endpoint<
11196                    fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11197                >,
11198                fdomain_client::fidl::FDomainResourceDialect,
11199                &mut self.packet_stream_control,
11200                decoder,
11201                offset + 24,
11202                _depth
11203            )?;
11204            Ok(())
11205        }
11206    }
11207
11208    impl fidl::encoding::ResourceTypeMarker for CompositeCreateRingBufferRequest {
11209        type Borrowed<'a> = &'a mut Self;
11210        fn take_or_borrow<'a>(
11211            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11212        ) -> Self::Borrowed<'a> {
11213            value
11214        }
11215    }
11216
11217    unsafe impl fidl::encoding::TypeMarker for CompositeCreateRingBufferRequest {
11218        type Owned = Self;
11219
11220        #[inline(always)]
11221        fn inline_align(_context: fidl::encoding::Context) -> usize {
11222            8
11223        }
11224
11225        #[inline(always)]
11226        fn inline_size(_context: fidl::encoding::Context) -> usize {
11227            32
11228        }
11229    }
11230
11231    unsafe impl
11232        fidl::encoding::Encode<
11233            CompositeCreateRingBufferRequest,
11234            fdomain_client::fidl::FDomainResourceDialect,
11235        > for &mut CompositeCreateRingBufferRequest
11236    {
11237        #[inline]
11238        unsafe fn encode(
11239            self,
11240            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11241            offset: usize,
11242            _depth: fidl::encoding::Depth,
11243        ) -> fidl::Result<()> {
11244            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
11245            // Delegate to tuple encoding.
11246            fidl::encoding::Encode::<CompositeCreateRingBufferRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11247                (
11248                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
11249                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
11250                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11251                ),
11252                encoder, offset, _depth
11253            )
11254        }
11255    }
11256    unsafe impl<
11257        T0: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
11258        T1: fidl::encoding::Encode<Format2, fdomain_client::fidl::FDomainResourceDialect>,
11259        T2: fidl::encoding::Encode<
11260                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11261                fdomain_client::fidl::FDomainResourceDialect,
11262            >,
11263    >
11264        fidl::encoding::Encode<
11265            CompositeCreateRingBufferRequest,
11266            fdomain_client::fidl::FDomainResourceDialect,
11267        > for (T0, T1, T2)
11268    {
11269        #[inline]
11270        unsafe fn encode(
11271            self,
11272            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11273            offset: usize,
11274            depth: fidl::encoding::Depth,
11275        ) -> fidl::Result<()> {
11276            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
11277            // Zero out padding regions. There's no need to apply masks
11278            // because the unmasked parts will be overwritten by fields.
11279            unsafe {
11280                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
11281                (ptr as *mut u64).write_unaligned(0);
11282            }
11283            // Write the fields.
11284            self.0.encode(encoder, offset + 0, depth)?;
11285            self.1.encode(encoder, offset + 8, depth)?;
11286            self.2.encode(encoder, offset + 24, depth)?;
11287            Ok(())
11288        }
11289    }
11290
11291    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11292        for CompositeCreateRingBufferRequest
11293    {
11294        #[inline(always)]
11295        fn new_empty() -> Self {
11296            Self {
11297                processing_element_id: fidl::new_empty!(
11298                    u64,
11299                    fdomain_client::fidl::FDomainResourceDialect
11300                ),
11301                format: fidl::new_empty!(Format2, fdomain_client::fidl::FDomainResourceDialect),
11302                ring_buffer: fidl::new_empty!(
11303                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11304                    fdomain_client::fidl::FDomainResourceDialect
11305                ),
11306            }
11307        }
11308
11309        #[inline]
11310        unsafe fn decode(
11311            &mut self,
11312            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11313            offset: usize,
11314            _depth: fidl::encoding::Depth,
11315        ) -> fidl::Result<()> {
11316            decoder.debug_check_bounds::<Self>(offset);
11317            // Verify that padding bytes are zero.
11318            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
11319            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11320            let mask = 0xffffffff00000000u64;
11321            let maskedval = padval & mask;
11322            if maskedval != 0 {
11323                return Err(fidl::Error::NonZeroPadding {
11324                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
11325                });
11326            }
11327            fidl::decode!(
11328                u64,
11329                fdomain_client::fidl::FDomainResourceDialect,
11330                &mut self.processing_element_id,
11331                decoder,
11332                offset + 0,
11333                _depth
11334            )?;
11335            fidl::decode!(
11336                Format2,
11337                fdomain_client::fidl::FDomainResourceDialect,
11338                &mut self.format,
11339                decoder,
11340                offset + 8,
11341                _depth
11342            )?;
11343            fidl::decode!(
11344                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11345                fdomain_client::fidl::FDomainResourceDialect,
11346                &mut self.ring_buffer,
11347                decoder,
11348                offset + 24,
11349                _depth
11350            )?;
11351            Ok(())
11352        }
11353    }
11354
11355    impl fidl::encoding::ResourceTypeMarker for DaiConnectorConnectRequest {
11356        type Borrowed<'a> = &'a mut Self;
11357        fn take_or_borrow<'a>(
11358            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11359        ) -> Self::Borrowed<'a> {
11360            value
11361        }
11362    }
11363
11364    unsafe impl fidl::encoding::TypeMarker for DaiConnectorConnectRequest {
11365        type Owned = Self;
11366
11367        #[inline(always)]
11368        fn inline_align(_context: fidl::encoding::Context) -> usize {
11369            4
11370        }
11371
11372        #[inline(always)]
11373        fn inline_size(_context: fidl::encoding::Context) -> usize {
11374            4
11375        }
11376    }
11377
11378    unsafe impl
11379        fidl::encoding::Encode<
11380            DaiConnectorConnectRequest,
11381            fdomain_client::fidl::FDomainResourceDialect,
11382        > for &mut DaiConnectorConnectRequest
11383    {
11384        #[inline]
11385        unsafe fn encode(
11386            self,
11387            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11388            offset: usize,
11389            _depth: fidl::encoding::Depth,
11390        ) -> fidl::Result<()> {
11391            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
11392            // Delegate to tuple encoding.
11393            fidl::encoding::Encode::<DaiConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11394                (
11395                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dai_protocol),
11396                ),
11397                encoder, offset, _depth
11398            )
11399        }
11400    }
11401    unsafe impl<
11402        T0: fidl::encoding::Encode<
11403                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>>,
11404                fdomain_client::fidl::FDomainResourceDialect,
11405            >,
11406    >
11407        fidl::encoding::Encode<
11408            DaiConnectorConnectRequest,
11409            fdomain_client::fidl::FDomainResourceDialect,
11410        > for (T0,)
11411    {
11412        #[inline]
11413        unsafe fn encode(
11414            self,
11415            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11416            offset: usize,
11417            depth: fidl::encoding::Depth,
11418        ) -> fidl::Result<()> {
11419            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
11420            // Zero out padding regions. There's no need to apply masks
11421            // because the unmasked parts will be overwritten by fields.
11422            // Write the fields.
11423            self.0.encode(encoder, offset + 0, depth)?;
11424            Ok(())
11425        }
11426    }
11427
11428    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11429        for DaiConnectorConnectRequest
11430    {
11431        #[inline(always)]
11432        fn new_empty() -> Self {
11433            Self {
11434                dai_protocol: fidl::new_empty!(
11435                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>>,
11436                    fdomain_client::fidl::FDomainResourceDialect
11437                ),
11438            }
11439        }
11440
11441        #[inline]
11442        unsafe fn decode(
11443            &mut self,
11444            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11445            offset: usize,
11446            _depth: fidl::encoding::Depth,
11447        ) -> fidl::Result<()> {
11448            decoder.debug_check_bounds::<Self>(offset);
11449            // Verify that padding bytes are zero.
11450            fidl::decode!(
11451                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>>,
11452                fdomain_client::fidl::FDomainResourceDialect,
11453                &mut self.dai_protocol,
11454                decoder,
11455                offset + 0,
11456                _depth
11457            )?;
11458            Ok(())
11459        }
11460    }
11461
11462    impl fidl::encoding::ResourceTypeMarker for DaiCreateRingBufferRequest {
11463        type Borrowed<'a> = &'a mut Self;
11464        fn take_or_borrow<'a>(
11465            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11466        ) -> Self::Borrowed<'a> {
11467            value
11468        }
11469    }
11470
11471    unsafe impl fidl::encoding::TypeMarker for DaiCreateRingBufferRequest {
11472        type Owned = Self;
11473
11474        #[inline(always)]
11475        fn inline_align(_context: fidl::encoding::Context) -> usize {
11476            8
11477        }
11478
11479        #[inline(always)]
11480        fn inline_size(_context: fidl::encoding::Context) -> usize {
11481            72
11482        }
11483    }
11484
11485    unsafe impl
11486        fidl::encoding::Encode<
11487            DaiCreateRingBufferRequest,
11488            fdomain_client::fidl::FDomainResourceDialect,
11489        > for &mut DaiCreateRingBufferRequest
11490    {
11491        #[inline]
11492        unsafe fn encode(
11493            self,
11494            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11495            offset: usize,
11496            _depth: fidl::encoding::Depth,
11497        ) -> fidl::Result<()> {
11498            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11499            // Delegate to tuple encoding.
11500            fidl::encoding::Encode::<DaiCreateRingBufferRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11501                (
11502                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_format),
11503                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_format),
11504                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11505                ),
11506                encoder, offset, _depth
11507            )
11508        }
11509    }
11510    unsafe impl<
11511        T0: fidl::encoding::Encode<DaiFormat, fdomain_client::fidl::FDomainResourceDialect>,
11512        T1: fidl::encoding::Encode<Format, fdomain_client::fidl::FDomainResourceDialect>,
11513        T2: fidl::encoding::Encode<
11514                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11515                fdomain_client::fidl::FDomainResourceDialect,
11516            >,
11517    >
11518        fidl::encoding::Encode<
11519            DaiCreateRingBufferRequest,
11520            fdomain_client::fidl::FDomainResourceDialect,
11521        > for (T0, T1, T2)
11522    {
11523        #[inline]
11524        unsafe fn encode(
11525            self,
11526            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11527            offset: usize,
11528            depth: fidl::encoding::Depth,
11529        ) -> fidl::Result<()> {
11530            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11531            // Zero out padding regions. There's no need to apply masks
11532            // because the unmasked parts will be overwritten by fields.
11533            unsafe {
11534                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
11535                (ptr as *mut u64).write_unaligned(0);
11536            }
11537            // Write the fields.
11538            self.0.encode(encoder, offset + 0, depth)?;
11539            self.1.encode(encoder, offset + 48, depth)?;
11540            self.2.encode(encoder, offset + 64, depth)?;
11541            Ok(())
11542        }
11543    }
11544
11545    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11546        for DaiCreateRingBufferRequest
11547    {
11548        #[inline(always)]
11549        fn new_empty() -> Self {
11550            Self {
11551                dai_format: fidl::new_empty!(
11552                    DaiFormat,
11553                    fdomain_client::fidl::FDomainResourceDialect
11554                ),
11555                ring_buffer_format: fidl::new_empty!(
11556                    Format,
11557                    fdomain_client::fidl::FDomainResourceDialect
11558                ),
11559                ring_buffer: fidl::new_empty!(
11560                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11561                    fdomain_client::fidl::FDomainResourceDialect
11562                ),
11563            }
11564        }
11565
11566        #[inline]
11567        unsafe fn decode(
11568            &mut self,
11569            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11570            offset: usize,
11571            _depth: fidl::encoding::Depth,
11572        ) -> fidl::Result<()> {
11573            decoder.debug_check_bounds::<Self>(offset);
11574            // Verify that padding bytes are zero.
11575            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
11576            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11577            let mask = 0xffffffff00000000u64;
11578            let maskedval = padval & mask;
11579            if maskedval != 0 {
11580                return Err(fidl::Error::NonZeroPadding {
11581                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
11582                });
11583            }
11584            fidl::decode!(
11585                DaiFormat,
11586                fdomain_client::fidl::FDomainResourceDialect,
11587                &mut self.dai_format,
11588                decoder,
11589                offset + 0,
11590                _depth
11591            )?;
11592            fidl::decode!(
11593                Format,
11594                fdomain_client::fidl::FDomainResourceDialect,
11595                &mut self.ring_buffer_format,
11596                decoder,
11597                offset + 48,
11598                _depth
11599            )?;
11600            fidl::decode!(
11601                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11602                fdomain_client::fidl::FDomainResourceDialect,
11603                &mut self.ring_buffer,
11604                decoder,
11605                offset + 64,
11606                _depth
11607            )?;
11608            Ok(())
11609        }
11610    }
11611
11612    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlAllocateVmosResponse {
11613        type Borrowed<'a> = &'a mut Self;
11614        fn take_or_borrow<'a>(
11615            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11616        ) -> Self::Borrowed<'a> {
11617            value
11618        }
11619    }
11620
11621    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlAllocateVmosResponse {
11622        type Owned = Self;
11623
11624        #[inline(always)]
11625        fn inline_align(_context: fidl::encoding::Context) -> usize {
11626            8
11627        }
11628
11629        #[inline(always)]
11630        fn inline_size(_context: fidl::encoding::Context) -> usize {
11631            16
11632        }
11633    }
11634
11635    unsafe impl
11636        fidl::encoding::Encode<
11637            PacketStreamControlAllocateVmosResponse,
11638            fdomain_client::fidl::FDomainResourceDialect,
11639        > for &mut PacketStreamControlAllocateVmosResponse
11640    {
11641        #[inline]
11642        unsafe fn encode(
11643            self,
11644            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11645            offset: usize,
11646            _depth: fidl::encoding::Depth,
11647        ) -> fidl::Result<()> {
11648            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
11649            // Delegate to tuple encoding.
11650            fidl::encoding::Encode::<PacketStreamControlAllocateVmosResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
11651                (
11652                    <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmos),
11653                ),
11654                encoder, offset, _depth
11655            )
11656        }
11657    }
11658    unsafe impl<
11659        T0: fidl::encoding::Encode<
11660                fidl::encoding::Vector<VmoInfo, 256>,
11661                fdomain_client::fidl::FDomainResourceDialect,
11662            >,
11663    >
11664        fidl::encoding::Encode<
11665            PacketStreamControlAllocateVmosResponse,
11666            fdomain_client::fidl::FDomainResourceDialect,
11667        > for (T0,)
11668    {
11669        #[inline]
11670        unsafe fn encode(
11671            self,
11672            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11673            offset: usize,
11674            depth: fidl::encoding::Depth,
11675        ) -> fidl::Result<()> {
11676            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
11677            // Zero out padding regions. There's no need to apply masks
11678            // because the unmasked parts will be overwritten by fields.
11679            // Write the fields.
11680            self.0.encode(encoder, offset + 0, depth)?;
11681            Ok(())
11682        }
11683    }
11684
11685    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11686        for PacketStreamControlAllocateVmosResponse
11687    {
11688        #[inline(always)]
11689        fn new_empty() -> Self {
11690            Self {
11691                vmos: fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect),
11692            }
11693        }
11694
11695        #[inline]
11696        unsafe fn decode(
11697            &mut self,
11698            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11699            offset: usize,
11700            _depth: fidl::encoding::Depth,
11701        ) -> fidl::Result<()> {
11702            decoder.debug_check_bounds::<Self>(offset);
11703            // Verify that padding bytes are zero.
11704            fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect, &mut self.vmos, decoder, offset + 0, _depth)?;
11705            Ok(())
11706        }
11707    }
11708
11709    impl fidl::encoding::ResourceTypeMarker for RingBufferGetVmoResponse {
11710        type Borrowed<'a> = &'a mut Self;
11711        fn take_or_borrow<'a>(
11712            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11713        ) -> Self::Borrowed<'a> {
11714            value
11715        }
11716    }
11717
11718    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoResponse {
11719        type Owned = Self;
11720
11721        #[inline(always)]
11722        fn inline_align(_context: fidl::encoding::Context) -> usize {
11723            4
11724        }
11725
11726        #[inline(always)]
11727        fn inline_size(_context: fidl::encoding::Context) -> usize {
11728            8
11729        }
11730    }
11731
11732    unsafe impl
11733        fidl::encoding::Encode<
11734            RingBufferGetVmoResponse,
11735            fdomain_client::fidl::FDomainResourceDialect,
11736        > for &mut RingBufferGetVmoResponse
11737    {
11738        #[inline]
11739        unsafe fn encode(
11740            self,
11741            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11742            offset: usize,
11743            _depth: fidl::encoding::Depth,
11744        ) -> fidl::Result<()> {
11745            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11746            // Delegate to tuple encoding.
11747            fidl::encoding::Encode::<
11748                RingBufferGetVmoResponse,
11749                fdomain_client::fidl::FDomainResourceDialect,
11750            >::encode(
11751                (
11752                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_frames),
11753                    <fidl::encoding::HandleType<
11754                        fdomain_client::Vmo,
11755                        { fidl::ObjectType::VMO.into_raw() },
11756                        2147483648,
11757                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11758                        &mut self.ring_buffer
11759                    ),
11760                ),
11761                encoder,
11762                offset,
11763                _depth,
11764            )
11765        }
11766    }
11767    unsafe impl<
11768        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
11769        T1: fidl::encoding::Encode<
11770                fidl::encoding::HandleType<
11771                    fdomain_client::Vmo,
11772                    { fidl::ObjectType::VMO.into_raw() },
11773                    2147483648,
11774                >,
11775                fdomain_client::fidl::FDomainResourceDialect,
11776            >,
11777    >
11778        fidl::encoding::Encode<
11779            RingBufferGetVmoResponse,
11780            fdomain_client::fidl::FDomainResourceDialect,
11781        > for (T0, T1)
11782    {
11783        #[inline]
11784        unsafe fn encode(
11785            self,
11786            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11787            offset: usize,
11788            depth: fidl::encoding::Depth,
11789        ) -> fidl::Result<()> {
11790            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11791            // Zero out padding regions. There's no need to apply masks
11792            // because the unmasked parts will be overwritten by fields.
11793            // Write the fields.
11794            self.0.encode(encoder, offset + 0, depth)?;
11795            self.1.encode(encoder, offset + 4, depth)?;
11796            Ok(())
11797        }
11798    }
11799
11800    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11801        for RingBufferGetVmoResponse
11802    {
11803        #[inline(always)]
11804        fn new_empty() -> Self {
11805            Self {
11806                num_frames: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
11807                ring_buffer: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
11808            }
11809        }
11810
11811        #[inline]
11812        unsafe fn decode(
11813            &mut self,
11814            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11815            offset: usize,
11816            _depth: fidl::encoding::Depth,
11817        ) -> fidl::Result<()> {
11818            decoder.debug_check_bounds::<Self>(offset);
11819            // Verify that padding bytes are zero.
11820            fidl::decode!(
11821                u32,
11822                fdomain_client::fidl::FDomainResourceDialect,
11823                &mut self.num_frames,
11824                decoder,
11825                offset + 0,
11826                _depth
11827            )?;
11828            fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, &mut self.ring_buffer, decoder, offset + 4, _depth)?;
11829            Ok(())
11830        }
11831    }
11832
11833    impl fidl::encoding::ResourceTypeMarker for StreamConfigConnectorConnectRequest {
11834        type Borrowed<'a> = &'a mut Self;
11835        fn take_or_borrow<'a>(
11836            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11837        ) -> Self::Borrowed<'a> {
11838            value
11839        }
11840    }
11841
11842    unsafe impl fidl::encoding::TypeMarker for StreamConfigConnectorConnectRequest {
11843        type Owned = Self;
11844
11845        #[inline(always)]
11846        fn inline_align(_context: fidl::encoding::Context) -> usize {
11847            4
11848        }
11849
11850        #[inline(always)]
11851        fn inline_size(_context: fidl::encoding::Context) -> usize {
11852            4
11853        }
11854    }
11855
11856    unsafe impl
11857        fidl::encoding::Encode<
11858            StreamConfigConnectorConnectRequest,
11859            fdomain_client::fidl::FDomainResourceDialect,
11860        > for &mut StreamConfigConnectorConnectRequest
11861    {
11862        #[inline]
11863        unsafe fn encode(
11864            self,
11865            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11866            offset: usize,
11867            _depth: fidl::encoding::Depth,
11868        ) -> fidl::Result<()> {
11869            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11870            // Delegate to tuple encoding.
11871            fidl::encoding::Encode::<StreamConfigConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11872                (
11873                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
11874                ),
11875                encoder, offset, _depth
11876            )
11877        }
11878    }
11879    unsafe impl<
11880        T0: fidl::encoding::Encode<
11881                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>>,
11882                fdomain_client::fidl::FDomainResourceDialect,
11883            >,
11884    >
11885        fidl::encoding::Encode<
11886            StreamConfigConnectorConnectRequest,
11887            fdomain_client::fidl::FDomainResourceDialect,
11888        > for (T0,)
11889    {
11890        #[inline]
11891        unsafe fn encode(
11892            self,
11893            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11894            offset: usize,
11895            depth: fidl::encoding::Depth,
11896        ) -> fidl::Result<()> {
11897            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11898            // Zero out padding regions. There's no need to apply masks
11899            // because the unmasked parts will be overwritten by fields.
11900            // Write the fields.
11901            self.0.encode(encoder, offset + 0, depth)?;
11902            Ok(())
11903        }
11904    }
11905
11906    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11907        for StreamConfigConnectorConnectRequest
11908    {
11909        #[inline(always)]
11910        fn new_empty() -> Self {
11911            Self {
11912                protocol: fidl::new_empty!(
11913                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>>,
11914                    fdomain_client::fidl::FDomainResourceDialect
11915                ),
11916            }
11917        }
11918
11919        #[inline]
11920        unsafe fn decode(
11921            &mut self,
11922            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11923            offset: usize,
11924            _depth: fidl::encoding::Depth,
11925        ) -> fidl::Result<()> {
11926            decoder.debug_check_bounds::<Self>(offset);
11927            // Verify that padding bytes are zero.
11928            fidl::decode!(
11929                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>>,
11930                fdomain_client::fidl::FDomainResourceDialect,
11931                &mut self.protocol,
11932                decoder,
11933                offset + 0,
11934                _depth
11935            )?;
11936            Ok(())
11937        }
11938    }
11939
11940    impl fidl::encoding::ResourceTypeMarker for StreamConfigCreateRingBufferRequest {
11941        type Borrowed<'a> = &'a mut Self;
11942        fn take_or_borrow<'a>(
11943            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11944        ) -> Self::Borrowed<'a> {
11945            value
11946        }
11947    }
11948
11949    unsafe impl fidl::encoding::TypeMarker for StreamConfigCreateRingBufferRequest {
11950        type Owned = Self;
11951
11952        #[inline(always)]
11953        fn inline_align(_context: fidl::encoding::Context) -> usize {
11954            8
11955        }
11956
11957        #[inline(always)]
11958        fn inline_size(_context: fidl::encoding::Context) -> usize {
11959            24
11960        }
11961    }
11962
11963    unsafe impl
11964        fidl::encoding::Encode<
11965            StreamConfigCreateRingBufferRequest,
11966            fdomain_client::fidl::FDomainResourceDialect,
11967        > for &mut StreamConfigCreateRingBufferRequest
11968    {
11969        #[inline]
11970        unsafe fn encode(
11971            self,
11972            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11973            offset: usize,
11974            _depth: fidl::encoding::Depth,
11975        ) -> fidl::Result<()> {
11976            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
11977            // Delegate to tuple encoding.
11978            fidl::encoding::Encode::<StreamConfigCreateRingBufferRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11979                (
11980                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
11981                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11982                ),
11983                encoder, offset, _depth
11984            )
11985        }
11986    }
11987    unsafe impl<
11988        T0: fidl::encoding::Encode<Format, fdomain_client::fidl::FDomainResourceDialect>,
11989        T1: fidl::encoding::Encode<
11990                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11991                fdomain_client::fidl::FDomainResourceDialect,
11992            >,
11993    >
11994        fidl::encoding::Encode<
11995            StreamConfigCreateRingBufferRequest,
11996            fdomain_client::fidl::FDomainResourceDialect,
11997        > for (T0, T1)
11998    {
11999        #[inline]
12000        unsafe fn encode(
12001            self,
12002            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12003            offset: usize,
12004            depth: fidl::encoding::Depth,
12005        ) -> fidl::Result<()> {
12006            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
12007            // Zero out padding regions. There's no need to apply masks
12008            // because the unmasked parts will be overwritten by fields.
12009            unsafe {
12010                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
12011                (ptr as *mut u64).write_unaligned(0);
12012            }
12013            // Write the fields.
12014            self.0.encode(encoder, offset + 0, depth)?;
12015            self.1.encode(encoder, offset + 16, depth)?;
12016            Ok(())
12017        }
12018    }
12019
12020    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12021        for StreamConfigCreateRingBufferRequest
12022    {
12023        #[inline(always)]
12024        fn new_empty() -> Self {
12025            Self {
12026                format: fidl::new_empty!(Format, fdomain_client::fidl::FDomainResourceDialect),
12027                ring_buffer: fidl::new_empty!(
12028                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
12029                    fdomain_client::fidl::FDomainResourceDialect
12030                ),
12031            }
12032        }
12033
12034        #[inline]
12035        unsafe fn decode(
12036            &mut self,
12037            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12038            offset: usize,
12039            _depth: fidl::encoding::Depth,
12040        ) -> fidl::Result<()> {
12041            decoder.debug_check_bounds::<Self>(offset);
12042            // Verify that padding bytes are zero.
12043            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
12044            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12045            let mask = 0xffffffff00000000u64;
12046            let maskedval = padval & mask;
12047            if maskedval != 0 {
12048                return Err(fidl::Error::NonZeroPadding {
12049                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
12050                });
12051            }
12052            fidl::decode!(
12053                Format,
12054                fdomain_client::fidl::FDomainResourceDialect,
12055                &mut self.format,
12056                decoder,
12057                offset + 0,
12058                _depth
12059            )?;
12060            fidl::decode!(
12061                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
12062                fdomain_client::fidl::FDomainResourceDialect,
12063                &mut self.ring_buffer,
12064                decoder,
12065                offset + 16,
12066                _depth
12067            )?;
12068            Ok(())
12069        }
12070    }
12071
12072    impl PacketStreamControlSetPacketStreamSinkRequest {
12073        #[inline(always)]
12074        fn max_ordinal_present(&self) -> u64 {
12075            if let Some(_) = self.stream {
12076                return 1;
12077            }
12078            0
12079        }
12080    }
12081
12082    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
12083        type Borrowed<'a> = &'a mut Self;
12084        fn take_or_borrow<'a>(
12085            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12086        ) -> Self::Borrowed<'a> {
12087            value
12088        }
12089    }
12090
12091    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
12092        type Owned = Self;
12093
12094        #[inline(always)]
12095        fn inline_align(_context: fidl::encoding::Context) -> usize {
12096            8
12097        }
12098
12099        #[inline(always)]
12100        fn inline_size(_context: fidl::encoding::Context) -> usize {
12101            16
12102        }
12103    }
12104
12105    unsafe impl
12106        fidl::encoding::Encode<
12107            PacketStreamControlSetPacketStreamSinkRequest,
12108            fdomain_client::fidl::FDomainResourceDialect,
12109        > for &mut PacketStreamControlSetPacketStreamSinkRequest
12110    {
12111        unsafe fn encode(
12112            self,
12113            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12114            offset: usize,
12115            mut depth: fidl::encoding::Depth,
12116        ) -> fidl::Result<()> {
12117            encoder.debug_check_bounds::<PacketStreamControlSetPacketStreamSinkRequest>(offset);
12118            // Vector header
12119            let max_ordinal: u64 = self.max_ordinal_present();
12120            encoder.write_num(max_ordinal, offset);
12121            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12122            // Calling encoder.out_of_line_offset(0) is not allowed.
12123            if max_ordinal == 0 {
12124                return Ok(());
12125            }
12126            depth.increment()?;
12127            let envelope_size = 8;
12128            let bytes_len = max_ordinal as usize * envelope_size;
12129            #[allow(unused_variables)]
12130            let offset = encoder.out_of_line_offset(bytes_len);
12131            let mut _prev_end_offset: usize = 0;
12132            if 1 > max_ordinal {
12133                return Ok(());
12134            }
12135
12136            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12137            // are envelope_size bytes.
12138            let cur_offset: usize = (1 - 1) * envelope_size;
12139
12140            // Zero reserved fields.
12141            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12142
12143            // Safety:
12144            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12145            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12146            //   envelope_size bytes, there is always sufficient room.
12147            fidl::encoding::encode_in_envelope_optional::<
12148                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>>,
12149                fdomain_client::fidl::FDomainResourceDialect,
12150            >(
12151                self.stream.as_mut().map(
12152                    <fidl::encoding::Endpoint<
12153                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12154                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12155                ),
12156                encoder,
12157                offset + cur_offset,
12158                depth,
12159            )?;
12160
12161            _prev_end_offset = cur_offset + envelope_size;
12162
12163            Ok(())
12164        }
12165    }
12166
12167    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12168        for PacketStreamControlSetPacketStreamSinkRequest
12169    {
12170        #[inline(always)]
12171        fn new_empty() -> Self {
12172            Self::default()
12173        }
12174
12175        unsafe fn decode(
12176            &mut self,
12177            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12178            offset: usize,
12179            mut depth: fidl::encoding::Depth,
12180        ) -> fidl::Result<()> {
12181            decoder.debug_check_bounds::<Self>(offset);
12182            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12183                None => return Err(fidl::Error::NotNullable),
12184                Some(len) => len,
12185            };
12186            // Calling decoder.out_of_line_offset(0) is not allowed.
12187            if len == 0 {
12188                return Ok(());
12189            };
12190            depth.increment()?;
12191            let envelope_size = 8;
12192            let bytes_len = len * envelope_size;
12193            let offset = decoder.out_of_line_offset(bytes_len)?;
12194            // Decode the envelope for each type.
12195            let mut _next_ordinal_to_read = 0;
12196            let mut next_offset = offset;
12197            let end_offset = offset + bytes_len;
12198            _next_ordinal_to_read += 1;
12199            if next_offset >= end_offset {
12200                return Ok(());
12201            }
12202
12203            // Decode unknown envelopes for gaps in ordinals.
12204            while _next_ordinal_to_read < 1 {
12205                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12206                _next_ordinal_to_read += 1;
12207                next_offset += envelope_size;
12208            }
12209
12210            let next_out_of_line = decoder.next_out_of_line();
12211            let handles_before = decoder.remaining_handles();
12212            if let Some((inlined, num_bytes, num_handles)) =
12213                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12214            {
12215                let member_inline_size = <fidl::encoding::Endpoint<
12216                    fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12217                > as fidl::encoding::TypeMarker>::inline_size(
12218                    decoder.context
12219                );
12220                if inlined != (member_inline_size <= 4) {
12221                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12222                }
12223                let inner_offset;
12224                let mut inner_depth = depth.clone();
12225                if inlined {
12226                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12227                    inner_offset = next_offset;
12228                } else {
12229                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12230                    inner_depth.increment()?;
12231                }
12232                let val_ref = self.stream.get_or_insert_with(|| {
12233                    fidl::new_empty!(
12234                        fidl::encoding::Endpoint<
12235                            fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12236                        >,
12237                        fdomain_client::fidl::FDomainResourceDialect
12238                    )
12239                });
12240                fidl::decode!(
12241                    fidl::encoding::Endpoint<
12242                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12243                    >,
12244                    fdomain_client::fidl::FDomainResourceDialect,
12245                    val_ref,
12246                    decoder,
12247                    inner_offset,
12248                    inner_depth
12249                )?;
12250                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12251                {
12252                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12253                }
12254                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12255                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12256                }
12257            }
12258
12259            next_offset += envelope_size;
12260
12261            // Decode the remaining unknown envelopes.
12262            while next_offset < end_offset {
12263                _next_ordinal_to_read += 1;
12264                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12265                next_offset += envelope_size;
12266            }
12267
12268            Ok(())
12269        }
12270    }
12271
12272    impl PacketStreamControlGetPacketStreamSinkResponse {
12273        #[inline(always)]
12274        fn max_ordinal_present(&self) -> u64 {
12275            if let Some(_) = self.stream {
12276                return 1;
12277            }
12278            0
12279        }
12280    }
12281
12282    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
12283        type Borrowed<'a> = &'a mut Self;
12284        fn take_or_borrow<'a>(
12285            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12286        ) -> Self::Borrowed<'a> {
12287            value
12288        }
12289    }
12290
12291    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
12292        type Owned = Self;
12293
12294        #[inline(always)]
12295        fn inline_align(_context: fidl::encoding::Context) -> usize {
12296            8
12297        }
12298
12299        #[inline(always)]
12300        fn inline_size(_context: fidl::encoding::Context) -> usize {
12301            16
12302        }
12303    }
12304
12305    unsafe impl
12306        fidl::encoding::Encode<
12307            PacketStreamControlGetPacketStreamSinkResponse,
12308            fdomain_client::fidl::FDomainResourceDialect,
12309        > for &mut PacketStreamControlGetPacketStreamSinkResponse
12310    {
12311        unsafe fn encode(
12312            self,
12313            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12314            offset: usize,
12315            mut depth: fidl::encoding::Depth,
12316        ) -> fidl::Result<()> {
12317            encoder.debug_check_bounds::<PacketStreamControlGetPacketStreamSinkResponse>(offset);
12318            // Vector header
12319            let max_ordinal: u64 = self.max_ordinal_present();
12320            encoder.write_num(max_ordinal, offset);
12321            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12322            // Calling encoder.out_of_line_offset(0) is not allowed.
12323            if max_ordinal == 0 {
12324                return Ok(());
12325            }
12326            depth.increment()?;
12327            let envelope_size = 8;
12328            let bytes_len = max_ordinal as usize * envelope_size;
12329            #[allow(unused_variables)]
12330            let offset = encoder.out_of_line_offset(bytes_len);
12331            let mut _prev_end_offset: usize = 0;
12332            if 1 > max_ordinal {
12333                return Ok(());
12334            }
12335
12336            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12337            // are envelope_size bytes.
12338            let cur_offset: usize = (1 - 1) * envelope_size;
12339
12340            // Zero reserved fields.
12341            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12342
12343            // Safety:
12344            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12345            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12346            //   envelope_size bytes, there is always sufficient room.
12347            fidl::encoding::encode_in_envelope_optional::<
12348                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>>,
12349                fdomain_client::fidl::FDomainResourceDialect,
12350            >(
12351                self.stream.as_mut().map(
12352                    <fidl::encoding::Endpoint<
12353                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12354                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12355                ),
12356                encoder,
12357                offset + cur_offset,
12358                depth,
12359            )?;
12360
12361            _prev_end_offset = cur_offset + envelope_size;
12362
12363            Ok(())
12364        }
12365    }
12366
12367    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12368        for PacketStreamControlGetPacketStreamSinkResponse
12369    {
12370        #[inline(always)]
12371        fn new_empty() -> Self {
12372            Self::default()
12373        }
12374
12375        unsafe fn decode(
12376            &mut self,
12377            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12378            offset: usize,
12379            mut depth: fidl::encoding::Depth,
12380        ) -> fidl::Result<()> {
12381            decoder.debug_check_bounds::<Self>(offset);
12382            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12383                None => return Err(fidl::Error::NotNullable),
12384                Some(len) => len,
12385            };
12386            // Calling decoder.out_of_line_offset(0) is not allowed.
12387            if len == 0 {
12388                return Ok(());
12389            };
12390            depth.increment()?;
12391            let envelope_size = 8;
12392            let bytes_len = len * envelope_size;
12393            let offset = decoder.out_of_line_offset(bytes_len)?;
12394            // Decode the envelope for each type.
12395            let mut _next_ordinal_to_read = 0;
12396            let mut next_offset = offset;
12397            let end_offset = offset + bytes_len;
12398            _next_ordinal_to_read += 1;
12399            if next_offset >= end_offset {
12400                return Ok(());
12401            }
12402
12403            // Decode unknown envelopes for gaps in ordinals.
12404            while _next_ordinal_to_read < 1 {
12405                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12406                _next_ordinal_to_read += 1;
12407                next_offset += envelope_size;
12408            }
12409
12410            let next_out_of_line = decoder.next_out_of_line();
12411            let handles_before = decoder.remaining_handles();
12412            if let Some((inlined, num_bytes, num_handles)) =
12413                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12414            {
12415                let member_inline_size = <fidl::encoding::Endpoint<
12416                    fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12417                > as fidl::encoding::TypeMarker>::inline_size(
12418                    decoder.context
12419                );
12420                if inlined != (member_inline_size <= 4) {
12421                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12422                }
12423                let inner_offset;
12424                let mut inner_depth = depth.clone();
12425                if inlined {
12426                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12427                    inner_offset = next_offset;
12428                } else {
12429                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12430                    inner_depth.increment()?;
12431                }
12432                let val_ref = self.stream.get_or_insert_with(|| {
12433                    fidl::new_empty!(
12434                        fidl::encoding::Endpoint<
12435                            fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12436                        >,
12437                        fdomain_client::fidl::FDomainResourceDialect
12438                    )
12439                });
12440                fidl::decode!(
12441                    fidl::encoding::Endpoint<
12442                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12443                    >,
12444                    fdomain_client::fidl::FDomainResourceDialect,
12445                    val_ref,
12446                    decoder,
12447                    inner_offset,
12448                    inner_depth
12449                )?;
12450                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12451                {
12452                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12453                }
12454                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12455                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12456                }
12457            }
12458
12459            next_offset += envelope_size;
12460
12461            // Decode the remaining unknown envelopes.
12462            while next_offset < end_offset {
12463                _next_ordinal_to_read += 1;
12464                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12465                next_offset += envelope_size;
12466            }
12467
12468            Ok(())
12469        }
12470    }
12471
12472    impl PacketStreamSinkPutPacketRequest {
12473        #[inline(always)]
12474        fn max_ordinal_present(&self) -> u64 {
12475            if let Some(_) = self.payload {
12476                return 1;
12477            }
12478            0
12479        }
12480    }
12481
12482    impl fidl::encoding::ResourceTypeMarker for PacketStreamSinkPutPacketRequest {
12483        type Borrowed<'a> = &'a mut Self;
12484        fn take_or_borrow<'a>(
12485            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12486        ) -> Self::Borrowed<'a> {
12487            value
12488        }
12489    }
12490
12491    unsafe impl fidl::encoding::TypeMarker for PacketStreamSinkPutPacketRequest {
12492        type Owned = Self;
12493
12494        #[inline(always)]
12495        fn inline_align(_context: fidl::encoding::Context) -> usize {
12496            8
12497        }
12498
12499        #[inline(always)]
12500        fn inline_size(_context: fidl::encoding::Context) -> usize {
12501            16
12502        }
12503    }
12504
12505    unsafe impl
12506        fidl::encoding::Encode<
12507            PacketStreamSinkPutPacketRequest,
12508            fdomain_client::fidl::FDomainResourceDialect,
12509        > for &mut PacketStreamSinkPutPacketRequest
12510    {
12511        unsafe fn encode(
12512            self,
12513            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12514            offset: usize,
12515            mut depth: fidl::encoding::Depth,
12516        ) -> fidl::Result<()> {
12517            encoder.debug_check_bounds::<PacketStreamSinkPutPacketRequest>(offset);
12518            // Vector header
12519            let max_ordinal: u64 = self.max_ordinal_present();
12520            encoder.write_num(max_ordinal, offset);
12521            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12522            // Calling encoder.out_of_line_offset(0) is not allowed.
12523            if max_ordinal == 0 {
12524                return Ok(());
12525            }
12526            depth.increment()?;
12527            let envelope_size = 8;
12528            let bytes_len = max_ordinal as usize * envelope_size;
12529            #[allow(unused_variables)]
12530            let offset = encoder.out_of_line_offset(bytes_len);
12531            let mut _prev_end_offset: usize = 0;
12532            if 1 > max_ordinal {
12533                return Ok(());
12534            }
12535
12536            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12537            // are envelope_size bytes.
12538            let cur_offset: usize = (1 - 1) * envelope_size;
12539
12540            // Zero reserved fields.
12541            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12542
12543            // Safety:
12544            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12545            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12546            //   envelope_size bytes, there is always sufficient room.
12547            fidl::encoding::encode_in_envelope_optional::<
12548                DataTransfer,
12549                fdomain_client::fidl::FDomainResourceDialect,
12550            >(
12551                self.payload
12552                    .as_mut()
12553                    .map(<DataTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12554                encoder,
12555                offset + cur_offset,
12556                depth,
12557            )?;
12558
12559            _prev_end_offset = cur_offset + envelope_size;
12560
12561            Ok(())
12562        }
12563    }
12564
12565    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12566        for PacketStreamSinkPutPacketRequest
12567    {
12568        #[inline(always)]
12569        fn new_empty() -> Self {
12570            Self::default()
12571        }
12572
12573        unsafe fn decode(
12574            &mut self,
12575            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12576            offset: usize,
12577            mut depth: fidl::encoding::Depth,
12578        ) -> fidl::Result<()> {
12579            decoder.debug_check_bounds::<Self>(offset);
12580            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12581                None => return Err(fidl::Error::NotNullable),
12582                Some(len) => len,
12583            };
12584            // Calling decoder.out_of_line_offset(0) is not allowed.
12585            if len == 0 {
12586                return Ok(());
12587            };
12588            depth.increment()?;
12589            let envelope_size = 8;
12590            let bytes_len = len * envelope_size;
12591            let offset = decoder.out_of_line_offset(bytes_len)?;
12592            // Decode the envelope for each type.
12593            let mut _next_ordinal_to_read = 0;
12594            let mut next_offset = offset;
12595            let end_offset = offset + bytes_len;
12596            _next_ordinal_to_read += 1;
12597            if next_offset >= end_offset {
12598                return Ok(());
12599            }
12600
12601            // Decode unknown envelopes for gaps in ordinals.
12602            while _next_ordinal_to_read < 1 {
12603                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12604                _next_ordinal_to_read += 1;
12605                next_offset += envelope_size;
12606            }
12607
12608            let next_out_of_line = decoder.next_out_of_line();
12609            let handles_before = decoder.remaining_handles();
12610            if let Some((inlined, num_bytes, num_handles)) =
12611                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12612            {
12613                let member_inline_size =
12614                    <DataTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12615                if inlined != (member_inline_size <= 4) {
12616                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12617                }
12618                let inner_offset;
12619                let mut inner_depth = depth.clone();
12620                if inlined {
12621                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12622                    inner_offset = next_offset;
12623                } else {
12624                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12625                    inner_depth.increment()?;
12626                }
12627                let val_ref = self.payload.get_or_insert_with(|| {
12628                    fidl::new_empty!(DataTransfer, fdomain_client::fidl::FDomainResourceDialect)
12629                });
12630                fidl::decode!(
12631                    DataTransfer,
12632                    fdomain_client::fidl::FDomainResourceDialect,
12633                    val_ref,
12634                    decoder,
12635                    inner_offset,
12636                    inner_depth
12637                )?;
12638                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12639                {
12640                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12641                }
12642                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12643                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12644                }
12645            }
12646
12647            next_offset += envelope_size;
12648
12649            // Decode the remaining unknown envelopes.
12650            while next_offset < end_offset {
12651                _next_ordinal_to_read += 1;
12652                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12653                next_offset += envelope_size;
12654            }
12655
12656            Ok(())
12657        }
12658    }
12659
12660    impl RegisterVmosConfig {
12661        #[inline(always)]
12662        fn max_ordinal_present(&self) -> u64 {
12663            if let Some(_) = self.vmo_infos {
12664                return 1;
12665            }
12666            0
12667        }
12668    }
12669
12670    impl fidl::encoding::ResourceTypeMarker for RegisterVmosConfig {
12671        type Borrowed<'a> = &'a mut Self;
12672        fn take_or_borrow<'a>(
12673            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12674        ) -> Self::Borrowed<'a> {
12675            value
12676        }
12677    }
12678
12679    unsafe impl fidl::encoding::TypeMarker for RegisterVmosConfig {
12680        type Owned = Self;
12681
12682        #[inline(always)]
12683        fn inline_align(_context: fidl::encoding::Context) -> usize {
12684            8
12685        }
12686
12687        #[inline(always)]
12688        fn inline_size(_context: fidl::encoding::Context) -> usize {
12689            16
12690        }
12691    }
12692
12693    unsafe impl
12694        fidl::encoding::Encode<RegisterVmosConfig, fdomain_client::fidl::FDomainResourceDialect>
12695        for &mut RegisterVmosConfig
12696    {
12697        unsafe fn encode(
12698            self,
12699            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12700            offset: usize,
12701            mut depth: fidl::encoding::Depth,
12702        ) -> fidl::Result<()> {
12703            encoder.debug_check_bounds::<RegisterVmosConfig>(offset);
12704            // Vector header
12705            let max_ordinal: u64 = self.max_ordinal_present();
12706            encoder.write_num(max_ordinal, offset);
12707            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12708            // Calling encoder.out_of_line_offset(0) is not allowed.
12709            if max_ordinal == 0 {
12710                return Ok(());
12711            }
12712            depth.increment()?;
12713            let envelope_size = 8;
12714            let bytes_len = max_ordinal as usize * envelope_size;
12715            #[allow(unused_variables)]
12716            let offset = encoder.out_of_line_offset(bytes_len);
12717            let mut _prev_end_offset: usize = 0;
12718            if 1 > max_ordinal {
12719                return Ok(());
12720            }
12721
12722            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12723            // are envelope_size bytes.
12724            let cur_offset: usize = (1 - 1) * envelope_size;
12725
12726            // Zero reserved fields.
12727            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12728
12729            // Safety:
12730            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12731            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12732            //   envelope_size bytes, there is always sufficient room.
12733            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect>(
12734            self.vmo_infos.as_mut().map(<fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12735            encoder, offset + cur_offset, depth
12736        )?;
12737
12738            _prev_end_offset = cur_offset + envelope_size;
12739
12740            Ok(())
12741        }
12742    }
12743
12744    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12745        for RegisterVmosConfig
12746    {
12747        #[inline(always)]
12748        fn new_empty() -> Self {
12749            Self::default()
12750        }
12751
12752        unsafe fn decode(
12753            &mut self,
12754            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12755            offset: usize,
12756            mut depth: fidl::encoding::Depth,
12757        ) -> fidl::Result<()> {
12758            decoder.debug_check_bounds::<Self>(offset);
12759            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12760                None => return Err(fidl::Error::NotNullable),
12761                Some(len) => len,
12762            };
12763            // Calling decoder.out_of_line_offset(0) is not allowed.
12764            if len == 0 {
12765                return Ok(());
12766            };
12767            depth.increment()?;
12768            let envelope_size = 8;
12769            let bytes_len = len * envelope_size;
12770            let offset = decoder.out_of_line_offset(bytes_len)?;
12771            // Decode the envelope for each type.
12772            let mut _next_ordinal_to_read = 0;
12773            let mut next_offset = offset;
12774            let end_offset = offset + bytes_len;
12775            _next_ordinal_to_read += 1;
12776            if next_offset >= end_offset {
12777                return Ok(());
12778            }
12779
12780            // Decode unknown envelopes for gaps in ordinals.
12781            while _next_ordinal_to_read < 1 {
12782                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12783                _next_ordinal_to_read += 1;
12784                next_offset += envelope_size;
12785            }
12786
12787            let next_out_of_line = decoder.next_out_of_line();
12788            let handles_before = decoder.remaining_handles();
12789            if let Some((inlined, num_bytes, num_handles)) =
12790                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12791            {
12792                let member_inline_size = <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12793                if inlined != (member_inline_size <= 4) {
12794                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12795                }
12796                let inner_offset;
12797                let mut inner_depth = depth.clone();
12798                if inlined {
12799                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12800                    inner_offset = next_offset;
12801                } else {
12802                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12803                    inner_depth.increment()?;
12804                }
12805                let val_ref =
12806                self.vmo_infos.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect));
12807                fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12808                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12809                {
12810                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12811                }
12812                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12813                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12814                }
12815            }
12816
12817            next_offset += envelope_size;
12818
12819            // Decode the remaining unknown envelopes.
12820            while next_offset < end_offset {
12821                _next_ordinal_to_read += 1;
12822                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12823                next_offset += envelope_size;
12824            }
12825
12826            Ok(())
12827        }
12828    }
12829
12830    impl VmoInfo {
12831        #[inline(always)]
12832        fn max_ordinal_present(&self) -> u64 {
12833            if let Some(_) = self.vmo {
12834                return 2;
12835            }
12836            if let Some(_) = self.id {
12837                return 1;
12838            }
12839            0
12840        }
12841    }
12842
12843    impl fidl::encoding::ResourceTypeMarker for VmoInfo {
12844        type Borrowed<'a> = &'a mut Self;
12845        fn take_or_borrow<'a>(
12846            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12847        ) -> Self::Borrowed<'a> {
12848            value
12849        }
12850    }
12851
12852    unsafe impl fidl::encoding::TypeMarker for VmoInfo {
12853        type Owned = Self;
12854
12855        #[inline(always)]
12856        fn inline_align(_context: fidl::encoding::Context) -> usize {
12857            8
12858        }
12859
12860        #[inline(always)]
12861        fn inline_size(_context: fidl::encoding::Context) -> usize {
12862            16
12863        }
12864    }
12865
12866    unsafe impl fidl::encoding::Encode<VmoInfo, fdomain_client::fidl::FDomainResourceDialect>
12867        for &mut VmoInfo
12868    {
12869        unsafe fn encode(
12870            self,
12871            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12872            offset: usize,
12873            mut depth: fidl::encoding::Depth,
12874        ) -> fidl::Result<()> {
12875            encoder.debug_check_bounds::<VmoInfo>(offset);
12876            // Vector header
12877            let max_ordinal: u64 = self.max_ordinal_present();
12878            encoder.write_num(max_ordinal, offset);
12879            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12880            // Calling encoder.out_of_line_offset(0) is not allowed.
12881            if max_ordinal == 0 {
12882                return Ok(());
12883            }
12884            depth.increment()?;
12885            let envelope_size = 8;
12886            let bytes_len = max_ordinal as usize * envelope_size;
12887            #[allow(unused_variables)]
12888            let offset = encoder.out_of_line_offset(bytes_len);
12889            let mut _prev_end_offset: usize = 0;
12890            if 1 > max_ordinal {
12891                return Ok(());
12892            }
12893
12894            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12895            // are envelope_size bytes.
12896            let cur_offset: usize = (1 - 1) * envelope_size;
12897
12898            // Zero reserved fields.
12899            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12900
12901            // Safety:
12902            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12903            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12904            //   envelope_size bytes, there is always sufficient room.
12905            fidl::encoding::encode_in_envelope_optional::<
12906                u64,
12907                fdomain_client::fidl::FDomainResourceDialect,
12908            >(
12909                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
12910                encoder,
12911                offset + cur_offset,
12912                depth,
12913            )?;
12914
12915            _prev_end_offset = cur_offset + envelope_size;
12916            if 2 > max_ordinal {
12917                return Ok(());
12918            }
12919
12920            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12921            // are envelope_size bytes.
12922            let cur_offset: usize = (2 - 1) * envelope_size;
12923
12924            // Zero reserved fields.
12925            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12926
12927            // Safety:
12928            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12929            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12930            //   envelope_size bytes, there is always sufficient room.
12931            fidl::encoding::encode_in_envelope_optional::<
12932                fidl::encoding::HandleType<
12933                    fdomain_client::Vmo,
12934                    { fidl::ObjectType::VMO.into_raw() },
12935                    2147483648,
12936                >,
12937                fdomain_client::fidl::FDomainResourceDialect,
12938            >(
12939                self.vmo.as_mut().map(
12940                    <fidl::encoding::HandleType<
12941                        fdomain_client::Vmo,
12942                        { fidl::ObjectType::VMO.into_raw() },
12943                        2147483648,
12944                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12945                ),
12946                encoder,
12947                offset + cur_offset,
12948                depth,
12949            )?;
12950
12951            _prev_end_offset = cur_offset + envelope_size;
12952
12953            Ok(())
12954        }
12955    }
12956
12957    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for VmoInfo {
12958        #[inline(always)]
12959        fn new_empty() -> Self {
12960            Self::default()
12961        }
12962
12963        unsafe fn decode(
12964            &mut self,
12965            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12966            offset: usize,
12967            mut depth: fidl::encoding::Depth,
12968        ) -> fidl::Result<()> {
12969            decoder.debug_check_bounds::<Self>(offset);
12970            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12971                None => return Err(fidl::Error::NotNullable),
12972                Some(len) => len,
12973            };
12974            // Calling decoder.out_of_line_offset(0) is not allowed.
12975            if len == 0 {
12976                return Ok(());
12977            };
12978            depth.increment()?;
12979            let envelope_size = 8;
12980            let bytes_len = len * envelope_size;
12981            let offset = decoder.out_of_line_offset(bytes_len)?;
12982            // Decode the envelope for each type.
12983            let mut _next_ordinal_to_read = 0;
12984            let mut next_offset = offset;
12985            let end_offset = offset + bytes_len;
12986            _next_ordinal_to_read += 1;
12987            if next_offset >= end_offset {
12988                return Ok(());
12989            }
12990
12991            // Decode unknown envelopes for gaps in ordinals.
12992            while _next_ordinal_to_read < 1 {
12993                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12994                _next_ordinal_to_read += 1;
12995                next_offset += envelope_size;
12996            }
12997
12998            let next_out_of_line = decoder.next_out_of_line();
12999            let handles_before = decoder.remaining_handles();
13000            if let Some((inlined, num_bytes, num_handles)) =
13001                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13002            {
13003                let member_inline_size =
13004                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13005                if inlined != (member_inline_size <= 4) {
13006                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13007                }
13008                let inner_offset;
13009                let mut inner_depth = depth.clone();
13010                if inlined {
13011                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13012                    inner_offset = next_offset;
13013                } else {
13014                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13015                    inner_depth.increment()?;
13016                }
13017                let val_ref = self.id.get_or_insert_with(|| {
13018                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13019                });
13020                fidl::decode!(
13021                    u64,
13022                    fdomain_client::fidl::FDomainResourceDialect,
13023                    val_ref,
13024                    decoder,
13025                    inner_offset,
13026                    inner_depth
13027                )?;
13028                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13029                {
13030                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13031                }
13032                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13033                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13034                }
13035            }
13036
13037            next_offset += envelope_size;
13038            _next_ordinal_to_read += 1;
13039            if next_offset >= end_offset {
13040                return Ok(());
13041            }
13042
13043            // Decode unknown envelopes for gaps in ordinals.
13044            while _next_ordinal_to_read < 2 {
13045                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13046                _next_ordinal_to_read += 1;
13047                next_offset += envelope_size;
13048            }
13049
13050            let next_out_of_line = decoder.next_out_of_line();
13051            let handles_before = decoder.remaining_handles();
13052            if let Some((inlined, num_bytes, num_handles)) =
13053                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13054            {
13055                let member_inline_size = <fidl::encoding::HandleType<
13056                    fdomain_client::Vmo,
13057                    { fidl::ObjectType::VMO.into_raw() },
13058                    2147483648,
13059                > as fidl::encoding::TypeMarker>::inline_size(
13060                    decoder.context
13061                );
13062                if inlined != (member_inline_size <= 4) {
13063                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13064                }
13065                let inner_offset;
13066                let mut inner_depth = depth.clone();
13067                if inlined {
13068                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13069                    inner_offset = next_offset;
13070                } else {
13071                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13072                    inner_depth.increment()?;
13073                }
13074                let val_ref =
13075                self.vmo.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect));
13076                fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13077                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13078                {
13079                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13080                }
13081                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13082                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13083                }
13084            }
13085
13086            next_offset += envelope_size;
13087
13088            // Decode the remaining unknown envelopes.
13089            while next_offset < end_offset {
13090                _next_ordinal_to_read += 1;
13091                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13092                next_offset += envelope_size;
13093            }
13094
13095            Ok(())
13096        }
13097    }
13098
13099    impl VmoTransfer {
13100        #[inline(always)]
13101        fn max_ordinal_present(&self) -> u64 {
13102            if let Some(_) = self.payload_size {
13103                return 3;
13104            }
13105            if let Some(_) = self.vmo_offset {
13106                return 2;
13107            }
13108            if let Some(_) = self.vmo_id {
13109                return 1;
13110            }
13111            0
13112        }
13113    }
13114
13115    impl fidl::encoding::ResourceTypeMarker for VmoTransfer {
13116        type Borrowed<'a> = &'a mut Self;
13117        fn take_or_borrow<'a>(
13118            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13119        ) -> Self::Borrowed<'a> {
13120            value
13121        }
13122    }
13123
13124    unsafe impl fidl::encoding::TypeMarker for VmoTransfer {
13125        type Owned = Self;
13126
13127        #[inline(always)]
13128        fn inline_align(_context: fidl::encoding::Context) -> usize {
13129            8
13130        }
13131
13132        #[inline(always)]
13133        fn inline_size(_context: fidl::encoding::Context) -> usize {
13134            16
13135        }
13136    }
13137
13138    unsafe impl fidl::encoding::Encode<VmoTransfer, fdomain_client::fidl::FDomainResourceDialect>
13139        for &mut VmoTransfer
13140    {
13141        unsafe fn encode(
13142            self,
13143            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13144            offset: usize,
13145            mut depth: fidl::encoding::Depth,
13146        ) -> fidl::Result<()> {
13147            encoder.debug_check_bounds::<VmoTransfer>(offset);
13148            // Vector header
13149            let max_ordinal: u64 = self.max_ordinal_present();
13150            encoder.write_num(max_ordinal, offset);
13151            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13152            // Calling encoder.out_of_line_offset(0) is not allowed.
13153            if max_ordinal == 0 {
13154                return Ok(());
13155            }
13156            depth.increment()?;
13157            let envelope_size = 8;
13158            let bytes_len = max_ordinal as usize * envelope_size;
13159            #[allow(unused_variables)]
13160            let offset = encoder.out_of_line_offset(bytes_len);
13161            let mut _prev_end_offset: usize = 0;
13162            if 1 > max_ordinal {
13163                return Ok(());
13164            }
13165
13166            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13167            // are envelope_size bytes.
13168            let cur_offset: usize = (1 - 1) * envelope_size;
13169
13170            // Zero reserved fields.
13171            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13172
13173            // Safety:
13174            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13175            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13176            //   envelope_size bytes, there is always sufficient room.
13177            fidl::encoding::encode_in_envelope_optional::<
13178                u64,
13179                fdomain_client::fidl::FDomainResourceDialect,
13180            >(
13181                self.vmo_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
13182                encoder,
13183                offset + cur_offset,
13184                depth,
13185            )?;
13186
13187            _prev_end_offset = cur_offset + envelope_size;
13188            if 2 > max_ordinal {
13189                return Ok(());
13190            }
13191
13192            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13193            // are envelope_size bytes.
13194            let cur_offset: usize = (2 - 1) * envelope_size;
13195
13196            // Zero reserved fields.
13197            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13198
13199            // Safety:
13200            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13201            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13202            //   envelope_size bytes, there is always sufficient room.
13203            fidl::encoding::encode_in_envelope_optional::<
13204                u64,
13205                fdomain_client::fidl::FDomainResourceDialect,
13206            >(
13207                self.vmo_offset.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
13208                encoder,
13209                offset + cur_offset,
13210                depth,
13211            )?;
13212
13213            _prev_end_offset = cur_offset + envelope_size;
13214            if 3 > max_ordinal {
13215                return Ok(());
13216            }
13217
13218            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13219            // are envelope_size bytes.
13220            let cur_offset: usize = (3 - 1) * envelope_size;
13221
13222            // Zero reserved fields.
13223            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13224
13225            // Safety:
13226            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13227            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13228            //   envelope_size bytes, there is always sufficient room.
13229            fidl::encoding::encode_in_envelope_optional::<
13230                u64,
13231                fdomain_client::fidl::FDomainResourceDialect,
13232            >(
13233                self.payload_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
13234                encoder,
13235                offset + cur_offset,
13236                depth,
13237            )?;
13238
13239            _prev_end_offset = cur_offset + envelope_size;
13240
13241            Ok(())
13242        }
13243    }
13244
13245    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for VmoTransfer {
13246        #[inline(always)]
13247        fn new_empty() -> Self {
13248            Self::default()
13249        }
13250
13251        unsafe fn decode(
13252            &mut self,
13253            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13254            offset: usize,
13255            mut depth: fidl::encoding::Depth,
13256        ) -> fidl::Result<()> {
13257            decoder.debug_check_bounds::<Self>(offset);
13258            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13259                None => return Err(fidl::Error::NotNullable),
13260                Some(len) => len,
13261            };
13262            // Calling decoder.out_of_line_offset(0) is not allowed.
13263            if len == 0 {
13264                return Ok(());
13265            };
13266            depth.increment()?;
13267            let envelope_size = 8;
13268            let bytes_len = len * envelope_size;
13269            let offset = decoder.out_of_line_offset(bytes_len)?;
13270            // Decode the envelope for each type.
13271            let mut _next_ordinal_to_read = 0;
13272            let mut next_offset = offset;
13273            let end_offset = offset + bytes_len;
13274            _next_ordinal_to_read += 1;
13275            if next_offset >= end_offset {
13276                return Ok(());
13277            }
13278
13279            // Decode unknown envelopes for gaps in ordinals.
13280            while _next_ordinal_to_read < 1 {
13281                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13282                _next_ordinal_to_read += 1;
13283                next_offset += envelope_size;
13284            }
13285
13286            let next_out_of_line = decoder.next_out_of_line();
13287            let handles_before = decoder.remaining_handles();
13288            if let Some((inlined, num_bytes, num_handles)) =
13289                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13290            {
13291                let member_inline_size =
13292                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13293                if inlined != (member_inline_size <= 4) {
13294                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13295                }
13296                let inner_offset;
13297                let mut inner_depth = depth.clone();
13298                if inlined {
13299                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13300                    inner_offset = next_offset;
13301                } else {
13302                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13303                    inner_depth.increment()?;
13304                }
13305                let val_ref = self.vmo_id.get_or_insert_with(|| {
13306                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13307                });
13308                fidl::decode!(
13309                    u64,
13310                    fdomain_client::fidl::FDomainResourceDialect,
13311                    val_ref,
13312                    decoder,
13313                    inner_offset,
13314                    inner_depth
13315                )?;
13316                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13317                {
13318                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13319                }
13320                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13321                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13322                }
13323            }
13324
13325            next_offset += envelope_size;
13326            _next_ordinal_to_read += 1;
13327            if next_offset >= end_offset {
13328                return Ok(());
13329            }
13330
13331            // Decode unknown envelopes for gaps in ordinals.
13332            while _next_ordinal_to_read < 2 {
13333                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13334                _next_ordinal_to_read += 1;
13335                next_offset += envelope_size;
13336            }
13337
13338            let next_out_of_line = decoder.next_out_of_line();
13339            let handles_before = decoder.remaining_handles();
13340            if let Some((inlined, num_bytes, num_handles)) =
13341                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13342            {
13343                let member_inline_size =
13344                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13345                if inlined != (member_inline_size <= 4) {
13346                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13347                }
13348                let inner_offset;
13349                let mut inner_depth = depth.clone();
13350                if inlined {
13351                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13352                    inner_offset = next_offset;
13353                } else {
13354                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13355                    inner_depth.increment()?;
13356                }
13357                let val_ref = self.vmo_offset.get_or_insert_with(|| {
13358                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13359                });
13360                fidl::decode!(
13361                    u64,
13362                    fdomain_client::fidl::FDomainResourceDialect,
13363                    val_ref,
13364                    decoder,
13365                    inner_offset,
13366                    inner_depth
13367                )?;
13368                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13369                {
13370                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13371                }
13372                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13373                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13374                }
13375            }
13376
13377            next_offset += envelope_size;
13378            _next_ordinal_to_read += 1;
13379            if next_offset >= end_offset {
13380                return Ok(());
13381            }
13382
13383            // Decode unknown envelopes for gaps in ordinals.
13384            while _next_ordinal_to_read < 3 {
13385                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13386                _next_ordinal_to_read += 1;
13387                next_offset += envelope_size;
13388            }
13389
13390            let next_out_of_line = decoder.next_out_of_line();
13391            let handles_before = decoder.remaining_handles();
13392            if let Some((inlined, num_bytes, num_handles)) =
13393                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13394            {
13395                let member_inline_size =
13396                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13397                if inlined != (member_inline_size <= 4) {
13398                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13399                }
13400                let inner_offset;
13401                let mut inner_depth = depth.clone();
13402                if inlined {
13403                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13404                    inner_offset = next_offset;
13405                } else {
13406                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13407                    inner_depth.increment()?;
13408                }
13409                let val_ref = self.payload_size.get_or_insert_with(|| {
13410                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13411                });
13412                fidl::decode!(
13413                    u64,
13414                    fdomain_client::fidl::FDomainResourceDialect,
13415                    val_ref,
13416                    decoder,
13417                    inner_offset,
13418                    inner_depth
13419                )?;
13420                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13421                {
13422                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13423                }
13424                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13425                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13426                }
13427            }
13428
13429            next_offset += envelope_size;
13430
13431            // Decode the remaining unknown envelopes.
13432            while next_offset < end_offset {
13433                _next_ordinal_to_read += 1;
13434                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13435                next_offset += envelope_size;
13436            }
13437
13438            Ok(())
13439        }
13440    }
13441
13442    impl fidl::encoding::ResourceTypeMarker for DataTransfer {
13443        type Borrowed<'a> = &'a mut Self;
13444        fn take_or_borrow<'a>(
13445            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13446        ) -> Self::Borrowed<'a> {
13447            value
13448        }
13449    }
13450
13451    unsafe impl fidl::encoding::TypeMarker for DataTransfer {
13452        type Owned = Self;
13453
13454        #[inline(always)]
13455        fn inline_align(_context: fidl::encoding::Context) -> usize {
13456            8
13457        }
13458
13459        #[inline(always)]
13460        fn inline_size(_context: fidl::encoding::Context) -> usize {
13461            16
13462        }
13463    }
13464
13465    unsafe impl fidl::encoding::Encode<DataTransfer, fdomain_client::fidl::FDomainResourceDialect>
13466        for &mut DataTransfer
13467    {
13468        #[inline]
13469        unsafe fn encode(
13470            self,
13471            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13472            offset: usize,
13473            _depth: fidl::encoding::Depth,
13474        ) -> fidl::Result<()> {
13475            encoder.debug_check_bounds::<DataTransfer>(offset);
13476            encoder.write_num::<u64>(self.ordinal(), offset);
13477            match self {
13478                DataTransfer::VmoTransfer(ref mut val) => fidl::encoding::encode_in_envelope::<
13479                    VmoTransfer,
13480                    fdomain_client::fidl::FDomainResourceDialect,
13481                >(
13482                    <VmoTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
13483                    encoder,
13484                    offset + 8,
13485                    _depth,
13486                ),
13487                DataTransfer::InlineData(ref val) => fidl::encoding::encode_in_envelope::<
13488                    fidl::encoding::Vector<u8, 8192>,
13489                    fdomain_client::fidl::FDomainResourceDialect,
13490                >(
13491                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
13492                        val,
13493                    ),
13494                    encoder,
13495                    offset + 8,
13496                    _depth,
13497                ),
13498                DataTransfer::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
13499            }
13500        }
13501    }
13502
13503    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for DataTransfer {
13504        #[inline(always)]
13505        fn new_empty() -> Self {
13506            Self::__SourceBreaking { unknown_ordinal: 0 }
13507        }
13508
13509        #[inline]
13510        unsafe fn decode(
13511            &mut self,
13512            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13513            offset: usize,
13514            mut depth: fidl::encoding::Depth,
13515        ) -> fidl::Result<()> {
13516            decoder.debug_check_bounds::<Self>(offset);
13517            #[allow(unused_variables)]
13518            let next_out_of_line = decoder.next_out_of_line();
13519            let handles_before = decoder.remaining_handles();
13520            let (ordinal, inlined, num_bytes, num_handles) =
13521                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
13522
13523            let member_inline_size = match ordinal {
13524                1 => <VmoTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13525                2 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
13526                    decoder.context,
13527                ),
13528                0 => return Err(fidl::Error::UnknownUnionTag),
13529                _ => num_bytes as usize,
13530            };
13531
13532            if inlined != (member_inline_size <= 4) {
13533                return Err(fidl::Error::InvalidInlineBitInEnvelope);
13534            }
13535            let _inner_offset;
13536            if inlined {
13537                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
13538                _inner_offset = offset + 8;
13539            } else {
13540                depth.increment()?;
13541                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13542            }
13543            match ordinal {
13544                1 => {
13545                    #[allow(irrefutable_let_patterns)]
13546                    if let DataTransfer::VmoTransfer(_) = self {
13547                        // Do nothing, read the value into the object
13548                    } else {
13549                        // Initialize `self` to the right variant
13550                        *self = DataTransfer::VmoTransfer(fidl::new_empty!(
13551                            VmoTransfer,
13552                            fdomain_client::fidl::FDomainResourceDialect
13553                        ));
13554                    }
13555                    #[allow(irrefutable_let_patterns)]
13556                    if let DataTransfer::VmoTransfer(ref mut val) = self {
13557                        fidl::decode!(
13558                            VmoTransfer,
13559                            fdomain_client::fidl::FDomainResourceDialect,
13560                            val,
13561                            decoder,
13562                            _inner_offset,
13563                            depth
13564                        )?;
13565                    } else {
13566                        unreachable!()
13567                    }
13568                }
13569                2 => {
13570                    #[allow(irrefutable_let_patterns)]
13571                    if let DataTransfer::InlineData(_) = self {
13572                        // Do nothing, read the value into the object
13573                    } else {
13574                        // Initialize `self` to the right variant
13575                        *self = DataTransfer::InlineData(
13576                            fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, fdomain_client::fidl::FDomainResourceDialect),
13577                        );
13578                    }
13579                    #[allow(irrefutable_let_patterns)]
13580                    if let DataTransfer::InlineData(ref mut val) = self {
13581                        fidl::decode!(fidl::encoding::Vector<u8, 8192>, fdomain_client::fidl::FDomainResourceDialect, val, decoder, _inner_offset, depth)?;
13582                    } else {
13583                        unreachable!()
13584                    }
13585                }
13586                #[allow(deprecated)]
13587                ordinal => {
13588                    for _ in 0..num_handles {
13589                        decoder.drop_next_handle()?;
13590                    }
13591                    *self = DataTransfer::__SourceBreaking { unknown_ordinal: ordinal };
13592                }
13593            }
13594            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
13595                return Err(fidl::Error::InvalidNumBytesInEnvelope);
13596            }
13597            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13598                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13599            }
13600            Ok(())
13601        }
13602    }
13603}