1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_audio_controller_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct DeviceControlDeviceSetGainStateRequest {
16 pub device: Option<DeviceSelector>,
20 pub gain_state: Option<fidl_fuchsia_hardware_audio::GainState>,
24 #[doc(hidden)]
25 pub __source_breaking: fidl::marker::SourceBreaking,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
29 for DeviceControlDeviceSetGainStateRequest
30{
31}
32
33#[derive(Debug, Default, PartialEq)]
34pub struct PlayerPlayRequest {
35 pub wav_source: Option<fidl::Socket>,
41 pub destination: Option<PlayDestination>,
45 pub gain_settings: Option<GainSettings>,
50 pub active_channels_bitmask: Option<u64>,
54 #[doc(hidden)]
55 pub __source_breaking: fidl::marker::SourceBreaking,
56}
57
58impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PlayerPlayRequest {}
59
60#[derive(Debug, Default, PartialEq)]
61pub struct PlayerPlayResponse {
62 pub bytes_processed: Option<u64>,
64 #[doc(hidden)]
65 pub __source_breaking: fidl::marker::SourceBreaking,
66}
67
68impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PlayerPlayResponse {}
69
70#[derive(Debug, Default, PartialEq)]
71pub struct RecorderRecordRequest {
72 pub source: Option<RecordSource>,
76 pub stream_type: Option<fidl_fuchsia_media::AudioStreamType>,
80 pub duration: Option<i64>,
89 pub canceler: Option<fidl::endpoints::ServerEnd<RecordCancelerMarker>>,
93 pub gain_settings: Option<GainSettings>,
99 pub buffer_size: Option<u64>,
104 pub wav_data: Option<fidl::Socket>,
110 #[doc(hidden)]
111 pub __source_breaking: fidl::marker::SourceBreaking,
112}
113
114impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RecorderRecordRequest {}
115
116#[derive(Debug, Default, PartialEq)]
117pub struct RecorderRecordResponse {
118 pub bytes_processed: Option<u64>,
120 pub packets_processed: Option<u64>,
122 pub late_wakeups: Option<u64>,
127 #[doc(hidden)]
128 pub __source_breaking: fidl::marker::SourceBreaking,
129}
130
131impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RecorderRecordResponse {}
132
133#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
134pub struct DeviceControlMarker;
135
136impl fidl::endpoints::ProtocolMarker for DeviceControlMarker {
137 type Proxy = DeviceControlProxy;
138 type RequestStream = DeviceControlRequestStream;
139 #[cfg(target_os = "fuchsia")]
140 type SynchronousProxy = DeviceControlSynchronousProxy;
141
142 const DEBUG_NAME: &'static str = "fuchsia.audio.controller.DeviceControl";
143}
144impl fidl::endpoints::DiscoverableProtocolMarker for DeviceControlMarker {}
145pub type DeviceControlDeviceSetGainStateResult = Result<(), i32>;
146
147pub trait DeviceControlProxyInterface: Send + Sync {
148 type DeviceSetGainStateResponseFut: std::future::Future<Output = Result<DeviceControlDeviceSetGainStateResult, fidl::Error>>
149 + Send;
150 fn r#device_set_gain_state(
151 &self,
152 payload: DeviceControlDeviceSetGainStateRequest,
153 ) -> Self::DeviceSetGainStateResponseFut;
154}
155#[derive(Debug)]
156#[cfg(target_os = "fuchsia")]
157pub struct DeviceControlSynchronousProxy {
158 client: fidl::client::sync::Client,
159}
160
161#[cfg(target_os = "fuchsia")]
162impl fidl::endpoints::SynchronousProxy for DeviceControlSynchronousProxy {
163 type Proxy = DeviceControlProxy;
164 type Protocol = DeviceControlMarker;
165
166 fn from_channel(inner: fidl::Channel) -> Self {
167 Self::new(inner)
168 }
169
170 fn into_channel(self) -> fidl::Channel {
171 self.client.into_channel()
172 }
173
174 fn as_channel(&self) -> &fidl::Channel {
175 self.client.as_channel()
176 }
177}
178
179#[cfg(target_os = "fuchsia")]
180impl DeviceControlSynchronousProxy {
181 pub fn new(channel: fidl::Channel) -> Self {
182 let protocol_name = <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
183 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
184 }
185
186 pub fn into_channel(self) -> fidl::Channel {
187 self.client.into_channel()
188 }
189
190 pub fn wait_for_event(
193 &self,
194 deadline: zx::MonotonicInstant,
195 ) -> Result<DeviceControlEvent, fidl::Error> {
196 DeviceControlEvent::decode(self.client.wait_for_event(deadline)?)
197 }
198
199 pub fn r#device_set_gain_state(
201 &self,
202 mut payload: DeviceControlDeviceSetGainStateRequest,
203 ___deadline: zx::MonotonicInstant,
204 ) -> Result<DeviceControlDeviceSetGainStateResult, fidl::Error> {
205 let _response = self.client.send_query::<
206 DeviceControlDeviceSetGainStateRequest,
207 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
208 >(
209 &mut payload,
210 0x7c5c028bb8c42d12,
211 fidl::encoding::DynamicFlags::FLEXIBLE,
212 ___deadline,
213 )?
214 .into_result::<DeviceControlMarker>("device_set_gain_state")?;
215 Ok(_response.map(|x| x))
216 }
217}
218
219#[cfg(target_os = "fuchsia")]
220impl From<DeviceControlSynchronousProxy> for zx::Handle {
221 fn from(value: DeviceControlSynchronousProxy) -> Self {
222 value.into_channel().into()
223 }
224}
225
226#[cfg(target_os = "fuchsia")]
227impl From<fidl::Channel> for DeviceControlSynchronousProxy {
228 fn from(value: fidl::Channel) -> Self {
229 Self::new(value)
230 }
231}
232
233#[derive(Debug, Clone)]
234pub struct DeviceControlProxy {
235 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
236}
237
238impl fidl::endpoints::Proxy for DeviceControlProxy {
239 type Protocol = DeviceControlMarker;
240
241 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
242 Self::new(inner)
243 }
244
245 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
246 self.client.into_channel().map_err(|client| Self { client })
247 }
248
249 fn as_channel(&self) -> &::fidl::AsyncChannel {
250 self.client.as_channel()
251 }
252}
253
254impl DeviceControlProxy {
255 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
257 let protocol_name = <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
258 Self { client: fidl::client::Client::new(channel, protocol_name) }
259 }
260
261 pub fn take_event_stream(&self) -> DeviceControlEventStream {
267 DeviceControlEventStream { event_receiver: self.client.take_event_receiver() }
268 }
269
270 pub fn r#device_set_gain_state(
272 &self,
273 mut payload: DeviceControlDeviceSetGainStateRequest,
274 ) -> fidl::client::QueryResponseFut<
275 DeviceControlDeviceSetGainStateResult,
276 fidl::encoding::DefaultFuchsiaResourceDialect,
277 > {
278 DeviceControlProxyInterface::r#device_set_gain_state(self, payload)
279 }
280}
281
282impl DeviceControlProxyInterface for DeviceControlProxy {
283 type DeviceSetGainStateResponseFut = fidl::client::QueryResponseFut<
284 DeviceControlDeviceSetGainStateResult,
285 fidl::encoding::DefaultFuchsiaResourceDialect,
286 >;
287 fn r#device_set_gain_state(
288 &self,
289 mut payload: DeviceControlDeviceSetGainStateRequest,
290 ) -> Self::DeviceSetGainStateResponseFut {
291 fn _decode(
292 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
293 ) -> Result<DeviceControlDeviceSetGainStateResult, fidl::Error> {
294 let _response = fidl::client::decode_transaction_body::<
295 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
296 fidl::encoding::DefaultFuchsiaResourceDialect,
297 0x7c5c028bb8c42d12,
298 >(_buf?)?
299 .into_result::<DeviceControlMarker>("device_set_gain_state")?;
300 Ok(_response.map(|x| x))
301 }
302 self.client.send_query_and_decode::<
303 DeviceControlDeviceSetGainStateRequest,
304 DeviceControlDeviceSetGainStateResult,
305 >(
306 &mut payload,
307 0x7c5c028bb8c42d12,
308 fidl::encoding::DynamicFlags::FLEXIBLE,
309 _decode,
310 )
311 }
312}
313
314pub struct DeviceControlEventStream {
315 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
316}
317
318impl std::marker::Unpin for DeviceControlEventStream {}
319
320impl futures::stream::FusedStream for DeviceControlEventStream {
321 fn is_terminated(&self) -> bool {
322 self.event_receiver.is_terminated()
323 }
324}
325
326impl futures::Stream for DeviceControlEventStream {
327 type Item = Result<DeviceControlEvent, fidl::Error>;
328
329 fn poll_next(
330 mut self: std::pin::Pin<&mut Self>,
331 cx: &mut std::task::Context<'_>,
332 ) -> std::task::Poll<Option<Self::Item>> {
333 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
334 &mut self.event_receiver,
335 cx
336 )?) {
337 Some(buf) => std::task::Poll::Ready(Some(DeviceControlEvent::decode(buf))),
338 None => std::task::Poll::Ready(None),
339 }
340 }
341}
342
343#[derive(Debug)]
344pub enum DeviceControlEvent {
345 #[non_exhaustive]
346 _UnknownEvent {
347 ordinal: u64,
349 },
350}
351
352impl DeviceControlEvent {
353 fn decode(
355 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
356 ) -> Result<DeviceControlEvent, fidl::Error> {
357 let (bytes, _handles) = buf.split_mut();
358 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
359 debug_assert_eq!(tx_header.tx_id, 0);
360 match tx_header.ordinal {
361 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
362 Ok(DeviceControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
363 }
364 _ => Err(fidl::Error::UnknownOrdinal {
365 ordinal: tx_header.ordinal,
366 protocol_name: <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
367 }),
368 }
369 }
370}
371
372pub struct DeviceControlRequestStream {
374 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
375 is_terminated: bool,
376}
377
378impl std::marker::Unpin for DeviceControlRequestStream {}
379
380impl futures::stream::FusedStream for DeviceControlRequestStream {
381 fn is_terminated(&self) -> bool {
382 self.is_terminated
383 }
384}
385
386impl fidl::endpoints::RequestStream for DeviceControlRequestStream {
387 type Protocol = DeviceControlMarker;
388 type ControlHandle = DeviceControlControlHandle;
389
390 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
391 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
392 }
393
394 fn control_handle(&self) -> Self::ControlHandle {
395 DeviceControlControlHandle { inner: self.inner.clone() }
396 }
397
398 fn into_inner(
399 self,
400 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
401 {
402 (self.inner, self.is_terminated)
403 }
404
405 fn from_inner(
406 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
407 is_terminated: bool,
408 ) -> Self {
409 Self { inner, is_terminated }
410 }
411}
412
413impl futures::Stream for DeviceControlRequestStream {
414 type Item = Result<DeviceControlRequest, fidl::Error>;
415
416 fn poll_next(
417 mut self: std::pin::Pin<&mut Self>,
418 cx: &mut std::task::Context<'_>,
419 ) -> std::task::Poll<Option<Self::Item>> {
420 let this = &mut *self;
421 if this.inner.check_shutdown(cx) {
422 this.is_terminated = true;
423 return std::task::Poll::Ready(None);
424 }
425 if this.is_terminated {
426 panic!("polled DeviceControlRequestStream after completion");
427 }
428 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
429 |bytes, handles| {
430 match this.inner.channel().read_etc(cx, bytes, handles) {
431 std::task::Poll::Ready(Ok(())) => {}
432 std::task::Poll::Pending => return std::task::Poll::Pending,
433 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
434 this.is_terminated = true;
435 return std::task::Poll::Ready(None);
436 }
437 std::task::Poll::Ready(Err(e)) => {
438 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
439 e.into(),
440 ))))
441 }
442 }
443
444 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
446
447 std::task::Poll::Ready(Some(match header.ordinal {
448 0x7c5c028bb8c42d12 => {
449 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
450 let mut req = fidl::new_empty!(
451 DeviceControlDeviceSetGainStateRequest,
452 fidl::encoding::DefaultFuchsiaResourceDialect
453 );
454 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceControlDeviceSetGainStateRequest>(&header, _body_bytes, handles, &mut req)?;
455 let control_handle =
456 DeviceControlControlHandle { inner: this.inner.clone() };
457 Ok(DeviceControlRequest::DeviceSetGainState {
458 payload: req,
459 responder: DeviceControlDeviceSetGainStateResponder {
460 control_handle: std::mem::ManuallyDrop::new(control_handle),
461 tx_id: header.tx_id,
462 },
463 })
464 }
465 _ if header.tx_id == 0
466 && header
467 .dynamic_flags()
468 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
469 {
470 Ok(DeviceControlRequest::_UnknownMethod {
471 ordinal: header.ordinal,
472 control_handle: DeviceControlControlHandle {
473 inner: this.inner.clone(),
474 },
475 method_type: fidl::MethodType::OneWay,
476 })
477 }
478 _ if header
479 .dynamic_flags()
480 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
481 {
482 this.inner.send_framework_err(
483 fidl::encoding::FrameworkErr::UnknownMethod,
484 header.tx_id,
485 header.ordinal,
486 header.dynamic_flags(),
487 (bytes, handles),
488 )?;
489 Ok(DeviceControlRequest::_UnknownMethod {
490 ordinal: header.ordinal,
491 control_handle: DeviceControlControlHandle {
492 inner: this.inner.clone(),
493 },
494 method_type: fidl::MethodType::TwoWay,
495 })
496 }
497 _ => Err(fidl::Error::UnknownOrdinal {
498 ordinal: header.ordinal,
499 protocol_name:
500 <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
501 }),
502 }))
503 },
504 )
505 }
506}
507
508#[derive(Debug)]
510pub enum DeviceControlRequest {
511 DeviceSetGainState {
513 payload: DeviceControlDeviceSetGainStateRequest,
514 responder: DeviceControlDeviceSetGainStateResponder,
515 },
516 #[non_exhaustive]
518 _UnknownMethod {
519 ordinal: u64,
521 control_handle: DeviceControlControlHandle,
522 method_type: fidl::MethodType,
523 },
524}
525
526impl DeviceControlRequest {
527 #[allow(irrefutable_let_patterns)]
528 pub fn into_device_set_gain_state(
529 self,
530 ) -> Option<(DeviceControlDeviceSetGainStateRequest, DeviceControlDeviceSetGainStateResponder)>
531 {
532 if let DeviceControlRequest::DeviceSetGainState { payload, responder } = self {
533 Some((payload, responder))
534 } else {
535 None
536 }
537 }
538
539 pub fn method_name(&self) -> &'static str {
541 match *self {
542 DeviceControlRequest::DeviceSetGainState { .. } => "device_set_gain_state",
543 DeviceControlRequest::_UnknownMethod {
544 method_type: fidl::MethodType::OneWay, ..
545 } => "unknown one-way method",
546 DeviceControlRequest::_UnknownMethod {
547 method_type: fidl::MethodType::TwoWay, ..
548 } => "unknown two-way method",
549 }
550 }
551}
552
553#[derive(Debug, Clone)]
554pub struct DeviceControlControlHandle {
555 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
556}
557
558impl fidl::endpoints::ControlHandle for DeviceControlControlHandle {
559 fn shutdown(&self) {
560 self.inner.shutdown()
561 }
562 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
563 self.inner.shutdown_with_epitaph(status)
564 }
565
566 fn is_closed(&self) -> bool {
567 self.inner.channel().is_closed()
568 }
569 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
570 self.inner.channel().on_closed()
571 }
572
573 #[cfg(target_os = "fuchsia")]
574 fn signal_peer(
575 &self,
576 clear_mask: zx::Signals,
577 set_mask: zx::Signals,
578 ) -> Result<(), zx_status::Status> {
579 use fidl::Peered;
580 self.inner.channel().signal_peer(clear_mask, set_mask)
581 }
582}
583
584impl DeviceControlControlHandle {}
585
586#[must_use = "FIDL methods require a response to be sent"]
587#[derive(Debug)]
588pub struct DeviceControlDeviceSetGainStateResponder {
589 control_handle: std::mem::ManuallyDrop<DeviceControlControlHandle>,
590 tx_id: u32,
591}
592
593impl std::ops::Drop for DeviceControlDeviceSetGainStateResponder {
597 fn drop(&mut self) {
598 self.control_handle.shutdown();
599 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
601 }
602}
603
604impl fidl::endpoints::Responder for DeviceControlDeviceSetGainStateResponder {
605 type ControlHandle = DeviceControlControlHandle;
606
607 fn control_handle(&self) -> &DeviceControlControlHandle {
608 &self.control_handle
609 }
610
611 fn drop_without_shutdown(mut self) {
612 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
614 std::mem::forget(self);
616 }
617}
618
619impl DeviceControlDeviceSetGainStateResponder {
620 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
624 let _result = self.send_raw(result);
625 if _result.is_err() {
626 self.control_handle.shutdown();
627 }
628 self.drop_without_shutdown();
629 _result
630 }
631
632 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
634 let _result = self.send_raw(result);
635 self.drop_without_shutdown();
636 _result
637 }
638
639 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
640 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
641 fidl::encoding::EmptyStruct,
642 i32,
643 >>(
644 fidl::encoding::FlexibleResult::new(result),
645 self.tx_id,
646 0x7c5c028bb8c42d12,
647 fidl::encoding::DynamicFlags::FLEXIBLE,
648 )
649 }
650}
651
652#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
653pub struct PlayerMarker;
654
655impl fidl::endpoints::ProtocolMarker for PlayerMarker {
656 type Proxy = PlayerProxy;
657 type RequestStream = PlayerRequestStream;
658 #[cfg(target_os = "fuchsia")]
659 type SynchronousProxy = PlayerSynchronousProxy;
660
661 const DEBUG_NAME: &'static str = "fuchsia.audio.controller.Player";
662}
663impl fidl::endpoints::DiscoverableProtocolMarker for PlayerMarker {}
664pub type PlayerPlayResult = Result<PlayerPlayResponse, Error>;
665
666pub trait PlayerProxyInterface: Send + Sync {
667 type PlayResponseFut: std::future::Future<Output = Result<PlayerPlayResult, fidl::Error>> + Send;
668 fn r#play(&self, payload: PlayerPlayRequest) -> Self::PlayResponseFut;
669}
670#[derive(Debug)]
671#[cfg(target_os = "fuchsia")]
672pub struct PlayerSynchronousProxy {
673 client: fidl::client::sync::Client,
674}
675
676#[cfg(target_os = "fuchsia")]
677impl fidl::endpoints::SynchronousProxy for PlayerSynchronousProxy {
678 type Proxy = PlayerProxy;
679 type Protocol = PlayerMarker;
680
681 fn from_channel(inner: fidl::Channel) -> Self {
682 Self::new(inner)
683 }
684
685 fn into_channel(self) -> fidl::Channel {
686 self.client.into_channel()
687 }
688
689 fn as_channel(&self) -> &fidl::Channel {
690 self.client.as_channel()
691 }
692}
693
694#[cfg(target_os = "fuchsia")]
695impl PlayerSynchronousProxy {
696 pub fn new(channel: fidl::Channel) -> Self {
697 let protocol_name = <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
698 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
699 }
700
701 pub fn into_channel(self) -> fidl::Channel {
702 self.client.into_channel()
703 }
704
705 pub fn wait_for_event(
708 &self,
709 deadline: zx::MonotonicInstant,
710 ) -> Result<PlayerEvent, fidl::Error> {
711 PlayerEvent::decode(self.client.wait_for_event(deadline)?)
712 }
713
714 pub fn r#play(
718 &self,
719 mut payload: PlayerPlayRequest,
720 ___deadline: zx::MonotonicInstant,
721 ) -> Result<PlayerPlayResult, fidl::Error> {
722 let _response = self.client.send_query::<
723 PlayerPlayRequest,
724 fidl::encoding::FlexibleResultType<PlayerPlayResponse, Error>,
725 >(
726 &mut payload,
727 0x1e63779971512042,
728 fidl::encoding::DynamicFlags::FLEXIBLE,
729 ___deadline,
730 )?
731 .into_result::<PlayerMarker>("play")?;
732 Ok(_response.map(|x| x))
733 }
734}
735
736#[cfg(target_os = "fuchsia")]
737impl From<PlayerSynchronousProxy> for zx::Handle {
738 fn from(value: PlayerSynchronousProxy) -> Self {
739 value.into_channel().into()
740 }
741}
742
743#[cfg(target_os = "fuchsia")]
744impl From<fidl::Channel> for PlayerSynchronousProxy {
745 fn from(value: fidl::Channel) -> Self {
746 Self::new(value)
747 }
748}
749
750#[derive(Debug, Clone)]
751pub struct PlayerProxy {
752 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
753}
754
755impl fidl::endpoints::Proxy for PlayerProxy {
756 type Protocol = PlayerMarker;
757
758 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
759 Self::new(inner)
760 }
761
762 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
763 self.client.into_channel().map_err(|client| Self { client })
764 }
765
766 fn as_channel(&self) -> &::fidl::AsyncChannel {
767 self.client.as_channel()
768 }
769}
770
771impl PlayerProxy {
772 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
774 let protocol_name = <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
775 Self { client: fidl::client::Client::new(channel, protocol_name) }
776 }
777
778 pub fn take_event_stream(&self) -> PlayerEventStream {
784 PlayerEventStream { event_receiver: self.client.take_event_receiver() }
785 }
786
787 pub fn r#play(
791 &self,
792 mut payload: PlayerPlayRequest,
793 ) -> fidl::client::QueryResponseFut<
794 PlayerPlayResult,
795 fidl::encoding::DefaultFuchsiaResourceDialect,
796 > {
797 PlayerProxyInterface::r#play(self, payload)
798 }
799}
800
801impl PlayerProxyInterface for PlayerProxy {
802 type PlayResponseFut = fidl::client::QueryResponseFut<
803 PlayerPlayResult,
804 fidl::encoding::DefaultFuchsiaResourceDialect,
805 >;
806 fn r#play(&self, mut payload: PlayerPlayRequest) -> Self::PlayResponseFut {
807 fn _decode(
808 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
809 ) -> Result<PlayerPlayResult, fidl::Error> {
810 let _response = fidl::client::decode_transaction_body::<
811 fidl::encoding::FlexibleResultType<PlayerPlayResponse, Error>,
812 fidl::encoding::DefaultFuchsiaResourceDialect,
813 0x1e63779971512042,
814 >(_buf?)?
815 .into_result::<PlayerMarker>("play")?;
816 Ok(_response.map(|x| x))
817 }
818 self.client.send_query_and_decode::<PlayerPlayRequest, PlayerPlayResult>(
819 &mut payload,
820 0x1e63779971512042,
821 fidl::encoding::DynamicFlags::FLEXIBLE,
822 _decode,
823 )
824 }
825}
826
827pub struct PlayerEventStream {
828 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
829}
830
831impl std::marker::Unpin for PlayerEventStream {}
832
833impl futures::stream::FusedStream for PlayerEventStream {
834 fn is_terminated(&self) -> bool {
835 self.event_receiver.is_terminated()
836 }
837}
838
839impl futures::Stream for PlayerEventStream {
840 type Item = Result<PlayerEvent, fidl::Error>;
841
842 fn poll_next(
843 mut self: std::pin::Pin<&mut Self>,
844 cx: &mut std::task::Context<'_>,
845 ) -> std::task::Poll<Option<Self::Item>> {
846 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
847 &mut self.event_receiver,
848 cx
849 )?) {
850 Some(buf) => std::task::Poll::Ready(Some(PlayerEvent::decode(buf))),
851 None => std::task::Poll::Ready(None),
852 }
853 }
854}
855
856#[derive(Debug)]
857pub enum PlayerEvent {
858 #[non_exhaustive]
859 _UnknownEvent {
860 ordinal: u64,
862 },
863}
864
865impl PlayerEvent {
866 fn decode(
868 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
869 ) -> Result<PlayerEvent, fidl::Error> {
870 let (bytes, _handles) = buf.split_mut();
871 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
872 debug_assert_eq!(tx_header.tx_id, 0);
873 match tx_header.ordinal {
874 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
875 Ok(PlayerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
876 }
877 _ => Err(fidl::Error::UnknownOrdinal {
878 ordinal: tx_header.ordinal,
879 protocol_name: <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
880 }),
881 }
882 }
883}
884
885pub struct PlayerRequestStream {
887 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
888 is_terminated: bool,
889}
890
891impl std::marker::Unpin for PlayerRequestStream {}
892
893impl futures::stream::FusedStream for PlayerRequestStream {
894 fn is_terminated(&self) -> bool {
895 self.is_terminated
896 }
897}
898
899impl fidl::endpoints::RequestStream for PlayerRequestStream {
900 type Protocol = PlayerMarker;
901 type ControlHandle = PlayerControlHandle;
902
903 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
904 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
905 }
906
907 fn control_handle(&self) -> Self::ControlHandle {
908 PlayerControlHandle { inner: self.inner.clone() }
909 }
910
911 fn into_inner(
912 self,
913 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
914 {
915 (self.inner, self.is_terminated)
916 }
917
918 fn from_inner(
919 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
920 is_terminated: bool,
921 ) -> Self {
922 Self { inner, is_terminated }
923 }
924}
925
926impl futures::Stream for PlayerRequestStream {
927 type Item = Result<PlayerRequest, fidl::Error>;
928
929 fn poll_next(
930 mut self: std::pin::Pin<&mut Self>,
931 cx: &mut std::task::Context<'_>,
932 ) -> std::task::Poll<Option<Self::Item>> {
933 let this = &mut *self;
934 if this.inner.check_shutdown(cx) {
935 this.is_terminated = true;
936 return std::task::Poll::Ready(None);
937 }
938 if this.is_terminated {
939 panic!("polled PlayerRequestStream after completion");
940 }
941 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
942 |bytes, handles| {
943 match this.inner.channel().read_etc(cx, bytes, handles) {
944 std::task::Poll::Ready(Ok(())) => {}
945 std::task::Poll::Pending => return std::task::Poll::Pending,
946 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
947 this.is_terminated = true;
948 return std::task::Poll::Ready(None);
949 }
950 std::task::Poll::Ready(Err(e)) => {
951 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
952 e.into(),
953 ))))
954 }
955 }
956
957 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
959
960 std::task::Poll::Ready(Some(match header.ordinal {
961 0x1e63779971512042 => {
962 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
963 let mut req = fidl::new_empty!(
964 PlayerPlayRequest,
965 fidl::encoding::DefaultFuchsiaResourceDialect
966 );
967 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerPlayRequest>(&header, _body_bytes, handles, &mut req)?;
968 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
969 Ok(PlayerRequest::Play {
970 payload: req,
971 responder: PlayerPlayResponder {
972 control_handle: std::mem::ManuallyDrop::new(control_handle),
973 tx_id: header.tx_id,
974 },
975 })
976 }
977 _ if header.tx_id == 0
978 && header
979 .dynamic_flags()
980 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
981 {
982 Ok(PlayerRequest::_UnknownMethod {
983 ordinal: header.ordinal,
984 control_handle: PlayerControlHandle { inner: this.inner.clone() },
985 method_type: fidl::MethodType::OneWay,
986 })
987 }
988 _ if header
989 .dynamic_flags()
990 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
991 {
992 this.inner.send_framework_err(
993 fidl::encoding::FrameworkErr::UnknownMethod,
994 header.tx_id,
995 header.ordinal,
996 header.dynamic_flags(),
997 (bytes, handles),
998 )?;
999 Ok(PlayerRequest::_UnknownMethod {
1000 ordinal: header.ordinal,
1001 control_handle: PlayerControlHandle { inner: this.inner.clone() },
1002 method_type: fidl::MethodType::TwoWay,
1003 })
1004 }
1005 _ => Err(fidl::Error::UnknownOrdinal {
1006 ordinal: header.ordinal,
1007 protocol_name:
1008 <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1009 }),
1010 }))
1011 },
1012 )
1013 }
1014}
1015
1016#[derive(Debug)]
1017pub enum PlayerRequest {
1018 Play { payload: PlayerPlayRequest, responder: PlayerPlayResponder },
1022 #[non_exhaustive]
1024 _UnknownMethod {
1025 ordinal: u64,
1027 control_handle: PlayerControlHandle,
1028 method_type: fidl::MethodType,
1029 },
1030}
1031
1032impl PlayerRequest {
1033 #[allow(irrefutable_let_patterns)]
1034 pub fn into_play(self) -> Option<(PlayerPlayRequest, PlayerPlayResponder)> {
1035 if let PlayerRequest::Play { payload, responder } = self {
1036 Some((payload, responder))
1037 } else {
1038 None
1039 }
1040 }
1041
1042 pub fn method_name(&self) -> &'static str {
1044 match *self {
1045 PlayerRequest::Play { .. } => "play",
1046 PlayerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1047 "unknown one-way method"
1048 }
1049 PlayerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1050 "unknown two-way method"
1051 }
1052 }
1053 }
1054}
1055
1056#[derive(Debug, Clone)]
1057pub struct PlayerControlHandle {
1058 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1059}
1060
1061impl fidl::endpoints::ControlHandle for PlayerControlHandle {
1062 fn shutdown(&self) {
1063 self.inner.shutdown()
1064 }
1065 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1066 self.inner.shutdown_with_epitaph(status)
1067 }
1068
1069 fn is_closed(&self) -> bool {
1070 self.inner.channel().is_closed()
1071 }
1072 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1073 self.inner.channel().on_closed()
1074 }
1075
1076 #[cfg(target_os = "fuchsia")]
1077 fn signal_peer(
1078 &self,
1079 clear_mask: zx::Signals,
1080 set_mask: zx::Signals,
1081 ) -> Result<(), zx_status::Status> {
1082 use fidl::Peered;
1083 self.inner.channel().signal_peer(clear_mask, set_mask)
1084 }
1085}
1086
1087impl PlayerControlHandle {}
1088
1089#[must_use = "FIDL methods require a response to be sent"]
1090#[derive(Debug)]
1091pub struct PlayerPlayResponder {
1092 control_handle: std::mem::ManuallyDrop<PlayerControlHandle>,
1093 tx_id: u32,
1094}
1095
1096impl std::ops::Drop for PlayerPlayResponder {
1100 fn drop(&mut self) {
1101 self.control_handle.shutdown();
1102 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1104 }
1105}
1106
1107impl fidl::endpoints::Responder for PlayerPlayResponder {
1108 type ControlHandle = PlayerControlHandle;
1109
1110 fn control_handle(&self) -> &PlayerControlHandle {
1111 &self.control_handle
1112 }
1113
1114 fn drop_without_shutdown(mut self) {
1115 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1117 std::mem::forget(self);
1119 }
1120}
1121
1122impl PlayerPlayResponder {
1123 pub fn send(self, mut result: Result<PlayerPlayResponse, Error>) -> Result<(), fidl::Error> {
1127 let _result = self.send_raw(result);
1128 if _result.is_err() {
1129 self.control_handle.shutdown();
1130 }
1131 self.drop_without_shutdown();
1132 _result
1133 }
1134
1135 pub fn send_no_shutdown_on_err(
1137 self,
1138 mut result: Result<PlayerPlayResponse, Error>,
1139 ) -> Result<(), fidl::Error> {
1140 let _result = self.send_raw(result);
1141 self.drop_without_shutdown();
1142 _result
1143 }
1144
1145 fn send_raw(&self, mut result: Result<PlayerPlayResponse, Error>) -> Result<(), fidl::Error> {
1146 self.control_handle
1147 .inner
1148 .send::<fidl::encoding::FlexibleResultType<PlayerPlayResponse, Error>>(
1149 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
1150 self.tx_id,
1151 0x1e63779971512042,
1152 fidl::encoding::DynamicFlags::FLEXIBLE,
1153 )
1154 }
1155}
1156
1157#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1158pub struct RecordCancelerMarker;
1159
1160impl fidl::endpoints::ProtocolMarker for RecordCancelerMarker {
1161 type Proxy = RecordCancelerProxy;
1162 type RequestStream = RecordCancelerRequestStream;
1163 #[cfg(target_os = "fuchsia")]
1164 type SynchronousProxy = RecordCancelerSynchronousProxy;
1165
1166 const DEBUG_NAME: &'static str = "(anonymous) RecordCanceler";
1167}
1168pub type RecordCancelerCancelResult = Result<(), i32>;
1169
1170pub trait RecordCancelerProxyInterface: Send + Sync {
1171 type CancelResponseFut: std::future::Future<Output = Result<RecordCancelerCancelResult, fidl::Error>>
1172 + Send;
1173 fn r#cancel(&self) -> Self::CancelResponseFut;
1174}
1175#[derive(Debug)]
1176#[cfg(target_os = "fuchsia")]
1177pub struct RecordCancelerSynchronousProxy {
1178 client: fidl::client::sync::Client,
1179}
1180
1181#[cfg(target_os = "fuchsia")]
1182impl fidl::endpoints::SynchronousProxy for RecordCancelerSynchronousProxy {
1183 type Proxy = RecordCancelerProxy;
1184 type Protocol = RecordCancelerMarker;
1185
1186 fn from_channel(inner: fidl::Channel) -> Self {
1187 Self::new(inner)
1188 }
1189
1190 fn into_channel(self) -> fidl::Channel {
1191 self.client.into_channel()
1192 }
1193
1194 fn as_channel(&self) -> &fidl::Channel {
1195 self.client.as_channel()
1196 }
1197}
1198
1199#[cfg(target_os = "fuchsia")]
1200impl RecordCancelerSynchronousProxy {
1201 pub fn new(channel: fidl::Channel) -> Self {
1202 let protocol_name = <RecordCancelerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1203 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1204 }
1205
1206 pub fn into_channel(self) -> fidl::Channel {
1207 self.client.into_channel()
1208 }
1209
1210 pub fn wait_for_event(
1213 &self,
1214 deadline: zx::MonotonicInstant,
1215 ) -> Result<RecordCancelerEvent, fidl::Error> {
1216 RecordCancelerEvent::decode(self.client.wait_for_event(deadline)?)
1217 }
1218
1219 pub fn r#cancel(
1221 &self,
1222 ___deadline: zx::MonotonicInstant,
1223 ) -> Result<RecordCancelerCancelResult, fidl::Error> {
1224 let _response = self.client.send_query::<
1225 fidl::encoding::EmptyPayload,
1226 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1227 >(
1228 (),
1229 0x5ea52b81e366daf6,
1230 fidl::encoding::DynamicFlags::empty(),
1231 ___deadline,
1232 )?;
1233 Ok(_response.map(|x| x))
1234 }
1235}
1236
1237#[cfg(target_os = "fuchsia")]
1238impl From<RecordCancelerSynchronousProxy> for zx::Handle {
1239 fn from(value: RecordCancelerSynchronousProxy) -> Self {
1240 value.into_channel().into()
1241 }
1242}
1243
1244#[cfg(target_os = "fuchsia")]
1245impl From<fidl::Channel> for RecordCancelerSynchronousProxy {
1246 fn from(value: fidl::Channel) -> Self {
1247 Self::new(value)
1248 }
1249}
1250
1251#[derive(Debug, Clone)]
1252pub struct RecordCancelerProxy {
1253 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1254}
1255
1256impl fidl::endpoints::Proxy for RecordCancelerProxy {
1257 type Protocol = RecordCancelerMarker;
1258
1259 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1260 Self::new(inner)
1261 }
1262
1263 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1264 self.client.into_channel().map_err(|client| Self { client })
1265 }
1266
1267 fn as_channel(&self) -> &::fidl::AsyncChannel {
1268 self.client.as_channel()
1269 }
1270}
1271
1272impl RecordCancelerProxy {
1273 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1275 let protocol_name = <RecordCancelerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1276 Self { client: fidl::client::Client::new(channel, protocol_name) }
1277 }
1278
1279 pub fn take_event_stream(&self) -> RecordCancelerEventStream {
1285 RecordCancelerEventStream { event_receiver: self.client.take_event_receiver() }
1286 }
1287
1288 pub fn r#cancel(
1290 &self,
1291 ) -> fidl::client::QueryResponseFut<
1292 RecordCancelerCancelResult,
1293 fidl::encoding::DefaultFuchsiaResourceDialect,
1294 > {
1295 RecordCancelerProxyInterface::r#cancel(self)
1296 }
1297}
1298
1299impl RecordCancelerProxyInterface for RecordCancelerProxy {
1300 type CancelResponseFut = fidl::client::QueryResponseFut<
1301 RecordCancelerCancelResult,
1302 fidl::encoding::DefaultFuchsiaResourceDialect,
1303 >;
1304 fn r#cancel(&self) -> Self::CancelResponseFut {
1305 fn _decode(
1306 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1307 ) -> Result<RecordCancelerCancelResult, fidl::Error> {
1308 let _response = fidl::client::decode_transaction_body::<
1309 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1310 fidl::encoding::DefaultFuchsiaResourceDialect,
1311 0x5ea52b81e366daf6,
1312 >(_buf?)?;
1313 Ok(_response.map(|x| x))
1314 }
1315 self.client
1316 .send_query_and_decode::<fidl::encoding::EmptyPayload, RecordCancelerCancelResult>(
1317 (),
1318 0x5ea52b81e366daf6,
1319 fidl::encoding::DynamicFlags::empty(),
1320 _decode,
1321 )
1322 }
1323}
1324
1325pub struct RecordCancelerEventStream {
1326 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1327}
1328
1329impl std::marker::Unpin for RecordCancelerEventStream {}
1330
1331impl futures::stream::FusedStream for RecordCancelerEventStream {
1332 fn is_terminated(&self) -> bool {
1333 self.event_receiver.is_terminated()
1334 }
1335}
1336
1337impl futures::Stream for RecordCancelerEventStream {
1338 type Item = Result<RecordCancelerEvent, fidl::Error>;
1339
1340 fn poll_next(
1341 mut self: std::pin::Pin<&mut Self>,
1342 cx: &mut std::task::Context<'_>,
1343 ) -> std::task::Poll<Option<Self::Item>> {
1344 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1345 &mut self.event_receiver,
1346 cx
1347 )?) {
1348 Some(buf) => std::task::Poll::Ready(Some(RecordCancelerEvent::decode(buf))),
1349 None => std::task::Poll::Ready(None),
1350 }
1351 }
1352}
1353
1354#[derive(Debug)]
1355pub enum RecordCancelerEvent {
1356 #[non_exhaustive]
1357 _UnknownEvent {
1358 ordinal: u64,
1360 },
1361}
1362
1363impl RecordCancelerEvent {
1364 fn decode(
1366 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1367 ) -> Result<RecordCancelerEvent, fidl::Error> {
1368 let (bytes, _handles) = buf.split_mut();
1369 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1370 debug_assert_eq!(tx_header.tx_id, 0);
1371 match tx_header.ordinal {
1372 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1373 Ok(RecordCancelerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1374 }
1375 _ => Err(fidl::Error::UnknownOrdinal {
1376 ordinal: tx_header.ordinal,
1377 protocol_name:
1378 <RecordCancelerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1379 }),
1380 }
1381 }
1382}
1383
1384pub struct RecordCancelerRequestStream {
1386 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1387 is_terminated: bool,
1388}
1389
1390impl std::marker::Unpin for RecordCancelerRequestStream {}
1391
1392impl futures::stream::FusedStream for RecordCancelerRequestStream {
1393 fn is_terminated(&self) -> bool {
1394 self.is_terminated
1395 }
1396}
1397
1398impl fidl::endpoints::RequestStream for RecordCancelerRequestStream {
1399 type Protocol = RecordCancelerMarker;
1400 type ControlHandle = RecordCancelerControlHandle;
1401
1402 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1403 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1404 }
1405
1406 fn control_handle(&self) -> Self::ControlHandle {
1407 RecordCancelerControlHandle { inner: self.inner.clone() }
1408 }
1409
1410 fn into_inner(
1411 self,
1412 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1413 {
1414 (self.inner, self.is_terminated)
1415 }
1416
1417 fn from_inner(
1418 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1419 is_terminated: bool,
1420 ) -> Self {
1421 Self { inner, is_terminated }
1422 }
1423}
1424
1425impl futures::Stream for RecordCancelerRequestStream {
1426 type Item = Result<RecordCancelerRequest, fidl::Error>;
1427
1428 fn poll_next(
1429 mut self: std::pin::Pin<&mut Self>,
1430 cx: &mut std::task::Context<'_>,
1431 ) -> std::task::Poll<Option<Self::Item>> {
1432 let this = &mut *self;
1433 if this.inner.check_shutdown(cx) {
1434 this.is_terminated = true;
1435 return std::task::Poll::Ready(None);
1436 }
1437 if this.is_terminated {
1438 panic!("polled RecordCancelerRequestStream after completion");
1439 }
1440 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1441 |bytes, handles| {
1442 match this.inner.channel().read_etc(cx, bytes, handles) {
1443 std::task::Poll::Ready(Ok(())) => {}
1444 std::task::Poll::Pending => return std::task::Poll::Pending,
1445 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1446 this.is_terminated = true;
1447 return std::task::Poll::Ready(None);
1448 }
1449 std::task::Poll::Ready(Err(e)) => {
1450 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1451 e.into(),
1452 ))))
1453 }
1454 }
1455
1456 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1458
1459 std::task::Poll::Ready(Some(match header.ordinal {
1460 0x5ea52b81e366daf6 => {
1461 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1462 let mut req = fidl::new_empty!(
1463 fidl::encoding::EmptyPayload,
1464 fidl::encoding::DefaultFuchsiaResourceDialect
1465 );
1466 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1467 let control_handle =
1468 RecordCancelerControlHandle { inner: this.inner.clone() };
1469 Ok(RecordCancelerRequest::Cancel {
1470 responder: RecordCancelerCancelResponder {
1471 control_handle: std::mem::ManuallyDrop::new(control_handle),
1472 tx_id: header.tx_id,
1473 },
1474 })
1475 }
1476 _ if header.tx_id == 0
1477 && header
1478 .dynamic_flags()
1479 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1480 {
1481 Ok(RecordCancelerRequest::_UnknownMethod {
1482 ordinal: header.ordinal,
1483 control_handle: RecordCancelerControlHandle {
1484 inner: this.inner.clone(),
1485 },
1486 method_type: fidl::MethodType::OneWay,
1487 })
1488 }
1489 _ if header
1490 .dynamic_flags()
1491 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1492 {
1493 this.inner.send_framework_err(
1494 fidl::encoding::FrameworkErr::UnknownMethod,
1495 header.tx_id,
1496 header.ordinal,
1497 header.dynamic_flags(),
1498 (bytes, handles),
1499 )?;
1500 Ok(RecordCancelerRequest::_UnknownMethod {
1501 ordinal: header.ordinal,
1502 control_handle: RecordCancelerControlHandle {
1503 inner: this.inner.clone(),
1504 },
1505 method_type: fidl::MethodType::TwoWay,
1506 })
1507 }
1508 _ => Err(fidl::Error::UnknownOrdinal {
1509 ordinal: header.ordinal,
1510 protocol_name:
1511 <RecordCancelerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1512 }),
1513 }))
1514 },
1515 )
1516 }
1517}
1518
1519#[derive(Debug)]
1521pub enum RecordCancelerRequest {
1522 Cancel { responder: RecordCancelerCancelResponder },
1524 #[non_exhaustive]
1526 _UnknownMethod {
1527 ordinal: u64,
1529 control_handle: RecordCancelerControlHandle,
1530 method_type: fidl::MethodType,
1531 },
1532}
1533
1534impl RecordCancelerRequest {
1535 #[allow(irrefutable_let_patterns)]
1536 pub fn into_cancel(self) -> Option<(RecordCancelerCancelResponder)> {
1537 if let RecordCancelerRequest::Cancel { responder } = self {
1538 Some((responder))
1539 } else {
1540 None
1541 }
1542 }
1543
1544 pub fn method_name(&self) -> &'static str {
1546 match *self {
1547 RecordCancelerRequest::Cancel { .. } => "cancel",
1548 RecordCancelerRequest::_UnknownMethod {
1549 method_type: fidl::MethodType::OneWay, ..
1550 } => "unknown one-way method",
1551 RecordCancelerRequest::_UnknownMethod {
1552 method_type: fidl::MethodType::TwoWay, ..
1553 } => "unknown two-way method",
1554 }
1555 }
1556}
1557
1558#[derive(Debug, Clone)]
1559pub struct RecordCancelerControlHandle {
1560 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1561}
1562
1563impl fidl::endpoints::ControlHandle for RecordCancelerControlHandle {
1564 fn shutdown(&self) {
1565 self.inner.shutdown()
1566 }
1567 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1568 self.inner.shutdown_with_epitaph(status)
1569 }
1570
1571 fn is_closed(&self) -> bool {
1572 self.inner.channel().is_closed()
1573 }
1574 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1575 self.inner.channel().on_closed()
1576 }
1577
1578 #[cfg(target_os = "fuchsia")]
1579 fn signal_peer(
1580 &self,
1581 clear_mask: zx::Signals,
1582 set_mask: zx::Signals,
1583 ) -> Result<(), zx_status::Status> {
1584 use fidl::Peered;
1585 self.inner.channel().signal_peer(clear_mask, set_mask)
1586 }
1587}
1588
1589impl RecordCancelerControlHandle {}
1590
1591#[must_use = "FIDL methods require a response to be sent"]
1592#[derive(Debug)]
1593pub struct RecordCancelerCancelResponder {
1594 control_handle: std::mem::ManuallyDrop<RecordCancelerControlHandle>,
1595 tx_id: u32,
1596}
1597
1598impl std::ops::Drop for RecordCancelerCancelResponder {
1602 fn drop(&mut self) {
1603 self.control_handle.shutdown();
1604 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1606 }
1607}
1608
1609impl fidl::endpoints::Responder for RecordCancelerCancelResponder {
1610 type ControlHandle = RecordCancelerControlHandle;
1611
1612 fn control_handle(&self) -> &RecordCancelerControlHandle {
1613 &self.control_handle
1614 }
1615
1616 fn drop_without_shutdown(mut self) {
1617 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1619 std::mem::forget(self);
1621 }
1622}
1623
1624impl RecordCancelerCancelResponder {
1625 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1629 let _result = self.send_raw(result);
1630 if _result.is_err() {
1631 self.control_handle.shutdown();
1632 }
1633 self.drop_without_shutdown();
1634 _result
1635 }
1636
1637 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1639 let _result = self.send_raw(result);
1640 self.drop_without_shutdown();
1641 _result
1642 }
1643
1644 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1645 self.control_handle
1646 .inner
1647 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1648 result,
1649 self.tx_id,
1650 0x5ea52b81e366daf6,
1651 fidl::encoding::DynamicFlags::empty(),
1652 )
1653 }
1654}
1655
1656#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1657pub struct RecorderMarker;
1658
1659impl fidl::endpoints::ProtocolMarker for RecorderMarker {
1660 type Proxy = RecorderProxy;
1661 type RequestStream = RecorderRequestStream;
1662 #[cfg(target_os = "fuchsia")]
1663 type SynchronousProxy = RecorderSynchronousProxy;
1664
1665 const DEBUG_NAME: &'static str = "fuchsia.audio.controller.Recorder";
1666}
1667impl fidl::endpoints::DiscoverableProtocolMarker for RecorderMarker {}
1668pub type RecorderRecordResult = Result<RecorderRecordResponse, Error>;
1669
1670pub trait RecorderProxyInterface: Send + Sync {
1671 type RecordResponseFut: std::future::Future<Output = Result<RecorderRecordResult, fidl::Error>>
1672 + Send;
1673 fn r#record(&self, payload: RecorderRecordRequest) -> Self::RecordResponseFut;
1674}
1675#[derive(Debug)]
1676#[cfg(target_os = "fuchsia")]
1677pub struct RecorderSynchronousProxy {
1678 client: fidl::client::sync::Client,
1679}
1680
1681#[cfg(target_os = "fuchsia")]
1682impl fidl::endpoints::SynchronousProxy for RecorderSynchronousProxy {
1683 type Proxy = RecorderProxy;
1684 type Protocol = RecorderMarker;
1685
1686 fn from_channel(inner: fidl::Channel) -> Self {
1687 Self::new(inner)
1688 }
1689
1690 fn into_channel(self) -> fidl::Channel {
1691 self.client.into_channel()
1692 }
1693
1694 fn as_channel(&self) -> &fidl::Channel {
1695 self.client.as_channel()
1696 }
1697}
1698
1699#[cfg(target_os = "fuchsia")]
1700impl RecorderSynchronousProxy {
1701 pub fn new(channel: fidl::Channel) -> Self {
1702 let protocol_name = <RecorderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1703 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1704 }
1705
1706 pub fn into_channel(self) -> fidl::Channel {
1707 self.client.into_channel()
1708 }
1709
1710 pub fn wait_for_event(
1713 &self,
1714 deadline: zx::MonotonicInstant,
1715 ) -> Result<RecorderEvent, fidl::Error> {
1716 RecorderEvent::decode(self.client.wait_for_event(deadline)?)
1717 }
1718
1719 pub fn r#record(
1721 &self,
1722 mut payload: RecorderRecordRequest,
1723 ___deadline: zx::MonotonicInstant,
1724 ) -> Result<RecorderRecordResult, fidl::Error> {
1725 let _response = self.client.send_query::<
1726 RecorderRecordRequest,
1727 fidl::encoding::FlexibleResultType<RecorderRecordResponse, Error>,
1728 >(
1729 &mut payload,
1730 0x47cabcb60b2c8ca7,
1731 fidl::encoding::DynamicFlags::FLEXIBLE,
1732 ___deadline,
1733 )?
1734 .into_result::<RecorderMarker>("record")?;
1735 Ok(_response.map(|x| x))
1736 }
1737}
1738
1739#[cfg(target_os = "fuchsia")]
1740impl From<RecorderSynchronousProxy> for zx::Handle {
1741 fn from(value: RecorderSynchronousProxy) -> Self {
1742 value.into_channel().into()
1743 }
1744}
1745
1746#[cfg(target_os = "fuchsia")]
1747impl From<fidl::Channel> for RecorderSynchronousProxy {
1748 fn from(value: fidl::Channel) -> Self {
1749 Self::new(value)
1750 }
1751}
1752
1753#[derive(Debug, Clone)]
1754pub struct RecorderProxy {
1755 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1756}
1757
1758impl fidl::endpoints::Proxy for RecorderProxy {
1759 type Protocol = RecorderMarker;
1760
1761 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1762 Self::new(inner)
1763 }
1764
1765 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1766 self.client.into_channel().map_err(|client| Self { client })
1767 }
1768
1769 fn as_channel(&self) -> &::fidl::AsyncChannel {
1770 self.client.as_channel()
1771 }
1772}
1773
1774impl RecorderProxy {
1775 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1777 let protocol_name = <RecorderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1778 Self { client: fidl::client::Client::new(channel, protocol_name) }
1779 }
1780
1781 pub fn take_event_stream(&self) -> RecorderEventStream {
1787 RecorderEventStream { event_receiver: self.client.take_event_receiver() }
1788 }
1789
1790 pub fn r#record(
1792 &self,
1793 mut payload: RecorderRecordRequest,
1794 ) -> fidl::client::QueryResponseFut<
1795 RecorderRecordResult,
1796 fidl::encoding::DefaultFuchsiaResourceDialect,
1797 > {
1798 RecorderProxyInterface::r#record(self, payload)
1799 }
1800}
1801
1802impl RecorderProxyInterface for RecorderProxy {
1803 type RecordResponseFut = fidl::client::QueryResponseFut<
1804 RecorderRecordResult,
1805 fidl::encoding::DefaultFuchsiaResourceDialect,
1806 >;
1807 fn r#record(&self, mut payload: RecorderRecordRequest) -> Self::RecordResponseFut {
1808 fn _decode(
1809 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1810 ) -> Result<RecorderRecordResult, fidl::Error> {
1811 let _response = fidl::client::decode_transaction_body::<
1812 fidl::encoding::FlexibleResultType<RecorderRecordResponse, Error>,
1813 fidl::encoding::DefaultFuchsiaResourceDialect,
1814 0x47cabcb60b2c8ca7,
1815 >(_buf?)?
1816 .into_result::<RecorderMarker>("record")?;
1817 Ok(_response.map(|x| x))
1818 }
1819 self.client.send_query_and_decode::<RecorderRecordRequest, RecorderRecordResult>(
1820 &mut payload,
1821 0x47cabcb60b2c8ca7,
1822 fidl::encoding::DynamicFlags::FLEXIBLE,
1823 _decode,
1824 )
1825 }
1826}
1827
1828pub struct RecorderEventStream {
1829 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1830}
1831
1832impl std::marker::Unpin for RecorderEventStream {}
1833
1834impl futures::stream::FusedStream for RecorderEventStream {
1835 fn is_terminated(&self) -> bool {
1836 self.event_receiver.is_terminated()
1837 }
1838}
1839
1840impl futures::Stream for RecorderEventStream {
1841 type Item = Result<RecorderEvent, fidl::Error>;
1842
1843 fn poll_next(
1844 mut self: std::pin::Pin<&mut Self>,
1845 cx: &mut std::task::Context<'_>,
1846 ) -> std::task::Poll<Option<Self::Item>> {
1847 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1848 &mut self.event_receiver,
1849 cx
1850 )?) {
1851 Some(buf) => std::task::Poll::Ready(Some(RecorderEvent::decode(buf))),
1852 None => std::task::Poll::Ready(None),
1853 }
1854 }
1855}
1856
1857#[derive(Debug)]
1858pub enum RecorderEvent {
1859 #[non_exhaustive]
1860 _UnknownEvent {
1861 ordinal: u64,
1863 },
1864}
1865
1866impl RecorderEvent {
1867 fn decode(
1869 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1870 ) -> Result<RecorderEvent, fidl::Error> {
1871 let (bytes, _handles) = buf.split_mut();
1872 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1873 debug_assert_eq!(tx_header.tx_id, 0);
1874 match tx_header.ordinal {
1875 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1876 Ok(RecorderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1877 }
1878 _ => Err(fidl::Error::UnknownOrdinal {
1879 ordinal: tx_header.ordinal,
1880 protocol_name: <RecorderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1881 }),
1882 }
1883 }
1884}
1885
1886pub struct RecorderRequestStream {
1888 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1889 is_terminated: bool,
1890}
1891
1892impl std::marker::Unpin for RecorderRequestStream {}
1893
1894impl futures::stream::FusedStream for RecorderRequestStream {
1895 fn is_terminated(&self) -> bool {
1896 self.is_terminated
1897 }
1898}
1899
1900impl fidl::endpoints::RequestStream for RecorderRequestStream {
1901 type Protocol = RecorderMarker;
1902 type ControlHandle = RecorderControlHandle;
1903
1904 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1905 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1906 }
1907
1908 fn control_handle(&self) -> Self::ControlHandle {
1909 RecorderControlHandle { inner: self.inner.clone() }
1910 }
1911
1912 fn into_inner(
1913 self,
1914 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1915 {
1916 (self.inner, self.is_terminated)
1917 }
1918
1919 fn from_inner(
1920 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1921 is_terminated: bool,
1922 ) -> Self {
1923 Self { inner, is_terminated }
1924 }
1925}
1926
1927impl futures::Stream for RecorderRequestStream {
1928 type Item = Result<RecorderRequest, fidl::Error>;
1929
1930 fn poll_next(
1931 mut self: std::pin::Pin<&mut Self>,
1932 cx: &mut std::task::Context<'_>,
1933 ) -> std::task::Poll<Option<Self::Item>> {
1934 let this = &mut *self;
1935 if this.inner.check_shutdown(cx) {
1936 this.is_terminated = true;
1937 return std::task::Poll::Ready(None);
1938 }
1939 if this.is_terminated {
1940 panic!("polled RecorderRequestStream after completion");
1941 }
1942 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1943 |bytes, handles| {
1944 match this.inner.channel().read_etc(cx, bytes, handles) {
1945 std::task::Poll::Ready(Ok(())) => {}
1946 std::task::Poll::Pending => return std::task::Poll::Pending,
1947 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1948 this.is_terminated = true;
1949 return std::task::Poll::Ready(None);
1950 }
1951 std::task::Poll::Ready(Err(e)) => {
1952 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1953 e.into(),
1954 ))))
1955 }
1956 }
1957
1958 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1960
1961 std::task::Poll::Ready(Some(match header.ordinal {
1962 0x47cabcb60b2c8ca7 => {
1963 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1964 let mut req = fidl::new_empty!(
1965 RecorderRecordRequest,
1966 fidl::encoding::DefaultFuchsiaResourceDialect
1967 );
1968 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RecorderRecordRequest>(&header, _body_bytes, handles, &mut req)?;
1969 let control_handle = RecorderControlHandle { inner: this.inner.clone() };
1970 Ok(RecorderRequest::Record {
1971 payload: req,
1972 responder: RecorderRecordResponder {
1973 control_handle: std::mem::ManuallyDrop::new(control_handle),
1974 tx_id: header.tx_id,
1975 },
1976 })
1977 }
1978 _ if header.tx_id == 0
1979 && header
1980 .dynamic_flags()
1981 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1982 {
1983 Ok(RecorderRequest::_UnknownMethod {
1984 ordinal: header.ordinal,
1985 control_handle: RecorderControlHandle { inner: this.inner.clone() },
1986 method_type: fidl::MethodType::OneWay,
1987 })
1988 }
1989 _ if header
1990 .dynamic_flags()
1991 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1992 {
1993 this.inner.send_framework_err(
1994 fidl::encoding::FrameworkErr::UnknownMethod,
1995 header.tx_id,
1996 header.ordinal,
1997 header.dynamic_flags(),
1998 (bytes, handles),
1999 )?;
2000 Ok(RecorderRequest::_UnknownMethod {
2001 ordinal: header.ordinal,
2002 control_handle: RecorderControlHandle { inner: this.inner.clone() },
2003 method_type: fidl::MethodType::TwoWay,
2004 })
2005 }
2006 _ => Err(fidl::Error::UnknownOrdinal {
2007 ordinal: header.ordinal,
2008 protocol_name:
2009 <RecorderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2010 }),
2011 }))
2012 },
2013 )
2014 }
2015}
2016
2017#[derive(Debug)]
2018pub enum RecorderRequest {
2019 Record { payload: RecorderRecordRequest, responder: RecorderRecordResponder },
2021 #[non_exhaustive]
2023 _UnknownMethod {
2024 ordinal: u64,
2026 control_handle: RecorderControlHandle,
2027 method_type: fidl::MethodType,
2028 },
2029}
2030
2031impl RecorderRequest {
2032 #[allow(irrefutable_let_patterns)]
2033 pub fn into_record(self) -> Option<(RecorderRecordRequest, RecorderRecordResponder)> {
2034 if let RecorderRequest::Record { payload, responder } = self {
2035 Some((payload, responder))
2036 } else {
2037 None
2038 }
2039 }
2040
2041 pub fn method_name(&self) -> &'static str {
2043 match *self {
2044 RecorderRequest::Record { .. } => "record",
2045 RecorderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2046 "unknown one-way method"
2047 }
2048 RecorderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2049 "unknown two-way method"
2050 }
2051 }
2052 }
2053}
2054
2055#[derive(Debug, Clone)]
2056pub struct RecorderControlHandle {
2057 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2058}
2059
2060impl fidl::endpoints::ControlHandle for RecorderControlHandle {
2061 fn shutdown(&self) {
2062 self.inner.shutdown()
2063 }
2064 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2065 self.inner.shutdown_with_epitaph(status)
2066 }
2067
2068 fn is_closed(&self) -> bool {
2069 self.inner.channel().is_closed()
2070 }
2071 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2072 self.inner.channel().on_closed()
2073 }
2074
2075 #[cfg(target_os = "fuchsia")]
2076 fn signal_peer(
2077 &self,
2078 clear_mask: zx::Signals,
2079 set_mask: zx::Signals,
2080 ) -> Result<(), zx_status::Status> {
2081 use fidl::Peered;
2082 self.inner.channel().signal_peer(clear_mask, set_mask)
2083 }
2084}
2085
2086impl RecorderControlHandle {}
2087
2088#[must_use = "FIDL methods require a response to be sent"]
2089#[derive(Debug)]
2090pub struct RecorderRecordResponder {
2091 control_handle: std::mem::ManuallyDrop<RecorderControlHandle>,
2092 tx_id: u32,
2093}
2094
2095impl std::ops::Drop for RecorderRecordResponder {
2099 fn drop(&mut self) {
2100 self.control_handle.shutdown();
2101 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2103 }
2104}
2105
2106impl fidl::endpoints::Responder for RecorderRecordResponder {
2107 type ControlHandle = RecorderControlHandle;
2108
2109 fn control_handle(&self) -> &RecorderControlHandle {
2110 &self.control_handle
2111 }
2112
2113 fn drop_without_shutdown(mut self) {
2114 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2116 std::mem::forget(self);
2118 }
2119}
2120
2121impl RecorderRecordResponder {
2122 pub fn send(
2126 self,
2127 mut result: Result<RecorderRecordResponse, Error>,
2128 ) -> Result<(), fidl::Error> {
2129 let _result = self.send_raw(result);
2130 if _result.is_err() {
2131 self.control_handle.shutdown();
2132 }
2133 self.drop_without_shutdown();
2134 _result
2135 }
2136
2137 pub fn send_no_shutdown_on_err(
2139 self,
2140 mut result: Result<RecorderRecordResponse, Error>,
2141 ) -> Result<(), fidl::Error> {
2142 let _result = self.send_raw(result);
2143 self.drop_without_shutdown();
2144 _result
2145 }
2146
2147 fn send_raw(
2148 &self,
2149 mut result: Result<RecorderRecordResponse, Error>,
2150 ) -> Result<(), fidl::Error> {
2151 self.control_handle
2152 .inner
2153 .send::<fidl::encoding::FlexibleResultType<RecorderRecordResponse, Error>>(
2154 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
2155 self.tx_id,
2156 0x47cabcb60b2c8ca7,
2157 fidl::encoding::DynamicFlags::FLEXIBLE,
2158 )
2159 }
2160}
2161
2162mod internal {
2163 use super::*;
2164
2165 impl DeviceControlDeviceSetGainStateRequest {
2166 #[inline(always)]
2167 fn max_ordinal_present(&self) -> u64 {
2168 if let Some(_) = self.gain_state {
2169 return 2;
2170 }
2171 if let Some(_) = self.device {
2172 return 1;
2173 }
2174 0
2175 }
2176 }
2177
2178 impl fidl::encoding::ResourceTypeMarker for DeviceControlDeviceSetGainStateRequest {
2179 type Borrowed<'a> = &'a mut Self;
2180 fn take_or_borrow<'a>(
2181 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2182 ) -> Self::Borrowed<'a> {
2183 value
2184 }
2185 }
2186
2187 unsafe impl fidl::encoding::TypeMarker for DeviceControlDeviceSetGainStateRequest {
2188 type Owned = Self;
2189
2190 #[inline(always)]
2191 fn inline_align(_context: fidl::encoding::Context) -> usize {
2192 8
2193 }
2194
2195 #[inline(always)]
2196 fn inline_size(_context: fidl::encoding::Context) -> usize {
2197 16
2198 }
2199 }
2200
2201 unsafe impl
2202 fidl::encoding::Encode<
2203 DeviceControlDeviceSetGainStateRequest,
2204 fidl::encoding::DefaultFuchsiaResourceDialect,
2205 > for &mut DeviceControlDeviceSetGainStateRequest
2206 {
2207 unsafe fn encode(
2208 self,
2209 encoder: &mut fidl::encoding::Encoder<
2210 '_,
2211 fidl::encoding::DefaultFuchsiaResourceDialect,
2212 >,
2213 offset: usize,
2214 mut depth: fidl::encoding::Depth,
2215 ) -> fidl::Result<()> {
2216 encoder.debug_check_bounds::<DeviceControlDeviceSetGainStateRequest>(offset);
2217 let max_ordinal: u64 = self.max_ordinal_present();
2219 encoder.write_num(max_ordinal, offset);
2220 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2221 if max_ordinal == 0 {
2223 return Ok(());
2224 }
2225 depth.increment()?;
2226 let envelope_size = 8;
2227 let bytes_len = max_ordinal as usize * envelope_size;
2228 #[allow(unused_variables)]
2229 let offset = encoder.out_of_line_offset(bytes_len);
2230 let mut _prev_end_offset: usize = 0;
2231 if 1 > max_ordinal {
2232 return Ok(());
2233 }
2234
2235 let cur_offset: usize = (1 - 1) * envelope_size;
2238
2239 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2241
2242 fidl::encoding::encode_in_envelope_optional::<
2247 DeviceSelector,
2248 fidl::encoding::DefaultFuchsiaResourceDialect,
2249 >(
2250 self.device
2251 .as_ref()
2252 .map(<DeviceSelector as fidl::encoding::ValueTypeMarker>::borrow),
2253 encoder,
2254 offset + cur_offset,
2255 depth,
2256 )?;
2257
2258 _prev_end_offset = cur_offset + envelope_size;
2259 if 2 > max_ordinal {
2260 return Ok(());
2261 }
2262
2263 let cur_offset: usize = (2 - 1) * envelope_size;
2266
2267 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2269
2270 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_hardware_audio::GainState, fidl::encoding::DefaultFuchsiaResourceDialect>(
2275 self.gain_state.as_ref().map(<fidl_fuchsia_hardware_audio::GainState as fidl::encoding::ValueTypeMarker>::borrow),
2276 encoder, offset + cur_offset, depth
2277 )?;
2278
2279 _prev_end_offset = cur_offset + envelope_size;
2280
2281 Ok(())
2282 }
2283 }
2284
2285 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2286 for DeviceControlDeviceSetGainStateRequest
2287 {
2288 #[inline(always)]
2289 fn new_empty() -> Self {
2290 Self::default()
2291 }
2292
2293 unsafe fn decode(
2294 &mut self,
2295 decoder: &mut fidl::encoding::Decoder<
2296 '_,
2297 fidl::encoding::DefaultFuchsiaResourceDialect,
2298 >,
2299 offset: usize,
2300 mut depth: fidl::encoding::Depth,
2301 ) -> fidl::Result<()> {
2302 decoder.debug_check_bounds::<Self>(offset);
2303 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2304 None => return Err(fidl::Error::NotNullable),
2305 Some(len) => len,
2306 };
2307 if len == 0 {
2309 return Ok(());
2310 };
2311 depth.increment()?;
2312 let envelope_size = 8;
2313 let bytes_len = len * envelope_size;
2314 let offset = decoder.out_of_line_offset(bytes_len)?;
2315 let mut _next_ordinal_to_read = 0;
2317 let mut next_offset = offset;
2318 let end_offset = offset + bytes_len;
2319 _next_ordinal_to_read += 1;
2320 if next_offset >= end_offset {
2321 return Ok(());
2322 }
2323
2324 while _next_ordinal_to_read < 1 {
2326 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2327 _next_ordinal_to_read += 1;
2328 next_offset += envelope_size;
2329 }
2330
2331 let next_out_of_line = decoder.next_out_of_line();
2332 let handles_before = decoder.remaining_handles();
2333 if let Some((inlined, num_bytes, num_handles)) =
2334 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2335 {
2336 let member_inline_size =
2337 <DeviceSelector as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2338 if inlined != (member_inline_size <= 4) {
2339 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2340 }
2341 let inner_offset;
2342 let mut inner_depth = depth.clone();
2343 if inlined {
2344 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2345 inner_offset = next_offset;
2346 } else {
2347 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2348 inner_depth.increment()?;
2349 }
2350 let val_ref = self.device.get_or_insert_with(|| {
2351 fidl::new_empty!(DeviceSelector, fidl::encoding::DefaultFuchsiaResourceDialect)
2352 });
2353 fidl::decode!(
2354 DeviceSelector,
2355 fidl::encoding::DefaultFuchsiaResourceDialect,
2356 val_ref,
2357 decoder,
2358 inner_offset,
2359 inner_depth
2360 )?;
2361 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2362 {
2363 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2364 }
2365 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2366 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2367 }
2368 }
2369
2370 next_offset += envelope_size;
2371 _next_ordinal_to_read += 1;
2372 if next_offset >= end_offset {
2373 return Ok(());
2374 }
2375
2376 while _next_ordinal_to_read < 2 {
2378 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2379 _next_ordinal_to_read += 1;
2380 next_offset += envelope_size;
2381 }
2382
2383 let next_out_of_line = decoder.next_out_of_line();
2384 let handles_before = decoder.remaining_handles();
2385 if let Some((inlined, num_bytes, num_handles)) =
2386 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2387 {
2388 let member_inline_size = <fidl_fuchsia_hardware_audio::GainState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2389 if inlined != (member_inline_size <= 4) {
2390 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2391 }
2392 let inner_offset;
2393 let mut inner_depth = depth.clone();
2394 if inlined {
2395 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2396 inner_offset = next_offset;
2397 } else {
2398 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2399 inner_depth.increment()?;
2400 }
2401 let val_ref = self.gain_state.get_or_insert_with(|| {
2402 fidl::new_empty!(
2403 fidl_fuchsia_hardware_audio::GainState,
2404 fidl::encoding::DefaultFuchsiaResourceDialect
2405 )
2406 });
2407 fidl::decode!(
2408 fidl_fuchsia_hardware_audio::GainState,
2409 fidl::encoding::DefaultFuchsiaResourceDialect,
2410 val_ref,
2411 decoder,
2412 inner_offset,
2413 inner_depth
2414 )?;
2415 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2416 {
2417 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2418 }
2419 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2420 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2421 }
2422 }
2423
2424 next_offset += envelope_size;
2425
2426 while next_offset < end_offset {
2428 _next_ordinal_to_read += 1;
2429 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2430 next_offset += envelope_size;
2431 }
2432
2433 Ok(())
2434 }
2435 }
2436
2437 impl PlayerPlayRequest {
2438 #[inline(always)]
2439 fn max_ordinal_present(&self) -> u64 {
2440 if let Some(_) = self.active_channels_bitmask {
2441 return 4;
2442 }
2443 if let Some(_) = self.gain_settings {
2444 return 3;
2445 }
2446 if let Some(_) = self.destination {
2447 return 2;
2448 }
2449 if let Some(_) = self.wav_source {
2450 return 1;
2451 }
2452 0
2453 }
2454 }
2455
2456 impl fidl::encoding::ResourceTypeMarker for PlayerPlayRequest {
2457 type Borrowed<'a> = &'a mut Self;
2458 fn take_or_borrow<'a>(
2459 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2460 ) -> Self::Borrowed<'a> {
2461 value
2462 }
2463 }
2464
2465 unsafe impl fidl::encoding::TypeMarker for PlayerPlayRequest {
2466 type Owned = Self;
2467
2468 #[inline(always)]
2469 fn inline_align(_context: fidl::encoding::Context) -> usize {
2470 8
2471 }
2472
2473 #[inline(always)]
2474 fn inline_size(_context: fidl::encoding::Context) -> usize {
2475 16
2476 }
2477 }
2478
2479 unsafe impl
2480 fidl::encoding::Encode<PlayerPlayRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2481 for &mut PlayerPlayRequest
2482 {
2483 unsafe fn encode(
2484 self,
2485 encoder: &mut fidl::encoding::Encoder<
2486 '_,
2487 fidl::encoding::DefaultFuchsiaResourceDialect,
2488 >,
2489 offset: usize,
2490 mut depth: fidl::encoding::Depth,
2491 ) -> fidl::Result<()> {
2492 encoder.debug_check_bounds::<PlayerPlayRequest>(offset);
2493 let max_ordinal: u64 = self.max_ordinal_present();
2495 encoder.write_num(max_ordinal, offset);
2496 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2497 if max_ordinal == 0 {
2499 return Ok(());
2500 }
2501 depth.increment()?;
2502 let envelope_size = 8;
2503 let bytes_len = max_ordinal as usize * envelope_size;
2504 #[allow(unused_variables)]
2505 let offset = encoder.out_of_line_offset(bytes_len);
2506 let mut _prev_end_offset: usize = 0;
2507 if 1 > max_ordinal {
2508 return Ok(());
2509 }
2510
2511 let cur_offset: usize = (1 - 1) * envelope_size;
2514
2515 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2517
2518 fidl::encoding::encode_in_envelope_optional::<
2523 fidl::encoding::HandleType<
2524 fidl::Socket,
2525 { fidl::ObjectType::SOCKET.into_raw() },
2526 16389,
2527 >,
2528 fidl::encoding::DefaultFuchsiaResourceDialect,
2529 >(
2530 self.wav_source.as_mut().map(
2531 <fidl::encoding::HandleType<
2532 fidl::Socket,
2533 { fidl::ObjectType::SOCKET.into_raw() },
2534 16389,
2535 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2536 ),
2537 encoder,
2538 offset + cur_offset,
2539 depth,
2540 )?;
2541
2542 _prev_end_offset = cur_offset + envelope_size;
2543 if 2 > max_ordinal {
2544 return Ok(());
2545 }
2546
2547 let cur_offset: usize = (2 - 1) * envelope_size;
2550
2551 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2553
2554 fidl::encoding::encode_in_envelope_optional::<
2559 PlayDestination,
2560 fidl::encoding::DefaultFuchsiaResourceDialect,
2561 >(
2562 self.destination
2563 .as_ref()
2564 .map(<PlayDestination as fidl::encoding::ValueTypeMarker>::borrow),
2565 encoder,
2566 offset + cur_offset,
2567 depth,
2568 )?;
2569
2570 _prev_end_offset = cur_offset + envelope_size;
2571 if 3 > max_ordinal {
2572 return Ok(());
2573 }
2574
2575 let cur_offset: usize = (3 - 1) * envelope_size;
2578
2579 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2581
2582 fidl::encoding::encode_in_envelope_optional::<
2587 GainSettings,
2588 fidl::encoding::DefaultFuchsiaResourceDialect,
2589 >(
2590 self.gain_settings
2591 .as_ref()
2592 .map(<GainSettings as fidl::encoding::ValueTypeMarker>::borrow),
2593 encoder,
2594 offset + cur_offset,
2595 depth,
2596 )?;
2597
2598 _prev_end_offset = cur_offset + envelope_size;
2599 if 4 > max_ordinal {
2600 return Ok(());
2601 }
2602
2603 let cur_offset: usize = (4 - 1) * envelope_size;
2606
2607 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2609
2610 fidl::encoding::encode_in_envelope_optional::<
2615 u64,
2616 fidl::encoding::DefaultFuchsiaResourceDialect,
2617 >(
2618 self.active_channels_bitmask
2619 .as_ref()
2620 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2621 encoder,
2622 offset + cur_offset,
2623 depth,
2624 )?;
2625
2626 _prev_end_offset = cur_offset + envelope_size;
2627
2628 Ok(())
2629 }
2630 }
2631
2632 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2633 for PlayerPlayRequest
2634 {
2635 #[inline(always)]
2636 fn new_empty() -> Self {
2637 Self::default()
2638 }
2639
2640 unsafe fn decode(
2641 &mut self,
2642 decoder: &mut fidl::encoding::Decoder<
2643 '_,
2644 fidl::encoding::DefaultFuchsiaResourceDialect,
2645 >,
2646 offset: usize,
2647 mut depth: fidl::encoding::Depth,
2648 ) -> fidl::Result<()> {
2649 decoder.debug_check_bounds::<Self>(offset);
2650 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2651 None => return Err(fidl::Error::NotNullable),
2652 Some(len) => len,
2653 };
2654 if len == 0 {
2656 return Ok(());
2657 };
2658 depth.increment()?;
2659 let envelope_size = 8;
2660 let bytes_len = len * envelope_size;
2661 let offset = decoder.out_of_line_offset(bytes_len)?;
2662 let mut _next_ordinal_to_read = 0;
2664 let mut next_offset = offset;
2665 let end_offset = offset + bytes_len;
2666 _next_ordinal_to_read += 1;
2667 if next_offset >= end_offset {
2668 return Ok(());
2669 }
2670
2671 while _next_ordinal_to_read < 1 {
2673 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2674 _next_ordinal_to_read += 1;
2675 next_offset += envelope_size;
2676 }
2677
2678 let next_out_of_line = decoder.next_out_of_line();
2679 let handles_before = decoder.remaining_handles();
2680 if let Some((inlined, num_bytes, num_handles)) =
2681 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2682 {
2683 let member_inline_size = <fidl::encoding::HandleType<
2684 fidl::Socket,
2685 { fidl::ObjectType::SOCKET.into_raw() },
2686 16389,
2687 > as fidl::encoding::TypeMarker>::inline_size(
2688 decoder.context
2689 );
2690 if inlined != (member_inline_size <= 4) {
2691 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2692 }
2693 let inner_offset;
2694 let mut inner_depth = depth.clone();
2695 if inlined {
2696 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2697 inner_offset = next_offset;
2698 } else {
2699 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2700 inner_depth.increment()?;
2701 }
2702 let val_ref =
2703 self.wav_source.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16389>, fidl::encoding::DefaultFuchsiaResourceDialect));
2704 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16389>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2705 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2706 {
2707 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2708 }
2709 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2710 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2711 }
2712 }
2713
2714 next_offset += envelope_size;
2715 _next_ordinal_to_read += 1;
2716 if next_offset >= end_offset {
2717 return Ok(());
2718 }
2719
2720 while _next_ordinal_to_read < 2 {
2722 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2723 _next_ordinal_to_read += 1;
2724 next_offset += envelope_size;
2725 }
2726
2727 let next_out_of_line = decoder.next_out_of_line();
2728 let handles_before = decoder.remaining_handles();
2729 if let Some((inlined, num_bytes, num_handles)) =
2730 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2731 {
2732 let member_inline_size =
2733 <PlayDestination as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2734 if inlined != (member_inline_size <= 4) {
2735 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2736 }
2737 let inner_offset;
2738 let mut inner_depth = depth.clone();
2739 if inlined {
2740 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2741 inner_offset = next_offset;
2742 } else {
2743 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2744 inner_depth.increment()?;
2745 }
2746 let val_ref = self.destination.get_or_insert_with(|| {
2747 fidl::new_empty!(PlayDestination, fidl::encoding::DefaultFuchsiaResourceDialect)
2748 });
2749 fidl::decode!(
2750 PlayDestination,
2751 fidl::encoding::DefaultFuchsiaResourceDialect,
2752 val_ref,
2753 decoder,
2754 inner_offset,
2755 inner_depth
2756 )?;
2757 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2758 {
2759 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2760 }
2761 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2762 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2763 }
2764 }
2765
2766 next_offset += envelope_size;
2767 _next_ordinal_to_read += 1;
2768 if next_offset >= end_offset {
2769 return Ok(());
2770 }
2771
2772 while _next_ordinal_to_read < 3 {
2774 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2775 _next_ordinal_to_read += 1;
2776 next_offset += envelope_size;
2777 }
2778
2779 let next_out_of_line = decoder.next_out_of_line();
2780 let handles_before = decoder.remaining_handles();
2781 if let Some((inlined, num_bytes, num_handles)) =
2782 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2783 {
2784 let member_inline_size =
2785 <GainSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2786 if inlined != (member_inline_size <= 4) {
2787 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2788 }
2789 let inner_offset;
2790 let mut inner_depth = depth.clone();
2791 if inlined {
2792 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2793 inner_offset = next_offset;
2794 } else {
2795 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2796 inner_depth.increment()?;
2797 }
2798 let val_ref = self.gain_settings.get_or_insert_with(|| {
2799 fidl::new_empty!(GainSettings, fidl::encoding::DefaultFuchsiaResourceDialect)
2800 });
2801 fidl::decode!(
2802 GainSettings,
2803 fidl::encoding::DefaultFuchsiaResourceDialect,
2804 val_ref,
2805 decoder,
2806 inner_offset,
2807 inner_depth
2808 )?;
2809 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2810 {
2811 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2812 }
2813 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2814 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2815 }
2816 }
2817
2818 next_offset += envelope_size;
2819 _next_ordinal_to_read += 1;
2820 if next_offset >= end_offset {
2821 return Ok(());
2822 }
2823
2824 while _next_ordinal_to_read < 4 {
2826 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2827 _next_ordinal_to_read += 1;
2828 next_offset += envelope_size;
2829 }
2830
2831 let next_out_of_line = decoder.next_out_of_line();
2832 let handles_before = decoder.remaining_handles();
2833 if let Some((inlined, num_bytes, num_handles)) =
2834 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2835 {
2836 let member_inline_size =
2837 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2838 if inlined != (member_inline_size <= 4) {
2839 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2840 }
2841 let inner_offset;
2842 let mut inner_depth = depth.clone();
2843 if inlined {
2844 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2845 inner_offset = next_offset;
2846 } else {
2847 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2848 inner_depth.increment()?;
2849 }
2850 let val_ref = self.active_channels_bitmask.get_or_insert_with(|| {
2851 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2852 });
2853 fidl::decode!(
2854 u64,
2855 fidl::encoding::DefaultFuchsiaResourceDialect,
2856 val_ref,
2857 decoder,
2858 inner_offset,
2859 inner_depth
2860 )?;
2861 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2862 {
2863 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2864 }
2865 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2866 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2867 }
2868 }
2869
2870 next_offset += envelope_size;
2871
2872 while next_offset < end_offset {
2874 _next_ordinal_to_read += 1;
2875 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2876 next_offset += envelope_size;
2877 }
2878
2879 Ok(())
2880 }
2881 }
2882
2883 impl PlayerPlayResponse {
2884 #[inline(always)]
2885 fn max_ordinal_present(&self) -> u64 {
2886 if let Some(_) = self.bytes_processed {
2887 return 1;
2888 }
2889 0
2890 }
2891 }
2892
2893 impl fidl::encoding::ResourceTypeMarker for PlayerPlayResponse {
2894 type Borrowed<'a> = &'a mut Self;
2895 fn take_or_borrow<'a>(
2896 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2897 ) -> Self::Borrowed<'a> {
2898 value
2899 }
2900 }
2901
2902 unsafe impl fidl::encoding::TypeMarker for PlayerPlayResponse {
2903 type Owned = Self;
2904
2905 #[inline(always)]
2906 fn inline_align(_context: fidl::encoding::Context) -> usize {
2907 8
2908 }
2909
2910 #[inline(always)]
2911 fn inline_size(_context: fidl::encoding::Context) -> usize {
2912 16
2913 }
2914 }
2915
2916 unsafe impl
2917 fidl::encoding::Encode<PlayerPlayResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
2918 for &mut PlayerPlayResponse
2919 {
2920 unsafe fn encode(
2921 self,
2922 encoder: &mut fidl::encoding::Encoder<
2923 '_,
2924 fidl::encoding::DefaultFuchsiaResourceDialect,
2925 >,
2926 offset: usize,
2927 mut depth: fidl::encoding::Depth,
2928 ) -> fidl::Result<()> {
2929 encoder.debug_check_bounds::<PlayerPlayResponse>(offset);
2930 let max_ordinal: u64 = self.max_ordinal_present();
2932 encoder.write_num(max_ordinal, offset);
2933 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2934 if max_ordinal == 0 {
2936 return Ok(());
2937 }
2938 depth.increment()?;
2939 let envelope_size = 8;
2940 let bytes_len = max_ordinal as usize * envelope_size;
2941 #[allow(unused_variables)]
2942 let offset = encoder.out_of_line_offset(bytes_len);
2943 let mut _prev_end_offset: usize = 0;
2944 if 1 > max_ordinal {
2945 return Ok(());
2946 }
2947
2948 let cur_offset: usize = (1 - 1) * envelope_size;
2951
2952 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2954
2955 fidl::encoding::encode_in_envelope_optional::<
2960 u64,
2961 fidl::encoding::DefaultFuchsiaResourceDialect,
2962 >(
2963 self.bytes_processed.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2964 encoder,
2965 offset + cur_offset,
2966 depth,
2967 )?;
2968
2969 _prev_end_offset = cur_offset + envelope_size;
2970
2971 Ok(())
2972 }
2973 }
2974
2975 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2976 for PlayerPlayResponse
2977 {
2978 #[inline(always)]
2979 fn new_empty() -> Self {
2980 Self::default()
2981 }
2982
2983 unsafe fn decode(
2984 &mut self,
2985 decoder: &mut fidl::encoding::Decoder<
2986 '_,
2987 fidl::encoding::DefaultFuchsiaResourceDialect,
2988 >,
2989 offset: usize,
2990 mut depth: fidl::encoding::Depth,
2991 ) -> fidl::Result<()> {
2992 decoder.debug_check_bounds::<Self>(offset);
2993 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2994 None => return Err(fidl::Error::NotNullable),
2995 Some(len) => len,
2996 };
2997 if len == 0 {
2999 return Ok(());
3000 };
3001 depth.increment()?;
3002 let envelope_size = 8;
3003 let bytes_len = len * envelope_size;
3004 let offset = decoder.out_of_line_offset(bytes_len)?;
3005 let mut _next_ordinal_to_read = 0;
3007 let mut next_offset = offset;
3008 let end_offset = offset + bytes_len;
3009 _next_ordinal_to_read += 1;
3010 if next_offset >= end_offset {
3011 return Ok(());
3012 }
3013
3014 while _next_ordinal_to_read < 1 {
3016 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3017 _next_ordinal_to_read += 1;
3018 next_offset += envelope_size;
3019 }
3020
3021 let next_out_of_line = decoder.next_out_of_line();
3022 let handles_before = decoder.remaining_handles();
3023 if let Some((inlined, num_bytes, num_handles)) =
3024 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3025 {
3026 let member_inline_size =
3027 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3028 if inlined != (member_inline_size <= 4) {
3029 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3030 }
3031 let inner_offset;
3032 let mut inner_depth = depth.clone();
3033 if inlined {
3034 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3035 inner_offset = next_offset;
3036 } else {
3037 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3038 inner_depth.increment()?;
3039 }
3040 let val_ref = self.bytes_processed.get_or_insert_with(|| {
3041 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3042 });
3043 fidl::decode!(
3044 u64,
3045 fidl::encoding::DefaultFuchsiaResourceDialect,
3046 val_ref,
3047 decoder,
3048 inner_offset,
3049 inner_depth
3050 )?;
3051 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3052 {
3053 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3054 }
3055 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3056 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3057 }
3058 }
3059
3060 next_offset += envelope_size;
3061
3062 while next_offset < end_offset {
3064 _next_ordinal_to_read += 1;
3065 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3066 next_offset += envelope_size;
3067 }
3068
3069 Ok(())
3070 }
3071 }
3072
3073 impl RecorderRecordRequest {
3074 #[inline(always)]
3075 fn max_ordinal_present(&self) -> u64 {
3076 if let Some(_) = self.wav_data {
3077 return 7;
3078 }
3079 if let Some(_) = self.buffer_size {
3080 return 6;
3081 }
3082 if let Some(_) = self.gain_settings {
3083 return 5;
3084 }
3085 if let Some(_) = self.canceler {
3086 return 4;
3087 }
3088 if let Some(_) = self.duration {
3089 return 3;
3090 }
3091 if let Some(_) = self.stream_type {
3092 return 2;
3093 }
3094 if let Some(_) = self.source {
3095 return 1;
3096 }
3097 0
3098 }
3099 }
3100
3101 impl fidl::encoding::ResourceTypeMarker for RecorderRecordRequest {
3102 type Borrowed<'a> = &'a mut Self;
3103 fn take_or_borrow<'a>(
3104 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3105 ) -> Self::Borrowed<'a> {
3106 value
3107 }
3108 }
3109
3110 unsafe impl fidl::encoding::TypeMarker for RecorderRecordRequest {
3111 type Owned = Self;
3112
3113 #[inline(always)]
3114 fn inline_align(_context: fidl::encoding::Context) -> usize {
3115 8
3116 }
3117
3118 #[inline(always)]
3119 fn inline_size(_context: fidl::encoding::Context) -> usize {
3120 16
3121 }
3122 }
3123
3124 unsafe impl
3125 fidl::encoding::Encode<RecorderRecordRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
3126 for &mut RecorderRecordRequest
3127 {
3128 unsafe fn encode(
3129 self,
3130 encoder: &mut fidl::encoding::Encoder<
3131 '_,
3132 fidl::encoding::DefaultFuchsiaResourceDialect,
3133 >,
3134 offset: usize,
3135 mut depth: fidl::encoding::Depth,
3136 ) -> fidl::Result<()> {
3137 encoder.debug_check_bounds::<RecorderRecordRequest>(offset);
3138 let max_ordinal: u64 = self.max_ordinal_present();
3140 encoder.write_num(max_ordinal, offset);
3141 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3142 if max_ordinal == 0 {
3144 return Ok(());
3145 }
3146 depth.increment()?;
3147 let envelope_size = 8;
3148 let bytes_len = max_ordinal as usize * envelope_size;
3149 #[allow(unused_variables)]
3150 let offset = encoder.out_of_line_offset(bytes_len);
3151 let mut _prev_end_offset: usize = 0;
3152 if 1 > max_ordinal {
3153 return Ok(());
3154 }
3155
3156 let cur_offset: usize = (1 - 1) * envelope_size;
3159
3160 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3162
3163 fidl::encoding::encode_in_envelope_optional::<
3168 RecordSource,
3169 fidl::encoding::DefaultFuchsiaResourceDialect,
3170 >(
3171 self.source.as_ref().map(<RecordSource as fidl::encoding::ValueTypeMarker>::borrow),
3172 encoder,
3173 offset + cur_offset,
3174 depth,
3175 )?;
3176
3177 _prev_end_offset = cur_offset + envelope_size;
3178 if 2 > max_ordinal {
3179 return Ok(());
3180 }
3181
3182 let cur_offset: usize = (2 - 1) * envelope_size;
3185
3186 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3188
3189 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::AudioStreamType, fidl::encoding::DefaultFuchsiaResourceDialect>(
3194 self.stream_type.as_ref().map(<fidl_fuchsia_media::AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow),
3195 encoder, offset + cur_offset, depth
3196 )?;
3197
3198 _prev_end_offset = cur_offset + envelope_size;
3199 if 3 > max_ordinal {
3200 return Ok(());
3201 }
3202
3203 let cur_offset: usize = (3 - 1) * envelope_size;
3206
3207 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3209
3210 fidl::encoding::encode_in_envelope_optional::<
3215 i64,
3216 fidl::encoding::DefaultFuchsiaResourceDialect,
3217 >(
3218 self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3219 encoder,
3220 offset + cur_offset,
3221 depth,
3222 )?;
3223
3224 _prev_end_offset = cur_offset + envelope_size;
3225 if 4 > max_ordinal {
3226 return Ok(());
3227 }
3228
3229 let cur_offset: usize = (4 - 1) * envelope_size;
3232
3233 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3235
3236 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RecordCancelerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3241 self.canceler.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RecordCancelerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
3242 encoder, offset + cur_offset, depth
3243 )?;
3244
3245 _prev_end_offset = cur_offset + envelope_size;
3246 if 5 > max_ordinal {
3247 return Ok(());
3248 }
3249
3250 let cur_offset: usize = (5 - 1) * envelope_size;
3253
3254 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3256
3257 fidl::encoding::encode_in_envelope_optional::<
3262 GainSettings,
3263 fidl::encoding::DefaultFuchsiaResourceDialect,
3264 >(
3265 self.gain_settings
3266 .as_ref()
3267 .map(<GainSettings as fidl::encoding::ValueTypeMarker>::borrow),
3268 encoder,
3269 offset + cur_offset,
3270 depth,
3271 )?;
3272
3273 _prev_end_offset = cur_offset + envelope_size;
3274 if 6 > max_ordinal {
3275 return Ok(());
3276 }
3277
3278 let cur_offset: usize = (6 - 1) * envelope_size;
3281
3282 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3284
3285 fidl::encoding::encode_in_envelope_optional::<
3290 u64,
3291 fidl::encoding::DefaultFuchsiaResourceDialect,
3292 >(
3293 self.buffer_size.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3294 encoder,
3295 offset + cur_offset,
3296 depth,
3297 )?;
3298
3299 _prev_end_offset = cur_offset + envelope_size;
3300 if 7 > max_ordinal {
3301 return Ok(());
3302 }
3303
3304 let cur_offset: usize = (7 - 1) * envelope_size;
3307
3308 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3310
3311 fidl::encoding::encode_in_envelope_optional::<
3316 fidl::encoding::HandleType<
3317 fidl::Socket,
3318 { fidl::ObjectType::SOCKET.into_raw() },
3319 2147483648,
3320 >,
3321 fidl::encoding::DefaultFuchsiaResourceDialect,
3322 >(
3323 self.wav_data.as_mut().map(
3324 <fidl::encoding::HandleType<
3325 fidl::Socket,
3326 { fidl::ObjectType::SOCKET.into_raw() },
3327 2147483648,
3328 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3329 ),
3330 encoder,
3331 offset + cur_offset,
3332 depth,
3333 )?;
3334
3335 _prev_end_offset = cur_offset + envelope_size;
3336
3337 Ok(())
3338 }
3339 }
3340
3341 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3342 for RecorderRecordRequest
3343 {
3344 #[inline(always)]
3345 fn new_empty() -> Self {
3346 Self::default()
3347 }
3348
3349 unsafe fn decode(
3350 &mut self,
3351 decoder: &mut fidl::encoding::Decoder<
3352 '_,
3353 fidl::encoding::DefaultFuchsiaResourceDialect,
3354 >,
3355 offset: usize,
3356 mut depth: fidl::encoding::Depth,
3357 ) -> fidl::Result<()> {
3358 decoder.debug_check_bounds::<Self>(offset);
3359 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3360 None => return Err(fidl::Error::NotNullable),
3361 Some(len) => len,
3362 };
3363 if len == 0 {
3365 return Ok(());
3366 };
3367 depth.increment()?;
3368 let envelope_size = 8;
3369 let bytes_len = len * envelope_size;
3370 let offset = decoder.out_of_line_offset(bytes_len)?;
3371 let mut _next_ordinal_to_read = 0;
3373 let mut next_offset = offset;
3374 let end_offset = offset + bytes_len;
3375 _next_ordinal_to_read += 1;
3376 if next_offset >= end_offset {
3377 return Ok(());
3378 }
3379
3380 while _next_ordinal_to_read < 1 {
3382 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3383 _next_ordinal_to_read += 1;
3384 next_offset += envelope_size;
3385 }
3386
3387 let next_out_of_line = decoder.next_out_of_line();
3388 let handles_before = decoder.remaining_handles();
3389 if let Some((inlined, num_bytes, num_handles)) =
3390 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3391 {
3392 let member_inline_size =
3393 <RecordSource as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3394 if inlined != (member_inline_size <= 4) {
3395 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3396 }
3397 let inner_offset;
3398 let mut inner_depth = depth.clone();
3399 if inlined {
3400 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3401 inner_offset = next_offset;
3402 } else {
3403 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3404 inner_depth.increment()?;
3405 }
3406 let val_ref = self.source.get_or_insert_with(|| {
3407 fidl::new_empty!(RecordSource, fidl::encoding::DefaultFuchsiaResourceDialect)
3408 });
3409 fidl::decode!(
3410 RecordSource,
3411 fidl::encoding::DefaultFuchsiaResourceDialect,
3412 val_ref,
3413 decoder,
3414 inner_offset,
3415 inner_depth
3416 )?;
3417 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3418 {
3419 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3420 }
3421 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3422 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3423 }
3424 }
3425
3426 next_offset += envelope_size;
3427 _next_ordinal_to_read += 1;
3428 if next_offset >= end_offset {
3429 return Ok(());
3430 }
3431
3432 while _next_ordinal_to_read < 2 {
3434 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3435 _next_ordinal_to_read += 1;
3436 next_offset += envelope_size;
3437 }
3438
3439 let next_out_of_line = decoder.next_out_of_line();
3440 let handles_before = decoder.remaining_handles();
3441 if let Some((inlined, num_bytes, num_handles)) =
3442 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3443 {
3444 let member_inline_size = <fidl_fuchsia_media::AudioStreamType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3445 if inlined != (member_inline_size <= 4) {
3446 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3447 }
3448 let inner_offset;
3449 let mut inner_depth = depth.clone();
3450 if inlined {
3451 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3452 inner_offset = next_offset;
3453 } else {
3454 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3455 inner_depth.increment()?;
3456 }
3457 let val_ref = self.stream_type.get_or_insert_with(|| {
3458 fidl::new_empty!(
3459 fidl_fuchsia_media::AudioStreamType,
3460 fidl::encoding::DefaultFuchsiaResourceDialect
3461 )
3462 });
3463 fidl::decode!(
3464 fidl_fuchsia_media::AudioStreamType,
3465 fidl::encoding::DefaultFuchsiaResourceDialect,
3466 val_ref,
3467 decoder,
3468 inner_offset,
3469 inner_depth
3470 )?;
3471 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3472 {
3473 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3474 }
3475 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3476 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3477 }
3478 }
3479
3480 next_offset += envelope_size;
3481 _next_ordinal_to_read += 1;
3482 if next_offset >= end_offset {
3483 return Ok(());
3484 }
3485
3486 while _next_ordinal_to_read < 3 {
3488 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3489 _next_ordinal_to_read += 1;
3490 next_offset += envelope_size;
3491 }
3492
3493 let next_out_of_line = decoder.next_out_of_line();
3494 let handles_before = decoder.remaining_handles();
3495 if let Some((inlined, num_bytes, num_handles)) =
3496 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3497 {
3498 let member_inline_size =
3499 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3500 if inlined != (member_inline_size <= 4) {
3501 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3502 }
3503 let inner_offset;
3504 let mut inner_depth = depth.clone();
3505 if inlined {
3506 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3507 inner_offset = next_offset;
3508 } else {
3509 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3510 inner_depth.increment()?;
3511 }
3512 let val_ref = self.duration.get_or_insert_with(|| {
3513 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
3514 });
3515 fidl::decode!(
3516 i64,
3517 fidl::encoding::DefaultFuchsiaResourceDialect,
3518 val_ref,
3519 decoder,
3520 inner_offset,
3521 inner_depth
3522 )?;
3523 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3524 {
3525 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3526 }
3527 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3528 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3529 }
3530 }
3531
3532 next_offset += envelope_size;
3533 _next_ordinal_to_read += 1;
3534 if next_offset >= end_offset {
3535 return Ok(());
3536 }
3537
3538 while _next_ordinal_to_read < 4 {
3540 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3541 _next_ordinal_to_read += 1;
3542 next_offset += envelope_size;
3543 }
3544
3545 let next_out_of_line = decoder.next_out_of_line();
3546 let handles_before = decoder.remaining_handles();
3547 if let Some((inlined, num_bytes, num_handles)) =
3548 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3549 {
3550 let member_inline_size = <fidl::encoding::Endpoint<
3551 fidl::endpoints::ServerEnd<RecordCancelerMarker>,
3552 > as fidl::encoding::TypeMarker>::inline_size(
3553 decoder.context
3554 );
3555 if inlined != (member_inline_size <= 4) {
3556 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3557 }
3558 let inner_offset;
3559 let mut inner_depth = depth.clone();
3560 if inlined {
3561 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3562 inner_offset = next_offset;
3563 } else {
3564 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3565 inner_depth.increment()?;
3566 }
3567 let val_ref = self.canceler.get_or_insert_with(|| {
3568 fidl::new_empty!(
3569 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RecordCancelerMarker>>,
3570 fidl::encoding::DefaultFuchsiaResourceDialect
3571 )
3572 });
3573 fidl::decode!(
3574 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RecordCancelerMarker>>,
3575 fidl::encoding::DefaultFuchsiaResourceDialect,
3576 val_ref,
3577 decoder,
3578 inner_offset,
3579 inner_depth
3580 )?;
3581 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3582 {
3583 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3584 }
3585 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3586 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3587 }
3588 }
3589
3590 next_offset += envelope_size;
3591 _next_ordinal_to_read += 1;
3592 if next_offset >= end_offset {
3593 return Ok(());
3594 }
3595
3596 while _next_ordinal_to_read < 5 {
3598 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3599 _next_ordinal_to_read += 1;
3600 next_offset += envelope_size;
3601 }
3602
3603 let next_out_of_line = decoder.next_out_of_line();
3604 let handles_before = decoder.remaining_handles();
3605 if let Some((inlined, num_bytes, num_handles)) =
3606 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3607 {
3608 let member_inline_size =
3609 <GainSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3610 if inlined != (member_inline_size <= 4) {
3611 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3612 }
3613 let inner_offset;
3614 let mut inner_depth = depth.clone();
3615 if inlined {
3616 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3617 inner_offset = next_offset;
3618 } else {
3619 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3620 inner_depth.increment()?;
3621 }
3622 let val_ref = self.gain_settings.get_or_insert_with(|| {
3623 fidl::new_empty!(GainSettings, fidl::encoding::DefaultFuchsiaResourceDialect)
3624 });
3625 fidl::decode!(
3626 GainSettings,
3627 fidl::encoding::DefaultFuchsiaResourceDialect,
3628 val_ref,
3629 decoder,
3630 inner_offset,
3631 inner_depth
3632 )?;
3633 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3634 {
3635 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3636 }
3637 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3638 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3639 }
3640 }
3641
3642 next_offset += envelope_size;
3643 _next_ordinal_to_read += 1;
3644 if next_offset >= end_offset {
3645 return Ok(());
3646 }
3647
3648 while _next_ordinal_to_read < 6 {
3650 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3651 _next_ordinal_to_read += 1;
3652 next_offset += envelope_size;
3653 }
3654
3655 let next_out_of_line = decoder.next_out_of_line();
3656 let handles_before = decoder.remaining_handles();
3657 if let Some((inlined, num_bytes, num_handles)) =
3658 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3659 {
3660 let member_inline_size =
3661 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3662 if inlined != (member_inline_size <= 4) {
3663 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3664 }
3665 let inner_offset;
3666 let mut inner_depth = depth.clone();
3667 if inlined {
3668 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3669 inner_offset = next_offset;
3670 } else {
3671 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3672 inner_depth.increment()?;
3673 }
3674 let val_ref = self.buffer_size.get_or_insert_with(|| {
3675 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3676 });
3677 fidl::decode!(
3678 u64,
3679 fidl::encoding::DefaultFuchsiaResourceDialect,
3680 val_ref,
3681 decoder,
3682 inner_offset,
3683 inner_depth
3684 )?;
3685 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3686 {
3687 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3688 }
3689 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3690 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3691 }
3692 }
3693
3694 next_offset += envelope_size;
3695 _next_ordinal_to_read += 1;
3696 if next_offset >= end_offset {
3697 return Ok(());
3698 }
3699
3700 while _next_ordinal_to_read < 7 {
3702 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3703 _next_ordinal_to_read += 1;
3704 next_offset += envelope_size;
3705 }
3706
3707 let next_out_of_line = decoder.next_out_of_line();
3708 let handles_before = decoder.remaining_handles();
3709 if let Some((inlined, num_bytes, num_handles)) =
3710 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3711 {
3712 let member_inline_size = <fidl::encoding::HandleType<
3713 fidl::Socket,
3714 { fidl::ObjectType::SOCKET.into_raw() },
3715 2147483648,
3716 > as fidl::encoding::TypeMarker>::inline_size(
3717 decoder.context
3718 );
3719 if inlined != (member_inline_size <= 4) {
3720 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3721 }
3722 let inner_offset;
3723 let mut inner_depth = depth.clone();
3724 if inlined {
3725 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3726 inner_offset = next_offset;
3727 } else {
3728 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3729 inner_depth.increment()?;
3730 }
3731 let val_ref =
3732 self.wav_data.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3733 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3734 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3735 {
3736 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3737 }
3738 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3739 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3740 }
3741 }
3742
3743 next_offset += envelope_size;
3744
3745 while next_offset < end_offset {
3747 _next_ordinal_to_read += 1;
3748 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3749 next_offset += envelope_size;
3750 }
3751
3752 Ok(())
3753 }
3754 }
3755
3756 impl RecorderRecordResponse {
3757 #[inline(always)]
3758 fn max_ordinal_present(&self) -> u64 {
3759 if let Some(_) = self.late_wakeups {
3760 return 3;
3761 }
3762 if let Some(_) = self.packets_processed {
3763 return 2;
3764 }
3765 if let Some(_) = self.bytes_processed {
3766 return 1;
3767 }
3768 0
3769 }
3770 }
3771
3772 impl fidl::encoding::ResourceTypeMarker for RecorderRecordResponse {
3773 type Borrowed<'a> = &'a mut Self;
3774 fn take_or_borrow<'a>(
3775 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3776 ) -> Self::Borrowed<'a> {
3777 value
3778 }
3779 }
3780
3781 unsafe impl fidl::encoding::TypeMarker for RecorderRecordResponse {
3782 type Owned = Self;
3783
3784 #[inline(always)]
3785 fn inline_align(_context: fidl::encoding::Context) -> usize {
3786 8
3787 }
3788
3789 #[inline(always)]
3790 fn inline_size(_context: fidl::encoding::Context) -> usize {
3791 16
3792 }
3793 }
3794
3795 unsafe impl
3796 fidl::encoding::Encode<
3797 RecorderRecordResponse,
3798 fidl::encoding::DefaultFuchsiaResourceDialect,
3799 > for &mut RecorderRecordResponse
3800 {
3801 unsafe fn encode(
3802 self,
3803 encoder: &mut fidl::encoding::Encoder<
3804 '_,
3805 fidl::encoding::DefaultFuchsiaResourceDialect,
3806 >,
3807 offset: usize,
3808 mut depth: fidl::encoding::Depth,
3809 ) -> fidl::Result<()> {
3810 encoder.debug_check_bounds::<RecorderRecordResponse>(offset);
3811 let max_ordinal: u64 = self.max_ordinal_present();
3813 encoder.write_num(max_ordinal, offset);
3814 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3815 if max_ordinal == 0 {
3817 return Ok(());
3818 }
3819 depth.increment()?;
3820 let envelope_size = 8;
3821 let bytes_len = max_ordinal as usize * envelope_size;
3822 #[allow(unused_variables)]
3823 let offset = encoder.out_of_line_offset(bytes_len);
3824 let mut _prev_end_offset: usize = 0;
3825 if 1 > max_ordinal {
3826 return Ok(());
3827 }
3828
3829 let cur_offset: usize = (1 - 1) * envelope_size;
3832
3833 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3835
3836 fidl::encoding::encode_in_envelope_optional::<
3841 u64,
3842 fidl::encoding::DefaultFuchsiaResourceDialect,
3843 >(
3844 self.bytes_processed.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3845 encoder,
3846 offset + cur_offset,
3847 depth,
3848 )?;
3849
3850 _prev_end_offset = cur_offset + envelope_size;
3851 if 2 > max_ordinal {
3852 return Ok(());
3853 }
3854
3855 let cur_offset: usize = (2 - 1) * envelope_size;
3858
3859 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3861
3862 fidl::encoding::encode_in_envelope_optional::<
3867 u64,
3868 fidl::encoding::DefaultFuchsiaResourceDialect,
3869 >(
3870 self.packets_processed
3871 .as_ref()
3872 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3873 encoder,
3874 offset + cur_offset,
3875 depth,
3876 )?;
3877
3878 _prev_end_offset = cur_offset + envelope_size;
3879 if 3 > max_ordinal {
3880 return Ok(());
3881 }
3882
3883 let cur_offset: usize = (3 - 1) * envelope_size;
3886
3887 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3889
3890 fidl::encoding::encode_in_envelope_optional::<
3895 u64,
3896 fidl::encoding::DefaultFuchsiaResourceDialect,
3897 >(
3898 self.late_wakeups.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3899 encoder,
3900 offset + cur_offset,
3901 depth,
3902 )?;
3903
3904 _prev_end_offset = cur_offset + envelope_size;
3905
3906 Ok(())
3907 }
3908 }
3909
3910 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3911 for RecorderRecordResponse
3912 {
3913 #[inline(always)]
3914 fn new_empty() -> Self {
3915 Self::default()
3916 }
3917
3918 unsafe fn decode(
3919 &mut self,
3920 decoder: &mut fidl::encoding::Decoder<
3921 '_,
3922 fidl::encoding::DefaultFuchsiaResourceDialect,
3923 >,
3924 offset: usize,
3925 mut depth: fidl::encoding::Depth,
3926 ) -> fidl::Result<()> {
3927 decoder.debug_check_bounds::<Self>(offset);
3928 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3929 None => return Err(fidl::Error::NotNullable),
3930 Some(len) => len,
3931 };
3932 if len == 0 {
3934 return Ok(());
3935 };
3936 depth.increment()?;
3937 let envelope_size = 8;
3938 let bytes_len = len * envelope_size;
3939 let offset = decoder.out_of_line_offset(bytes_len)?;
3940 let mut _next_ordinal_to_read = 0;
3942 let mut next_offset = offset;
3943 let end_offset = offset + bytes_len;
3944 _next_ordinal_to_read += 1;
3945 if next_offset >= end_offset {
3946 return Ok(());
3947 }
3948
3949 while _next_ordinal_to_read < 1 {
3951 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3952 _next_ordinal_to_read += 1;
3953 next_offset += envelope_size;
3954 }
3955
3956 let next_out_of_line = decoder.next_out_of_line();
3957 let handles_before = decoder.remaining_handles();
3958 if let Some((inlined, num_bytes, num_handles)) =
3959 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3960 {
3961 let member_inline_size =
3962 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3963 if inlined != (member_inline_size <= 4) {
3964 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3965 }
3966 let inner_offset;
3967 let mut inner_depth = depth.clone();
3968 if inlined {
3969 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3970 inner_offset = next_offset;
3971 } else {
3972 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3973 inner_depth.increment()?;
3974 }
3975 let val_ref = self.bytes_processed.get_or_insert_with(|| {
3976 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3977 });
3978 fidl::decode!(
3979 u64,
3980 fidl::encoding::DefaultFuchsiaResourceDialect,
3981 val_ref,
3982 decoder,
3983 inner_offset,
3984 inner_depth
3985 )?;
3986 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3987 {
3988 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3989 }
3990 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3991 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3992 }
3993 }
3994
3995 next_offset += envelope_size;
3996 _next_ordinal_to_read += 1;
3997 if next_offset >= end_offset {
3998 return Ok(());
3999 }
4000
4001 while _next_ordinal_to_read < 2 {
4003 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4004 _next_ordinal_to_read += 1;
4005 next_offset += envelope_size;
4006 }
4007
4008 let next_out_of_line = decoder.next_out_of_line();
4009 let handles_before = decoder.remaining_handles();
4010 if let Some((inlined, num_bytes, num_handles)) =
4011 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4012 {
4013 let member_inline_size =
4014 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4015 if inlined != (member_inline_size <= 4) {
4016 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4017 }
4018 let inner_offset;
4019 let mut inner_depth = depth.clone();
4020 if inlined {
4021 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4022 inner_offset = next_offset;
4023 } else {
4024 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4025 inner_depth.increment()?;
4026 }
4027 let val_ref = self.packets_processed.get_or_insert_with(|| {
4028 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
4029 });
4030 fidl::decode!(
4031 u64,
4032 fidl::encoding::DefaultFuchsiaResourceDialect,
4033 val_ref,
4034 decoder,
4035 inner_offset,
4036 inner_depth
4037 )?;
4038 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4039 {
4040 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4041 }
4042 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4043 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4044 }
4045 }
4046
4047 next_offset += envelope_size;
4048 _next_ordinal_to_read += 1;
4049 if next_offset >= end_offset {
4050 return Ok(());
4051 }
4052
4053 while _next_ordinal_to_read < 3 {
4055 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4056 _next_ordinal_to_read += 1;
4057 next_offset += envelope_size;
4058 }
4059
4060 let next_out_of_line = decoder.next_out_of_line();
4061 let handles_before = decoder.remaining_handles();
4062 if let Some((inlined, num_bytes, num_handles)) =
4063 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4064 {
4065 let member_inline_size =
4066 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4067 if inlined != (member_inline_size <= 4) {
4068 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4069 }
4070 let inner_offset;
4071 let mut inner_depth = depth.clone();
4072 if inlined {
4073 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4074 inner_offset = next_offset;
4075 } else {
4076 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4077 inner_depth.increment()?;
4078 }
4079 let val_ref = self.late_wakeups.get_or_insert_with(|| {
4080 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
4081 });
4082 fidl::decode!(
4083 u64,
4084 fidl::encoding::DefaultFuchsiaResourceDialect,
4085 val_ref,
4086 decoder,
4087 inner_offset,
4088 inner_depth
4089 )?;
4090 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4091 {
4092 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4093 }
4094 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4095 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4096 }
4097 }
4098
4099 next_offset += envelope_size;
4100
4101 while next_offset < end_offset {
4103 _next_ordinal_to_read += 1;
4104 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4105 next_offset += envelope_size;
4106 }
4107
4108 Ok(())
4109 }
4110 }
4111}