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