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 CodecControlHandle {
1074    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1075        self.inner.shutdown_with_epitaph(status.into())
1076    }
1077}
1078
1079impl fdomain_client::fidl::ControlHandle for CodecControlHandle {
1080    fn shutdown(&self) {
1081        self.inner.shutdown()
1082    }
1083
1084    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1085        self.inner.shutdown_with_epitaph(status)
1086    }
1087
1088    fn is_closed(&self) -> bool {
1089        self.inner.channel().is_closed()
1090    }
1091    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1092        self.inner.channel().on_closed()
1093    }
1094}
1095
1096impl CodecControlHandle {}
1097
1098#[must_use = "FIDL methods require a response to be sent"]
1099#[derive(Debug)]
1100pub struct CodecGetHealthStateResponder {
1101    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1102    tx_id: u32,
1103}
1104
1105/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1106/// if the responder is dropped without sending a response, so that the client
1107/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1108impl std::ops::Drop for CodecGetHealthStateResponder {
1109    fn drop(&mut self) {
1110        self.control_handle.shutdown();
1111        // Safety: drops once, never accessed again
1112        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1113    }
1114}
1115
1116impl fdomain_client::fidl::Responder for CodecGetHealthStateResponder {
1117    type ControlHandle = CodecControlHandle;
1118
1119    fn control_handle(&self) -> &CodecControlHandle {
1120        &self.control_handle
1121    }
1122
1123    fn drop_without_shutdown(mut self) {
1124        // Safety: drops once, never accessed again due to mem::forget
1125        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1126        // Prevent Drop from running (which would shut down the channel)
1127        std::mem::forget(self);
1128    }
1129}
1130
1131impl CodecGetHealthStateResponder {
1132    /// Sends a response to the FIDL transaction.
1133    ///
1134    /// Sets the channel to shutdown if an error occurs.
1135    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1136        let _result = self.send_raw(state);
1137        if _result.is_err() {
1138            self.control_handle.shutdown();
1139        }
1140        self.drop_without_shutdown();
1141        _result
1142    }
1143
1144    /// Similar to "send" but does not shutdown the channel if an error occurs.
1145    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1146        let _result = self.send_raw(state);
1147        self.drop_without_shutdown();
1148        _result
1149    }
1150
1151    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
1152        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
1153            (state,),
1154            self.tx_id,
1155            0x4e146d6bca733a84,
1156            fidl::encoding::DynamicFlags::empty(),
1157        )
1158    }
1159}
1160
1161#[must_use = "FIDL methods require a response to be sent"]
1162#[derive(Debug)]
1163pub struct CodecResetResponder {
1164    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1165    tx_id: u32,
1166}
1167
1168/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1169/// if the responder is dropped without sending a response, so that the client
1170/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1171impl std::ops::Drop for CodecResetResponder {
1172    fn drop(&mut self) {
1173        self.control_handle.shutdown();
1174        // Safety: drops once, never accessed again
1175        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1176    }
1177}
1178
1179impl fdomain_client::fidl::Responder for CodecResetResponder {
1180    type ControlHandle = CodecControlHandle;
1181
1182    fn control_handle(&self) -> &CodecControlHandle {
1183        &self.control_handle
1184    }
1185
1186    fn drop_without_shutdown(mut self) {
1187        // Safety: drops once, never accessed again due to mem::forget
1188        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1189        // Prevent Drop from running (which would shut down the channel)
1190        std::mem::forget(self);
1191    }
1192}
1193
1194impl CodecResetResponder {
1195    /// Sends a response to the FIDL transaction.
1196    ///
1197    /// Sets the channel to shutdown if an error occurs.
1198    pub fn send(self) -> Result<(), fidl::Error> {
1199        let _result = self.send_raw();
1200        if _result.is_err() {
1201            self.control_handle.shutdown();
1202        }
1203        self.drop_without_shutdown();
1204        _result
1205    }
1206
1207    /// Similar to "send" but does not shutdown the channel if an error occurs.
1208    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1209        let _result = self.send_raw();
1210        self.drop_without_shutdown();
1211        _result
1212    }
1213
1214    fn send_raw(&self) -> Result<(), fidl::Error> {
1215        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1216            (),
1217            self.tx_id,
1218            0x50757ae579a7bd6b,
1219            fidl::encoding::DynamicFlags::empty(),
1220        )
1221    }
1222}
1223
1224#[must_use = "FIDL methods require a response to be sent"]
1225#[derive(Debug)]
1226pub struct CodecGetPropertiesResponder {
1227    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1228    tx_id: u32,
1229}
1230
1231/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1232/// if the responder is dropped without sending a response, so that the client
1233/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1234impl std::ops::Drop for CodecGetPropertiesResponder {
1235    fn drop(&mut self) {
1236        self.control_handle.shutdown();
1237        // Safety: drops once, never accessed again
1238        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1239    }
1240}
1241
1242impl fdomain_client::fidl::Responder for CodecGetPropertiesResponder {
1243    type ControlHandle = CodecControlHandle;
1244
1245    fn control_handle(&self) -> &CodecControlHandle {
1246        &self.control_handle
1247    }
1248
1249    fn drop_without_shutdown(mut self) {
1250        // Safety: drops once, never accessed again due to mem::forget
1251        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1252        // Prevent Drop from running (which would shut down the channel)
1253        std::mem::forget(self);
1254    }
1255}
1256
1257impl CodecGetPropertiesResponder {
1258    /// Sends a response to the FIDL transaction.
1259    ///
1260    /// Sets the channel to shutdown if an error occurs.
1261    pub fn send(self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1262        let _result = self.send_raw(properties);
1263        if _result.is_err() {
1264            self.control_handle.shutdown();
1265        }
1266        self.drop_without_shutdown();
1267        _result
1268    }
1269
1270    /// Similar to "send" but does not shutdown the channel if an error occurs.
1271    pub fn send_no_shutdown_on_err(
1272        self,
1273        mut properties: &CodecProperties,
1274    ) -> Result<(), fidl::Error> {
1275        let _result = self.send_raw(properties);
1276        self.drop_without_shutdown();
1277        _result
1278    }
1279
1280    fn send_raw(&self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1281        self.control_handle.inner.send::<CodecGetPropertiesResponse>(
1282            (properties,),
1283            self.tx_id,
1284            0x7a0d138a6a1d9d90,
1285            fidl::encoding::DynamicFlags::empty(),
1286        )
1287    }
1288}
1289
1290#[must_use = "FIDL methods require a response to be sent"]
1291#[derive(Debug)]
1292pub struct CodecStopResponder {
1293    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1294    tx_id: u32,
1295}
1296
1297/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1298/// if the responder is dropped without sending a response, so that the client
1299/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1300impl std::ops::Drop for CodecStopResponder {
1301    fn drop(&mut self) {
1302        self.control_handle.shutdown();
1303        // Safety: drops once, never accessed again
1304        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1305    }
1306}
1307
1308impl fdomain_client::fidl::Responder for CodecStopResponder {
1309    type ControlHandle = CodecControlHandle;
1310
1311    fn control_handle(&self) -> &CodecControlHandle {
1312        &self.control_handle
1313    }
1314
1315    fn drop_without_shutdown(mut self) {
1316        // Safety: drops once, never accessed again due to mem::forget
1317        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1318        // Prevent Drop from running (which would shut down the channel)
1319        std::mem::forget(self);
1320    }
1321}
1322
1323impl CodecStopResponder {
1324    /// Sends a response to the FIDL transaction.
1325    ///
1326    /// Sets the channel to shutdown if an error occurs.
1327    pub fn send(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1328        let _result = self.send_raw(stop_time);
1329        if _result.is_err() {
1330            self.control_handle.shutdown();
1331        }
1332        self.drop_without_shutdown();
1333        _result
1334    }
1335
1336    /// Similar to "send" but does not shutdown the channel if an error occurs.
1337    pub fn send_no_shutdown_on_err(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1338        let _result = self.send_raw(stop_time);
1339        self.drop_without_shutdown();
1340        _result
1341    }
1342
1343    fn send_raw(&self, mut stop_time: i64) -> Result<(), fidl::Error> {
1344        self.control_handle.inner.send::<CodecStopResponse>(
1345            (stop_time,),
1346            self.tx_id,
1347            0x5c2e380df1332dbd,
1348            fidl::encoding::DynamicFlags::empty(),
1349        )
1350    }
1351}
1352
1353#[must_use = "FIDL methods require a response to be sent"]
1354#[derive(Debug)]
1355pub struct CodecStartResponder {
1356    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1357    tx_id: u32,
1358}
1359
1360/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1361/// if the responder is dropped without sending a response, so that the client
1362/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1363impl std::ops::Drop for CodecStartResponder {
1364    fn drop(&mut self) {
1365        self.control_handle.shutdown();
1366        // Safety: drops once, never accessed again
1367        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1368    }
1369}
1370
1371impl fdomain_client::fidl::Responder for CodecStartResponder {
1372    type ControlHandle = CodecControlHandle;
1373
1374    fn control_handle(&self) -> &CodecControlHandle {
1375        &self.control_handle
1376    }
1377
1378    fn drop_without_shutdown(mut self) {
1379        // Safety: drops once, never accessed again due to mem::forget
1380        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1381        // Prevent Drop from running (which would shut down the channel)
1382        std::mem::forget(self);
1383    }
1384}
1385
1386impl CodecStartResponder {
1387    /// Sends a response to the FIDL transaction.
1388    ///
1389    /// Sets the channel to shutdown if an error occurs.
1390    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
1391        let _result = self.send_raw(start_time);
1392        if _result.is_err() {
1393            self.control_handle.shutdown();
1394        }
1395        self.drop_without_shutdown();
1396        _result
1397    }
1398
1399    /// Similar to "send" but does not shutdown the channel if an error occurs.
1400    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
1401        let _result = self.send_raw(start_time);
1402        self.drop_without_shutdown();
1403        _result
1404    }
1405
1406    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
1407        self.control_handle.inner.send::<CodecStartResponse>(
1408            (start_time,),
1409            self.tx_id,
1410            0x329cdacb286ab00,
1411            fidl::encoding::DynamicFlags::empty(),
1412        )
1413    }
1414}
1415
1416#[must_use = "FIDL methods require a response to be sent"]
1417#[derive(Debug)]
1418pub struct CodecGetDaiFormatsResponder {
1419    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1420    tx_id: u32,
1421}
1422
1423/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1424/// if the responder is dropped without sending a response, so that the client
1425/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1426impl std::ops::Drop for CodecGetDaiFormatsResponder {
1427    fn drop(&mut self) {
1428        self.control_handle.shutdown();
1429        // Safety: drops once, never accessed again
1430        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1431    }
1432}
1433
1434impl fdomain_client::fidl::Responder for CodecGetDaiFormatsResponder {
1435    type ControlHandle = CodecControlHandle;
1436
1437    fn control_handle(&self) -> &CodecControlHandle {
1438        &self.control_handle
1439    }
1440
1441    fn drop_without_shutdown(mut self) {
1442        // Safety: drops once, never accessed again due to mem::forget
1443        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1444        // Prevent Drop from running (which would shut down the channel)
1445        std::mem::forget(self);
1446    }
1447}
1448
1449impl CodecGetDaiFormatsResponder {
1450    /// Sends a response to the FIDL transaction.
1451    ///
1452    /// Sets the channel to shutdown if an error occurs.
1453    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1454        let _result = self.send_raw(result);
1455        if _result.is_err() {
1456            self.control_handle.shutdown();
1457        }
1458        self.drop_without_shutdown();
1459        _result
1460    }
1461
1462    /// Similar to "send" but does not shutdown the channel if an error occurs.
1463    pub fn send_no_shutdown_on_err(
1464        self,
1465        mut result: Result<&[DaiSupportedFormats], i32>,
1466    ) -> Result<(), fidl::Error> {
1467        let _result = self.send_raw(result);
1468        self.drop_without_shutdown();
1469        _result
1470    }
1471
1472    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1473        self.control_handle
1474            .inner
1475            .send::<fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>>(
1476                result.map(|formats| (formats,)),
1477                self.tx_id,
1478                0xf8bbc46b4ba6a52,
1479                fidl::encoding::DynamicFlags::empty(),
1480            )
1481    }
1482}
1483
1484#[must_use = "FIDL methods require a response to be sent"]
1485#[derive(Debug)]
1486pub struct CodecSetDaiFormatResponder {
1487    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1488    tx_id: u32,
1489}
1490
1491/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1492/// if the responder is dropped without sending a response, so that the client
1493/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1494impl std::ops::Drop for CodecSetDaiFormatResponder {
1495    fn drop(&mut self) {
1496        self.control_handle.shutdown();
1497        // Safety: drops once, never accessed again
1498        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1499    }
1500}
1501
1502impl fdomain_client::fidl::Responder for CodecSetDaiFormatResponder {
1503    type ControlHandle = CodecControlHandle;
1504
1505    fn control_handle(&self) -> &CodecControlHandle {
1506        &self.control_handle
1507    }
1508
1509    fn drop_without_shutdown(mut self) {
1510        // Safety: drops once, never accessed again due to mem::forget
1511        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1512        // Prevent Drop from running (which would shut down the channel)
1513        std::mem::forget(self);
1514    }
1515}
1516
1517impl CodecSetDaiFormatResponder {
1518    /// Sends a response to the FIDL transaction.
1519    ///
1520    /// Sets the channel to shutdown if an error occurs.
1521    pub fn send(self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1522        let _result = self.send_raw(result);
1523        if _result.is_err() {
1524            self.control_handle.shutdown();
1525        }
1526        self.drop_without_shutdown();
1527        _result
1528    }
1529
1530    /// Similar to "send" but does not shutdown the channel if an error occurs.
1531    pub fn send_no_shutdown_on_err(
1532        self,
1533        mut result: Result<&CodecFormatInfo, i32>,
1534    ) -> Result<(), fidl::Error> {
1535        let _result = self.send_raw(result);
1536        self.drop_without_shutdown();
1537        _result
1538    }
1539
1540    fn send_raw(&self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1541        self.control_handle
1542            .inner
1543            .send::<fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>>(
1544                result.map(|state| (state,)),
1545                self.tx_id,
1546                0x2f829df9e5a7a1ea,
1547                fidl::encoding::DynamicFlags::empty(),
1548            )
1549    }
1550}
1551
1552#[must_use = "FIDL methods require a response to be sent"]
1553#[derive(Debug)]
1554pub struct CodecWatchPlugStateResponder {
1555    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1556    tx_id: u32,
1557}
1558
1559/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1560/// if the responder is dropped without sending a response, so that the client
1561/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1562impl std::ops::Drop for CodecWatchPlugStateResponder {
1563    fn drop(&mut self) {
1564        self.control_handle.shutdown();
1565        // Safety: drops once, never accessed again
1566        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1567    }
1568}
1569
1570impl fdomain_client::fidl::Responder for CodecWatchPlugStateResponder {
1571    type ControlHandle = CodecControlHandle;
1572
1573    fn control_handle(&self) -> &CodecControlHandle {
1574        &self.control_handle
1575    }
1576
1577    fn drop_without_shutdown(mut self) {
1578        // Safety: drops once, never accessed again due to mem::forget
1579        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1580        // Prevent Drop from running (which would shut down the channel)
1581        std::mem::forget(self);
1582    }
1583}
1584
1585impl CodecWatchPlugStateResponder {
1586    /// Sends a response to the FIDL transaction.
1587    ///
1588    /// Sets the channel to shutdown if an error occurs.
1589    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1590        let _result = self.send_raw(plug_state);
1591        if _result.is_err() {
1592            self.control_handle.shutdown();
1593        }
1594        self.drop_without_shutdown();
1595        _result
1596    }
1597
1598    /// Similar to "send" but does not shutdown the channel if an error occurs.
1599    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1600        let _result = self.send_raw(plug_state);
1601        self.drop_without_shutdown();
1602        _result
1603    }
1604
1605    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1606        self.control_handle.inner.send::<CodecWatchPlugStateResponse>(
1607            (plug_state,),
1608            self.tx_id,
1609            0x182b87f935ca7326,
1610            fidl::encoding::DynamicFlags::empty(),
1611        )
1612    }
1613}
1614
1615#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1616pub struct CodecConnectorMarker;
1617
1618impl fdomain_client::fidl::ProtocolMarker for CodecConnectorMarker {
1619    type Proxy = CodecConnectorProxy;
1620    type RequestStream = CodecConnectorRequestStream;
1621
1622    const DEBUG_NAME: &'static str = "(anonymous) CodecConnector";
1623}
1624
1625pub trait CodecConnectorProxyInterface: Send + Sync {
1626    fn r#connect(
1627        &self,
1628        codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1629    ) -> Result<(), fidl::Error>;
1630}
1631
1632#[derive(Debug, Clone)]
1633pub struct CodecConnectorProxy {
1634    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1635}
1636
1637impl fdomain_client::fidl::Proxy for CodecConnectorProxy {
1638    type Protocol = CodecConnectorMarker;
1639
1640    fn from_channel(inner: fdomain_client::Channel) -> Self {
1641        Self::new(inner)
1642    }
1643
1644    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1645        self.client.into_channel().map_err(|client| Self { client })
1646    }
1647
1648    fn as_channel(&self) -> &fdomain_client::Channel {
1649        self.client.as_channel()
1650    }
1651}
1652
1653impl CodecConnectorProxy {
1654    /// Create a new Proxy for fuchsia.hardware.audio/CodecConnector.
1655    pub fn new(channel: fdomain_client::Channel) -> Self {
1656        let protocol_name =
1657            <CodecConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1658        Self { client: fidl::client::Client::new(channel, protocol_name) }
1659    }
1660
1661    /// Get a Stream of events from the remote end of the protocol.
1662    ///
1663    /// # Panics
1664    ///
1665    /// Panics if the event stream was already taken.
1666    pub fn take_event_stream(&self) -> CodecConnectorEventStream {
1667        CodecConnectorEventStream { event_receiver: self.client.take_event_receiver() }
1668    }
1669
1670    /// Connect to a Codec protocol server.
1671    /// This indirection into the Codec protocol allows us to support independent codec client
1672    /// connections.
1673    pub fn r#connect(
1674        &self,
1675        mut codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1676    ) -> Result<(), fidl::Error> {
1677        CodecConnectorProxyInterface::r#connect(self, codec_protocol)
1678    }
1679}
1680
1681impl CodecConnectorProxyInterface for CodecConnectorProxy {
1682    fn r#connect(
1683        &self,
1684        mut codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1685    ) -> Result<(), fidl::Error> {
1686        self.client.send::<CodecConnectorConnectRequest>(
1687            (codec_protocol,),
1688            0x1413f551544026c9,
1689            fidl::encoding::DynamicFlags::empty(),
1690        )
1691    }
1692}
1693
1694pub struct CodecConnectorEventStream {
1695    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1696}
1697
1698impl std::marker::Unpin for CodecConnectorEventStream {}
1699
1700impl futures::stream::FusedStream for CodecConnectorEventStream {
1701    fn is_terminated(&self) -> bool {
1702        self.event_receiver.is_terminated()
1703    }
1704}
1705
1706impl futures::Stream for CodecConnectorEventStream {
1707    type Item = Result<CodecConnectorEvent, fidl::Error>;
1708
1709    fn poll_next(
1710        mut self: std::pin::Pin<&mut Self>,
1711        cx: &mut std::task::Context<'_>,
1712    ) -> std::task::Poll<Option<Self::Item>> {
1713        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1714            &mut self.event_receiver,
1715            cx
1716        )?) {
1717            Some(buf) => std::task::Poll::Ready(Some(CodecConnectorEvent::decode(buf))),
1718            None => std::task::Poll::Ready(None),
1719        }
1720    }
1721}
1722
1723#[derive(Debug)]
1724pub enum CodecConnectorEvent {}
1725
1726impl CodecConnectorEvent {
1727    /// Decodes a message buffer as a [`CodecConnectorEvent`].
1728    fn decode(
1729        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1730    ) -> Result<CodecConnectorEvent, fidl::Error> {
1731        let (bytes, _handles) = buf.split_mut();
1732        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1733        debug_assert_eq!(tx_header.tx_id, 0);
1734        match tx_header.ordinal {
1735            _ => Err(fidl::Error::UnknownOrdinal {
1736                ordinal: tx_header.ordinal,
1737                protocol_name:
1738                    <CodecConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1739            }),
1740        }
1741    }
1742}
1743
1744/// A Stream of incoming requests for fuchsia.hardware.audio/CodecConnector.
1745pub struct CodecConnectorRequestStream {
1746    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1747    is_terminated: bool,
1748}
1749
1750impl std::marker::Unpin for CodecConnectorRequestStream {}
1751
1752impl futures::stream::FusedStream for CodecConnectorRequestStream {
1753    fn is_terminated(&self) -> bool {
1754        self.is_terminated
1755    }
1756}
1757
1758impl fdomain_client::fidl::RequestStream for CodecConnectorRequestStream {
1759    type Protocol = CodecConnectorMarker;
1760    type ControlHandle = CodecConnectorControlHandle;
1761
1762    fn from_channel(channel: fdomain_client::Channel) -> Self {
1763        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1764    }
1765
1766    fn control_handle(&self) -> Self::ControlHandle {
1767        CodecConnectorControlHandle { inner: self.inner.clone() }
1768    }
1769
1770    fn into_inner(
1771        self,
1772    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1773    {
1774        (self.inner, self.is_terminated)
1775    }
1776
1777    fn from_inner(
1778        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1779        is_terminated: bool,
1780    ) -> Self {
1781        Self { inner, is_terminated }
1782    }
1783}
1784
1785impl futures::Stream for CodecConnectorRequestStream {
1786    type Item = Result<CodecConnectorRequest, fidl::Error>;
1787
1788    fn poll_next(
1789        mut self: std::pin::Pin<&mut Self>,
1790        cx: &mut std::task::Context<'_>,
1791    ) -> std::task::Poll<Option<Self::Item>> {
1792        let this = &mut *self;
1793        if this.inner.check_shutdown(cx) {
1794            this.is_terminated = true;
1795            return std::task::Poll::Ready(None);
1796        }
1797        if this.is_terminated {
1798            panic!("polled CodecConnectorRequestStream after completion");
1799        }
1800        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1801            |bytes, handles| {
1802                match this.inner.channel().read_etc(cx, bytes, handles) {
1803                    std::task::Poll::Ready(Ok(())) => {}
1804                    std::task::Poll::Pending => return std::task::Poll::Pending,
1805                    std::task::Poll::Ready(Err(None)) => {
1806                        this.is_terminated = true;
1807                        return std::task::Poll::Ready(None);
1808                    }
1809                    std::task::Poll::Ready(Err(Some(e))) => {
1810                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1811                            e.into(),
1812                        ))));
1813                    }
1814                }
1815
1816                // A message has been received from the channel
1817                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1818
1819                std::task::Poll::Ready(Some(match header.ordinal {
1820                0x1413f551544026c9 => {
1821                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1822                    let mut req = fidl::new_empty!(CodecConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
1823                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CodecConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1824                    let control_handle = CodecConnectorControlHandle {
1825                        inner: this.inner.clone(),
1826                    };
1827                    Ok(CodecConnectorRequest::Connect {codec_protocol: req.codec_protocol,
1828
1829                        control_handle,
1830                    })
1831                }
1832                _ => Err(fidl::Error::UnknownOrdinal {
1833                    ordinal: header.ordinal,
1834                    protocol_name: <CodecConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1835                }),
1836            }))
1837            },
1838        )
1839    }
1840}
1841
1842/// For an overview of the Codec protocols see
1843/// [Codec Interface](//docs/development/audio/drivers/codec.md)
1844/// # Deprecation
1845///
1846/// Not supported anymore, instead use an
1847/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
1848/// with one DAI and no Ring Buffer, see
1849/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
1850#[derive(Debug)]
1851pub enum CodecConnectorRequest {
1852    /// Connect to a Codec protocol server.
1853    /// This indirection into the Codec protocol allows us to support independent codec client
1854    /// connections.
1855    Connect {
1856        codec_protocol: fdomain_client::fidl::ServerEnd<CodecMarker>,
1857        control_handle: CodecConnectorControlHandle,
1858    },
1859}
1860
1861impl CodecConnectorRequest {
1862    #[allow(irrefutable_let_patterns)]
1863    pub fn into_connect(
1864        self,
1865    ) -> Option<(fdomain_client::fidl::ServerEnd<CodecMarker>, CodecConnectorControlHandle)> {
1866        if let CodecConnectorRequest::Connect { codec_protocol, control_handle } = self {
1867            Some((codec_protocol, control_handle))
1868        } else {
1869            None
1870        }
1871    }
1872
1873    /// Name of the method defined in FIDL
1874    pub fn method_name(&self) -> &'static str {
1875        match *self {
1876            CodecConnectorRequest::Connect { .. } => "connect",
1877        }
1878    }
1879}
1880
1881#[derive(Debug, Clone)]
1882pub struct CodecConnectorControlHandle {
1883    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1884}
1885
1886impl CodecConnectorControlHandle {
1887    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1888        self.inner.shutdown_with_epitaph(status.into())
1889    }
1890}
1891
1892impl fdomain_client::fidl::ControlHandle for CodecConnectorControlHandle {
1893    fn shutdown(&self) {
1894        self.inner.shutdown()
1895    }
1896
1897    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1898        self.inner.shutdown_with_epitaph(status)
1899    }
1900
1901    fn is_closed(&self) -> bool {
1902        self.inner.channel().is_closed()
1903    }
1904    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1905        self.inner.channel().on_closed()
1906    }
1907}
1908
1909impl CodecConnectorControlHandle {}
1910
1911#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1912pub struct CompositeMarker;
1913
1914impl fdomain_client::fidl::ProtocolMarker for CompositeMarker {
1915    type Proxy = CompositeProxy;
1916    type RequestStream = CompositeRequestStream;
1917
1918    const DEBUG_NAME: &'static str = "(anonymous) Composite";
1919}
1920pub type CompositeResetResult = Result<(), DriverError>;
1921pub type CompositeGetRingBufferFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
1922pub type CompositeCreateRingBufferResult = Result<(), DriverError>;
1923pub type CompositeGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, DriverError>;
1924pub type CompositeSetDaiFormatResult = Result<(), DriverError>;
1925pub type CompositeGetPacketStreamFormatsResult = Result<Vec<SupportedFormats2>, DriverError>;
1926pub type CompositeCreatePacketStreamResult = Result<(), DriverError>;
1927
1928pub trait CompositeProxyInterface: Send + Sync {
1929    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
1930        + Send;
1931    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
1932    fn r#signal_processing_connect(
1933        &self,
1934        protocol: fdomain_client::fidl::ServerEnd<
1935            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1936        >,
1937    ) -> Result<(), fidl::Error>;
1938    type ResetResponseFut: std::future::Future<Output = Result<CompositeResetResult, fidl::Error>>
1939        + Send;
1940    fn r#reset(&self) -> Self::ResetResponseFut;
1941    type GetPropertiesResponseFut: std::future::Future<Output = Result<CompositeProperties, fidl::Error>>
1942        + Send;
1943    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
1944    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<CompositeGetRingBufferFormatsResult, fidl::Error>>
1945        + Send;
1946    fn r#get_ring_buffer_formats(
1947        &self,
1948        processing_element_id: u64,
1949    ) -> Self::GetRingBufferFormatsResponseFut;
1950    type CreateRingBufferResponseFut: std::future::Future<Output = Result<CompositeCreateRingBufferResult, fidl::Error>>
1951        + Send;
1952    fn r#create_ring_buffer(
1953        &self,
1954        processing_element_id: u64,
1955        format: &Format2,
1956        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
1957    ) -> Self::CreateRingBufferResponseFut;
1958    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CompositeGetDaiFormatsResult, fidl::Error>>
1959        + Send;
1960    fn r#get_dai_formats(&self, processing_element_id: u64) -> Self::GetDaiFormatsResponseFut;
1961    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CompositeSetDaiFormatResult, fidl::Error>>
1962        + Send;
1963    fn r#set_dai_format(
1964        &self,
1965        processing_element_id: u64,
1966        format: &DaiFormat,
1967    ) -> Self::SetDaiFormatResponseFut;
1968    type GetPacketStreamFormatsResponseFut: std::future::Future<Output = Result<CompositeGetPacketStreamFormatsResult, fidl::Error>>
1969        + Send;
1970    fn r#get_packet_stream_formats(
1971        &self,
1972        processing_element_id: u64,
1973    ) -> Self::GetPacketStreamFormatsResponseFut;
1974    type CreatePacketStreamResponseFut: std::future::Future<Output = Result<CompositeCreatePacketStreamResult, fidl::Error>>
1975        + Send;
1976    fn r#create_packet_stream(
1977        &self,
1978        processing_element_id: u64,
1979        format: &Format2,
1980        packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
1981    ) -> Self::CreatePacketStreamResponseFut;
1982}
1983
1984#[derive(Debug, Clone)]
1985pub struct CompositeProxy {
1986    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1987}
1988
1989impl fdomain_client::fidl::Proxy for CompositeProxy {
1990    type Protocol = CompositeMarker;
1991
1992    fn from_channel(inner: fdomain_client::Channel) -> Self {
1993        Self::new(inner)
1994    }
1995
1996    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1997        self.client.into_channel().map_err(|client| Self { client })
1998    }
1999
2000    fn as_channel(&self) -> &fdomain_client::Channel {
2001        self.client.as_channel()
2002    }
2003}
2004
2005impl CompositeProxy {
2006    /// Create a new Proxy for fuchsia.hardware.audio/Composite.
2007    pub fn new(channel: fdomain_client::Channel) -> Self {
2008        let protocol_name = <CompositeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2009        Self { client: fidl::client::Client::new(channel, protocol_name) }
2010    }
2011
2012    /// Get a Stream of events from the remote end of the protocol.
2013    ///
2014    /// # Panics
2015    ///
2016    /// Panics if the event stream was already taken.
2017    pub fn take_event_stream(&self) -> CompositeEventStream {
2018        CompositeEventStream { event_receiver: self.client.take_event_receiver() }
2019    }
2020
2021    /// Retrieves top level health state.
2022    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2023    pub fn r#get_health_state(
2024        &self,
2025    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
2026    {
2027        CompositeProxyInterface::r#get_health_state(self)
2028    }
2029
2030    /// Connect to a `SignalProcessing` protocol.
2031    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2032    /// the maximum number of connections have already been created, for instance one, then the
2033    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2034    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2035    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2036    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2037    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2038    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2039    /// is intended to be composed, and hence the more verbose name allows differentiation and
2040    /// improved clarity.
2041    pub fn r#signal_processing_connect(
2042        &self,
2043        mut protocol: fdomain_client::fidl::ServerEnd<
2044            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2045        >,
2046    ) -> Result<(), fidl::Error> {
2047        CompositeProxyInterface::r#signal_processing_connect(self, protocol)
2048    }
2049
2050    /// Resets the hardware including all DAI interconnects and signal processing.
2051    /// As a result, all channels obtained by `CreateRingBuffer` or `CreatePacketStream` will be
2052    /// closed.
2053    ///
2054    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2055    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2056    /// any processing elements, and reconstruct any ring buffers and packet streams.
2057    ///
2058    /// If the driver can't successfully reset the hardware, it will return an error and then close
2059    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2060    pub fn r#reset(
2061        &self,
2062    ) -> fidl::client::QueryResponseFut<
2063        CompositeResetResult,
2064        fdomain_client::fidl::FDomainResourceDialect,
2065    > {
2066        CompositeProxyInterface::r#reset(self)
2067    }
2068
2069    /// Retrieves top level static properties.
2070    pub fn r#get_properties(
2071        &self,
2072    ) -> fidl::client::QueryResponseFut<
2073        CompositeProperties,
2074        fdomain_client::fidl::FDomainResourceDialect,
2075    > {
2076        CompositeProxyInterface::r#get_properties(self)
2077    }
2078
2079    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2080    /// in the topology supported by this driver as returned by `GetElements` from
2081    /// fuchsia.hardware.audio.signalprocessing.
2082    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2083    /// client may retry at a later time.
2084    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2085    /// by `GetElements`.
2086    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2087    /// `RING_BUFFER`.
2088    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2089    /// the parameters in `SupportedFormats2` may be supported.
2090    /// The vector returned to the caller must contain at least one entry.
2091    pub fn r#get_ring_buffer_formats(
2092        &self,
2093        mut processing_element_id: u64,
2094    ) -> fidl::client::QueryResponseFut<
2095        CompositeGetRingBufferFormatsResult,
2096        fdomain_client::fidl::FDomainResourceDialect,
2097    > {
2098        CompositeProxyInterface::r#get_ring_buffer_formats(self, processing_element_id)
2099    }
2100
2101    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2102    /// processing element specified by `processing_element_id`. The format is based on information
2103    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2104    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2105    /// audio buffer provided by the driver.
2106    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2107    /// by `GetElements`.
2108    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2109    /// `RING_BUFFER`.
2110    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2111    /// `format` is not supported.
2112    pub fn r#create_ring_buffer(
2113        &self,
2114        mut processing_element_id: u64,
2115        mut format: &Format2,
2116        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
2117    ) -> fidl::client::QueryResponseFut<
2118        CompositeCreateRingBufferResult,
2119        fdomain_client::fidl::FDomainResourceDialect,
2120    > {
2121        CompositeProxyInterface::r#create_ring_buffer(
2122            self,
2123            processing_element_id,
2124            format,
2125            ring_buffer,
2126        )
2127    }
2128
2129    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2130    /// in the topology supported by this driver as returned by `GetElements` from
2131    /// fuchsia.hardware.audio.signalprocessing.
2132    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2133    /// may retry at a later time.
2134    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2135    /// by `GetElements`.
2136    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2137    /// `DAI_INTERCONNECT`.
2138    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2139    /// the parameters in DaiSupportedFormats may be supported.
2140    /// The vector returned to the caller must contain at least one entry.
2141    pub fn r#get_dai_formats(
2142        &self,
2143        mut processing_element_id: u64,
2144    ) -> fidl::client::QueryResponseFut<
2145        CompositeGetDaiFormatsResult,
2146        fdomain_client::fidl::FDomainResourceDialect,
2147    > {
2148        CompositeProxyInterface::r#get_dai_formats(self, processing_element_id)
2149    }
2150
2151    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2152    /// processing element specified by `processing_element_id`. The format is based on information
2153    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2154    /// requirement.
2155    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2156    /// by `GetElements`.
2157    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2158    /// `DAI_INTERCONNECT`.
2159    pub fn r#set_dai_format(
2160        &self,
2161        mut processing_element_id: u64,
2162        mut format: &DaiFormat,
2163    ) -> fidl::client::QueryResponseFut<
2164        CompositeSetDaiFormatResult,
2165        fdomain_client::fidl::FDomainResourceDialect,
2166    > {
2167        CompositeProxyInterface::r#set_dai_format(self, processing_element_id, format)
2168    }
2169
2170    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2171    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2172    /// from fuchsia.hardware.audio.signalprocessing.
2173    ///
2174    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2175    /// client may retry this request at a later time.
2176    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2177    /// `GetElements`.
2178    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2179    /// `PACKET_STREAM`.
2180    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2181    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2182    /// combinations of the parameters in `SupportedFormats2` may be supported.
2183    /// The vector returned to the caller must contain at least one entry.
2184    pub fn r#get_packet_stream_formats(
2185        &self,
2186        mut processing_element_id: u64,
2187    ) -> fidl::client::QueryResponseFut<
2188        CompositeGetPacketStreamFormatsResult,
2189        fdomain_client::fidl::FDomainResourceDialect,
2190    > {
2191        CompositeProxyInterface::r#get_packet_stream_formats(self, processing_element_id)
2192    }
2193
2194    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2195    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is
2196    /// based on information that the driver provides in `GetPacketStreamFormats`, what is
2197    /// supported by the client, and any other requirement. The returned `packet_stream_control`
2198    /// channel is used to access and control the packet stream protocol served by the driver.
2199    ///
2200    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2201    /// `GetElements`.
2202    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2203    /// `PACKET_STREAM`.
2204    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2205    /// at this time, but it should be able to at some future time. This request can be retried.
2206    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2207    /// `format` is not supported.
2208    pub fn r#create_packet_stream(
2209        &self,
2210        mut processing_element_id: u64,
2211        mut format: &Format2,
2212        mut packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
2213    ) -> fidl::client::QueryResponseFut<
2214        CompositeCreatePacketStreamResult,
2215        fdomain_client::fidl::FDomainResourceDialect,
2216    > {
2217        CompositeProxyInterface::r#create_packet_stream(
2218            self,
2219            processing_element_id,
2220            format,
2221            packet_stream_control,
2222        )
2223    }
2224}
2225
2226impl CompositeProxyInterface for CompositeProxy {
2227    type GetHealthStateResponseFut =
2228        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
2229    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
2230        fn _decode(
2231            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2232        ) -> Result<HealthState, fidl::Error> {
2233            let _response = fidl::client::decode_transaction_body::<
2234                HealthGetHealthStateResponse,
2235                fdomain_client::fidl::FDomainResourceDialect,
2236                0x4e146d6bca733a84,
2237            >(_buf?)?;
2238            Ok(_response.state)
2239        }
2240        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
2241            (),
2242            0x4e146d6bca733a84,
2243            fidl::encoding::DynamicFlags::empty(),
2244            _decode,
2245        )
2246    }
2247
2248    fn r#signal_processing_connect(
2249        &self,
2250        mut protocol: fdomain_client::fidl::ServerEnd<
2251            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2252        >,
2253    ) -> Result<(), fidl::Error> {
2254        self.client.send::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2255            (protocol,),
2256            0xa81907ce6066295,
2257            fidl::encoding::DynamicFlags::empty(),
2258        )
2259    }
2260
2261    type ResetResponseFut = fidl::client::QueryResponseFut<
2262        CompositeResetResult,
2263        fdomain_client::fidl::FDomainResourceDialect,
2264    >;
2265    fn r#reset(&self) -> Self::ResetResponseFut {
2266        fn _decode(
2267            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2268        ) -> Result<CompositeResetResult, fidl::Error> {
2269            let _response = fidl::client::decode_transaction_body::<
2270                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2271                fdomain_client::fidl::FDomainResourceDialect,
2272                0xac355fb98341996,
2273            >(_buf?)?
2274            .into_result_fdomain::<CompositeMarker>("reset")?;
2275            Ok(_response.map(|x| x))
2276        }
2277        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeResetResult>(
2278            (),
2279            0xac355fb98341996,
2280            fidl::encoding::DynamicFlags::FLEXIBLE,
2281            _decode,
2282        )
2283    }
2284
2285    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2286        CompositeProperties,
2287        fdomain_client::fidl::FDomainResourceDialect,
2288    >;
2289    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2290        fn _decode(
2291            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2292        ) -> Result<CompositeProperties, fidl::Error> {
2293            let _response = fidl::client::decode_transaction_body::<
2294                fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>,
2295                fdomain_client::fidl::FDomainResourceDialect,
2296                0x31846fa0a459942b,
2297            >(_buf?)?
2298            .into_result_fdomain::<CompositeMarker>("get_properties")?;
2299            Ok(_response.properties)
2300        }
2301        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeProperties>(
2302            (),
2303            0x31846fa0a459942b,
2304            fidl::encoding::DynamicFlags::FLEXIBLE,
2305            _decode,
2306        )
2307    }
2308
2309    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
2310        CompositeGetRingBufferFormatsResult,
2311        fdomain_client::fidl::FDomainResourceDialect,
2312    >;
2313    fn r#get_ring_buffer_formats(
2314        &self,
2315        mut processing_element_id: u64,
2316    ) -> Self::GetRingBufferFormatsResponseFut {
2317        fn _decode(
2318            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2319        ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2320            let _response = fidl::client::decode_transaction_body::<
2321                fidl::encoding::FlexibleResultType<
2322                    CompositeGetRingBufferFormatsResponse,
2323                    DriverError,
2324                >,
2325                fdomain_client::fidl::FDomainResourceDialect,
2326                0x1d89b701b6816ac4,
2327            >(_buf?)?
2328            .into_result_fdomain::<CompositeMarker>("get_ring_buffer_formats")?;
2329            Ok(_response.map(|x| x.ring_buffer_formats))
2330        }
2331        self.client.send_query_and_decode::<
2332            CompositeGetRingBufferFormatsRequest,
2333            CompositeGetRingBufferFormatsResult,
2334        >(
2335            (processing_element_id,),
2336            0x1d89b701b6816ac4,
2337            fidl::encoding::DynamicFlags::FLEXIBLE,
2338            _decode,
2339        )
2340    }
2341
2342    type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
2343        CompositeCreateRingBufferResult,
2344        fdomain_client::fidl::FDomainResourceDialect,
2345    >;
2346    fn r#create_ring_buffer(
2347        &self,
2348        mut processing_element_id: u64,
2349        mut format: &Format2,
2350        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
2351    ) -> Self::CreateRingBufferResponseFut {
2352        fn _decode(
2353            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2354        ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2355            let _response = fidl::client::decode_transaction_body::<
2356                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2357                fdomain_client::fidl::FDomainResourceDialect,
2358                0x28c5685f85262033,
2359            >(_buf?)?
2360            .into_result_fdomain::<CompositeMarker>("create_ring_buffer")?;
2361            Ok(_response.map(|x| x))
2362        }
2363        self.client.send_query_and_decode::<
2364            CompositeCreateRingBufferRequest,
2365            CompositeCreateRingBufferResult,
2366        >(
2367            (processing_element_id, format, ring_buffer,),
2368            0x28c5685f85262033,
2369            fidl::encoding::DynamicFlags::FLEXIBLE,
2370            _decode,
2371        )
2372    }
2373
2374    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
2375        CompositeGetDaiFormatsResult,
2376        fdomain_client::fidl::FDomainResourceDialect,
2377    >;
2378    fn r#get_dai_formats(&self, mut processing_element_id: u64) -> Self::GetDaiFormatsResponseFut {
2379        fn _decode(
2380            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2381        ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2382            let _response = fidl::client::decode_transaction_body::<
2383                fidl::encoding::FlexibleResultType<CompositeGetDaiFormatsResponse, DriverError>,
2384                fdomain_client::fidl::FDomainResourceDialect,
2385                0x3cbeaed59c8f69b,
2386            >(_buf?)?
2387            .into_result_fdomain::<CompositeMarker>("get_dai_formats")?;
2388            Ok(_response.map(|x| x.dai_formats))
2389        }
2390        self.client
2391            .send_query_and_decode::<CompositeGetDaiFormatsRequest, CompositeGetDaiFormatsResult>(
2392                (processing_element_id,),
2393                0x3cbeaed59c8f69b,
2394                fidl::encoding::DynamicFlags::FLEXIBLE,
2395                _decode,
2396            )
2397    }
2398
2399    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
2400        CompositeSetDaiFormatResult,
2401        fdomain_client::fidl::FDomainResourceDialect,
2402    >;
2403    fn r#set_dai_format(
2404        &self,
2405        mut processing_element_id: u64,
2406        mut format: &DaiFormat,
2407    ) -> Self::SetDaiFormatResponseFut {
2408        fn _decode(
2409            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2410        ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2411            let _response = fidl::client::decode_transaction_body::<
2412                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2413                fdomain_client::fidl::FDomainResourceDialect,
2414                0x155acf5cc0dc8a84,
2415            >(_buf?)?
2416            .into_result_fdomain::<CompositeMarker>("set_dai_format")?;
2417            Ok(_response.map(|x| x))
2418        }
2419        self.client
2420            .send_query_and_decode::<CompositeSetDaiFormatRequest, CompositeSetDaiFormatResult>(
2421                (processing_element_id, format),
2422                0x155acf5cc0dc8a84,
2423                fidl::encoding::DynamicFlags::FLEXIBLE,
2424                _decode,
2425            )
2426    }
2427
2428    type GetPacketStreamFormatsResponseFut = fidl::client::QueryResponseFut<
2429        CompositeGetPacketStreamFormatsResult,
2430        fdomain_client::fidl::FDomainResourceDialect,
2431    >;
2432    fn r#get_packet_stream_formats(
2433        &self,
2434        mut processing_element_id: u64,
2435    ) -> Self::GetPacketStreamFormatsResponseFut {
2436        fn _decode(
2437            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2438        ) -> Result<CompositeGetPacketStreamFormatsResult, fidl::Error> {
2439            let _response = fidl::client::decode_transaction_body::<
2440                fidl::encoding::FlexibleResultType<
2441                    CompositeGetPacketStreamFormatsResponse,
2442                    DriverError,
2443                >,
2444                fdomain_client::fidl::FDomainResourceDialect,
2445                0x73cc47c6ad39bca7,
2446            >(_buf?)?
2447            .into_result_fdomain::<CompositeMarker>("get_packet_stream_formats")?;
2448            Ok(_response.map(|x| x.packet_stream_formats))
2449        }
2450        self.client.send_query_and_decode::<
2451            CompositeGetPacketStreamFormatsRequest,
2452            CompositeGetPacketStreamFormatsResult,
2453        >(
2454            (processing_element_id,),
2455            0x73cc47c6ad39bca7,
2456            fidl::encoding::DynamicFlags::FLEXIBLE,
2457            _decode,
2458        )
2459    }
2460
2461    type CreatePacketStreamResponseFut = fidl::client::QueryResponseFut<
2462        CompositeCreatePacketStreamResult,
2463        fdomain_client::fidl::FDomainResourceDialect,
2464    >;
2465    fn r#create_packet_stream(
2466        &self,
2467        mut processing_element_id: u64,
2468        mut format: &Format2,
2469        mut packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
2470    ) -> Self::CreatePacketStreamResponseFut {
2471        fn _decode(
2472            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2473        ) -> Result<CompositeCreatePacketStreamResult, fidl::Error> {
2474            let _response = fidl::client::decode_transaction_body::<
2475                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DriverError>,
2476                fdomain_client::fidl::FDomainResourceDialect,
2477                0x50e8902b756c707c,
2478            >(_buf?)?
2479            .into_result_fdomain::<CompositeMarker>("create_packet_stream")?;
2480            Ok(_response.map(|x| x))
2481        }
2482        self.client.send_query_and_decode::<
2483            CompositeCreatePacketStreamRequest,
2484            CompositeCreatePacketStreamResult,
2485        >(
2486            (processing_element_id, format, packet_stream_control,),
2487            0x50e8902b756c707c,
2488            fidl::encoding::DynamicFlags::FLEXIBLE,
2489            _decode,
2490        )
2491    }
2492}
2493
2494pub struct CompositeEventStream {
2495    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2496}
2497
2498impl std::marker::Unpin for CompositeEventStream {}
2499
2500impl futures::stream::FusedStream for CompositeEventStream {
2501    fn is_terminated(&self) -> bool {
2502        self.event_receiver.is_terminated()
2503    }
2504}
2505
2506impl futures::Stream for CompositeEventStream {
2507    type Item = Result<CompositeEvent, fidl::Error>;
2508
2509    fn poll_next(
2510        mut self: std::pin::Pin<&mut Self>,
2511        cx: &mut std::task::Context<'_>,
2512    ) -> std::task::Poll<Option<Self::Item>> {
2513        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2514            &mut self.event_receiver,
2515            cx
2516        )?) {
2517            Some(buf) => std::task::Poll::Ready(Some(CompositeEvent::decode(buf))),
2518            None => std::task::Poll::Ready(None),
2519        }
2520    }
2521}
2522
2523#[derive(Debug)]
2524pub enum CompositeEvent {
2525    #[non_exhaustive]
2526    _UnknownEvent {
2527        /// Ordinal of the event that was sent.
2528        ordinal: u64,
2529    },
2530}
2531
2532impl CompositeEvent {
2533    /// Decodes a message buffer as a [`CompositeEvent`].
2534    fn decode(
2535        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2536    ) -> Result<CompositeEvent, fidl::Error> {
2537        let (bytes, _handles) = buf.split_mut();
2538        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2539        debug_assert_eq!(tx_header.tx_id, 0);
2540        match tx_header.ordinal {
2541            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2542                Ok(CompositeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2543            }
2544            _ => Err(fidl::Error::UnknownOrdinal {
2545                ordinal: tx_header.ordinal,
2546                protocol_name:
2547                    <CompositeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2548            }),
2549        }
2550    }
2551}
2552
2553/// A Stream of incoming requests for fuchsia.hardware.audio/Composite.
2554pub struct CompositeRequestStream {
2555    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2556    is_terminated: bool,
2557}
2558
2559impl std::marker::Unpin for CompositeRequestStream {}
2560
2561impl futures::stream::FusedStream for CompositeRequestStream {
2562    fn is_terminated(&self) -> bool {
2563        self.is_terminated
2564    }
2565}
2566
2567impl fdomain_client::fidl::RequestStream for CompositeRequestStream {
2568    type Protocol = CompositeMarker;
2569    type ControlHandle = CompositeControlHandle;
2570
2571    fn from_channel(channel: fdomain_client::Channel) -> Self {
2572        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2573    }
2574
2575    fn control_handle(&self) -> Self::ControlHandle {
2576        CompositeControlHandle { inner: self.inner.clone() }
2577    }
2578
2579    fn into_inner(
2580        self,
2581    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2582    {
2583        (self.inner, self.is_terminated)
2584    }
2585
2586    fn from_inner(
2587        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2588        is_terminated: bool,
2589    ) -> Self {
2590        Self { inner, is_terminated }
2591    }
2592}
2593
2594impl futures::Stream for CompositeRequestStream {
2595    type Item = Result<CompositeRequest, fidl::Error>;
2596
2597    fn poll_next(
2598        mut self: std::pin::Pin<&mut Self>,
2599        cx: &mut std::task::Context<'_>,
2600    ) -> std::task::Poll<Option<Self::Item>> {
2601        let this = &mut *self;
2602        if this.inner.check_shutdown(cx) {
2603            this.is_terminated = true;
2604            return std::task::Poll::Ready(None);
2605        }
2606        if this.is_terminated {
2607            panic!("polled CompositeRequestStream after completion");
2608        }
2609        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2610            |bytes, handles| {
2611                match this.inner.channel().read_etc(cx, bytes, handles) {
2612                    std::task::Poll::Ready(Ok(())) => {}
2613                    std::task::Poll::Pending => return std::task::Poll::Pending,
2614                    std::task::Poll::Ready(Err(None)) => {
2615                        this.is_terminated = true;
2616                        return std::task::Poll::Ready(None);
2617                    }
2618                    std::task::Poll::Ready(Err(Some(e))) => {
2619                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2620                            e.into(),
2621                        ))));
2622                    }
2623                }
2624
2625                // A message has been received from the channel
2626                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2627
2628                std::task::Poll::Ready(Some(match header.ordinal {
2629                    0x4e146d6bca733a84 => {
2630                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2631                        let mut req = fidl::new_empty!(
2632                            fidl::encoding::EmptyPayload,
2633                            fdomain_client::fidl::FDomainResourceDialect
2634                        );
2635                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2636                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2637                        Ok(CompositeRequest::GetHealthState {
2638                            responder: CompositeGetHealthStateResponder {
2639                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2640                                tx_id: header.tx_id,
2641                            },
2642                        })
2643                    }
2644                    0xa81907ce6066295 => {
2645                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2646                        let mut req = fidl::new_empty!(fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
2647                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2648                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2649                        Ok(CompositeRequest::SignalProcessingConnect {
2650                            protocol: req.protocol,
2651
2652                            control_handle,
2653                        })
2654                    }
2655                    0xac355fb98341996 => {
2656                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2657                        let mut req = fidl::new_empty!(
2658                            fidl::encoding::EmptyPayload,
2659                            fdomain_client::fidl::FDomainResourceDialect
2660                        );
2661                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2662                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2663                        Ok(CompositeRequest::Reset {
2664                            responder: CompositeResetResponder {
2665                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2666                                tx_id: header.tx_id,
2667                            },
2668                        })
2669                    }
2670                    0x31846fa0a459942b => {
2671                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2672                        let mut req = fidl::new_empty!(
2673                            fidl::encoding::EmptyPayload,
2674                            fdomain_client::fidl::FDomainResourceDialect
2675                        );
2676                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2677                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2678                        Ok(CompositeRequest::GetProperties {
2679                            responder: CompositeGetPropertiesResponder {
2680                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2681                                tx_id: header.tx_id,
2682                            },
2683                        })
2684                    }
2685                    0x1d89b701b6816ac4 => {
2686                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2687                        let mut req = fidl::new_empty!(
2688                            CompositeGetRingBufferFormatsRequest,
2689                            fdomain_client::fidl::FDomainResourceDialect
2690                        );
2691                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeGetRingBufferFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2692                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2693                        Ok(CompositeRequest::GetRingBufferFormats {
2694                            processing_element_id: req.processing_element_id,
2695
2696                            responder: CompositeGetRingBufferFormatsResponder {
2697                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2698                                tx_id: header.tx_id,
2699                            },
2700                        })
2701                    }
2702                    0x28c5685f85262033 => {
2703                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2704                        let mut req = fidl::new_empty!(
2705                            CompositeCreateRingBufferRequest,
2706                            fdomain_client::fidl::FDomainResourceDialect
2707                        );
2708                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
2709                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2710                        Ok(CompositeRequest::CreateRingBuffer {
2711                            processing_element_id: req.processing_element_id,
2712                            format: req.format,
2713                            ring_buffer: req.ring_buffer,
2714
2715                            responder: CompositeCreateRingBufferResponder {
2716                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2717                                tx_id: header.tx_id,
2718                            },
2719                        })
2720                    }
2721                    0x3cbeaed59c8f69b => {
2722                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2723                        let mut req = fidl::new_empty!(
2724                            CompositeGetDaiFormatsRequest,
2725                            fdomain_client::fidl::FDomainResourceDialect
2726                        );
2727                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeGetDaiFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2728                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2729                        Ok(CompositeRequest::GetDaiFormats {
2730                            processing_element_id: req.processing_element_id,
2731
2732                            responder: CompositeGetDaiFormatsResponder {
2733                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2734                                tx_id: header.tx_id,
2735                            },
2736                        })
2737                    }
2738                    0x155acf5cc0dc8a84 => {
2739                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2740                        let mut req = fidl::new_empty!(
2741                            CompositeSetDaiFormatRequest,
2742                            fdomain_client::fidl::FDomainResourceDialect
2743                        );
2744                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
2745                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2746                        Ok(CompositeRequest::SetDaiFormat {
2747                            processing_element_id: req.processing_element_id,
2748                            format: req.format,
2749
2750                            responder: CompositeSetDaiFormatResponder {
2751                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2752                                tx_id: header.tx_id,
2753                            },
2754                        })
2755                    }
2756                    0x73cc47c6ad39bca7 => {
2757                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2758                        let mut req = fidl::new_empty!(
2759                            CompositeGetPacketStreamFormatsRequest,
2760                            fdomain_client::fidl::FDomainResourceDialect
2761                        );
2762                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeGetPacketStreamFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
2763                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2764                        Ok(CompositeRequest::GetPacketStreamFormats {
2765                            processing_element_id: req.processing_element_id,
2766
2767                            responder: CompositeGetPacketStreamFormatsResponder {
2768                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2769                                tx_id: header.tx_id,
2770                            },
2771                        })
2772                    }
2773                    0x50e8902b756c707c => {
2774                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2775                        let mut req = fidl::new_empty!(
2776                            CompositeCreatePacketStreamRequest,
2777                            fdomain_client::fidl::FDomainResourceDialect
2778                        );
2779                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeCreatePacketStreamRequest>(&header, _body_bytes, handles, &mut req)?;
2780                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
2781                        Ok(CompositeRequest::CreatePacketStream {
2782                            processing_element_id: req.processing_element_id,
2783                            format: req.format,
2784                            packet_stream_control: req.packet_stream_control,
2785
2786                            responder: CompositeCreatePacketStreamResponder {
2787                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2788                                tx_id: header.tx_id,
2789                            },
2790                        })
2791                    }
2792                    _ if header.tx_id == 0
2793                        && header
2794                            .dynamic_flags()
2795                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2796                    {
2797                        Ok(CompositeRequest::_UnknownMethod {
2798                            ordinal: header.ordinal,
2799                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
2800                            method_type: fidl::MethodType::OneWay,
2801                        })
2802                    }
2803                    _ if header
2804                        .dynamic_flags()
2805                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2806                    {
2807                        this.inner.send_framework_err(
2808                            fidl::encoding::FrameworkErr::UnknownMethod,
2809                            header.tx_id,
2810                            header.ordinal,
2811                            header.dynamic_flags(),
2812                            (bytes, handles),
2813                        )?;
2814                        Ok(CompositeRequest::_UnknownMethod {
2815                            ordinal: header.ordinal,
2816                            control_handle: CompositeControlHandle { inner: this.inner.clone() },
2817                            method_type: fidl::MethodType::TwoWay,
2818                        })
2819                    }
2820                    _ => Err(fidl::Error::UnknownOrdinal {
2821                        ordinal: header.ordinal,
2822                        protocol_name:
2823                            <CompositeMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2824                    }),
2825                }))
2826            },
2827        )
2828    }
2829}
2830
2831#[derive(Debug)]
2832pub enum CompositeRequest {
2833    /// Retrieves top level health state.
2834    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2835    GetHealthState { responder: CompositeGetHealthStateResponder },
2836    /// Connect to a `SignalProcessing` protocol.
2837    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2838    /// the maximum number of connections have already been created, for instance one, then the
2839    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2840    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2841    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2842    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2843    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2844    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2845    /// is intended to be composed, and hence the more verbose name allows differentiation and
2846    /// improved clarity.
2847    SignalProcessingConnect {
2848        protocol: fdomain_client::fidl::ServerEnd<
2849            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2850        >,
2851        control_handle: CompositeControlHandle,
2852    },
2853    /// Resets the hardware including all DAI interconnects and signal processing.
2854    /// As a result, all channels obtained by `CreateRingBuffer` or `CreatePacketStream` will be
2855    /// closed.
2856    ///
2857    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2858    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2859    /// any processing elements, and reconstruct any ring buffers and packet streams.
2860    ///
2861    /// If the driver can't successfully reset the hardware, it will return an error and then close
2862    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2863    Reset { responder: CompositeResetResponder },
2864    /// Retrieves top level static properties.
2865    GetProperties { responder: CompositeGetPropertiesResponder },
2866    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2867    /// in the topology supported by this driver as returned by `GetElements` from
2868    /// fuchsia.hardware.audio.signalprocessing.
2869    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2870    /// client may retry at a later time.
2871    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2872    /// by `GetElements`.
2873    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2874    /// `RING_BUFFER`.
2875    /// Retrieving multiple `SupportedFormats2` allows for cases where exclusive combinations of
2876    /// the parameters in `SupportedFormats2` may be supported.
2877    /// The vector returned to the caller must contain at least one entry.
2878    GetRingBufferFormats {
2879        processing_element_id: u64,
2880        responder: CompositeGetRingBufferFormatsResponder,
2881    },
2882    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2883    /// processing element specified by `processing_element_id`. The format is based on information
2884    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2885    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2886    /// audio buffer provided by the driver.
2887    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2888    /// by `GetElements`.
2889    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2890    /// `RING_BUFFER`.
2891    /// Returns `NOT_SUPPORTED` if the driver does not support ring buffers, or if the specified
2892    /// `format` is not supported.
2893    CreateRingBuffer {
2894        processing_element_id: u64,
2895        format: Format2,
2896        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
2897        responder: CompositeCreateRingBufferResponder,
2898    },
2899    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2900    /// in the topology supported by this driver as returned by `GetElements` from
2901    /// fuchsia.hardware.audio.signalprocessing.
2902    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2903    /// may retry at a later time.
2904    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2905    /// by `GetElements`.
2906    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2907    /// `DAI_INTERCONNECT`.
2908    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2909    /// the parameters in DaiSupportedFormats may be supported.
2910    /// The vector returned to the caller must contain at least one entry.
2911    GetDaiFormats { processing_element_id: u64, responder: CompositeGetDaiFormatsResponder },
2912    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2913    /// processing element specified by `processing_element_id`. The format is based on information
2914    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2915    /// requirement.
2916    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2917    /// by `GetElements`.
2918    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2919    /// `DAI_INTERCONNECT`.
2920    SetDaiFormat {
2921        processing_element_id: u64,
2922        format: DaiFormat,
2923        responder: CompositeSetDaiFormatResponder,
2924    },
2925    /// Retrieves the packet-stream formats supported by a `PACKET_STREAM` processing element
2926    /// in the topologies supported by this driver, as returned by `GetElements` and `GetTopologies`
2927    /// from fuchsia.hardware.audio.signalprocessing.
2928    ///
2929    /// Returns `SHOULD_WAIT` if the packet-stream formats are not available at this time. The
2930    /// client may retry this request at a later time.
2931    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2932    /// `GetElements`.
2933    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2934    /// `PACKET_STREAM`.
2935    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams.
2936    /// Returning a vector with multiple `SupportedFormats2` enables cases where exclusive
2937    /// combinations of the parameters in `SupportedFormats2` may be supported.
2938    /// The vector returned to the caller must contain at least one entry.
2939    GetPacketStreamFormats {
2940        processing_element_id: u64,
2941        responder: CompositeGetPacketStreamFormatsResponder,
2942    },
2943    /// `CreatePacketStream` is sent by clients to select a packet-stream format for the
2944    /// `PACKET_STREAM` processing element specified by `processing_element_id`. The format is
2945    /// based on information that the driver provides in `GetPacketStreamFormats`, what is
2946    /// supported by the client, and any other requirement. The returned `packet_stream_control`
2947    /// channel is used to access and control the packet stream protocol served by the driver.
2948    ///
2949    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned by
2950    /// `GetElements`.
2951    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2952    /// `PACKET_STREAM`.
2953    /// Returns `SHOULD_WAIT` if the server cannot create a packet stream for this element/format
2954    /// at this time, but it should be able to at some future time. This request can be retried.
2955    /// Returns `NOT_SUPPORTED` if the driver does not support packet streams, or if the specified
2956    /// `format` is not supported.
2957    CreatePacketStream {
2958        processing_element_id: u64,
2959        format: Format2,
2960        packet_stream_control: fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
2961        responder: CompositeCreatePacketStreamResponder,
2962    },
2963    /// An interaction was received which does not match any known method.
2964    #[non_exhaustive]
2965    _UnknownMethod {
2966        /// Ordinal of the method that was called.
2967        ordinal: u64,
2968        control_handle: CompositeControlHandle,
2969        method_type: fidl::MethodType,
2970    },
2971}
2972
2973impl CompositeRequest {
2974    #[allow(irrefutable_let_patterns)]
2975    pub fn into_get_health_state(self) -> Option<(CompositeGetHealthStateResponder)> {
2976        if let CompositeRequest::GetHealthState { responder } = self {
2977            Some((responder))
2978        } else {
2979            None
2980        }
2981    }
2982
2983    #[allow(irrefutable_let_patterns)]
2984    pub fn into_signal_processing_connect(
2985        self,
2986    ) -> Option<(
2987        fdomain_client::fidl::ServerEnd<
2988            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2989        >,
2990        CompositeControlHandle,
2991    )> {
2992        if let CompositeRequest::SignalProcessingConnect { protocol, control_handle } = self {
2993            Some((protocol, control_handle))
2994        } else {
2995            None
2996        }
2997    }
2998
2999    #[allow(irrefutable_let_patterns)]
3000    pub fn into_reset(self) -> Option<(CompositeResetResponder)> {
3001        if let CompositeRequest::Reset { responder } = self { Some((responder)) } else { None }
3002    }
3003
3004    #[allow(irrefutable_let_patterns)]
3005    pub fn into_get_properties(self) -> Option<(CompositeGetPropertiesResponder)> {
3006        if let CompositeRequest::GetProperties { responder } = self {
3007            Some((responder))
3008        } else {
3009            None
3010        }
3011    }
3012
3013    #[allow(irrefutable_let_patterns)]
3014    pub fn into_get_ring_buffer_formats(
3015        self,
3016    ) -> Option<(u64, CompositeGetRingBufferFormatsResponder)> {
3017        if let CompositeRequest::GetRingBufferFormats { processing_element_id, responder } = self {
3018            Some((processing_element_id, responder))
3019        } else {
3020            None
3021        }
3022    }
3023
3024    #[allow(irrefutable_let_patterns)]
3025    pub fn into_create_ring_buffer(
3026        self,
3027    ) -> Option<(
3028        u64,
3029        Format2,
3030        fdomain_client::fidl::ServerEnd<RingBufferMarker>,
3031        CompositeCreateRingBufferResponder,
3032    )> {
3033        if let CompositeRequest::CreateRingBuffer {
3034            processing_element_id,
3035            format,
3036            ring_buffer,
3037            responder,
3038        } = self
3039        {
3040            Some((processing_element_id, format, ring_buffer, responder))
3041        } else {
3042            None
3043        }
3044    }
3045
3046    #[allow(irrefutable_let_patterns)]
3047    pub fn into_get_dai_formats(self) -> Option<(u64, CompositeGetDaiFormatsResponder)> {
3048        if let CompositeRequest::GetDaiFormats { processing_element_id, responder } = self {
3049            Some((processing_element_id, responder))
3050        } else {
3051            None
3052        }
3053    }
3054
3055    #[allow(irrefutable_let_patterns)]
3056    pub fn into_set_dai_format(self) -> Option<(u64, DaiFormat, CompositeSetDaiFormatResponder)> {
3057        if let CompositeRequest::SetDaiFormat { processing_element_id, format, responder } = self {
3058            Some((processing_element_id, format, responder))
3059        } else {
3060            None
3061        }
3062    }
3063
3064    #[allow(irrefutable_let_patterns)]
3065    pub fn into_get_packet_stream_formats(
3066        self,
3067    ) -> Option<(u64, CompositeGetPacketStreamFormatsResponder)> {
3068        if let CompositeRequest::GetPacketStreamFormats { processing_element_id, responder } = self
3069        {
3070            Some((processing_element_id, responder))
3071        } else {
3072            None
3073        }
3074    }
3075
3076    #[allow(irrefutable_let_patterns)]
3077    pub fn into_create_packet_stream(
3078        self,
3079    ) -> Option<(
3080        u64,
3081        Format2,
3082        fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
3083        CompositeCreatePacketStreamResponder,
3084    )> {
3085        if let CompositeRequest::CreatePacketStream {
3086            processing_element_id,
3087            format,
3088            packet_stream_control,
3089            responder,
3090        } = self
3091        {
3092            Some((processing_element_id, format, packet_stream_control, responder))
3093        } else {
3094            None
3095        }
3096    }
3097
3098    /// Name of the method defined in FIDL
3099    pub fn method_name(&self) -> &'static str {
3100        match *self {
3101            CompositeRequest::GetHealthState { .. } => "get_health_state",
3102            CompositeRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
3103            CompositeRequest::Reset { .. } => "reset",
3104            CompositeRequest::GetProperties { .. } => "get_properties",
3105            CompositeRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
3106            CompositeRequest::CreateRingBuffer { .. } => "create_ring_buffer",
3107            CompositeRequest::GetDaiFormats { .. } => "get_dai_formats",
3108            CompositeRequest::SetDaiFormat { .. } => "set_dai_format",
3109            CompositeRequest::GetPacketStreamFormats { .. } => "get_packet_stream_formats",
3110            CompositeRequest::CreatePacketStream { .. } => "create_packet_stream",
3111            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3112                "unknown one-way method"
3113            }
3114            CompositeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3115                "unknown two-way method"
3116            }
3117        }
3118    }
3119}
3120
3121#[derive(Debug, Clone)]
3122pub struct CompositeControlHandle {
3123    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3124}
3125
3126impl CompositeControlHandle {
3127    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3128        self.inner.shutdown_with_epitaph(status.into())
3129    }
3130}
3131
3132impl fdomain_client::fidl::ControlHandle for CompositeControlHandle {
3133    fn shutdown(&self) {
3134        self.inner.shutdown()
3135    }
3136
3137    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3138        self.inner.shutdown_with_epitaph(status)
3139    }
3140
3141    fn is_closed(&self) -> bool {
3142        self.inner.channel().is_closed()
3143    }
3144    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
3145        self.inner.channel().on_closed()
3146    }
3147}
3148
3149impl CompositeControlHandle {}
3150
3151#[must_use = "FIDL methods require a response to be sent"]
3152#[derive(Debug)]
3153pub struct CompositeGetHealthStateResponder {
3154    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3155    tx_id: u32,
3156}
3157
3158/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3159/// if the responder is dropped without sending a response, so that the client
3160/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3161impl std::ops::Drop for CompositeGetHealthStateResponder {
3162    fn drop(&mut self) {
3163        self.control_handle.shutdown();
3164        // Safety: drops once, never accessed again
3165        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3166    }
3167}
3168
3169impl fdomain_client::fidl::Responder for CompositeGetHealthStateResponder {
3170    type ControlHandle = CompositeControlHandle;
3171
3172    fn control_handle(&self) -> &CompositeControlHandle {
3173        &self.control_handle
3174    }
3175
3176    fn drop_without_shutdown(mut self) {
3177        // Safety: drops once, never accessed again due to mem::forget
3178        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3179        // Prevent Drop from running (which would shut down the channel)
3180        std::mem::forget(self);
3181    }
3182}
3183
3184impl CompositeGetHealthStateResponder {
3185    /// Sends a response to the FIDL transaction.
3186    ///
3187    /// Sets the channel to shutdown if an error occurs.
3188    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3189        let _result = self.send_raw(state);
3190        if _result.is_err() {
3191            self.control_handle.shutdown();
3192        }
3193        self.drop_without_shutdown();
3194        _result
3195    }
3196
3197    /// Similar to "send" but does not shutdown the channel if an error occurs.
3198    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3199        let _result = self.send_raw(state);
3200        self.drop_without_shutdown();
3201        _result
3202    }
3203
3204    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
3205        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
3206            (state,),
3207            self.tx_id,
3208            0x4e146d6bca733a84,
3209            fidl::encoding::DynamicFlags::empty(),
3210        )
3211    }
3212}
3213
3214#[must_use = "FIDL methods require a response to be sent"]
3215#[derive(Debug)]
3216pub struct CompositeResetResponder {
3217    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3218    tx_id: u32,
3219}
3220
3221/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3222/// if the responder is dropped without sending a response, so that the client
3223/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3224impl std::ops::Drop for CompositeResetResponder {
3225    fn drop(&mut self) {
3226        self.control_handle.shutdown();
3227        // Safety: drops once, never accessed again
3228        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3229    }
3230}
3231
3232impl fdomain_client::fidl::Responder for CompositeResetResponder {
3233    type ControlHandle = CompositeControlHandle;
3234
3235    fn control_handle(&self) -> &CompositeControlHandle {
3236        &self.control_handle
3237    }
3238
3239    fn drop_without_shutdown(mut self) {
3240        // Safety: drops once, never accessed again due to mem::forget
3241        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3242        // Prevent Drop from running (which would shut down the channel)
3243        std::mem::forget(self);
3244    }
3245}
3246
3247impl CompositeResetResponder {
3248    /// Sends a response to the FIDL transaction.
3249    ///
3250    /// Sets the channel to shutdown if an error occurs.
3251    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3252        let _result = self.send_raw(result);
3253        if _result.is_err() {
3254            self.control_handle.shutdown();
3255        }
3256        self.drop_without_shutdown();
3257        _result
3258    }
3259
3260    /// Similar to "send" but does not shutdown the channel if an error occurs.
3261    pub fn send_no_shutdown_on_err(
3262        self,
3263        mut result: Result<(), DriverError>,
3264    ) -> Result<(), fidl::Error> {
3265        let _result = self.send_raw(result);
3266        self.drop_without_shutdown();
3267        _result
3268    }
3269
3270    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3271        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3272            fidl::encoding::EmptyStruct,
3273            DriverError,
3274        >>(
3275            fidl::encoding::FlexibleResult::new(result),
3276            self.tx_id,
3277            0xac355fb98341996,
3278            fidl::encoding::DynamicFlags::FLEXIBLE,
3279        )
3280    }
3281}
3282
3283#[must_use = "FIDL methods require a response to be sent"]
3284#[derive(Debug)]
3285pub struct CompositeGetPropertiesResponder {
3286    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3287    tx_id: u32,
3288}
3289
3290/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3291/// if the responder is dropped without sending a response, so that the client
3292/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3293impl std::ops::Drop for CompositeGetPropertiesResponder {
3294    fn drop(&mut self) {
3295        self.control_handle.shutdown();
3296        // Safety: drops once, never accessed again
3297        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3298    }
3299}
3300
3301impl fdomain_client::fidl::Responder for CompositeGetPropertiesResponder {
3302    type ControlHandle = CompositeControlHandle;
3303
3304    fn control_handle(&self) -> &CompositeControlHandle {
3305        &self.control_handle
3306    }
3307
3308    fn drop_without_shutdown(mut self) {
3309        // Safety: drops once, never accessed again due to mem::forget
3310        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3311        // Prevent Drop from running (which would shut down the channel)
3312        std::mem::forget(self);
3313    }
3314}
3315
3316impl CompositeGetPropertiesResponder {
3317    /// Sends a response to the FIDL transaction.
3318    ///
3319    /// Sets the channel to shutdown if an error occurs.
3320    pub fn send(self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3321        let _result = self.send_raw(properties);
3322        if _result.is_err() {
3323            self.control_handle.shutdown();
3324        }
3325        self.drop_without_shutdown();
3326        _result
3327    }
3328
3329    /// Similar to "send" but does not shutdown the channel if an error occurs.
3330    pub fn send_no_shutdown_on_err(
3331        self,
3332        mut properties: &CompositeProperties,
3333    ) -> Result<(), fidl::Error> {
3334        let _result = self.send_raw(properties);
3335        self.drop_without_shutdown();
3336        _result
3337    }
3338
3339    fn send_raw(&self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3340        self.control_handle
3341            .inner
3342            .send::<fidl::encoding::FlexibleType<CompositeGetPropertiesResponse>>(
3343                fidl::encoding::Flexible::new((properties,)),
3344                self.tx_id,
3345                0x31846fa0a459942b,
3346                fidl::encoding::DynamicFlags::FLEXIBLE,
3347            )
3348    }
3349}
3350
3351#[must_use = "FIDL methods require a response to be sent"]
3352#[derive(Debug)]
3353pub struct CompositeGetRingBufferFormatsResponder {
3354    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3355    tx_id: u32,
3356}
3357
3358/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3359/// if the responder is dropped without sending a response, so that the client
3360/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3361impl std::ops::Drop for CompositeGetRingBufferFormatsResponder {
3362    fn drop(&mut self) {
3363        self.control_handle.shutdown();
3364        // Safety: drops once, never accessed again
3365        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3366    }
3367}
3368
3369impl fdomain_client::fidl::Responder for CompositeGetRingBufferFormatsResponder {
3370    type ControlHandle = CompositeControlHandle;
3371
3372    fn control_handle(&self) -> &CompositeControlHandle {
3373        &self.control_handle
3374    }
3375
3376    fn drop_without_shutdown(mut self) {
3377        // Safety: drops once, never accessed again due to mem::forget
3378        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3379        // Prevent Drop from running (which would shut down the channel)
3380        std::mem::forget(self);
3381    }
3382}
3383
3384impl CompositeGetRingBufferFormatsResponder {
3385    /// Sends a response to the FIDL transaction.
3386    ///
3387    /// Sets the channel to shutdown if an error occurs.
3388    pub fn send(
3389        self,
3390        mut result: Result<&[SupportedFormats2], DriverError>,
3391    ) -> Result<(), fidl::Error> {
3392        let _result = self.send_raw(result);
3393        if _result.is_err() {
3394            self.control_handle.shutdown();
3395        }
3396        self.drop_without_shutdown();
3397        _result
3398    }
3399
3400    /// Similar to "send" but does not shutdown the channel if an error occurs.
3401    pub fn send_no_shutdown_on_err(
3402        self,
3403        mut result: Result<&[SupportedFormats2], DriverError>,
3404    ) -> Result<(), fidl::Error> {
3405        let _result = self.send_raw(result);
3406        self.drop_without_shutdown();
3407        _result
3408    }
3409
3410    fn send_raw(
3411        &self,
3412        mut result: Result<&[SupportedFormats2], DriverError>,
3413    ) -> Result<(), fidl::Error> {
3414        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3415            CompositeGetRingBufferFormatsResponse,
3416            DriverError,
3417        >>(
3418            fidl::encoding::FlexibleResult::new(
3419                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
3420            ),
3421            self.tx_id,
3422            0x1d89b701b6816ac4,
3423            fidl::encoding::DynamicFlags::FLEXIBLE,
3424        )
3425    }
3426}
3427
3428#[must_use = "FIDL methods require a response to be sent"]
3429#[derive(Debug)]
3430pub struct CompositeCreateRingBufferResponder {
3431    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3432    tx_id: u32,
3433}
3434
3435/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3436/// if the responder is dropped without sending a response, so that the client
3437/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3438impl std::ops::Drop for CompositeCreateRingBufferResponder {
3439    fn drop(&mut self) {
3440        self.control_handle.shutdown();
3441        // Safety: drops once, never accessed again
3442        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3443    }
3444}
3445
3446impl fdomain_client::fidl::Responder for CompositeCreateRingBufferResponder {
3447    type ControlHandle = CompositeControlHandle;
3448
3449    fn control_handle(&self) -> &CompositeControlHandle {
3450        &self.control_handle
3451    }
3452
3453    fn drop_without_shutdown(mut self) {
3454        // Safety: drops once, never accessed again due to mem::forget
3455        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3456        // Prevent Drop from running (which would shut down the channel)
3457        std::mem::forget(self);
3458    }
3459}
3460
3461impl CompositeCreateRingBufferResponder {
3462    /// Sends a response to the FIDL transaction.
3463    ///
3464    /// Sets the channel to shutdown if an error occurs.
3465    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3466        let _result = self.send_raw(result);
3467        if _result.is_err() {
3468            self.control_handle.shutdown();
3469        }
3470        self.drop_without_shutdown();
3471        _result
3472    }
3473
3474    /// Similar to "send" but does not shutdown the channel if an error occurs.
3475    pub fn send_no_shutdown_on_err(
3476        self,
3477        mut result: Result<(), DriverError>,
3478    ) -> Result<(), fidl::Error> {
3479        let _result = self.send_raw(result);
3480        self.drop_without_shutdown();
3481        _result
3482    }
3483
3484    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3485        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3486            fidl::encoding::EmptyStruct,
3487            DriverError,
3488        >>(
3489            fidl::encoding::FlexibleResult::new(result),
3490            self.tx_id,
3491            0x28c5685f85262033,
3492            fidl::encoding::DynamicFlags::FLEXIBLE,
3493        )
3494    }
3495}
3496
3497#[must_use = "FIDL methods require a response to be sent"]
3498#[derive(Debug)]
3499pub struct CompositeGetDaiFormatsResponder {
3500    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3501    tx_id: u32,
3502}
3503
3504/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3505/// if the responder is dropped without sending a response, so that the client
3506/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3507impl std::ops::Drop for CompositeGetDaiFormatsResponder {
3508    fn drop(&mut self) {
3509        self.control_handle.shutdown();
3510        // Safety: drops once, never accessed again
3511        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3512    }
3513}
3514
3515impl fdomain_client::fidl::Responder for CompositeGetDaiFormatsResponder {
3516    type ControlHandle = CompositeControlHandle;
3517
3518    fn control_handle(&self) -> &CompositeControlHandle {
3519        &self.control_handle
3520    }
3521
3522    fn drop_without_shutdown(mut self) {
3523        // Safety: drops once, never accessed again due to mem::forget
3524        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3525        // Prevent Drop from running (which would shut down the channel)
3526        std::mem::forget(self);
3527    }
3528}
3529
3530impl CompositeGetDaiFormatsResponder {
3531    /// Sends a response to the FIDL transaction.
3532    ///
3533    /// Sets the channel to shutdown if an error occurs.
3534    pub fn send(
3535        self,
3536        mut result: Result<&[DaiSupportedFormats], DriverError>,
3537    ) -> Result<(), fidl::Error> {
3538        let _result = self.send_raw(result);
3539        if _result.is_err() {
3540            self.control_handle.shutdown();
3541        }
3542        self.drop_without_shutdown();
3543        _result
3544    }
3545
3546    /// Similar to "send" but does not shutdown the channel if an error occurs.
3547    pub fn send_no_shutdown_on_err(
3548        self,
3549        mut result: Result<&[DaiSupportedFormats], DriverError>,
3550    ) -> Result<(), fidl::Error> {
3551        let _result = self.send_raw(result);
3552        self.drop_without_shutdown();
3553        _result
3554    }
3555
3556    fn send_raw(
3557        &self,
3558        mut result: Result<&[DaiSupportedFormats], DriverError>,
3559    ) -> Result<(), fidl::Error> {
3560        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3561            CompositeGetDaiFormatsResponse,
3562            DriverError,
3563        >>(
3564            fidl::encoding::FlexibleResult::new(result.map(|dai_formats| (dai_formats,))),
3565            self.tx_id,
3566            0x3cbeaed59c8f69b,
3567            fidl::encoding::DynamicFlags::FLEXIBLE,
3568        )
3569    }
3570}
3571
3572#[must_use = "FIDL methods require a response to be sent"]
3573#[derive(Debug)]
3574pub struct CompositeSetDaiFormatResponder {
3575    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3576    tx_id: u32,
3577}
3578
3579/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3580/// if the responder is dropped without sending a response, so that the client
3581/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3582impl std::ops::Drop for CompositeSetDaiFormatResponder {
3583    fn drop(&mut self) {
3584        self.control_handle.shutdown();
3585        // Safety: drops once, never accessed again
3586        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3587    }
3588}
3589
3590impl fdomain_client::fidl::Responder for CompositeSetDaiFormatResponder {
3591    type ControlHandle = CompositeControlHandle;
3592
3593    fn control_handle(&self) -> &CompositeControlHandle {
3594        &self.control_handle
3595    }
3596
3597    fn drop_without_shutdown(mut self) {
3598        // Safety: drops once, never accessed again due to mem::forget
3599        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3600        // Prevent Drop from running (which would shut down the channel)
3601        std::mem::forget(self);
3602    }
3603}
3604
3605impl CompositeSetDaiFormatResponder {
3606    /// Sends a response to the FIDL transaction.
3607    ///
3608    /// Sets the channel to shutdown if an error occurs.
3609    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3610        let _result = self.send_raw(result);
3611        if _result.is_err() {
3612            self.control_handle.shutdown();
3613        }
3614        self.drop_without_shutdown();
3615        _result
3616    }
3617
3618    /// Similar to "send" but does not shutdown the channel if an error occurs.
3619    pub fn send_no_shutdown_on_err(
3620        self,
3621        mut result: Result<(), DriverError>,
3622    ) -> Result<(), fidl::Error> {
3623        let _result = self.send_raw(result);
3624        self.drop_without_shutdown();
3625        _result
3626    }
3627
3628    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3629        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3630            fidl::encoding::EmptyStruct,
3631            DriverError,
3632        >>(
3633            fidl::encoding::FlexibleResult::new(result),
3634            self.tx_id,
3635            0x155acf5cc0dc8a84,
3636            fidl::encoding::DynamicFlags::FLEXIBLE,
3637        )
3638    }
3639}
3640
3641#[must_use = "FIDL methods require a response to be sent"]
3642#[derive(Debug)]
3643pub struct CompositeGetPacketStreamFormatsResponder {
3644    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3645    tx_id: u32,
3646}
3647
3648/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3649/// if the responder is dropped without sending a response, so that the client
3650/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3651impl std::ops::Drop for CompositeGetPacketStreamFormatsResponder {
3652    fn drop(&mut self) {
3653        self.control_handle.shutdown();
3654        // Safety: drops once, never accessed again
3655        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3656    }
3657}
3658
3659impl fdomain_client::fidl::Responder for CompositeGetPacketStreamFormatsResponder {
3660    type ControlHandle = CompositeControlHandle;
3661
3662    fn control_handle(&self) -> &CompositeControlHandle {
3663        &self.control_handle
3664    }
3665
3666    fn drop_without_shutdown(mut self) {
3667        // Safety: drops once, never accessed again due to mem::forget
3668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3669        // Prevent Drop from running (which would shut down the channel)
3670        std::mem::forget(self);
3671    }
3672}
3673
3674impl CompositeGetPacketStreamFormatsResponder {
3675    /// Sends a response to the FIDL transaction.
3676    ///
3677    /// Sets the channel to shutdown if an error occurs.
3678    pub fn send(
3679        self,
3680        mut result: Result<&[SupportedFormats2], DriverError>,
3681    ) -> Result<(), fidl::Error> {
3682        let _result = self.send_raw(result);
3683        if _result.is_err() {
3684            self.control_handle.shutdown();
3685        }
3686        self.drop_without_shutdown();
3687        _result
3688    }
3689
3690    /// Similar to "send" but does not shutdown the channel if an error occurs.
3691    pub fn send_no_shutdown_on_err(
3692        self,
3693        mut result: Result<&[SupportedFormats2], DriverError>,
3694    ) -> Result<(), fidl::Error> {
3695        let _result = self.send_raw(result);
3696        self.drop_without_shutdown();
3697        _result
3698    }
3699
3700    fn send_raw(
3701        &self,
3702        mut result: Result<&[SupportedFormats2], DriverError>,
3703    ) -> Result<(), fidl::Error> {
3704        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3705            CompositeGetPacketStreamFormatsResponse,
3706            DriverError,
3707        >>(
3708            fidl::encoding::FlexibleResult::new(
3709                result.map(|packet_stream_formats| (packet_stream_formats,)),
3710            ),
3711            self.tx_id,
3712            0x73cc47c6ad39bca7,
3713            fidl::encoding::DynamicFlags::FLEXIBLE,
3714        )
3715    }
3716}
3717
3718#[must_use = "FIDL methods require a response to be sent"]
3719#[derive(Debug)]
3720pub struct CompositeCreatePacketStreamResponder {
3721    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3722    tx_id: u32,
3723}
3724
3725/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3726/// if the responder is dropped without sending a response, so that the client
3727/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3728impl std::ops::Drop for CompositeCreatePacketStreamResponder {
3729    fn drop(&mut self) {
3730        self.control_handle.shutdown();
3731        // Safety: drops once, never accessed again
3732        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3733    }
3734}
3735
3736impl fdomain_client::fidl::Responder for CompositeCreatePacketStreamResponder {
3737    type ControlHandle = CompositeControlHandle;
3738
3739    fn control_handle(&self) -> &CompositeControlHandle {
3740        &self.control_handle
3741    }
3742
3743    fn drop_without_shutdown(mut self) {
3744        // Safety: drops once, never accessed again due to mem::forget
3745        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3746        // Prevent Drop from running (which would shut down the channel)
3747        std::mem::forget(self);
3748    }
3749}
3750
3751impl CompositeCreatePacketStreamResponder {
3752    /// Sends a response to the FIDL transaction.
3753    ///
3754    /// Sets the channel to shutdown if an error occurs.
3755    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3756        let _result = self.send_raw(result);
3757        if _result.is_err() {
3758            self.control_handle.shutdown();
3759        }
3760        self.drop_without_shutdown();
3761        _result
3762    }
3763
3764    /// Similar to "send" but does not shutdown the channel if an error occurs.
3765    pub fn send_no_shutdown_on_err(
3766        self,
3767        mut result: Result<(), DriverError>,
3768    ) -> Result<(), fidl::Error> {
3769        let _result = self.send_raw(result);
3770        self.drop_without_shutdown();
3771        _result
3772    }
3773
3774    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3775        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3776            fidl::encoding::EmptyStruct,
3777            DriverError,
3778        >>(
3779            fidl::encoding::FlexibleResult::new(result),
3780            self.tx_id,
3781            0x50e8902b756c707c,
3782            fidl::encoding::DynamicFlags::FLEXIBLE,
3783        )
3784    }
3785}
3786
3787#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3788pub struct CompositeConnectorMarker;
3789
3790impl fdomain_client::fidl::ProtocolMarker for CompositeConnectorMarker {
3791    type Proxy = CompositeConnectorProxy;
3792    type RequestStream = CompositeConnectorRequestStream;
3793
3794    const DEBUG_NAME: &'static str = "(anonymous) CompositeConnector";
3795}
3796
3797pub trait CompositeConnectorProxyInterface: Send + Sync {
3798    fn r#connect(
3799        &self,
3800        composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
3801    ) -> Result<(), fidl::Error>;
3802}
3803
3804#[derive(Debug, Clone)]
3805pub struct CompositeConnectorProxy {
3806    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
3807}
3808
3809impl fdomain_client::fidl::Proxy for CompositeConnectorProxy {
3810    type Protocol = CompositeConnectorMarker;
3811
3812    fn from_channel(inner: fdomain_client::Channel) -> Self {
3813        Self::new(inner)
3814    }
3815
3816    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
3817        self.client.into_channel().map_err(|client| Self { client })
3818    }
3819
3820    fn as_channel(&self) -> &fdomain_client::Channel {
3821        self.client.as_channel()
3822    }
3823}
3824
3825impl CompositeConnectorProxy {
3826    /// Create a new Proxy for fuchsia.hardware.audio/CompositeConnector.
3827    pub fn new(channel: fdomain_client::Channel) -> Self {
3828        let protocol_name =
3829            <CompositeConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
3830        Self { client: fidl::client::Client::new(channel, protocol_name) }
3831    }
3832
3833    /// Get a Stream of events from the remote end of the protocol.
3834    ///
3835    /// # Panics
3836    ///
3837    /// Panics if the event stream was already taken.
3838    pub fn take_event_stream(&self) -> CompositeConnectorEventStream {
3839        CompositeConnectorEventStream { event_receiver: self.client.take_event_receiver() }
3840    }
3841
3842    /// Connect to a `Composite` protocol.
3843    /// This method allows a component to serve FIDL outside the devhost's control.
3844    pub fn r#connect(
3845        &self,
3846        mut composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
3847    ) -> Result<(), fidl::Error> {
3848        CompositeConnectorProxyInterface::r#connect(self, composite_protocol)
3849    }
3850}
3851
3852impl CompositeConnectorProxyInterface for CompositeConnectorProxy {
3853    fn r#connect(
3854        &self,
3855        mut composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
3856    ) -> Result<(), fidl::Error> {
3857        self.client.send::<CompositeConnectorConnectRequest>(
3858            (composite_protocol,),
3859            0x7ee557529079e466,
3860            fidl::encoding::DynamicFlags::empty(),
3861        )
3862    }
3863}
3864
3865pub struct CompositeConnectorEventStream {
3866    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
3867}
3868
3869impl std::marker::Unpin for CompositeConnectorEventStream {}
3870
3871impl futures::stream::FusedStream for CompositeConnectorEventStream {
3872    fn is_terminated(&self) -> bool {
3873        self.event_receiver.is_terminated()
3874    }
3875}
3876
3877impl futures::Stream for CompositeConnectorEventStream {
3878    type Item = Result<CompositeConnectorEvent, fidl::Error>;
3879
3880    fn poll_next(
3881        mut self: std::pin::Pin<&mut Self>,
3882        cx: &mut std::task::Context<'_>,
3883    ) -> std::task::Poll<Option<Self::Item>> {
3884        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3885            &mut self.event_receiver,
3886            cx
3887        )?) {
3888            Some(buf) => std::task::Poll::Ready(Some(CompositeConnectorEvent::decode(buf))),
3889            None => std::task::Poll::Ready(None),
3890        }
3891    }
3892}
3893
3894#[derive(Debug)]
3895pub enum CompositeConnectorEvent {}
3896
3897impl CompositeConnectorEvent {
3898    /// Decodes a message buffer as a [`CompositeConnectorEvent`].
3899    fn decode(
3900        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3901    ) -> Result<CompositeConnectorEvent, fidl::Error> {
3902        let (bytes, _handles) = buf.split_mut();
3903        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3904        debug_assert_eq!(tx_header.tx_id, 0);
3905        match tx_header.ordinal {
3906            _ => Err(fidl::Error::UnknownOrdinal {
3907                ordinal: tx_header.ordinal,
3908                protocol_name:
3909                    <CompositeConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3910            }),
3911        }
3912    }
3913}
3914
3915/// A Stream of incoming requests for fuchsia.hardware.audio/CompositeConnector.
3916pub struct CompositeConnectorRequestStream {
3917    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3918    is_terminated: bool,
3919}
3920
3921impl std::marker::Unpin for CompositeConnectorRequestStream {}
3922
3923impl futures::stream::FusedStream for CompositeConnectorRequestStream {
3924    fn is_terminated(&self) -> bool {
3925        self.is_terminated
3926    }
3927}
3928
3929impl fdomain_client::fidl::RequestStream for CompositeConnectorRequestStream {
3930    type Protocol = CompositeConnectorMarker;
3931    type ControlHandle = CompositeConnectorControlHandle;
3932
3933    fn from_channel(channel: fdomain_client::Channel) -> Self {
3934        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3935    }
3936
3937    fn control_handle(&self) -> Self::ControlHandle {
3938        CompositeConnectorControlHandle { inner: self.inner.clone() }
3939    }
3940
3941    fn into_inner(
3942        self,
3943    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
3944    {
3945        (self.inner, self.is_terminated)
3946    }
3947
3948    fn from_inner(
3949        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3950        is_terminated: bool,
3951    ) -> Self {
3952        Self { inner, is_terminated }
3953    }
3954}
3955
3956impl futures::Stream for CompositeConnectorRequestStream {
3957    type Item = Result<CompositeConnectorRequest, fidl::Error>;
3958
3959    fn poll_next(
3960        mut self: std::pin::Pin<&mut Self>,
3961        cx: &mut std::task::Context<'_>,
3962    ) -> std::task::Poll<Option<Self::Item>> {
3963        let this = &mut *self;
3964        if this.inner.check_shutdown(cx) {
3965            this.is_terminated = true;
3966            return std::task::Poll::Ready(None);
3967        }
3968        if this.is_terminated {
3969            panic!("polled CompositeConnectorRequestStream after completion");
3970        }
3971        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
3972            |bytes, handles| {
3973                match this.inner.channel().read_etc(cx, bytes, handles) {
3974                    std::task::Poll::Ready(Ok(())) => {}
3975                    std::task::Poll::Pending => return std::task::Poll::Pending,
3976                    std::task::Poll::Ready(Err(None)) => {
3977                        this.is_terminated = true;
3978                        return std::task::Poll::Ready(None);
3979                    }
3980                    std::task::Poll::Ready(Err(Some(e))) => {
3981                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3982                            e.into(),
3983                        ))));
3984                    }
3985                }
3986
3987                // A message has been received from the channel
3988                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3989
3990                std::task::Poll::Ready(Some(match header.ordinal {
3991                0x7ee557529079e466 => {
3992                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3993                    let mut req = fidl::new_empty!(CompositeConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
3994                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CompositeConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3995                    let control_handle = CompositeConnectorControlHandle {
3996                        inner: this.inner.clone(),
3997                    };
3998                    Ok(CompositeConnectorRequest::Connect {composite_protocol: req.composite_protocol,
3999
4000                        control_handle,
4001                    })
4002                }
4003                _ => Err(fidl::Error::UnknownOrdinal {
4004                    ordinal: header.ordinal,
4005                    protocol_name: <CompositeConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4006                }),
4007            }))
4008            },
4009        )
4010    }
4011}
4012
4013/// For an overview see
4014/// [Audio Composite Devices](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md).
4015#[derive(Debug)]
4016pub enum CompositeConnectorRequest {
4017    /// Connect to a `Composite` protocol.
4018    /// This method allows a component to serve FIDL outside the devhost's control.
4019    Connect {
4020        composite_protocol: fdomain_client::fidl::ServerEnd<CompositeMarker>,
4021        control_handle: CompositeConnectorControlHandle,
4022    },
4023}
4024
4025impl CompositeConnectorRequest {
4026    #[allow(irrefutable_let_patterns)]
4027    pub fn into_connect(
4028        self,
4029    ) -> Option<(fdomain_client::fidl::ServerEnd<CompositeMarker>, CompositeConnectorControlHandle)>
4030    {
4031        if let CompositeConnectorRequest::Connect { composite_protocol, control_handle } = self {
4032            Some((composite_protocol, control_handle))
4033        } else {
4034            None
4035        }
4036    }
4037
4038    /// Name of the method defined in FIDL
4039    pub fn method_name(&self) -> &'static str {
4040        match *self {
4041            CompositeConnectorRequest::Connect { .. } => "connect",
4042        }
4043    }
4044}
4045
4046#[derive(Debug, Clone)]
4047pub struct CompositeConnectorControlHandle {
4048    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4049}
4050
4051impl CompositeConnectorControlHandle {
4052    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4053        self.inner.shutdown_with_epitaph(status.into())
4054    }
4055}
4056
4057impl fdomain_client::fidl::ControlHandle for CompositeConnectorControlHandle {
4058    fn shutdown(&self) {
4059        self.inner.shutdown()
4060    }
4061
4062    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4063        self.inner.shutdown_with_epitaph(status)
4064    }
4065
4066    fn is_closed(&self) -> bool {
4067        self.inner.channel().is_closed()
4068    }
4069    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
4070        self.inner.channel().on_closed()
4071    }
4072}
4073
4074impl CompositeConnectorControlHandle {}
4075
4076#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4077pub struct DaiMarker;
4078
4079impl fdomain_client::fidl::ProtocolMarker for DaiMarker {
4080    type Proxy = DaiProxy;
4081    type RequestStream = DaiRequestStream;
4082
4083    const DEBUG_NAME: &'static str = "(anonymous) Dai";
4084}
4085pub type DaiGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
4086pub type DaiGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, i32>;
4087
4088pub trait DaiProxyInterface: Send + Sync {
4089    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
4090        + Send;
4091    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
4092    fn r#signal_processing_connect(
4093        &self,
4094        protocol: fdomain_client::fidl::ServerEnd<
4095            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4096        >,
4097    ) -> Result<(), fidl::Error>;
4098    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4099    fn r#reset(&self) -> Self::ResetResponseFut;
4100    type GetPropertiesResponseFut: std::future::Future<Output = Result<DaiProperties, fidl::Error>>
4101        + Send;
4102    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
4103    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<DaiGetDaiFormatsResult, fidl::Error>>
4104        + Send;
4105    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
4106    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<DaiGetRingBufferFormatsResult, fidl::Error>>
4107        + Send;
4108    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut;
4109    fn r#create_ring_buffer(
4110        &self,
4111        dai_format: &DaiFormat,
4112        ring_buffer_format: &Format,
4113        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4114    ) -> Result<(), fidl::Error>;
4115}
4116
4117#[derive(Debug, Clone)]
4118pub struct DaiProxy {
4119    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
4120}
4121
4122impl fdomain_client::fidl::Proxy for DaiProxy {
4123    type Protocol = DaiMarker;
4124
4125    fn from_channel(inner: fdomain_client::Channel) -> Self {
4126        Self::new(inner)
4127    }
4128
4129    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
4130        self.client.into_channel().map_err(|client| Self { client })
4131    }
4132
4133    fn as_channel(&self) -> &fdomain_client::Channel {
4134        self.client.as_channel()
4135    }
4136}
4137
4138impl DaiProxy {
4139    /// Create a new Proxy for fuchsia.hardware.audio/Dai.
4140    pub fn new(channel: fdomain_client::Channel) -> Self {
4141        let protocol_name = <DaiMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
4142        Self { client: fidl::client::Client::new(channel, protocol_name) }
4143    }
4144
4145    /// Get a Stream of events from the remote end of the protocol.
4146    ///
4147    /// # Panics
4148    ///
4149    /// Panics if the event stream was already taken.
4150    pub fn take_event_stream(&self) -> DaiEventStream {
4151        DaiEventStream { event_receiver: self.client.take_event_receiver() }
4152    }
4153
4154    /// Retrieves top level health state.
4155    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4156    pub fn r#get_health_state(
4157        &self,
4158    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
4159    {
4160        DaiProxyInterface::r#get_health_state(self)
4161    }
4162
4163    /// Connect to a `SignalProcessing` protocol.
4164    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4165    /// the maximum number of connections have already been created, for instance one, then the
4166    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4167    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4168    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4169    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4170    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4171    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4172    /// is intended to be composed, and hence the more verbose name allows differentiation and
4173    /// improved clarity.
4174    pub fn r#signal_processing_connect(
4175        &self,
4176        mut protocol: fdomain_client::fidl::ServerEnd<
4177            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4178        >,
4179    ) -> Result<(), fidl::Error> {
4180        DaiProxyInterface::r#signal_processing_connect(self, protocol)
4181    }
4182
4183    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4184    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4185    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4186    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4187    /// protocol channel and retry.
4188    pub fn r#reset(
4189        &self,
4190    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
4191        DaiProxyInterface::r#reset(self)
4192    }
4193
4194    /// Retrieves top level static properties.
4195    pub fn r#get_properties(
4196        &self,
4197    ) -> fidl::client::QueryResponseFut<DaiProperties, fdomain_client::fidl::FDomainResourceDialect>
4198    {
4199        DaiProxyInterface::r#get_properties(self)
4200    }
4201
4202    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4203    /// may reply with an error status and the client may retry at a later time.
4204    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4205    /// the parameters in SupportedFormats may be supported.
4206    pub fn r#get_dai_formats(
4207        &self,
4208    ) -> fidl::client::QueryResponseFut<
4209        DaiGetDaiFormatsResult,
4210        fdomain_client::fidl::FDomainResourceDialect,
4211    > {
4212        DaiProxyInterface::r#get_dai_formats(self)
4213    }
4214
4215    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4216    /// may reply with an error status and the client may retry at a later time.
4217    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4218    /// the parameters in `SupportedFormats` may be supported.
4219    pub fn r#get_ring_buffer_formats(
4220        &self,
4221    ) -> fidl::client::QueryResponseFut<
4222        DaiGetRingBufferFormatsResult,
4223        fdomain_client::fidl::FDomainResourceDialect,
4224    > {
4225        DaiProxyInterface::r#get_ring_buffer_formats(self)
4226    }
4227
4228    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4229    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4230    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4231    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4232    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4233    /// gracefully quiesce any on-going streaming operations in the process.
4234    pub fn r#create_ring_buffer(
4235        &self,
4236        mut dai_format: &DaiFormat,
4237        mut ring_buffer_format: &Format,
4238        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4239    ) -> Result<(), fidl::Error> {
4240        DaiProxyInterface::r#create_ring_buffer(self, dai_format, ring_buffer_format, ring_buffer)
4241    }
4242}
4243
4244impl DaiProxyInterface for DaiProxy {
4245    type GetHealthStateResponseFut =
4246        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
4247    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
4248        fn _decode(
4249            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4250        ) -> Result<HealthState, fidl::Error> {
4251            let _response = fidl::client::decode_transaction_body::<
4252                HealthGetHealthStateResponse,
4253                fdomain_client::fidl::FDomainResourceDialect,
4254                0x4e146d6bca733a84,
4255            >(_buf?)?;
4256            Ok(_response.state)
4257        }
4258        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
4259            (),
4260            0x4e146d6bca733a84,
4261            fidl::encoding::DynamicFlags::empty(),
4262            _decode,
4263        )
4264    }
4265
4266    fn r#signal_processing_connect(
4267        &self,
4268        mut protocol: fdomain_client::fidl::ServerEnd<
4269            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4270        >,
4271    ) -> Result<(), fidl::Error> {
4272        self.client.send::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4273            (protocol,),
4274            0xa81907ce6066295,
4275            fidl::encoding::DynamicFlags::empty(),
4276        )
4277    }
4278
4279    type ResetResponseFut =
4280        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
4281    fn r#reset(&self) -> Self::ResetResponseFut {
4282        fn _decode(
4283            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4284        ) -> Result<(), fidl::Error> {
4285            let _response = fidl::client::decode_transaction_body::<
4286                fidl::encoding::EmptyPayload,
4287                fdomain_client::fidl::FDomainResourceDialect,
4288                0x69e5fa9fa2f78c14,
4289            >(_buf?)?;
4290            Ok(_response)
4291        }
4292        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4293            (),
4294            0x69e5fa9fa2f78c14,
4295            fidl::encoding::DynamicFlags::empty(),
4296            _decode,
4297        )
4298    }
4299
4300    type GetPropertiesResponseFut =
4301        fidl::client::QueryResponseFut<DaiProperties, fdomain_client::fidl::FDomainResourceDialect>;
4302    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
4303        fn _decode(
4304            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4305        ) -> Result<DaiProperties, fidl::Error> {
4306            let _response = fidl::client::decode_transaction_body::<
4307                DaiGetPropertiesResponse,
4308                fdomain_client::fidl::FDomainResourceDialect,
4309                0x2c25a1a66149510b,
4310            >(_buf?)?;
4311            Ok(_response.properties)
4312        }
4313        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiProperties>(
4314            (),
4315            0x2c25a1a66149510b,
4316            fidl::encoding::DynamicFlags::empty(),
4317            _decode,
4318        )
4319    }
4320
4321    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
4322        DaiGetDaiFormatsResult,
4323        fdomain_client::fidl::FDomainResourceDialect,
4324    >;
4325    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
4326        fn _decode(
4327            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4328        ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4329            let _response = fidl::client::decode_transaction_body::<
4330                fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
4331                fdomain_client::fidl::FDomainResourceDialect,
4332                0x1eb37b0cddf79d69,
4333            >(_buf?)?;
4334            Ok(_response.map(|x| x.dai_formats))
4335        }
4336        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetDaiFormatsResult>(
4337            (),
4338            0x1eb37b0cddf79d69,
4339            fidl::encoding::DynamicFlags::empty(),
4340            _decode,
4341        )
4342    }
4343
4344    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
4345        DaiGetRingBufferFormatsResult,
4346        fdomain_client::fidl::FDomainResourceDialect,
4347    >;
4348    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut {
4349        fn _decode(
4350            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4351        ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
4352            let _response = fidl::client::decode_transaction_body::<
4353                fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
4354                fdomain_client::fidl::FDomainResourceDialect,
4355                0x760371081d8c92e4,
4356            >(_buf?)?;
4357            Ok(_response.map(|x| x.ring_buffer_formats))
4358        }
4359        self.client
4360            .send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetRingBufferFormatsResult>(
4361                (),
4362                0x760371081d8c92e4,
4363                fidl::encoding::DynamicFlags::empty(),
4364                _decode,
4365            )
4366    }
4367
4368    fn r#create_ring_buffer(
4369        &self,
4370        mut dai_format: &DaiFormat,
4371        mut ring_buffer_format: &Format,
4372        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4373    ) -> Result<(), fidl::Error> {
4374        self.client.send::<DaiCreateRingBufferRequest>(
4375            (dai_format, ring_buffer_format, ring_buffer),
4376            0x5af9760589a75257,
4377            fidl::encoding::DynamicFlags::empty(),
4378        )
4379    }
4380}
4381
4382pub struct DaiEventStream {
4383    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
4384}
4385
4386impl std::marker::Unpin for DaiEventStream {}
4387
4388impl futures::stream::FusedStream for DaiEventStream {
4389    fn is_terminated(&self) -> bool {
4390        self.event_receiver.is_terminated()
4391    }
4392}
4393
4394impl futures::Stream for DaiEventStream {
4395    type Item = Result<DaiEvent, fidl::Error>;
4396
4397    fn poll_next(
4398        mut self: std::pin::Pin<&mut Self>,
4399        cx: &mut std::task::Context<'_>,
4400    ) -> std::task::Poll<Option<Self::Item>> {
4401        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4402            &mut self.event_receiver,
4403            cx
4404        )?) {
4405            Some(buf) => std::task::Poll::Ready(Some(DaiEvent::decode(buf))),
4406            None => std::task::Poll::Ready(None),
4407        }
4408    }
4409}
4410
4411#[derive(Debug)]
4412pub enum DaiEvent {}
4413
4414impl DaiEvent {
4415    /// Decodes a message buffer as a [`DaiEvent`].
4416    fn decode(
4417        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4418    ) -> Result<DaiEvent, fidl::Error> {
4419        let (bytes, _handles) = buf.split_mut();
4420        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4421        debug_assert_eq!(tx_header.tx_id, 0);
4422        match tx_header.ordinal {
4423            _ => Err(fidl::Error::UnknownOrdinal {
4424                ordinal: tx_header.ordinal,
4425                protocol_name: <DaiMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4426            }),
4427        }
4428    }
4429}
4430
4431/// A Stream of incoming requests for fuchsia.hardware.audio/Dai.
4432pub struct DaiRequestStream {
4433    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4434    is_terminated: bool,
4435}
4436
4437impl std::marker::Unpin for DaiRequestStream {}
4438
4439impl futures::stream::FusedStream for DaiRequestStream {
4440    fn is_terminated(&self) -> bool {
4441        self.is_terminated
4442    }
4443}
4444
4445impl fdomain_client::fidl::RequestStream for DaiRequestStream {
4446    type Protocol = DaiMarker;
4447    type ControlHandle = DaiControlHandle;
4448
4449    fn from_channel(channel: fdomain_client::Channel) -> Self {
4450        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4451    }
4452
4453    fn control_handle(&self) -> Self::ControlHandle {
4454        DaiControlHandle { inner: self.inner.clone() }
4455    }
4456
4457    fn into_inner(
4458        self,
4459    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
4460    {
4461        (self.inner, self.is_terminated)
4462    }
4463
4464    fn from_inner(
4465        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4466        is_terminated: bool,
4467    ) -> Self {
4468        Self { inner, is_terminated }
4469    }
4470}
4471
4472impl futures::Stream for DaiRequestStream {
4473    type Item = Result<DaiRequest, fidl::Error>;
4474
4475    fn poll_next(
4476        mut self: std::pin::Pin<&mut Self>,
4477        cx: &mut std::task::Context<'_>,
4478    ) -> std::task::Poll<Option<Self::Item>> {
4479        let this = &mut *self;
4480        if this.inner.check_shutdown(cx) {
4481            this.is_terminated = true;
4482            return std::task::Poll::Ready(None);
4483        }
4484        if this.is_terminated {
4485            panic!("polled DaiRequestStream after completion");
4486        }
4487        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
4488            |bytes, handles| {
4489                match this.inner.channel().read_etc(cx, bytes, handles) {
4490                    std::task::Poll::Ready(Ok(())) => {}
4491                    std::task::Poll::Pending => return std::task::Poll::Pending,
4492                    std::task::Poll::Ready(Err(None)) => {
4493                        this.is_terminated = true;
4494                        return std::task::Poll::Ready(None);
4495                    }
4496                    std::task::Poll::Ready(Err(Some(e))) => {
4497                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4498                            e.into(),
4499                        ))));
4500                    }
4501                }
4502
4503                // A message has been received from the channel
4504                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4505
4506                std::task::Poll::Ready(Some(match header.ordinal {
4507                    0x4e146d6bca733a84 => {
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::GetHealthState {
4516                            responder: DaiGetHealthStateResponder {
4517                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4518                                tx_id: header.tx_id,
4519                            },
4520                        })
4521                    }
4522                    0xa81907ce6066295 => {
4523                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4524                        let mut req = fidl::new_empty!(fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
4525                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4526                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4527                        Ok(DaiRequest::SignalProcessingConnect {
4528                            protocol: req.protocol,
4529
4530                            control_handle,
4531                        })
4532                    }
4533                    0x69e5fa9fa2f78c14 => {
4534                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4535                        let mut req = fidl::new_empty!(
4536                            fidl::encoding::EmptyPayload,
4537                            fdomain_client::fidl::FDomainResourceDialect
4538                        );
4539                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4540                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4541                        Ok(DaiRequest::Reset {
4542                            responder: DaiResetResponder {
4543                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4544                                tx_id: header.tx_id,
4545                            },
4546                        })
4547                    }
4548                    0x2c25a1a66149510b => {
4549                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4550                        let mut req = fidl::new_empty!(
4551                            fidl::encoding::EmptyPayload,
4552                            fdomain_client::fidl::FDomainResourceDialect
4553                        );
4554                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4555                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4556                        Ok(DaiRequest::GetProperties {
4557                            responder: DaiGetPropertiesResponder {
4558                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4559                                tx_id: header.tx_id,
4560                            },
4561                        })
4562                    }
4563                    0x1eb37b0cddf79d69 => {
4564                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4565                        let mut req = fidl::new_empty!(
4566                            fidl::encoding::EmptyPayload,
4567                            fdomain_client::fidl::FDomainResourceDialect
4568                        );
4569                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4570                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4571                        Ok(DaiRequest::GetDaiFormats {
4572                            responder: DaiGetDaiFormatsResponder {
4573                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4574                                tx_id: header.tx_id,
4575                            },
4576                        })
4577                    }
4578                    0x760371081d8c92e4 => {
4579                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4580                        let mut req = fidl::new_empty!(
4581                            fidl::encoding::EmptyPayload,
4582                            fdomain_client::fidl::FDomainResourceDialect
4583                        );
4584                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4585                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4586                        Ok(DaiRequest::GetRingBufferFormats {
4587                            responder: DaiGetRingBufferFormatsResponder {
4588                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4589                                tx_id: header.tx_id,
4590                            },
4591                        })
4592                    }
4593                    0x5af9760589a75257 => {
4594                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4595                        let mut req = fidl::new_empty!(
4596                            DaiCreateRingBufferRequest,
4597                            fdomain_client::fidl::FDomainResourceDialect
4598                        );
4599                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<DaiCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
4600                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4601                        Ok(DaiRequest::CreateRingBuffer {
4602                            dai_format: req.dai_format,
4603                            ring_buffer_format: req.ring_buffer_format,
4604                            ring_buffer: req.ring_buffer,
4605
4606                            control_handle,
4607                        })
4608                    }
4609                    _ => Err(fidl::Error::UnknownOrdinal {
4610                        ordinal: header.ordinal,
4611                        protocol_name:
4612                            <DaiMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4613                    }),
4614                }))
4615            },
4616        )
4617    }
4618}
4619
4620/// For an overview see
4621/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/development/audio/drivers/dai).
4622/// # Deprecation
4623///
4624/// Not supported anymore, instead use an
4625/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
4626/// with one DAI and one Ring Buffer, see
4627/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
4628#[derive(Debug)]
4629pub enum DaiRequest {
4630    /// Retrieves top level health state.
4631    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4632    GetHealthState { responder: DaiGetHealthStateResponder },
4633    /// Connect to a `SignalProcessing` protocol.
4634    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4635    /// the maximum number of connections have already been created, for instance one, then the
4636    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4637    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4638    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4639    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4640    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4641    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4642    /// is intended to be composed, and hence the more verbose name allows differentiation and
4643    /// improved clarity.
4644    SignalProcessingConnect {
4645        protocol: fdomain_client::fidl::ServerEnd<
4646            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4647        >,
4648        control_handle: DaiControlHandle,
4649    },
4650    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4651    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4652    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4653    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4654    /// protocol channel and retry.
4655    Reset { responder: DaiResetResponder },
4656    /// Retrieves top level static properties.
4657    GetProperties { responder: DaiGetPropertiesResponder },
4658    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4659    /// may reply with an error status and the client may retry at a later time.
4660    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4661    /// the parameters in SupportedFormats may be supported.
4662    GetDaiFormats { responder: DaiGetDaiFormatsResponder },
4663    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4664    /// may reply with an error status and the client may retry at a later time.
4665    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4666    /// the parameters in `SupportedFormats` may be supported.
4667    GetRingBufferFormats { responder: DaiGetRingBufferFormatsResponder },
4668    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4669    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4670    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4671    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4672    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4673    /// gracefully quiesce any on-going streaming operations in the process.
4674    CreateRingBuffer {
4675        dai_format: DaiFormat,
4676        ring_buffer_format: Format,
4677        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4678        control_handle: DaiControlHandle,
4679    },
4680}
4681
4682impl DaiRequest {
4683    #[allow(irrefutable_let_patterns)]
4684    pub fn into_get_health_state(self) -> Option<(DaiGetHealthStateResponder)> {
4685        if let DaiRequest::GetHealthState { responder } = self { Some((responder)) } else { None }
4686    }
4687
4688    #[allow(irrefutable_let_patterns)]
4689    pub fn into_signal_processing_connect(
4690        self,
4691    ) -> Option<(
4692        fdomain_client::fidl::ServerEnd<
4693            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4694        >,
4695        DaiControlHandle,
4696    )> {
4697        if let DaiRequest::SignalProcessingConnect { protocol, control_handle } = self {
4698            Some((protocol, control_handle))
4699        } else {
4700            None
4701        }
4702    }
4703
4704    #[allow(irrefutable_let_patterns)]
4705    pub fn into_reset(self) -> Option<(DaiResetResponder)> {
4706        if let DaiRequest::Reset { responder } = self { Some((responder)) } else { None }
4707    }
4708
4709    #[allow(irrefutable_let_patterns)]
4710    pub fn into_get_properties(self) -> Option<(DaiGetPropertiesResponder)> {
4711        if let DaiRequest::GetProperties { responder } = self { Some((responder)) } else { None }
4712    }
4713
4714    #[allow(irrefutable_let_patterns)]
4715    pub fn into_get_dai_formats(self) -> Option<(DaiGetDaiFormatsResponder)> {
4716        if let DaiRequest::GetDaiFormats { responder } = self { Some((responder)) } else { None }
4717    }
4718
4719    #[allow(irrefutable_let_patterns)]
4720    pub fn into_get_ring_buffer_formats(self) -> Option<(DaiGetRingBufferFormatsResponder)> {
4721        if let DaiRequest::GetRingBufferFormats { responder } = self {
4722            Some((responder))
4723        } else {
4724            None
4725        }
4726    }
4727
4728    #[allow(irrefutable_let_patterns)]
4729    pub fn into_create_ring_buffer(
4730        self,
4731    ) -> Option<(
4732        DaiFormat,
4733        Format,
4734        fdomain_client::fidl::ServerEnd<RingBufferMarker>,
4735        DaiControlHandle,
4736    )> {
4737        if let DaiRequest::CreateRingBuffer {
4738            dai_format,
4739            ring_buffer_format,
4740            ring_buffer,
4741            control_handle,
4742        } = self
4743        {
4744            Some((dai_format, ring_buffer_format, ring_buffer, control_handle))
4745        } else {
4746            None
4747        }
4748    }
4749
4750    /// Name of the method defined in FIDL
4751    pub fn method_name(&self) -> &'static str {
4752        match *self {
4753            DaiRequest::GetHealthState { .. } => "get_health_state",
4754            DaiRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
4755            DaiRequest::Reset { .. } => "reset",
4756            DaiRequest::GetProperties { .. } => "get_properties",
4757            DaiRequest::GetDaiFormats { .. } => "get_dai_formats",
4758            DaiRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
4759            DaiRequest::CreateRingBuffer { .. } => "create_ring_buffer",
4760        }
4761    }
4762}
4763
4764#[derive(Debug, Clone)]
4765pub struct DaiControlHandle {
4766    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4767}
4768
4769impl DaiControlHandle {
4770    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4771        self.inner.shutdown_with_epitaph(status.into())
4772    }
4773}
4774
4775impl fdomain_client::fidl::ControlHandle for DaiControlHandle {
4776    fn shutdown(&self) {
4777        self.inner.shutdown()
4778    }
4779
4780    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4781        self.inner.shutdown_with_epitaph(status)
4782    }
4783
4784    fn is_closed(&self) -> bool {
4785        self.inner.channel().is_closed()
4786    }
4787    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
4788        self.inner.channel().on_closed()
4789    }
4790}
4791
4792impl DaiControlHandle {}
4793
4794#[must_use = "FIDL methods require a response to be sent"]
4795#[derive(Debug)]
4796pub struct DaiGetHealthStateResponder {
4797    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4798    tx_id: u32,
4799}
4800
4801/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4802/// if the responder is dropped without sending a response, so that the client
4803/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4804impl std::ops::Drop for DaiGetHealthStateResponder {
4805    fn drop(&mut self) {
4806        self.control_handle.shutdown();
4807        // Safety: drops once, never accessed again
4808        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4809    }
4810}
4811
4812impl fdomain_client::fidl::Responder for DaiGetHealthStateResponder {
4813    type ControlHandle = DaiControlHandle;
4814
4815    fn control_handle(&self) -> &DaiControlHandle {
4816        &self.control_handle
4817    }
4818
4819    fn drop_without_shutdown(mut self) {
4820        // Safety: drops once, never accessed again due to mem::forget
4821        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4822        // Prevent Drop from running (which would shut down the channel)
4823        std::mem::forget(self);
4824    }
4825}
4826
4827impl DaiGetHealthStateResponder {
4828    /// Sends a response to the FIDL transaction.
4829    ///
4830    /// Sets the channel to shutdown if an error occurs.
4831    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
4832        let _result = self.send_raw(state);
4833        if _result.is_err() {
4834            self.control_handle.shutdown();
4835        }
4836        self.drop_without_shutdown();
4837        _result
4838    }
4839
4840    /// Similar to "send" but does not shutdown the channel if an error occurs.
4841    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
4842        let _result = self.send_raw(state);
4843        self.drop_without_shutdown();
4844        _result
4845    }
4846
4847    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
4848        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
4849            (state,),
4850            self.tx_id,
4851            0x4e146d6bca733a84,
4852            fidl::encoding::DynamicFlags::empty(),
4853        )
4854    }
4855}
4856
4857#[must_use = "FIDL methods require a response to be sent"]
4858#[derive(Debug)]
4859pub struct DaiResetResponder {
4860    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4861    tx_id: u32,
4862}
4863
4864/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4865/// if the responder is dropped without sending a response, so that the client
4866/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4867impl std::ops::Drop for DaiResetResponder {
4868    fn drop(&mut self) {
4869        self.control_handle.shutdown();
4870        // Safety: drops once, never accessed again
4871        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4872    }
4873}
4874
4875impl fdomain_client::fidl::Responder for DaiResetResponder {
4876    type ControlHandle = DaiControlHandle;
4877
4878    fn control_handle(&self) -> &DaiControlHandle {
4879        &self.control_handle
4880    }
4881
4882    fn drop_without_shutdown(mut self) {
4883        // Safety: drops once, never accessed again due to mem::forget
4884        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4885        // Prevent Drop from running (which would shut down the channel)
4886        std::mem::forget(self);
4887    }
4888}
4889
4890impl DaiResetResponder {
4891    /// Sends a response to the FIDL transaction.
4892    ///
4893    /// Sets the channel to shutdown if an error occurs.
4894    pub fn send(self) -> Result<(), fidl::Error> {
4895        let _result = self.send_raw();
4896        if _result.is_err() {
4897            self.control_handle.shutdown();
4898        }
4899        self.drop_without_shutdown();
4900        _result
4901    }
4902
4903    /// Similar to "send" but does not shutdown the channel if an error occurs.
4904    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4905        let _result = self.send_raw();
4906        self.drop_without_shutdown();
4907        _result
4908    }
4909
4910    fn send_raw(&self) -> Result<(), fidl::Error> {
4911        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4912            (),
4913            self.tx_id,
4914            0x69e5fa9fa2f78c14,
4915            fidl::encoding::DynamicFlags::empty(),
4916        )
4917    }
4918}
4919
4920#[must_use = "FIDL methods require a response to be sent"]
4921#[derive(Debug)]
4922pub struct DaiGetPropertiesResponder {
4923    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4924    tx_id: u32,
4925}
4926
4927/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4928/// if the responder is dropped without sending a response, so that the client
4929/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4930impl std::ops::Drop for DaiGetPropertiesResponder {
4931    fn drop(&mut self) {
4932        self.control_handle.shutdown();
4933        // Safety: drops once, never accessed again
4934        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4935    }
4936}
4937
4938impl fdomain_client::fidl::Responder for DaiGetPropertiesResponder {
4939    type ControlHandle = DaiControlHandle;
4940
4941    fn control_handle(&self) -> &DaiControlHandle {
4942        &self.control_handle
4943    }
4944
4945    fn drop_without_shutdown(mut self) {
4946        // Safety: drops once, never accessed again due to mem::forget
4947        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4948        // Prevent Drop from running (which would shut down the channel)
4949        std::mem::forget(self);
4950    }
4951}
4952
4953impl DaiGetPropertiesResponder {
4954    /// Sends a response to the FIDL transaction.
4955    ///
4956    /// Sets the channel to shutdown if an error occurs.
4957    pub fn send(self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
4958        let _result = self.send_raw(properties);
4959        if _result.is_err() {
4960            self.control_handle.shutdown();
4961        }
4962        self.drop_without_shutdown();
4963        _result
4964    }
4965
4966    /// Similar to "send" but does not shutdown the channel if an error occurs.
4967    pub fn send_no_shutdown_on_err(
4968        self,
4969        mut properties: &DaiProperties,
4970    ) -> Result<(), fidl::Error> {
4971        let _result = self.send_raw(properties);
4972        self.drop_without_shutdown();
4973        _result
4974    }
4975
4976    fn send_raw(&self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
4977        self.control_handle.inner.send::<DaiGetPropertiesResponse>(
4978            (properties,),
4979            self.tx_id,
4980            0x2c25a1a66149510b,
4981            fidl::encoding::DynamicFlags::empty(),
4982        )
4983    }
4984}
4985
4986#[must_use = "FIDL methods require a response to be sent"]
4987#[derive(Debug)]
4988pub struct DaiGetDaiFormatsResponder {
4989    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
4990    tx_id: u32,
4991}
4992
4993/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
4994/// if the responder is dropped without sending a response, so that the client
4995/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4996impl std::ops::Drop for DaiGetDaiFormatsResponder {
4997    fn drop(&mut self) {
4998        self.control_handle.shutdown();
4999        // Safety: drops once, never accessed again
5000        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5001    }
5002}
5003
5004impl fdomain_client::fidl::Responder for DaiGetDaiFormatsResponder {
5005    type ControlHandle = DaiControlHandle;
5006
5007    fn control_handle(&self) -> &DaiControlHandle {
5008        &self.control_handle
5009    }
5010
5011    fn drop_without_shutdown(mut self) {
5012        // Safety: drops once, never accessed again due to mem::forget
5013        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5014        // Prevent Drop from running (which would shut down the channel)
5015        std::mem::forget(self);
5016    }
5017}
5018
5019impl DaiGetDaiFormatsResponder {
5020    /// Sends a response to the FIDL transaction.
5021    ///
5022    /// Sets the channel to shutdown if an error occurs.
5023    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5024        let _result = self.send_raw(result);
5025        if _result.is_err() {
5026            self.control_handle.shutdown();
5027        }
5028        self.drop_without_shutdown();
5029        _result
5030    }
5031
5032    /// Similar to "send" but does not shutdown the channel if an error occurs.
5033    pub fn send_no_shutdown_on_err(
5034        self,
5035        mut result: Result<&[DaiSupportedFormats], i32>,
5036    ) -> Result<(), fidl::Error> {
5037        let _result = self.send_raw(result);
5038        self.drop_without_shutdown();
5039        _result
5040    }
5041
5042    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5043        self.control_handle.inner.send::<fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>>(
5044            result.map(|dai_formats| (dai_formats,)),
5045            self.tx_id,
5046            0x1eb37b0cddf79d69,
5047            fidl::encoding::DynamicFlags::empty(),
5048        )
5049    }
5050}
5051
5052#[must_use = "FIDL methods require a response to be sent"]
5053#[derive(Debug)]
5054pub struct DaiGetRingBufferFormatsResponder {
5055    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5056    tx_id: u32,
5057}
5058
5059/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5060/// if the responder is dropped without sending a response, so that the client
5061/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5062impl std::ops::Drop for DaiGetRingBufferFormatsResponder {
5063    fn drop(&mut self) {
5064        self.control_handle.shutdown();
5065        // Safety: drops once, never accessed again
5066        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5067    }
5068}
5069
5070impl fdomain_client::fidl::Responder for DaiGetRingBufferFormatsResponder {
5071    type ControlHandle = DaiControlHandle;
5072
5073    fn control_handle(&self) -> &DaiControlHandle {
5074        &self.control_handle
5075    }
5076
5077    fn drop_without_shutdown(mut self) {
5078        // Safety: drops once, never accessed again due to mem::forget
5079        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5080        // Prevent Drop from running (which would shut down the channel)
5081        std::mem::forget(self);
5082    }
5083}
5084
5085impl DaiGetRingBufferFormatsResponder {
5086    /// Sends a response to the FIDL transaction.
5087    ///
5088    /// Sets the channel to shutdown if an error occurs.
5089    pub fn send(self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5090        let _result = self.send_raw(result);
5091        if _result.is_err() {
5092            self.control_handle.shutdown();
5093        }
5094        self.drop_without_shutdown();
5095        _result
5096    }
5097
5098    /// Similar to "send" but does not shutdown the channel if an error occurs.
5099    pub fn send_no_shutdown_on_err(
5100        self,
5101        mut result: Result<&[SupportedFormats], i32>,
5102    ) -> Result<(), fidl::Error> {
5103        let _result = self.send_raw(result);
5104        self.drop_without_shutdown();
5105        _result
5106    }
5107
5108    fn send_raw(&self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5109        self.control_handle
5110            .inner
5111            .send::<fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>>(
5112                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
5113                self.tx_id,
5114                0x760371081d8c92e4,
5115                fidl::encoding::DynamicFlags::empty(),
5116            )
5117    }
5118}
5119
5120#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5121pub struct DaiConnectorMarker;
5122
5123impl fdomain_client::fidl::ProtocolMarker for DaiConnectorMarker {
5124    type Proxy = DaiConnectorProxy;
5125    type RequestStream = DaiConnectorRequestStream;
5126
5127    const DEBUG_NAME: &'static str = "(anonymous) DaiConnector";
5128}
5129
5130pub trait DaiConnectorProxyInterface: Send + Sync {
5131    fn r#connect(
5132        &self,
5133        dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5134    ) -> Result<(), fidl::Error>;
5135}
5136
5137#[derive(Debug, Clone)]
5138pub struct DaiConnectorProxy {
5139    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
5140}
5141
5142impl fdomain_client::fidl::Proxy for DaiConnectorProxy {
5143    type Protocol = DaiConnectorMarker;
5144
5145    fn from_channel(inner: fdomain_client::Channel) -> Self {
5146        Self::new(inner)
5147    }
5148
5149    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
5150        self.client.into_channel().map_err(|client| Self { client })
5151    }
5152
5153    fn as_channel(&self) -> &fdomain_client::Channel {
5154        self.client.as_channel()
5155    }
5156}
5157
5158impl DaiConnectorProxy {
5159    /// Create a new Proxy for fuchsia.hardware.audio/DaiConnector.
5160    pub fn new(channel: fdomain_client::Channel) -> Self {
5161        let protocol_name =
5162            <DaiConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
5163        Self { client: fidl::client::Client::new(channel, protocol_name) }
5164    }
5165
5166    /// Get a Stream of events from the remote end of the protocol.
5167    ///
5168    /// # Panics
5169    ///
5170    /// Panics if the event stream was already taken.
5171    pub fn take_event_stream(&self) -> DaiConnectorEventStream {
5172        DaiConnectorEventStream { event_receiver: self.client.take_event_receiver() }
5173    }
5174
5175    /// This connects to a DAI protocol server.
5176    pub fn r#connect(
5177        &self,
5178        mut dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5179    ) -> Result<(), fidl::Error> {
5180        DaiConnectorProxyInterface::r#connect(self, dai_protocol)
5181    }
5182}
5183
5184impl DaiConnectorProxyInterface for DaiConnectorProxy {
5185    fn r#connect(
5186        &self,
5187        mut dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5188    ) -> Result<(), fidl::Error> {
5189        self.client.send::<DaiConnectorConnectRequest>(
5190            (dai_protocol,),
5191            0x4e4db05c2eca1450,
5192            fidl::encoding::DynamicFlags::empty(),
5193        )
5194    }
5195}
5196
5197pub struct DaiConnectorEventStream {
5198    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
5199}
5200
5201impl std::marker::Unpin for DaiConnectorEventStream {}
5202
5203impl futures::stream::FusedStream for DaiConnectorEventStream {
5204    fn is_terminated(&self) -> bool {
5205        self.event_receiver.is_terminated()
5206    }
5207}
5208
5209impl futures::Stream for DaiConnectorEventStream {
5210    type Item = Result<DaiConnectorEvent, fidl::Error>;
5211
5212    fn poll_next(
5213        mut self: std::pin::Pin<&mut Self>,
5214        cx: &mut std::task::Context<'_>,
5215    ) -> std::task::Poll<Option<Self::Item>> {
5216        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5217            &mut self.event_receiver,
5218            cx
5219        )?) {
5220            Some(buf) => std::task::Poll::Ready(Some(DaiConnectorEvent::decode(buf))),
5221            None => std::task::Poll::Ready(None),
5222        }
5223    }
5224}
5225
5226#[derive(Debug)]
5227pub enum DaiConnectorEvent {}
5228
5229impl DaiConnectorEvent {
5230    /// Decodes a message buffer as a [`DaiConnectorEvent`].
5231    fn decode(
5232        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5233    ) -> Result<DaiConnectorEvent, fidl::Error> {
5234        let (bytes, _handles) = buf.split_mut();
5235        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5236        debug_assert_eq!(tx_header.tx_id, 0);
5237        match tx_header.ordinal {
5238            _ => Err(fidl::Error::UnknownOrdinal {
5239                ordinal: tx_header.ordinal,
5240                protocol_name:
5241                    <DaiConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5242            }),
5243        }
5244    }
5245}
5246
5247/// A Stream of incoming requests for fuchsia.hardware.audio/DaiConnector.
5248pub struct DaiConnectorRequestStream {
5249    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5250    is_terminated: bool,
5251}
5252
5253impl std::marker::Unpin for DaiConnectorRequestStream {}
5254
5255impl futures::stream::FusedStream for DaiConnectorRequestStream {
5256    fn is_terminated(&self) -> bool {
5257        self.is_terminated
5258    }
5259}
5260
5261impl fdomain_client::fidl::RequestStream for DaiConnectorRequestStream {
5262    type Protocol = DaiConnectorMarker;
5263    type ControlHandle = DaiConnectorControlHandle;
5264
5265    fn from_channel(channel: fdomain_client::Channel) -> Self {
5266        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5267    }
5268
5269    fn control_handle(&self) -> Self::ControlHandle {
5270        DaiConnectorControlHandle { inner: self.inner.clone() }
5271    }
5272
5273    fn into_inner(
5274        self,
5275    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
5276    {
5277        (self.inner, self.is_terminated)
5278    }
5279
5280    fn from_inner(
5281        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5282        is_terminated: bool,
5283    ) -> Self {
5284        Self { inner, is_terminated }
5285    }
5286}
5287
5288impl futures::Stream for DaiConnectorRequestStream {
5289    type Item = Result<DaiConnectorRequest, fidl::Error>;
5290
5291    fn poll_next(
5292        mut self: std::pin::Pin<&mut Self>,
5293        cx: &mut std::task::Context<'_>,
5294    ) -> std::task::Poll<Option<Self::Item>> {
5295        let this = &mut *self;
5296        if this.inner.check_shutdown(cx) {
5297            this.is_terminated = true;
5298            return std::task::Poll::Ready(None);
5299        }
5300        if this.is_terminated {
5301            panic!("polled DaiConnectorRequestStream after completion");
5302        }
5303        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
5304            |bytes, handles| {
5305                match this.inner.channel().read_etc(cx, bytes, handles) {
5306                    std::task::Poll::Ready(Ok(())) => {}
5307                    std::task::Poll::Pending => return std::task::Poll::Pending,
5308                    std::task::Poll::Ready(Err(None)) => {
5309                        this.is_terminated = true;
5310                        return std::task::Poll::Ready(None);
5311                    }
5312                    std::task::Poll::Ready(Err(Some(e))) => {
5313                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5314                            e.into(),
5315                        ))));
5316                    }
5317                }
5318
5319                // A message has been received from the channel
5320                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5321
5322                std::task::Poll::Ready(Some(match header.ordinal {
5323                    0x4e4db05c2eca1450 => {
5324                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5325                        let mut req = fidl::new_empty!(
5326                            DaiConnectorConnectRequest,
5327                            fdomain_client::fidl::FDomainResourceDialect
5328                        );
5329                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<DaiConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5330                        let control_handle =
5331                            DaiConnectorControlHandle { inner: this.inner.clone() };
5332                        Ok(DaiConnectorRequest::Connect {
5333                            dai_protocol: req.dai_protocol,
5334
5335                            control_handle,
5336                        })
5337                    }
5338                    _ => Err(fidl::Error::UnknownOrdinal {
5339                        ordinal: header.ordinal,
5340                        protocol_name:
5341                            <DaiConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5342                    }),
5343                }))
5344            },
5345        )
5346    }
5347}
5348
5349/// For an overview of the DAI protocols see
5350/// [Digital Audio Interface](//docs/development/audio/drivers/dai.md)
5351/// # Deprecation
5352///
5353/// Not supported anymore, instead use an
5354/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5355/// with one DAI and one Ring Buffer, see
5356/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5357#[derive(Debug)]
5358pub enum DaiConnectorRequest {
5359    /// This connects to a DAI protocol server.
5360    Connect {
5361        dai_protocol: fdomain_client::fidl::ServerEnd<DaiMarker>,
5362        control_handle: DaiConnectorControlHandle,
5363    },
5364}
5365
5366impl DaiConnectorRequest {
5367    #[allow(irrefutable_let_patterns)]
5368    pub fn into_connect(
5369        self,
5370    ) -> Option<(fdomain_client::fidl::ServerEnd<DaiMarker>, DaiConnectorControlHandle)> {
5371        if let DaiConnectorRequest::Connect { dai_protocol, control_handle } = self {
5372            Some((dai_protocol, control_handle))
5373        } else {
5374            None
5375        }
5376    }
5377
5378    /// Name of the method defined in FIDL
5379    pub fn method_name(&self) -> &'static str {
5380        match *self {
5381            DaiConnectorRequest::Connect { .. } => "connect",
5382        }
5383    }
5384}
5385
5386#[derive(Debug, Clone)]
5387pub struct DaiConnectorControlHandle {
5388    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5389}
5390
5391impl DaiConnectorControlHandle {
5392    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5393        self.inner.shutdown_with_epitaph(status.into())
5394    }
5395}
5396
5397impl fdomain_client::fidl::ControlHandle for DaiConnectorControlHandle {
5398    fn shutdown(&self) {
5399        self.inner.shutdown()
5400    }
5401
5402    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5403        self.inner.shutdown_with_epitaph(status)
5404    }
5405
5406    fn is_closed(&self) -> bool {
5407        self.inner.channel().is_closed()
5408    }
5409    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
5410        self.inner.channel().on_closed()
5411    }
5412}
5413
5414impl DaiConnectorControlHandle {}
5415
5416#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5417pub struct HealthMarker;
5418
5419impl fdomain_client::fidl::ProtocolMarker for HealthMarker {
5420    type Proxy = HealthProxy;
5421    type RequestStream = HealthRequestStream;
5422
5423    const DEBUG_NAME: &'static str = "(anonymous) Health";
5424}
5425
5426pub trait HealthProxyInterface: Send + Sync {
5427    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
5428        + Send;
5429    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
5430}
5431
5432#[derive(Debug, Clone)]
5433pub struct HealthProxy {
5434    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
5435}
5436
5437impl fdomain_client::fidl::Proxy for HealthProxy {
5438    type Protocol = HealthMarker;
5439
5440    fn from_channel(inner: fdomain_client::Channel) -> Self {
5441        Self::new(inner)
5442    }
5443
5444    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
5445        self.client.into_channel().map_err(|client| Self { client })
5446    }
5447
5448    fn as_channel(&self) -> &fdomain_client::Channel {
5449        self.client.as_channel()
5450    }
5451}
5452
5453impl HealthProxy {
5454    /// Create a new Proxy for fuchsia.hardware.audio/Health.
5455    pub fn new(channel: fdomain_client::Channel) -> Self {
5456        let protocol_name = <HealthMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
5457        Self { client: fidl::client::Client::new(channel, protocol_name) }
5458    }
5459
5460    /// Get a Stream of events from the remote end of the protocol.
5461    ///
5462    /// # Panics
5463    ///
5464    /// Panics if the event stream was already taken.
5465    pub fn take_event_stream(&self) -> HealthEventStream {
5466        HealthEventStream { event_receiver: self.client.take_event_receiver() }
5467    }
5468
5469    /// Retrieves top level health state.
5470    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5471    pub fn r#get_health_state(
5472        &self,
5473    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
5474    {
5475        HealthProxyInterface::r#get_health_state(self)
5476    }
5477}
5478
5479impl HealthProxyInterface for HealthProxy {
5480    type GetHealthStateResponseFut =
5481        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
5482    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
5483        fn _decode(
5484            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5485        ) -> Result<HealthState, fidl::Error> {
5486            let _response = fidl::client::decode_transaction_body::<
5487                HealthGetHealthStateResponse,
5488                fdomain_client::fidl::FDomainResourceDialect,
5489                0x4e146d6bca733a84,
5490            >(_buf?)?;
5491            Ok(_response.state)
5492        }
5493        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
5494            (),
5495            0x4e146d6bca733a84,
5496            fidl::encoding::DynamicFlags::empty(),
5497            _decode,
5498        )
5499    }
5500}
5501
5502pub struct HealthEventStream {
5503    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
5504}
5505
5506impl std::marker::Unpin for HealthEventStream {}
5507
5508impl futures::stream::FusedStream for HealthEventStream {
5509    fn is_terminated(&self) -> bool {
5510        self.event_receiver.is_terminated()
5511    }
5512}
5513
5514impl futures::Stream for HealthEventStream {
5515    type Item = Result<HealthEvent, fidl::Error>;
5516
5517    fn poll_next(
5518        mut self: std::pin::Pin<&mut Self>,
5519        cx: &mut std::task::Context<'_>,
5520    ) -> std::task::Poll<Option<Self::Item>> {
5521        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5522            &mut self.event_receiver,
5523            cx
5524        )?) {
5525            Some(buf) => std::task::Poll::Ready(Some(HealthEvent::decode(buf))),
5526            None => std::task::Poll::Ready(None),
5527        }
5528    }
5529}
5530
5531#[derive(Debug)]
5532pub enum HealthEvent {}
5533
5534impl HealthEvent {
5535    /// Decodes a message buffer as a [`HealthEvent`].
5536    fn decode(
5537        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5538    ) -> Result<HealthEvent, fidl::Error> {
5539        let (bytes, _handles) = buf.split_mut();
5540        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5541        debug_assert_eq!(tx_header.tx_id, 0);
5542        match tx_header.ordinal {
5543            _ => Err(fidl::Error::UnknownOrdinal {
5544                ordinal: tx_header.ordinal,
5545                protocol_name: <HealthMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5546            }),
5547        }
5548    }
5549}
5550
5551/// A Stream of incoming requests for fuchsia.hardware.audio/Health.
5552pub struct HealthRequestStream {
5553    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5554    is_terminated: bool,
5555}
5556
5557impl std::marker::Unpin for HealthRequestStream {}
5558
5559impl futures::stream::FusedStream for HealthRequestStream {
5560    fn is_terminated(&self) -> bool {
5561        self.is_terminated
5562    }
5563}
5564
5565impl fdomain_client::fidl::RequestStream for HealthRequestStream {
5566    type Protocol = HealthMarker;
5567    type ControlHandle = HealthControlHandle;
5568
5569    fn from_channel(channel: fdomain_client::Channel) -> Self {
5570        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5571    }
5572
5573    fn control_handle(&self) -> Self::ControlHandle {
5574        HealthControlHandle { inner: self.inner.clone() }
5575    }
5576
5577    fn into_inner(
5578        self,
5579    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
5580    {
5581        (self.inner, self.is_terminated)
5582    }
5583
5584    fn from_inner(
5585        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5586        is_terminated: bool,
5587    ) -> Self {
5588        Self { inner, is_terminated }
5589    }
5590}
5591
5592impl futures::Stream for HealthRequestStream {
5593    type Item = Result<HealthRequest, fidl::Error>;
5594
5595    fn poll_next(
5596        mut self: std::pin::Pin<&mut Self>,
5597        cx: &mut std::task::Context<'_>,
5598    ) -> std::task::Poll<Option<Self::Item>> {
5599        let this = &mut *self;
5600        if this.inner.check_shutdown(cx) {
5601            this.is_terminated = true;
5602            return std::task::Poll::Ready(None);
5603        }
5604        if this.is_terminated {
5605            panic!("polled HealthRequestStream after completion");
5606        }
5607        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
5608            |bytes, handles| {
5609                match this.inner.channel().read_etc(cx, bytes, handles) {
5610                    std::task::Poll::Ready(Ok(())) => {}
5611                    std::task::Poll::Pending => return std::task::Poll::Pending,
5612                    std::task::Poll::Ready(Err(None)) => {
5613                        this.is_terminated = true;
5614                        return std::task::Poll::Ready(None);
5615                    }
5616                    std::task::Poll::Ready(Err(Some(e))) => {
5617                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5618                            e.into(),
5619                        ))));
5620                    }
5621                }
5622
5623                // A message has been received from the channel
5624                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5625
5626                std::task::Poll::Ready(Some(match header.ordinal {
5627                    0x4e146d6bca733a84 => {
5628                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5629                        let mut req = fidl::new_empty!(
5630                            fidl::encoding::EmptyPayload,
5631                            fdomain_client::fidl::FDomainResourceDialect
5632                        );
5633                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5634                        let control_handle = HealthControlHandle { inner: this.inner.clone() };
5635                        Ok(HealthRequest::GetHealthState {
5636                            responder: HealthGetHealthStateResponder {
5637                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5638                                tx_id: header.tx_id,
5639                            },
5640                        })
5641                    }
5642                    _ => Err(fidl::Error::UnknownOrdinal {
5643                        ordinal: header.ordinal,
5644                        protocol_name:
5645                            <HealthMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5646                    }),
5647                }))
5648            },
5649        )
5650    }
5651}
5652
5653#[derive(Debug)]
5654pub enum HealthRequest {
5655    /// Retrieves top level health state.
5656    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5657    GetHealthState { responder: HealthGetHealthStateResponder },
5658}
5659
5660impl HealthRequest {
5661    #[allow(irrefutable_let_patterns)]
5662    pub fn into_get_health_state(self) -> Option<(HealthGetHealthStateResponder)> {
5663        if let HealthRequest::GetHealthState { responder } = self {
5664            Some((responder))
5665        } else {
5666            None
5667        }
5668    }
5669
5670    /// Name of the method defined in FIDL
5671    pub fn method_name(&self) -> &'static str {
5672        match *self {
5673            HealthRequest::GetHealthState { .. } => "get_health_state",
5674        }
5675    }
5676}
5677
5678#[derive(Debug, Clone)]
5679pub struct HealthControlHandle {
5680    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5681}
5682
5683impl HealthControlHandle {
5684    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5685        self.inner.shutdown_with_epitaph(status.into())
5686    }
5687}
5688
5689impl fdomain_client::fidl::ControlHandle for HealthControlHandle {
5690    fn shutdown(&self) {
5691        self.inner.shutdown()
5692    }
5693
5694    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5695        self.inner.shutdown_with_epitaph(status)
5696    }
5697
5698    fn is_closed(&self) -> bool {
5699        self.inner.channel().is_closed()
5700    }
5701    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
5702        self.inner.channel().on_closed()
5703    }
5704}
5705
5706impl HealthControlHandle {}
5707
5708#[must_use = "FIDL methods require a response to be sent"]
5709#[derive(Debug)]
5710pub struct HealthGetHealthStateResponder {
5711    control_handle: std::mem::ManuallyDrop<HealthControlHandle>,
5712    tx_id: u32,
5713}
5714
5715/// Set the the channel to be shutdown (see [`HealthControlHandle::shutdown`])
5716/// if the responder is dropped without sending a response, so that the client
5717/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5718impl std::ops::Drop for HealthGetHealthStateResponder {
5719    fn drop(&mut self) {
5720        self.control_handle.shutdown();
5721        // Safety: drops once, never accessed again
5722        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5723    }
5724}
5725
5726impl fdomain_client::fidl::Responder for HealthGetHealthStateResponder {
5727    type ControlHandle = HealthControlHandle;
5728
5729    fn control_handle(&self) -> &HealthControlHandle {
5730        &self.control_handle
5731    }
5732
5733    fn drop_without_shutdown(mut self) {
5734        // Safety: drops once, never accessed again due to mem::forget
5735        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5736        // Prevent Drop from running (which would shut down the channel)
5737        std::mem::forget(self);
5738    }
5739}
5740
5741impl HealthGetHealthStateResponder {
5742    /// Sends a response to the FIDL transaction.
5743    ///
5744    /// Sets the channel to shutdown if an error occurs.
5745    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5746        let _result = self.send_raw(state);
5747        if _result.is_err() {
5748            self.control_handle.shutdown();
5749        }
5750        self.drop_without_shutdown();
5751        _result
5752    }
5753
5754    /// Similar to "send" but does not shutdown the channel if an error occurs.
5755    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5756        let _result = self.send_raw(state);
5757        self.drop_without_shutdown();
5758        _result
5759    }
5760
5761    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
5762        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
5763            (state,),
5764            self.tx_id,
5765            0x4e146d6bca733a84,
5766            fidl::encoding::DynamicFlags::empty(),
5767        )
5768    }
5769}
5770
5771#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5772pub struct PacketStreamControlMarker;
5773
5774impl fdomain_client::fidl::ProtocolMarker for PacketStreamControlMarker {
5775    type Proxy = PacketStreamControlProxy;
5776    type RequestStream = PacketStreamControlRequestStream;
5777
5778    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamControl";
5779}
5780pub type PacketStreamControlAllocateVmosResult = Result<Vec<VmoInfo>, i32>;
5781pub type PacketStreamControlDeallocateVmosResult = Result<(), i32>;
5782pub type PacketStreamControlRegisterVmosResult = Result<(), i32>;
5783pub type PacketStreamControlUnregisterVmosResult = Result<(), i32>;
5784pub type PacketStreamControlGetPacketStreamSinkResult =
5785    Result<PacketStreamControlGetPacketStreamSinkResponse, i32>;
5786pub type PacketStreamControlSetPacketStreamSinkResult = Result<(), i32>;
5787pub type PacketStreamControlStartResult = Result<(), i32>;
5788pub type PacketStreamControlStopResult = Result<(), i32>;
5789
5790pub trait PacketStreamControlProxyInterface: Send + Sync {
5791    type GetPropertiesResponseFut: std::future::Future<Output = Result<PacketStreamProperties, fidl::Error>>
5792        + Send;
5793    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
5794    type AllocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlAllocateVmosResult, fidl::Error>>
5795        + Send;
5796    fn r#allocate_vmos(&self, payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut;
5797    type DeallocateVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlDeallocateVmosResult, fidl::Error>>
5798        + Send;
5799    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut;
5800    type RegisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlRegisterVmosResult, fidl::Error>>
5801        + Send;
5802    fn r#register_vmos(&self, payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut;
5803    type UnregisterVmosResponseFut: std::future::Future<Output = Result<PacketStreamControlUnregisterVmosResult, fidl::Error>>
5804        + Send;
5805    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut;
5806    type GetPacketStreamSinkResponseFut: std::future::Future<
5807            Output = Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error>,
5808        > + Send;
5809    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut;
5810    type SetPacketStreamSinkResponseFut: std::future::Future<
5811            Output = Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error>,
5812        > + Send;
5813    fn r#set_packet_stream_sink(
5814        &self,
5815        payload: PacketStreamControlSetPacketStreamSinkRequest,
5816    ) -> Self::SetPacketStreamSinkResponseFut;
5817    type StartResponseFut: std::future::Future<Output = Result<PacketStreamControlStartResult, fidl::Error>>
5818        + Send;
5819    fn r#start(&self) -> Self::StartResponseFut;
5820    type StopResponseFut: std::future::Future<Output = Result<PacketStreamControlStopResult, fidl::Error>>
5821        + Send;
5822    fn r#stop(&self) -> Self::StopResponseFut;
5823}
5824
5825#[derive(Debug, Clone)]
5826pub struct PacketStreamControlProxy {
5827    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
5828}
5829
5830impl fdomain_client::fidl::Proxy for PacketStreamControlProxy {
5831    type Protocol = PacketStreamControlMarker;
5832
5833    fn from_channel(inner: fdomain_client::Channel) -> Self {
5834        Self::new(inner)
5835    }
5836
5837    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
5838        self.client.into_channel().map_err(|client| Self { client })
5839    }
5840
5841    fn as_channel(&self) -> &fdomain_client::Channel {
5842        self.client.as_channel()
5843    }
5844}
5845
5846impl PacketStreamControlProxy {
5847    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamControl.
5848    pub fn new(channel: fdomain_client::Channel) -> Self {
5849        let protocol_name =
5850            <PacketStreamControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
5851        Self { client: fidl::client::Client::new(channel, protocol_name) }
5852    }
5853
5854    /// Get a Stream of events from the remote end of the protocol.
5855    ///
5856    /// # Panics
5857    ///
5858    /// Panics if the event stream was already taken.
5859    pub fn take_event_stream(&self) -> PacketStreamControlEventStream {
5860        PacketStreamControlEventStream { event_receiver: self.client.take_event_receiver() }
5861    }
5862
5863    /// Accessor for top level static properties.
5864    pub fn r#get_properties(
5865        &self,
5866    ) -> fidl::client::QueryResponseFut<
5867        PacketStreamProperties,
5868        fdomain_client::fidl::FDomainResourceDialect,
5869    > {
5870        PacketStreamControlProxyInterface::r#get_properties(self)
5871    }
5872
5873    /// Request the driver to allocate VMOs for data transfer.
5874    /// Returns the allocated VMOs and their assigned IDs.
5875    ///
5876    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
5877    /// If the packet stream is an output stream, then the handle must also include
5878    /// ZX_RIGHT_WRITE.
5879    ///
5880    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
5881    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
5882    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
5883    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
5884    /// reconfigure.
5885    pub fn r#allocate_vmos(
5886        &self,
5887        mut payload: &AllocateVmosConfig,
5888    ) -> fidl::client::QueryResponseFut<
5889        PacketStreamControlAllocateVmosResult,
5890        fdomain_client::fidl::FDomainResourceDialect,
5891    > {
5892        PacketStreamControlProxyInterface::r#allocate_vmos(self, payload)
5893    }
5894
5895    /// Releases all VMOs previously allocated via `AllocateVmos`.
5896    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
5897    ///
5898    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
5899    /// not stopped.
5900    pub fn r#deallocate_vmos(
5901        &self,
5902    ) -> fidl::client::QueryResponseFut<
5903        PacketStreamControlDeallocateVmosResult,
5904        fdomain_client::fidl::FDomainResourceDialect,
5905    > {
5906        PacketStreamControlProxyInterface::r#deallocate_vmos(self)
5907    }
5908
5909    /// Registers client-allocated VMOs with the driver.
5910    ///
5911    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
5912    /// If the packet stream is an input stream, then the handle must also include
5913    /// ZX_RIGHT_WRITE.
5914    ///
5915    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
5916    /// or if duplicate `vmo_id`s are found.
5917    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
5918    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
5919    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
5920    /// reconfigure.
5921    pub fn r#register_vmos(
5922        &self,
5923        mut payload: RegisterVmosConfig,
5924    ) -> fidl::client::QueryResponseFut<
5925        PacketStreamControlRegisterVmosResult,
5926        fdomain_client::fidl::FDomainResourceDialect,
5927    > {
5928        PacketStreamControlProxyInterface::r#register_vmos(self, payload)
5929    }
5930
5931    /// Unregisters all VMOs previously registered via `RegisterVmos`.
5932    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
5933    ///
5934    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
5935    /// not stopped.
5936    pub fn r#unregister_vmos(
5937        &self,
5938    ) -> fidl::client::QueryResponseFut<
5939        PacketStreamControlUnregisterVmosResult,
5940        fdomain_client::fidl::FDomainResourceDialect,
5941    > {
5942        PacketStreamControlProxyInterface::r#unregister_vmos(self)
5943    }
5944
5945    /// Connects to the data sink implemented by the driver.
5946    /// This is used for audio **Output** where the driver consumes data.
5947    ///
5948    /// Flow:
5949    /// 1. App writes audio data to a registered VMO.
5950    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
5951    ///    true).
5952    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
5953    /// 4. Driver consumes the data.
5954    ///
5955    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
5956    /// and any pending requests on that channel are discarded. The new channel replaces the old
5957    /// one.
5958    ///
5959    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
5960    /// not support this method.
5961    pub fn r#get_packet_stream_sink(
5962        &self,
5963    ) -> fidl::client::QueryResponseFut<
5964        PacketStreamControlGetPacketStreamSinkResult,
5965        fdomain_client::fidl::FDomainResourceDialect,
5966    > {
5967        PacketStreamControlProxyInterface::r#get_packet_stream_sink(self)
5968    }
5969
5970    /// Provides a data sink to the driver.
5971    /// This is used for audio **Input** where the driver produces data.
5972    ///
5973    /// Flow:
5974    /// 1. Driver writes audio data to a registered VMO.
5975    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
5976    /// 3. App receives `PutPacket`.
5977    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
5978    ///    true).
5979    /// 5. App reads the data.
5980    ///
5981    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
5982    /// channel. The new channel replaces the old one.
5983    ///
5984    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
5985    /// not support this method.
5986    pub fn r#set_packet_stream_sink(
5987        &self,
5988        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
5989    ) -> fidl::client::QueryResponseFut<
5990        PacketStreamControlSetPacketStreamSinkResult,
5991        fdomain_client::fidl::FDomainResourceDialect,
5992    > {
5993        PacketStreamControlProxyInterface::r#set_packet_stream_sink(self, payload)
5994    }
5995
5996    /// Start the packet-stream.
5997    ///
5998    /// Returns `ZX_ERR_BAD_STATE` if:
5999    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
6000    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
6001    ///   `INLINE` is supported.
6002    /// * The stream is already started.
6003    pub fn r#start(
6004        &self,
6005    ) -> fidl::client::QueryResponseFut<
6006        PacketStreamControlStartResult,
6007        fdomain_client::fidl::FDomainResourceDialect,
6008    > {
6009        PacketStreamControlProxyInterface::r#start(self)
6010    }
6011
6012    /// Stop the packet-stream.
6013    ///
6014    /// Once the response is received, the stream is halted.
6015    ///
6016    /// Behavior depends on the stream direction:
6017    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
6018    ///   requests will remain pending until `Start` is called again. Clients may call
6019    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
6020    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
6021    ///   calls will be made by the driver until `Start` is called again.
6022    ///
6023    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
6024    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
6025    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
6026    ///   complete successfully after `Stop` has returned.
6027    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
6028    ///   arrive at the client after `Stop` has returned.
6029    ///
6030    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
6031    pub fn r#stop(
6032        &self,
6033    ) -> fidl::client::QueryResponseFut<
6034        PacketStreamControlStopResult,
6035        fdomain_client::fidl::FDomainResourceDialect,
6036    > {
6037        PacketStreamControlProxyInterface::r#stop(self)
6038    }
6039}
6040
6041impl PacketStreamControlProxyInterface for PacketStreamControlProxy {
6042    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
6043        PacketStreamProperties,
6044        fdomain_client::fidl::FDomainResourceDialect,
6045    >;
6046    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
6047        fn _decode(
6048            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6049        ) -> Result<PacketStreamProperties, fidl::Error> {
6050            let _response = fidl::client::decode_transaction_body::<
6051                fidl::encoding::FlexibleType<PacketStreamControlGetPropertiesResponse>,
6052                fdomain_client::fidl::FDomainResourceDialect,
6053                0x586cf4f0f8d2771f,
6054            >(_buf?)?
6055            .into_result_fdomain::<PacketStreamControlMarker>("get_properties")?;
6056            Ok(_response.properties)
6057        }
6058        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamProperties>(
6059            (),
6060            0x586cf4f0f8d2771f,
6061            fidl::encoding::DynamicFlags::FLEXIBLE,
6062            _decode,
6063        )
6064    }
6065
6066    type AllocateVmosResponseFut = fidl::client::QueryResponseFut<
6067        PacketStreamControlAllocateVmosResult,
6068        fdomain_client::fidl::FDomainResourceDialect,
6069    >;
6070    fn r#allocate_vmos(&self, mut payload: &AllocateVmosConfig) -> Self::AllocateVmosResponseFut {
6071        fn _decode(
6072            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6073        ) -> Result<PacketStreamControlAllocateVmosResult, fidl::Error> {
6074            let _response = fidl::client::decode_transaction_body::<
6075                fidl::encoding::FlexibleResultType<PacketStreamControlAllocateVmosResponse, i32>,
6076                fdomain_client::fidl::FDomainResourceDialect,
6077                0x7ff1473165ed344b,
6078            >(_buf?)?
6079            .into_result_fdomain::<PacketStreamControlMarker>("allocate_vmos")?;
6080            Ok(_response.map(|x| x.vmos))
6081        }
6082        self.client
6083            .send_query_and_decode::<AllocateVmosConfig, PacketStreamControlAllocateVmosResult>(
6084                payload,
6085                0x7ff1473165ed344b,
6086                fidl::encoding::DynamicFlags::FLEXIBLE,
6087                _decode,
6088            )
6089    }
6090
6091    type DeallocateVmosResponseFut = fidl::client::QueryResponseFut<
6092        PacketStreamControlDeallocateVmosResult,
6093        fdomain_client::fidl::FDomainResourceDialect,
6094    >;
6095    fn r#deallocate_vmos(&self) -> Self::DeallocateVmosResponseFut {
6096        fn _decode(
6097            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6098        ) -> Result<PacketStreamControlDeallocateVmosResult, fidl::Error> {
6099            let _response = fidl::client::decode_transaction_body::<
6100                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6101                fdomain_client::fidl::FDomainResourceDialect,
6102                0x4db5cc85a7b8405b,
6103            >(_buf?)?
6104            .into_result_fdomain::<PacketStreamControlMarker>("deallocate_vmos")?;
6105            Ok(_response.map(|x| x))
6106        }
6107        self.client.send_query_and_decode::<
6108            fidl::encoding::EmptyPayload,
6109            PacketStreamControlDeallocateVmosResult,
6110        >(
6111            (),
6112            0x4db5cc85a7b8405b,
6113            fidl::encoding::DynamicFlags::FLEXIBLE,
6114            _decode,
6115        )
6116    }
6117
6118    type RegisterVmosResponseFut = fidl::client::QueryResponseFut<
6119        PacketStreamControlRegisterVmosResult,
6120        fdomain_client::fidl::FDomainResourceDialect,
6121    >;
6122    fn r#register_vmos(&self, mut payload: RegisterVmosConfig) -> Self::RegisterVmosResponseFut {
6123        fn _decode(
6124            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6125        ) -> Result<PacketStreamControlRegisterVmosResult, fidl::Error> {
6126            let _response = fidl::client::decode_transaction_body::<
6127                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6128                fdomain_client::fidl::FDomainResourceDialect,
6129                0x29c3b656a1020bfd,
6130            >(_buf?)?
6131            .into_result_fdomain::<PacketStreamControlMarker>("register_vmos")?;
6132            Ok(_response.map(|x| x))
6133        }
6134        self.client
6135            .send_query_and_decode::<RegisterVmosConfig, PacketStreamControlRegisterVmosResult>(
6136                &mut payload,
6137                0x29c3b656a1020bfd,
6138                fidl::encoding::DynamicFlags::FLEXIBLE,
6139                _decode,
6140            )
6141    }
6142
6143    type UnregisterVmosResponseFut = fidl::client::QueryResponseFut<
6144        PacketStreamControlUnregisterVmosResult,
6145        fdomain_client::fidl::FDomainResourceDialect,
6146    >;
6147    fn r#unregister_vmos(&self) -> Self::UnregisterVmosResponseFut {
6148        fn _decode(
6149            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6150        ) -> Result<PacketStreamControlUnregisterVmosResult, fidl::Error> {
6151            let _response = fidl::client::decode_transaction_body::<
6152                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6153                fdomain_client::fidl::FDomainResourceDialect,
6154                0x3e3b4dbfe26b6094,
6155            >(_buf?)?
6156            .into_result_fdomain::<PacketStreamControlMarker>("unregister_vmos")?;
6157            Ok(_response.map(|x| x))
6158        }
6159        self.client.send_query_and_decode::<
6160            fidl::encoding::EmptyPayload,
6161            PacketStreamControlUnregisterVmosResult,
6162        >(
6163            (),
6164            0x3e3b4dbfe26b6094,
6165            fidl::encoding::DynamicFlags::FLEXIBLE,
6166            _decode,
6167        )
6168    }
6169
6170    type GetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
6171        PacketStreamControlGetPacketStreamSinkResult,
6172        fdomain_client::fidl::FDomainResourceDialect,
6173    >;
6174    fn r#get_packet_stream_sink(&self) -> Self::GetPacketStreamSinkResponseFut {
6175        fn _decode(
6176            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6177        ) -> Result<PacketStreamControlGetPacketStreamSinkResult, fidl::Error> {
6178            let _response = fidl::client::decode_transaction_body::<
6179                fidl::encoding::FlexibleResultType<
6180                    PacketStreamControlGetPacketStreamSinkResponse,
6181                    i32,
6182                >,
6183                fdomain_client::fidl::FDomainResourceDialect,
6184                0x7394726463ebbc6a,
6185            >(_buf?)?
6186            .into_result_fdomain::<PacketStreamControlMarker>("get_packet_stream_sink")?;
6187            Ok(_response.map(|x| x))
6188        }
6189        self.client.send_query_and_decode::<
6190            fidl::encoding::EmptyPayload,
6191            PacketStreamControlGetPacketStreamSinkResult,
6192        >(
6193            (),
6194            0x7394726463ebbc6a,
6195            fidl::encoding::DynamicFlags::FLEXIBLE,
6196            _decode,
6197        )
6198    }
6199
6200    type SetPacketStreamSinkResponseFut = fidl::client::QueryResponseFut<
6201        PacketStreamControlSetPacketStreamSinkResult,
6202        fdomain_client::fidl::FDomainResourceDialect,
6203    >;
6204    fn r#set_packet_stream_sink(
6205        &self,
6206        mut payload: PacketStreamControlSetPacketStreamSinkRequest,
6207    ) -> Self::SetPacketStreamSinkResponseFut {
6208        fn _decode(
6209            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6210        ) -> Result<PacketStreamControlSetPacketStreamSinkResult, fidl::Error> {
6211            let _response = fidl::client::decode_transaction_body::<
6212                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6213                fdomain_client::fidl::FDomainResourceDialect,
6214                0xab88800e31dc0e4,
6215            >(_buf?)?
6216            .into_result_fdomain::<PacketStreamControlMarker>("set_packet_stream_sink")?;
6217            Ok(_response.map(|x| x))
6218        }
6219        self.client.send_query_and_decode::<
6220            PacketStreamControlSetPacketStreamSinkRequest,
6221            PacketStreamControlSetPacketStreamSinkResult,
6222        >(
6223            &mut payload,
6224            0xab88800e31dc0e4,
6225            fidl::encoding::DynamicFlags::FLEXIBLE,
6226            _decode,
6227        )
6228    }
6229
6230    type StartResponseFut = fidl::client::QueryResponseFut<
6231        PacketStreamControlStartResult,
6232        fdomain_client::fidl::FDomainResourceDialect,
6233    >;
6234    fn r#start(&self) -> Self::StartResponseFut {
6235        fn _decode(
6236            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6237        ) -> Result<PacketStreamControlStartResult, fidl::Error> {
6238            let _response = fidl::client::decode_transaction_body::<
6239                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6240                fdomain_client::fidl::FDomainResourceDialect,
6241                0x3a584b94d8a6bfd0,
6242            >(_buf?)?
6243            .into_result_fdomain::<PacketStreamControlMarker>("start")?;
6244            Ok(_response.map(|x| x))
6245        }
6246        self.client
6247            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStartResult>(
6248                (),
6249                0x3a584b94d8a6bfd0,
6250                fidl::encoding::DynamicFlags::FLEXIBLE,
6251                _decode,
6252            )
6253    }
6254
6255    type StopResponseFut = fidl::client::QueryResponseFut<
6256        PacketStreamControlStopResult,
6257        fdomain_client::fidl::FDomainResourceDialect,
6258    >;
6259    fn r#stop(&self) -> Self::StopResponseFut {
6260        fn _decode(
6261            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6262        ) -> Result<PacketStreamControlStopResult, fidl::Error> {
6263            let _response = fidl::client::decode_transaction_body::<
6264                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6265                fdomain_client::fidl::FDomainResourceDialect,
6266                0x703e4fafcdd7ef32,
6267            >(_buf?)?
6268            .into_result_fdomain::<PacketStreamControlMarker>("stop")?;
6269            Ok(_response.map(|x| x))
6270        }
6271        self.client
6272            .send_query_and_decode::<fidl::encoding::EmptyPayload, PacketStreamControlStopResult>(
6273                (),
6274                0x703e4fafcdd7ef32,
6275                fidl::encoding::DynamicFlags::FLEXIBLE,
6276                _decode,
6277            )
6278    }
6279}
6280
6281pub struct PacketStreamControlEventStream {
6282    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
6283}
6284
6285impl std::marker::Unpin for PacketStreamControlEventStream {}
6286
6287impl futures::stream::FusedStream for PacketStreamControlEventStream {
6288    fn is_terminated(&self) -> bool {
6289        self.event_receiver.is_terminated()
6290    }
6291}
6292
6293impl futures::Stream for PacketStreamControlEventStream {
6294    type Item = Result<PacketStreamControlEvent, fidl::Error>;
6295
6296    fn poll_next(
6297        mut self: std::pin::Pin<&mut Self>,
6298        cx: &mut std::task::Context<'_>,
6299    ) -> std::task::Poll<Option<Self::Item>> {
6300        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6301            &mut self.event_receiver,
6302            cx
6303        )?) {
6304            Some(buf) => std::task::Poll::Ready(Some(PacketStreamControlEvent::decode(buf))),
6305            None => std::task::Poll::Ready(None),
6306        }
6307    }
6308}
6309
6310#[derive(Debug)]
6311pub enum PacketStreamControlEvent {
6312    #[non_exhaustive]
6313    _UnknownEvent {
6314        /// Ordinal of the event that was sent.
6315        ordinal: u64,
6316    },
6317}
6318
6319impl PacketStreamControlEvent {
6320    /// Decodes a message buffer as a [`PacketStreamControlEvent`].
6321    fn decode(
6322        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6323    ) -> Result<PacketStreamControlEvent, fidl::Error> {
6324        let (bytes, _handles) = buf.split_mut();
6325        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6326        debug_assert_eq!(tx_header.tx_id, 0);
6327        match tx_header.ordinal {
6328            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6329                Ok(PacketStreamControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6330            }
6331            _ => Err(fidl::Error::UnknownOrdinal {
6332                ordinal: tx_header.ordinal,
6333                protocol_name:
6334                    <PacketStreamControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
6335            }),
6336        }
6337    }
6338}
6339
6340/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamControl.
6341pub struct PacketStreamControlRequestStream {
6342    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6343    is_terminated: bool,
6344}
6345
6346impl std::marker::Unpin for PacketStreamControlRequestStream {}
6347
6348impl futures::stream::FusedStream for PacketStreamControlRequestStream {
6349    fn is_terminated(&self) -> bool {
6350        self.is_terminated
6351    }
6352}
6353
6354impl fdomain_client::fidl::RequestStream for PacketStreamControlRequestStream {
6355    type Protocol = PacketStreamControlMarker;
6356    type ControlHandle = PacketStreamControlControlHandle;
6357
6358    fn from_channel(channel: fdomain_client::Channel) -> Self {
6359        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6360    }
6361
6362    fn control_handle(&self) -> Self::ControlHandle {
6363        PacketStreamControlControlHandle { inner: self.inner.clone() }
6364    }
6365
6366    fn into_inner(
6367        self,
6368    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
6369    {
6370        (self.inner, self.is_terminated)
6371    }
6372
6373    fn from_inner(
6374        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6375        is_terminated: bool,
6376    ) -> Self {
6377        Self { inner, is_terminated }
6378    }
6379}
6380
6381impl futures::Stream for PacketStreamControlRequestStream {
6382    type Item = Result<PacketStreamControlRequest, fidl::Error>;
6383
6384    fn poll_next(
6385        mut self: std::pin::Pin<&mut Self>,
6386        cx: &mut std::task::Context<'_>,
6387    ) -> std::task::Poll<Option<Self::Item>> {
6388        let this = &mut *self;
6389        if this.inner.check_shutdown(cx) {
6390            this.is_terminated = true;
6391            return std::task::Poll::Ready(None);
6392        }
6393        if this.is_terminated {
6394            panic!("polled PacketStreamControlRequestStream after completion");
6395        }
6396        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
6397            |bytes, handles| {
6398                match this.inner.channel().read_etc(cx, bytes, handles) {
6399                    std::task::Poll::Ready(Ok(())) => {}
6400                    std::task::Poll::Pending => return std::task::Poll::Pending,
6401                    std::task::Poll::Ready(Err(None)) => {
6402                        this.is_terminated = true;
6403                        return std::task::Poll::Ready(None);
6404                    }
6405                    std::task::Poll::Ready(Err(Some(e))) => {
6406                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6407                            e.into(),
6408                        ))));
6409                    }
6410                }
6411
6412                // A message has been received from the channel
6413                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6414
6415                std::task::Poll::Ready(Some(match header.ordinal {
6416                0x586cf4f0f8d2771f => {
6417                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6418                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6419                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6420                    let control_handle = PacketStreamControlControlHandle {
6421                        inner: this.inner.clone(),
6422                    };
6423                    Ok(PacketStreamControlRequest::GetProperties {
6424                        responder: PacketStreamControlGetPropertiesResponder {
6425                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6426                            tx_id: header.tx_id,
6427                        },
6428                    })
6429                }
6430                0x7ff1473165ed344b => {
6431                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6432                    let mut req = fidl::new_empty!(AllocateVmosConfig, fdomain_client::fidl::FDomainResourceDialect);
6433                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<AllocateVmosConfig>(&header, _body_bytes, handles, &mut req)?;
6434                    let control_handle = PacketStreamControlControlHandle {
6435                        inner: this.inner.clone(),
6436                    };
6437                    Ok(PacketStreamControlRequest::AllocateVmos {payload: req,
6438                        responder: PacketStreamControlAllocateVmosResponder {
6439                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6440                            tx_id: header.tx_id,
6441                        },
6442                    })
6443                }
6444                0x4db5cc85a7b8405b => {
6445                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6446                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6447                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6448                    let control_handle = PacketStreamControlControlHandle {
6449                        inner: this.inner.clone(),
6450                    };
6451                    Ok(PacketStreamControlRequest::DeallocateVmos {
6452                        responder: PacketStreamControlDeallocateVmosResponder {
6453                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6454                            tx_id: header.tx_id,
6455                        },
6456                    })
6457                }
6458                0x29c3b656a1020bfd => {
6459                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6460                    let mut req = fidl::new_empty!(RegisterVmosConfig, fdomain_client::fidl::FDomainResourceDialect);
6461                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RegisterVmosConfig>(&header, _body_bytes, handles, &mut req)?;
6462                    let control_handle = PacketStreamControlControlHandle {
6463                        inner: this.inner.clone(),
6464                    };
6465                    Ok(PacketStreamControlRequest::RegisterVmos {payload: req,
6466                        responder: PacketStreamControlRegisterVmosResponder {
6467                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6468                            tx_id: header.tx_id,
6469                        },
6470                    })
6471                }
6472                0x3e3b4dbfe26b6094 => {
6473                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6474                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6475                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6476                    let control_handle = PacketStreamControlControlHandle {
6477                        inner: this.inner.clone(),
6478                    };
6479                    Ok(PacketStreamControlRequest::UnregisterVmos {
6480                        responder: PacketStreamControlUnregisterVmosResponder {
6481                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6482                            tx_id: header.tx_id,
6483                        },
6484                    })
6485                }
6486                0x7394726463ebbc6a => {
6487                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6488                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6489                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6490                    let control_handle = PacketStreamControlControlHandle {
6491                        inner: this.inner.clone(),
6492                    };
6493                    Ok(PacketStreamControlRequest::GetPacketStreamSink {
6494                        responder: PacketStreamControlGetPacketStreamSinkResponder {
6495                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6496                            tx_id: header.tx_id,
6497                        },
6498                    })
6499                }
6500                0xab88800e31dc0e4 => {
6501                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6502                    let mut req = fidl::new_empty!(PacketStreamControlSetPacketStreamSinkRequest, fdomain_client::fidl::FDomainResourceDialect);
6503                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<PacketStreamControlSetPacketStreamSinkRequest>(&header, _body_bytes, handles, &mut req)?;
6504                    let control_handle = PacketStreamControlControlHandle {
6505                        inner: this.inner.clone(),
6506                    };
6507                    Ok(PacketStreamControlRequest::SetPacketStreamSink {payload: req,
6508                        responder: PacketStreamControlSetPacketStreamSinkResponder {
6509                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6510                            tx_id: header.tx_id,
6511                        },
6512                    })
6513                }
6514                0x3a584b94d8a6bfd0 => {
6515                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6516                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6517                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6518                    let control_handle = PacketStreamControlControlHandle {
6519                        inner: this.inner.clone(),
6520                    };
6521                    Ok(PacketStreamControlRequest::Start {
6522                        responder: PacketStreamControlStartResponder {
6523                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6524                            tx_id: header.tx_id,
6525                        },
6526                    })
6527                }
6528                0x703e4fafcdd7ef32 => {
6529                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6530                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
6531                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6532                    let control_handle = PacketStreamControlControlHandle {
6533                        inner: this.inner.clone(),
6534                    };
6535                    Ok(PacketStreamControlRequest::Stop {
6536                        responder: PacketStreamControlStopResponder {
6537                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6538                            tx_id: header.tx_id,
6539                        },
6540                    })
6541                }
6542                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6543                    Ok(PacketStreamControlRequest::_UnknownMethod {
6544                        ordinal: header.ordinal,
6545                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
6546                        method_type: fidl::MethodType::OneWay,
6547                    })
6548                }
6549                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6550                    this.inner.send_framework_err(
6551                        fidl::encoding::FrameworkErr::UnknownMethod,
6552                        header.tx_id,
6553                        header.ordinal,
6554                        header.dynamic_flags(),
6555                        (bytes, handles),
6556                    )?;
6557                    Ok(PacketStreamControlRequest::_UnknownMethod {
6558                        ordinal: header.ordinal,
6559                        control_handle: PacketStreamControlControlHandle { inner: this.inner.clone() },
6560                        method_type: fidl::MethodType::TwoWay,
6561                    })
6562                }
6563                _ => Err(fidl::Error::UnknownOrdinal {
6564                    ordinal: header.ordinal,
6565                    protocol_name: <PacketStreamControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
6566                }),
6567            }))
6568            },
6569        )
6570    }
6571}
6572
6573/// Control protocol for establishing and managing the packet stream.
6574#[derive(Debug)]
6575pub enum PacketStreamControlRequest {
6576    /// Accessor for top level static properties.
6577    GetProperties { responder: PacketStreamControlGetPropertiesResponder },
6578    /// Request the driver to allocate VMOs for data transfer.
6579    /// Returns the allocated VMOs and their assigned IDs.
6580    ///
6581    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6582    /// If the packet stream is an output stream, then the handle must also include
6583    /// ZX_RIGHT_WRITE.
6584    ///
6585    /// Returns `ZX_ERR_INVALID_ARGS` if `min_vmo_size` is zero or `vmo_count` is zero.
6586    /// Returns `ZX_ERR_NO_MEMORY` if the driver cannot allocate the requested VMOs.
6587    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already allocated or registered, or if the
6588    /// stream is already started. Call `DeallocateVmos` or `UnregisterVmos` first to
6589    /// reconfigure.
6590    AllocateVmos {
6591        payload: AllocateVmosConfig,
6592        responder: PacketStreamControlAllocateVmosResponder,
6593    },
6594    /// Releases all VMOs previously allocated via `AllocateVmos`.
6595    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
6596    ///
6597    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently allocated, or if the stream is
6598    /// not stopped.
6599    DeallocateVmos { responder: PacketStreamControlDeallocateVmosResponder },
6600    /// Registers client-allocated VMOs with the driver.
6601    ///
6602    /// The registered VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6603    /// If the packet stream is an input stream, then the handle must also include
6604    /// ZX_RIGHT_WRITE.
6605    ///
6606    /// Returns `ZX_ERR_INVALID_ARGS` if `vmo_infos` is empty, or if any VMO handle is invalid,
6607    /// or if duplicate `vmo_id`s are found.
6608    /// Returns `ZX_ERR_ACCESS_DENIED` if any VMO does not have the required rights.
6609    /// Returns `ZX_ERR_BAD_STATE` if VMOs are already registered or allocated, or if the
6610    /// stream is already started. Call `UnregisterVmos` or `DeallocateVmos` first to
6611    /// reconfigure.
6612    RegisterVmos {
6613        payload: RegisterVmosConfig,
6614        responder: PacketStreamControlRegisterVmosResponder,
6615    },
6616    /// Unregisters all VMOs previously registered via `RegisterVmos`.
6617    /// This also occurs automatically when the `PacketStreamControl` channel is closed.
6618    ///
6619    /// Returns `ZX_ERR_BAD_STATE` if VMOs are not currently registered, or if the stream is
6620    /// not stopped.
6621    UnregisterVmos { responder: PacketStreamControlUnregisterVmosResponder },
6622    /// Connects to the data sink implemented by the driver.
6623    /// This is used for audio **Output** where the driver consumes data.
6624    ///
6625    /// Flow:
6626    /// 1. App writes audio data to a registered VMO.
6627    /// 2. App flushes the cache for the written region (if `needs_cache_flush_or_invalidate` is
6628    ///    true).
6629    /// 3. App calls `PacketStreamSink.PutPacket` with the location of the data.
6630    /// 4. Driver consumes the data.
6631    ///
6632    /// If this method is called multiple times, the previous `PacketStreamSink` channel is closed,
6633    /// and any pending requests on that channel are discarded. The new channel replaces the old
6634    /// one.
6635    ///
6636    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an input stream, or if the driver does
6637    /// not support this method.
6638    GetPacketStreamSink { responder: PacketStreamControlGetPacketStreamSinkResponder },
6639    /// Provides a data sink to the driver.
6640    /// This is used for audio **Input** where the driver produces data.
6641    ///
6642    /// Flow:
6643    /// 1. Driver writes audio data to a registered VMO.
6644    /// 2. Driver calls `PacketStreamSink.PutPacket` with the location of the data.
6645    /// 3. App receives `PutPacket`.
6646    /// 4. App invalidates the cache for the region (if `needs_cache_flush_or_invalidate` is
6647    ///    true).
6648    /// 5. App reads the data.
6649    ///
6650    /// If this method is called multiple times, the driver closes the previous `PacketStreamSink`
6651    /// channel. The new channel replaces the old one.
6652    ///
6653    /// Returns `ZX_ERR_NOT_SUPPORTED` if the stream is an output stream, or if the driver does
6654    /// not support this method.
6655    SetPacketStreamSink {
6656        payload: PacketStreamControlSetPacketStreamSinkRequest,
6657        responder: PacketStreamControlSetPacketStreamSinkResponder,
6658    },
6659    /// Start the packet-stream.
6660    ///
6661    /// Returns `ZX_ERR_BAD_STATE` if:
6662    /// * Buffers have not been allocated (if `DRIVER_OWNED` was specified)
6663    ///   and/or registered (if `CLIENT_OWNED` was specified). This is not applicable if
6664    ///   `INLINE` is supported.
6665    /// * The stream is already started.
6666    Start { responder: PacketStreamControlStartResponder },
6667    /// Stop the packet-stream.
6668    ///
6669    /// Once the response is received, the stream is halted.
6670    ///
6671    /// Behavior depends on the stream direction:
6672    /// * **Output**: The driver stops consuming packets. Any pending `PacketStreamSink.PutPacket`
6673    ///   requests will remain pending until `Start` is called again. Clients may call
6674    ///   `PacketStreamSink.FlushPackets` after `Stop` to discard these pending packets.
6675    /// * **Input**: The driver stops producing packets. No further `PacketStreamSink.PutPacket`
6676    ///   calls will be made by the driver until `Start` is called again.
6677    ///
6678    /// Note that since `PacketStreamSink` uses a separate channel, there is no strict ordering
6679    /// guarantee between `Stop` and `PacketStreamSink.PutPacket`:
6680    /// * For **Output**, some in-flight `PacketStreamSink.PutPacket` calls may
6681    ///   complete successfully after `Stop` has returned.
6682    /// * For **Input**, some in-flight `PacketStreamSink.PutPacket` calls may
6683    ///   arrive at the client after `Stop` has returned.
6684    ///
6685    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started.
6686    Stop { responder: PacketStreamControlStopResponder },
6687    /// An interaction was received which does not match any known method.
6688    #[non_exhaustive]
6689    _UnknownMethod {
6690        /// Ordinal of the method that was called.
6691        ordinal: u64,
6692        control_handle: PacketStreamControlControlHandle,
6693        method_type: fidl::MethodType,
6694    },
6695}
6696
6697impl PacketStreamControlRequest {
6698    #[allow(irrefutable_let_patterns)]
6699    pub fn into_get_properties(self) -> Option<(PacketStreamControlGetPropertiesResponder)> {
6700        if let PacketStreamControlRequest::GetProperties { responder } = self {
6701            Some((responder))
6702        } else {
6703            None
6704        }
6705    }
6706
6707    #[allow(irrefutable_let_patterns)]
6708    pub fn into_allocate_vmos(
6709        self,
6710    ) -> Option<(AllocateVmosConfig, PacketStreamControlAllocateVmosResponder)> {
6711        if let PacketStreamControlRequest::AllocateVmos { payload, responder } = self {
6712            Some((payload, responder))
6713        } else {
6714            None
6715        }
6716    }
6717
6718    #[allow(irrefutable_let_patterns)]
6719    pub fn into_deallocate_vmos(self) -> Option<(PacketStreamControlDeallocateVmosResponder)> {
6720        if let PacketStreamControlRequest::DeallocateVmos { responder } = self {
6721            Some((responder))
6722        } else {
6723            None
6724        }
6725    }
6726
6727    #[allow(irrefutable_let_patterns)]
6728    pub fn into_register_vmos(
6729        self,
6730    ) -> Option<(RegisterVmosConfig, PacketStreamControlRegisterVmosResponder)> {
6731        if let PacketStreamControlRequest::RegisterVmos { payload, responder } = self {
6732            Some((payload, responder))
6733        } else {
6734            None
6735        }
6736    }
6737
6738    #[allow(irrefutable_let_patterns)]
6739    pub fn into_unregister_vmos(self) -> Option<(PacketStreamControlUnregisterVmosResponder)> {
6740        if let PacketStreamControlRequest::UnregisterVmos { responder } = self {
6741            Some((responder))
6742        } else {
6743            None
6744        }
6745    }
6746
6747    #[allow(irrefutable_let_patterns)]
6748    pub fn into_get_packet_stream_sink(
6749        self,
6750    ) -> Option<(PacketStreamControlGetPacketStreamSinkResponder)> {
6751        if let PacketStreamControlRequest::GetPacketStreamSink { responder } = self {
6752            Some((responder))
6753        } else {
6754            None
6755        }
6756    }
6757
6758    #[allow(irrefutable_let_patterns)]
6759    pub fn into_set_packet_stream_sink(
6760        self,
6761    ) -> Option<(
6762        PacketStreamControlSetPacketStreamSinkRequest,
6763        PacketStreamControlSetPacketStreamSinkResponder,
6764    )> {
6765        if let PacketStreamControlRequest::SetPacketStreamSink { payload, responder } = self {
6766            Some((payload, responder))
6767        } else {
6768            None
6769        }
6770    }
6771
6772    #[allow(irrefutable_let_patterns)]
6773    pub fn into_start(self) -> Option<(PacketStreamControlStartResponder)> {
6774        if let PacketStreamControlRequest::Start { responder } = self {
6775            Some((responder))
6776        } else {
6777            None
6778        }
6779    }
6780
6781    #[allow(irrefutable_let_patterns)]
6782    pub fn into_stop(self) -> Option<(PacketStreamControlStopResponder)> {
6783        if let PacketStreamControlRequest::Stop { responder } = self {
6784            Some((responder))
6785        } else {
6786            None
6787        }
6788    }
6789
6790    /// Name of the method defined in FIDL
6791    pub fn method_name(&self) -> &'static str {
6792        match *self {
6793            PacketStreamControlRequest::GetProperties { .. } => "get_properties",
6794            PacketStreamControlRequest::AllocateVmos { .. } => "allocate_vmos",
6795            PacketStreamControlRequest::DeallocateVmos { .. } => "deallocate_vmos",
6796            PacketStreamControlRequest::RegisterVmos { .. } => "register_vmos",
6797            PacketStreamControlRequest::UnregisterVmos { .. } => "unregister_vmos",
6798            PacketStreamControlRequest::GetPacketStreamSink { .. } => "get_packet_stream_sink",
6799            PacketStreamControlRequest::SetPacketStreamSink { .. } => "set_packet_stream_sink",
6800            PacketStreamControlRequest::Start { .. } => "start",
6801            PacketStreamControlRequest::Stop { .. } => "stop",
6802            PacketStreamControlRequest::_UnknownMethod {
6803                method_type: fidl::MethodType::OneWay,
6804                ..
6805            } => "unknown one-way method",
6806            PacketStreamControlRequest::_UnknownMethod {
6807                method_type: fidl::MethodType::TwoWay,
6808                ..
6809            } => "unknown two-way method",
6810        }
6811    }
6812}
6813
6814#[derive(Debug, Clone)]
6815pub struct PacketStreamControlControlHandle {
6816    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6817}
6818
6819impl PacketStreamControlControlHandle {
6820    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6821        self.inner.shutdown_with_epitaph(status.into())
6822    }
6823}
6824
6825impl fdomain_client::fidl::ControlHandle for PacketStreamControlControlHandle {
6826    fn shutdown(&self) {
6827        self.inner.shutdown()
6828    }
6829
6830    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6831        self.inner.shutdown_with_epitaph(status)
6832    }
6833
6834    fn is_closed(&self) -> bool {
6835        self.inner.channel().is_closed()
6836    }
6837    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
6838        self.inner.channel().on_closed()
6839    }
6840}
6841
6842impl PacketStreamControlControlHandle {}
6843
6844#[must_use = "FIDL methods require a response to be sent"]
6845#[derive(Debug)]
6846pub struct PacketStreamControlGetPropertiesResponder {
6847    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
6848    tx_id: u32,
6849}
6850
6851/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
6852/// if the responder is dropped without sending a response, so that the client
6853/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6854impl std::ops::Drop for PacketStreamControlGetPropertiesResponder {
6855    fn drop(&mut self) {
6856        self.control_handle.shutdown();
6857        // Safety: drops once, never accessed again
6858        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6859    }
6860}
6861
6862impl fdomain_client::fidl::Responder for PacketStreamControlGetPropertiesResponder {
6863    type ControlHandle = PacketStreamControlControlHandle;
6864
6865    fn control_handle(&self) -> &PacketStreamControlControlHandle {
6866        &self.control_handle
6867    }
6868
6869    fn drop_without_shutdown(mut self) {
6870        // Safety: drops once, never accessed again due to mem::forget
6871        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6872        // Prevent Drop from running (which would shut down the channel)
6873        std::mem::forget(self);
6874    }
6875}
6876
6877impl PacketStreamControlGetPropertiesResponder {
6878    /// Sends a response to the FIDL transaction.
6879    ///
6880    /// Sets the channel to shutdown if an error occurs.
6881    pub fn send(self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
6882        let _result = self.send_raw(properties);
6883        if _result.is_err() {
6884            self.control_handle.shutdown();
6885        }
6886        self.drop_without_shutdown();
6887        _result
6888    }
6889
6890    /// Similar to "send" but does not shutdown the channel if an error occurs.
6891    pub fn send_no_shutdown_on_err(
6892        self,
6893        mut properties: &PacketStreamProperties,
6894    ) -> Result<(), fidl::Error> {
6895        let _result = self.send_raw(properties);
6896        self.drop_without_shutdown();
6897        _result
6898    }
6899
6900    fn send_raw(&self, mut properties: &PacketStreamProperties) -> Result<(), fidl::Error> {
6901        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
6902            PacketStreamControlGetPropertiesResponse,
6903        >>(
6904            fidl::encoding::Flexible::new((properties,)),
6905            self.tx_id,
6906            0x586cf4f0f8d2771f,
6907            fidl::encoding::DynamicFlags::FLEXIBLE,
6908        )
6909    }
6910}
6911
6912#[must_use = "FIDL methods require a response to be sent"]
6913#[derive(Debug)]
6914pub struct PacketStreamControlAllocateVmosResponder {
6915    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
6916    tx_id: u32,
6917}
6918
6919/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
6920/// if the responder is dropped without sending a response, so that the client
6921/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6922impl std::ops::Drop for PacketStreamControlAllocateVmosResponder {
6923    fn drop(&mut self) {
6924        self.control_handle.shutdown();
6925        // Safety: drops once, never accessed again
6926        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6927    }
6928}
6929
6930impl fdomain_client::fidl::Responder for PacketStreamControlAllocateVmosResponder {
6931    type ControlHandle = PacketStreamControlControlHandle;
6932
6933    fn control_handle(&self) -> &PacketStreamControlControlHandle {
6934        &self.control_handle
6935    }
6936
6937    fn drop_without_shutdown(mut self) {
6938        // Safety: drops once, never accessed again due to mem::forget
6939        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6940        // Prevent Drop from running (which would shut down the channel)
6941        std::mem::forget(self);
6942    }
6943}
6944
6945impl PacketStreamControlAllocateVmosResponder {
6946    /// Sends a response to the FIDL transaction.
6947    ///
6948    /// Sets the channel to shutdown if an error occurs.
6949    pub fn send(self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
6950        let _result = self.send_raw(result);
6951        if _result.is_err() {
6952            self.control_handle.shutdown();
6953        }
6954        self.drop_without_shutdown();
6955        _result
6956    }
6957
6958    /// Similar to "send" but does not shutdown the channel if an error occurs.
6959    pub fn send_no_shutdown_on_err(
6960        self,
6961        mut result: Result<Vec<VmoInfo>, i32>,
6962    ) -> Result<(), fidl::Error> {
6963        let _result = self.send_raw(result);
6964        self.drop_without_shutdown();
6965        _result
6966    }
6967
6968    fn send_raw(&self, mut result: Result<Vec<VmoInfo>, i32>) -> Result<(), fidl::Error> {
6969        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6970            PacketStreamControlAllocateVmosResponse,
6971            i32,
6972        >>(
6973            fidl::encoding::FlexibleResult::new(
6974                result.as_mut().map_err(|e| *e).map(|vmos| (vmos.as_mut_slice(),)),
6975            ),
6976            self.tx_id,
6977            0x7ff1473165ed344b,
6978            fidl::encoding::DynamicFlags::FLEXIBLE,
6979        )
6980    }
6981}
6982
6983#[must_use = "FIDL methods require a response to be sent"]
6984#[derive(Debug)]
6985pub struct PacketStreamControlDeallocateVmosResponder {
6986    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
6987    tx_id: u32,
6988}
6989
6990/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
6991/// if the responder is dropped without sending a response, so that the client
6992/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6993impl std::ops::Drop for PacketStreamControlDeallocateVmosResponder {
6994    fn drop(&mut self) {
6995        self.control_handle.shutdown();
6996        // Safety: drops once, never accessed again
6997        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6998    }
6999}
7000
7001impl fdomain_client::fidl::Responder for PacketStreamControlDeallocateVmosResponder {
7002    type ControlHandle = PacketStreamControlControlHandle;
7003
7004    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7005        &self.control_handle
7006    }
7007
7008    fn drop_without_shutdown(mut self) {
7009        // Safety: drops once, never accessed again due to mem::forget
7010        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7011        // Prevent Drop from running (which would shut down the channel)
7012        std::mem::forget(self);
7013    }
7014}
7015
7016impl PacketStreamControlDeallocateVmosResponder {
7017    /// Sends a response to the FIDL transaction.
7018    ///
7019    /// Sets the channel to shutdown if an error occurs.
7020    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7021        let _result = self.send_raw(result);
7022        if _result.is_err() {
7023            self.control_handle.shutdown();
7024        }
7025        self.drop_without_shutdown();
7026        _result
7027    }
7028
7029    /// Similar to "send" but does not shutdown the channel if an error occurs.
7030    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7031        let _result = self.send_raw(result);
7032        self.drop_without_shutdown();
7033        _result
7034    }
7035
7036    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7037        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7038            fidl::encoding::EmptyStruct,
7039            i32,
7040        >>(
7041            fidl::encoding::FlexibleResult::new(result),
7042            self.tx_id,
7043            0x4db5cc85a7b8405b,
7044            fidl::encoding::DynamicFlags::FLEXIBLE,
7045        )
7046    }
7047}
7048
7049#[must_use = "FIDL methods require a response to be sent"]
7050#[derive(Debug)]
7051pub struct PacketStreamControlRegisterVmosResponder {
7052    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7053    tx_id: u32,
7054}
7055
7056/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7057/// if the responder is dropped without sending a response, so that the client
7058/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7059impl std::ops::Drop for PacketStreamControlRegisterVmosResponder {
7060    fn drop(&mut self) {
7061        self.control_handle.shutdown();
7062        // Safety: drops once, never accessed again
7063        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7064    }
7065}
7066
7067impl fdomain_client::fidl::Responder for PacketStreamControlRegisterVmosResponder {
7068    type ControlHandle = PacketStreamControlControlHandle;
7069
7070    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7071        &self.control_handle
7072    }
7073
7074    fn drop_without_shutdown(mut self) {
7075        // Safety: drops once, never accessed again due to mem::forget
7076        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7077        // Prevent Drop from running (which would shut down the channel)
7078        std::mem::forget(self);
7079    }
7080}
7081
7082impl PacketStreamControlRegisterVmosResponder {
7083    /// Sends a response to the FIDL transaction.
7084    ///
7085    /// Sets the channel to shutdown if an error occurs.
7086    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7087        let _result = self.send_raw(result);
7088        if _result.is_err() {
7089            self.control_handle.shutdown();
7090        }
7091        self.drop_without_shutdown();
7092        _result
7093    }
7094
7095    /// Similar to "send" but does not shutdown the channel if an error occurs.
7096    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7097        let _result = self.send_raw(result);
7098        self.drop_without_shutdown();
7099        _result
7100    }
7101
7102    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7103        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7104            fidl::encoding::EmptyStruct,
7105            i32,
7106        >>(
7107            fidl::encoding::FlexibleResult::new(result),
7108            self.tx_id,
7109            0x29c3b656a1020bfd,
7110            fidl::encoding::DynamicFlags::FLEXIBLE,
7111        )
7112    }
7113}
7114
7115#[must_use = "FIDL methods require a response to be sent"]
7116#[derive(Debug)]
7117pub struct PacketStreamControlUnregisterVmosResponder {
7118    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7119    tx_id: u32,
7120}
7121
7122/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7123/// if the responder is dropped without sending a response, so that the client
7124/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7125impl std::ops::Drop for PacketStreamControlUnregisterVmosResponder {
7126    fn drop(&mut self) {
7127        self.control_handle.shutdown();
7128        // Safety: drops once, never accessed again
7129        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7130    }
7131}
7132
7133impl fdomain_client::fidl::Responder for PacketStreamControlUnregisterVmosResponder {
7134    type ControlHandle = PacketStreamControlControlHandle;
7135
7136    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7137        &self.control_handle
7138    }
7139
7140    fn drop_without_shutdown(mut self) {
7141        // Safety: drops once, never accessed again due to mem::forget
7142        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7143        // Prevent Drop from running (which would shut down the channel)
7144        std::mem::forget(self);
7145    }
7146}
7147
7148impl PacketStreamControlUnregisterVmosResponder {
7149    /// Sends a response to the FIDL transaction.
7150    ///
7151    /// Sets the channel to shutdown if an error occurs.
7152    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7153        let _result = self.send_raw(result);
7154        if _result.is_err() {
7155            self.control_handle.shutdown();
7156        }
7157        self.drop_without_shutdown();
7158        _result
7159    }
7160
7161    /// Similar to "send" but does not shutdown the channel if an error occurs.
7162    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7163        let _result = self.send_raw(result);
7164        self.drop_without_shutdown();
7165        _result
7166    }
7167
7168    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7169        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7170            fidl::encoding::EmptyStruct,
7171            i32,
7172        >>(
7173            fidl::encoding::FlexibleResult::new(result),
7174            self.tx_id,
7175            0x3e3b4dbfe26b6094,
7176            fidl::encoding::DynamicFlags::FLEXIBLE,
7177        )
7178    }
7179}
7180
7181#[must_use = "FIDL methods require a response to be sent"]
7182#[derive(Debug)]
7183pub struct PacketStreamControlGetPacketStreamSinkResponder {
7184    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7185    tx_id: u32,
7186}
7187
7188/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7189/// if the responder is dropped without sending a response, so that the client
7190/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7191impl std::ops::Drop for PacketStreamControlGetPacketStreamSinkResponder {
7192    fn drop(&mut self) {
7193        self.control_handle.shutdown();
7194        // Safety: drops once, never accessed again
7195        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7196    }
7197}
7198
7199impl fdomain_client::fidl::Responder for PacketStreamControlGetPacketStreamSinkResponder {
7200    type ControlHandle = PacketStreamControlControlHandle;
7201
7202    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7203        &self.control_handle
7204    }
7205
7206    fn drop_without_shutdown(mut self) {
7207        // Safety: drops once, never accessed again due to mem::forget
7208        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7209        // Prevent Drop from running (which would shut down the channel)
7210        std::mem::forget(self);
7211    }
7212}
7213
7214impl PacketStreamControlGetPacketStreamSinkResponder {
7215    /// Sends a response to the FIDL transaction.
7216    ///
7217    /// Sets the channel to shutdown if an error occurs.
7218    pub fn send(
7219        self,
7220        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
7221    ) -> Result<(), fidl::Error> {
7222        let _result = self.send_raw(result);
7223        if _result.is_err() {
7224            self.control_handle.shutdown();
7225        }
7226        self.drop_without_shutdown();
7227        _result
7228    }
7229
7230    /// Similar to "send" but does not shutdown the channel if an error occurs.
7231    pub fn send_no_shutdown_on_err(
7232        self,
7233        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
7234    ) -> Result<(), fidl::Error> {
7235        let _result = self.send_raw(result);
7236        self.drop_without_shutdown();
7237        _result
7238    }
7239
7240    fn send_raw(
7241        &self,
7242        mut result: Result<PacketStreamControlGetPacketStreamSinkResponse, i32>,
7243    ) -> Result<(), fidl::Error> {
7244        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7245            PacketStreamControlGetPacketStreamSinkResponse,
7246            i32,
7247        >>(
7248            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
7249            self.tx_id,
7250            0x7394726463ebbc6a,
7251            fidl::encoding::DynamicFlags::FLEXIBLE,
7252        )
7253    }
7254}
7255
7256#[must_use = "FIDL methods require a response to be sent"]
7257#[derive(Debug)]
7258pub struct PacketStreamControlSetPacketStreamSinkResponder {
7259    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7260    tx_id: u32,
7261}
7262
7263/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7264/// if the responder is dropped without sending a response, so that the client
7265/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7266impl std::ops::Drop for PacketStreamControlSetPacketStreamSinkResponder {
7267    fn drop(&mut self) {
7268        self.control_handle.shutdown();
7269        // Safety: drops once, never accessed again
7270        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7271    }
7272}
7273
7274impl fdomain_client::fidl::Responder for PacketStreamControlSetPacketStreamSinkResponder {
7275    type ControlHandle = PacketStreamControlControlHandle;
7276
7277    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7278        &self.control_handle
7279    }
7280
7281    fn drop_without_shutdown(mut self) {
7282        // Safety: drops once, never accessed again due to mem::forget
7283        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7284        // Prevent Drop from running (which would shut down the channel)
7285        std::mem::forget(self);
7286    }
7287}
7288
7289impl PacketStreamControlSetPacketStreamSinkResponder {
7290    /// Sends a response to the FIDL transaction.
7291    ///
7292    /// Sets the channel to shutdown if an error occurs.
7293    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7294        let _result = self.send_raw(result);
7295        if _result.is_err() {
7296            self.control_handle.shutdown();
7297        }
7298        self.drop_without_shutdown();
7299        _result
7300    }
7301
7302    /// Similar to "send" but does not shutdown the channel if an error occurs.
7303    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7304        let _result = self.send_raw(result);
7305        self.drop_without_shutdown();
7306        _result
7307    }
7308
7309    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7310        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7311            fidl::encoding::EmptyStruct,
7312            i32,
7313        >>(
7314            fidl::encoding::FlexibleResult::new(result),
7315            self.tx_id,
7316            0xab88800e31dc0e4,
7317            fidl::encoding::DynamicFlags::FLEXIBLE,
7318        )
7319    }
7320}
7321
7322#[must_use = "FIDL methods require a response to be sent"]
7323#[derive(Debug)]
7324pub struct PacketStreamControlStartResponder {
7325    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7326    tx_id: u32,
7327}
7328
7329/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7330/// if the responder is dropped without sending a response, so that the client
7331/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7332impl std::ops::Drop for PacketStreamControlStartResponder {
7333    fn drop(&mut self) {
7334        self.control_handle.shutdown();
7335        // Safety: drops once, never accessed again
7336        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7337    }
7338}
7339
7340impl fdomain_client::fidl::Responder for PacketStreamControlStartResponder {
7341    type ControlHandle = PacketStreamControlControlHandle;
7342
7343    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7344        &self.control_handle
7345    }
7346
7347    fn drop_without_shutdown(mut self) {
7348        // Safety: drops once, never accessed again due to mem::forget
7349        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7350        // Prevent Drop from running (which would shut down the channel)
7351        std::mem::forget(self);
7352    }
7353}
7354
7355impl PacketStreamControlStartResponder {
7356    /// Sends a response to the FIDL transaction.
7357    ///
7358    /// Sets the channel to shutdown if an error occurs.
7359    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7360        let _result = self.send_raw(result);
7361        if _result.is_err() {
7362            self.control_handle.shutdown();
7363        }
7364        self.drop_without_shutdown();
7365        _result
7366    }
7367
7368    /// Similar to "send" but does not shutdown the channel if an error occurs.
7369    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7370        let _result = self.send_raw(result);
7371        self.drop_without_shutdown();
7372        _result
7373    }
7374
7375    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7376        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7377            fidl::encoding::EmptyStruct,
7378            i32,
7379        >>(
7380            fidl::encoding::FlexibleResult::new(result),
7381            self.tx_id,
7382            0x3a584b94d8a6bfd0,
7383            fidl::encoding::DynamicFlags::FLEXIBLE,
7384        )
7385    }
7386}
7387
7388#[must_use = "FIDL methods require a response to be sent"]
7389#[derive(Debug)]
7390pub struct PacketStreamControlStopResponder {
7391    control_handle: std::mem::ManuallyDrop<PacketStreamControlControlHandle>,
7392    tx_id: u32,
7393}
7394
7395/// Set the the channel to be shutdown (see [`PacketStreamControlControlHandle::shutdown`])
7396/// if the responder is dropped without sending a response, so that the client
7397/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7398impl std::ops::Drop for PacketStreamControlStopResponder {
7399    fn drop(&mut self) {
7400        self.control_handle.shutdown();
7401        // Safety: drops once, never accessed again
7402        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7403    }
7404}
7405
7406impl fdomain_client::fidl::Responder for PacketStreamControlStopResponder {
7407    type ControlHandle = PacketStreamControlControlHandle;
7408
7409    fn control_handle(&self) -> &PacketStreamControlControlHandle {
7410        &self.control_handle
7411    }
7412
7413    fn drop_without_shutdown(mut self) {
7414        // Safety: drops once, never accessed again due to mem::forget
7415        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7416        // Prevent Drop from running (which would shut down the channel)
7417        std::mem::forget(self);
7418    }
7419}
7420
7421impl PacketStreamControlStopResponder {
7422    /// Sends a response to the FIDL transaction.
7423    ///
7424    /// Sets the channel to shutdown if an error occurs.
7425    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7426        let _result = self.send_raw(result);
7427        if _result.is_err() {
7428            self.control_handle.shutdown();
7429        }
7430        self.drop_without_shutdown();
7431        _result
7432    }
7433
7434    /// Similar to "send" but does not shutdown the channel if an error occurs.
7435    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7436        let _result = self.send_raw(result);
7437        self.drop_without_shutdown();
7438        _result
7439    }
7440
7441    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7442        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7443            fidl::encoding::EmptyStruct,
7444            i32,
7445        >>(
7446            fidl::encoding::FlexibleResult::new(result),
7447            self.tx_id,
7448            0x703e4fafcdd7ef32,
7449            fidl::encoding::DynamicFlags::FLEXIBLE,
7450        )
7451    }
7452}
7453
7454#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7455pub struct PacketStreamSinkMarker;
7456
7457impl fdomain_client::fidl::ProtocolMarker for PacketStreamSinkMarker {
7458    type Proxy = PacketStreamSinkProxy;
7459    type RequestStream = PacketStreamSinkRequestStream;
7460
7461    const DEBUG_NAME: &'static str = "(anonymous) PacketStreamSink";
7462}
7463pub type PacketStreamSinkPutPacketResult = Result<PacketStreamSinkPutPacketResponse, i32>;
7464pub type PacketStreamSinkFlushPacketsResult = Result<(), i32>;
7465
7466pub trait PacketStreamSinkProxyInterface: Send + Sync {
7467    type PutPacketResponseFut: std::future::Future<Output = Result<PacketStreamSinkPutPacketResult, fidl::Error>>
7468        + Send;
7469    fn r#put_packet(&self, payload: PacketStreamSinkPutPacketRequest)
7470    -> Self::PutPacketResponseFut;
7471    type FlushPacketsResponseFut: std::future::Future<Output = Result<PacketStreamSinkFlushPacketsResult, fidl::Error>>
7472        + Send;
7473    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut;
7474}
7475
7476#[derive(Debug, Clone)]
7477pub struct PacketStreamSinkProxy {
7478    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
7479}
7480
7481impl fdomain_client::fidl::Proxy for PacketStreamSinkProxy {
7482    type Protocol = PacketStreamSinkMarker;
7483
7484    fn from_channel(inner: fdomain_client::Channel) -> Self {
7485        Self::new(inner)
7486    }
7487
7488    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
7489        self.client.into_channel().map_err(|client| Self { client })
7490    }
7491
7492    fn as_channel(&self) -> &fdomain_client::Channel {
7493        self.client.as_channel()
7494    }
7495}
7496
7497impl PacketStreamSinkProxy {
7498    /// Create a new Proxy for fuchsia.hardware.audio/PacketStreamSink.
7499    pub fn new(channel: fdomain_client::Channel) -> Self {
7500        let protocol_name =
7501            <PacketStreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
7502        Self { client: fidl::client::Client::new(channel, protocol_name) }
7503    }
7504
7505    /// Get a Stream of events from the remote end of the protocol.
7506    ///
7507    /// # Panics
7508    ///
7509    /// Panics if the event stream was already taken.
7510    pub fn take_event_stream(&self) -> PacketStreamSinkEventStream {
7511        PacketStreamSinkEventStream { event_receiver: self.client.take_event_receiver() }
7512    }
7513
7514    /// Submits a packet to be processed by the server.
7515    ///
7516    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
7517    /// Packets are processed in the order they were submitted. This call
7518    /// blocks until the payload is processed. When this call returns, the
7519    /// buffer region is guaranteed to be available for reuse.
7520    ///
7521    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
7522    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
7523    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
7524    /// * The payload is missing.
7525    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
7526    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
7527    ///   `DRIVER_OWNED`.
7528    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
7529    ///
7530    /// Note: The server is not required to detect if a VMO region is currently in use by a
7531    /// previous pending packet. Clients are responsible for managing buffer usage.
7532    pub fn r#put_packet(
7533        &self,
7534        mut payload: PacketStreamSinkPutPacketRequest,
7535    ) -> fidl::client::QueryResponseFut<
7536        PacketStreamSinkPutPacketResult,
7537        fdomain_client::fidl::FDomainResourceDialect,
7538    > {
7539        PacketStreamSinkProxyInterface::r#put_packet(self, payload)
7540    }
7541
7542    /// Flushes all packets currently pending without processing them.
7543    /// This call waits until all pending packets are completed or canceled.
7544    ///
7545    /// Note: A packet may be partially processed (e.g. if it contains multiple
7546    /// audio frames, or if the data does not align with encoded frame boundaries)
7547    /// before it is canceled.
7548    pub fn r#flush_packets(
7549        &self,
7550    ) -> fidl::client::QueryResponseFut<
7551        PacketStreamSinkFlushPacketsResult,
7552        fdomain_client::fidl::FDomainResourceDialect,
7553    > {
7554        PacketStreamSinkProxyInterface::r#flush_packets(self)
7555    }
7556}
7557
7558impl PacketStreamSinkProxyInterface for PacketStreamSinkProxy {
7559    type PutPacketResponseFut = fidl::client::QueryResponseFut<
7560        PacketStreamSinkPutPacketResult,
7561        fdomain_client::fidl::FDomainResourceDialect,
7562    >;
7563    fn r#put_packet(
7564        &self,
7565        mut payload: PacketStreamSinkPutPacketRequest,
7566    ) -> Self::PutPacketResponseFut {
7567        fn _decode(
7568            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7569        ) -> Result<PacketStreamSinkPutPacketResult, fidl::Error> {
7570            let _response = fidl::client::decode_transaction_body::<
7571                fidl::encoding::FlexibleResultType<PacketStreamSinkPutPacketResponse, i32>,
7572                fdomain_client::fidl::FDomainResourceDialect,
7573                0x25a8e35efba81f2b,
7574            >(_buf?)?
7575            .into_result_fdomain::<PacketStreamSinkMarker>("put_packet")?;
7576            Ok(_response.map(|x| x))
7577        }
7578        self.client.send_query_and_decode::<
7579            PacketStreamSinkPutPacketRequest,
7580            PacketStreamSinkPutPacketResult,
7581        >(
7582            &mut payload,
7583            0x25a8e35efba81f2b,
7584            fidl::encoding::DynamicFlags::FLEXIBLE,
7585            _decode,
7586        )
7587    }
7588
7589    type FlushPacketsResponseFut = fidl::client::QueryResponseFut<
7590        PacketStreamSinkFlushPacketsResult,
7591        fdomain_client::fidl::FDomainResourceDialect,
7592    >;
7593    fn r#flush_packets(&self) -> Self::FlushPacketsResponseFut {
7594        fn _decode(
7595            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7596        ) -> Result<PacketStreamSinkFlushPacketsResult, fidl::Error> {
7597            let _response = fidl::client::decode_transaction_body::<
7598                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7599                fdomain_client::fidl::FDomainResourceDialect,
7600                0x13f16ca37ede8a4,
7601            >(_buf?)?
7602            .into_result_fdomain::<PacketStreamSinkMarker>("flush_packets")?;
7603            Ok(_response.map(|x| x))
7604        }
7605        self.client.send_query_and_decode::<
7606            fidl::encoding::EmptyPayload,
7607            PacketStreamSinkFlushPacketsResult,
7608        >(
7609            (),
7610            0x13f16ca37ede8a4,
7611            fidl::encoding::DynamicFlags::FLEXIBLE,
7612            _decode,
7613        )
7614    }
7615}
7616
7617pub struct PacketStreamSinkEventStream {
7618    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
7619}
7620
7621impl std::marker::Unpin for PacketStreamSinkEventStream {}
7622
7623impl futures::stream::FusedStream for PacketStreamSinkEventStream {
7624    fn is_terminated(&self) -> bool {
7625        self.event_receiver.is_terminated()
7626    }
7627}
7628
7629impl futures::Stream for PacketStreamSinkEventStream {
7630    type Item = Result<PacketStreamSinkEvent, fidl::Error>;
7631
7632    fn poll_next(
7633        mut self: std::pin::Pin<&mut Self>,
7634        cx: &mut std::task::Context<'_>,
7635    ) -> std::task::Poll<Option<Self::Item>> {
7636        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7637            &mut self.event_receiver,
7638            cx
7639        )?) {
7640            Some(buf) => std::task::Poll::Ready(Some(PacketStreamSinkEvent::decode(buf))),
7641            None => std::task::Poll::Ready(None),
7642        }
7643    }
7644}
7645
7646#[derive(Debug)]
7647pub enum PacketStreamSinkEvent {
7648    #[non_exhaustive]
7649    _UnknownEvent {
7650        /// Ordinal of the event that was sent.
7651        ordinal: u64,
7652    },
7653}
7654
7655impl PacketStreamSinkEvent {
7656    /// Decodes a message buffer as a [`PacketStreamSinkEvent`].
7657    fn decode(
7658        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7659    ) -> Result<PacketStreamSinkEvent, fidl::Error> {
7660        let (bytes, _handles) = buf.split_mut();
7661        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7662        debug_assert_eq!(tx_header.tx_id, 0);
7663        match tx_header.ordinal {
7664            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7665                Ok(PacketStreamSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7666            }
7667            _ => Err(fidl::Error::UnknownOrdinal {
7668                ordinal: tx_header.ordinal,
7669                protocol_name:
7670                    <PacketStreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7671            }),
7672        }
7673    }
7674}
7675
7676/// A Stream of incoming requests for fuchsia.hardware.audio/PacketStreamSink.
7677pub struct PacketStreamSinkRequestStream {
7678    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7679    is_terminated: bool,
7680}
7681
7682impl std::marker::Unpin for PacketStreamSinkRequestStream {}
7683
7684impl futures::stream::FusedStream for PacketStreamSinkRequestStream {
7685    fn is_terminated(&self) -> bool {
7686        self.is_terminated
7687    }
7688}
7689
7690impl fdomain_client::fidl::RequestStream for PacketStreamSinkRequestStream {
7691    type Protocol = PacketStreamSinkMarker;
7692    type ControlHandle = PacketStreamSinkControlHandle;
7693
7694    fn from_channel(channel: fdomain_client::Channel) -> Self {
7695        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7696    }
7697
7698    fn control_handle(&self) -> Self::ControlHandle {
7699        PacketStreamSinkControlHandle { inner: self.inner.clone() }
7700    }
7701
7702    fn into_inner(
7703        self,
7704    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
7705    {
7706        (self.inner, self.is_terminated)
7707    }
7708
7709    fn from_inner(
7710        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7711        is_terminated: bool,
7712    ) -> Self {
7713        Self { inner, is_terminated }
7714    }
7715}
7716
7717impl futures::Stream for PacketStreamSinkRequestStream {
7718    type Item = Result<PacketStreamSinkRequest, fidl::Error>;
7719
7720    fn poll_next(
7721        mut self: std::pin::Pin<&mut Self>,
7722        cx: &mut std::task::Context<'_>,
7723    ) -> std::task::Poll<Option<Self::Item>> {
7724        let this = &mut *self;
7725        if this.inner.check_shutdown(cx) {
7726            this.is_terminated = true;
7727            return std::task::Poll::Ready(None);
7728        }
7729        if this.is_terminated {
7730            panic!("polled PacketStreamSinkRequestStream after completion");
7731        }
7732        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
7733            |bytes, handles| {
7734                match this.inner.channel().read_etc(cx, bytes, handles) {
7735                    std::task::Poll::Ready(Ok(())) => {}
7736                    std::task::Poll::Pending => return std::task::Poll::Pending,
7737                    std::task::Poll::Ready(Err(None)) => {
7738                        this.is_terminated = true;
7739                        return std::task::Poll::Ready(None);
7740                    }
7741                    std::task::Poll::Ready(Err(Some(e))) => {
7742                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7743                            e.into(),
7744                        ))));
7745                    }
7746                }
7747
7748                // A message has been received from the channel
7749                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7750
7751                std::task::Poll::Ready(Some(match header.ordinal {
7752                0x25a8e35efba81f2b => {
7753                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7754                    let mut req = fidl::new_empty!(PacketStreamSinkPutPacketRequest, fdomain_client::fidl::FDomainResourceDialect);
7755                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<PacketStreamSinkPutPacketRequest>(&header, _body_bytes, handles, &mut req)?;
7756                    let control_handle = PacketStreamSinkControlHandle {
7757                        inner: this.inner.clone(),
7758                    };
7759                    Ok(PacketStreamSinkRequest::PutPacket {payload: req,
7760                        responder: PacketStreamSinkPutPacketResponder {
7761                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7762                            tx_id: header.tx_id,
7763                        },
7764                    })
7765                }
7766                0x13f16ca37ede8a4 => {
7767                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7768                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
7769                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7770                    let control_handle = PacketStreamSinkControlHandle {
7771                        inner: this.inner.clone(),
7772                    };
7773                    Ok(PacketStreamSinkRequest::FlushPackets {
7774                        responder: PacketStreamSinkFlushPacketsResponder {
7775                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7776                            tx_id: header.tx_id,
7777                        },
7778                    })
7779                }
7780                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7781                    Ok(PacketStreamSinkRequest::_UnknownMethod {
7782                        ordinal: header.ordinal,
7783                        control_handle: PacketStreamSinkControlHandle { inner: this.inner.clone() },
7784                        method_type: fidl::MethodType::OneWay,
7785                    })
7786                }
7787                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7788                    this.inner.send_framework_err(
7789                        fidl::encoding::FrameworkErr::UnknownMethod,
7790                        header.tx_id,
7791                        header.ordinal,
7792                        header.dynamic_flags(),
7793                        (bytes, handles),
7794                    )?;
7795                    Ok(PacketStreamSinkRequest::_UnknownMethod {
7796                        ordinal: header.ordinal,
7797                        control_handle: PacketStreamSinkControlHandle { inner: this.inner.clone() },
7798                        method_type: fidl::MethodType::TwoWay,
7799                    })
7800                }
7801                _ => Err(fidl::Error::UnknownOrdinal {
7802                    ordinal: header.ordinal,
7803                    protocol_name: <PacketStreamSinkMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7804                }),
7805            }))
7806            },
7807        )
7808    }
7809}
7810
7811/// The protocol for streaming packet-based audio data.
7812/// This protocol functions as a data sink. The "server" of this protocol consumes packets,
7813/// and the "client" produces packets.
7814///
7815/// This protocol can be used in two directions:
7816/// 1. **Output (Client -> Driver)**: The Driver implements `PacketStreamSink`. The Client (App)
7817///    calls `PutPacket`.
7818/// 2. **Input (Driver -> Client)**: The Client (App) implements `PacketStreamSink`. The Driver
7819///    calls `PutPacket`.
7820#[derive(Debug)]
7821pub enum PacketStreamSinkRequest {
7822    /// Submits a packet to be processed by the server.
7823    ///
7824    /// The client may queue multiple packets by calling `PutPacket` repeatedly.
7825    /// Packets are processed in the order they were submitted. This call
7826    /// blocks until the payload is processed. When this call returns, the
7827    /// buffer region is guaranteed to be available for reuse.
7828    ///
7829    /// Returns `ZX_ERR_BAD_STATE` if the stream is not started or configured.
7830    /// Returns `ZX_ERR_CANCELED` if `FlushPackets` was called.
7831    /// Returns `ZX_ERR_INVALID_ARGS` if the packet is invalid. This includes:
7832    /// * The payload is missing.
7833    /// * `inline_data` is used but `supported_buffer_types` does not include `INLINE`.
7834    /// * `vmo_transfer` is used but `supported_buffer_types` does not include `CLIENT_OWNED` or
7835    ///   `DRIVER_OWNED`.
7836    /// * `vmo_id` is unrecognized, or `vmo_offset` + `payload_size` exceeds the VMO size.
7837    ///
7838    /// Note: The server is not required to detect if a VMO region is currently in use by a
7839    /// previous pending packet. Clients are responsible for managing buffer usage.
7840    PutPacket {
7841        payload: PacketStreamSinkPutPacketRequest,
7842        responder: PacketStreamSinkPutPacketResponder,
7843    },
7844    /// Flushes all packets currently pending without processing them.
7845    /// This call waits until all pending packets are completed or canceled.
7846    ///
7847    /// Note: A packet may be partially processed (e.g. if it contains multiple
7848    /// audio frames, or if the data does not align with encoded frame boundaries)
7849    /// before it is canceled.
7850    FlushPackets { responder: PacketStreamSinkFlushPacketsResponder },
7851    /// An interaction was received which does not match any known method.
7852    #[non_exhaustive]
7853    _UnknownMethod {
7854        /// Ordinal of the method that was called.
7855        ordinal: u64,
7856        control_handle: PacketStreamSinkControlHandle,
7857        method_type: fidl::MethodType,
7858    },
7859}
7860
7861impl PacketStreamSinkRequest {
7862    #[allow(irrefutable_let_patterns)]
7863    pub fn into_put_packet(
7864        self,
7865    ) -> Option<(PacketStreamSinkPutPacketRequest, PacketStreamSinkPutPacketResponder)> {
7866        if let PacketStreamSinkRequest::PutPacket { payload, responder } = self {
7867            Some((payload, responder))
7868        } else {
7869            None
7870        }
7871    }
7872
7873    #[allow(irrefutable_let_patterns)]
7874    pub fn into_flush_packets(self) -> Option<(PacketStreamSinkFlushPacketsResponder)> {
7875        if let PacketStreamSinkRequest::FlushPackets { responder } = self {
7876            Some((responder))
7877        } else {
7878            None
7879        }
7880    }
7881
7882    /// Name of the method defined in FIDL
7883    pub fn method_name(&self) -> &'static str {
7884        match *self {
7885            PacketStreamSinkRequest::PutPacket { .. } => "put_packet",
7886            PacketStreamSinkRequest::FlushPackets { .. } => "flush_packets",
7887            PacketStreamSinkRequest::_UnknownMethod {
7888                method_type: fidl::MethodType::OneWay,
7889                ..
7890            } => "unknown one-way method",
7891            PacketStreamSinkRequest::_UnknownMethod {
7892                method_type: fidl::MethodType::TwoWay,
7893                ..
7894            } => "unknown two-way method",
7895        }
7896    }
7897}
7898
7899#[derive(Debug, Clone)]
7900pub struct PacketStreamSinkControlHandle {
7901    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7902}
7903
7904impl PacketStreamSinkControlHandle {
7905    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7906        self.inner.shutdown_with_epitaph(status.into())
7907    }
7908}
7909
7910impl fdomain_client::fidl::ControlHandle for PacketStreamSinkControlHandle {
7911    fn shutdown(&self) {
7912        self.inner.shutdown()
7913    }
7914
7915    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7916        self.inner.shutdown_with_epitaph(status)
7917    }
7918
7919    fn is_closed(&self) -> bool {
7920        self.inner.channel().is_closed()
7921    }
7922    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
7923        self.inner.channel().on_closed()
7924    }
7925}
7926
7927impl PacketStreamSinkControlHandle {}
7928
7929#[must_use = "FIDL methods require a response to be sent"]
7930#[derive(Debug)]
7931pub struct PacketStreamSinkPutPacketResponder {
7932    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
7933    tx_id: u32,
7934}
7935
7936/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
7937/// if the responder is dropped without sending a response, so that the client
7938/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7939impl std::ops::Drop for PacketStreamSinkPutPacketResponder {
7940    fn drop(&mut self) {
7941        self.control_handle.shutdown();
7942        // Safety: drops once, never accessed again
7943        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7944    }
7945}
7946
7947impl fdomain_client::fidl::Responder for PacketStreamSinkPutPacketResponder {
7948    type ControlHandle = PacketStreamSinkControlHandle;
7949
7950    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
7951        &self.control_handle
7952    }
7953
7954    fn drop_without_shutdown(mut self) {
7955        // Safety: drops once, never accessed again due to mem::forget
7956        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7957        // Prevent Drop from running (which would shut down the channel)
7958        std::mem::forget(self);
7959    }
7960}
7961
7962impl PacketStreamSinkPutPacketResponder {
7963    /// Sends a response to the FIDL transaction.
7964    ///
7965    /// Sets the channel to shutdown if an error occurs.
7966    pub fn send(
7967        self,
7968        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
7969    ) -> Result<(), fidl::Error> {
7970        let _result = self.send_raw(result);
7971        if _result.is_err() {
7972            self.control_handle.shutdown();
7973        }
7974        self.drop_without_shutdown();
7975        _result
7976    }
7977
7978    /// Similar to "send" but does not shutdown the channel if an error occurs.
7979    pub fn send_no_shutdown_on_err(
7980        self,
7981        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
7982    ) -> Result<(), fidl::Error> {
7983        let _result = self.send_raw(result);
7984        self.drop_without_shutdown();
7985        _result
7986    }
7987
7988    fn send_raw(
7989        &self,
7990        mut result: Result<&PacketStreamSinkPutPacketResponse, i32>,
7991    ) -> Result<(), fidl::Error> {
7992        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7993            PacketStreamSinkPutPacketResponse,
7994            i32,
7995        >>(
7996            fidl::encoding::FlexibleResult::new(result),
7997            self.tx_id,
7998            0x25a8e35efba81f2b,
7999            fidl::encoding::DynamicFlags::FLEXIBLE,
8000        )
8001    }
8002}
8003
8004#[must_use = "FIDL methods require a response to be sent"]
8005#[derive(Debug)]
8006pub struct PacketStreamSinkFlushPacketsResponder {
8007    control_handle: std::mem::ManuallyDrop<PacketStreamSinkControlHandle>,
8008    tx_id: u32,
8009}
8010
8011/// Set the the channel to be shutdown (see [`PacketStreamSinkControlHandle::shutdown`])
8012/// if the responder is dropped without sending a response, so that the client
8013/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8014impl std::ops::Drop for PacketStreamSinkFlushPacketsResponder {
8015    fn drop(&mut self) {
8016        self.control_handle.shutdown();
8017        // Safety: drops once, never accessed again
8018        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8019    }
8020}
8021
8022impl fdomain_client::fidl::Responder for PacketStreamSinkFlushPacketsResponder {
8023    type ControlHandle = PacketStreamSinkControlHandle;
8024
8025    fn control_handle(&self) -> &PacketStreamSinkControlHandle {
8026        &self.control_handle
8027    }
8028
8029    fn drop_without_shutdown(mut self) {
8030        // Safety: drops once, never accessed again due to mem::forget
8031        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8032        // Prevent Drop from running (which would shut down the channel)
8033        std::mem::forget(self);
8034    }
8035}
8036
8037impl PacketStreamSinkFlushPacketsResponder {
8038    /// Sends a response to the FIDL transaction.
8039    ///
8040    /// Sets the channel to shutdown if an error occurs.
8041    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8042        let _result = self.send_raw(result);
8043        if _result.is_err() {
8044            self.control_handle.shutdown();
8045        }
8046        self.drop_without_shutdown();
8047        _result
8048    }
8049
8050    /// Similar to "send" but does not shutdown the channel if an error occurs.
8051    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8052        let _result = self.send_raw(result);
8053        self.drop_without_shutdown();
8054        _result
8055    }
8056
8057    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8058        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8059            fidl::encoding::EmptyStruct,
8060            i32,
8061        >>(
8062            fidl::encoding::FlexibleResult::new(result),
8063            self.tx_id,
8064            0x13f16ca37ede8a4,
8065            fidl::encoding::DynamicFlags::FLEXIBLE,
8066        )
8067    }
8068}
8069
8070#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8071pub struct RingBufferMarker;
8072
8073impl fdomain_client::fidl::ProtocolMarker for RingBufferMarker {
8074    type Proxy = RingBufferProxy;
8075    type RequestStream = RingBufferRequestStream;
8076
8077    const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
8078}
8079pub type RingBufferGetVmoResult = Result<(u32, fdomain_client::Vmo), GetVmoError>;
8080pub type RingBufferSetActiveChannelsResult = Result<i64, i32>;
8081
8082pub trait RingBufferProxyInterface: Send + Sync {
8083    type GetPropertiesResponseFut: std::future::Future<Output = Result<RingBufferProperties, fidl::Error>>
8084        + Send;
8085    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
8086    type WatchClockRecoveryPositionInfoResponseFut: std::future::Future<Output = Result<RingBufferPositionInfo, fidl::Error>>
8087        + Send;
8088    fn r#watch_clock_recovery_position_info(
8089        &self,
8090    ) -> Self::WatchClockRecoveryPositionInfoResponseFut;
8091    type GetVmoResponseFut: std::future::Future<Output = Result<RingBufferGetVmoResult, fidl::Error>>
8092        + Send;
8093    fn r#get_vmo(
8094        &self,
8095        min_frames: u32,
8096        clock_recovery_notifications_per_ring: u32,
8097    ) -> Self::GetVmoResponseFut;
8098    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
8099    fn r#start(&self) -> Self::StartResponseFut;
8100    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
8101    fn r#stop(&self) -> Self::StopResponseFut;
8102    type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
8103        + Send;
8104    fn r#set_active_channels(
8105        &self,
8106        active_channels_bitmask: u64,
8107    ) -> Self::SetActiveChannelsResponseFut;
8108    type WatchDelayInfoResponseFut: std::future::Future<Output = Result<DelayInfo, fidl::Error>>
8109        + Send;
8110    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
8111}
8112
8113#[derive(Debug, Clone)]
8114pub struct RingBufferProxy {
8115    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
8116}
8117
8118impl fdomain_client::fidl::Proxy for RingBufferProxy {
8119    type Protocol = RingBufferMarker;
8120
8121    fn from_channel(inner: fdomain_client::Channel) -> Self {
8122        Self::new(inner)
8123    }
8124
8125    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
8126        self.client.into_channel().map_err(|client| Self { client })
8127    }
8128
8129    fn as_channel(&self) -> &fdomain_client::Channel {
8130        self.client.as_channel()
8131    }
8132}
8133
8134impl RingBufferProxy {
8135    /// Create a new Proxy for fuchsia.hardware.audio/RingBuffer.
8136    pub fn new(channel: fdomain_client::Channel) -> Self {
8137        let protocol_name = <RingBufferMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
8138        Self { client: fidl::client::Client::new(channel, protocol_name) }
8139    }
8140
8141    /// Get a Stream of events from the remote end of the protocol.
8142    ///
8143    /// # Panics
8144    ///
8145    /// Panics if the event stream was already taken.
8146    pub fn take_event_stream(&self) -> RingBufferEventStream {
8147        RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
8148    }
8149
8150    /// Accessor for top level static properties.
8151    pub fn r#get_properties(
8152        &self,
8153    ) -> fidl::client::QueryResponseFut<
8154        RingBufferProperties,
8155        fdomain_client::fidl::FDomainResourceDialect,
8156    > {
8157        RingBufferProxyInterface::r#get_properties(self)
8158    }
8159
8160    /// Gets the ring buffer current position via a hanging get.
8161    ///
8162    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
8163    /// `clock_recovery_notifications_per_ring` was specified.
8164    ///
8165    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
8166    /// not respond to subsequent client calls until the position information has changed from what
8167    /// was most recently provided to that client.
8168    ///
8169    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
8170    /// to the `Start` command.
8171    ///
8172    /// At the `start_time` returned by `Start`, position is always 0. From there, it
8173    /// progresses at the rate specified by the rate, sample format (and clock domain,
8174    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
8175    ///
8176    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
8177    /// estimated position to be used for clock recovery at most at
8178    /// `clock_recovery_notifications_per_ring` frequency.
8179    ///
8180    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
8181    /// increasing.
8182    ///
8183    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
8184    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
8185    pub fn r#watch_clock_recovery_position_info(
8186        &self,
8187    ) -> fidl::client::QueryResponseFut<
8188        RingBufferPositionInfo,
8189        fdomain_client::fidl::FDomainResourceDialect,
8190    > {
8191        RingBufferProxyInterface::r#watch_clock_recovery_position_info(self)
8192    }
8193
8194    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
8195    ///
8196    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
8197    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
8198    ///
8199    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
8200    /// that ring buffer contents can be transfered in and out, or else the call must be failed
8201    /// with GetVmoError.INVALID_ARGS.
8202    ///
8203    /// The driver may increase the ring buffer size beyond `min_frames` plus
8204    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
8205    /// alignment.
8206    ///
8207    /// Clients can treat the entire returned ring buffer as safe to access, except for the
8208    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
8209    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
8210    ///
8211    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8212    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
8213    /// handle must also include ZX_RIGHT_WRITE.
8214    ///
8215    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
8216    /// `WatchClockRecoveryPositionInfo` client requests at most at
8217    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
8218    /// for clock recovery.
8219    pub fn r#get_vmo(
8220        &self,
8221        mut min_frames: u32,
8222        mut clock_recovery_notifications_per_ring: u32,
8223    ) -> fidl::client::QueryResponseFut<
8224        RingBufferGetVmoResult,
8225        fdomain_client::fidl::FDomainResourceDialect,
8226    > {
8227        RingBufferProxyInterface::r#get_vmo(self, min_frames, clock_recovery_notifications_per_ring)
8228    }
8229
8230    /// Start the ring buffer.
8231    ///
8232    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
8233    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
8234    /// write from or to the ring buffer position 0, subject to the overall position and buffering
8235    /// behavior described in 'Ring buffer behavior' below.
8236    ///
8237    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8238    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
8239    /// a second time before the first call has completed, then the channel must be closed with an
8240    /// error `ZX_ERR_BAD_STATE` returned.
8241    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
8242    pub fn r#start(
8243        &self,
8244    ) -> fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect> {
8245        RingBufferProxyInterface::r#start(self)
8246    }
8247
8248    /// Stop the ring buffer.
8249    ///
8250    /// Once this call's response is received, no further position notifications will be sent until
8251    /// `Start` is called again.
8252    ///
8253    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8254    pub fn r#stop(
8255        &self,
8256    ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
8257        RingBufferProxyInterface::r#stop(self)
8258    }
8259
8260    /// Sets which channels are active via a bitmask.
8261    ///
8262    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
8263    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
8264    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
8265    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
8266    /// turns on the hardware associated for all channels.
8267    ///
8268    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
8269    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
8270    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
8271    ///
8272    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
8273    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
8274    /// buffer's position advances (and position notifications sent as needed) regardless of the
8275    /// number of active channels, including if no channels are active. This means that the format
8276    /// in the ring buffer is not changed.
8277    ///
8278    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
8279    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
8280    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
8281    ///
8282    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
8283    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
8284    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
8285    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
8286    /// hardware configuration was completed. If the requested channel configuration is already
8287    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
8288    /// before the reply is sent. If called again with the same configuration, the reply must
8289    /// include the same `set_time` value as was previously returned.
8290    ///
8291    /// For input channels, it is not required that the driver zero-out inactive channels.
8292    ///
8293    /// If `SetActiveChannels` is called for a second time before the first call has completed,
8294    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8295    pub fn r#set_active_channels(
8296        &self,
8297        mut active_channels_bitmask: u64,
8298    ) -> fidl::client::QueryResponseFut<
8299        RingBufferSetActiveChannelsResult,
8300        fdomain_client::fidl::FDomainResourceDialect,
8301    > {
8302        RingBufferProxyInterface::r#set_active_channels(self, active_channels_bitmask)
8303    }
8304
8305    /// Get information about delays via a hanging get.
8306    ///
8307    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
8308    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
8309    /// changes from what was most recently reported.
8310    ///
8311    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
8312    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8313    pub fn r#watch_delay_info(
8314        &self,
8315    ) -> fidl::client::QueryResponseFut<DelayInfo, fdomain_client::fidl::FDomainResourceDialect>
8316    {
8317        RingBufferProxyInterface::r#watch_delay_info(self)
8318    }
8319}
8320
8321impl RingBufferProxyInterface for RingBufferProxy {
8322    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
8323        RingBufferProperties,
8324        fdomain_client::fidl::FDomainResourceDialect,
8325    >;
8326    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
8327        fn _decode(
8328            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8329        ) -> Result<RingBufferProperties, fidl::Error> {
8330            let _response = fidl::client::decode_transaction_body::<
8331                RingBufferGetPropertiesResponse,
8332                fdomain_client::fidl::FDomainResourceDialect,
8333                0x12947f061a8fe1,
8334            >(_buf?)?;
8335            Ok(_response.properties)
8336        }
8337        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferProperties>(
8338            (),
8339            0x12947f061a8fe1,
8340            fidl::encoding::DynamicFlags::empty(),
8341            _decode,
8342        )
8343    }
8344
8345    type WatchClockRecoveryPositionInfoResponseFut = fidl::client::QueryResponseFut<
8346        RingBufferPositionInfo,
8347        fdomain_client::fidl::FDomainResourceDialect,
8348    >;
8349    fn r#watch_clock_recovery_position_info(
8350        &self,
8351    ) -> Self::WatchClockRecoveryPositionInfoResponseFut {
8352        fn _decode(
8353            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8354        ) -> Result<RingBufferPositionInfo, fidl::Error> {
8355            let _response = fidl::client::decode_transaction_body::<
8356                RingBufferWatchClockRecoveryPositionInfoResponse,
8357                fdomain_client::fidl::FDomainResourceDialect,
8358                0x694d5b898a4167e5,
8359            >(_buf?)?;
8360            Ok(_response.position_info)
8361        }
8362        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferPositionInfo>(
8363            (),
8364            0x694d5b898a4167e5,
8365            fidl::encoding::DynamicFlags::empty(),
8366            _decode,
8367        )
8368    }
8369
8370    type GetVmoResponseFut = fidl::client::QueryResponseFut<
8371        RingBufferGetVmoResult,
8372        fdomain_client::fidl::FDomainResourceDialect,
8373    >;
8374    fn r#get_vmo(
8375        &self,
8376        mut min_frames: u32,
8377        mut clock_recovery_notifications_per_ring: u32,
8378    ) -> Self::GetVmoResponseFut {
8379        fn _decode(
8380            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8381        ) -> Result<RingBufferGetVmoResult, fidl::Error> {
8382            let _response = fidl::client::decode_transaction_body::<
8383                fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
8384                fdomain_client::fidl::FDomainResourceDialect,
8385                0x44c8f4f5680e853a,
8386            >(_buf?)?;
8387            Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
8388        }
8389        self.client.send_query_and_decode::<RingBufferGetVmoRequest, RingBufferGetVmoResult>(
8390            (min_frames, clock_recovery_notifications_per_ring),
8391            0x44c8f4f5680e853a,
8392            fidl::encoding::DynamicFlags::empty(),
8393            _decode,
8394        )
8395    }
8396
8397    type StartResponseFut =
8398        fidl::client::QueryResponseFut<i64, fdomain_client::fidl::FDomainResourceDialect>;
8399    fn r#start(&self) -> Self::StartResponseFut {
8400        fn _decode(
8401            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8402        ) -> Result<i64, fidl::Error> {
8403            let _response = fidl::client::decode_transaction_body::<
8404                RingBufferStartResponse,
8405                fdomain_client::fidl::FDomainResourceDialect,
8406                0x5dd780a769a8892d,
8407            >(_buf?)?;
8408            Ok(_response.start_time)
8409        }
8410        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
8411            (),
8412            0x5dd780a769a8892d,
8413            fidl::encoding::DynamicFlags::empty(),
8414            _decode,
8415        )
8416    }
8417
8418    type StopResponseFut =
8419        fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
8420    fn r#stop(&self) -> Self::StopResponseFut {
8421        fn _decode(
8422            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8423        ) -> Result<(), fidl::Error> {
8424            let _response = fidl::client::decode_transaction_body::<
8425                fidl::encoding::EmptyPayload,
8426                fdomain_client::fidl::FDomainResourceDialect,
8427                0x49a73d9cf1d4e110,
8428            >(_buf?)?;
8429            Ok(_response)
8430        }
8431        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
8432            (),
8433            0x49a73d9cf1d4e110,
8434            fidl::encoding::DynamicFlags::empty(),
8435            _decode,
8436        )
8437    }
8438
8439    type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
8440        RingBufferSetActiveChannelsResult,
8441        fdomain_client::fidl::FDomainResourceDialect,
8442    >;
8443    fn r#set_active_channels(
8444        &self,
8445        mut active_channels_bitmask: u64,
8446    ) -> Self::SetActiveChannelsResponseFut {
8447        fn _decode(
8448            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8449        ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
8450            let _response = fidl::client::decode_transaction_body::<
8451                fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
8452                fdomain_client::fidl::FDomainResourceDialect,
8453                0x605464c1d384f309,
8454            >(_buf?)?;
8455            Ok(_response.map(|x| x.set_time))
8456        }
8457        self.client.send_query_and_decode::<
8458            RingBufferSetActiveChannelsRequest,
8459            RingBufferSetActiveChannelsResult,
8460        >(
8461            (active_channels_bitmask,),
8462            0x605464c1d384f309,
8463            fidl::encoding::DynamicFlags::empty(),
8464            _decode,
8465        )
8466    }
8467
8468    type WatchDelayInfoResponseFut =
8469        fidl::client::QueryResponseFut<DelayInfo, fdomain_client::fidl::FDomainResourceDialect>;
8470    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
8471        fn _decode(
8472            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8473        ) -> Result<DelayInfo, fidl::Error> {
8474            let _response = fidl::client::decode_transaction_body::<
8475                fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
8476                fdomain_client::fidl::FDomainResourceDialect,
8477                0x6c1248db213fcf9f,
8478            >(_buf?)?
8479            .into_result_fdomain::<RingBufferMarker>("watch_delay_info")?;
8480            Ok(_response.delay_info)
8481        }
8482        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelayInfo>(
8483            (),
8484            0x6c1248db213fcf9f,
8485            fidl::encoding::DynamicFlags::FLEXIBLE,
8486            _decode,
8487        )
8488    }
8489}
8490
8491pub struct RingBufferEventStream {
8492    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
8493}
8494
8495impl std::marker::Unpin for RingBufferEventStream {}
8496
8497impl futures::stream::FusedStream for RingBufferEventStream {
8498    fn is_terminated(&self) -> bool {
8499        self.event_receiver.is_terminated()
8500    }
8501}
8502
8503impl futures::Stream for RingBufferEventStream {
8504    type Item = Result<RingBufferEvent, fidl::Error>;
8505
8506    fn poll_next(
8507        mut self: std::pin::Pin<&mut Self>,
8508        cx: &mut std::task::Context<'_>,
8509    ) -> std::task::Poll<Option<Self::Item>> {
8510        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8511            &mut self.event_receiver,
8512            cx
8513        )?) {
8514            Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
8515            None => std::task::Poll::Ready(None),
8516        }
8517    }
8518}
8519
8520#[derive(Debug)]
8521pub enum RingBufferEvent {
8522    #[non_exhaustive]
8523    _UnknownEvent {
8524        /// Ordinal of the event that was sent.
8525        ordinal: u64,
8526    },
8527}
8528
8529impl RingBufferEvent {
8530    /// Decodes a message buffer as a [`RingBufferEvent`].
8531    fn decode(
8532        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8533    ) -> Result<RingBufferEvent, fidl::Error> {
8534        let (bytes, _handles) = buf.split_mut();
8535        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8536        debug_assert_eq!(tx_header.tx_id, 0);
8537        match tx_header.ordinal {
8538            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8539                Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
8540            }
8541            _ => Err(fidl::Error::UnknownOrdinal {
8542                ordinal: tx_header.ordinal,
8543                protocol_name:
8544                    <RingBufferMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
8545            }),
8546        }
8547    }
8548}
8549
8550/// A Stream of incoming requests for fuchsia.hardware.audio/RingBuffer.
8551pub struct RingBufferRequestStream {
8552    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
8553    is_terminated: bool,
8554}
8555
8556impl std::marker::Unpin for RingBufferRequestStream {}
8557
8558impl futures::stream::FusedStream for RingBufferRequestStream {
8559    fn is_terminated(&self) -> bool {
8560        self.is_terminated
8561    }
8562}
8563
8564impl fdomain_client::fidl::RequestStream for RingBufferRequestStream {
8565    type Protocol = RingBufferMarker;
8566    type ControlHandle = RingBufferControlHandle;
8567
8568    fn from_channel(channel: fdomain_client::Channel) -> Self {
8569        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8570    }
8571
8572    fn control_handle(&self) -> Self::ControlHandle {
8573        RingBufferControlHandle { inner: self.inner.clone() }
8574    }
8575
8576    fn into_inner(
8577        self,
8578    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
8579    {
8580        (self.inner, self.is_terminated)
8581    }
8582
8583    fn from_inner(
8584        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
8585        is_terminated: bool,
8586    ) -> Self {
8587        Self { inner, is_terminated }
8588    }
8589}
8590
8591impl futures::Stream for RingBufferRequestStream {
8592    type Item = Result<RingBufferRequest, fidl::Error>;
8593
8594    fn poll_next(
8595        mut self: std::pin::Pin<&mut Self>,
8596        cx: &mut std::task::Context<'_>,
8597    ) -> std::task::Poll<Option<Self::Item>> {
8598        let this = &mut *self;
8599        if this.inner.check_shutdown(cx) {
8600            this.is_terminated = true;
8601            return std::task::Poll::Ready(None);
8602        }
8603        if this.is_terminated {
8604            panic!("polled RingBufferRequestStream after completion");
8605        }
8606        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
8607            |bytes, handles| {
8608                match this.inner.channel().read_etc(cx, bytes, handles) {
8609                    std::task::Poll::Ready(Ok(())) => {}
8610                    std::task::Poll::Pending => return std::task::Poll::Pending,
8611                    std::task::Poll::Ready(Err(None)) => {
8612                        this.is_terminated = true;
8613                        return std::task::Poll::Ready(None);
8614                    }
8615                    std::task::Poll::Ready(Err(Some(e))) => {
8616                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8617                            e.into(),
8618                        ))));
8619                    }
8620                }
8621
8622                // A message has been received from the channel
8623                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8624
8625                std::task::Poll::Ready(Some(match header.ordinal {
8626                    0x12947f061a8fe1 => {
8627                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8628                        let mut req = fidl::new_empty!(
8629                            fidl::encoding::EmptyPayload,
8630                            fdomain_client::fidl::FDomainResourceDialect
8631                        );
8632                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8633                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8634                        Ok(RingBufferRequest::GetProperties {
8635                            responder: RingBufferGetPropertiesResponder {
8636                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8637                                tx_id: header.tx_id,
8638                            },
8639                        })
8640                    }
8641                    0x694d5b898a4167e5 => {
8642                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8643                        let mut req = fidl::new_empty!(
8644                            fidl::encoding::EmptyPayload,
8645                            fdomain_client::fidl::FDomainResourceDialect
8646                        );
8647                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8648                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8649                        Ok(RingBufferRequest::WatchClockRecoveryPositionInfo {
8650                            responder: RingBufferWatchClockRecoveryPositionInfoResponder {
8651                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8652                                tx_id: header.tx_id,
8653                            },
8654                        })
8655                    }
8656                    0x44c8f4f5680e853a => {
8657                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8658                        let mut req = fidl::new_empty!(
8659                            RingBufferGetVmoRequest,
8660                            fdomain_client::fidl::FDomainResourceDialect
8661                        );
8662                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RingBufferGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
8663                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8664                        Ok(RingBufferRequest::GetVmo {
8665                            min_frames: req.min_frames,
8666                            clock_recovery_notifications_per_ring: req
8667                                .clock_recovery_notifications_per_ring,
8668
8669                            responder: RingBufferGetVmoResponder {
8670                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8671                                tx_id: header.tx_id,
8672                            },
8673                        })
8674                    }
8675                    0x5dd780a769a8892d => {
8676                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8677                        let mut req = fidl::new_empty!(
8678                            fidl::encoding::EmptyPayload,
8679                            fdomain_client::fidl::FDomainResourceDialect
8680                        );
8681                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8682                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8683                        Ok(RingBufferRequest::Start {
8684                            responder: RingBufferStartResponder {
8685                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8686                                tx_id: header.tx_id,
8687                            },
8688                        })
8689                    }
8690                    0x49a73d9cf1d4e110 => {
8691                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8692                        let mut req = fidl::new_empty!(
8693                            fidl::encoding::EmptyPayload,
8694                            fdomain_client::fidl::FDomainResourceDialect
8695                        );
8696                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8697                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8698                        Ok(RingBufferRequest::Stop {
8699                            responder: RingBufferStopResponder {
8700                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8701                                tx_id: header.tx_id,
8702                            },
8703                        })
8704                    }
8705                    0x605464c1d384f309 => {
8706                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8707                        let mut req = fidl::new_empty!(
8708                            RingBufferSetActiveChannelsRequest,
8709                            fdomain_client::fidl::FDomainResourceDialect
8710                        );
8711                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
8712                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8713                        Ok(RingBufferRequest::SetActiveChannels {
8714                            active_channels_bitmask: req.active_channels_bitmask,
8715
8716                            responder: RingBufferSetActiveChannelsResponder {
8717                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8718                                tx_id: header.tx_id,
8719                            },
8720                        })
8721                    }
8722                    0x6c1248db213fcf9f => {
8723                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8724                        let mut req = fidl::new_empty!(
8725                            fidl::encoding::EmptyPayload,
8726                            fdomain_client::fidl::FDomainResourceDialect
8727                        );
8728                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8729                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
8730                        Ok(RingBufferRequest::WatchDelayInfo {
8731                            responder: RingBufferWatchDelayInfoResponder {
8732                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8733                                tx_id: header.tx_id,
8734                            },
8735                        })
8736                    }
8737                    _ if header.tx_id == 0
8738                        && header
8739                            .dynamic_flags()
8740                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8741                    {
8742                        Ok(RingBufferRequest::_UnknownMethod {
8743                            ordinal: header.ordinal,
8744                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
8745                            method_type: fidl::MethodType::OneWay,
8746                        })
8747                    }
8748                    _ if header
8749                        .dynamic_flags()
8750                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8751                    {
8752                        this.inner.send_framework_err(
8753                            fidl::encoding::FrameworkErr::UnknownMethod,
8754                            header.tx_id,
8755                            header.ordinal,
8756                            header.dynamic_flags(),
8757                            (bytes, handles),
8758                        )?;
8759                        Ok(RingBufferRequest::_UnknownMethod {
8760                            ordinal: header.ordinal,
8761                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
8762                            method_type: fidl::MethodType::TwoWay,
8763                        })
8764                    }
8765                    _ => Err(fidl::Error::UnknownOrdinal {
8766                        ordinal: header.ordinal,
8767                        protocol_name:
8768                            <RingBufferMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
8769                    }),
8770                }))
8771            },
8772        )
8773    }
8774}
8775
8776/// Ring buffers are used to convey audio between parties (usually in different processes), allowing
8777/// concurrent, asynchronous data access without requiring locks. This pattern works because both
8778/// parties share an understanding of which buffer areas are safe to access, and how those areas
8779/// change over time.
8780///
8781/// For in-depth description of the responsibilities for both _producers_ and _consumers_,
8782/// before the ring buffer is started as well as while it is active, please see
8783/// [Ring Buffer Behavior](https://fuchsia.dev/fuchsia-src/development/audio/ring_buffer.md).
8784#[derive(Debug)]
8785pub enum RingBufferRequest {
8786    /// Accessor for top level static properties.
8787    GetProperties { responder: RingBufferGetPropertiesResponder },
8788    /// Gets the ring buffer current position via a hanging get.
8789    ///
8790    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, where a
8791    /// `clock_recovery_notifications_per_ring` was specified.
8792    ///
8793    /// The driver must respond to a client's first `WatchClockRecoveryPositionInfo` call, but will
8794    /// not respond to subsequent client calls until the position information has changed from what
8795    /// was most recently provided to that client.
8796    ///
8797    /// The driver must not respond to a `WatchClockRecoveryPositionInfo` until after it has replied
8798    /// to the `Start` command.
8799    ///
8800    /// At the `start_time` returned by `Start`, position is always 0. From there, it
8801    /// progresses at the rate specified by the rate, sample format (and clock domain,
8802    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
8803    ///
8804    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
8805    /// estimated position to be used for clock recovery at most at
8806    /// `clock_recovery_notifications_per_ring` frequency.
8807    ///
8808    /// The `RingBufferPositionInfo` return values must include timestamps that are monotonically
8809    /// increasing.
8810    ///
8811    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
8812    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
8813    WatchClockRecoveryPositionInfo { responder: RingBufferWatchClockRecoveryPositionInfoResponder },
8814    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
8815    ///
8816    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
8817    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
8818    ///
8819    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
8820    /// that ring buffer contents can be transfered in and out, or else the call must be failed
8821    /// with GetVmoError.INVALID_ARGS.
8822    ///
8823    /// The driver may increase the ring buffer size beyond `min_frames` plus
8824    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
8825    /// alignment.
8826    ///
8827    /// Clients can treat the entire returned ring buffer as safe to access, except for the
8828    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
8829    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
8830    ///
8831    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
8832    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
8833    /// handle must also include ZX_RIGHT_WRITE.
8834    ///
8835    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
8836    /// `WatchClockRecoveryPositionInfo` client requests at most at
8837    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
8838    /// for clock recovery.
8839    GetVmo {
8840        min_frames: u32,
8841        clock_recovery_notifications_per_ring: u32,
8842        responder: RingBufferGetVmoResponder,
8843    },
8844    /// Start the ring buffer.
8845    ///
8846    /// The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates when position began
8847    /// moving, starting at the beginning of the ring buffer, i.e. the driver has started to read or
8848    /// write from or to the ring buffer position 0, subject to the overall position and buffering
8849    /// behavior described in 'Ring buffer behavior' below.
8850    ///
8851    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8852    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
8853    /// a second time before the first call has completed, then the channel must be closed with an
8854    /// error `ZX_ERR_BAD_STATE` returned.
8855    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
8856    Start { responder: RingBufferStartResponder },
8857    /// Stop the ring buffer.
8858    ///
8859    /// Once this call's response is received, no further position notifications will be sent until
8860    /// `Start` is called again.
8861    ///
8862    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
8863    Stop { responder: RingBufferStopResponder },
8864    /// Sets which channels are active via a bitmask.
8865    ///
8866    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
8867    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
8868    /// The least significant bit corresponds to channel index 0. Channels not set (bits are 0) in
8869    /// the bitmask are inactive. By default all channels are active. Hence creating a RingBuffer
8870    /// turns on the hardware associated for all channels.
8871    ///
8872    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
8873    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
8874    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
8875    ///
8876    /// Deactivating one, several, or all channels does not `Stop` the ring buffer, nor does it
8877    /// change the ring buffer's behavior with regard to position. Once `Start` is called, a ring
8878    /// buffer's position advances (and position notifications sent as needed) regardless of the
8879    /// number of active channels, including if no channels are active. This means that the format
8880    /// in the ring buffer is not changed.
8881    ///
8882    /// If the driver does not support deactivating channels, it must return `ZX_ERR_NOT_SUPPORTED`.
8883    /// If the mask is incorrect, i.e. enables channels outside the number of bits to use for a
8884    /// given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
8885    ///
8886    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
8887    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
8888    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
8889    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
8890    /// hardware configuration was completed. If the requested channel configuration is already
8891    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
8892    /// before the reply is sent. If called again with the same configuration, the reply must
8893    /// include the same `set_time` value as was previously returned.
8894    ///
8895    /// For input channels, it is not required that the driver zero-out inactive channels.
8896    ///
8897    /// If `SetActiveChannels` is called for a second time before the first call has completed,
8898    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8899    SetActiveChannels {
8900        active_channels_bitmask: u64,
8901        responder: RingBufferSetActiveChannelsResponder,
8902    },
8903    /// Get information about delays via a hanging get.
8904    ///
8905    /// The driver will immediately reply to the first `WatchDelayInfo` sent by the client.
8906    /// The driver will not respond to subsequent client `WatchDelayInfo` calls until the delay info
8907    /// changes from what was most recently reported.
8908    ///
8909    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
8910    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
8911    WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
8912    /// An interaction was received which does not match any known method.
8913    #[non_exhaustive]
8914    _UnknownMethod {
8915        /// Ordinal of the method that was called.
8916        ordinal: u64,
8917        control_handle: RingBufferControlHandle,
8918        method_type: fidl::MethodType,
8919    },
8920}
8921
8922impl RingBufferRequest {
8923    #[allow(irrefutable_let_patterns)]
8924    pub fn into_get_properties(self) -> Option<(RingBufferGetPropertiesResponder)> {
8925        if let RingBufferRequest::GetProperties { responder } = self {
8926            Some((responder))
8927        } else {
8928            None
8929        }
8930    }
8931
8932    #[allow(irrefutable_let_patterns)]
8933    pub fn into_watch_clock_recovery_position_info(
8934        self,
8935    ) -> Option<(RingBufferWatchClockRecoveryPositionInfoResponder)> {
8936        if let RingBufferRequest::WatchClockRecoveryPositionInfo { responder } = self {
8937            Some((responder))
8938        } else {
8939            None
8940        }
8941    }
8942
8943    #[allow(irrefutable_let_patterns)]
8944    pub fn into_get_vmo(self) -> Option<(u32, u32, RingBufferGetVmoResponder)> {
8945        if let RingBufferRequest::GetVmo {
8946            min_frames,
8947            clock_recovery_notifications_per_ring,
8948            responder,
8949        } = self
8950        {
8951            Some((min_frames, clock_recovery_notifications_per_ring, responder))
8952        } else {
8953            None
8954        }
8955    }
8956
8957    #[allow(irrefutable_let_patterns)]
8958    pub fn into_start(self) -> Option<(RingBufferStartResponder)> {
8959        if let RingBufferRequest::Start { responder } = self { Some((responder)) } else { None }
8960    }
8961
8962    #[allow(irrefutable_let_patterns)]
8963    pub fn into_stop(self) -> Option<(RingBufferStopResponder)> {
8964        if let RingBufferRequest::Stop { responder } = self { Some((responder)) } else { None }
8965    }
8966
8967    #[allow(irrefutable_let_patterns)]
8968    pub fn into_set_active_channels(self) -> Option<(u64, RingBufferSetActiveChannelsResponder)> {
8969        if let RingBufferRequest::SetActiveChannels { active_channels_bitmask, responder } = self {
8970            Some((active_channels_bitmask, responder))
8971        } else {
8972            None
8973        }
8974    }
8975
8976    #[allow(irrefutable_let_patterns)]
8977    pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
8978        if let RingBufferRequest::WatchDelayInfo { responder } = self {
8979            Some((responder))
8980        } else {
8981            None
8982        }
8983    }
8984
8985    /// Name of the method defined in FIDL
8986    pub fn method_name(&self) -> &'static str {
8987        match *self {
8988            RingBufferRequest::GetProperties { .. } => "get_properties",
8989            RingBufferRequest::WatchClockRecoveryPositionInfo { .. } => {
8990                "watch_clock_recovery_position_info"
8991            }
8992            RingBufferRequest::GetVmo { .. } => "get_vmo",
8993            RingBufferRequest::Start { .. } => "start",
8994            RingBufferRequest::Stop { .. } => "stop",
8995            RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
8996            RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
8997            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
8998                "unknown one-way method"
8999            }
9000            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
9001                "unknown two-way method"
9002            }
9003        }
9004    }
9005}
9006
9007#[derive(Debug, Clone)]
9008pub struct RingBufferControlHandle {
9009    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
9010}
9011
9012impl RingBufferControlHandle {
9013    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9014        self.inner.shutdown_with_epitaph(status.into())
9015    }
9016}
9017
9018impl fdomain_client::fidl::ControlHandle for RingBufferControlHandle {
9019    fn shutdown(&self) {
9020        self.inner.shutdown()
9021    }
9022
9023    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9024        self.inner.shutdown_with_epitaph(status)
9025    }
9026
9027    fn is_closed(&self) -> bool {
9028        self.inner.channel().is_closed()
9029    }
9030    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
9031        self.inner.channel().on_closed()
9032    }
9033}
9034
9035impl RingBufferControlHandle {}
9036
9037#[must_use = "FIDL methods require a response to be sent"]
9038#[derive(Debug)]
9039pub struct RingBufferGetPropertiesResponder {
9040    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9041    tx_id: u32,
9042}
9043
9044/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9045/// if the responder is dropped without sending a response, so that the client
9046/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9047impl std::ops::Drop for RingBufferGetPropertiesResponder {
9048    fn drop(&mut self) {
9049        self.control_handle.shutdown();
9050        // Safety: drops once, never accessed again
9051        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9052    }
9053}
9054
9055impl fdomain_client::fidl::Responder for RingBufferGetPropertiesResponder {
9056    type ControlHandle = RingBufferControlHandle;
9057
9058    fn control_handle(&self) -> &RingBufferControlHandle {
9059        &self.control_handle
9060    }
9061
9062    fn drop_without_shutdown(mut self) {
9063        // Safety: drops once, never accessed again due to mem::forget
9064        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9065        // Prevent Drop from running (which would shut down the channel)
9066        std::mem::forget(self);
9067    }
9068}
9069
9070impl RingBufferGetPropertiesResponder {
9071    /// Sends a response to the FIDL transaction.
9072    ///
9073    /// Sets the channel to shutdown if an error occurs.
9074    pub fn send(self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
9075        let _result = self.send_raw(properties);
9076        if _result.is_err() {
9077            self.control_handle.shutdown();
9078        }
9079        self.drop_without_shutdown();
9080        _result
9081    }
9082
9083    /// Similar to "send" but does not shutdown the channel if an error occurs.
9084    pub fn send_no_shutdown_on_err(
9085        self,
9086        mut properties: &RingBufferProperties,
9087    ) -> Result<(), fidl::Error> {
9088        let _result = self.send_raw(properties);
9089        self.drop_without_shutdown();
9090        _result
9091    }
9092
9093    fn send_raw(&self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
9094        self.control_handle.inner.send::<RingBufferGetPropertiesResponse>(
9095            (properties,),
9096            self.tx_id,
9097            0x12947f061a8fe1,
9098            fidl::encoding::DynamicFlags::empty(),
9099        )
9100    }
9101}
9102
9103#[must_use = "FIDL methods require a response to be sent"]
9104#[derive(Debug)]
9105pub struct RingBufferWatchClockRecoveryPositionInfoResponder {
9106    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9107    tx_id: u32,
9108}
9109
9110/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9111/// if the responder is dropped without sending a response, so that the client
9112/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9113impl std::ops::Drop for RingBufferWatchClockRecoveryPositionInfoResponder {
9114    fn drop(&mut self) {
9115        self.control_handle.shutdown();
9116        // Safety: drops once, never accessed again
9117        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9118    }
9119}
9120
9121impl fdomain_client::fidl::Responder for RingBufferWatchClockRecoveryPositionInfoResponder {
9122    type ControlHandle = RingBufferControlHandle;
9123
9124    fn control_handle(&self) -> &RingBufferControlHandle {
9125        &self.control_handle
9126    }
9127
9128    fn drop_without_shutdown(mut self) {
9129        // Safety: drops once, never accessed again due to mem::forget
9130        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9131        // Prevent Drop from running (which would shut down the channel)
9132        std::mem::forget(self);
9133    }
9134}
9135
9136impl RingBufferWatchClockRecoveryPositionInfoResponder {
9137    /// Sends a response to the FIDL transaction.
9138    ///
9139    /// Sets the channel to shutdown if an error occurs.
9140    pub fn send(self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
9141        let _result = self.send_raw(position_info);
9142        if _result.is_err() {
9143            self.control_handle.shutdown();
9144        }
9145        self.drop_without_shutdown();
9146        _result
9147    }
9148
9149    /// Similar to "send" but does not shutdown the channel if an error occurs.
9150    pub fn send_no_shutdown_on_err(
9151        self,
9152        mut position_info: &RingBufferPositionInfo,
9153    ) -> Result<(), fidl::Error> {
9154        let _result = self.send_raw(position_info);
9155        self.drop_without_shutdown();
9156        _result
9157    }
9158
9159    fn send_raw(&self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
9160        self.control_handle.inner.send::<RingBufferWatchClockRecoveryPositionInfoResponse>(
9161            (position_info,),
9162            self.tx_id,
9163            0x694d5b898a4167e5,
9164            fidl::encoding::DynamicFlags::empty(),
9165        )
9166    }
9167}
9168
9169#[must_use = "FIDL methods require a response to be sent"]
9170#[derive(Debug)]
9171pub struct RingBufferGetVmoResponder {
9172    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9173    tx_id: u32,
9174}
9175
9176/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9177/// if the responder is dropped without sending a response, so that the client
9178/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9179impl std::ops::Drop for RingBufferGetVmoResponder {
9180    fn drop(&mut self) {
9181        self.control_handle.shutdown();
9182        // Safety: drops once, never accessed again
9183        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9184    }
9185}
9186
9187impl fdomain_client::fidl::Responder for RingBufferGetVmoResponder {
9188    type ControlHandle = RingBufferControlHandle;
9189
9190    fn control_handle(&self) -> &RingBufferControlHandle {
9191        &self.control_handle
9192    }
9193
9194    fn drop_without_shutdown(mut self) {
9195        // Safety: drops once, never accessed again due to mem::forget
9196        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9197        // Prevent Drop from running (which would shut down the channel)
9198        std::mem::forget(self);
9199    }
9200}
9201
9202impl RingBufferGetVmoResponder {
9203    /// Sends a response to the FIDL transaction.
9204    ///
9205    /// Sets the channel to shutdown if an error occurs.
9206    pub fn send(
9207        self,
9208        mut result: Result<(u32, fdomain_client::Vmo), GetVmoError>,
9209    ) -> Result<(), fidl::Error> {
9210        let _result = self.send_raw(result);
9211        if _result.is_err() {
9212            self.control_handle.shutdown();
9213        }
9214        self.drop_without_shutdown();
9215        _result
9216    }
9217
9218    /// Similar to "send" but does not shutdown the channel if an error occurs.
9219    pub fn send_no_shutdown_on_err(
9220        self,
9221        mut result: Result<(u32, fdomain_client::Vmo), GetVmoError>,
9222    ) -> Result<(), fidl::Error> {
9223        let _result = self.send_raw(result);
9224        self.drop_without_shutdown();
9225        _result
9226    }
9227
9228    fn send_raw(
9229        &self,
9230        mut result: Result<(u32, fdomain_client::Vmo), GetVmoError>,
9231    ) -> Result<(), fidl::Error> {
9232        self.control_handle
9233            .inner
9234            .send::<fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>>(
9235                result,
9236                self.tx_id,
9237                0x44c8f4f5680e853a,
9238                fidl::encoding::DynamicFlags::empty(),
9239            )
9240    }
9241}
9242
9243#[must_use = "FIDL methods require a response to be sent"]
9244#[derive(Debug)]
9245pub struct RingBufferStartResponder {
9246    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9247    tx_id: u32,
9248}
9249
9250/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9251/// if the responder is dropped without sending a response, so that the client
9252/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9253impl std::ops::Drop for RingBufferStartResponder {
9254    fn drop(&mut self) {
9255        self.control_handle.shutdown();
9256        // Safety: drops once, never accessed again
9257        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9258    }
9259}
9260
9261impl fdomain_client::fidl::Responder for RingBufferStartResponder {
9262    type ControlHandle = RingBufferControlHandle;
9263
9264    fn control_handle(&self) -> &RingBufferControlHandle {
9265        &self.control_handle
9266    }
9267
9268    fn drop_without_shutdown(mut self) {
9269        // Safety: drops once, never accessed again due to mem::forget
9270        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9271        // Prevent Drop from running (which would shut down the channel)
9272        std::mem::forget(self);
9273    }
9274}
9275
9276impl RingBufferStartResponder {
9277    /// Sends a response to the FIDL transaction.
9278    ///
9279    /// Sets the channel to shutdown if an error occurs.
9280    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
9281        let _result = self.send_raw(start_time);
9282        if _result.is_err() {
9283            self.control_handle.shutdown();
9284        }
9285        self.drop_without_shutdown();
9286        _result
9287    }
9288
9289    /// Similar to "send" but does not shutdown the channel if an error occurs.
9290    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
9291        let _result = self.send_raw(start_time);
9292        self.drop_without_shutdown();
9293        _result
9294    }
9295
9296    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
9297        self.control_handle.inner.send::<RingBufferStartResponse>(
9298            (start_time,),
9299            self.tx_id,
9300            0x5dd780a769a8892d,
9301            fidl::encoding::DynamicFlags::empty(),
9302        )
9303    }
9304}
9305
9306#[must_use = "FIDL methods require a response to be sent"]
9307#[derive(Debug)]
9308pub struct RingBufferStopResponder {
9309    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9310    tx_id: u32,
9311}
9312
9313/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9314/// if the responder is dropped without sending a response, so that the client
9315/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9316impl std::ops::Drop for RingBufferStopResponder {
9317    fn drop(&mut self) {
9318        self.control_handle.shutdown();
9319        // Safety: drops once, never accessed again
9320        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9321    }
9322}
9323
9324impl fdomain_client::fidl::Responder for RingBufferStopResponder {
9325    type ControlHandle = RingBufferControlHandle;
9326
9327    fn control_handle(&self) -> &RingBufferControlHandle {
9328        &self.control_handle
9329    }
9330
9331    fn drop_without_shutdown(mut self) {
9332        // Safety: drops once, never accessed again due to mem::forget
9333        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9334        // Prevent Drop from running (which would shut down the channel)
9335        std::mem::forget(self);
9336    }
9337}
9338
9339impl RingBufferStopResponder {
9340    /// Sends a response to the FIDL transaction.
9341    ///
9342    /// Sets the channel to shutdown if an error occurs.
9343    pub fn send(self) -> Result<(), fidl::Error> {
9344        let _result = self.send_raw();
9345        if _result.is_err() {
9346            self.control_handle.shutdown();
9347        }
9348        self.drop_without_shutdown();
9349        _result
9350    }
9351
9352    /// Similar to "send" but does not shutdown the channel if an error occurs.
9353    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9354        let _result = self.send_raw();
9355        self.drop_without_shutdown();
9356        _result
9357    }
9358
9359    fn send_raw(&self) -> Result<(), fidl::Error> {
9360        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9361            (),
9362            self.tx_id,
9363            0x49a73d9cf1d4e110,
9364            fidl::encoding::DynamicFlags::empty(),
9365        )
9366    }
9367}
9368
9369#[must_use = "FIDL methods require a response to be sent"]
9370#[derive(Debug)]
9371pub struct RingBufferSetActiveChannelsResponder {
9372    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9373    tx_id: u32,
9374}
9375
9376/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9377/// if the responder is dropped without sending a response, so that the client
9378/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9379impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
9380    fn drop(&mut self) {
9381        self.control_handle.shutdown();
9382        // Safety: drops once, never accessed again
9383        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9384    }
9385}
9386
9387impl fdomain_client::fidl::Responder for RingBufferSetActiveChannelsResponder {
9388    type ControlHandle = RingBufferControlHandle;
9389
9390    fn control_handle(&self) -> &RingBufferControlHandle {
9391        &self.control_handle
9392    }
9393
9394    fn drop_without_shutdown(mut self) {
9395        // Safety: drops once, never accessed again due to mem::forget
9396        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9397        // Prevent Drop from running (which would shut down the channel)
9398        std::mem::forget(self);
9399    }
9400}
9401
9402impl RingBufferSetActiveChannelsResponder {
9403    /// Sends a response to the FIDL transaction.
9404    ///
9405    /// Sets the channel to shutdown if an error occurs.
9406    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
9407        let _result = self.send_raw(result);
9408        if _result.is_err() {
9409            self.control_handle.shutdown();
9410        }
9411        self.drop_without_shutdown();
9412        _result
9413    }
9414
9415    /// Similar to "send" but does not shutdown the channel if an error occurs.
9416    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
9417        let _result = self.send_raw(result);
9418        self.drop_without_shutdown();
9419        _result
9420    }
9421
9422    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
9423        self.control_handle.inner.send::<fidl::encoding::ResultType<
9424            RingBufferSetActiveChannelsResponse,
9425            i32,
9426        >>(
9427            result.map(|set_time| (set_time,)),
9428            self.tx_id,
9429            0x605464c1d384f309,
9430            fidl::encoding::DynamicFlags::empty(),
9431        )
9432    }
9433}
9434
9435#[must_use = "FIDL methods require a response to be sent"]
9436#[derive(Debug)]
9437pub struct RingBufferWatchDelayInfoResponder {
9438    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
9439    tx_id: u32,
9440}
9441
9442/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
9443/// if the responder is dropped without sending a response, so that the client
9444/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9445impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
9446    fn drop(&mut self) {
9447        self.control_handle.shutdown();
9448        // Safety: drops once, never accessed again
9449        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9450    }
9451}
9452
9453impl fdomain_client::fidl::Responder for RingBufferWatchDelayInfoResponder {
9454    type ControlHandle = RingBufferControlHandle;
9455
9456    fn control_handle(&self) -> &RingBufferControlHandle {
9457        &self.control_handle
9458    }
9459
9460    fn drop_without_shutdown(mut self) {
9461        // Safety: drops once, never accessed again due to mem::forget
9462        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9463        // Prevent Drop from running (which would shut down the channel)
9464        std::mem::forget(self);
9465    }
9466}
9467
9468impl RingBufferWatchDelayInfoResponder {
9469    /// Sends a response to the FIDL transaction.
9470    ///
9471    /// Sets the channel to shutdown if an error occurs.
9472    pub fn send(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
9473        let _result = self.send_raw(delay_info);
9474        if _result.is_err() {
9475            self.control_handle.shutdown();
9476        }
9477        self.drop_without_shutdown();
9478        _result
9479    }
9480
9481    /// Similar to "send" but does not shutdown the channel if an error occurs.
9482    pub fn send_no_shutdown_on_err(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
9483        let _result = self.send_raw(delay_info);
9484        self.drop_without_shutdown();
9485        _result
9486    }
9487
9488    fn send_raw(&self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
9489        self.control_handle
9490            .inner
9491            .send::<fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>>(
9492                fidl::encoding::Flexible::new((delay_info,)),
9493                self.tx_id,
9494                0x6c1248db213fcf9f,
9495                fidl::encoding::DynamicFlags::FLEXIBLE,
9496            )
9497    }
9498}
9499
9500#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9501pub struct StreamConfigMarker;
9502
9503impl fdomain_client::fidl::ProtocolMarker for StreamConfigMarker {
9504    type Proxy = StreamConfigProxy;
9505    type RequestStream = StreamConfigRequestStream;
9506
9507    const DEBUG_NAME: &'static str = "(anonymous) StreamConfig";
9508}
9509
9510pub trait StreamConfigProxyInterface: Send + Sync {
9511    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
9512        + Send;
9513    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
9514    fn r#signal_processing_connect(
9515        &self,
9516        protocol: fdomain_client::fidl::ServerEnd<
9517            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
9518        >,
9519    ) -> Result<(), fidl::Error>;
9520    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
9521        + Send;
9522    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
9523    type GetSupportedFormatsResponseFut: std::future::Future<Output = Result<Vec<SupportedFormats>, fidl::Error>>
9524        + Send;
9525    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut;
9526    fn r#create_ring_buffer(
9527        &self,
9528        format: &Format,
9529        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
9530    ) -> Result<(), fidl::Error>;
9531    type WatchGainStateResponseFut: std::future::Future<Output = Result<GainState, fidl::Error>>
9532        + Send;
9533    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut;
9534    fn r#set_gain(&self, target_state: &GainState) -> Result<(), fidl::Error>;
9535    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
9536        + Send;
9537    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
9538}
9539
9540#[derive(Debug, Clone)]
9541pub struct StreamConfigProxy {
9542    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
9543}
9544
9545impl fdomain_client::fidl::Proxy for StreamConfigProxy {
9546    type Protocol = StreamConfigMarker;
9547
9548    fn from_channel(inner: fdomain_client::Channel) -> Self {
9549        Self::new(inner)
9550    }
9551
9552    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
9553        self.client.into_channel().map_err(|client| Self { client })
9554    }
9555
9556    fn as_channel(&self) -> &fdomain_client::Channel {
9557        self.client.as_channel()
9558    }
9559}
9560
9561impl StreamConfigProxy {
9562    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfig.
9563    pub fn new(channel: fdomain_client::Channel) -> Self {
9564        let protocol_name =
9565            <StreamConfigMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
9566        Self { client: fidl::client::Client::new(channel, protocol_name) }
9567    }
9568
9569    /// Get a Stream of events from the remote end of the protocol.
9570    ///
9571    /// # Panics
9572    ///
9573    /// Panics if the event stream was already taken.
9574    pub fn take_event_stream(&self) -> StreamConfigEventStream {
9575        StreamConfigEventStream { event_receiver: self.client.take_event_receiver() }
9576    }
9577
9578    /// Retrieves top level health state.
9579    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
9580    pub fn r#get_health_state(
9581        &self,
9582    ) -> fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>
9583    {
9584        StreamConfigProxyInterface::r#get_health_state(self)
9585    }
9586
9587    /// Connect to a `SignalProcessing` protocol.
9588    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
9589    /// the maximum number of connections have already been created, for instance one, then the
9590    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
9591    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
9592    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
9593    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
9594    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
9595    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
9596    /// is intended to be composed, and hence the more verbose name allows differentiation and
9597    /// improved clarity.
9598    pub fn r#signal_processing_connect(
9599        &self,
9600        mut protocol: fdomain_client::fidl::ServerEnd<
9601            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
9602        >,
9603    ) -> Result<(), fidl::Error> {
9604        StreamConfigProxyInterface::r#signal_processing_connect(self, protocol)
9605    }
9606
9607    /// Retrieves top level static properties.
9608    pub fn r#get_properties(
9609        &self,
9610    ) -> fidl::client::QueryResponseFut<
9611        StreamProperties,
9612        fdomain_client::fidl::FDomainResourceDialect,
9613    > {
9614        StreamConfigProxyInterface::r#get_properties(self)
9615    }
9616
9617    /// Gets formats supported by a given driver. When not all combinations supported by the
9618    /// driver can be described with one `SupportedFormats`, the driver returns more than one
9619    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
9620    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
9621    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
9622    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
9623    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
9624    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
9625    /// <<16bits,32bits>,<48KHz,96KHz>>.
9626    pub fn r#get_supported_formats(
9627        &self,
9628    ) -> fidl::client::QueryResponseFut<
9629        Vec<SupportedFormats>,
9630        fdomain_client::fidl::FDomainResourceDialect,
9631    > {
9632        StreamConfigProxyInterface::r#get_supported_formats(self)
9633    }
9634
9635    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
9636    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
9637    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
9638    /// ring buffer channel had been established and was still active, the driver must close that
9639    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
9640    /// operations in the process.
9641    pub fn r#create_ring_buffer(
9642        &self,
9643        mut format: &Format,
9644        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
9645    ) -> Result<(), fidl::Error> {
9646        StreamConfigProxyInterface::r#create_ring_buffer(self, format, ring_buffer)
9647    }
9648
9649    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
9650    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
9651    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
9652    /// from what was most recently reported.
9653    /// If `WatchGainState` is called for a second time before the first call has completed, then
9654    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
9655    pub fn r#watch_gain_state(
9656        &self,
9657    ) -> fidl::client::QueryResponseFut<GainState, fdomain_client::fidl::FDomainResourceDialect>
9658    {
9659        StreamConfigProxyInterface::r#watch_gain_state(self)
9660    }
9661
9662    /// Client update of the gain state.
9663    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
9664        StreamConfigProxyInterface::r#set_gain(self, target_state)
9665    }
9666
9667    /// Get the plug detect state via a hanging get. The driver will reply to the first
9668    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
9669    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
9670    /// If `WatchPlugState` is called for a second time before the first call has completed, then
9671    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
9672    pub fn r#watch_plug_state(
9673        &self,
9674    ) -> fidl::client::QueryResponseFut<PlugState, fdomain_client::fidl::FDomainResourceDialect>
9675    {
9676        StreamConfigProxyInterface::r#watch_plug_state(self)
9677    }
9678}
9679
9680impl StreamConfigProxyInterface for StreamConfigProxy {
9681    type GetHealthStateResponseFut =
9682        fidl::client::QueryResponseFut<HealthState, fdomain_client::fidl::FDomainResourceDialect>;
9683    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
9684        fn _decode(
9685            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9686        ) -> Result<HealthState, fidl::Error> {
9687            let _response = fidl::client::decode_transaction_body::<
9688                HealthGetHealthStateResponse,
9689                fdomain_client::fidl::FDomainResourceDialect,
9690                0x4e146d6bca733a84,
9691            >(_buf?)?;
9692            Ok(_response.state)
9693        }
9694        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
9695            (),
9696            0x4e146d6bca733a84,
9697            fidl::encoding::DynamicFlags::empty(),
9698            _decode,
9699        )
9700    }
9701
9702    fn r#signal_processing_connect(
9703        &self,
9704        mut protocol: fdomain_client::fidl::ServerEnd<
9705            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
9706        >,
9707    ) -> Result<(), fidl::Error> {
9708        self.client.send::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
9709            (protocol,),
9710            0xa81907ce6066295,
9711            fidl::encoding::DynamicFlags::empty(),
9712        )
9713    }
9714
9715    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
9716        StreamProperties,
9717        fdomain_client::fidl::FDomainResourceDialect,
9718    >;
9719    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
9720        fn _decode(
9721            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9722        ) -> Result<StreamProperties, fidl::Error> {
9723            let _response = fidl::client::decode_transaction_body::<
9724                StreamConfigGetPropertiesResponse,
9725                fdomain_client::fidl::FDomainResourceDialect,
9726                0x7d89c02f3e2d3c01,
9727            >(_buf?)?;
9728            Ok(_response.properties)
9729        }
9730        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
9731            (),
9732            0x7d89c02f3e2d3c01,
9733            fidl::encoding::DynamicFlags::empty(),
9734            _decode,
9735        )
9736    }
9737
9738    type GetSupportedFormatsResponseFut = fidl::client::QueryResponseFut<
9739        Vec<SupportedFormats>,
9740        fdomain_client::fidl::FDomainResourceDialect,
9741    >;
9742    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut {
9743        fn _decode(
9744            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9745        ) -> Result<Vec<SupportedFormats>, fidl::Error> {
9746            let _response = fidl::client::decode_transaction_body::<
9747                StreamConfigGetSupportedFormatsResponse,
9748                fdomain_client::fidl::FDomainResourceDialect,
9749                0x448efa7850cafe7e,
9750            >(_buf?)?;
9751            Ok(_response.supported_formats)
9752        }
9753        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<SupportedFormats>>(
9754            (),
9755            0x448efa7850cafe7e,
9756            fidl::encoding::DynamicFlags::empty(),
9757            _decode,
9758        )
9759    }
9760
9761    fn r#create_ring_buffer(
9762        &self,
9763        mut format: &Format,
9764        mut ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
9765    ) -> Result<(), fidl::Error> {
9766        self.client.send::<StreamConfigCreateRingBufferRequest>(
9767            (format, ring_buffer),
9768            0x2afb19dd13faa1ba,
9769            fidl::encoding::DynamicFlags::empty(),
9770        )
9771    }
9772
9773    type WatchGainStateResponseFut =
9774        fidl::client::QueryResponseFut<GainState, fdomain_client::fidl::FDomainResourceDialect>;
9775    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut {
9776        fn _decode(
9777            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9778        ) -> Result<GainState, fidl::Error> {
9779            let _response = fidl::client::decode_transaction_body::<
9780                StreamConfigWatchGainStateResponse,
9781                fdomain_client::fidl::FDomainResourceDialect,
9782                0x4772506136ab65c1,
9783            >(_buf?)?;
9784            Ok(_response.gain_state)
9785        }
9786        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GainState>(
9787            (),
9788            0x4772506136ab65c1,
9789            fidl::encoding::DynamicFlags::empty(),
9790            _decode,
9791        )
9792    }
9793
9794    fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
9795        self.client.send::<StreamConfigSetGainRequest>(
9796            (target_state,),
9797            0x3943b41498c6a384,
9798            fidl::encoding::DynamicFlags::empty(),
9799        )
9800    }
9801
9802    type WatchPlugStateResponseFut =
9803        fidl::client::QueryResponseFut<PlugState, fdomain_client::fidl::FDomainResourceDialect>;
9804    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
9805        fn _decode(
9806            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9807        ) -> Result<PlugState, fidl::Error> {
9808            let _response = fidl::client::decode_transaction_body::<
9809                StreamConfigWatchPlugStateResponse,
9810                fdomain_client::fidl::FDomainResourceDialect,
9811                0x497345a6f048b2a6,
9812            >(_buf?)?;
9813            Ok(_response.plug_state)
9814        }
9815        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
9816            (),
9817            0x497345a6f048b2a6,
9818            fidl::encoding::DynamicFlags::empty(),
9819            _decode,
9820        )
9821    }
9822}
9823
9824pub struct StreamConfigEventStream {
9825    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
9826}
9827
9828impl std::marker::Unpin for StreamConfigEventStream {}
9829
9830impl futures::stream::FusedStream for StreamConfigEventStream {
9831    fn is_terminated(&self) -> bool {
9832        self.event_receiver.is_terminated()
9833    }
9834}
9835
9836impl futures::Stream for StreamConfigEventStream {
9837    type Item = Result<StreamConfigEvent, fidl::Error>;
9838
9839    fn poll_next(
9840        mut self: std::pin::Pin<&mut Self>,
9841        cx: &mut std::task::Context<'_>,
9842    ) -> std::task::Poll<Option<Self::Item>> {
9843        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9844            &mut self.event_receiver,
9845            cx
9846        )?) {
9847            Some(buf) => std::task::Poll::Ready(Some(StreamConfigEvent::decode(buf))),
9848            None => std::task::Poll::Ready(None),
9849        }
9850    }
9851}
9852
9853#[derive(Debug)]
9854pub enum StreamConfigEvent {}
9855
9856impl StreamConfigEvent {
9857    /// Decodes a message buffer as a [`StreamConfigEvent`].
9858    fn decode(
9859        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9860    ) -> Result<StreamConfigEvent, fidl::Error> {
9861        let (bytes, _handles) = buf.split_mut();
9862        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9863        debug_assert_eq!(tx_header.tx_id, 0);
9864        match tx_header.ordinal {
9865            _ => Err(fidl::Error::UnknownOrdinal {
9866                ordinal: tx_header.ordinal,
9867                protocol_name:
9868                    <StreamConfigMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
9869            }),
9870        }
9871    }
9872}
9873
9874/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfig.
9875pub struct StreamConfigRequestStream {
9876    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
9877    is_terminated: bool,
9878}
9879
9880impl std::marker::Unpin for StreamConfigRequestStream {}
9881
9882impl futures::stream::FusedStream for StreamConfigRequestStream {
9883    fn is_terminated(&self) -> bool {
9884        self.is_terminated
9885    }
9886}
9887
9888impl fdomain_client::fidl::RequestStream for StreamConfigRequestStream {
9889    type Protocol = StreamConfigMarker;
9890    type ControlHandle = StreamConfigControlHandle;
9891
9892    fn from_channel(channel: fdomain_client::Channel) -> Self {
9893        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9894    }
9895
9896    fn control_handle(&self) -> Self::ControlHandle {
9897        StreamConfigControlHandle { inner: self.inner.clone() }
9898    }
9899
9900    fn into_inner(
9901        self,
9902    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
9903    {
9904        (self.inner, self.is_terminated)
9905    }
9906
9907    fn from_inner(
9908        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
9909        is_terminated: bool,
9910    ) -> Self {
9911        Self { inner, is_terminated }
9912    }
9913}
9914
9915impl futures::Stream for StreamConfigRequestStream {
9916    type Item = Result<StreamConfigRequest, fidl::Error>;
9917
9918    fn poll_next(
9919        mut self: std::pin::Pin<&mut Self>,
9920        cx: &mut std::task::Context<'_>,
9921    ) -> std::task::Poll<Option<Self::Item>> {
9922        let this = &mut *self;
9923        if this.inner.check_shutdown(cx) {
9924            this.is_terminated = true;
9925            return std::task::Poll::Ready(None);
9926        }
9927        if this.is_terminated {
9928            panic!("polled StreamConfigRequestStream after completion");
9929        }
9930        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
9931            |bytes, handles| {
9932                match this.inner.channel().read_etc(cx, bytes, handles) {
9933                    std::task::Poll::Ready(Ok(())) => {}
9934                    std::task::Poll::Pending => return std::task::Poll::Pending,
9935                    std::task::Poll::Ready(Err(None)) => {
9936                        this.is_terminated = true;
9937                        return std::task::Poll::Ready(None);
9938                    }
9939                    std::task::Poll::Ready(Err(Some(e))) => {
9940                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9941                            e.into(),
9942                        ))));
9943                    }
9944                }
9945
9946                // A message has been received from the channel
9947                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9948
9949                std::task::Poll::Ready(Some(match header.ordinal {
9950                    0x4e146d6bca733a84 => {
9951                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9952                        let mut req = fidl::new_empty!(
9953                            fidl::encoding::EmptyPayload,
9954                            fdomain_client::fidl::FDomainResourceDialect
9955                        );
9956                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9957                        let control_handle =
9958                            StreamConfigControlHandle { inner: this.inner.clone() };
9959                        Ok(StreamConfigRequest::GetHealthState {
9960                            responder: StreamConfigGetHealthStateResponder {
9961                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9962                                tx_id: header.tx_id,
9963                            },
9964                        })
9965                    }
9966                    0xa81907ce6066295 => {
9967                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9968                        let mut req = fidl::new_empty!(fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
9969                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fdomain_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
9970                        let control_handle =
9971                            StreamConfigControlHandle { inner: this.inner.clone() };
9972                        Ok(StreamConfigRequest::SignalProcessingConnect {
9973                            protocol: req.protocol,
9974
9975                            control_handle,
9976                        })
9977                    }
9978                    0x7d89c02f3e2d3c01 => {
9979                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9980                        let mut req = fidl::new_empty!(
9981                            fidl::encoding::EmptyPayload,
9982                            fdomain_client::fidl::FDomainResourceDialect
9983                        );
9984                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9985                        let control_handle =
9986                            StreamConfigControlHandle { inner: this.inner.clone() };
9987                        Ok(StreamConfigRequest::GetProperties {
9988                            responder: StreamConfigGetPropertiesResponder {
9989                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9990                                tx_id: header.tx_id,
9991                            },
9992                        })
9993                    }
9994                    0x448efa7850cafe7e => {
9995                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9996                        let mut req = fidl::new_empty!(
9997                            fidl::encoding::EmptyPayload,
9998                            fdomain_client::fidl::FDomainResourceDialect
9999                        );
10000                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10001                        let control_handle =
10002                            StreamConfigControlHandle { inner: this.inner.clone() };
10003                        Ok(StreamConfigRequest::GetSupportedFormats {
10004                            responder: StreamConfigGetSupportedFormatsResponder {
10005                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10006                                tx_id: header.tx_id,
10007                            },
10008                        })
10009                    }
10010                    0x2afb19dd13faa1ba => {
10011                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10012                        let mut req = fidl::new_empty!(
10013                            StreamConfigCreateRingBufferRequest,
10014                            fdomain_client::fidl::FDomainResourceDialect
10015                        );
10016                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamConfigCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
10017                        let control_handle =
10018                            StreamConfigControlHandle { inner: this.inner.clone() };
10019                        Ok(StreamConfigRequest::CreateRingBuffer {
10020                            format: req.format,
10021                            ring_buffer: req.ring_buffer,
10022
10023                            control_handle,
10024                        })
10025                    }
10026                    0x4772506136ab65c1 => {
10027                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10028                        let mut req = fidl::new_empty!(
10029                            fidl::encoding::EmptyPayload,
10030                            fdomain_client::fidl::FDomainResourceDialect
10031                        );
10032                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10033                        let control_handle =
10034                            StreamConfigControlHandle { inner: this.inner.clone() };
10035                        Ok(StreamConfigRequest::WatchGainState {
10036                            responder: StreamConfigWatchGainStateResponder {
10037                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10038                                tx_id: header.tx_id,
10039                            },
10040                        })
10041                    }
10042                    0x3943b41498c6a384 => {
10043                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10044                        let mut req = fidl::new_empty!(
10045                            StreamConfigSetGainRequest,
10046                            fdomain_client::fidl::FDomainResourceDialect
10047                        );
10048                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamConfigSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
10049                        let control_handle =
10050                            StreamConfigControlHandle { inner: this.inner.clone() };
10051                        Ok(StreamConfigRequest::SetGain {
10052                            target_state: req.target_state,
10053
10054                            control_handle,
10055                        })
10056                    }
10057                    0x497345a6f048b2a6 => {
10058                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10059                        let mut req = fidl::new_empty!(
10060                            fidl::encoding::EmptyPayload,
10061                            fdomain_client::fidl::FDomainResourceDialect
10062                        );
10063                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10064                        let control_handle =
10065                            StreamConfigControlHandle { inner: this.inner.clone() };
10066                        Ok(StreamConfigRequest::WatchPlugState {
10067                            responder: StreamConfigWatchPlugStateResponder {
10068                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10069                                tx_id: header.tx_id,
10070                            },
10071                        })
10072                    }
10073                    _ => Err(fidl::Error::UnknownOrdinal {
10074                        ordinal: header.ordinal,
10075                        protocol_name:
10076                            <StreamConfigMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
10077                    }),
10078                }))
10079            },
10080        )
10081    }
10082}
10083
10084/// For an overview see
10085/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/development/audio/drivers/streaming)
10086/// # Deprecation
10087///
10088/// Not supported anymore, instead use an
10089/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10090/// with one Ring Buffer, see
10091/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10092#[derive(Debug)]
10093pub enum StreamConfigRequest {
10094    /// Retrieves top level health state.
10095    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
10096    GetHealthState { responder: StreamConfigGetHealthStateResponder },
10097    /// Connect to a `SignalProcessing` protocol.
10098    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
10099    /// the maximum number of connections have already been created, for instance one, then the
10100    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
10101    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
10102    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
10103    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
10104    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
10105    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
10106    /// is intended to be composed, and hence the more verbose name allows differentiation and
10107    /// improved clarity.
10108    SignalProcessingConnect {
10109        protocol: fdomain_client::fidl::ServerEnd<
10110            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
10111        >,
10112        control_handle: StreamConfigControlHandle,
10113    },
10114    /// Retrieves top level static properties.
10115    GetProperties { responder: StreamConfigGetPropertiesResponder },
10116    /// Gets formats supported by a given driver. When not all combinations supported by the
10117    /// driver can be described with one `SupportedFormats`, the driver returns more than one
10118    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
10119    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
10120    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
10121    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
10122    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
10123    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
10124    /// <<16bits,32bits>,<48KHz,96KHz>>.
10125    GetSupportedFormats { responder: StreamConfigGetSupportedFormatsResponder },
10126    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
10127    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
10128    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
10129    /// ring buffer channel had been established and was still active, the driver must close that
10130    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
10131    /// operations in the process.
10132    CreateRingBuffer {
10133        format: Format,
10134        ring_buffer: fdomain_client::fidl::ServerEnd<RingBufferMarker>,
10135        control_handle: StreamConfigControlHandle,
10136    },
10137    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
10138    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
10139    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
10140    /// from what was most recently reported.
10141    /// If `WatchGainState` is called for a second time before the first call has completed, then
10142    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
10143    WatchGainState { responder: StreamConfigWatchGainStateResponder },
10144    /// Client update of the gain state.
10145    SetGain { target_state: GainState, control_handle: StreamConfigControlHandle },
10146    /// Get the plug detect state via a hanging get. The driver will reply to the first
10147    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
10148    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
10149    /// If `WatchPlugState` is called for a second time before the first call has completed, then
10150    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
10151    WatchPlugState { responder: StreamConfigWatchPlugStateResponder },
10152}
10153
10154impl StreamConfigRequest {
10155    #[allow(irrefutable_let_patterns)]
10156    pub fn into_get_health_state(self) -> Option<(StreamConfigGetHealthStateResponder)> {
10157        if let StreamConfigRequest::GetHealthState { responder } = self {
10158            Some((responder))
10159        } else {
10160            None
10161        }
10162    }
10163
10164    #[allow(irrefutable_let_patterns)]
10165    pub fn into_signal_processing_connect(
10166        self,
10167    ) -> Option<(
10168        fdomain_client::fidl::ServerEnd<
10169            fdomain_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
10170        >,
10171        StreamConfigControlHandle,
10172    )> {
10173        if let StreamConfigRequest::SignalProcessingConnect { protocol, control_handle } = self {
10174            Some((protocol, control_handle))
10175        } else {
10176            None
10177        }
10178    }
10179
10180    #[allow(irrefutable_let_patterns)]
10181    pub fn into_get_properties(self) -> Option<(StreamConfigGetPropertiesResponder)> {
10182        if let StreamConfigRequest::GetProperties { responder } = self {
10183            Some((responder))
10184        } else {
10185            None
10186        }
10187    }
10188
10189    #[allow(irrefutable_let_patterns)]
10190    pub fn into_get_supported_formats(self) -> Option<(StreamConfigGetSupportedFormatsResponder)> {
10191        if let StreamConfigRequest::GetSupportedFormats { responder } = self {
10192            Some((responder))
10193        } else {
10194            None
10195        }
10196    }
10197
10198    #[allow(irrefutable_let_patterns)]
10199    pub fn into_create_ring_buffer(
10200        self,
10201    ) -> Option<(
10202        Format,
10203        fdomain_client::fidl::ServerEnd<RingBufferMarker>,
10204        StreamConfigControlHandle,
10205    )> {
10206        if let StreamConfigRequest::CreateRingBuffer { format, ring_buffer, control_handle } = self
10207        {
10208            Some((format, ring_buffer, control_handle))
10209        } else {
10210            None
10211        }
10212    }
10213
10214    #[allow(irrefutable_let_patterns)]
10215    pub fn into_watch_gain_state(self) -> Option<(StreamConfigWatchGainStateResponder)> {
10216        if let StreamConfigRequest::WatchGainState { responder } = self {
10217            Some((responder))
10218        } else {
10219            None
10220        }
10221    }
10222
10223    #[allow(irrefutable_let_patterns)]
10224    pub fn into_set_gain(self) -> Option<(GainState, StreamConfigControlHandle)> {
10225        if let StreamConfigRequest::SetGain { target_state, control_handle } = self {
10226            Some((target_state, control_handle))
10227        } else {
10228            None
10229        }
10230    }
10231
10232    #[allow(irrefutable_let_patterns)]
10233    pub fn into_watch_plug_state(self) -> Option<(StreamConfigWatchPlugStateResponder)> {
10234        if let StreamConfigRequest::WatchPlugState { responder } = self {
10235            Some((responder))
10236        } else {
10237            None
10238        }
10239    }
10240
10241    /// Name of the method defined in FIDL
10242    pub fn method_name(&self) -> &'static str {
10243        match *self {
10244            StreamConfigRequest::GetHealthState { .. } => "get_health_state",
10245            StreamConfigRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
10246            StreamConfigRequest::GetProperties { .. } => "get_properties",
10247            StreamConfigRequest::GetSupportedFormats { .. } => "get_supported_formats",
10248            StreamConfigRequest::CreateRingBuffer { .. } => "create_ring_buffer",
10249            StreamConfigRequest::WatchGainState { .. } => "watch_gain_state",
10250            StreamConfigRequest::SetGain { .. } => "set_gain",
10251            StreamConfigRequest::WatchPlugState { .. } => "watch_plug_state",
10252        }
10253    }
10254}
10255
10256#[derive(Debug, Clone)]
10257pub struct StreamConfigControlHandle {
10258    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10259}
10260
10261impl StreamConfigControlHandle {
10262    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
10263        self.inner.shutdown_with_epitaph(status.into())
10264    }
10265}
10266
10267impl fdomain_client::fidl::ControlHandle for StreamConfigControlHandle {
10268    fn shutdown(&self) {
10269        self.inner.shutdown()
10270    }
10271
10272    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
10273        self.inner.shutdown_with_epitaph(status)
10274    }
10275
10276    fn is_closed(&self) -> bool {
10277        self.inner.channel().is_closed()
10278    }
10279    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
10280        self.inner.channel().on_closed()
10281    }
10282}
10283
10284impl StreamConfigControlHandle {}
10285
10286#[must_use = "FIDL methods require a response to be sent"]
10287#[derive(Debug)]
10288pub struct StreamConfigGetHealthStateResponder {
10289    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10290    tx_id: u32,
10291}
10292
10293/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10294/// if the responder is dropped without sending a response, so that the client
10295/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10296impl std::ops::Drop for StreamConfigGetHealthStateResponder {
10297    fn drop(&mut self) {
10298        self.control_handle.shutdown();
10299        // Safety: drops once, never accessed again
10300        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10301    }
10302}
10303
10304impl fdomain_client::fidl::Responder for StreamConfigGetHealthStateResponder {
10305    type ControlHandle = StreamConfigControlHandle;
10306
10307    fn control_handle(&self) -> &StreamConfigControlHandle {
10308        &self.control_handle
10309    }
10310
10311    fn drop_without_shutdown(mut self) {
10312        // Safety: drops once, never accessed again due to mem::forget
10313        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10314        // Prevent Drop from running (which would shut down the channel)
10315        std::mem::forget(self);
10316    }
10317}
10318
10319impl StreamConfigGetHealthStateResponder {
10320    /// Sends a response to the FIDL transaction.
10321    ///
10322    /// Sets the channel to shutdown if an error occurs.
10323    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
10324        let _result = self.send_raw(state);
10325        if _result.is_err() {
10326            self.control_handle.shutdown();
10327        }
10328        self.drop_without_shutdown();
10329        _result
10330    }
10331
10332    /// Similar to "send" but does not shutdown the channel if an error occurs.
10333    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
10334        let _result = self.send_raw(state);
10335        self.drop_without_shutdown();
10336        _result
10337    }
10338
10339    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
10340        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
10341            (state,),
10342            self.tx_id,
10343            0x4e146d6bca733a84,
10344            fidl::encoding::DynamicFlags::empty(),
10345        )
10346    }
10347}
10348
10349#[must_use = "FIDL methods require a response to be sent"]
10350#[derive(Debug)]
10351pub struct StreamConfigGetPropertiesResponder {
10352    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10353    tx_id: u32,
10354}
10355
10356/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10357/// if the responder is dropped without sending a response, so that the client
10358/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10359impl std::ops::Drop for StreamConfigGetPropertiesResponder {
10360    fn drop(&mut self) {
10361        self.control_handle.shutdown();
10362        // Safety: drops once, never accessed again
10363        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10364    }
10365}
10366
10367impl fdomain_client::fidl::Responder for StreamConfigGetPropertiesResponder {
10368    type ControlHandle = StreamConfigControlHandle;
10369
10370    fn control_handle(&self) -> &StreamConfigControlHandle {
10371        &self.control_handle
10372    }
10373
10374    fn drop_without_shutdown(mut self) {
10375        // Safety: drops once, never accessed again due to mem::forget
10376        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10377        // Prevent Drop from running (which would shut down the channel)
10378        std::mem::forget(self);
10379    }
10380}
10381
10382impl StreamConfigGetPropertiesResponder {
10383    /// Sends a response to the FIDL transaction.
10384    ///
10385    /// Sets the channel to shutdown if an error occurs.
10386    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
10387        let _result = self.send_raw(properties);
10388        if _result.is_err() {
10389            self.control_handle.shutdown();
10390        }
10391        self.drop_without_shutdown();
10392        _result
10393    }
10394
10395    /// Similar to "send" but does not shutdown the channel if an error occurs.
10396    pub fn send_no_shutdown_on_err(
10397        self,
10398        mut properties: &StreamProperties,
10399    ) -> Result<(), fidl::Error> {
10400        let _result = self.send_raw(properties);
10401        self.drop_without_shutdown();
10402        _result
10403    }
10404
10405    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
10406        self.control_handle.inner.send::<StreamConfigGetPropertiesResponse>(
10407            (properties,),
10408            self.tx_id,
10409            0x7d89c02f3e2d3c01,
10410            fidl::encoding::DynamicFlags::empty(),
10411        )
10412    }
10413}
10414
10415#[must_use = "FIDL methods require a response to be sent"]
10416#[derive(Debug)]
10417pub struct StreamConfigGetSupportedFormatsResponder {
10418    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10419    tx_id: u32,
10420}
10421
10422/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10423/// if the responder is dropped without sending a response, so that the client
10424/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10425impl std::ops::Drop for StreamConfigGetSupportedFormatsResponder {
10426    fn drop(&mut self) {
10427        self.control_handle.shutdown();
10428        // Safety: drops once, never accessed again
10429        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10430    }
10431}
10432
10433impl fdomain_client::fidl::Responder for StreamConfigGetSupportedFormatsResponder {
10434    type ControlHandle = StreamConfigControlHandle;
10435
10436    fn control_handle(&self) -> &StreamConfigControlHandle {
10437        &self.control_handle
10438    }
10439
10440    fn drop_without_shutdown(mut self) {
10441        // Safety: drops once, never accessed again due to mem::forget
10442        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10443        // Prevent Drop from running (which would shut down the channel)
10444        std::mem::forget(self);
10445    }
10446}
10447
10448impl StreamConfigGetSupportedFormatsResponder {
10449    /// Sends a response to the FIDL transaction.
10450    ///
10451    /// Sets the channel to shutdown if an error occurs.
10452    pub fn send(self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
10453        let _result = self.send_raw(supported_formats);
10454        if _result.is_err() {
10455            self.control_handle.shutdown();
10456        }
10457        self.drop_without_shutdown();
10458        _result
10459    }
10460
10461    /// Similar to "send" but does not shutdown the channel if an error occurs.
10462    pub fn send_no_shutdown_on_err(
10463        self,
10464        mut supported_formats: &[SupportedFormats],
10465    ) -> Result<(), fidl::Error> {
10466        let _result = self.send_raw(supported_formats);
10467        self.drop_without_shutdown();
10468        _result
10469    }
10470
10471    fn send_raw(&self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
10472        self.control_handle.inner.send::<StreamConfigGetSupportedFormatsResponse>(
10473            (supported_formats,),
10474            self.tx_id,
10475            0x448efa7850cafe7e,
10476            fidl::encoding::DynamicFlags::empty(),
10477        )
10478    }
10479}
10480
10481#[must_use = "FIDL methods require a response to be sent"]
10482#[derive(Debug)]
10483pub struct StreamConfigWatchGainStateResponder {
10484    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10485    tx_id: u32,
10486}
10487
10488/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10489/// if the responder is dropped without sending a response, so that the client
10490/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10491impl std::ops::Drop for StreamConfigWatchGainStateResponder {
10492    fn drop(&mut self) {
10493        self.control_handle.shutdown();
10494        // Safety: drops once, never accessed again
10495        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10496    }
10497}
10498
10499impl fdomain_client::fidl::Responder for StreamConfigWatchGainStateResponder {
10500    type ControlHandle = StreamConfigControlHandle;
10501
10502    fn control_handle(&self) -> &StreamConfigControlHandle {
10503        &self.control_handle
10504    }
10505
10506    fn drop_without_shutdown(mut self) {
10507        // Safety: drops once, never accessed again due to mem::forget
10508        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10509        // Prevent Drop from running (which would shut down the channel)
10510        std::mem::forget(self);
10511    }
10512}
10513
10514impl StreamConfigWatchGainStateResponder {
10515    /// Sends a response to the FIDL transaction.
10516    ///
10517    /// Sets the channel to shutdown if an error occurs.
10518    pub fn send(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
10519        let _result = self.send_raw(gain_state);
10520        if _result.is_err() {
10521            self.control_handle.shutdown();
10522        }
10523        self.drop_without_shutdown();
10524        _result
10525    }
10526
10527    /// Similar to "send" but does not shutdown the channel if an error occurs.
10528    pub fn send_no_shutdown_on_err(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
10529        let _result = self.send_raw(gain_state);
10530        self.drop_without_shutdown();
10531        _result
10532    }
10533
10534    fn send_raw(&self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
10535        self.control_handle.inner.send::<StreamConfigWatchGainStateResponse>(
10536            (gain_state,),
10537            self.tx_id,
10538            0x4772506136ab65c1,
10539            fidl::encoding::DynamicFlags::empty(),
10540        )
10541    }
10542}
10543
10544#[must_use = "FIDL methods require a response to be sent"]
10545#[derive(Debug)]
10546pub struct StreamConfigWatchPlugStateResponder {
10547    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
10548    tx_id: u32,
10549}
10550
10551/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
10552/// if the responder is dropped without sending a response, so that the client
10553/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10554impl std::ops::Drop for StreamConfigWatchPlugStateResponder {
10555    fn drop(&mut self) {
10556        self.control_handle.shutdown();
10557        // Safety: drops once, never accessed again
10558        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10559    }
10560}
10561
10562impl fdomain_client::fidl::Responder for StreamConfigWatchPlugStateResponder {
10563    type ControlHandle = StreamConfigControlHandle;
10564
10565    fn control_handle(&self) -> &StreamConfigControlHandle {
10566        &self.control_handle
10567    }
10568
10569    fn drop_without_shutdown(mut self) {
10570        // Safety: drops once, never accessed again due to mem::forget
10571        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10572        // Prevent Drop from running (which would shut down the channel)
10573        std::mem::forget(self);
10574    }
10575}
10576
10577impl StreamConfigWatchPlugStateResponder {
10578    /// Sends a response to the FIDL transaction.
10579    ///
10580    /// Sets the channel to shutdown if an error occurs.
10581    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
10582        let _result = self.send_raw(plug_state);
10583        if _result.is_err() {
10584            self.control_handle.shutdown();
10585        }
10586        self.drop_without_shutdown();
10587        _result
10588    }
10589
10590    /// Similar to "send" but does not shutdown the channel if an error occurs.
10591    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
10592        let _result = self.send_raw(plug_state);
10593        self.drop_without_shutdown();
10594        _result
10595    }
10596
10597    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
10598        self.control_handle.inner.send::<StreamConfigWatchPlugStateResponse>(
10599            (plug_state,),
10600            self.tx_id,
10601            0x497345a6f048b2a6,
10602            fidl::encoding::DynamicFlags::empty(),
10603        )
10604    }
10605}
10606
10607#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10608pub struct StreamConfigConnectorMarker;
10609
10610impl fdomain_client::fidl::ProtocolMarker for StreamConfigConnectorMarker {
10611    type Proxy = StreamConfigConnectorProxy;
10612    type RequestStream = StreamConfigConnectorRequestStream;
10613
10614    const DEBUG_NAME: &'static str = "(anonymous) StreamConfigConnector";
10615}
10616
10617pub trait StreamConfigConnectorProxyInterface: Send + Sync {
10618    fn r#connect(
10619        &self,
10620        protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10621    ) -> Result<(), fidl::Error>;
10622}
10623
10624#[derive(Debug, Clone)]
10625pub struct StreamConfigConnectorProxy {
10626    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
10627}
10628
10629impl fdomain_client::fidl::Proxy for StreamConfigConnectorProxy {
10630    type Protocol = StreamConfigConnectorMarker;
10631
10632    fn from_channel(inner: fdomain_client::Channel) -> Self {
10633        Self::new(inner)
10634    }
10635
10636    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
10637        self.client.into_channel().map_err(|client| Self { client })
10638    }
10639
10640    fn as_channel(&self) -> &fdomain_client::Channel {
10641        self.client.as_channel()
10642    }
10643}
10644
10645impl StreamConfigConnectorProxy {
10646    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfigConnector.
10647    pub fn new(channel: fdomain_client::Channel) -> Self {
10648        let protocol_name =
10649            <StreamConfigConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
10650        Self { client: fidl::client::Client::new(channel, protocol_name) }
10651    }
10652
10653    /// Get a Stream of events from the remote end of the protocol.
10654    ///
10655    /// # Panics
10656    ///
10657    /// Panics if the event stream was already taken.
10658    pub fn take_event_stream(&self) -> StreamConfigConnectorEventStream {
10659        StreamConfigConnectorEventStream { event_receiver: self.client.take_event_receiver() }
10660    }
10661
10662    /// Connect to a `StreamConfig` protocol.
10663    /// This method allows a component to serve FIDL outside the devhost's control.
10664    pub fn r#connect(
10665        &self,
10666        mut protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10667    ) -> Result<(), fidl::Error> {
10668        StreamConfigConnectorProxyInterface::r#connect(self, protocol)
10669    }
10670}
10671
10672impl StreamConfigConnectorProxyInterface for StreamConfigConnectorProxy {
10673    fn r#connect(
10674        &self,
10675        mut protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10676    ) -> Result<(), fidl::Error> {
10677        self.client.send::<StreamConfigConnectorConnectRequest>(
10678            (protocol,),
10679            0x22051ff3021eafec,
10680            fidl::encoding::DynamicFlags::empty(),
10681        )
10682    }
10683}
10684
10685pub struct StreamConfigConnectorEventStream {
10686    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
10687}
10688
10689impl std::marker::Unpin for StreamConfigConnectorEventStream {}
10690
10691impl futures::stream::FusedStream for StreamConfigConnectorEventStream {
10692    fn is_terminated(&self) -> bool {
10693        self.event_receiver.is_terminated()
10694    }
10695}
10696
10697impl futures::Stream for StreamConfigConnectorEventStream {
10698    type Item = Result<StreamConfigConnectorEvent, fidl::Error>;
10699
10700    fn poll_next(
10701        mut self: std::pin::Pin<&mut Self>,
10702        cx: &mut std::task::Context<'_>,
10703    ) -> std::task::Poll<Option<Self::Item>> {
10704        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10705            &mut self.event_receiver,
10706            cx
10707        )?) {
10708            Some(buf) => std::task::Poll::Ready(Some(StreamConfigConnectorEvent::decode(buf))),
10709            None => std::task::Poll::Ready(None),
10710        }
10711    }
10712}
10713
10714#[derive(Debug)]
10715pub enum StreamConfigConnectorEvent {}
10716
10717impl StreamConfigConnectorEvent {
10718    /// Decodes a message buffer as a [`StreamConfigConnectorEvent`].
10719    fn decode(
10720        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10721    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
10722        let (bytes, _handles) = buf.split_mut();
10723        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10724        debug_assert_eq!(tx_header.tx_id, 0);
10725        match tx_header.ordinal {
10726            _ => Err(fidl::Error::UnknownOrdinal {
10727                ordinal: tx_header.ordinal,
10728                protocol_name: <StreamConfigConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
10729            })
10730        }
10731    }
10732}
10733
10734/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfigConnector.
10735pub struct StreamConfigConnectorRequestStream {
10736    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10737    is_terminated: bool,
10738}
10739
10740impl std::marker::Unpin for StreamConfigConnectorRequestStream {}
10741
10742impl futures::stream::FusedStream for StreamConfigConnectorRequestStream {
10743    fn is_terminated(&self) -> bool {
10744        self.is_terminated
10745    }
10746}
10747
10748impl fdomain_client::fidl::RequestStream for StreamConfigConnectorRequestStream {
10749    type Protocol = StreamConfigConnectorMarker;
10750    type ControlHandle = StreamConfigConnectorControlHandle;
10751
10752    fn from_channel(channel: fdomain_client::Channel) -> Self {
10753        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10754    }
10755
10756    fn control_handle(&self) -> Self::ControlHandle {
10757        StreamConfigConnectorControlHandle { inner: self.inner.clone() }
10758    }
10759
10760    fn into_inner(
10761        self,
10762    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
10763    {
10764        (self.inner, self.is_terminated)
10765    }
10766
10767    fn from_inner(
10768        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10769        is_terminated: bool,
10770    ) -> Self {
10771        Self { inner, is_terminated }
10772    }
10773}
10774
10775impl futures::Stream for StreamConfigConnectorRequestStream {
10776    type Item = Result<StreamConfigConnectorRequest, fidl::Error>;
10777
10778    fn poll_next(
10779        mut self: std::pin::Pin<&mut Self>,
10780        cx: &mut std::task::Context<'_>,
10781    ) -> std::task::Poll<Option<Self::Item>> {
10782        let this = &mut *self;
10783        if this.inner.check_shutdown(cx) {
10784            this.is_terminated = true;
10785            return std::task::Poll::Ready(None);
10786        }
10787        if this.is_terminated {
10788            panic!("polled StreamConfigConnectorRequestStream after completion");
10789        }
10790        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
10791            |bytes, handles| {
10792                match this.inner.channel().read_etc(cx, bytes, handles) {
10793                    std::task::Poll::Ready(Ok(())) => {}
10794                    std::task::Poll::Pending => return std::task::Poll::Pending,
10795                    std::task::Poll::Ready(Err(None)) => {
10796                        this.is_terminated = true;
10797                        return std::task::Poll::Ready(None);
10798                    }
10799                    std::task::Poll::Ready(Err(Some(e))) => {
10800                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10801                            e.into(),
10802                        ))));
10803                    }
10804                }
10805
10806                // A message has been received from the channel
10807                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10808
10809                std::task::Poll::Ready(Some(match header.ordinal {
10810                0x22051ff3021eafec => {
10811                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10812                    let mut req = fidl::new_empty!(StreamConfigConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect);
10813                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StreamConfigConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
10814                    let control_handle = StreamConfigConnectorControlHandle {
10815                        inner: this.inner.clone(),
10816                    };
10817                    Ok(StreamConfigConnectorRequest::Connect {protocol: req.protocol,
10818
10819                        control_handle,
10820                    })
10821                }
10822                _ => Err(fidl::Error::UnknownOrdinal {
10823                    ordinal: header.ordinal,
10824                    protocol_name: <StreamConfigConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
10825                }),
10826            }))
10827            },
10828        )
10829    }
10830}
10831
10832/// For an overview see
10833/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/development/audio/drivers/streaming).
10834/// # Deprecation
10835///
10836/// Not supported anymore, instead use an
10837/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10838/// with one Ring Buffer, see
10839/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10840#[derive(Debug)]
10841pub enum StreamConfigConnectorRequest {
10842    /// Connect to a `StreamConfig` protocol.
10843    /// This method allows a component to serve FIDL outside the devhost's control.
10844    Connect {
10845        protocol: fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10846        control_handle: StreamConfigConnectorControlHandle,
10847    },
10848}
10849
10850impl StreamConfigConnectorRequest {
10851    #[allow(irrefutable_let_patterns)]
10852    pub fn into_connect(
10853        self,
10854    ) -> Option<(
10855        fdomain_client::fidl::ServerEnd<StreamConfigMarker>,
10856        StreamConfigConnectorControlHandle,
10857    )> {
10858        if let StreamConfigConnectorRequest::Connect { protocol, control_handle } = self {
10859            Some((protocol, control_handle))
10860        } else {
10861            None
10862        }
10863    }
10864
10865    /// Name of the method defined in FIDL
10866    pub fn method_name(&self) -> &'static str {
10867        match *self {
10868            StreamConfigConnectorRequest::Connect { .. } => "connect",
10869        }
10870    }
10871}
10872
10873#[derive(Debug, Clone)]
10874pub struct StreamConfigConnectorControlHandle {
10875    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
10876}
10877
10878impl StreamConfigConnectorControlHandle {
10879    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
10880        self.inner.shutdown_with_epitaph(status.into())
10881    }
10882}
10883
10884impl fdomain_client::fidl::ControlHandle for StreamConfigConnectorControlHandle {
10885    fn shutdown(&self) {
10886        self.inner.shutdown()
10887    }
10888
10889    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
10890        self.inner.shutdown_with_epitaph(status)
10891    }
10892
10893    fn is_closed(&self) -> bool {
10894        self.inner.channel().is_closed()
10895    }
10896    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
10897        self.inner.channel().on_closed()
10898    }
10899}
10900
10901impl StreamConfigConnectorControlHandle {}
10902
10903mod internal {
10904    use super::*;
10905
10906    impl fidl::encoding::ResourceTypeMarker for CodecConnectorConnectRequest {
10907        type Borrowed<'a> = &'a mut Self;
10908        fn take_or_borrow<'a>(
10909            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10910        ) -> Self::Borrowed<'a> {
10911            value
10912        }
10913    }
10914
10915    unsafe impl fidl::encoding::TypeMarker for CodecConnectorConnectRequest {
10916        type Owned = Self;
10917
10918        #[inline(always)]
10919        fn inline_align(_context: fidl::encoding::Context) -> usize {
10920            4
10921        }
10922
10923        #[inline(always)]
10924        fn inline_size(_context: fidl::encoding::Context) -> usize {
10925            4
10926        }
10927    }
10928
10929    unsafe impl
10930        fidl::encoding::Encode<
10931            CodecConnectorConnectRequest,
10932            fdomain_client::fidl::FDomainResourceDialect,
10933        > for &mut CodecConnectorConnectRequest
10934    {
10935        #[inline]
10936        unsafe fn encode(
10937            self,
10938            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10939            offset: usize,
10940            _depth: fidl::encoding::Depth,
10941        ) -> fidl::Result<()> {
10942            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10943            // Delegate to tuple encoding.
10944            fidl::encoding::Encode::<CodecConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
10945                (
10946                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.codec_protocol),
10947                ),
10948                encoder, offset, _depth
10949            )
10950        }
10951    }
10952    unsafe impl<
10953        T0: fidl::encoding::Encode<
10954                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>>,
10955                fdomain_client::fidl::FDomainResourceDialect,
10956            >,
10957    >
10958        fidl::encoding::Encode<
10959            CodecConnectorConnectRequest,
10960            fdomain_client::fidl::FDomainResourceDialect,
10961        > for (T0,)
10962    {
10963        #[inline]
10964        unsafe fn encode(
10965            self,
10966            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10967            offset: usize,
10968            depth: fidl::encoding::Depth,
10969        ) -> fidl::Result<()> {
10970            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10971            // Zero out padding regions. There's no need to apply masks
10972            // because the unmasked parts will be overwritten by fields.
10973            // Write the fields.
10974            self.0.encode(encoder, offset + 0, depth)?;
10975            Ok(())
10976        }
10977    }
10978
10979    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
10980        for CodecConnectorConnectRequest
10981    {
10982        #[inline(always)]
10983        fn new_empty() -> Self {
10984            Self {
10985                codec_protocol: fidl::new_empty!(
10986                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>>,
10987                    fdomain_client::fidl::FDomainResourceDialect
10988                ),
10989            }
10990        }
10991
10992        #[inline]
10993        unsafe fn decode(
10994            &mut self,
10995            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10996            offset: usize,
10997            _depth: fidl::encoding::Depth,
10998        ) -> fidl::Result<()> {
10999            decoder.debug_check_bounds::<Self>(offset);
11000            // Verify that padding bytes are zero.
11001            fidl::decode!(
11002                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CodecMarker>>,
11003                fdomain_client::fidl::FDomainResourceDialect,
11004                &mut self.codec_protocol,
11005                decoder,
11006                offset + 0,
11007                _depth
11008            )?;
11009            Ok(())
11010        }
11011    }
11012
11013    impl fidl::encoding::ResourceTypeMarker for CompositeConnectorConnectRequest {
11014        type Borrowed<'a> = &'a mut Self;
11015        fn take_or_borrow<'a>(
11016            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11017        ) -> Self::Borrowed<'a> {
11018            value
11019        }
11020    }
11021
11022    unsafe impl fidl::encoding::TypeMarker for CompositeConnectorConnectRequest {
11023        type Owned = Self;
11024
11025        #[inline(always)]
11026        fn inline_align(_context: fidl::encoding::Context) -> usize {
11027            4
11028        }
11029
11030        #[inline(always)]
11031        fn inline_size(_context: fidl::encoding::Context) -> usize {
11032            4
11033        }
11034    }
11035
11036    unsafe impl
11037        fidl::encoding::Encode<
11038            CompositeConnectorConnectRequest,
11039            fdomain_client::fidl::FDomainResourceDialect,
11040        > for &mut CompositeConnectorConnectRequest
11041    {
11042        #[inline]
11043        unsafe fn encode(
11044            self,
11045            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11046            offset: usize,
11047            _depth: fidl::encoding::Depth,
11048        ) -> fidl::Result<()> {
11049            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
11050            // Delegate to tuple encoding.
11051            fidl::encoding::Encode::<CompositeConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11052                (
11053                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.composite_protocol),
11054                ),
11055                encoder, offset, _depth
11056            )
11057        }
11058    }
11059    unsafe impl<
11060        T0: fidl::encoding::Encode<
11061                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>>,
11062                fdomain_client::fidl::FDomainResourceDialect,
11063            >,
11064    >
11065        fidl::encoding::Encode<
11066            CompositeConnectorConnectRequest,
11067            fdomain_client::fidl::FDomainResourceDialect,
11068        > for (T0,)
11069    {
11070        #[inline]
11071        unsafe fn encode(
11072            self,
11073            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11074            offset: usize,
11075            depth: fidl::encoding::Depth,
11076        ) -> fidl::Result<()> {
11077            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
11078            // Zero out padding regions. There's no need to apply masks
11079            // because the unmasked parts will be overwritten by fields.
11080            // Write the fields.
11081            self.0.encode(encoder, offset + 0, depth)?;
11082            Ok(())
11083        }
11084    }
11085
11086    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11087        for CompositeConnectorConnectRequest
11088    {
11089        #[inline(always)]
11090        fn new_empty() -> Self {
11091            Self {
11092                composite_protocol: fidl::new_empty!(
11093                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>>,
11094                    fdomain_client::fidl::FDomainResourceDialect
11095                ),
11096            }
11097        }
11098
11099        #[inline]
11100        unsafe fn decode(
11101            &mut self,
11102            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11103            offset: usize,
11104            _depth: fidl::encoding::Depth,
11105        ) -> fidl::Result<()> {
11106            decoder.debug_check_bounds::<Self>(offset);
11107            // Verify that padding bytes are zero.
11108            fidl::decode!(
11109                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CompositeMarker>>,
11110                fdomain_client::fidl::FDomainResourceDialect,
11111                &mut self.composite_protocol,
11112                decoder,
11113                offset + 0,
11114                _depth
11115            )?;
11116            Ok(())
11117        }
11118    }
11119
11120    impl fidl::encoding::ResourceTypeMarker for CompositeCreatePacketStreamRequest {
11121        type Borrowed<'a> = &'a mut Self;
11122        fn take_or_borrow<'a>(
11123            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11124        ) -> Self::Borrowed<'a> {
11125            value
11126        }
11127    }
11128
11129    unsafe impl fidl::encoding::TypeMarker for CompositeCreatePacketStreamRequest {
11130        type Owned = Self;
11131
11132        #[inline(always)]
11133        fn inline_align(_context: fidl::encoding::Context) -> usize {
11134            8
11135        }
11136
11137        #[inline(always)]
11138        fn inline_size(_context: fidl::encoding::Context) -> usize {
11139            32
11140        }
11141    }
11142
11143    unsafe impl
11144        fidl::encoding::Encode<
11145            CompositeCreatePacketStreamRequest,
11146            fdomain_client::fidl::FDomainResourceDialect,
11147        > for &mut CompositeCreatePacketStreamRequest
11148    {
11149        #[inline]
11150        unsafe fn encode(
11151            self,
11152            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11153            offset: usize,
11154            _depth: fidl::encoding::Depth,
11155        ) -> fidl::Result<()> {
11156            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
11157            // Delegate to tuple encoding.
11158            fidl::encoding::Encode::<
11159                CompositeCreatePacketStreamRequest,
11160                fdomain_client::fidl::FDomainResourceDialect,
11161            >::encode(
11162                (
11163                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
11164                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
11165                    <fidl::encoding::Endpoint<
11166                        fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11167                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11168                        &mut self.packet_stream_control,
11169                    ),
11170                ),
11171                encoder,
11172                offset,
11173                _depth,
11174            )
11175        }
11176    }
11177    unsafe impl<
11178        T0: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
11179        T1: fidl::encoding::Encode<Format2, fdomain_client::fidl::FDomainResourceDialect>,
11180        T2: fidl::encoding::Encode<
11181                fidl::encoding::Endpoint<
11182                    fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11183                >,
11184                fdomain_client::fidl::FDomainResourceDialect,
11185            >,
11186    >
11187        fidl::encoding::Encode<
11188            CompositeCreatePacketStreamRequest,
11189            fdomain_client::fidl::FDomainResourceDialect,
11190        > for (T0, T1, T2)
11191    {
11192        #[inline]
11193        unsafe fn encode(
11194            self,
11195            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11196            offset: usize,
11197            depth: fidl::encoding::Depth,
11198        ) -> fidl::Result<()> {
11199            encoder.debug_check_bounds::<CompositeCreatePacketStreamRequest>(offset);
11200            // Zero out padding regions. There's no need to apply masks
11201            // because the unmasked parts will be overwritten by fields.
11202            unsafe {
11203                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
11204                (ptr as *mut u64).write_unaligned(0);
11205            }
11206            // Write the fields.
11207            self.0.encode(encoder, offset + 0, depth)?;
11208            self.1.encode(encoder, offset + 8, depth)?;
11209            self.2.encode(encoder, offset + 24, depth)?;
11210            Ok(())
11211        }
11212    }
11213
11214    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11215        for CompositeCreatePacketStreamRequest
11216    {
11217        #[inline(always)]
11218        fn new_empty() -> Self {
11219            Self {
11220                processing_element_id: fidl::new_empty!(
11221                    u64,
11222                    fdomain_client::fidl::FDomainResourceDialect
11223                ),
11224                format: fidl::new_empty!(Format2, fdomain_client::fidl::FDomainResourceDialect),
11225                packet_stream_control: fidl::new_empty!(
11226                    fidl::encoding::Endpoint<
11227                        fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11228                    >,
11229                    fdomain_client::fidl::FDomainResourceDialect
11230                ),
11231            }
11232        }
11233
11234        #[inline]
11235        unsafe fn decode(
11236            &mut self,
11237            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11238            offset: usize,
11239            _depth: fidl::encoding::Depth,
11240        ) -> fidl::Result<()> {
11241            decoder.debug_check_bounds::<Self>(offset);
11242            // Verify that padding bytes are zero.
11243            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
11244            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11245            let mask = 0xffffffff00000000u64;
11246            let maskedval = padval & mask;
11247            if maskedval != 0 {
11248                return Err(fidl::Error::NonZeroPadding {
11249                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
11250                });
11251            }
11252            fidl::decode!(
11253                u64,
11254                fdomain_client::fidl::FDomainResourceDialect,
11255                &mut self.processing_element_id,
11256                decoder,
11257                offset + 0,
11258                _depth
11259            )?;
11260            fidl::decode!(
11261                Format2,
11262                fdomain_client::fidl::FDomainResourceDialect,
11263                &mut self.format,
11264                decoder,
11265                offset + 8,
11266                _depth
11267            )?;
11268            fidl::decode!(
11269                fidl::encoding::Endpoint<
11270                    fdomain_client::fidl::ServerEnd<PacketStreamControlMarker>,
11271                >,
11272                fdomain_client::fidl::FDomainResourceDialect,
11273                &mut self.packet_stream_control,
11274                decoder,
11275                offset + 24,
11276                _depth
11277            )?;
11278            Ok(())
11279        }
11280    }
11281
11282    impl fidl::encoding::ResourceTypeMarker for CompositeCreateRingBufferRequest {
11283        type Borrowed<'a> = &'a mut Self;
11284        fn take_or_borrow<'a>(
11285            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11286        ) -> Self::Borrowed<'a> {
11287            value
11288        }
11289    }
11290
11291    unsafe impl fidl::encoding::TypeMarker for CompositeCreateRingBufferRequest {
11292        type Owned = Self;
11293
11294        #[inline(always)]
11295        fn inline_align(_context: fidl::encoding::Context) -> usize {
11296            8
11297        }
11298
11299        #[inline(always)]
11300        fn inline_size(_context: fidl::encoding::Context) -> usize {
11301            32
11302        }
11303    }
11304
11305    unsafe impl
11306        fidl::encoding::Encode<
11307            CompositeCreateRingBufferRequest,
11308            fdomain_client::fidl::FDomainResourceDialect,
11309        > for &mut CompositeCreateRingBufferRequest
11310    {
11311        #[inline]
11312        unsafe fn encode(
11313            self,
11314            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11315            offset: usize,
11316            _depth: fidl::encoding::Depth,
11317        ) -> fidl::Result<()> {
11318            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
11319            // Delegate to tuple encoding.
11320            fidl::encoding::Encode::<CompositeCreateRingBufferRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11321                (
11322                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
11323                    <Format2 as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
11324                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11325                ),
11326                encoder, offset, _depth
11327            )
11328        }
11329    }
11330    unsafe impl<
11331        T0: fidl::encoding::Encode<u64, fdomain_client::fidl::FDomainResourceDialect>,
11332        T1: fidl::encoding::Encode<Format2, fdomain_client::fidl::FDomainResourceDialect>,
11333        T2: fidl::encoding::Encode<
11334                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11335                fdomain_client::fidl::FDomainResourceDialect,
11336            >,
11337    >
11338        fidl::encoding::Encode<
11339            CompositeCreateRingBufferRequest,
11340            fdomain_client::fidl::FDomainResourceDialect,
11341        > for (T0, T1, T2)
11342    {
11343        #[inline]
11344        unsafe fn encode(
11345            self,
11346            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11347            offset: usize,
11348            depth: fidl::encoding::Depth,
11349        ) -> fidl::Result<()> {
11350            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
11351            // Zero out padding regions. There's no need to apply masks
11352            // because the unmasked parts will be overwritten by fields.
11353            unsafe {
11354                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
11355                (ptr as *mut u64).write_unaligned(0);
11356            }
11357            // Write the fields.
11358            self.0.encode(encoder, offset + 0, depth)?;
11359            self.1.encode(encoder, offset + 8, depth)?;
11360            self.2.encode(encoder, offset + 24, depth)?;
11361            Ok(())
11362        }
11363    }
11364
11365    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11366        for CompositeCreateRingBufferRequest
11367    {
11368        #[inline(always)]
11369        fn new_empty() -> Self {
11370            Self {
11371                processing_element_id: fidl::new_empty!(
11372                    u64,
11373                    fdomain_client::fidl::FDomainResourceDialect
11374                ),
11375                format: fidl::new_empty!(Format2, fdomain_client::fidl::FDomainResourceDialect),
11376                ring_buffer: fidl::new_empty!(
11377                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11378                    fdomain_client::fidl::FDomainResourceDialect
11379                ),
11380            }
11381        }
11382
11383        #[inline]
11384        unsafe fn decode(
11385            &mut self,
11386            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11387            offset: usize,
11388            _depth: fidl::encoding::Depth,
11389        ) -> fidl::Result<()> {
11390            decoder.debug_check_bounds::<Self>(offset);
11391            // Verify that padding bytes are zero.
11392            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
11393            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11394            let mask = 0xffffffff00000000u64;
11395            let maskedval = padval & mask;
11396            if maskedval != 0 {
11397                return Err(fidl::Error::NonZeroPadding {
11398                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
11399                });
11400            }
11401            fidl::decode!(
11402                u64,
11403                fdomain_client::fidl::FDomainResourceDialect,
11404                &mut self.processing_element_id,
11405                decoder,
11406                offset + 0,
11407                _depth
11408            )?;
11409            fidl::decode!(
11410                Format2,
11411                fdomain_client::fidl::FDomainResourceDialect,
11412                &mut self.format,
11413                decoder,
11414                offset + 8,
11415                _depth
11416            )?;
11417            fidl::decode!(
11418                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11419                fdomain_client::fidl::FDomainResourceDialect,
11420                &mut self.ring_buffer,
11421                decoder,
11422                offset + 24,
11423                _depth
11424            )?;
11425            Ok(())
11426        }
11427    }
11428
11429    impl fidl::encoding::ResourceTypeMarker for DaiConnectorConnectRequest {
11430        type Borrowed<'a> = &'a mut Self;
11431        fn take_or_borrow<'a>(
11432            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11433        ) -> Self::Borrowed<'a> {
11434            value
11435        }
11436    }
11437
11438    unsafe impl fidl::encoding::TypeMarker for DaiConnectorConnectRequest {
11439        type Owned = Self;
11440
11441        #[inline(always)]
11442        fn inline_align(_context: fidl::encoding::Context) -> usize {
11443            4
11444        }
11445
11446        #[inline(always)]
11447        fn inline_size(_context: fidl::encoding::Context) -> usize {
11448            4
11449        }
11450    }
11451
11452    unsafe impl
11453        fidl::encoding::Encode<
11454            DaiConnectorConnectRequest,
11455            fdomain_client::fidl::FDomainResourceDialect,
11456        > for &mut DaiConnectorConnectRequest
11457    {
11458        #[inline]
11459        unsafe fn encode(
11460            self,
11461            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11462            offset: usize,
11463            _depth: fidl::encoding::Depth,
11464        ) -> fidl::Result<()> {
11465            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
11466            // Delegate to tuple encoding.
11467            fidl::encoding::Encode::<DaiConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11468                (
11469                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dai_protocol),
11470                ),
11471                encoder, offset, _depth
11472            )
11473        }
11474    }
11475    unsafe impl<
11476        T0: fidl::encoding::Encode<
11477                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>>,
11478                fdomain_client::fidl::FDomainResourceDialect,
11479            >,
11480    >
11481        fidl::encoding::Encode<
11482            DaiConnectorConnectRequest,
11483            fdomain_client::fidl::FDomainResourceDialect,
11484        > for (T0,)
11485    {
11486        #[inline]
11487        unsafe fn encode(
11488            self,
11489            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11490            offset: usize,
11491            depth: fidl::encoding::Depth,
11492        ) -> fidl::Result<()> {
11493            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
11494            // Zero out padding regions. There's no need to apply masks
11495            // because the unmasked parts will be overwritten by fields.
11496            // Write the fields.
11497            self.0.encode(encoder, offset + 0, depth)?;
11498            Ok(())
11499        }
11500    }
11501
11502    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11503        for DaiConnectorConnectRequest
11504    {
11505        #[inline(always)]
11506        fn new_empty() -> Self {
11507            Self {
11508                dai_protocol: fidl::new_empty!(
11509                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>>,
11510                    fdomain_client::fidl::FDomainResourceDialect
11511                ),
11512            }
11513        }
11514
11515        #[inline]
11516        unsafe fn decode(
11517            &mut self,
11518            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11519            offset: usize,
11520            _depth: fidl::encoding::Depth,
11521        ) -> fidl::Result<()> {
11522            decoder.debug_check_bounds::<Self>(offset);
11523            // Verify that padding bytes are zero.
11524            fidl::decode!(
11525                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<DaiMarker>>,
11526                fdomain_client::fidl::FDomainResourceDialect,
11527                &mut self.dai_protocol,
11528                decoder,
11529                offset + 0,
11530                _depth
11531            )?;
11532            Ok(())
11533        }
11534    }
11535
11536    impl fidl::encoding::ResourceTypeMarker for DaiCreateRingBufferRequest {
11537        type Borrowed<'a> = &'a mut Self;
11538        fn take_or_borrow<'a>(
11539            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11540        ) -> Self::Borrowed<'a> {
11541            value
11542        }
11543    }
11544
11545    unsafe impl fidl::encoding::TypeMarker for DaiCreateRingBufferRequest {
11546        type Owned = Self;
11547
11548        #[inline(always)]
11549        fn inline_align(_context: fidl::encoding::Context) -> usize {
11550            8
11551        }
11552
11553        #[inline(always)]
11554        fn inline_size(_context: fidl::encoding::Context) -> usize {
11555            72
11556        }
11557    }
11558
11559    unsafe impl
11560        fidl::encoding::Encode<
11561            DaiCreateRingBufferRequest,
11562            fdomain_client::fidl::FDomainResourceDialect,
11563        > for &mut DaiCreateRingBufferRequest
11564    {
11565        #[inline]
11566        unsafe fn encode(
11567            self,
11568            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11569            offset: usize,
11570            _depth: fidl::encoding::Depth,
11571        ) -> fidl::Result<()> {
11572            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11573            // Delegate to tuple encoding.
11574            fidl::encoding::Encode::<DaiCreateRingBufferRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11575                (
11576                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_format),
11577                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_format),
11578                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11579                ),
11580                encoder, offset, _depth
11581            )
11582        }
11583    }
11584    unsafe impl<
11585        T0: fidl::encoding::Encode<DaiFormat, fdomain_client::fidl::FDomainResourceDialect>,
11586        T1: fidl::encoding::Encode<Format, fdomain_client::fidl::FDomainResourceDialect>,
11587        T2: fidl::encoding::Encode<
11588                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11589                fdomain_client::fidl::FDomainResourceDialect,
11590            >,
11591    >
11592        fidl::encoding::Encode<
11593            DaiCreateRingBufferRequest,
11594            fdomain_client::fidl::FDomainResourceDialect,
11595        > for (T0, T1, T2)
11596    {
11597        #[inline]
11598        unsafe fn encode(
11599            self,
11600            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11601            offset: usize,
11602            depth: fidl::encoding::Depth,
11603        ) -> fidl::Result<()> {
11604            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11605            // Zero out padding regions. There's no need to apply masks
11606            // because the unmasked parts will be overwritten by fields.
11607            unsafe {
11608                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
11609                (ptr as *mut u64).write_unaligned(0);
11610            }
11611            // Write the fields.
11612            self.0.encode(encoder, offset + 0, depth)?;
11613            self.1.encode(encoder, offset + 48, depth)?;
11614            self.2.encode(encoder, offset + 64, depth)?;
11615            Ok(())
11616        }
11617    }
11618
11619    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11620        for DaiCreateRingBufferRequest
11621    {
11622        #[inline(always)]
11623        fn new_empty() -> Self {
11624            Self {
11625                dai_format: fidl::new_empty!(
11626                    DaiFormat,
11627                    fdomain_client::fidl::FDomainResourceDialect
11628                ),
11629                ring_buffer_format: fidl::new_empty!(
11630                    Format,
11631                    fdomain_client::fidl::FDomainResourceDialect
11632                ),
11633                ring_buffer: fidl::new_empty!(
11634                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11635                    fdomain_client::fidl::FDomainResourceDialect
11636                ),
11637            }
11638        }
11639
11640        #[inline]
11641        unsafe fn decode(
11642            &mut self,
11643            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11644            offset: usize,
11645            _depth: fidl::encoding::Depth,
11646        ) -> fidl::Result<()> {
11647            decoder.debug_check_bounds::<Self>(offset);
11648            // Verify that padding bytes are zero.
11649            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
11650            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11651            let mask = 0xffffffff00000000u64;
11652            let maskedval = padval & mask;
11653            if maskedval != 0 {
11654                return Err(fidl::Error::NonZeroPadding {
11655                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
11656                });
11657            }
11658            fidl::decode!(
11659                DaiFormat,
11660                fdomain_client::fidl::FDomainResourceDialect,
11661                &mut self.dai_format,
11662                decoder,
11663                offset + 0,
11664                _depth
11665            )?;
11666            fidl::decode!(
11667                Format,
11668                fdomain_client::fidl::FDomainResourceDialect,
11669                &mut self.ring_buffer_format,
11670                decoder,
11671                offset + 48,
11672                _depth
11673            )?;
11674            fidl::decode!(
11675                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
11676                fdomain_client::fidl::FDomainResourceDialect,
11677                &mut self.ring_buffer,
11678                decoder,
11679                offset + 64,
11680                _depth
11681            )?;
11682            Ok(())
11683        }
11684    }
11685
11686    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlAllocateVmosResponse {
11687        type Borrowed<'a> = &'a mut Self;
11688        fn take_or_borrow<'a>(
11689            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11690        ) -> Self::Borrowed<'a> {
11691            value
11692        }
11693    }
11694
11695    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlAllocateVmosResponse {
11696        type Owned = Self;
11697
11698        #[inline(always)]
11699        fn inline_align(_context: fidl::encoding::Context) -> usize {
11700            8
11701        }
11702
11703        #[inline(always)]
11704        fn inline_size(_context: fidl::encoding::Context) -> usize {
11705            16
11706        }
11707    }
11708
11709    unsafe impl
11710        fidl::encoding::Encode<
11711            PacketStreamControlAllocateVmosResponse,
11712            fdomain_client::fidl::FDomainResourceDialect,
11713        > for &mut PacketStreamControlAllocateVmosResponse
11714    {
11715        #[inline]
11716        unsafe fn encode(
11717            self,
11718            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11719            offset: usize,
11720            _depth: fidl::encoding::Depth,
11721        ) -> fidl::Result<()> {
11722            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
11723            // Delegate to tuple encoding.
11724            fidl::encoding::Encode::<PacketStreamControlAllocateVmosResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
11725                (
11726                    <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmos),
11727                ),
11728                encoder, offset, _depth
11729            )
11730        }
11731    }
11732    unsafe impl<
11733        T0: fidl::encoding::Encode<
11734                fidl::encoding::Vector<VmoInfo, 256>,
11735                fdomain_client::fidl::FDomainResourceDialect,
11736            >,
11737    >
11738        fidl::encoding::Encode<
11739            PacketStreamControlAllocateVmosResponse,
11740            fdomain_client::fidl::FDomainResourceDialect,
11741        > for (T0,)
11742    {
11743        #[inline]
11744        unsafe fn encode(
11745            self,
11746            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11747            offset: usize,
11748            depth: fidl::encoding::Depth,
11749        ) -> fidl::Result<()> {
11750            encoder.debug_check_bounds::<PacketStreamControlAllocateVmosResponse>(offset);
11751            // Zero out padding regions. There's no need to apply masks
11752            // because the unmasked parts will be overwritten by fields.
11753            // Write the fields.
11754            self.0.encode(encoder, offset + 0, depth)?;
11755            Ok(())
11756        }
11757    }
11758
11759    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11760        for PacketStreamControlAllocateVmosResponse
11761    {
11762        #[inline(always)]
11763        fn new_empty() -> Self {
11764            Self {
11765                vmos: fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect),
11766            }
11767        }
11768
11769        #[inline]
11770        unsafe fn decode(
11771            &mut self,
11772            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11773            offset: usize,
11774            _depth: fidl::encoding::Depth,
11775        ) -> fidl::Result<()> {
11776            decoder.debug_check_bounds::<Self>(offset);
11777            // Verify that padding bytes are zero.
11778            fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect, &mut self.vmos, decoder, offset + 0, _depth)?;
11779            Ok(())
11780        }
11781    }
11782
11783    impl fidl::encoding::ResourceTypeMarker for RingBufferGetVmoResponse {
11784        type Borrowed<'a> = &'a mut Self;
11785        fn take_or_borrow<'a>(
11786            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11787        ) -> Self::Borrowed<'a> {
11788            value
11789        }
11790    }
11791
11792    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoResponse {
11793        type Owned = Self;
11794
11795        #[inline(always)]
11796        fn inline_align(_context: fidl::encoding::Context) -> usize {
11797            4
11798        }
11799
11800        #[inline(always)]
11801        fn inline_size(_context: fidl::encoding::Context) -> usize {
11802            8
11803        }
11804    }
11805
11806    unsafe impl
11807        fidl::encoding::Encode<
11808            RingBufferGetVmoResponse,
11809            fdomain_client::fidl::FDomainResourceDialect,
11810        > for &mut RingBufferGetVmoResponse
11811    {
11812        #[inline]
11813        unsafe fn encode(
11814            self,
11815            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11816            offset: usize,
11817            _depth: fidl::encoding::Depth,
11818        ) -> fidl::Result<()> {
11819            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11820            // Delegate to tuple encoding.
11821            fidl::encoding::Encode::<
11822                RingBufferGetVmoResponse,
11823                fdomain_client::fidl::FDomainResourceDialect,
11824            >::encode(
11825                (
11826                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_frames),
11827                    <fidl::encoding::HandleType<
11828                        fdomain_client::Vmo,
11829                        { fidl::ObjectType::VMO.into_raw() },
11830                        2147483648,
11831                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11832                        &mut self.ring_buffer
11833                    ),
11834                ),
11835                encoder,
11836                offset,
11837                _depth,
11838            )
11839        }
11840    }
11841    unsafe impl<
11842        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
11843        T1: fidl::encoding::Encode<
11844                fidl::encoding::HandleType<
11845                    fdomain_client::Vmo,
11846                    { fidl::ObjectType::VMO.into_raw() },
11847                    2147483648,
11848                >,
11849                fdomain_client::fidl::FDomainResourceDialect,
11850            >,
11851    >
11852        fidl::encoding::Encode<
11853            RingBufferGetVmoResponse,
11854            fdomain_client::fidl::FDomainResourceDialect,
11855        > for (T0, T1)
11856    {
11857        #[inline]
11858        unsafe fn encode(
11859            self,
11860            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11861            offset: usize,
11862            depth: fidl::encoding::Depth,
11863        ) -> fidl::Result<()> {
11864            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11865            // Zero out padding regions. There's no need to apply masks
11866            // because the unmasked parts will be overwritten by fields.
11867            // Write the fields.
11868            self.0.encode(encoder, offset + 0, depth)?;
11869            self.1.encode(encoder, offset + 4, depth)?;
11870            Ok(())
11871        }
11872    }
11873
11874    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11875        for RingBufferGetVmoResponse
11876    {
11877        #[inline(always)]
11878        fn new_empty() -> Self {
11879            Self {
11880                num_frames: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
11881                ring_buffer: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
11882            }
11883        }
11884
11885        #[inline]
11886        unsafe fn decode(
11887            &mut self,
11888            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11889            offset: usize,
11890            _depth: fidl::encoding::Depth,
11891        ) -> fidl::Result<()> {
11892            decoder.debug_check_bounds::<Self>(offset);
11893            // Verify that padding bytes are zero.
11894            fidl::decode!(
11895                u32,
11896                fdomain_client::fidl::FDomainResourceDialect,
11897                &mut self.num_frames,
11898                decoder,
11899                offset + 0,
11900                _depth
11901            )?;
11902            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)?;
11903            Ok(())
11904        }
11905    }
11906
11907    impl fidl::encoding::ResourceTypeMarker for StreamConfigConnectorConnectRequest {
11908        type Borrowed<'a> = &'a mut Self;
11909        fn take_or_borrow<'a>(
11910            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11911        ) -> Self::Borrowed<'a> {
11912            value
11913        }
11914    }
11915
11916    unsafe impl fidl::encoding::TypeMarker for StreamConfigConnectorConnectRequest {
11917        type Owned = Self;
11918
11919        #[inline(always)]
11920        fn inline_align(_context: fidl::encoding::Context) -> usize {
11921            4
11922        }
11923
11924        #[inline(always)]
11925        fn inline_size(_context: fidl::encoding::Context) -> usize {
11926            4
11927        }
11928    }
11929
11930    unsafe impl
11931        fidl::encoding::Encode<
11932            StreamConfigConnectorConnectRequest,
11933            fdomain_client::fidl::FDomainResourceDialect,
11934        > for &mut StreamConfigConnectorConnectRequest
11935    {
11936        #[inline]
11937        unsafe fn encode(
11938            self,
11939            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11940            offset: usize,
11941            _depth: fidl::encoding::Depth,
11942        ) -> fidl::Result<()> {
11943            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11944            // Delegate to tuple encoding.
11945            fidl::encoding::Encode::<StreamConfigConnectorConnectRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
11946                (
11947                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
11948                ),
11949                encoder, offset, _depth
11950            )
11951        }
11952    }
11953    unsafe impl<
11954        T0: fidl::encoding::Encode<
11955                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>>,
11956                fdomain_client::fidl::FDomainResourceDialect,
11957            >,
11958    >
11959        fidl::encoding::Encode<
11960            StreamConfigConnectorConnectRequest,
11961            fdomain_client::fidl::FDomainResourceDialect,
11962        > for (T0,)
11963    {
11964        #[inline]
11965        unsafe fn encode(
11966            self,
11967            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11968            offset: usize,
11969            depth: fidl::encoding::Depth,
11970        ) -> fidl::Result<()> {
11971            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11972            // Zero out padding regions. There's no need to apply masks
11973            // because the unmasked parts will be overwritten by fields.
11974            // Write the fields.
11975            self.0.encode(encoder, offset + 0, depth)?;
11976            Ok(())
11977        }
11978    }
11979
11980    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
11981        for StreamConfigConnectorConnectRequest
11982    {
11983        #[inline(always)]
11984        fn new_empty() -> Self {
11985            Self {
11986                protocol: fidl::new_empty!(
11987                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>>,
11988                    fdomain_client::fidl::FDomainResourceDialect
11989                ),
11990            }
11991        }
11992
11993        #[inline]
11994        unsafe fn decode(
11995            &mut self,
11996            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
11997            offset: usize,
11998            _depth: fidl::encoding::Depth,
11999        ) -> fidl::Result<()> {
12000            decoder.debug_check_bounds::<Self>(offset);
12001            // Verify that padding bytes are zero.
12002            fidl::decode!(
12003                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<StreamConfigMarker>>,
12004                fdomain_client::fidl::FDomainResourceDialect,
12005                &mut self.protocol,
12006                decoder,
12007                offset + 0,
12008                _depth
12009            )?;
12010            Ok(())
12011        }
12012    }
12013
12014    impl fidl::encoding::ResourceTypeMarker for StreamConfigCreateRingBufferRequest {
12015        type Borrowed<'a> = &'a mut Self;
12016        fn take_or_borrow<'a>(
12017            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12018        ) -> Self::Borrowed<'a> {
12019            value
12020        }
12021    }
12022
12023    unsafe impl fidl::encoding::TypeMarker for StreamConfigCreateRingBufferRequest {
12024        type Owned = Self;
12025
12026        #[inline(always)]
12027        fn inline_align(_context: fidl::encoding::Context) -> usize {
12028            8
12029        }
12030
12031        #[inline(always)]
12032        fn inline_size(_context: fidl::encoding::Context) -> usize {
12033            24
12034        }
12035    }
12036
12037    unsafe impl
12038        fidl::encoding::Encode<
12039            StreamConfigCreateRingBufferRequest,
12040            fdomain_client::fidl::FDomainResourceDialect,
12041        > for &mut StreamConfigCreateRingBufferRequest
12042    {
12043        #[inline]
12044        unsafe fn encode(
12045            self,
12046            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12047            offset: usize,
12048            _depth: fidl::encoding::Depth,
12049        ) -> fidl::Result<()> {
12050            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
12051            // Delegate to tuple encoding.
12052            fidl::encoding::Encode::<StreamConfigCreateRingBufferRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
12053                (
12054                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
12055                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
12056                ),
12057                encoder, offset, _depth
12058            )
12059        }
12060    }
12061    unsafe impl<
12062        T0: fidl::encoding::Encode<Format, fdomain_client::fidl::FDomainResourceDialect>,
12063        T1: fidl::encoding::Encode<
12064                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
12065                fdomain_client::fidl::FDomainResourceDialect,
12066            >,
12067    >
12068        fidl::encoding::Encode<
12069            StreamConfigCreateRingBufferRequest,
12070            fdomain_client::fidl::FDomainResourceDialect,
12071        > for (T0, T1)
12072    {
12073        #[inline]
12074        unsafe fn encode(
12075            self,
12076            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12077            offset: usize,
12078            depth: fidl::encoding::Depth,
12079        ) -> fidl::Result<()> {
12080            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
12081            // Zero out padding regions. There's no need to apply masks
12082            // because the unmasked parts will be overwritten by fields.
12083            unsafe {
12084                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
12085                (ptr as *mut u64).write_unaligned(0);
12086            }
12087            // Write the fields.
12088            self.0.encode(encoder, offset + 0, depth)?;
12089            self.1.encode(encoder, offset + 16, depth)?;
12090            Ok(())
12091        }
12092    }
12093
12094    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12095        for StreamConfigCreateRingBufferRequest
12096    {
12097        #[inline(always)]
12098        fn new_empty() -> Self {
12099            Self {
12100                format: fidl::new_empty!(Format, fdomain_client::fidl::FDomainResourceDialect),
12101                ring_buffer: fidl::new_empty!(
12102                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
12103                    fdomain_client::fidl::FDomainResourceDialect
12104                ),
12105            }
12106        }
12107
12108        #[inline]
12109        unsafe fn decode(
12110            &mut self,
12111            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12112            offset: usize,
12113            _depth: fidl::encoding::Depth,
12114        ) -> fidl::Result<()> {
12115            decoder.debug_check_bounds::<Self>(offset);
12116            // Verify that padding bytes are zero.
12117            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
12118            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12119            let mask = 0xffffffff00000000u64;
12120            let maskedval = padval & mask;
12121            if maskedval != 0 {
12122                return Err(fidl::Error::NonZeroPadding {
12123                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
12124                });
12125            }
12126            fidl::decode!(
12127                Format,
12128                fdomain_client::fidl::FDomainResourceDialect,
12129                &mut self.format,
12130                decoder,
12131                offset + 0,
12132                _depth
12133            )?;
12134            fidl::decode!(
12135                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RingBufferMarker>>,
12136                fdomain_client::fidl::FDomainResourceDialect,
12137                &mut self.ring_buffer,
12138                decoder,
12139                offset + 16,
12140                _depth
12141            )?;
12142            Ok(())
12143        }
12144    }
12145
12146    impl PacketStreamControlSetPacketStreamSinkRequest {
12147        #[inline(always)]
12148        fn max_ordinal_present(&self) -> u64 {
12149            if let Some(_) = self.stream {
12150                return 1;
12151            }
12152            0
12153        }
12154    }
12155
12156    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
12157        type Borrowed<'a> = &'a mut Self;
12158        fn take_or_borrow<'a>(
12159            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12160        ) -> Self::Borrowed<'a> {
12161            value
12162        }
12163    }
12164
12165    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlSetPacketStreamSinkRequest {
12166        type Owned = Self;
12167
12168        #[inline(always)]
12169        fn inline_align(_context: fidl::encoding::Context) -> usize {
12170            8
12171        }
12172
12173        #[inline(always)]
12174        fn inline_size(_context: fidl::encoding::Context) -> usize {
12175            16
12176        }
12177    }
12178
12179    unsafe impl
12180        fidl::encoding::Encode<
12181            PacketStreamControlSetPacketStreamSinkRequest,
12182            fdomain_client::fidl::FDomainResourceDialect,
12183        > for &mut PacketStreamControlSetPacketStreamSinkRequest
12184    {
12185        unsafe fn encode(
12186            self,
12187            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12188            offset: usize,
12189            mut depth: fidl::encoding::Depth,
12190        ) -> fidl::Result<()> {
12191            encoder.debug_check_bounds::<PacketStreamControlSetPacketStreamSinkRequest>(offset);
12192            // Vector header
12193            let max_ordinal: u64 = self.max_ordinal_present();
12194            encoder.write_num(max_ordinal, offset);
12195            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12196            // Calling encoder.out_of_line_offset(0) is not allowed.
12197            if max_ordinal == 0 {
12198                return Ok(());
12199            }
12200            depth.increment()?;
12201            let envelope_size = 8;
12202            let bytes_len = max_ordinal as usize * envelope_size;
12203            #[allow(unused_variables)]
12204            let offset = encoder.out_of_line_offset(bytes_len);
12205            let mut _prev_end_offset: usize = 0;
12206            if 1 > max_ordinal {
12207                return Ok(());
12208            }
12209
12210            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12211            // are envelope_size bytes.
12212            let cur_offset: usize = (1 - 1) * envelope_size;
12213
12214            // Zero reserved fields.
12215            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12216
12217            // Safety:
12218            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12219            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12220            //   envelope_size bytes, there is always sufficient room.
12221            fidl::encoding::encode_in_envelope_optional::<
12222                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>>,
12223                fdomain_client::fidl::FDomainResourceDialect,
12224            >(
12225                self.stream.as_mut().map(
12226                    <fidl::encoding::Endpoint<
12227                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12228                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12229                ),
12230                encoder,
12231                offset + cur_offset,
12232                depth,
12233            )?;
12234
12235            _prev_end_offset = cur_offset + envelope_size;
12236
12237            Ok(())
12238        }
12239    }
12240
12241    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12242        for PacketStreamControlSetPacketStreamSinkRequest
12243    {
12244        #[inline(always)]
12245        fn new_empty() -> Self {
12246            Self::default()
12247        }
12248
12249        unsafe fn decode(
12250            &mut self,
12251            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12252            offset: usize,
12253            mut depth: fidl::encoding::Depth,
12254        ) -> fidl::Result<()> {
12255            decoder.debug_check_bounds::<Self>(offset);
12256            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12257                None => return Err(fidl::Error::NotNullable),
12258                Some(len) => len,
12259            };
12260            // Calling decoder.out_of_line_offset(0) is not allowed.
12261            if len == 0 {
12262                return Ok(());
12263            };
12264            depth.increment()?;
12265            let envelope_size = 8;
12266            let bytes_len = len * envelope_size;
12267            let offset = decoder.out_of_line_offset(bytes_len)?;
12268            // Decode the envelope for each type.
12269            let mut _next_ordinal_to_read = 0;
12270            let mut next_offset = offset;
12271            let end_offset = offset + bytes_len;
12272            _next_ordinal_to_read += 1;
12273            if next_offset >= end_offset {
12274                return Ok(());
12275            }
12276
12277            // Decode unknown envelopes for gaps in ordinals.
12278            while _next_ordinal_to_read < 1 {
12279                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12280                _next_ordinal_to_read += 1;
12281                next_offset += envelope_size;
12282            }
12283
12284            let next_out_of_line = decoder.next_out_of_line();
12285            let handles_before = decoder.remaining_handles();
12286            if let Some((inlined, num_bytes, num_handles)) =
12287                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12288            {
12289                let member_inline_size = <fidl::encoding::Endpoint<
12290                    fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12291                > as fidl::encoding::TypeMarker>::inline_size(
12292                    decoder.context
12293                );
12294                if inlined != (member_inline_size <= 4) {
12295                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12296                }
12297                let inner_offset;
12298                let mut inner_depth = depth.clone();
12299                if inlined {
12300                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12301                    inner_offset = next_offset;
12302                } else {
12303                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12304                    inner_depth.increment()?;
12305                }
12306                let val_ref = self.stream.get_or_insert_with(|| {
12307                    fidl::new_empty!(
12308                        fidl::encoding::Endpoint<
12309                            fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12310                        >,
12311                        fdomain_client::fidl::FDomainResourceDialect
12312                    )
12313                });
12314                fidl::decode!(
12315                    fidl::encoding::Endpoint<
12316                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12317                    >,
12318                    fdomain_client::fidl::FDomainResourceDialect,
12319                    val_ref,
12320                    decoder,
12321                    inner_offset,
12322                    inner_depth
12323                )?;
12324                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12325                {
12326                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12327                }
12328                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12329                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12330                }
12331            }
12332
12333            next_offset += envelope_size;
12334
12335            // Decode the remaining unknown envelopes.
12336            while next_offset < end_offset {
12337                _next_ordinal_to_read += 1;
12338                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12339                next_offset += envelope_size;
12340            }
12341
12342            Ok(())
12343        }
12344    }
12345
12346    impl PacketStreamControlGetPacketStreamSinkResponse {
12347        #[inline(always)]
12348        fn max_ordinal_present(&self) -> u64 {
12349            if let Some(_) = self.stream {
12350                return 1;
12351            }
12352            0
12353        }
12354    }
12355
12356    impl fidl::encoding::ResourceTypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
12357        type Borrowed<'a> = &'a mut Self;
12358        fn take_or_borrow<'a>(
12359            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12360        ) -> Self::Borrowed<'a> {
12361            value
12362        }
12363    }
12364
12365    unsafe impl fidl::encoding::TypeMarker for PacketStreamControlGetPacketStreamSinkResponse {
12366        type Owned = Self;
12367
12368        #[inline(always)]
12369        fn inline_align(_context: fidl::encoding::Context) -> usize {
12370            8
12371        }
12372
12373        #[inline(always)]
12374        fn inline_size(_context: fidl::encoding::Context) -> usize {
12375            16
12376        }
12377    }
12378
12379    unsafe impl
12380        fidl::encoding::Encode<
12381            PacketStreamControlGetPacketStreamSinkResponse,
12382            fdomain_client::fidl::FDomainResourceDialect,
12383        > for &mut PacketStreamControlGetPacketStreamSinkResponse
12384    {
12385        unsafe fn encode(
12386            self,
12387            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12388            offset: usize,
12389            mut depth: fidl::encoding::Depth,
12390        ) -> fidl::Result<()> {
12391            encoder.debug_check_bounds::<PacketStreamControlGetPacketStreamSinkResponse>(offset);
12392            // Vector header
12393            let max_ordinal: u64 = self.max_ordinal_present();
12394            encoder.write_num(max_ordinal, offset);
12395            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12396            // Calling encoder.out_of_line_offset(0) is not allowed.
12397            if max_ordinal == 0 {
12398                return Ok(());
12399            }
12400            depth.increment()?;
12401            let envelope_size = 8;
12402            let bytes_len = max_ordinal as usize * envelope_size;
12403            #[allow(unused_variables)]
12404            let offset = encoder.out_of_line_offset(bytes_len);
12405            let mut _prev_end_offset: usize = 0;
12406            if 1 > max_ordinal {
12407                return Ok(());
12408            }
12409
12410            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12411            // are envelope_size bytes.
12412            let cur_offset: usize = (1 - 1) * envelope_size;
12413
12414            // Zero reserved fields.
12415            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12416
12417            // Safety:
12418            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12419            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12420            //   envelope_size bytes, there is always sufficient room.
12421            fidl::encoding::encode_in_envelope_optional::<
12422                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>>,
12423                fdomain_client::fidl::FDomainResourceDialect,
12424            >(
12425                self.stream.as_mut().map(
12426                    <fidl::encoding::Endpoint<
12427                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12428                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12429                ),
12430                encoder,
12431                offset + cur_offset,
12432                depth,
12433            )?;
12434
12435            _prev_end_offset = cur_offset + envelope_size;
12436
12437            Ok(())
12438        }
12439    }
12440
12441    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12442        for PacketStreamControlGetPacketStreamSinkResponse
12443    {
12444        #[inline(always)]
12445        fn new_empty() -> Self {
12446            Self::default()
12447        }
12448
12449        unsafe fn decode(
12450            &mut self,
12451            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12452            offset: usize,
12453            mut depth: fidl::encoding::Depth,
12454        ) -> fidl::Result<()> {
12455            decoder.debug_check_bounds::<Self>(offset);
12456            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12457                None => return Err(fidl::Error::NotNullable),
12458                Some(len) => len,
12459            };
12460            // Calling decoder.out_of_line_offset(0) is not allowed.
12461            if len == 0 {
12462                return Ok(());
12463            };
12464            depth.increment()?;
12465            let envelope_size = 8;
12466            let bytes_len = len * envelope_size;
12467            let offset = decoder.out_of_line_offset(bytes_len)?;
12468            // Decode the envelope for each type.
12469            let mut _next_ordinal_to_read = 0;
12470            let mut next_offset = offset;
12471            let end_offset = offset + bytes_len;
12472            _next_ordinal_to_read += 1;
12473            if next_offset >= end_offset {
12474                return Ok(());
12475            }
12476
12477            // Decode unknown envelopes for gaps in ordinals.
12478            while _next_ordinal_to_read < 1 {
12479                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12480                _next_ordinal_to_read += 1;
12481                next_offset += envelope_size;
12482            }
12483
12484            let next_out_of_line = decoder.next_out_of_line();
12485            let handles_before = decoder.remaining_handles();
12486            if let Some((inlined, num_bytes, num_handles)) =
12487                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12488            {
12489                let member_inline_size = <fidl::encoding::Endpoint<
12490                    fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12491                > as fidl::encoding::TypeMarker>::inline_size(
12492                    decoder.context
12493                );
12494                if inlined != (member_inline_size <= 4) {
12495                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12496                }
12497                let inner_offset;
12498                let mut inner_depth = depth.clone();
12499                if inlined {
12500                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12501                    inner_offset = next_offset;
12502                } else {
12503                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12504                    inner_depth.increment()?;
12505                }
12506                let val_ref = self.stream.get_or_insert_with(|| {
12507                    fidl::new_empty!(
12508                        fidl::encoding::Endpoint<
12509                            fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12510                        >,
12511                        fdomain_client::fidl::FDomainResourceDialect
12512                    )
12513                });
12514                fidl::decode!(
12515                    fidl::encoding::Endpoint<
12516                        fdomain_client::fidl::ClientEnd<PacketStreamSinkMarker>,
12517                    >,
12518                    fdomain_client::fidl::FDomainResourceDialect,
12519                    val_ref,
12520                    decoder,
12521                    inner_offset,
12522                    inner_depth
12523                )?;
12524                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12525                {
12526                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12527                }
12528                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12529                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12530                }
12531            }
12532
12533            next_offset += envelope_size;
12534
12535            // Decode the remaining unknown envelopes.
12536            while next_offset < end_offset {
12537                _next_ordinal_to_read += 1;
12538                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12539                next_offset += envelope_size;
12540            }
12541
12542            Ok(())
12543        }
12544    }
12545
12546    impl PacketStreamSinkPutPacketRequest {
12547        #[inline(always)]
12548        fn max_ordinal_present(&self) -> u64 {
12549            if let Some(_) = self.payload {
12550                return 1;
12551            }
12552            0
12553        }
12554    }
12555
12556    impl fidl::encoding::ResourceTypeMarker for PacketStreamSinkPutPacketRequest {
12557        type Borrowed<'a> = &'a mut Self;
12558        fn take_or_borrow<'a>(
12559            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12560        ) -> Self::Borrowed<'a> {
12561            value
12562        }
12563    }
12564
12565    unsafe impl fidl::encoding::TypeMarker for PacketStreamSinkPutPacketRequest {
12566        type Owned = Self;
12567
12568        #[inline(always)]
12569        fn inline_align(_context: fidl::encoding::Context) -> usize {
12570            8
12571        }
12572
12573        #[inline(always)]
12574        fn inline_size(_context: fidl::encoding::Context) -> usize {
12575            16
12576        }
12577    }
12578
12579    unsafe impl
12580        fidl::encoding::Encode<
12581            PacketStreamSinkPutPacketRequest,
12582            fdomain_client::fidl::FDomainResourceDialect,
12583        > for &mut PacketStreamSinkPutPacketRequest
12584    {
12585        unsafe fn encode(
12586            self,
12587            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12588            offset: usize,
12589            mut depth: fidl::encoding::Depth,
12590        ) -> fidl::Result<()> {
12591            encoder.debug_check_bounds::<PacketStreamSinkPutPacketRequest>(offset);
12592            // Vector header
12593            let max_ordinal: u64 = self.max_ordinal_present();
12594            encoder.write_num(max_ordinal, offset);
12595            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12596            // Calling encoder.out_of_line_offset(0) is not allowed.
12597            if max_ordinal == 0 {
12598                return Ok(());
12599            }
12600            depth.increment()?;
12601            let envelope_size = 8;
12602            let bytes_len = max_ordinal as usize * envelope_size;
12603            #[allow(unused_variables)]
12604            let offset = encoder.out_of_line_offset(bytes_len);
12605            let mut _prev_end_offset: usize = 0;
12606            if 1 > max_ordinal {
12607                return Ok(());
12608            }
12609
12610            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12611            // are envelope_size bytes.
12612            let cur_offset: usize = (1 - 1) * envelope_size;
12613
12614            // Zero reserved fields.
12615            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12616
12617            // Safety:
12618            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12619            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12620            //   envelope_size bytes, there is always sufficient room.
12621            fidl::encoding::encode_in_envelope_optional::<
12622                DataTransfer,
12623                fdomain_client::fidl::FDomainResourceDialect,
12624            >(
12625                self.payload
12626                    .as_mut()
12627                    .map(<DataTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12628                encoder,
12629                offset + cur_offset,
12630                depth,
12631            )?;
12632
12633            _prev_end_offset = cur_offset + envelope_size;
12634
12635            Ok(())
12636        }
12637    }
12638
12639    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12640        for PacketStreamSinkPutPacketRequest
12641    {
12642        #[inline(always)]
12643        fn new_empty() -> Self {
12644            Self::default()
12645        }
12646
12647        unsafe fn decode(
12648            &mut self,
12649            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12650            offset: usize,
12651            mut depth: fidl::encoding::Depth,
12652        ) -> fidl::Result<()> {
12653            decoder.debug_check_bounds::<Self>(offset);
12654            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12655                None => return Err(fidl::Error::NotNullable),
12656                Some(len) => len,
12657            };
12658            // Calling decoder.out_of_line_offset(0) is not allowed.
12659            if len == 0 {
12660                return Ok(());
12661            };
12662            depth.increment()?;
12663            let envelope_size = 8;
12664            let bytes_len = len * envelope_size;
12665            let offset = decoder.out_of_line_offset(bytes_len)?;
12666            // Decode the envelope for each type.
12667            let mut _next_ordinal_to_read = 0;
12668            let mut next_offset = offset;
12669            let end_offset = offset + bytes_len;
12670            _next_ordinal_to_read += 1;
12671            if next_offset >= end_offset {
12672                return Ok(());
12673            }
12674
12675            // Decode unknown envelopes for gaps in ordinals.
12676            while _next_ordinal_to_read < 1 {
12677                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12678                _next_ordinal_to_read += 1;
12679                next_offset += envelope_size;
12680            }
12681
12682            let next_out_of_line = decoder.next_out_of_line();
12683            let handles_before = decoder.remaining_handles();
12684            if let Some((inlined, num_bytes, num_handles)) =
12685                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12686            {
12687                let member_inline_size =
12688                    <DataTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12689                if inlined != (member_inline_size <= 4) {
12690                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12691                }
12692                let inner_offset;
12693                let mut inner_depth = depth.clone();
12694                if inlined {
12695                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12696                    inner_offset = next_offset;
12697                } else {
12698                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12699                    inner_depth.increment()?;
12700                }
12701                let val_ref = self.payload.get_or_insert_with(|| {
12702                    fidl::new_empty!(DataTransfer, fdomain_client::fidl::FDomainResourceDialect)
12703                });
12704                fidl::decode!(
12705                    DataTransfer,
12706                    fdomain_client::fidl::FDomainResourceDialect,
12707                    val_ref,
12708                    decoder,
12709                    inner_offset,
12710                    inner_depth
12711                )?;
12712                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12713                {
12714                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12715                }
12716                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12717                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12718                }
12719            }
12720
12721            next_offset += envelope_size;
12722
12723            // Decode the remaining unknown envelopes.
12724            while next_offset < end_offset {
12725                _next_ordinal_to_read += 1;
12726                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12727                next_offset += envelope_size;
12728            }
12729
12730            Ok(())
12731        }
12732    }
12733
12734    impl RegisterVmosConfig {
12735        #[inline(always)]
12736        fn max_ordinal_present(&self) -> u64 {
12737            if let Some(_) = self.vmo_infos {
12738                return 1;
12739            }
12740            0
12741        }
12742    }
12743
12744    impl fidl::encoding::ResourceTypeMarker for RegisterVmosConfig {
12745        type Borrowed<'a> = &'a mut Self;
12746        fn take_or_borrow<'a>(
12747            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12748        ) -> Self::Borrowed<'a> {
12749            value
12750        }
12751    }
12752
12753    unsafe impl fidl::encoding::TypeMarker for RegisterVmosConfig {
12754        type Owned = Self;
12755
12756        #[inline(always)]
12757        fn inline_align(_context: fidl::encoding::Context) -> usize {
12758            8
12759        }
12760
12761        #[inline(always)]
12762        fn inline_size(_context: fidl::encoding::Context) -> usize {
12763            16
12764        }
12765    }
12766
12767    unsafe impl
12768        fidl::encoding::Encode<RegisterVmosConfig, fdomain_client::fidl::FDomainResourceDialect>
12769        for &mut RegisterVmosConfig
12770    {
12771        unsafe fn encode(
12772            self,
12773            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12774            offset: usize,
12775            mut depth: fidl::encoding::Depth,
12776        ) -> fidl::Result<()> {
12777            encoder.debug_check_bounds::<RegisterVmosConfig>(offset);
12778            // Vector header
12779            let max_ordinal: u64 = self.max_ordinal_present();
12780            encoder.write_num(max_ordinal, offset);
12781            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12782            // Calling encoder.out_of_line_offset(0) is not allowed.
12783            if max_ordinal == 0 {
12784                return Ok(());
12785            }
12786            depth.increment()?;
12787            let envelope_size = 8;
12788            let bytes_len = max_ordinal as usize * envelope_size;
12789            #[allow(unused_variables)]
12790            let offset = encoder.out_of_line_offset(bytes_len);
12791            let mut _prev_end_offset: usize = 0;
12792            if 1 > max_ordinal {
12793                return Ok(());
12794            }
12795
12796            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12797            // are envelope_size bytes.
12798            let cur_offset: usize = (1 - 1) * envelope_size;
12799
12800            // Zero reserved fields.
12801            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12802
12803            // Safety:
12804            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12805            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12806            //   envelope_size bytes, there is always sufficient room.
12807            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect>(
12808            self.vmo_infos.as_mut().map(<fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12809            encoder, offset + cur_offset, depth
12810        )?;
12811
12812            _prev_end_offset = cur_offset + envelope_size;
12813
12814            Ok(())
12815        }
12816    }
12817
12818    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
12819        for RegisterVmosConfig
12820    {
12821        #[inline(always)]
12822        fn new_empty() -> Self {
12823            Self::default()
12824        }
12825
12826        unsafe fn decode(
12827            &mut self,
12828            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12829            offset: usize,
12830            mut depth: fidl::encoding::Depth,
12831        ) -> fidl::Result<()> {
12832            decoder.debug_check_bounds::<Self>(offset);
12833            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12834                None => return Err(fidl::Error::NotNullable),
12835                Some(len) => len,
12836            };
12837            // Calling decoder.out_of_line_offset(0) is not allowed.
12838            if len == 0 {
12839                return Ok(());
12840            };
12841            depth.increment()?;
12842            let envelope_size = 8;
12843            let bytes_len = len * envelope_size;
12844            let offset = decoder.out_of_line_offset(bytes_len)?;
12845            // Decode the envelope for each type.
12846            let mut _next_ordinal_to_read = 0;
12847            let mut next_offset = offset;
12848            let end_offset = offset + bytes_len;
12849            _next_ordinal_to_read += 1;
12850            if next_offset >= end_offset {
12851                return Ok(());
12852            }
12853
12854            // Decode unknown envelopes for gaps in ordinals.
12855            while _next_ordinal_to_read < 1 {
12856                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12857                _next_ordinal_to_read += 1;
12858                next_offset += envelope_size;
12859            }
12860
12861            let next_out_of_line = decoder.next_out_of_line();
12862            let handles_before = decoder.remaining_handles();
12863            if let Some((inlined, num_bytes, num_handles)) =
12864                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12865            {
12866                let member_inline_size = <fidl::encoding::Vector<VmoInfo, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12867                if inlined != (member_inline_size <= 4) {
12868                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12869                }
12870                let inner_offset;
12871                let mut inner_depth = depth.clone();
12872                if inlined {
12873                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12874                    inner_offset = next_offset;
12875                } else {
12876                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12877                    inner_depth.increment()?;
12878                }
12879                let val_ref =
12880                self.vmo_infos.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect));
12881                fidl::decode!(fidl::encoding::Vector<VmoInfo, 256>, fdomain_client::fidl::FDomainResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12882                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12883                {
12884                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12885                }
12886                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12887                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12888                }
12889            }
12890
12891            next_offset += envelope_size;
12892
12893            // Decode the remaining unknown envelopes.
12894            while next_offset < end_offset {
12895                _next_ordinal_to_read += 1;
12896                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12897                next_offset += envelope_size;
12898            }
12899
12900            Ok(())
12901        }
12902    }
12903
12904    impl VmoInfo {
12905        #[inline(always)]
12906        fn max_ordinal_present(&self) -> u64 {
12907            if let Some(_) = self.vmo {
12908                return 2;
12909            }
12910            if let Some(_) = self.id {
12911                return 1;
12912            }
12913            0
12914        }
12915    }
12916
12917    impl fidl::encoding::ResourceTypeMarker for VmoInfo {
12918        type Borrowed<'a> = &'a mut Self;
12919        fn take_or_borrow<'a>(
12920            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12921        ) -> Self::Borrowed<'a> {
12922            value
12923        }
12924    }
12925
12926    unsafe impl fidl::encoding::TypeMarker for VmoInfo {
12927        type Owned = Self;
12928
12929        #[inline(always)]
12930        fn inline_align(_context: fidl::encoding::Context) -> usize {
12931            8
12932        }
12933
12934        #[inline(always)]
12935        fn inline_size(_context: fidl::encoding::Context) -> usize {
12936            16
12937        }
12938    }
12939
12940    unsafe impl fidl::encoding::Encode<VmoInfo, fdomain_client::fidl::FDomainResourceDialect>
12941        for &mut VmoInfo
12942    {
12943        unsafe fn encode(
12944            self,
12945            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
12946            offset: usize,
12947            mut depth: fidl::encoding::Depth,
12948        ) -> fidl::Result<()> {
12949            encoder.debug_check_bounds::<VmoInfo>(offset);
12950            // Vector header
12951            let max_ordinal: u64 = self.max_ordinal_present();
12952            encoder.write_num(max_ordinal, offset);
12953            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12954            // Calling encoder.out_of_line_offset(0) is not allowed.
12955            if max_ordinal == 0 {
12956                return Ok(());
12957            }
12958            depth.increment()?;
12959            let envelope_size = 8;
12960            let bytes_len = max_ordinal as usize * envelope_size;
12961            #[allow(unused_variables)]
12962            let offset = encoder.out_of_line_offset(bytes_len);
12963            let mut _prev_end_offset: usize = 0;
12964            if 1 > max_ordinal {
12965                return Ok(());
12966            }
12967
12968            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12969            // are envelope_size bytes.
12970            let cur_offset: usize = (1 - 1) * envelope_size;
12971
12972            // Zero reserved fields.
12973            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12974
12975            // Safety:
12976            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12977            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12978            //   envelope_size bytes, there is always sufficient room.
12979            fidl::encoding::encode_in_envelope_optional::<
12980                u64,
12981                fdomain_client::fidl::FDomainResourceDialect,
12982            >(
12983                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
12984                encoder,
12985                offset + cur_offset,
12986                depth,
12987            )?;
12988
12989            _prev_end_offset = cur_offset + envelope_size;
12990            if 2 > max_ordinal {
12991                return Ok(());
12992            }
12993
12994            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12995            // are envelope_size bytes.
12996            let cur_offset: usize = (2 - 1) * envelope_size;
12997
12998            // Zero reserved fields.
12999            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13000
13001            // Safety:
13002            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13003            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13004            //   envelope_size bytes, there is always sufficient room.
13005            fidl::encoding::encode_in_envelope_optional::<
13006                fidl::encoding::HandleType<
13007                    fdomain_client::Vmo,
13008                    { fidl::ObjectType::VMO.into_raw() },
13009                    2147483648,
13010                >,
13011                fdomain_client::fidl::FDomainResourceDialect,
13012            >(
13013                self.vmo.as_mut().map(
13014                    <fidl::encoding::HandleType<
13015                        fdomain_client::Vmo,
13016                        { fidl::ObjectType::VMO.into_raw() },
13017                        2147483648,
13018                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13019                ),
13020                encoder,
13021                offset + cur_offset,
13022                depth,
13023            )?;
13024
13025            _prev_end_offset = cur_offset + envelope_size;
13026
13027            Ok(())
13028        }
13029    }
13030
13031    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for VmoInfo {
13032        #[inline(always)]
13033        fn new_empty() -> Self {
13034            Self::default()
13035        }
13036
13037        unsafe fn decode(
13038            &mut self,
13039            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13040            offset: usize,
13041            mut depth: fidl::encoding::Depth,
13042        ) -> fidl::Result<()> {
13043            decoder.debug_check_bounds::<Self>(offset);
13044            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13045                None => return Err(fidl::Error::NotNullable),
13046                Some(len) => len,
13047            };
13048            // Calling decoder.out_of_line_offset(0) is not allowed.
13049            if len == 0 {
13050                return Ok(());
13051            };
13052            depth.increment()?;
13053            let envelope_size = 8;
13054            let bytes_len = len * envelope_size;
13055            let offset = decoder.out_of_line_offset(bytes_len)?;
13056            // Decode the envelope for each type.
13057            let mut _next_ordinal_to_read = 0;
13058            let mut next_offset = offset;
13059            let end_offset = offset + bytes_len;
13060            _next_ordinal_to_read += 1;
13061            if next_offset >= end_offset {
13062                return Ok(());
13063            }
13064
13065            // Decode unknown envelopes for gaps in ordinals.
13066            while _next_ordinal_to_read < 1 {
13067                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13068                _next_ordinal_to_read += 1;
13069                next_offset += envelope_size;
13070            }
13071
13072            let next_out_of_line = decoder.next_out_of_line();
13073            let handles_before = decoder.remaining_handles();
13074            if let Some((inlined, num_bytes, num_handles)) =
13075                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13076            {
13077                let member_inline_size =
13078                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13079                if inlined != (member_inline_size <= 4) {
13080                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13081                }
13082                let inner_offset;
13083                let mut inner_depth = depth.clone();
13084                if inlined {
13085                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13086                    inner_offset = next_offset;
13087                } else {
13088                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13089                    inner_depth.increment()?;
13090                }
13091                let val_ref = self.id.get_or_insert_with(|| {
13092                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13093                });
13094                fidl::decode!(
13095                    u64,
13096                    fdomain_client::fidl::FDomainResourceDialect,
13097                    val_ref,
13098                    decoder,
13099                    inner_offset,
13100                    inner_depth
13101                )?;
13102                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13103                {
13104                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13105                }
13106                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13107                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13108                }
13109            }
13110
13111            next_offset += envelope_size;
13112            _next_ordinal_to_read += 1;
13113            if next_offset >= end_offset {
13114                return Ok(());
13115            }
13116
13117            // Decode unknown envelopes for gaps in ordinals.
13118            while _next_ordinal_to_read < 2 {
13119                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13120                _next_ordinal_to_read += 1;
13121                next_offset += envelope_size;
13122            }
13123
13124            let next_out_of_line = decoder.next_out_of_line();
13125            let handles_before = decoder.remaining_handles();
13126            if let Some((inlined, num_bytes, num_handles)) =
13127                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13128            {
13129                let member_inline_size = <fidl::encoding::HandleType<
13130                    fdomain_client::Vmo,
13131                    { fidl::ObjectType::VMO.into_raw() },
13132                    2147483648,
13133                > as fidl::encoding::TypeMarker>::inline_size(
13134                    decoder.context
13135                );
13136                if inlined != (member_inline_size <= 4) {
13137                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13138                }
13139                let inner_offset;
13140                let mut inner_depth = depth.clone();
13141                if inlined {
13142                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13143                    inner_offset = next_offset;
13144                } else {
13145                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13146                    inner_depth.increment()?;
13147                }
13148                let val_ref =
13149                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));
13150                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)?;
13151                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13152                {
13153                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13154                }
13155                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13156                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13157                }
13158            }
13159
13160            next_offset += envelope_size;
13161
13162            // Decode the remaining unknown envelopes.
13163            while next_offset < end_offset {
13164                _next_ordinal_to_read += 1;
13165                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13166                next_offset += envelope_size;
13167            }
13168
13169            Ok(())
13170        }
13171    }
13172
13173    impl VmoTransfer {
13174        #[inline(always)]
13175        fn max_ordinal_present(&self) -> u64 {
13176            if let Some(_) = self.payload_size {
13177                return 3;
13178            }
13179            if let Some(_) = self.vmo_offset {
13180                return 2;
13181            }
13182            if let Some(_) = self.vmo_id {
13183                return 1;
13184            }
13185            0
13186        }
13187    }
13188
13189    impl fidl::encoding::ResourceTypeMarker for VmoTransfer {
13190        type Borrowed<'a> = &'a mut Self;
13191        fn take_or_borrow<'a>(
13192            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13193        ) -> Self::Borrowed<'a> {
13194            value
13195        }
13196    }
13197
13198    unsafe impl fidl::encoding::TypeMarker for VmoTransfer {
13199        type Owned = Self;
13200
13201        #[inline(always)]
13202        fn inline_align(_context: fidl::encoding::Context) -> usize {
13203            8
13204        }
13205
13206        #[inline(always)]
13207        fn inline_size(_context: fidl::encoding::Context) -> usize {
13208            16
13209        }
13210    }
13211
13212    unsafe impl fidl::encoding::Encode<VmoTransfer, fdomain_client::fidl::FDomainResourceDialect>
13213        for &mut VmoTransfer
13214    {
13215        unsafe fn encode(
13216            self,
13217            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13218            offset: usize,
13219            mut depth: fidl::encoding::Depth,
13220        ) -> fidl::Result<()> {
13221            encoder.debug_check_bounds::<VmoTransfer>(offset);
13222            // Vector header
13223            let max_ordinal: u64 = self.max_ordinal_present();
13224            encoder.write_num(max_ordinal, offset);
13225            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13226            // Calling encoder.out_of_line_offset(0) is not allowed.
13227            if max_ordinal == 0 {
13228                return Ok(());
13229            }
13230            depth.increment()?;
13231            let envelope_size = 8;
13232            let bytes_len = max_ordinal as usize * envelope_size;
13233            #[allow(unused_variables)]
13234            let offset = encoder.out_of_line_offset(bytes_len);
13235            let mut _prev_end_offset: usize = 0;
13236            if 1 > max_ordinal {
13237                return Ok(());
13238            }
13239
13240            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13241            // are envelope_size bytes.
13242            let cur_offset: usize = (1 - 1) * envelope_size;
13243
13244            // Zero reserved fields.
13245            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13246
13247            // Safety:
13248            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13249            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13250            //   envelope_size bytes, there is always sufficient room.
13251            fidl::encoding::encode_in_envelope_optional::<
13252                u64,
13253                fdomain_client::fidl::FDomainResourceDialect,
13254            >(
13255                self.vmo_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
13256                encoder,
13257                offset + cur_offset,
13258                depth,
13259            )?;
13260
13261            _prev_end_offset = cur_offset + envelope_size;
13262            if 2 > max_ordinal {
13263                return Ok(());
13264            }
13265
13266            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13267            // are envelope_size bytes.
13268            let cur_offset: usize = (2 - 1) * envelope_size;
13269
13270            // Zero reserved fields.
13271            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13272
13273            // Safety:
13274            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13275            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13276            //   envelope_size bytes, there is always sufficient room.
13277            fidl::encoding::encode_in_envelope_optional::<
13278                u64,
13279                fdomain_client::fidl::FDomainResourceDialect,
13280            >(
13281                self.vmo_offset.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
13282                encoder,
13283                offset + cur_offset,
13284                depth,
13285            )?;
13286
13287            _prev_end_offset = cur_offset + envelope_size;
13288            if 3 > max_ordinal {
13289                return Ok(());
13290            }
13291
13292            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13293            // are envelope_size bytes.
13294            let cur_offset: usize = (3 - 1) * envelope_size;
13295
13296            // Zero reserved fields.
13297            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13298
13299            // Safety:
13300            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13301            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13302            //   envelope_size bytes, there is always sufficient room.
13303            fidl::encoding::encode_in_envelope_optional::<
13304                u64,
13305                fdomain_client::fidl::FDomainResourceDialect,
13306            >(
13307                self.payload_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
13308                encoder,
13309                offset + cur_offset,
13310                depth,
13311            )?;
13312
13313            _prev_end_offset = cur_offset + envelope_size;
13314
13315            Ok(())
13316        }
13317    }
13318
13319    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for VmoTransfer {
13320        #[inline(always)]
13321        fn new_empty() -> Self {
13322            Self::default()
13323        }
13324
13325        unsafe fn decode(
13326            &mut self,
13327            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13328            offset: usize,
13329            mut depth: fidl::encoding::Depth,
13330        ) -> fidl::Result<()> {
13331            decoder.debug_check_bounds::<Self>(offset);
13332            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13333                None => return Err(fidl::Error::NotNullable),
13334                Some(len) => len,
13335            };
13336            // Calling decoder.out_of_line_offset(0) is not allowed.
13337            if len == 0 {
13338                return Ok(());
13339            };
13340            depth.increment()?;
13341            let envelope_size = 8;
13342            let bytes_len = len * envelope_size;
13343            let offset = decoder.out_of_line_offset(bytes_len)?;
13344            // Decode the envelope for each type.
13345            let mut _next_ordinal_to_read = 0;
13346            let mut next_offset = offset;
13347            let end_offset = offset + bytes_len;
13348            _next_ordinal_to_read += 1;
13349            if next_offset >= end_offset {
13350                return Ok(());
13351            }
13352
13353            // Decode unknown envelopes for gaps in ordinals.
13354            while _next_ordinal_to_read < 1 {
13355                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13356                _next_ordinal_to_read += 1;
13357                next_offset += envelope_size;
13358            }
13359
13360            let next_out_of_line = decoder.next_out_of_line();
13361            let handles_before = decoder.remaining_handles();
13362            if let Some((inlined, num_bytes, num_handles)) =
13363                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13364            {
13365                let member_inline_size =
13366                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13367                if inlined != (member_inline_size <= 4) {
13368                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13369                }
13370                let inner_offset;
13371                let mut inner_depth = depth.clone();
13372                if inlined {
13373                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13374                    inner_offset = next_offset;
13375                } else {
13376                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13377                    inner_depth.increment()?;
13378                }
13379                let val_ref = self.vmo_id.get_or_insert_with(|| {
13380                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13381                });
13382                fidl::decode!(
13383                    u64,
13384                    fdomain_client::fidl::FDomainResourceDialect,
13385                    val_ref,
13386                    decoder,
13387                    inner_offset,
13388                    inner_depth
13389                )?;
13390                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13391                {
13392                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13393                }
13394                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13395                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13396                }
13397            }
13398
13399            next_offset += envelope_size;
13400            _next_ordinal_to_read += 1;
13401            if next_offset >= end_offset {
13402                return Ok(());
13403            }
13404
13405            // Decode unknown envelopes for gaps in ordinals.
13406            while _next_ordinal_to_read < 2 {
13407                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13408                _next_ordinal_to_read += 1;
13409                next_offset += envelope_size;
13410            }
13411
13412            let next_out_of_line = decoder.next_out_of_line();
13413            let handles_before = decoder.remaining_handles();
13414            if let Some((inlined, num_bytes, num_handles)) =
13415                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13416            {
13417                let member_inline_size =
13418                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13419                if inlined != (member_inline_size <= 4) {
13420                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13421                }
13422                let inner_offset;
13423                let mut inner_depth = depth.clone();
13424                if inlined {
13425                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13426                    inner_offset = next_offset;
13427                } else {
13428                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13429                    inner_depth.increment()?;
13430                }
13431                let val_ref = self.vmo_offset.get_or_insert_with(|| {
13432                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13433                });
13434                fidl::decode!(
13435                    u64,
13436                    fdomain_client::fidl::FDomainResourceDialect,
13437                    val_ref,
13438                    decoder,
13439                    inner_offset,
13440                    inner_depth
13441                )?;
13442                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13443                {
13444                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13445                }
13446                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13447                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13448                }
13449            }
13450
13451            next_offset += envelope_size;
13452            _next_ordinal_to_read += 1;
13453            if next_offset >= end_offset {
13454                return Ok(());
13455            }
13456
13457            // Decode unknown envelopes for gaps in ordinals.
13458            while _next_ordinal_to_read < 3 {
13459                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13460                _next_ordinal_to_read += 1;
13461                next_offset += envelope_size;
13462            }
13463
13464            let next_out_of_line = decoder.next_out_of_line();
13465            let handles_before = decoder.remaining_handles();
13466            if let Some((inlined, num_bytes, num_handles)) =
13467                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13468            {
13469                let member_inline_size =
13470                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13471                if inlined != (member_inline_size <= 4) {
13472                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13473                }
13474                let inner_offset;
13475                let mut inner_depth = depth.clone();
13476                if inlined {
13477                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13478                    inner_offset = next_offset;
13479                } else {
13480                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13481                    inner_depth.increment()?;
13482                }
13483                let val_ref = self.payload_size.get_or_insert_with(|| {
13484                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
13485                });
13486                fidl::decode!(
13487                    u64,
13488                    fdomain_client::fidl::FDomainResourceDialect,
13489                    val_ref,
13490                    decoder,
13491                    inner_offset,
13492                    inner_depth
13493                )?;
13494                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13495                {
13496                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13497                }
13498                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13499                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13500                }
13501            }
13502
13503            next_offset += envelope_size;
13504
13505            // Decode the remaining unknown envelopes.
13506            while next_offset < end_offset {
13507                _next_ordinal_to_read += 1;
13508                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13509                next_offset += envelope_size;
13510            }
13511
13512            Ok(())
13513        }
13514    }
13515
13516    impl fidl::encoding::ResourceTypeMarker for DataTransfer {
13517        type Borrowed<'a> = &'a mut Self;
13518        fn take_or_borrow<'a>(
13519            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13520        ) -> Self::Borrowed<'a> {
13521            value
13522        }
13523    }
13524
13525    unsafe impl fidl::encoding::TypeMarker for DataTransfer {
13526        type Owned = Self;
13527
13528        #[inline(always)]
13529        fn inline_align(_context: fidl::encoding::Context) -> usize {
13530            8
13531        }
13532
13533        #[inline(always)]
13534        fn inline_size(_context: fidl::encoding::Context) -> usize {
13535            16
13536        }
13537    }
13538
13539    unsafe impl fidl::encoding::Encode<DataTransfer, fdomain_client::fidl::FDomainResourceDialect>
13540        for &mut DataTransfer
13541    {
13542        #[inline]
13543        unsafe fn encode(
13544            self,
13545            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13546            offset: usize,
13547            _depth: fidl::encoding::Depth,
13548        ) -> fidl::Result<()> {
13549            encoder.debug_check_bounds::<DataTransfer>(offset);
13550            encoder.write_num::<u64>(self.ordinal(), offset);
13551            match self {
13552                DataTransfer::VmoTransfer(ref mut val) => fidl::encoding::encode_in_envelope::<
13553                    VmoTransfer,
13554                    fdomain_client::fidl::FDomainResourceDialect,
13555                >(
13556                    <VmoTransfer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
13557                    encoder,
13558                    offset + 8,
13559                    _depth,
13560                ),
13561                DataTransfer::InlineData(ref val) => fidl::encoding::encode_in_envelope::<
13562                    fidl::encoding::Vector<u8, 8192>,
13563                    fdomain_client::fidl::FDomainResourceDialect,
13564                >(
13565                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
13566                        val,
13567                    ),
13568                    encoder,
13569                    offset + 8,
13570                    _depth,
13571                ),
13572                DataTransfer::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
13573            }
13574        }
13575    }
13576
13577    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect> for DataTransfer {
13578        #[inline(always)]
13579        fn new_empty() -> Self {
13580            Self::__SourceBreaking { unknown_ordinal: 0 }
13581        }
13582
13583        #[inline]
13584        unsafe fn decode(
13585            &mut self,
13586            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
13587            offset: usize,
13588            mut depth: fidl::encoding::Depth,
13589        ) -> fidl::Result<()> {
13590            decoder.debug_check_bounds::<Self>(offset);
13591            #[allow(unused_variables)]
13592            let next_out_of_line = decoder.next_out_of_line();
13593            let handles_before = decoder.remaining_handles();
13594            let (ordinal, inlined, num_bytes, num_handles) =
13595                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
13596
13597            let member_inline_size = match ordinal {
13598                1 => <VmoTransfer as fidl::encoding::TypeMarker>::inline_size(decoder.context),
13599                2 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
13600                    decoder.context,
13601                ),
13602                0 => return Err(fidl::Error::UnknownUnionTag),
13603                _ => num_bytes as usize,
13604            };
13605
13606            if inlined != (member_inline_size <= 4) {
13607                return Err(fidl::Error::InvalidInlineBitInEnvelope);
13608            }
13609            let _inner_offset;
13610            if inlined {
13611                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
13612                _inner_offset = offset + 8;
13613            } else {
13614                depth.increment()?;
13615                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13616            }
13617            match ordinal {
13618                1 => {
13619                    #[allow(irrefutable_let_patterns)]
13620                    if let DataTransfer::VmoTransfer(_) = self {
13621                        // Do nothing, read the value into the object
13622                    } else {
13623                        // Initialize `self` to the right variant
13624                        *self = DataTransfer::VmoTransfer(fidl::new_empty!(
13625                            VmoTransfer,
13626                            fdomain_client::fidl::FDomainResourceDialect
13627                        ));
13628                    }
13629                    #[allow(irrefutable_let_patterns)]
13630                    if let DataTransfer::VmoTransfer(ref mut val) = self {
13631                        fidl::decode!(
13632                            VmoTransfer,
13633                            fdomain_client::fidl::FDomainResourceDialect,
13634                            val,
13635                            decoder,
13636                            _inner_offset,
13637                            depth
13638                        )?;
13639                    } else {
13640                        unreachable!()
13641                    }
13642                }
13643                2 => {
13644                    #[allow(irrefutable_let_patterns)]
13645                    if let DataTransfer::InlineData(_) = self {
13646                        // Do nothing, read the value into the object
13647                    } else {
13648                        // Initialize `self` to the right variant
13649                        *self = DataTransfer::InlineData(
13650                            fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, fdomain_client::fidl::FDomainResourceDialect),
13651                        );
13652                    }
13653                    #[allow(irrefutable_let_patterns)]
13654                    if let DataTransfer::InlineData(ref mut val) = self {
13655                        fidl::decode!(fidl::encoding::Vector<u8, 8192>, fdomain_client::fidl::FDomainResourceDialect, val, decoder, _inner_offset, depth)?;
13656                    } else {
13657                        unreachable!()
13658                    }
13659                }
13660                #[allow(deprecated)]
13661                ordinal => {
13662                    for _ in 0..num_handles {
13663                        decoder.drop_next_handle()?;
13664                    }
13665                    *self = DataTransfer::__SourceBreaking { unknown_ordinal: ordinal };
13666                }
13667            }
13668            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
13669                return Err(fidl::Error::InvalidNumBytesInEnvelope);
13670            }
13671            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13672                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13673            }
13674            Ok(())
13675        }
13676    }
13677}