Skip to main content

fdomain_fuchsia_audio_controller/
fdomain_fuchsia_audio_controller.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_audio_controller__common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Default, PartialEq)]
14pub struct DeviceControlDeviceSetGainStateRequest {
15    /// Id of the device to set the gain state.
16    ///
17    /// Required.
18    pub device: Option<DeviceSelector>,
19    /// Desired gain state.
20    ///
21    /// Required.
22    pub gain_state: Option<fdomain_fuchsia_hardware_audio::GainState>,
23    #[doc(hidden)]
24    pub __source_breaking: fidl::marker::SourceBreaking,
25}
26
27impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
28    for DeviceControlDeviceSetGainStateRequest
29{
30}
31
32#[derive(Debug, Default, PartialEq)]
33pub struct PlayerPlayRequest {
34    /// Socket for the client to send audio data in WAV format.
35    ///
36    /// The client should transmit an entire file, then close the socket.
37    ///
38    /// Required.
39    pub wav_source: Option<fdomain_client::Socket>,
40    /// The destination to which to play the audio.
41    ///
42    /// Required.
43    pub destination: Option<PlayDestination>,
44    /// Play settings.
45    ///
46    /// Optional. If not specified, use unity gain unmuted, and no other gain
47    /// processing enabled.
48    pub gain_settings: Option<GainSettings>,
49    /// Channels to enable during playback.
50    ///
51    /// Optional. If not specified, the active-channels configuration is not changed.
52    pub active_channels_bitmask: Option<u64>,
53    #[doc(hidden)]
54    pub __source_breaking: fidl::marker::SourceBreaking,
55}
56
57impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for PlayerPlayRequest {}
58
59#[derive(Debug, Default, PartialEq)]
60pub struct PlayerPlayResponse {
61    /// Total number of bytes sent to destination.
62    pub bytes_processed: Option<u64>,
63    #[doc(hidden)]
64    pub __source_breaking: fidl::marker::SourceBreaking,
65}
66
67impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for PlayerPlayResponse {}
68
69#[derive(Debug, Default, PartialEq)]
70pub struct RecorderRecordRequest {
71    /// The source from which to record the audio.
72    ///
73    /// Required.
74    pub source: Option<RecordSource>,
75    /// The stream format in which to record the audio.
76    ///
77    /// Required.
78    pub stream_type: Option<fdomain_fuchsia_media::AudioStreamType>,
79    /// Duration in nanoseconds to record audio data.
80    ///
81    /// If not specified, `Recorder` will record and write data to the
82    /// socket until it receives a stop signal on `canceler`.
83    ///
84    /// If present, the record request is still cancelable via `canceler`.
85    ///
86    /// Optional.
87    pub duration: Option<i64>,
88    /// Handle to signal when to stop sending data back to the client.
89    ///
90    /// Required.
91    pub canceler: Option<fdomain_client::fidl::ServerEnd<RecordCancelerMarker>>,
92    /// Record gain settings.
93    ///
94    /// Only used for the `capturer` and `loopback` sources.
95    ///
96    /// Optional.
97    pub gain_settings: Option<GainSettings>,
98    /// Buffer size.
99    ///
100    /// Optional. If not specified, defaults to a size that is enough to
101    /// hold one second of audio data.
102    pub buffer_size: Option<u64>,
103    /// Sink for audio data.
104    ///
105    /// The captured data here will be written here as a complete WAV file.
106    ///
107    /// Required.
108    pub wav_data: Option<fdomain_client::Socket>,
109    #[doc(hidden)]
110    pub __source_breaking: fidl::marker::SourceBreaking,
111}
112
113impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RecorderRecordRequest {}
114
115#[derive(Debug, Default, PartialEq)]
116pub struct RecorderRecordResponse {
117    /// Total number of bytes read from the source.
118    pub bytes_processed: Option<u64>,
119    /// If applicable, number of packets read from an `AudioCapturer`.
120    pub packets_processed: Option<u64>,
121    /// If applicable, number of times the capturer woke up too late to
122    /// read valid data from the device.
123    ///
124    /// If this is non-zero, some data was lost and replaced with silence.
125    pub late_wakeups: Option<u64>,
126    #[doc(hidden)]
127    pub __source_breaking: fidl::marker::SourceBreaking,
128}
129
130impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RecorderRecordResponse {}
131
132#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
133pub struct DeviceControlMarker;
134
135impl fdomain_client::fidl::ProtocolMarker for DeviceControlMarker {
136    type Proxy = DeviceControlProxy;
137    type RequestStream = DeviceControlRequestStream;
138
139    const DEBUG_NAME: &'static str = "fuchsia.audio.controller.DeviceControl";
140}
141impl fdomain_client::fidl::DiscoverableProtocolMarker for DeviceControlMarker {}
142pub type DeviceControlDeviceSetGainStateResult = Result<(), i32>;
143
144pub trait DeviceControlProxyInterface: Send + Sync {
145    type DeviceSetGainStateResponseFut: std::future::Future<Output = Result<DeviceControlDeviceSetGainStateResult, fidl::Error>>
146        + Send;
147    fn r#device_set_gain_state(
148        &self,
149        payload: DeviceControlDeviceSetGainStateRequest,
150    ) -> Self::DeviceSetGainStateResponseFut;
151}
152
153#[derive(Debug, Clone)]
154pub struct DeviceControlProxy {
155    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
156}
157
158impl fdomain_client::fidl::Proxy for DeviceControlProxy {
159    type Protocol = DeviceControlMarker;
160
161    fn from_channel(inner: fdomain_client::Channel) -> Self {
162        Self::new(inner)
163    }
164
165    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
166        self.client.into_channel().map_err(|client| Self { client })
167    }
168
169    fn as_channel(&self) -> &fdomain_client::Channel {
170        self.client.as_channel()
171    }
172}
173
174impl DeviceControlProxy {
175    /// Create a new Proxy for fuchsia.audio.controller/DeviceControl.
176    pub fn new(channel: fdomain_client::Channel) -> Self {
177        let protocol_name =
178            <DeviceControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
179        Self { client: fidl::client::Client::new(channel, protocol_name) }
180    }
181
182    /// Get a Stream of events from the remote end of the protocol.
183    ///
184    /// # Panics
185    ///
186    /// Panics if the event stream was already taken.
187    pub fn take_event_stream(&self) -> DeviceControlEventStream {
188        DeviceControlEventStream { event_receiver: self.client.take_event_receiver() }
189    }
190
191    /// Sets the gain of the stream in decibels.
192    pub fn r#device_set_gain_state(
193        &self,
194        mut payload: DeviceControlDeviceSetGainStateRequest,
195    ) -> fidl::client::QueryResponseFut<
196        DeviceControlDeviceSetGainStateResult,
197        fdomain_client::fidl::FDomainResourceDialect,
198    > {
199        DeviceControlProxyInterface::r#device_set_gain_state(self, payload)
200    }
201}
202
203impl DeviceControlProxyInterface for DeviceControlProxy {
204    type DeviceSetGainStateResponseFut = fidl::client::QueryResponseFut<
205        DeviceControlDeviceSetGainStateResult,
206        fdomain_client::fidl::FDomainResourceDialect,
207    >;
208    fn r#device_set_gain_state(
209        &self,
210        mut payload: DeviceControlDeviceSetGainStateRequest,
211    ) -> Self::DeviceSetGainStateResponseFut {
212        fn _decode(
213            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
214        ) -> Result<DeviceControlDeviceSetGainStateResult, fidl::Error> {
215            let _response = fidl::client::decode_transaction_body::<
216                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
217                fdomain_client::fidl::FDomainResourceDialect,
218                0x7c5c028bb8c42d12,
219            >(_buf?)?
220            .into_result_fdomain::<DeviceControlMarker>("device_set_gain_state")?;
221            Ok(_response.map(|x| x))
222        }
223        self.client.send_query_and_decode::<
224            DeviceControlDeviceSetGainStateRequest,
225            DeviceControlDeviceSetGainStateResult,
226        >(
227            &mut payload,
228            0x7c5c028bb8c42d12,
229            fidl::encoding::DynamicFlags::FLEXIBLE,
230            _decode,
231        )
232    }
233}
234
235pub struct DeviceControlEventStream {
236    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
237}
238
239impl std::marker::Unpin for DeviceControlEventStream {}
240
241impl futures::stream::FusedStream for DeviceControlEventStream {
242    fn is_terminated(&self) -> bool {
243        self.event_receiver.is_terminated()
244    }
245}
246
247impl futures::Stream for DeviceControlEventStream {
248    type Item = Result<DeviceControlEvent, fidl::Error>;
249
250    fn poll_next(
251        mut self: std::pin::Pin<&mut Self>,
252        cx: &mut std::task::Context<'_>,
253    ) -> std::task::Poll<Option<Self::Item>> {
254        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
255            &mut self.event_receiver,
256            cx
257        )?) {
258            Some(buf) => std::task::Poll::Ready(Some(DeviceControlEvent::decode(buf))),
259            None => std::task::Poll::Ready(None),
260        }
261    }
262}
263
264#[derive(Debug)]
265pub enum DeviceControlEvent {
266    #[non_exhaustive]
267    _UnknownEvent {
268        /// Ordinal of the event that was sent.
269        ordinal: u64,
270    },
271}
272
273impl DeviceControlEvent {
274    /// Decodes a message buffer as a [`DeviceControlEvent`].
275    fn decode(
276        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
277    ) -> Result<DeviceControlEvent, fidl::Error> {
278        let (bytes, _handles) = buf.split_mut();
279        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
280        debug_assert_eq!(tx_header.tx_id, 0);
281        match tx_header.ordinal {
282            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
283                Ok(DeviceControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
284            }
285            _ => Err(fidl::Error::UnknownOrdinal {
286                ordinal: tx_header.ordinal,
287                protocol_name:
288                    <DeviceControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
289            }),
290        }
291    }
292}
293
294/// A Stream of incoming requests for fuchsia.audio.controller/DeviceControl.
295pub struct DeviceControlRequestStream {
296    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
297    is_terminated: bool,
298}
299
300impl std::marker::Unpin for DeviceControlRequestStream {}
301
302impl futures::stream::FusedStream for DeviceControlRequestStream {
303    fn is_terminated(&self) -> bool {
304        self.is_terminated
305    }
306}
307
308impl fdomain_client::fidl::RequestStream for DeviceControlRequestStream {
309    type Protocol = DeviceControlMarker;
310    type ControlHandle = DeviceControlControlHandle;
311
312    fn from_channel(channel: fdomain_client::Channel) -> Self {
313        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
314    }
315
316    fn control_handle(&self) -> Self::ControlHandle {
317        DeviceControlControlHandle { inner: self.inner.clone() }
318    }
319
320    fn into_inner(
321        self,
322    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
323    {
324        (self.inner, self.is_terminated)
325    }
326
327    fn from_inner(
328        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
329        is_terminated: bool,
330    ) -> Self {
331        Self { inner, is_terminated }
332    }
333}
334
335impl futures::Stream for DeviceControlRequestStream {
336    type Item = Result<DeviceControlRequest, fidl::Error>;
337
338    fn poll_next(
339        mut self: std::pin::Pin<&mut Self>,
340        cx: &mut std::task::Context<'_>,
341    ) -> std::task::Poll<Option<Self::Item>> {
342        let this = &mut *self;
343        if this.inner.check_shutdown(cx) {
344            this.is_terminated = true;
345            return std::task::Poll::Ready(None);
346        }
347        if this.is_terminated {
348            panic!("polled DeviceControlRequestStream after completion");
349        }
350        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
351            |bytes, handles| {
352                match this.inner.channel().read_etc(cx, bytes, handles) {
353                    std::task::Poll::Ready(Ok(())) => {}
354                    std::task::Poll::Pending => return std::task::Poll::Pending,
355                    std::task::Poll::Ready(Err(None)) => {
356                        this.is_terminated = true;
357                        return std::task::Poll::Ready(None);
358                    }
359                    std::task::Poll::Ready(Err(Some(e))) => {
360                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
361                            e.into(),
362                        ))));
363                    }
364                }
365
366                // A message has been received from the channel
367                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
368
369                std::task::Poll::Ready(Some(match header.ordinal {
370                0x7c5c028bb8c42d12 => {
371                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
372                    let mut req = fidl::new_empty!(DeviceControlDeviceSetGainStateRequest, fdomain_client::fidl::FDomainResourceDialect);
373                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<DeviceControlDeviceSetGainStateRequest>(&header, _body_bytes, handles, &mut req)?;
374                    let control_handle = DeviceControlControlHandle {
375                        inner: this.inner.clone(),
376                    };
377                    Ok(DeviceControlRequest::DeviceSetGainState {payload: req,
378                        responder: DeviceControlDeviceSetGainStateResponder {
379                            control_handle: std::mem::ManuallyDrop::new(control_handle),
380                            tx_id: header.tx_id,
381                        },
382                    })
383                }
384                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
385                    Ok(DeviceControlRequest::_UnknownMethod {
386                        ordinal: header.ordinal,
387                        control_handle: DeviceControlControlHandle { inner: this.inner.clone() },
388                        method_type: fidl::MethodType::OneWay,
389                    })
390                }
391                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
392                    this.inner.send_framework_err(
393                        fidl::encoding::FrameworkErr::UnknownMethod,
394                        header.tx_id,
395                        header.ordinal,
396                        header.dynamic_flags(),
397                        (bytes, handles),
398                    )?;
399                    Ok(DeviceControlRequest::_UnknownMethod {
400                        ordinal: header.ordinal,
401                        control_handle: DeviceControlControlHandle { inner: this.inner.clone() },
402                        method_type: fidl::MethodType::TwoWay,
403                    })
404                }
405                _ => Err(fidl::Error::UnknownOrdinal {
406                    ordinal: header.ordinal,
407                    protocol_name: <DeviceControlMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
408                }),
409            }))
410            },
411        )
412    }
413}
414
415/// Enumerate, query, and control audio devices from clients.
416#[derive(Debug)]
417pub enum DeviceControlRequest {
418    /// Sets the gain of the stream in decibels.
419    DeviceSetGainState {
420        payload: DeviceControlDeviceSetGainStateRequest,
421        responder: DeviceControlDeviceSetGainStateResponder,
422    },
423    /// An interaction was received which does not match any known method.
424    #[non_exhaustive]
425    _UnknownMethod {
426        /// Ordinal of the method that was called.
427        ordinal: u64,
428        control_handle: DeviceControlControlHandle,
429        method_type: fidl::MethodType,
430    },
431}
432
433impl DeviceControlRequest {
434    #[allow(irrefutable_let_patterns)]
435    pub fn into_device_set_gain_state(
436        self,
437    ) -> Option<(DeviceControlDeviceSetGainStateRequest, DeviceControlDeviceSetGainStateResponder)>
438    {
439        if let DeviceControlRequest::DeviceSetGainState { payload, responder } = self {
440            Some((payload, responder))
441        } else {
442            None
443        }
444    }
445
446    /// Name of the method defined in FIDL
447    pub fn method_name(&self) -> &'static str {
448        match *self {
449            DeviceControlRequest::DeviceSetGainState { .. } => "device_set_gain_state",
450            DeviceControlRequest::_UnknownMethod {
451                method_type: fidl::MethodType::OneWay, ..
452            } => "unknown one-way method",
453            DeviceControlRequest::_UnknownMethod {
454                method_type: fidl::MethodType::TwoWay, ..
455            } => "unknown two-way method",
456        }
457    }
458}
459
460#[derive(Debug, Clone)]
461pub struct DeviceControlControlHandle {
462    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
463}
464
465impl fdomain_client::fidl::ControlHandle for DeviceControlControlHandle {
466    fn shutdown(&self) {
467        self.inner.shutdown()
468    }
469
470    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
471        self.inner.shutdown_with_epitaph(status)
472    }
473
474    fn is_closed(&self) -> bool {
475        self.inner.channel().is_closed()
476    }
477    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
478        self.inner.channel().on_closed()
479    }
480}
481
482impl DeviceControlControlHandle {}
483
484#[must_use = "FIDL methods require a response to be sent"]
485#[derive(Debug)]
486pub struct DeviceControlDeviceSetGainStateResponder {
487    control_handle: std::mem::ManuallyDrop<DeviceControlControlHandle>,
488    tx_id: u32,
489}
490
491/// Set the the channel to be shutdown (see [`DeviceControlControlHandle::shutdown`])
492/// if the responder is dropped without sending a response, so that the client
493/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
494impl std::ops::Drop for DeviceControlDeviceSetGainStateResponder {
495    fn drop(&mut self) {
496        self.control_handle.shutdown();
497        // Safety: drops once, never accessed again
498        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
499    }
500}
501
502impl fdomain_client::fidl::Responder for DeviceControlDeviceSetGainStateResponder {
503    type ControlHandle = DeviceControlControlHandle;
504
505    fn control_handle(&self) -> &DeviceControlControlHandle {
506        &self.control_handle
507    }
508
509    fn drop_without_shutdown(mut self) {
510        // Safety: drops once, never accessed again due to mem::forget
511        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
512        // Prevent Drop from running (which would shut down the channel)
513        std::mem::forget(self);
514    }
515}
516
517impl DeviceControlDeviceSetGainStateResponder {
518    /// Sends a response to the FIDL transaction.
519    ///
520    /// Sets the channel to shutdown if an error occurs.
521    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
522        let _result = self.send_raw(result);
523        if _result.is_err() {
524            self.control_handle.shutdown();
525        }
526        self.drop_without_shutdown();
527        _result
528    }
529
530    /// Similar to "send" but does not shutdown the channel if an error occurs.
531    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
532        let _result = self.send_raw(result);
533        self.drop_without_shutdown();
534        _result
535    }
536
537    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
538        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
539            fidl::encoding::EmptyStruct,
540            i32,
541        >>(
542            fidl::encoding::FlexibleResult::new(result),
543            self.tx_id,
544            0x7c5c028bb8c42d12,
545            fidl::encoding::DynamicFlags::FLEXIBLE,
546        )
547    }
548}
549
550#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
551pub struct PlayerMarker;
552
553impl fdomain_client::fidl::ProtocolMarker for PlayerMarker {
554    type Proxy = PlayerProxy;
555    type RequestStream = PlayerRequestStream;
556
557    const DEBUG_NAME: &'static str = "fuchsia.audio.controller.Player";
558}
559impl fdomain_client::fidl::DiscoverableProtocolMarker for PlayerMarker {}
560pub type PlayerPlayResult = Result<PlayerPlayResponse, Error>;
561
562pub trait PlayerProxyInterface: Send + Sync {
563    type PlayResponseFut: std::future::Future<Output = Result<PlayerPlayResult, fidl::Error>> + Send;
564    fn r#play(&self, payload: PlayerPlayRequest) -> Self::PlayResponseFut;
565}
566
567#[derive(Debug, Clone)]
568pub struct PlayerProxy {
569    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
570}
571
572impl fdomain_client::fidl::Proxy for PlayerProxy {
573    type Protocol = PlayerMarker;
574
575    fn from_channel(inner: fdomain_client::Channel) -> Self {
576        Self::new(inner)
577    }
578
579    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
580        self.client.into_channel().map_err(|client| Self { client })
581    }
582
583    fn as_channel(&self) -> &fdomain_client::Channel {
584        self.client.as_channel()
585    }
586}
587
588impl PlayerProxy {
589    /// Create a new Proxy for fuchsia.audio.controller/Player.
590    pub fn new(channel: fdomain_client::Channel) -> Self {
591        let protocol_name = <PlayerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
592        Self { client: fidl::client::Client::new(channel, protocol_name) }
593    }
594
595    /// Get a Stream of events from the remote end of the protocol.
596    ///
597    /// # Panics
598    ///
599    /// Panics if the event stream was already taken.
600    pub fn take_event_stream(&self) -> PlayerEventStream {
601        PlayerEventStream { event_receiver: self.client.take_event_receiver() }
602    }
603
604    /// Read audio data from a socket in WAV format and play it to a destination.
605    ///
606    /// Returns when all bytes have been read from the socket.
607    pub fn r#play(
608        &self,
609        mut payload: PlayerPlayRequest,
610    ) -> fidl::client::QueryResponseFut<
611        PlayerPlayResult,
612        fdomain_client::fidl::FDomainResourceDialect,
613    > {
614        PlayerProxyInterface::r#play(self, payload)
615    }
616}
617
618impl PlayerProxyInterface for PlayerProxy {
619    type PlayResponseFut = fidl::client::QueryResponseFut<
620        PlayerPlayResult,
621        fdomain_client::fidl::FDomainResourceDialect,
622    >;
623    fn r#play(&self, mut payload: PlayerPlayRequest) -> Self::PlayResponseFut {
624        fn _decode(
625            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
626        ) -> Result<PlayerPlayResult, fidl::Error> {
627            let _response = fidl::client::decode_transaction_body::<
628                fidl::encoding::FlexibleResultType<PlayerPlayResponse, Error>,
629                fdomain_client::fidl::FDomainResourceDialect,
630                0x1e63779971512042,
631            >(_buf?)?
632            .into_result_fdomain::<PlayerMarker>("play")?;
633            Ok(_response.map(|x| x))
634        }
635        self.client.send_query_and_decode::<PlayerPlayRequest, PlayerPlayResult>(
636            &mut payload,
637            0x1e63779971512042,
638            fidl::encoding::DynamicFlags::FLEXIBLE,
639            _decode,
640        )
641    }
642}
643
644pub struct PlayerEventStream {
645    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
646}
647
648impl std::marker::Unpin for PlayerEventStream {}
649
650impl futures::stream::FusedStream for PlayerEventStream {
651    fn is_terminated(&self) -> bool {
652        self.event_receiver.is_terminated()
653    }
654}
655
656impl futures::Stream for PlayerEventStream {
657    type Item = Result<PlayerEvent, fidl::Error>;
658
659    fn poll_next(
660        mut self: std::pin::Pin<&mut Self>,
661        cx: &mut std::task::Context<'_>,
662    ) -> std::task::Poll<Option<Self::Item>> {
663        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
664            &mut self.event_receiver,
665            cx
666        )?) {
667            Some(buf) => std::task::Poll::Ready(Some(PlayerEvent::decode(buf))),
668            None => std::task::Poll::Ready(None),
669        }
670    }
671}
672
673#[derive(Debug)]
674pub enum PlayerEvent {
675    #[non_exhaustive]
676    _UnknownEvent {
677        /// Ordinal of the event that was sent.
678        ordinal: u64,
679    },
680}
681
682impl PlayerEvent {
683    /// Decodes a message buffer as a [`PlayerEvent`].
684    fn decode(
685        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
686    ) -> Result<PlayerEvent, fidl::Error> {
687        let (bytes, _handles) = buf.split_mut();
688        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
689        debug_assert_eq!(tx_header.tx_id, 0);
690        match tx_header.ordinal {
691            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
692                Ok(PlayerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
693            }
694            _ => Err(fidl::Error::UnknownOrdinal {
695                ordinal: tx_header.ordinal,
696                protocol_name: <PlayerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
697            }),
698        }
699    }
700}
701
702/// A Stream of incoming requests for fuchsia.audio.controller/Player.
703pub struct PlayerRequestStream {
704    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
705    is_terminated: bool,
706}
707
708impl std::marker::Unpin for PlayerRequestStream {}
709
710impl futures::stream::FusedStream for PlayerRequestStream {
711    fn is_terminated(&self) -> bool {
712        self.is_terminated
713    }
714}
715
716impl fdomain_client::fidl::RequestStream for PlayerRequestStream {
717    type Protocol = PlayerMarker;
718    type ControlHandle = PlayerControlHandle;
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        PlayerControlHandle { 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 PlayerRequestStream {
744    type Item = Result<PlayerRequest, 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 PlayerRequestStream 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                    0x1e63779971512042 => {
779                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
780                        let mut req = fidl::new_empty!(
781                            PlayerPlayRequest,
782                            fdomain_client::fidl::FDomainResourceDialect
783                        );
784                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<PlayerPlayRequest>(&header, _body_bytes, handles, &mut req)?;
785                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
786                        Ok(PlayerRequest::Play {
787                            payload: req,
788                            responder: PlayerPlayResponder {
789                                control_handle: std::mem::ManuallyDrop::new(control_handle),
790                                tx_id: header.tx_id,
791                            },
792                        })
793                    }
794                    _ if header.tx_id == 0
795                        && header
796                            .dynamic_flags()
797                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
798                    {
799                        Ok(PlayerRequest::_UnknownMethod {
800                            ordinal: header.ordinal,
801                            control_handle: PlayerControlHandle { inner: this.inner.clone() },
802                            method_type: fidl::MethodType::OneWay,
803                        })
804                    }
805                    _ if header
806                        .dynamic_flags()
807                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
808                    {
809                        this.inner.send_framework_err(
810                            fidl::encoding::FrameworkErr::UnknownMethod,
811                            header.tx_id,
812                            header.ordinal,
813                            header.dynamic_flags(),
814                            (bytes, handles),
815                        )?;
816                        Ok(PlayerRequest::_UnknownMethod {
817                            ordinal: header.ordinal,
818                            control_handle: PlayerControlHandle { inner: this.inner.clone() },
819                            method_type: fidl::MethodType::TwoWay,
820                        })
821                    }
822                    _ => Err(fidl::Error::UnknownOrdinal {
823                        ordinal: header.ordinal,
824                        protocol_name:
825                            <PlayerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
826                    }),
827                }))
828            },
829        )
830    }
831}
832
833#[derive(Debug)]
834pub enum PlayerRequest {
835    /// Read audio data from a socket in WAV format and play it to a destination.
836    ///
837    /// Returns when all bytes have been read from the socket.
838    Play { payload: PlayerPlayRequest, responder: PlayerPlayResponder },
839    /// An interaction was received which does not match any known method.
840    #[non_exhaustive]
841    _UnknownMethod {
842        /// Ordinal of the method that was called.
843        ordinal: u64,
844        control_handle: PlayerControlHandle,
845        method_type: fidl::MethodType,
846    },
847}
848
849impl PlayerRequest {
850    #[allow(irrefutable_let_patterns)]
851    pub fn into_play(self) -> Option<(PlayerPlayRequest, PlayerPlayResponder)> {
852        if let PlayerRequest::Play { payload, responder } = self {
853            Some((payload, responder))
854        } else {
855            None
856        }
857    }
858
859    /// Name of the method defined in FIDL
860    pub fn method_name(&self) -> &'static str {
861        match *self {
862            PlayerRequest::Play { .. } => "play",
863            PlayerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
864                "unknown one-way method"
865            }
866            PlayerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
867                "unknown two-way method"
868            }
869        }
870    }
871}
872
873#[derive(Debug, Clone)]
874pub struct PlayerControlHandle {
875    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
876}
877
878impl fdomain_client::fidl::ControlHandle for PlayerControlHandle {
879    fn shutdown(&self) {
880        self.inner.shutdown()
881    }
882
883    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
884        self.inner.shutdown_with_epitaph(status)
885    }
886
887    fn is_closed(&self) -> bool {
888        self.inner.channel().is_closed()
889    }
890    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
891        self.inner.channel().on_closed()
892    }
893}
894
895impl PlayerControlHandle {}
896
897#[must_use = "FIDL methods require a response to be sent"]
898#[derive(Debug)]
899pub struct PlayerPlayResponder {
900    control_handle: std::mem::ManuallyDrop<PlayerControlHandle>,
901    tx_id: u32,
902}
903
904/// Set the the channel to be shutdown (see [`PlayerControlHandle::shutdown`])
905/// if the responder is dropped without sending a response, so that the client
906/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
907impl std::ops::Drop for PlayerPlayResponder {
908    fn drop(&mut self) {
909        self.control_handle.shutdown();
910        // Safety: drops once, never accessed again
911        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
912    }
913}
914
915impl fdomain_client::fidl::Responder for PlayerPlayResponder {
916    type ControlHandle = PlayerControlHandle;
917
918    fn control_handle(&self) -> &PlayerControlHandle {
919        &self.control_handle
920    }
921
922    fn drop_without_shutdown(mut self) {
923        // Safety: drops once, never accessed again due to mem::forget
924        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
925        // Prevent Drop from running (which would shut down the channel)
926        std::mem::forget(self);
927    }
928}
929
930impl PlayerPlayResponder {
931    /// Sends a response to the FIDL transaction.
932    ///
933    /// Sets the channel to shutdown if an error occurs.
934    pub fn send(self, mut result: Result<PlayerPlayResponse, Error>) -> Result<(), fidl::Error> {
935        let _result = self.send_raw(result);
936        if _result.is_err() {
937            self.control_handle.shutdown();
938        }
939        self.drop_without_shutdown();
940        _result
941    }
942
943    /// Similar to "send" but does not shutdown the channel if an error occurs.
944    pub fn send_no_shutdown_on_err(
945        self,
946        mut result: Result<PlayerPlayResponse, Error>,
947    ) -> Result<(), fidl::Error> {
948        let _result = self.send_raw(result);
949        self.drop_without_shutdown();
950        _result
951    }
952
953    fn send_raw(&self, mut result: Result<PlayerPlayResponse, Error>) -> Result<(), fidl::Error> {
954        self.control_handle
955            .inner
956            .send::<fidl::encoding::FlexibleResultType<PlayerPlayResponse, Error>>(
957                fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
958                self.tx_id,
959                0x1e63779971512042,
960                fidl::encoding::DynamicFlags::FLEXIBLE,
961            )
962    }
963}
964
965#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
966pub struct RecordCancelerMarker;
967
968impl fdomain_client::fidl::ProtocolMarker for RecordCancelerMarker {
969    type Proxy = RecordCancelerProxy;
970    type RequestStream = RecordCancelerRequestStream;
971
972    const DEBUG_NAME: &'static str = "(anonymous) RecordCanceler";
973}
974pub type RecordCancelerCancelResult = Result<(), i32>;
975
976pub trait RecordCancelerProxyInterface: Send + Sync {
977    type CancelResponseFut: std::future::Future<Output = Result<RecordCancelerCancelResult, fidl::Error>>
978        + Send;
979    fn r#cancel(&self) -> Self::CancelResponseFut;
980}
981
982#[derive(Debug, Clone)]
983pub struct RecordCancelerProxy {
984    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
985}
986
987impl fdomain_client::fidl::Proxy for RecordCancelerProxy {
988    type Protocol = RecordCancelerMarker;
989
990    fn from_channel(inner: fdomain_client::Channel) -> Self {
991        Self::new(inner)
992    }
993
994    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
995        self.client.into_channel().map_err(|client| Self { client })
996    }
997
998    fn as_channel(&self) -> &fdomain_client::Channel {
999        self.client.as_channel()
1000    }
1001}
1002
1003impl RecordCancelerProxy {
1004    /// Create a new Proxy for fuchsia.audio.controller/RecordCanceler.
1005    pub fn new(channel: fdomain_client::Channel) -> Self {
1006        let protocol_name =
1007            <RecordCancelerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1008        Self { client: fidl::client::Client::new(channel, protocol_name) }
1009    }
1010
1011    /// Get a Stream of events from the remote end of the protocol.
1012    ///
1013    /// # Panics
1014    ///
1015    /// Panics if the event stream was already taken.
1016    pub fn take_event_stream(&self) -> RecordCancelerEventStream {
1017        RecordCancelerEventStream { event_receiver: self.client.take_event_receiver() }
1018    }
1019
1020    /// Stop recording and writing data on the output socket.
1021    pub fn r#cancel(
1022        &self,
1023    ) -> fidl::client::QueryResponseFut<
1024        RecordCancelerCancelResult,
1025        fdomain_client::fidl::FDomainResourceDialect,
1026    > {
1027        RecordCancelerProxyInterface::r#cancel(self)
1028    }
1029}
1030
1031impl RecordCancelerProxyInterface for RecordCancelerProxy {
1032    type CancelResponseFut = fidl::client::QueryResponseFut<
1033        RecordCancelerCancelResult,
1034        fdomain_client::fidl::FDomainResourceDialect,
1035    >;
1036    fn r#cancel(&self) -> Self::CancelResponseFut {
1037        fn _decode(
1038            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1039        ) -> Result<RecordCancelerCancelResult, fidl::Error> {
1040            let _response = fidl::client::decode_transaction_body::<
1041                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1042                fdomain_client::fidl::FDomainResourceDialect,
1043                0x5ea52b81e366daf6,
1044            >(_buf?)?;
1045            Ok(_response.map(|x| x))
1046        }
1047        self.client
1048            .send_query_and_decode::<fidl::encoding::EmptyPayload, RecordCancelerCancelResult>(
1049                (),
1050                0x5ea52b81e366daf6,
1051                fidl::encoding::DynamicFlags::empty(),
1052                _decode,
1053            )
1054    }
1055}
1056
1057pub struct RecordCancelerEventStream {
1058    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1059}
1060
1061impl std::marker::Unpin for RecordCancelerEventStream {}
1062
1063impl futures::stream::FusedStream for RecordCancelerEventStream {
1064    fn is_terminated(&self) -> bool {
1065        self.event_receiver.is_terminated()
1066    }
1067}
1068
1069impl futures::Stream for RecordCancelerEventStream {
1070    type Item = Result<RecordCancelerEvent, fidl::Error>;
1071
1072    fn poll_next(
1073        mut self: std::pin::Pin<&mut Self>,
1074        cx: &mut std::task::Context<'_>,
1075    ) -> std::task::Poll<Option<Self::Item>> {
1076        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1077            &mut self.event_receiver,
1078            cx
1079        )?) {
1080            Some(buf) => std::task::Poll::Ready(Some(RecordCancelerEvent::decode(buf))),
1081            None => std::task::Poll::Ready(None),
1082        }
1083    }
1084}
1085
1086#[derive(Debug)]
1087pub enum RecordCancelerEvent {
1088    #[non_exhaustive]
1089    _UnknownEvent {
1090        /// Ordinal of the event that was sent.
1091        ordinal: u64,
1092    },
1093}
1094
1095impl RecordCancelerEvent {
1096    /// Decodes a message buffer as a [`RecordCancelerEvent`].
1097    fn decode(
1098        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1099    ) -> Result<RecordCancelerEvent, fidl::Error> {
1100        let (bytes, _handles) = buf.split_mut();
1101        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1102        debug_assert_eq!(tx_header.tx_id, 0);
1103        match tx_header.ordinal {
1104            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1105                Ok(RecordCancelerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1106            }
1107            _ => Err(fidl::Error::UnknownOrdinal {
1108                ordinal: tx_header.ordinal,
1109                protocol_name:
1110                    <RecordCancelerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1111            }),
1112        }
1113    }
1114}
1115
1116/// A Stream of incoming requests for fuchsia.audio.controller/RecordCanceler.
1117pub struct RecordCancelerRequestStream {
1118    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1119    is_terminated: bool,
1120}
1121
1122impl std::marker::Unpin for RecordCancelerRequestStream {}
1123
1124impl futures::stream::FusedStream for RecordCancelerRequestStream {
1125    fn is_terminated(&self) -> bool {
1126        self.is_terminated
1127    }
1128}
1129
1130impl fdomain_client::fidl::RequestStream for RecordCancelerRequestStream {
1131    type Protocol = RecordCancelerMarker;
1132    type ControlHandle = RecordCancelerControlHandle;
1133
1134    fn from_channel(channel: fdomain_client::Channel) -> Self {
1135        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1136    }
1137
1138    fn control_handle(&self) -> Self::ControlHandle {
1139        RecordCancelerControlHandle { inner: self.inner.clone() }
1140    }
1141
1142    fn into_inner(
1143        self,
1144    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1145    {
1146        (self.inner, self.is_terminated)
1147    }
1148
1149    fn from_inner(
1150        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1151        is_terminated: bool,
1152    ) -> Self {
1153        Self { inner, is_terminated }
1154    }
1155}
1156
1157impl futures::Stream for RecordCancelerRequestStream {
1158    type Item = Result<RecordCancelerRequest, fidl::Error>;
1159
1160    fn poll_next(
1161        mut self: std::pin::Pin<&mut Self>,
1162        cx: &mut std::task::Context<'_>,
1163    ) -> std::task::Poll<Option<Self::Item>> {
1164        let this = &mut *self;
1165        if this.inner.check_shutdown(cx) {
1166            this.is_terminated = true;
1167            return std::task::Poll::Ready(None);
1168        }
1169        if this.is_terminated {
1170            panic!("polled RecordCancelerRequestStream after completion");
1171        }
1172        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1173            |bytes, handles| {
1174                match this.inner.channel().read_etc(cx, bytes, handles) {
1175                    std::task::Poll::Ready(Ok(())) => {}
1176                    std::task::Poll::Pending => return std::task::Poll::Pending,
1177                    std::task::Poll::Ready(Err(None)) => {
1178                        this.is_terminated = true;
1179                        return std::task::Poll::Ready(None);
1180                    }
1181                    std::task::Poll::Ready(Err(Some(e))) => {
1182                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1183                            e.into(),
1184                        ))));
1185                    }
1186                }
1187
1188                // A message has been received from the channel
1189                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1190
1191                std::task::Poll::Ready(Some(match header.ordinal {
1192                0x5ea52b81e366daf6 => {
1193                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1194                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
1195                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1196                    let control_handle = RecordCancelerControlHandle {
1197                        inner: this.inner.clone(),
1198                    };
1199                    Ok(RecordCancelerRequest::Cancel {
1200                        responder: RecordCancelerCancelResponder {
1201                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1202                            tx_id: header.tx_id,
1203                        },
1204                    })
1205                }
1206                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1207                    Ok(RecordCancelerRequest::_UnknownMethod {
1208                        ordinal: header.ordinal,
1209                        control_handle: RecordCancelerControlHandle { inner: this.inner.clone() },
1210                        method_type: fidl::MethodType::OneWay,
1211                    })
1212                }
1213                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1214                    this.inner.send_framework_err(
1215                        fidl::encoding::FrameworkErr::UnknownMethod,
1216                        header.tx_id,
1217                        header.ordinal,
1218                        header.dynamic_flags(),
1219                        (bytes, handles),
1220                    )?;
1221                    Ok(RecordCancelerRequest::_UnknownMethod {
1222                        ordinal: header.ordinal,
1223                        control_handle: RecordCancelerControlHandle { inner: this.inner.clone() },
1224                        method_type: fidl::MethodType::TwoWay,
1225                    })
1226                }
1227                _ => Err(fidl::Error::UnknownOrdinal {
1228                    ordinal: header.ordinal,
1229                    protocol_name: <RecordCancelerMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1230                }),
1231            }))
1232            },
1233        )
1234    }
1235}
1236
1237/// Cancels a `Recorder.Record` request.
1238#[derive(Debug)]
1239pub enum RecordCancelerRequest {
1240    /// Stop recording and writing data on the output socket.
1241    Cancel { responder: RecordCancelerCancelResponder },
1242    /// An interaction was received which does not match any known method.
1243    #[non_exhaustive]
1244    _UnknownMethod {
1245        /// Ordinal of the method that was called.
1246        ordinal: u64,
1247        control_handle: RecordCancelerControlHandle,
1248        method_type: fidl::MethodType,
1249    },
1250}
1251
1252impl RecordCancelerRequest {
1253    #[allow(irrefutable_let_patterns)]
1254    pub fn into_cancel(self) -> Option<(RecordCancelerCancelResponder)> {
1255        if let RecordCancelerRequest::Cancel { responder } = self {
1256            Some((responder))
1257        } else {
1258            None
1259        }
1260    }
1261
1262    /// Name of the method defined in FIDL
1263    pub fn method_name(&self) -> &'static str {
1264        match *self {
1265            RecordCancelerRequest::Cancel { .. } => "cancel",
1266            RecordCancelerRequest::_UnknownMethod {
1267                method_type: fidl::MethodType::OneWay, ..
1268            } => "unknown one-way method",
1269            RecordCancelerRequest::_UnknownMethod {
1270                method_type: fidl::MethodType::TwoWay, ..
1271            } => "unknown two-way method",
1272        }
1273    }
1274}
1275
1276#[derive(Debug, Clone)]
1277pub struct RecordCancelerControlHandle {
1278    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1279}
1280
1281impl fdomain_client::fidl::ControlHandle for RecordCancelerControlHandle {
1282    fn shutdown(&self) {
1283        self.inner.shutdown()
1284    }
1285
1286    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1287        self.inner.shutdown_with_epitaph(status)
1288    }
1289
1290    fn is_closed(&self) -> bool {
1291        self.inner.channel().is_closed()
1292    }
1293    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1294        self.inner.channel().on_closed()
1295    }
1296}
1297
1298impl RecordCancelerControlHandle {}
1299
1300#[must_use = "FIDL methods require a response to be sent"]
1301#[derive(Debug)]
1302pub struct RecordCancelerCancelResponder {
1303    control_handle: std::mem::ManuallyDrop<RecordCancelerControlHandle>,
1304    tx_id: u32,
1305}
1306
1307/// Set the the channel to be shutdown (see [`RecordCancelerControlHandle::shutdown`])
1308/// if the responder is dropped without sending a response, so that the client
1309/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1310impl std::ops::Drop for RecordCancelerCancelResponder {
1311    fn drop(&mut self) {
1312        self.control_handle.shutdown();
1313        // Safety: drops once, never accessed again
1314        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1315    }
1316}
1317
1318impl fdomain_client::fidl::Responder for RecordCancelerCancelResponder {
1319    type ControlHandle = RecordCancelerControlHandle;
1320
1321    fn control_handle(&self) -> &RecordCancelerControlHandle {
1322        &self.control_handle
1323    }
1324
1325    fn drop_without_shutdown(mut self) {
1326        // Safety: drops once, never accessed again due to mem::forget
1327        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1328        // Prevent Drop from running (which would shut down the channel)
1329        std::mem::forget(self);
1330    }
1331}
1332
1333impl RecordCancelerCancelResponder {
1334    /// Sends a response to the FIDL transaction.
1335    ///
1336    /// Sets the channel to shutdown if an error occurs.
1337    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1338        let _result = self.send_raw(result);
1339        if _result.is_err() {
1340            self.control_handle.shutdown();
1341        }
1342        self.drop_without_shutdown();
1343        _result
1344    }
1345
1346    /// Similar to "send" but does not shutdown the channel if an error occurs.
1347    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1348        let _result = self.send_raw(result);
1349        self.drop_without_shutdown();
1350        _result
1351    }
1352
1353    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1354        self.control_handle
1355            .inner
1356            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1357                result,
1358                self.tx_id,
1359                0x5ea52b81e366daf6,
1360                fidl::encoding::DynamicFlags::empty(),
1361            )
1362    }
1363}
1364
1365#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1366pub struct RecorderMarker;
1367
1368impl fdomain_client::fidl::ProtocolMarker for RecorderMarker {
1369    type Proxy = RecorderProxy;
1370    type RequestStream = RecorderRequestStream;
1371
1372    const DEBUG_NAME: &'static str = "fuchsia.audio.controller.Recorder";
1373}
1374impl fdomain_client::fidl::DiscoverableProtocolMarker for RecorderMarker {}
1375pub type RecorderRecordResult = Result<RecorderRecordResponse, Error>;
1376
1377pub trait RecorderProxyInterface: Send + Sync {
1378    type RecordResponseFut: std::future::Future<Output = Result<RecorderRecordResult, fidl::Error>>
1379        + Send;
1380    fn r#record(&self, payload: RecorderRecordRequest) -> Self::RecordResponseFut;
1381}
1382
1383#[derive(Debug, Clone)]
1384pub struct RecorderProxy {
1385    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1386}
1387
1388impl fdomain_client::fidl::Proxy for RecorderProxy {
1389    type Protocol = RecorderMarker;
1390
1391    fn from_channel(inner: fdomain_client::Channel) -> Self {
1392        Self::new(inner)
1393    }
1394
1395    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1396        self.client.into_channel().map_err(|client| Self { client })
1397    }
1398
1399    fn as_channel(&self) -> &fdomain_client::Channel {
1400        self.client.as_channel()
1401    }
1402}
1403
1404impl RecorderProxy {
1405    /// Create a new Proxy for fuchsia.audio.controller/Recorder.
1406    pub fn new(channel: fdomain_client::Channel) -> Self {
1407        let protocol_name = <RecorderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1408        Self { client: fidl::client::Client::new(channel, protocol_name) }
1409    }
1410
1411    /// Get a Stream of events from the remote end of the protocol.
1412    ///
1413    /// # Panics
1414    ///
1415    /// Panics if the event stream was already taken.
1416    pub fn take_event_stream(&self) -> RecorderEventStream {
1417        RecorderEventStream { event_receiver: self.client.take_event_receiver() }
1418    }
1419
1420    /// Record audio data and write it to a socket in WAV format.
1421    pub fn r#record(
1422        &self,
1423        mut payload: RecorderRecordRequest,
1424    ) -> fidl::client::QueryResponseFut<
1425        RecorderRecordResult,
1426        fdomain_client::fidl::FDomainResourceDialect,
1427    > {
1428        RecorderProxyInterface::r#record(self, payload)
1429    }
1430}
1431
1432impl RecorderProxyInterface for RecorderProxy {
1433    type RecordResponseFut = fidl::client::QueryResponseFut<
1434        RecorderRecordResult,
1435        fdomain_client::fidl::FDomainResourceDialect,
1436    >;
1437    fn r#record(&self, mut payload: RecorderRecordRequest) -> Self::RecordResponseFut {
1438        fn _decode(
1439            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1440        ) -> Result<RecorderRecordResult, fidl::Error> {
1441            let _response = fidl::client::decode_transaction_body::<
1442                fidl::encoding::FlexibleResultType<RecorderRecordResponse, Error>,
1443                fdomain_client::fidl::FDomainResourceDialect,
1444                0x47cabcb60b2c8ca7,
1445            >(_buf?)?
1446            .into_result_fdomain::<RecorderMarker>("record")?;
1447            Ok(_response.map(|x| x))
1448        }
1449        self.client.send_query_and_decode::<RecorderRecordRequest, RecorderRecordResult>(
1450            &mut payload,
1451            0x47cabcb60b2c8ca7,
1452            fidl::encoding::DynamicFlags::FLEXIBLE,
1453            _decode,
1454        )
1455    }
1456}
1457
1458pub struct RecorderEventStream {
1459    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1460}
1461
1462impl std::marker::Unpin for RecorderEventStream {}
1463
1464impl futures::stream::FusedStream for RecorderEventStream {
1465    fn is_terminated(&self) -> bool {
1466        self.event_receiver.is_terminated()
1467    }
1468}
1469
1470impl futures::Stream for RecorderEventStream {
1471    type Item = Result<RecorderEvent, fidl::Error>;
1472
1473    fn poll_next(
1474        mut self: std::pin::Pin<&mut Self>,
1475        cx: &mut std::task::Context<'_>,
1476    ) -> std::task::Poll<Option<Self::Item>> {
1477        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1478            &mut self.event_receiver,
1479            cx
1480        )?) {
1481            Some(buf) => std::task::Poll::Ready(Some(RecorderEvent::decode(buf))),
1482            None => std::task::Poll::Ready(None),
1483        }
1484    }
1485}
1486
1487#[derive(Debug)]
1488pub enum RecorderEvent {
1489    #[non_exhaustive]
1490    _UnknownEvent {
1491        /// Ordinal of the event that was sent.
1492        ordinal: u64,
1493    },
1494}
1495
1496impl RecorderEvent {
1497    /// Decodes a message buffer as a [`RecorderEvent`].
1498    fn decode(
1499        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1500    ) -> Result<RecorderEvent, fidl::Error> {
1501        let (bytes, _handles) = buf.split_mut();
1502        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1503        debug_assert_eq!(tx_header.tx_id, 0);
1504        match tx_header.ordinal {
1505            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1506                Ok(RecorderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1507            }
1508            _ => Err(fidl::Error::UnknownOrdinal {
1509                ordinal: tx_header.ordinal,
1510                protocol_name: <RecorderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1511            }),
1512        }
1513    }
1514}
1515
1516/// A Stream of incoming requests for fuchsia.audio.controller/Recorder.
1517pub struct RecorderRequestStream {
1518    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1519    is_terminated: bool,
1520}
1521
1522impl std::marker::Unpin for RecorderRequestStream {}
1523
1524impl futures::stream::FusedStream for RecorderRequestStream {
1525    fn is_terminated(&self) -> bool {
1526        self.is_terminated
1527    }
1528}
1529
1530impl fdomain_client::fidl::RequestStream for RecorderRequestStream {
1531    type Protocol = RecorderMarker;
1532    type ControlHandle = RecorderControlHandle;
1533
1534    fn from_channel(channel: fdomain_client::Channel) -> Self {
1535        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1536    }
1537
1538    fn control_handle(&self) -> Self::ControlHandle {
1539        RecorderControlHandle { inner: self.inner.clone() }
1540    }
1541
1542    fn into_inner(
1543        self,
1544    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1545    {
1546        (self.inner, self.is_terminated)
1547    }
1548
1549    fn from_inner(
1550        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1551        is_terminated: bool,
1552    ) -> Self {
1553        Self { inner, is_terminated }
1554    }
1555}
1556
1557impl futures::Stream for RecorderRequestStream {
1558    type Item = Result<RecorderRequest, fidl::Error>;
1559
1560    fn poll_next(
1561        mut self: std::pin::Pin<&mut Self>,
1562        cx: &mut std::task::Context<'_>,
1563    ) -> std::task::Poll<Option<Self::Item>> {
1564        let this = &mut *self;
1565        if this.inner.check_shutdown(cx) {
1566            this.is_terminated = true;
1567            return std::task::Poll::Ready(None);
1568        }
1569        if this.is_terminated {
1570            panic!("polled RecorderRequestStream after completion");
1571        }
1572        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1573            |bytes, handles| {
1574                match this.inner.channel().read_etc(cx, bytes, handles) {
1575                    std::task::Poll::Ready(Ok(())) => {}
1576                    std::task::Poll::Pending => return std::task::Poll::Pending,
1577                    std::task::Poll::Ready(Err(None)) => {
1578                        this.is_terminated = true;
1579                        return std::task::Poll::Ready(None);
1580                    }
1581                    std::task::Poll::Ready(Err(Some(e))) => {
1582                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1583                            e.into(),
1584                        ))));
1585                    }
1586                }
1587
1588                // A message has been received from the channel
1589                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1590
1591                std::task::Poll::Ready(Some(match header.ordinal {
1592                    0x47cabcb60b2c8ca7 => {
1593                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1594                        let mut req = fidl::new_empty!(
1595                            RecorderRecordRequest,
1596                            fdomain_client::fidl::FDomainResourceDialect
1597                        );
1598                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RecorderRecordRequest>(&header, _body_bytes, handles, &mut req)?;
1599                        let control_handle = RecorderControlHandle { inner: this.inner.clone() };
1600                        Ok(RecorderRequest::Record {
1601                            payload: req,
1602                            responder: RecorderRecordResponder {
1603                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1604                                tx_id: header.tx_id,
1605                            },
1606                        })
1607                    }
1608                    _ if header.tx_id == 0
1609                        && header
1610                            .dynamic_flags()
1611                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1612                    {
1613                        Ok(RecorderRequest::_UnknownMethod {
1614                            ordinal: header.ordinal,
1615                            control_handle: RecorderControlHandle { inner: this.inner.clone() },
1616                            method_type: fidl::MethodType::OneWay,
1617                        })
1618                    }
1619                    _ if header
1620                        .dynamic_flags()
1621                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1622                    {
1623                        this.inner.send_framework_err(
1624                            fidl::encoding::FrameworkErr::UnknownMethod,
1625                            header.tx_id,
1626                            header.ordinal,
1627                            header.dynamic_flags(),
1628                            (bytes, handles),
1629                        )?;
1630                        Ok(RecorderRequest::_UnknownMethod {
1631                            ordinal: header.ordinal,
1632                            control_handle: RecorderControlHandle { inner: this.inner.clone() },
1633                            method_type: fidl::MethodType::TwoWay,
1634                        })
1635                    }
1636                    _ => Err(fidl::Error::UnknownOrdinal {
1637                        ordinal: header.ordinal,
1638                        protocol_name:
1639                            <RecorderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1640                    }),
1641                }))
1642            },
1643        )
1644    }
1645}
1646
1647#[derive(Debug)]
1648pub enum RecorderRequest {
1649    /// Record audio data and write it to a socket in WAV format.
1650    Record { payload: RecorderRecordRequest, responder: RecorderRecordResponder },
1651    /// An interaction was received which does not match any known method.
1652    #[non_exhaustive]
1653    _UnknownMethod {
1654        /// Ordinal of the method that was called.
1655        ordinal: u64,
1656        control_handle: RecorderControlHandle,
1657        method_type: fidl::MethodType,
1658    },
1659}
1660
1661impl RecorderRequest {
1662    #[allow(irrefutable_let_patterns)]
1663    pub fn into_record(self) -> Option<(RecorderRecordRequest, RecorderRecordResponder)> {
1664        if let RecorderRequest::Record { payload, responder } = self {
1665            Some((payload, responder))
1666        } else {
1667            None
1668        }
1669    }
1670
1671    /// Name of the method defined in FIDL
1672    pub fn method_name(&self) -> &'static str {
1673        match *self {
1674            RecorderRequest::Record { .. } => "record",
1675            RecorderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1676                "unknown one-way method"
1677            }
1678            RecorderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1679                "unknown two-way method"
1680            }
1681        }
1682    }
1683}
1684
1685#[derive(Debug, Clone)]
1686pub struct RecorderControlHandle {
1687    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1688}
1689
1690impl fdomain_client::fidl::ControlHandle for RecorderControlHandle {
1691    fn shutdown(&self) {
1692        self.inner.shutdown()
1693    }
1694
1695    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1696        self.inner.shutdown_with_epitaph(status)
1697    }
1698
1699    fn is_closed(&self) -> bool {
1700        self.inner.channel().is_closed()
1701    }
1702    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1703        self.inner.channel().on_closed()
1704    }
1705}
1706
1707impl RecorderControlHandle {}
1708
1709#[must_use = "FIDL methods require a response to be sent"]
1710#[derive(Debug)]
1711pub struct RecorderRecordResponder {
1712    control_handle: std::mem::ManuallyDrop<RecorderControlHandle>,
1713    tx_id: u32,
1714}
1715
1716/// Set the the channel to be shutdown (see [`RecorderControlHandle::shutdown`])
1717/// if the responder is dropped without sending a response, so that the client
1718/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1719impl std::ops::Drop for RecorderRecordResponder {
1720    fn drop(&mut self) {
1721        self.control_handle.shutdown();
1722        // Safety: drops once, never accessed again
1723        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1724    }
1725}
1726
1727impl fdomain_client::fidl::Responder for RecorderRecordResponder {
1728    type ControlHandle = RecorderControlHandle;
1729
1730    fn control_handle(&self) -> &RecorderControlHandle {
1731        &self.control_handle
1732    }
1733
1734    fn drop_without_shutdown(mut self) {
1735        // Safety: drops once, never accessed again due to mem::forget
1736        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1737        // Prevent Drop from running (which would shut down the channel)
1738        std::mem::forget(self);
1739    }
1740}
1741
1742impl RecorderRecordResponder {
1743    /// Sends a response to the FIDL transaction.
1744    ///
1745    /// Sets the channel to shutdown if an error occurs.
1746    pub fn send(
1747        self,
1748        mut result: Result<RecorderRecordResponse, Error>,
1749    ) -> Result<(), fidl::Error> {
1750        let _result = self.send_raw(result);
1751        if _result.is_err() {
1752            self.control_handle.shutdown();
1753        }
1754        self.drop_without_shutdown();
1755        _result
1756    }
1757
1758    /// Similar to "send" but does not shutdown the channel if an error occurs.
1759    pub fn send_no_shutdown_on_err(
1760        self,
1761        mut result: Result<RecorderRecordResponse, Error>,
1762    ) -> Result<(), fidl::Error> {
1763        let _result = self.send_raw(result);
1764        self.drop_without_shutdown();
1765        _result
1766    }
1767
1768    fn send_raw(
1769        &self,
1770        mut result: Result<RecorderRecordResponse, Error>,
1771    ) -> Result<(), fidl::Error> {
1772        self.control_handle
1773            .inner
1774            .send::<fidl::encoding::FlexibleResultType<RecorderRecordResponse, Error>>(
1775                fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
1776                self.tx_id,
1777                0x47cabcb60b2c8ca7,
1778                fidl::encoding::DynamicFlags::FLEXIBLE,
1779            )
1780    }
1781}
1782
1783mod internal {
1784    use super::*;
1785
1786    impl DeviceControlDeviceSetGainStateRequest {
1787        #[inline(always)]
1788        fn max_ordinal_present(&self) -> u64 {
1789            if let Some(_) = self.gain_state {
1790                return 2;
1791            }
1792            if let Some(_) = self.device {
1793                return 1;
1794            }
1795            0
1796        }
1797    }
1798
1799    impl fidl::encoding::ResourceTypeMarker for DeviceControlDeviceSetGainStateRequest {
1800        type Borrowed<'a> = &'a mut Self;
1801        fn take_or_borrow<'a>(
1802            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1803        ) -> Self::Borrowed<'a> {
1804            value
1805        }
1806    }
1807
1808    unsafe impl fidl::encoding::TypeMarker for DeviceControlDeviceSetGainStateRequest {
1809        type Owned = Self;
1810
1811        #[inline(always)]
1812        fn inline_align(_context: fidl::encoding::Context) -> usize {
1813            8
1814        }
1815
1816        #[inline(always)]
1817        fn inline_size(_context: fidl::encoding::Context) -> usize {
1818            16
1819        }
1820    }
1821
1822    unsafe impl
1823        fidl::encoding::Encode<
1824            DeviceControlDeviceSetGainStateRequest,
1825            fdomain_client::fidl::FDomainResourceDialect,
1826        > for &mut DeviceControlDeviceSetGainStateRequest
1827    {
1828        unsafe fn encode(
1829            self,
1830            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1831            offset: usize,
1832            mut depth: fidl::encoding::Depth,
1833        ) -> fidl::Result<()> {
1834            encoder.debug_check_bounds::<DeviceControlDeviceSetGainStateRequest>(offset);
1835            // Vector header
1836            let max_ordinal: u64 = self.max_ordinal_present();
1837            encoder.write_num(max_ordinal, offset);
1838            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1839            // Calling encoder.out_of_line_offset(0) is not allowed.
1840            if max_ordinal == 0 {
1841                return Ok(());
1842            }
1843            depth.increment()?;
1844            let envelope_size = 8;
1845            let bytes_len = max_ordinal as usize * envelope_size;
1846            #[allow(unused_variables)]
1847            let offset = encoder.out_of_line_offset(bytes_len);
1848            let mut _prev_end_offset: usize = 0;
1849            if 1 > max_ordinal {
1850                return Ok(());
1851            }
1852
1853            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1854            // are envelope_size bytes.
1855            let cur_offset: usize = (1 - 1) * envelope_size;
1856
1857            // Zero reserved fields.
1858            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1859
1860            // Safety:
1861            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1862            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1863            //   envelope_size bytes, there is always sufficient room.
1864            fidl::encoding::encode_in_envelope_optional::<
1865                DeviceSelector,
1866                fdomain_client::fidl::FDomainResourceDialect,
1867            >(
1868                self.device
1869                    .as_ref()
1870                    .map(<DeviceSelector as fidl::encoding::ValueTypeMarker>::borrow),
1871                encoder,
1872                offset + cur_offset,
1873                depth,
1874            )?;
1875
1876            _prev_end_offset = cur_offset + envelope_size;
1877            if 2 > max_ordinal {
1878                return Ok(());
1879            }
1880
1881            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1882            // are envelope_size bytes.
1883            let cur_offset: usize = (2 - 1) * envelope_size;
1884
1885            // Zero reserved fields.
1886            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1887
1888            // Safety:
1889            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1890            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1891            //   envelope_size bytes, there is always sufficient room.
1892            fidl::encoding::encode_in_envelope_optional::<fdomain_fuchsia_hardware_audio::GainState, fdomain_client::fidl::FDomainResourceDialect>(
1893            self.gain_state.as_ref().map(<fdomain_fuchsia_hardware_audio::GainState as fidl::encoding::ValueTypeMarker>::borrow),
1894            encoder, offset + cur_offset, depth
1895        )?;
1896
1897            _prev_end_offset = cur_offset + envelope_size;
1898
1899            Ok(())
1900        }
1901    }
1902
1903    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1904        for DeviceControlDeviceSetGainStateRequest
1905    {
1906        #[inline(always)]
1907        fn new_empty() -> Self {
1908            Self::default()
1909        }
1910
1911        unsafe fn decode(
1912            &mut self,
1913            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1914            offset: usize,
1915            mut depth: fidl::encoding::Depth,
1916        ) -> fidl::Result<()> {
1917            decoder.debug_check_bounds::<Self>(offset);
1918            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1919                None => return Err(fidl::Error::NotNullable),
1920                Some(len) => len,
1921            };
1922            // Calling decoder.out_of_line_offset(0) is not allowed.
1923            if len == 0 {
1924                return Ok(());
1925            };
1926            depth.increment()?;
1927            let envelope_size = 8;
1928            let bytes_len = len * envelope_size;
1929            let offset = decoder.out_of_line_offset(bytes_len)?;
1930            // Decode the envelope for each type.
1931            let mut _next_ordinal_to_read = 0;
1932            let mut next_offset = offset;
1933            let end_offset = offset + bytes_len;
1934            _next_ordinal_to_read += 1;
1935            if next_offset >= end_offset {
1936                return Ok(());
1937            }
1938
1939            // Decode unknown envelopes for gaps in ordinals.
1940            while _next_ordinal_to_read < 1 {
1941                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1942                _next_ordinal_to_read += 1;
1943                next_offset += envelope_size;
1944            }
1945
1946            let next_out_of_line = decoder.next_out_of_line();
1947            let handles_before = decoder.remaining_handles();
1948            if let Some((inlined, num_bytes, num_handles)) =
1949                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1950            {
1951                let member_inline_size =
1952                    <DeviceSelector as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1953                if inlined != (member_inline_size <= 4) {
1954                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1955                }
1956                let inner_offset;
1957                let mut inner_depth = depth.clone();
1958                if inlined {
1959                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1960                    inner_offset = next_offset;
1961                } else {
1962                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1963                    inner_depth.increment()?;
1964                }
1965                let val_ref = self.device.get_or_insert_with(|| {
1966                    fidl::new_empty!(DeviceSelector, fdomain_client::fidl::FDomainResourceDialect)
1967                });
1968                fidl::decode!(
1969                    DeviceSelector,
1970                    fdomain_client::fidl::FDomainResourceDialect,
1971                    val_ref,
1972                    decoder,
1973                    inner_offset,
1974                    inner_depth
1975                )?;
1976                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1977                {
1978                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1979                }
1980                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1981                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1982                }
1983            }
1984
1985            next_offset += envelope_size;
1986            _next_ordinal_to_read += 1;
1987            if next_offset >= end_offset {
1988                return Ok(());
1989            }
1990
1991            // Decode unknown envelopes for gaps in ordinals.
1992            while _next_ordinal_to_read < 2 {
1993                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1994                _next_ordinal_to_read += 1;
1995                next_offset += envelope_size;
1996            }
1997
1998            let next_out_of_line = decoder.next_out_of_line();
1999            let handles_before = decoder.remaining_handles();
2000            if let Some((inlined, num_bytes, num_handles)) =
2001                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2002            {
2003                let member_inline_size = <fdomain_fuchsia_hardware_audio::GainState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2004                if inlined != (member_inline_size <= 4) {
2005                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2006                }
2007                let inner_offset;
2008                let mut inner_depth = depth.clone();
2009                if inlined {
2010                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2011                    inner_offset = next_offset;
2012                } else {
2013                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2014                    inner_depth.increment()?;
2015                }
2016                let val_ref = self.gain_state.get_or_insert_with(|| {
2017                    fidl::new_empty!(
2018                        fdomain_fuchsia_hardware_audio::GainState,
2019                        fdomain_client::fidl::FDomainResourceDialect
2020                    )
2021                });
2022                fidl::decode!(
2023                    fdomain_fuchsia_hardware_audio::GainState,
2024                    fdomain_client::fidl::FDomainResourceDialect,
2025                    val_ref,
2026                    decoder,
2027                    inner_offset,
2028                    inner_depth
2029                )?;
2030                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2031                {
2032                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2033                }
2034                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2035                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2036                }
2037            }
2038
2039            next_offset += envelope_size;
2040
2041            // Decode the remaining unknown envelopes.
2042            while next_offset < end_offset {
2043                _next_ordinal_to_read += 1;
2044                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2045                next_offset += envelope_size;
2046            }
2047
2048            Ok(())
2049        }
2050    }
2051
2052    impl PlayerPlayRequest {
2053        #[inline(always)]
2054        fn max_ordinal_present(&self) -> u64 {
2055            if let Some(_) = self.active_channels_bitmask {
2056                return 4;
2057            }
2058            if let Some(_) = self.gain_settings {
2059                return 3;
2060            }
2061            if let Some(_) = self.destination {
2062                return 2;
2063            }
2064            if let Some(_) = self.wav_source {
2065                return 1;
2066            }
2067            0
2068        }
2069    }
2070
2071    impl fidl::encoding::ResourceTypeMarker for PlayerPlayRequest {
2072        type Borrowed<'a> = &'a mut Self;
2073        fn take_or_borrow<'a>(
2074            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2075        ) -> Self::Borrowed<'a> {
2076            value
2077        }
2078    }
2079
2080    unsafe impl fidl::encoding::TypeMarker for PlayerPlayRequest {
2081        type Owned = Self;
2082
2083        #[inline(always)]
2084        fn inline_align(_context: fidl::encoding::Context) -> usize {
2085            8
2086        }
2087
2088        #[inline(always)]
2089        fn inline_size(_context: fidl::encoding::Context) -> usize {
2090            16
2091        }
2092    }
2093
2094    unsafe impl
2095        fidl::encoding::Encode<PlayerPlayRequest, fdomain_client::fidl::FDomainResourceDialect>
2096        for &mut PlayerPlayRequest
2097    {
2098        unsafe fn encode(
2099            self,
2100            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2101            offset: usize,
2102            mut depth: fidl::encoding::Depth,
2103        ) -> fidl::Result<()> {
2104            encoder.debug_check_bounds::<PlayerPlayRequest>(offset);
2105            // Vector header
2106            let max_ordinal: u64 = self.max_ordinal_present();
2107            encoder.write_num(max_ordinal, offset);
2108            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2109            // Calling encoder.out_of_line_offset(0) is not allowed.
2110            if max_ordinal == 0 {
2111                return Ok(());
2112            }
2113            depth.increment()?;
2114            let envelope_size = 8;
2115            let bytes_len = max_ordinal as usize * envelope_size;
2116            #[allow(unused_variables)]
2117            let offset = encoder.out_of_line_offset(bytes_len);
2118            let mut _prev_end_offset: usize = 0;
2119            if 1 > max_ordinal {
2120                return Ok(());
2121            }
2122
2123            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2124            // are envelope_size bytes.
2125            let cur_offset: usize = (1 - 1) * envelope_size;
2126
2127            // Zero reserved fields.
2128            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2129
2130            // Safety:
2131            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2132            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2133            //   envelope_size bytes, there is always sufficient room.
2134            fidl::encoding::encode_in_envelope_optional::<
2135                fidl::encoding::HandleType<
2136                    fdomain_client::Socket,
2137                    { fidl::ObjectType::SOCKET.into_raw() },
2138                    16389,
2139                >,
2140                fdomain_client::fidl::FDomainResourceDialect,
2141            >(
2142                self.wav_source.as_mut().map(
2143                    <fidl::encoding::HandleType<
2144                        fdomain_client::Socket,
2145                        { fidl::ObjectType::SOCKET.into_raw() },
2146                        16389,
2147                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2148                ),
2149                encoder,
2150                offset + cur_offset,
2151                depth,
2152            )?;
2153
2154            _prev_end_offset = cur_offset + envelope_size;
2155            if 2 > max_ordinal {
2156                return Ok(());
2157            }
2158
2159            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2160            // are envelope_size bytes.
2161            let cur_offset: usize = (2 - 1) * envelope_size;
2162
2163            // Zero reserved fields.
2164            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2165
2166            // Safety:
2167            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2168            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2169            //   envelope_size bytes, there is always sufficient room.
2170            fidl::encoding::encode_in_envelope_optional::<
2171                PlayDestination,
2172                fdomain_client::fidl::FDomainResourceDialect,
2173            >(
2174                self.destination
2175                    .as_ref()
2176                    .map(<PlayDestination as fidl::encoding::ValueTypeMarker>::borrow),
2177                encoder,
2178                offset + cur_offset,
2179                depth,
2180            )?;
2181
2182            _prev_end_offset = cur_offset + envelope_size;
2183            if 3 > max_ordinal {
2184                return Ok(());
2185            }
2186
2187            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2188            // are envelope_size bytes.
2189            let cur_offset: usize = (3 - 1) * envelope_size;
2190
2191            // Zero reserved fields.
2192            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2193
2194            // Safety:
2195            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2196            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2197            //   envelope_size bytes, there is always sufficient room.
2198            fidl::encoding::encode_in_envelope_optional::<
2199                GainSettings,
2200                fdomain_client::fidl::FDomainResourceDialect,
2201            >(
2202                self.gain_settings
2203                    .as_ref()
2204                    .map(<GainSettings as fidl::encoding::ValueTypeMarker>::borrow),
2205                encoder,
2206                offset + cur_offset,
2207                depth,
2208            )?;
2209
2210            _prev_end_offset = cur_offset + envelope_size;
2211            if 4 > max_ordinal {
2212                return Ok(());
2213            }
2214
2215            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2216            // are envelope_size bytes.
2217            let cur_offset: usize = (4 - 1) * envelope_size;
2218
2219            // Zero reserved fields.
2220            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2221
2222            // Safety:
2223            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2224            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2225            //   envelope_size bytes, there is always sufficient room.
2226            fidl::encoding::encode_in_envelope_optional::<
2227                u64,
2228                fdomain_client::fidl::FDomainResourceDialect,
2229            >(
2230                self.active_channels_bitmask
2231                    .as_ref()
2232                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2233                encoder,
2234                offset + cur_offset,
2235                depth,
2236            )?;
2237
2238            _prev_end_offset = cur_offset + envelope_size;
2239
2240            Ok(())
2241        }
2242    }
2243
2244    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2245        for PlayerPlayRequest
2246    {
2247        #[inline(always)]
2248        fn new_empty() -> Self {
2249            Self::default()
2250        }
2251
2252        unsafe fn decode(
2253            &mut self,
2254            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2255            offset: usize,
2256            mut depth: fidl::encoding::Depth,
2257        ) -> fidl::Result<()> {
2258            decoder.debug_check_bounds::<Self>(offset);
2259            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2260                None => return Err(fidl::Error::NotNullable),
2261                Some(len) => len,
2262            };
2263            // Calling decoder.out_of_line_offset(0) is not allowed.
2264            if len == 0 {
2265                return Ok(());
2266            };
2267            depth.increment()?;
2268            let envelope_size = 8;
2269            let bytes_len = len * envelope_size;
2270            let offset = decoder.out_of_line_offset(bytes_len)?;
2271            // Decode the envelope for each type.
2272            let mut _next_ordinal_to_read = 0;
2273            let mut next_offset = offset;
2274            let end_offset = offset + bytes_len;
2275            _next_ordinal_to_read += 1;
2276            if next_offset >= end_offset {
2277                return Ok(());
2278            }
2279
2280            // Decode unknown envelopes for gaps in ordinals.
2281            while _next_ordinal_to_read < 1 {
2282                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2283                _next_ordinal_to_read += 1;
2284                next_offset += envelope_size;
2285            }
2286
2287            let next_out_of_line = decoder.next_out_of_line();
2288            let handles_before = decoder.remaining_handles();
2289            if let Some((inlined, num_bytes, num_handles)) =
2290                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2291            {
2292                let member_inline_size = <fidl::encoding::HandleType<
2293                    fdomain_client::Socket,
2294                    { fidl::ObjectType::SOCKET.into_raw() },
2295                    16389,
2296                > as fidl::encoding::TypeMarker>::inline_size(
2297                    decoder.context
2298                );
2299                if inlined != (member_inline_size <= 4) {
2300                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2301                }
2302                let inner_offset;
2303                let mut inner_depth = depth.clone();
2304                if inlined {
2305                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2306                    inner_offset = next_offset;
2307                } else {
2308                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2309                    inner_depth.increment()?;
2310                }
2311                let val_ref =
2312                self.wav_source.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16389>, fdomain_client::fidl::FDomainResourceDialect));
2313                fidl::decode!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16389>, fdomain_client::fidl::FDomainResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2314                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2315                {
2316                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2317                }
2318                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2319                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2320                }
2321            }
2322
2323            next_offset += envelope_size;
2324            _next_ordinal_to_read += 1;
2325            if next_offset >= end_offset {
2326                return Ok(());
2327            }
2328
2329            // Decode unknown envelopes for gaps in ordinals.
2330            while _next_ordinal_to_read < 2 {
2331                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2332                _next_ordinal_to_read += 1;
2333                next_offset += envelope_size;
2334            }
2335
2336            let next_out_of_line = decoder.next_out_of_line();
2337            let handles_before = decoder.remaining_handles();
2338            if let Some((inlined, num_bytes, num_handles)) =
2339                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2340            {
2341                let member_inline_size =
2342                    <PlayDestination as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2343                if inlined != (member_inline_size <= 4) {
2344                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2345                }
2346                let inner_offset;
2347                let mut inner_depth = depth.clone();
2348                if inlined {
2349                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2350                    inner_offset = next_offset;
2351                } else {
2352                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2353                    inner_depth.increment()?;
2354                }
2355                let val_ref = self.destination.get_or_insert_with(|| {
2356                    fidl::new_empty!(PlayDestination, fdomain_client::fidl::FDomainResourceDialect)
2357                });
2358                fidl::decode!(
2359                    PlayDestination,
2360                    fdomain_client::fidl::FDomainResourceDialect,
2361                    val_ref,
2362                    decoder,
2363                    inner_offset,
2364                    inner_depth
2365                )?;
2366                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2367                {
2368                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2369                }
2370                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2371                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2372                }
2373            }
2374
2375            next_offset += envelope_size;
2376            _next_ordinal_to_read += 1;
2377            if next_offset >= end_offset {
2378                return Ok(());
2379            }
2380
2381            // Decode unknown envelopes for gaps in ordinals.
2382            while _next_ordinal_to_read < 3 {
2383                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2384                _next_ordinal_to_read += 1;
2385                next_offset += envelope_size;
2386            }
2387
2388            let next_out_of_line = decoder.next_out_of_line();
2389            let handles_before = decoder.remaining_handles();
2390            if let Some((inlined, num_bytes, num_handles)) =
2391                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2392            {
2393                let member_inline_size =
2394                    <GainSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2395                if inlined != (member_inline_size <= 4) {
2396                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2397                }
2398                let inner_offset;
2399                let mut inner_depth = depth.clone();
2400                if inlined {
2401                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2402                    inner_offset = next_offset;
2403                } else {
2404                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2405                    inner_depth.increment()?;
2406                }
2407                let val_ref = self.gain_settings.get_or_insert_with(|| {
2408                    fidl::new_empty!(GainSettings, fdomain_client::fidl::FDomainResourceDialect)
2409                });
2410                fidl::decode!(
2411                    GainSettings,
2412                    fdomain_client::fidl::FDomainResourceDialect,
2413                    val_ref,
2414                    decoder,
2415                    inner_offset,
2416                    inner_depth
2417                )?;
2418                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2419                {
2420                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2421                }
2422                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2423                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2424                }
2425            }
2426
2427            next_offset += envelope_size;
2428            _next_ordinal_to_read += 1;
2429            if next_offset >= end_offset {
2430                return Ok(());
2431            }
2432
2433            // Decode unknown envelopes for gaps in ordinals.
2434            while _next_ordinal_to_read < 4 {
2435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2436                _next_ordinal_to_read += 1;
2437                next_offset += envelope_size;
2438            }
2439
2440            let next_out_of_line = decoder.next_out_of_line();
2441            let handles_before = decoder.remaining_handles();
2442            if let Some((inlined, num_bytes, num_handles)) =
2443                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2444            {
2445                let member_inline_size =
2446                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2447                if inlined != (member_inline_size <= 4) {
2448                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2449                }
2450                let inner_offset;
2451                let mut inner_depth = depth.clone();
2452                if inlined {
2453                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2454                    inner_offset = next_offset;
2455                } else {
2456                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2457                    inner_depth.increment()?;
2458                }
2459                let val_ref = self.active_channels_bitmask.get_or_insert_with(|| {
2460                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
2461                });
2462                fidl::decode!(
2463                    u64,
2464                    fdomain_client::fidl::FDomainResourceDialect,
2465                    val_ref,
2466                    decoder,
2467                    inner_offset,
2468                    inner_depth
2469                )?;
2470                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2471                {
2472                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2473                }
2474                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2475                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2476                }
2477            }
2478
2479            next_offset += envelope_size;
2480
2481            // Decode the remaining unknown envelopes.
2482            while next_offset < end_offset {
2483                _next_ordinal_to_read += 1;
2484                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2485                next_offset += envelope_size;
2486            }
2487
2488            Ok(())
2489        }
2490    }
2491
2492    impl PlayerPlayResponse {
2493        #[inline(always)]
2494        fn max_ordinal_present(&self) -> u64 {
2495            if let Some(_) = self.bytes_processed {
2496                return 1;
2497            }
2498            0
2499        }
2500    }
2501
2502    impl fidl::encoding::ResourceTypeMarker for PlayerPlayResponse {
2503        type Borrowed<'a> = &'a mut Self;
2504        fn take_or_borrow<'a>(
2505            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2506        ) -> Self::Borrowed<'a> {
2507            value
2508        }
2509    }
2510
2511    unsafe impl fidl::encoding::TypeMarker for PlayerPlayResponse {
2512        type Owned = Self;
2513
2514        #[inline(always)]
2515        fn inline_align(_context: fidl::encoding::Context) -> usize {
2516            8
2517        }
2518
2519        #[inline(always)]
2520        fn inline_size(_context: fidl::encoding::Context) -> usize {
2521            16
2522        }
2523    }
2524
2525    unsafe impl
2526        fidl::encoding::Encode<PlayerPlayResponse, fdomain_client::fidl::FDomainResourceDialect>
2527        for &mut PlayerPlayResponse
2528    {
2529        unsafe fn encode(
2530            self,
2531            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2532            offset: usize,
2533            mut depth: fidl::encoding::Depth,
2534        ) -> fidl::Result<()> {
2535            encoder.debug_check_bounds::<PlayerPlayResponse>(offset);
2536            // Vector header
2537            let max_ordinal: u64 = self.max_ordinal_present();
2538            encoder.write_num(max_ordinal, offset);
2539            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2540            // Calling encoder.out_of_line_offset(0) is not allowed.
2541            if max_ordinal == 0 {
2542                return Ok(());
2543            }
2544            depth.increment()?;
2545            let envelope_size = 8;
2546            let bytes_len = max_ordinal as usize * envelope_size;
2547            #[allow(unused_variables)]
2548            let offset = encoder.out_of_line_offset(bytes_len);
2549            let mut _prev_end_offset: usize = 0;
2550            if 1 > max_ordinal {
2551                return Ok(());
2552            }
2553
2554            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2555            // are envelope_size bytes.
2556            let cur_offset: usize = (1 - 1) * envelope_size;
2557
2558            // Zero reserved fields.
2559            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2560
2561            // Safety:
2562            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2563            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2564            //   envelope_size bytes, there is always sufficient room.
2565            fidl::encoding::encode_in_envelope_optional::<
2566                u64,
2567                fdomain_client::fidl::FDomainResourceDialect,
2568            >(
2569                self.bytes_processed.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2570                encoder,
2571                offset + cur_offset,
2572                depth,
2573            )?;
2574
2575            _prev_end_offset = cur_offset + envelope_size;
2576
2577            Ok(())
2578        }
2579    }
2580
2581    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2582        for PlayerPlayResponse
2583    {
2584        #[inline(always)]
2585        fn new_empty() -> Self {
2586            Self::default()
2587        }
2588
2589        unsafe fn decode(
2590            &mut self,
2591            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2592            offset: usize,
2593            mut depth: fidl::encoding::Depth,
2594        ) -> fidl::Result<()> {
2595            decoder.debug_check_bounds::<Self>(offset);
2596            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2597                None => return Err(fidl::Error::NotNullable),
2598                Some(len) => len,
2599            };
2600            // Calling decoder.out_of_line_offset(0) is not allowed.
2601            if len == 0 {
2602                return Ok(());
2603            };
2604            depth.increment()?;
2605            let envelope_size = 8;
2606            let bytes_len = len * envelope_size;
2607            let offset = decoder.out_of_line_offset(bytes_len)?;
2608            // Decode the envelope for each type.
2609            let mut _next_ordinal_to_read = 0;
2610            let mut next_offset = offset;
2611            let end_offset = offset + bytes_len;
2612            _next_ordinal_to_read += 1;
2613            if next_offset >= end_offset {
2614                return Ok(());
2615            }
2616
2617            // Decode unknown envelopes for gaps in ordinals.
2618            while _next_ordinal_to_read < 1 {
2619                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2620                _next_ordinal_to_read += 1;
2621                next_offset += envelope_size;
2622            }
2623
2624            let next_out_of_line = decoder.next_out_of_line();
2625            let handles_before = decoder.remaining_handles();
2626            if let Some((inlined, num_bytes, num_handles)) =
2627                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2628            {
2629                let member_inline_size =
2630                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2631                if inlined != (member_inline_size <= 4) {
2632                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2633                }
2634                let inner_offset;
2635                let mut inner_depth = depth.clone();
2636                if inlined {
2637                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2638                    inner_offset = next_offset;
2639                } else {
2640                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2641                    inner_depth.increment()?;
2642                }
2643                let val_ref = self.bytes_processed.get_or_insert_with(|| {
2644                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
2645                });
2646                fidl::decode!(
2647                    u64,
2648                    fdomain_client::fidl::FDomainResourceDialect,
2649                    val_ref,
2650                    decoder,
2651                    inner_offset,
2652                    inner_depth
2653                )?;
2654                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2655                {
2656                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2657                }
2658                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2659                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2660                }
2661            }
2662
2663            next_offset += envelope_size;
2664
2665            // Decode the remaining unknown envelopes.
2666            while next_offset < end_offset {
2667                _next_ordinal_to_read += 1;
2668                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2669                next_offset += envelope_size;
2670            }
2671
2672            Ok(())
2673        }
2674    }
2675
2676    impl RecorderRecordRequest {
2677        #[inline(always)]
2678        fn max_ordinal_present(&self) -> u64 {
2679            if let Some(_) = self.wav_data {
2680                return 7;
2681            }
2682            if let Some(_) = self.buffer_size {
2683                return 6;
2684            }
2685            if let Some(_) = self.gain_settings {
2686                return 5;
2687            }
2688            if let Some(_) = self.canceler {
2689                return 4;
2690            }
2691            if let Some(_) = self.duration {
2692                return 3;
2693            }
2694            if let Some(_) = self.stream_type {
2695                return 2;
2696            }
2697            if let Some(_) = self.source {
2698                return 1;
2699            }
2700            0
2701        }
2702    }
2703
2704    impl fidl::encoding::ResourceTypeMarker for RecorderRecordRequest {
2705        type Borrowed<'a> = &'a mut Self;
2706        fn take_or_borrow<'a>(
2707            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2708        ) -> Self::Borrowed<'a> {
2709            value
2710        }
2711    }
2712
2713    unsafe impl fidl::encoding::TypeMarker for RecorderRecordRequest {
2714        type Owned = Self;
2715
2716        #[inline(always)]
2717        fn inline_align(_context: fidl::encoding::Context) -> usize {
2718            8
2719        }
2720
2721        #[inline(always)]
2722        fn inline_size(_context: fidl::encoding::Context) -> usize {
2723            16
2724        }
2725    }
2726
2727    unsafe impl
2728        fidl::encoding::Encode<RecorderRecordRequest, fdomain_client::fidl::FDomainResourceDialect>
2729        for &mut RecorderRecordRequest
2730    {
2731        unsafe fn encode(
2732            self,
2733            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2734            offset: usize,
2735            mut depth: fidl::encoding::Depth,
2736        ) -> fidl::Result<()> {
2737            encoder.debug_check_bounds::<RecorderRecordRequest>(offset);
2738            // Vector header
2739            let max_ordinal: u64 = self.max_ordinal_present();
2740            encoder.write_num(max_ordinal, offset);
2741            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2742            // Calling encoder.out_of_line_offset(0) is not allowed.
2743            if max_ordinal == 0 {
2744                return Ok(());
2745            }
2746            depth.increment()?;
2747            let envelope_size = 8;
2748            let bytes_len = max_ordinal as usize * envelope_size;
2749            #[allow(unused_variables)]
2750            let offset = encoder.out_of_line_offset(bytes_len);
2751            let mut _prev_end_offset: usize = 0;
2752            if 1 > max_ordinal {
2753                return Ok(());
2754            }
2755
2756            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2757            // are envelope_size bytes.
2758            let cur_offset: usize = (1 - 1) * envelope_size;
2759
2760            // Zero reserved fields.
2761            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2762
2763            // Safety:
2764            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2765            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2766            //   envelope_size bytes, there is always sufficient room.
2767            fidl::encoding::encode_in_envelope_optional::<
2768                RecordSource,
2769                fdomain_client::fidl::FDomainResourceDialect,
2770            >(
2771                self.source.as_ref().map(<RecordSource as fidl::encoding::ValueTypeMarker>::borrow),
2772                encoder,
2773                offset + cur_offset,
2774                depth,
2775            )?;
2776
2777            _prev_end_offset = cur_offset + envelope_size;
2778            if 2 > max_ordinal {
2779                return Ok(());
2780            }
2781
2782            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2783            // are envelope_size bytes.
2784            let cur_offset: usize = (2 - 1) * envelope_size;
2785
2786            // Zero reserved fields.
2787            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2788
2789            // Safety:
2790            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2791            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2792            //   envelope_size bytes, there is always sufficient room.
2793            fidl::encoding::encode_in_envelope_optional::<fdomain_fuchsia_media::AudioStreamType, fdomain_client::fidl::FDomainResourceDialect>(
2794            self.stream_type.as_ref().map(<fdomain_fuchsia_media::AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow),
2795            encoder, offset + cur_offset, depth
2796        )?;
2797
2798            _prev_end_offset = cur_offset + envelope_size;
2799            if 3 > max_ordinal {
2800                return Ok(());
2801            }
2802
2803            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2804            // are envelope_size bytes.
2805            let cur_offset: usize = (3 - 1) * envelope_size;
2806
2807            // Zero reserved fields.
2808            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2809
2810            // Safety:
2811            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2812            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2813            //   envelope_size bytes, there is always sufficient room.
2814            fidl::encoding::encode_in_envelope_optional::<
2815                i64,
2816                fdomain_client::fidl::FDomainResourceDialect,
2817            >(
2818                self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2819                encoder,
2820                offset + cur_offset,
2821                depth,
2822            )?;
2823
2824            _prev_end_offset = cur_offset + envelope_size;
2825            if 4 > max_ordinal {
2826                return Ok(());
2827            }
2828
2829            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2830            // are envelope_size bytes.
2831            let cur_offset: usize = (4 - 1) * envelope_size;
2832
2833            // Zero reserved fields.
2834            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2835
2836            // Safety:
2837            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2838            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2839            //   envelope_size bytes, there is always sufficient room.
2840            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RecordCancelerMarker>>, fdomain_client::fidl::FDomainResourceDialect>(
2841            self.canceler.as_mut().map(<fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RecordCancelerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2842            encoder, offset + cur_offset, depth
2843        )?;
2844
2845            _prev_end_offset = cur_offset + envelope_size;
2846            if 5 > max_ordinal {
2847                return Ok(());
2848            }
2849
2850            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2851            // are envelope_size bytes.
2852            let cur_offset: usize = (5 - 1) * envelope_size;
2853
2854            // Zero reserved fields.
2855            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2856
2857            // Safety:
2858            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2859            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2860            //   envelope_size bytes, there is always sufficient room.
2861            fidl::encoding::encode_in_envelope_optional::<
2862                GainSettings,
2863                fdomain_client::fidl::FDomainResourceDialect,
2864            >(
2865                self.gain_settings
2866                    .as_ref()
2867                    .map(<GainSettings as fidl::encoding::ValueTypeMarker>::borrow),
2868                encoder,
2869                offset + cur_offset,
2870                depth,
2871            )?;
2872
2873            _prev_end_offset = cur_offset + envelope_size;
2874            if 6 > max_ordinal {
2875                return Ok(());
2876            }
2877
2878            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2879            // are envelope_size bytes.
2880            let cur_offset: usize = (6 - 1) * envelope_size;
2881
2882            // Zero reserved fields.
2883            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2884
2885            // Safety:
2886            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2887            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2888            //   envelope_size bytes, there is always sufficient room.
2889            fidl::encoding::encode_in_envelope_optional::<
2890                u64,
2891                fdomain_client::fidl::FDomainResourceDialect,
2892            >(
2893                self.buffer_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2894                encoder,
2895                offset + cur_offset,
2896                depth,
2897            )?;
2898
2899            _prev_end_offset = cur_offset + envelope_size;
2900            if 7 > max_ordinal {
2901                return Ok(());
2902            }
2903
2904            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2905            // are envelope_size bytes.
2906            let cur_offset: usize = (7 - 1) * envelope_size;
2907
2908            // Zero reserved fields.
2909            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2910
2911            // Safety:
2912            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2913            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2914            //   envelope_size bytes, there is always sufficient room.
2915            fidl::encoding::encode_in_envelope_optional::<
2916                fidl::encoding::HandleType<
2917                    fdomain_client::Socket,
2918                    { fidl::ObjectType::SOCKET.into_raw() },
2919                    2147483648,
2920                >,
2921                fdomain_client::fidl::FDomainResourceDialect,
2922            >(
2923                self.wav_data.as_mut().map(
2924                    <fidl::encoding::HandleType<
2925                        fdomain_client::Socket,
2926                        { fidl::ObjectType::SOCKET.into_raw() },
2927                        2147483648,
2928                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2929                ),
2930                encoder,
2931                offset + cur_offset,
2932                depth,
2933            )?;
2934
2935            _prev_end_offset = cur_offset + envelope_size;
2936
2937            Ok(())
2938        }
2939    }
2940
2941    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2942        for RecorderRecordRequest
2943    {
2944        #[inline(always)]
2945        fn new_empty() -> Self {
2946            Self::default()
2947        }
2948
2949        unsafe fn decode(
2950            &mut self,
2951            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2952            offset: usize,
2953            mut depth: fidl::encoding::Depth,
2954        ) -> fidl::Result<()> {
2955            decoder.debug_check_bounds::<Self>(offset);
2956            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2957                None => return Err(fidl::Error::NotNullable),
2958                Some(len) => len,
2959            };
2960            // Calling decoder.out_of_line_offset(0) is not allowed.
2961            if len == 0 {
2962                return Ok(());
2963            };
2964            depth.increment()?;
2965            let envelope_size = 8;
2966            let bytes_len = len * envelope_size;
2967            let offset = decoder.out_of_line_offset(bytes_len)?;
2968            // Decode the envelope for each type.
2969            let mut _next_ordinal_to_read = 0;
2970            let mut next_offset = offset;
2971            let end_offset = offset + bytes_len;
2972            _next_ordinal_to_read += 1;
2973            if next_offset >= end_offset {
2974                return Ok(());
2975            }
2976
2977            // Decode unknown envelopes for gaps in ordinals.
2978            while _next_ordinal_to_read < 1 {
2979                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2980                _next_ordinal_to_read += 1;
2981                next_offset += envelope_size;
2982            }
2983
2984            let next_out_of_line = decoder.next_out_of_line();
2985            let handles_before = decoder.remaining_handles();
2986            if let Some((inlined, num_bytes, num_handles)) =
2987                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2988            {
2989                let member_inline_size =
2990                    <RecordSource as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2991                if inlined != (member_inline_size <= 4) {
2992                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2993                }
2994                let inner_offset;
2995                let mut inner_depth = depth.clone();
2996                if inlined {
2997                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2998                    inner_offset = next_offset;
2999                } else {
3000                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3001                    inner_depth.increment()?;
3002                }
3003                let val_ref = self.source.get_or_insert_with(|| {
3004                    fidl::new_empty!(RecordSource, fdomain_client::fidl::FDomainResourceDialect)
3005                });
3006                fidl::decode!(
3007                    RecordSource,
3008                    fdomain_client::fidl::FDomainResourceDialect,
3009                    val_ref,
3010                    decoder,
3011                    inner_offset,
3012                    inner_depth
3013                )?;
3014                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3015                {
3016                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3017                }
3018                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3019                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3020                }
3021            }
3022
3023            next_offset += envelope_size;
3024            _next_ordinal_to_read += 1;
3025            if next_offset >= end_offset {
3026                return Ok(());
3027            }
3028
3029            // Decode unknown envelopes for gaps in ordinals.
3030            while _next_ordinal_to_read < 2 {
3031                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3032                _next_ordinal_to_read += 1;
3033                next_offset += envelope_size;
3034            }
3035
3036            let next_out_of_line = decoder.next_out_of_line();
3037            let handles_before = decoder.remaining_handles();
3038            if let Some((inlined, num_bytes, num_handles)) =
3039                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3040            {
3041                let member_inline_size = <fdomain_fuchsia_media::AudioStreamType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3042                if inlined != (member_inline_size <= 4) {
3043                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3044                }
3045                let inner_offset;
3046                let mut inner_depth = depth.clone();
3047                if inlined {
3048                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3049                    inner_offset = next_offset;
3050                } else {
3051                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3052                    inner_depth.increment()?;
3053                }
3054                let val_ref = self.stream_type.get_or_insert_with(|| {
3055                    fidl::new_empty!(
3056                        fdomain_fuchsia_media::AudioStreamType,
3057                        fdomain_client::fidl::FDomainResourceDialect
3058                    )
3059                });
3060                fidl::decode!(
3061                    fdomain_fuchsia_media::AudioStreamType,
3062                    fdomain_client::fidl::FDomainResourceDialect,
3063                    val_ref,
3064                    decoder,
3065                    inner_offset,
3066                    inner_depth
3067                )?;
3068                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3069                {
3070                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3071                }
3072                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3073                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3074                }
3075            }
3076
3077            next_offset += envelope_size;
3078            _next_ordinal_to_read += 1;
3079            if next_offset >= end_offset {
3080                return Ok(());
3081            }
3082
3083            // Decode unknown envelopes for gaps in ordinals.
3084            while _next_ordinal_to_read < 3 {
3085                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3086                _next_ordinal_to_read += 1;
3087                next_offset += envelope_size;
3088            }
3089
3090            let next_out_of_line = decoder.next_out_of_line();
3091            let handles_before = decoder.remaining_handles();
3092            if let Some((inlined, num_bytes, num_handles)) =
3093                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3094            {
3095                let member_inline_size =
3096                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3097                if inlined != (member_inline_size <= 4) {
3098                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3099                }
3100                let inner_offset;
3101                let mut inner_depth = depth.clone();
3102                if inlined {
3103                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3104                    inner_offset = next_offset;
3105                } else {
3106                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3107                    inner_depth.increment()?;
3108                }
3109                let val_ref = self.duration.get_or_insert_with(|| {
3110                    fidl::new_empty!(i64, fdomain_client::fidl::FDomainResourceDialect)
3111                });
3112                fidl::decode!(
3113                    i64,
3114                    fdomain_client::fidl::FDomainResourceDialect,
3115                    val_ref,
3116                    decoder,
3117                    inner_offset,
3118                    inner_depth
3119                )?;
3120                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3121                {
3122                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3123                }
3124                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3125                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3126                }
3127            }
3128
3129            next_offset += envelope_size;
3130            _next_ordinal_to_read += 1;
3131            if next_offset >= end_offset {
3132                return Ok(());
3133            }
3134
3135            // Decode unknown envelopes for gaps in ordinals.
3136            while _next_ordinal_to_read < 4 {
3137                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3138                _next_ordinal_to_read += 1;
3139                next_offset += envelope_size;
3140            }
3141
3142            let next_out_of_line = decoder.next_out_of_line();
3143            let handles_before = decoder.remaining_handles();
3144            if let Some((inlined, num_bytes, num_handles)) =
3145                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3146            {
3147                let member_inline_size = <fidl::encoding::Endpoint<
3148                    fdomain_client::fidl::ServerEnd<RecordCancelerMarker>,
3149                > as fidl::encoding::TypeMarker>::inline_size(
3150                    decoder.context
3151                );
3152                if inlined != (member_inline_size <= 4) {
3153                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3154                }
3155                let inner_offset;
3156                let mut inner_depth = depth.clone();
3157                if inlined {
3158                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3159                    inner_offset = next_offset;
3160                } else {
3161                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3162                    inner_depth.increment()?;
3163                }
3164                let val_ref = self.canceler.get_or_insert_with(|| {
3165                    fidl::new_empty!(
3166                        fidl::encoding::Endpoint<
3167                            fdomain_client::fidl::ServerEnd<RecordCancelerMarker>,
3168                        >,
3169                        fdomain_client::fidl::FDomainResourceDialect
3170                    )
3171                });
3172                fidl::decode!(
3173                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RecordCancelerMarker>>,
3174                    fdomain_client::fidl::FDomainResourceDialect,
3175                    val_ref,
3176                    decoder,
3177                    inner_offset,
3178                    inner_depth
3179                )?;
3180                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3181                {
3182                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3183                }
3184                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3185                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3186                }
3187            }
3188
3189            next_offset += envelope_size;
3190            _next_ordinal_to_read += 1;
3191            if next_offset >= end_offset {
3192                return Ok(());
3193            }
3194
3195            // Decode unknown envelopes for gaps in ordinals.
3196            while _next_ordinal_to_read < 5 {
3197                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3198                _next_ordinal_to_read += 1;
3199                next_offset += envelope_size;
3200            }
3201
3202            let next_out_of_line = decoder.next_out_of_line();
3203            let handles_before = decoder.remaining_handles();
3204            if let Some((inlined, num_bytes, num_handles)) =
3205                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3206            {
3207                let member_inline_size =
3208                    <GainSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3209                if inlined != (member_inline_size <= 4) {
3210                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3211                }
3212                let inner_offset;
3213                let mut inner_depth = depth.clone();
3214                if inlined {
3215                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3216                    inner_offset = next_offset;
3217                } else {
3218                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3219                    inner_depth.increment()?;
3220                }
3221                let val_ref = self.gain_settings.get_or_insert_with(|| {
3222                    fidl::new_empty!(GainSettings, fdomain_client::fidl::FDomainResourceDialect)
3223                });
3224                fidl::decode!(
3225                    GainSettings,
3226                    fdomain_client::fidl::FDomainResourceDialect,
3227                    val_ref,
3228                    decoder,
3229                    inner_offset,
3230                    inner_depth
3231                )?;
3232                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3233                {
3234                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3235                }
3236                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3237                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3238                }
3239            }
3240
3241            next_offset += envelope_size;
3242            _next_ordinal_to_read += 1;
3243            if next_offset >= end_offset {
3244                return Ok(());
3245            }
3246
3247            // Decode unknown envelopes for gaps in ordinals.
3248            while _next_ordinal_to_read < 6 {
3249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3250                _next_ordinal_to_read += 1;
3251                next_offset += envelope_size;
3252            }
3253
3254            let next_out_of_line = decoder.next_out_of_line();
3255            let handles_before = decoder.remaining_handles();
3256            if let Some((inlined, num_bytes, num_handles)) =
3257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3258            {
3259                let member_inline_size =
3260                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3261                if inlined != (member_inline_size <= 4) {
3262                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3263                }
3264                let inner_offset;
3265                let mut inner_depth = depth.clone();
3266                if inlined {
3267                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3268                    inner_offset = next_offset;
3269                } else {
3270                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3271                    inner_depth.increment()?;
3272                }
3273                let val_ref = self.buffer_size.get_or_insert_with(|| {
3274                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
3275                });
3276                fidl::decode!(
3277                    u64,
3278                    fdomain_client::fidl::FDomainResourceDialect,
3279                    val_ref,
3280                    decoder,
3281                    inner_offset,
3282                    inner_depth
3283                )?;
3284                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3285                {
3286                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3287                }
3288                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3289                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3290                }
3291            }
3292
3293            next_offset += envelope_size;
3294            _next_ordinal_to_read += 1;
3295            if next_offset >= end_offset {
3296                return Ok(());
3297            }
3298
3299            // Decode unknown envelopes for gaps in ordinals.
3300            while _next_ordinal_to_read < 7 {
3301                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3302                _next_ordinal_to_read += 1;
3303                next_offset += envelope_size;
3304            }
3305
3306            let next_out_of_line = decoder.next_out_of_line();
3307            let handles_before = decoder.remaining_handles();
3308            if let Some((inlined, num_bytes, num_handles)) =
3309                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3310            {
3311                let member_inline_size = <fidl::encoding::HandleType<
3312                    fdomain_client::Socket,
3313                    { fidl::ObjectType::SOCKET.into_raw() },
3314                    2147483648,
3315                > as fidl::encoding::TypeMarker>::inline_size(
3316                    decoder.context
3317                );
3318                if inlined != (member_inline_size <= 4) {
3319                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3320                }
3321                let inner_offset;
3322                let mut inner_depth = depth.clone();
3323                if inlined {
3324                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3325                    inner_offset = next_offset;
3326                } else {
3327                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3328                    inner_depth.increment()?;
3329                }
3330                let val_ref =
3331                self.wav_data.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect));
3332                fidl::decode!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3333                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3334                {
3335                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3336                }
3337                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3338                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3339                }
3340            }
3341
3342            next_offset += envelope_size;
3343
3344            // Decode the remaining unknown envelopes.
3345            while next_offset < end_offset {
3346                _next_ordinal_to_read += 1;
3347                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3348                next_offset += envelope_size;
3349            }
3350
3351            Ok(())
3352        }
3353    }
3354
3355    impl RecorderRecordResponse {
3356        #[inline(always)]
3357        fn max_ordinal_present(&self) -> u64 {
3358            if let Some(_) = self.late_wakeups {
3359                return 3;
3360            }
3361            if let Some(_) = self.packets_processed {
3362                return 2;
3363            }
3364            if let Some(_) = self.bytes_processed {
3365                return 1;
3366            }
3367            0
3368        }
3369    }
3370
3371    impl fidl::encoding::ResourceTypeMarker for RecorderRecordResponse {
3372        type Borrowed<'a> = &'a mut Self;
3373        fn take_or_borrow<'a>(
3374            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3375        ) -> Self::Borrowed<'a> {
3376            value
3377        }
3378    }
3379
3380    unsafe impl fidl::encoding::TypeMarker for RecorderRecordResponse {
3381        type Owned = Self;
3382
3383        #[inline(always)]
3384        fn inline_align(_context: fidl::encoding::Context) -> usize {
3385            8
3386        }
3387
3388        #[inline(always)]
3389        fn inline_size(_context: fidl::encoding::Context) -> usize {
3390            16
3391        }
3392    }
3393
3394    unsafe impl
3395        fidl::encoding::Encode<RecorderRecordResponse, fdomain_client::fidl::FDomainResourceDialect>
3396        for &mut RecorderRecordResponse
3397    {
3398        unsafe fn encode(
3399            self,
3400            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3401            offset: usize,
3402            mut depth: fidl::encoding::Depth,
3403        ) -> fidl::Result<()> {
3404            encoder.debug_check_bounds::<RecorderRecordResponse>(offset);
3405            // Vector header
3406            let max_ordinal: u64 = self.max_ordinal_present();
3407            encoder.write_num(max_ordinal, offset);
3408            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3409            // Calling encoder.out_of_line_offset(0) is not allowed.
3410            if max_ordinal == 0 {
3411                return Ok(());
3412            }
3413            depth.increment()?;
3414            let envelope_size = 8;
3415            let bytes_len = max_ordinal as usize * envelope_size;
3416            #[allow(unused_variables)]
3417            let offset = encoder.out_of_line_offset(bytes_len);
3418            let mut _prev_end_offset: usize = 0;
3419            if 1 > max_ordinal {
3420                return Ok(());
3421            }
3422
3423            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3424            // are envelope_size bytes.
3425            let cur_offset: usize = (1 - 1) * envelope_size;
3426
3427            // Zero reserved fields.
3428            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3429
3430            // Safety:
3431            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3432            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3433            //   envelope_size bytes, there is always sufficient room.
3434            fidl::encoding::encode_in_envelope_optional::<
3435                u64,
3436                fdomain_client::fidl::FDomainResourceDialect,
3437            >(
3438                self.bytes_processed.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3439                encoder,
3440                offset + cur_offset,
3441                depth,
3442            )?;
3443
3444            _prev_end_offset = cur_offset + envelope_size;
3445            if 2 > max_ordinal {
3446                return Ok(());
3447            }
3448
3449            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3450            // are envelope_size bytes.
3451            let cur_offset: usize = (2 - 1) * envelope_size;
3452
3453            // Zero reserved fields.
3454            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3455
3456            // Safety:
3457            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3458            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3459            //   envelope_size bytes, there is always sufficient room.
3460            fidl::encoding::encode_in_envelope_optional::<
3461                u64,
3462                fdomain_client::fidl::FDomainResourceDialect,
3463            >(
3464                self.packets_processed
3465                    .as_ref()
3466                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3467                encoder,
3468                offset + cur_offset,
3469                depth,
3470            )?;
3471
3472            _prev_end_offset = cur_offset + envelope_size;
3473            if 3 > max_ordinal {
3474                return Ok(());
3475            }
3476
3477            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3478            // are envelope_size bytes.
3479            let cur_offset: usize = (3 - 1) * envelope_size;
3480
3481            // Zero reserved fields.
3482            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3483
3484            // Safety:
3485            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3486            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3487            //   envelope_size bytes, there is always sufficient room.
3488            fidl::encoding::encode_in_envelope_optional::<
3489                u64,
3490                fdomain_client::fidl::FDomainResourceDialect,
3491            >(
3492                self.late_wakeups.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3493                encoder,
3494                offset + cur_offset,
3495                depth,
3496            )?;
3497
3498            _prev_end_offset = cur_offset + envelope_size;
3499
3500            Ok(())
3501        }
3502    }
3503
3504    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3505        for RecorderRecordResponse
3506    {
3507        #[inline(always)]
3508        fn new_empty() -> Self {
3509            Self::default()
3510        }
3511
3512        unsafe fn decode(
3513            &mut self,
3514            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3515            offset: usize,
3516            mut depth: fidl::encoding::Depth,
3517        ) -> fidl::Result<()> {
3518            decoder.debug_check_bounds::<Self>(offset);
3519            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3520                None => return Err(fidl::Error::NotNullable),
3521                Some(len) => len,
3522            };
3523            // Calling decoder.out_of_line_offset(0) is not allowed.
3524            if len == 0 {
3525                return Ok(());
3526            };
3527            depth.increment()?;
3528            let envelope_size = 8;
3529            let bytes_len = len * envelope_size;
3530            let offset = decoder.out_of_line_offset(bytes_len)?;
3531            // Decode the envelope for each type.
3532            let mut _next_ordinal_to_read = 0;
3533            let mut next_offset = offset;
3534            let end_offset = offset + bytes_len;
3535            _next_ordinal_to_read += 1;
3536            if next_offset >= end_offset {
3537                return Ok(());
3538            }
3539
3540            // Decode unknown envelopes for gaps in ordinals.
3541            while _next_ordinal_to_read < 1 {
3542                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3543                _next_ordinal_to_read += 1;
3544                next_offset += envelope_size;
3545            }
3546
3547            let next_out_of_line = decoder.next_out_of_line();
3548            let handles_before = decoder.remaining_handles();
3549            if let Some((inlined, num_bytes, num_handles)) =
3550                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3551            {
3552                let member_inline_size =
3553                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3554                if inlined != (member_inline_size <= 4) {
3555                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3556                }
3557                let inner_offset;
3558                let mut inner_depth = depth.clone();
3559                if inlined {
3560                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3561                    inner_offset = next_offset;
3562                } else {
3563                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3564                    inner_depth.increment()?;
3565                }
3566                let val_ref = self.bytes_processed.get_or_insert_with(|| {
3567                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
3568                });
3569                fidl::decode!(
3570                    u64,
3571                    fdomain_client::fidl::FDomainResourceDialect,
3572                    val_ref,
3573                    decoder,
3574                    inner_offset,
3575                    inner_depth
3576                )?;
3577                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3578                {
3579                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3580                }
3581                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3582                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3583                }
3584            }
3585
3586            next_offset += envelope_size;
3587            _next_ordinal_to_read += 1;
3588            if next_offset >= end_offset {
3589                return Ok(());
3590            }
3591
3592            // Decode unknown envelopes for gaps in ordinals.
3593            while _next_ordinal_to_read < 2 {
3594                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3595                _next_ordinal_to_read += 1;
3596                next_offset += envelope_size;
3597            }
3598
3599            let next_out_of_line = decoder.next_out_of_line();
3600            let handles_before = decoder.remaining_handles();
3601            if let Some((inlined, num_bytes, num_handles)) =
3602                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3603            {
3604                let member_inline_size =
3605                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3606                if inlined != (member_inline_size <= 4) {
3607                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3608                }
3609                let inner_offset;
3610                let mut inner_depth = depth.clone();
3611                if inlined {
3612                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3613                    inner_offset = next_offset;
3614                } else {
3615                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3616                    inner_depth.increment()?;
3617                }
3618                let val_ref = self.packets_processed.get_or_insert_with(|| {
3619                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
3620                });
3621                fidl::decode!(
3622                    u64,
3623                    fdomain_client::fidl::FDomainResourceDialect,
3624                    val_ref,
3625                    decoder,
3626                    inner_offset,
3627                    inner_depth
3628                )?;
3629                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3630                {
3631                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3632                }
3633                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3634                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3635                }
3636            }
3637
3638            next_offset += envelope_size;
3639            _next_ordinal_to_read += 1;
3640            if next_offset >= end_offset {
3641                return Ok(());
3642            }
3643
3644            // Decode unknown envelopes for gaps in ordinals.
3645            while _next_ordinal_to_read < 3 {
3646                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3647                _next_ordinal_to_read += 1;
3648                next_offset += envelope_size;
3649            }
3650
3651            let next_out_of_line = decoder.next_out_of_line();
3652            let handles_before = decoder.remaining_handles();
3653            if let Some((inlined, num_bytes, num_handles)) =
3654                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3655            {
3656                let member_inline_size =
3657                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3658                if inlined != (member_inline_size <= 4) {
3659                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3660                }
3661                let inner_offset;
3662                let mut inner_depth = depth.clone();
3663                if inlined {
3664                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3665                    inner_offset = next_offset;
3666                } else {
3667                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3668                    inner_depth.increment()?;
3669                }
3670                let val_ref = self.late_wakeups.get_or_insert_with(|| {
3671                    fidl::new_empty!(u64, fdomain_client::fidl::FDomainResourceDialect)
3672                });
3673                fidl::decode!(
3674                    u64,
3675                    fdomain_client::fidl::FDomainResourceDialect,
3676                    val_ref,
3677                    decoder,
3678                    inner_offset,
3679                    inner_depth
3680                )?;
3681                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3682                {
3683                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3684                }
3685                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3686                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3687                }
3688            }
3689
3690            next_offset += envelope_size;
3691
3692            // Decode the remaining unknown envelopes.
3693            while next_offset < end_offset {
3694                _next_ordinal_to_read += 1;
3695                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3696                next_offset += envelope_size;
3697            }
3698
3699            Ok(())
3700        }
3701    }
3702}