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_media_sounds_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct PlayerAddSoundBufferRequest {
16 pub id: u32,
17 pub buffer: fidl_fuchsia_mem::Buffer,
18 pub stream_type: fidl_fuchsia_media::AudioStreamType,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22 for PlayerAddSoundBufferRequest
23{
24}
25
26#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct PlayerAddSoundFromFileRequest {
28 pub id: u32,
29 pub file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33 for PlayerAddSoundFromFileRequest
34{
35}
36
37#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
38pub struct PlayerMarker;
39
40impl fidl::endpoints::ProtocolMarker for PlayerMarker {
41 type Proxy = PlayerProxy;
42 type RequestStream = PlayerRequestStream;
43 #[cfg(target_os = "fuchsia")]
44 type SynchronousProxy = PlayerSynchronousProxy;
45
46 const DEBUG_NAME: &'static str = "fuchsia.media.sounds.Player";
47}
48impl fidl::endpoints::DiscoverableProtocolMarker for PlayerMarker {}
49pub type PlayerAddSoundFromFileResult = Result<i64, i32>;
50pub type PlayerPlaySoundResult = Result<(), PlaySoundError>;
51pub type PlayerPlaySound2Result = Result<(), PlaySoundError>;
52
53pub trait PlayerProxyInterface: Send + Sync {
54 type AddSoundFromFileResponseFut: std::future::Future<Output = Result<PlayerAddSoundFromFileResult, fidl::Error>>
55 + Send;
56 fn r#add_sound_from_file(
57 &self,
58 id: u32,
59 file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
60 ) -> Self::AddSoundFromFileResponseFut;
61 fn r#add_sound_buffer(
62 &self,
63 id: u32,
64 buffer: fidl_fuchsia_mem::Buffer,
65 stream_type: &fidl_fuchsia_media::AudioStreamType,
66 ) -> Result<(), fidl::Error>;
67 fn r#remove_sound(&self, id: u32) -> Result<(), fidl::Error>;
68 type PlaySoundResponseFut: std::future::Future<Output = Result<PlayerPlaySoundResult, fidl::Error>>
69 + Send;
70 fn r#play_sound(
71 &self,
72 id: u32,
73 usage: fidl_fuchsia_media::AudioRenderUsage,
74 ) -> Self::PlaySoundResponseFut;
75 type PlaySound2ResponseFut: std::future::Future<Output = Result<PlayerPlaySound2Result, fidl::Error>>
76 + Send;
77 fn r#play_sound2(
78 &self,
79 id: u32,
80 usage: fidl_fuchsia_media::AudioRenderUsage2,
81 ) -> Self::PlaySound2ResponseFut;
82 fn r#stop_playing_sound(&self, id: u32) -> Result<(), fidl::Error>;
83}
84#[derive(Debug)]
85#[cfg(target_os = "fuchsia")]
86pub struct PlayerSynchronousProxy {
87 client: fidl::client::sync::Client,
88}
89
90#[cfg(target_os = "fuchsia")]
91impl fidl::endpoints::SynchronousProxy for PlayerSynchronousProxy {
92 type Proxy = PlayerProxy;
93 type Protocol = PlayerMarker;
94
95 fn from_channel(inner: fidl::Channel) -> Self {
96 Self::new(inner)
97 }
98
99 fn into_channel(self) -> fidl::Channel {
100 self.client.into_channel()
101 }
102
103 fn as_channel(&self) -> &fidl::Channel {
104 self.client.as_channel()
105 }
106}
107
108#[cfg(target_os = "fuchsia")]
109impl PlayerSynchronousProxy {
110 pub fn new(channel: fidl::Channel) -> Self {
111 let protocol_name = <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
112 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
113 }
114
115 pub fn into_channel(self) -> fidl::Channel {
116 self.client.into_channel()
117 }
118
119 pub fn wait_for_event(
122 &self,
123 deadline: zx::MonotonicInstant,
124 ) -> Result<PlayerEvent, fidl::Error> {
125 PlayerEvent::decode(self.client.wait_for_event(deadline)?)
126 }
127
128 pub fn r#add_sound_from_file(
135 &self,
136 mut id: u32,
137 mut file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
138 ___deadline: zx::MonotonicInstant,
139 ) -> Result<PlayerAddSoundFromFileResult, fidl::Error> {
140 let _response = self.client.send_query::<
141 PlayerAddSoundFromFileRequest,
142 fidl::encoding::ResultType<PlayerAddSoundFromFileResponse, i32>,
143 >(
144 (id, file,),
145 0x2fd248cffbd53f06,
146 fidl::encoding::DynamicFlags::empty(),
147 ___deadline,
148 )?;
149 Ok(_response.map(|x| x.duration))
150 }
151
152 pub fn r#add_sound_buffer(
159 &self,
160 mut id: u32,
161 mut buffer: fidl_fuchsia_mem::Buffer,
162 mut stream_type: &fidl_fuchsia_media::AudioStreamType,
163 ) -> Result<(), fidl::Error> {
164 self.client.send::<PlayerAddSoundBufferRequest>(
165 (id, &mut buffer, stream_type),
166 0x4eaa5c060d71da62,
167 fidl::encoding::DynamicFlags::empty(),
168 )
169 }
170
171 pub fn r#remove_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
181 self.client.send::<PlayerRemoveSoundRequest>(
182 (id,),
183 0x1a066f9fcf9ef0c2,
184 fidl::encoding::DynamicFlags::empty(),
185 )
186 }
187
188 pub fn r#play_sound(
195 &self,
196 mut id: u32,
197 mut usage: fidl_fuchsia_media::AudioRenderUsage,
198 ___deadline: zx::MonotonicInstant,
199 ) -> Result<PlayerPlaySoundResult, fidl::Error> {
200 let _response = self.client.send_query::<
201 PlayerPlaySoundRequest,
202 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PlaySoundError>,
203 >(
204 (id, usage,),
205 0x76f7d6bd8d1725c1,
206 fidl::encoding::DynamicFlags::empty(),
207 ___deadline,
208 )?;
209 Ok(_response.map(|x| x))
210 }
211
212 pub fn r#play_sound2(
213 &self,
214 mut id: u32,
215 mut usage: fidl_fuchsia_media::AudioRenderUsage2,
216 ___deadline: zx::MonotonicInstant,
217 ) -> Result<PlayerPlaySound2Result, fidl::Error> {
218 let _response = self.client.send_query::<
219 PlayerPlaySound2Request,
220 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, PlaySoundError>,
221 >(
222 (id, usage,),
223 0x5e68b5f96613bc39,
224 fidl::encoding::DynamicFlags::FLEXIBLE,
225 ___deadline,
226 )?
227 .into_result::<PlayerMarker>("play_sound2")?;
228 Ok(_response.map(|x| x))
229 }
230
231 pub fn r#stop_playing_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
236 self.client.send::<PlayerStopPlayingSoundRequest>(
237 (id,),
238 0x14487efba2de8152,
239 fidl::encoding::DynamicFlags::empty(),
240 )
241 }
242}
243
244#[cfg(target_os = "fuchsia")]
245impl From<PlayerSynchronousProxy> for zx::Handle {
246 fn from(value: PlayerSynchronousProxy) -> Self {
247 value.into_channel().into()
248 }
249}
250
251#[cfg(target_os = "fuchsia")]
252impl From<fidl::Channel> for PlayerSynchronousProxy {
253 fn from(value: fidl::Channel) -> Self {
254 Self::new(value)
255 }
256}
257
258#[derive(Debug, Clone)]
259pub struct PlayerProxy {
260 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
261}
262
263impl fidl::endpoints::Proxy for PlayerProxy {
264 type Protocol = PlayerMarker;
265
266 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
267 Self::new(inner)
268 }
269
270 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
271 self.client.into_channel().map_err(|client| Self { client })
272 }
273
274 fn as_channel(&self) -> &::fidl::AsyncChannel {
275 self.client.as_channel()
276 }
277}
278
279impl PlayerProxy {
280 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
282 let protocol_name = <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
283 Self { client: fidl::client::Client::new(channel, protocol_name) }
284 }
285
286 pub fn take_event_stream(&self) -> PlayerEventStream {
292 PlayerEventStream { event_receiver: self.client.take_event_receiver() }
293 }
294
295 pub fn r#add_sound_from_file(
302 &self,
303 mut id: u32,
304 mut file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
305 ) -> fidl::client::QueryResponseFut<
306 PlayerAddSoundFromFileResult,
307 fidl::encoding::DefaultFuchsiaResourceDialect,
308 > {
309 PlayerProxyInterface::r#add_sound_from_file(self, id, file)
310 }
311
312 pub fn r#add_sound_buffer(
319 &self,
320 mut id: u32,
321 mut buffer: fidl_fuchsia_mem::Buffer,
322 mut stream_type: &fidl_fuchsia_media::AudioStreamType,
323 ) -> Result<(), fidl::Error> {
324 PlayerProxyInterface::r#add_sound_buffer(self, id, buffer, stream_type)
325 }
326
327 pub fn r#remove_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
337 PlayerProxyInterface::r#remove_sound(self, id)
338 }
339
340 pub fn r#play_sound(
347 &self,
348 mut id: u32,
349 mut usage: fidl_fuchsia_media::AudioRenderUsage,
350 ) -> fidl::client::QueryResponseFut<
351 PlayerPlaySoundResult,
352 fidl::encoding::DefaultFuchsiaResourceDialect,
353 > {
354 PlayerProxyInterface::r#play_sound(self, id, usage)
355 }
356
357 pub fn r#play_sound2(
358 &self,
359 mut id: u32,
360 mut usage: fidl_fuchsia_media::AudioRenderUsage2,
361 ) -> fidl::client::QueryResponseFut<
362 PlayerPlaySound2Result,
363 fidl::encoding::DefaultFuchsiaResourceDialect,
364 > {
365 PlayerProxyInterface::r#play_sound2(self, id, usage)
366 }
367
368 pub fn r#stop_playing_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
373 PlayerProxyInterface::r#stop_playing_sound(self, id)
374 }
375}
376
377impl PlayerProxyInterface for PlayerProxy {
378 type AddSoundFromFileResponseFut = fidl::client::QueryResponseFut<
379 PlayerAddSoundFromFileResult,
380 fidl::encoding::DefaultFuchsiaResourceDialect,
381 >;
382 fn r#add_sound_from_file(
383 &self,
384 mut id: u32,
385 mut file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
386 ) -> Self::AddSoundFromFileResponseFut {
387 fn _decode(
388 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
389 ) -> Result<PlayerAddSoundFromFileResult, fidl::Error> {
390 let _response = fidl::client::decode_transaction_body::<
391 fidl::encoding::ResultType<PlayerAddSoundFromFileResponse, i32>,
392 fidl::encoding::DefaultFuchsiaResourceDialect,
393 0x2fd248cffbd53f06,
394 >(_buf?)?;
395 Ok(_response.map(|x| x.duration))
396 }
397 self.client
398 .send_query_and_decode::<PlayerAddSoundFromFileRequest, PlayerAddSoundFromFileResult>(
399 (id, file),
400 0x2fd248cffbd53f06,
401 fidl::encoding::DynamicFlags::empty(),
402 _decode,
403 )
404 }
405
406 fn r#add_sound_buffer(
407 &self,
408 mut id: u32,
409 mut buffer: fidl_fuchsia_mem::Buffer,
410 mut stream_type: &fidl_fuchsia_media::AudioStreamType,
411 ) -> Result<(), fidl::Error> {
412 self.client.send::<PlayerAddSoundBufferRequest>(
413 (id, &mut buffer, stream_type),
414 0x4eaa5c060d71da62,
415 fidl::encoding::DynamicFlags::empty(),
416 )
417 }
418
419 fn r#remove_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
420 self.client.send::<PlayerRemoveSoundRequest>(
421 (id,),
422 0x1a066f9fcf9ef0c2,
423 fidl::encoding::DynamicFlags::empty(),
424 )
425 }
426
427 type PlaySoundResponseFut = fidl::client::QueryResponseFut<
428 PlayerPlaySoundResult,
429 fidl::encoding::DefaultFuchsiaResourceDialect,
430 >;
431 fn r#play_sound(
432 &self,
433 mut id: u32,
434 mut usage: fidl_fuchsia_media::AudioRenderUsage,
435 ) -> Self::PlaySoundResponseFut {
436 fn _decode(
437 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
438 ) -> Result<PlayerPlaySoundResult, fidl::Error> {
439 let _response = fidl::client::decode_transaction_body::<
440 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PlaySoundError>,
441 fidl::encoding::DefaultFuchsiaResourceDialect,
442 0x76f7d6bd8d1725c1,
443 >(_buf?)?;
444 Ok(_response.map(|x| x))
445 }
446 self.client.send_query_and_decode::<PlayerPlaySoundRequest, PlayerPlaySoundResult>(
447 (id, usage),
448 0x76f7d6bd8d1725c1,
449 fidl::encoding::DynamicFlags::empty(),
450 _decode,
451 )
452 }
453
454 type PlaySound2ResponseFut = fidl::client::QueryResponseFut<
455 PlayerPlaySound2Result,
456 fidl::encoding::DefaultFuchsiaResourceDialect,
457 >;
458 fn r#play_sound2(
459 &self,
460 mut id: u32,
461 mut usage: fidl_fuchsia_media::AudioRenderUsage2,
462 ) -> Self::PlaySound2ResponseFut {
463 fn _decode(
464 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
465 ) -> Result<PlayerPlaySound2Result, fidl::Error> {
466 let _response = fidl::client::decode_transaction_body::<
467 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, PlaySoundError>,
468 fidl::encoding::DefaultFuchsiaResourceDialect,
469 0x5e68b5f96613bc39,
470 >(_buf?)?
471 .into_result::<PlayerMarker>("play_sound2")?;
472 Ok(_response.map(|x| x))
473 }
474 self.client.send_query_and_decode::<PlayerPlaySound2Request, PlayerPlaySound2Result>(
475 (id, usage),
476 0x5e68b5f96613bc39,
477 fidl::encoding::DynamicFlags::FLEXIBLE,
478 _decode,
479 )
480 }
481
482 fn r#stop_playing_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
483 self.client.send::<PlayerStopPlayingSoundRequest>(
484 (id,),
485 0x14487efba2de8152,
486 fidl::encoding::DynamicFlags::empty(),
487 )
488 }
489}
490
491pub struct PlayerEventStream {
492 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
493}
494
495impl std::marker::Unpin for PlayerEventStream {}
496
497impl futures::stream::FusedStream for PlayerEventStream {
498 fn is_terminated(&self) -> bool {
499 self.event_receiver.is_terminated()
500 }
501}
502
503impl futures::Stream for PlayerEventStream {
504 type Item = Result<PlayerEvent, fidl::Error>;
505
506 fn poll_next(
507 mut self: std::pin::Pin<&mut Self>,
508 cx: &mut std::task::Context<'_>,
509 ) -> std::task::Poll<Option<Self::Item>> {
510 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
511 &mut self.event_receiver,
512 cx
513 )?) {
514 Some(buf) => std::task::Poll::Ready(Some(PlayerEvent::decode(buf))),
515 None => std::task::Poll::Ready(None),
516 }
517 }
518}
519
520#[derive(Debug)]
521pub enum PlayerEvent {
522 #[non_exhaustive]
523 _UnknownEvent {
524 ordinal: u64,
526 },
527}
528
529impl PlayerEvent {
530 fn decode(
532 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
533 ) -> Result<PlayerEvent, fidl::Error> {
534 let (bytes, _handles) = buf.split_mut();
535 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
536 debug_assert_eq!(tx_header.tx_id, 0);
537 match tx_header.ordinal {
538 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
539 Ok(PlayerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
540 }
541 _ => Err(fidl::Error::UnknownOrdinal {
542 ordinal: tx_header.ordinal,
543 protocol_name: <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
544 }),
545 }
546 }
547}
548
549pub struct PlayerRequestStream {
551 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
552 is_terminated: bool,
553}
554
555impl std::marker::Unpin for PlayerRequestStream {}
556
557impl futures::stream::FusedStream for PlayerRequestStream {
558 fn is_terminated(&self) -> bool {
559 self.is_terminated
560 }
561}
562
563impl fidl::endpoints::RequestStream for PlayerRequestStream {
564 type Protocol = PlayerMarker;
565 type ControlHandle = PlayerControlHandle;
566
567 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
568 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
569 }
570
571 fn control_handle(&self) -> Self::ControlHandle {
572 PlayerControlHandle { inner: self.inner.clone() }
573 }
574
575 fn into_inner(
576 self,
577 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
578 {
579 (self.inner, self.is_terminated)
580 }
581
582 fn from_inner(
583 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
584 is_terminated: bool,
585 ) -> Self {
586 Self { inner, is_terminated }
587 }
588}
589
590impl futures::Stream for PlayerRequestStream {
591 type Item = Result<PlayerRequest, fidl::Error>;
592
593 fn poll_next(
594 mut self: std::pin::Pin<&mut Self>,
595 cx: &mut std::task::Context<'_>,
596 ) -> std::task::Poll<Option<Self::Item>> {
597 let this = &mut *self;
598 if this.inner.check_shutdown(cx) {
599 this.is_terminated = true;
600 return std::task::Poll::Ready(None);
601 }
602 if this.is_terminated {
603 panic!("polled PlayerRequestStream after completion");
604 }
605 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
606 |bytes, handles| {
607 match this.inner.channel().read_etc(cx, bytes, handles) {
608 std::task::Poll::Ready(Ok(())) => {}
609 std::task::Poll::Pending => return std::task::Poll::Pending,
610 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
611 this.is_terminated = true;
612 return std::task::Poll::Ready(None);
613 }
614 std::task::Poll::Ready(Err(e)) => {
615 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
616 e.into(),
617 ))))
618 }
619 }
620
621 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
623
624 std::task::Poll::Ready(Some(match header.ordinal {
625 0x2fd248cffbd53f06 => {
626 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
627 let mut req = fidl::new_empty!(
628 PlayerAddSoundFromFileRequest,
629 fidl::encoding::DefaultFuchsiaResourceDialect
630 );
631 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerAddSoundFromFileRequest>(&header, _body_bytes, handles, &mut req)?;
632 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
633 Ok(PlayerRequest::AddSoundFromFile {
634 id: req.id,
635 file: req.file,
636
637 responder: PlayerAddSoundFromFileResponder {
638 control_handle: std::mem::ManuallyDrop::new(control_handle),
639 tx_id: header.tx_id,
640 },
641 })
642 }
643 0x4eaa5c060d71da62 => {
644 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
645 let mut req = fidl::new_empty!(
646 PlayerAddSoundBufferRequest,
647 fidl::encoding::DefaultFuchsiaResourceDialect
648 );
649 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerAddSoundBufferRequest>(&header, _body_bytes, handles, &mut req)?;
650 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
651 Ok(PlayerRequest::AddSoundBuffer {
652 id: req.id,
653 buffer: req.buffer,
654 stream_type: req.stream_type,
655
656 control_handle,
657 })
658 }
659 0x1a066f9fcf9ef0c2 => {
660 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
661 let mut req = fidl::new_empty!(
662 PlayerRemoveSoundRequest,
663 fidl::encoding::DefaultFuchsiaResourceDialect
664 );
665 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerRemoveSoundRequest>(&header, _body_bytes, handles, &mut req)?;
666 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
667 Ok(PlayerRequest::RemoveSound { id: req.id, control_handle })
668 }
669 0x76f7d6bd8d1725c1 => {
670 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
671 let mut req = fidl::new_empty!(
672 PlayerPlaySoundRequest,
673 fidl::encoding::DefaultFuchsiaResourceDialect
674 );
675 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerPlaySoundRequest>(&header, _body_bytes, handles, &mut req)?;
676 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
677 Ok(PlayerRequest::PlaySound {
678 id: req.id,
679 usage: req.usage,
680
681 responder: PlayerPlaySoundResponder {
682 control_handle: std::mem::ManuallyDrop::new(control_handle),
683 tx_id: header.tx_id,
684 },
685 })
686 }
687 0x5e68b5f96613bc39 => {
688 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
689 let mut req = fidl::new_empty!(
690 PlayerPlaySound2Request,
691 fidl::encoding::DefaultFuchsiaResourceDialect
692 );
693 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerPlaySound2Request>(&header, _body_bytes, handles, &mut req)?;
694 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
695 Ok(PlayerRequest::PlaySound2 {
696 id: req.id,
697 usage: req.usage,
698
699 responder: PlayerPlaySound2Responder {
700 control_handle: std::mem::ManuallyDrop::new(control_handle),
701 tx_id: header.tx_id,
702 },
703 })
704 }
705 0x14487efba2de8152 => {
706 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
707 let mut req = fidl::new_empty!(
708 PlayerStopPlayingSoundRequest,
709 fidl::encoding::DefaultFuchsiaResourceDialect
710 );
711 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerStopPlayingSoundRequest>(&header, _body_bytes, handles, &mut req)?;
712 let control_handle = PlayerControlHandle { inner: this.inner.clone() };
713 Ok(PlayerRequest::StopPlayingSound { id: req.id, control_handle })
714 }
715 _ if header.tx_id == 0
716 && header
717 .dynamic_flags()
718 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
719 {
720 Ok(PlayerRequest::_UnknownMethod {
721 ordinal: header.ordinal,
722 control_handle: PlayerControlHandle { inner: this.inner.clone() },
723 method_type: fidl::MethodType::OneWay,
724 })
725 }
726 _ if header
727 .dynamic_flags()
728 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
729 {
730 this.inner.send_framework_err(
731 fidl::encoding::FrameworkErr::UnknownMethod,
732 header.tx_id,
733 header.ordinal,
734 header.dynamic_flags(),
735 (bytes, handles),
736 )?;
737 Ok(PlayerRequest::_UnknownMethod {
738 ordinal: header.ordinal,
739 control_handle: PlayerControlHandle { inner: this.inner.clone() },
740 method_type: fidl::MethodType::TwoWay,
741 })
742 }
743 _ => Err(fidl::Error::UnknownOrdinal {
744 ordinal: header.ordinal,
745 protocol_name:
746 <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
747 }),
748 }))
749 },
750 )
751 }
752}
753
754#[derive(Debug)]
756pub enum PlayerRequest {
757 AddSoundFromFile {
764 id: u32,
765 file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
766 responder: PlayerAddSoundFromFileResponder,
767 },
768 AddSoundBuffer {
775 id: u32,
776 buffer: fidl_fuchsia_mem::Buffer,
777 stream_type: fidl_fuchsia_media::AudioStreamType,
778 control_handle: PlayerControlHandle,
779 },
780 RemoveSound { id: u32, control_handle: PlayerControlHandle },
790 PlaySound {
797 id: u32,
798 usage: fidl_fuchsia_media::AudioRenderUsage,
799 responder: PlayerPlaySoundResponder,
800 },
801 PlaySound2 {
802 id: u32,
803 usage: fidl_fuchsia_media::AudioRenderUsage2,
804 responder: PlayerPlaySound2Responder,
805 },
806 StopPlayingSound { id: u32, control_handle: PlayerControlHandle },
811 #[non_exhaustive]
813 _UnknownMethod {
814 ordinal: u64,
816 control_handle: PlayerControlHandle,
817 method_type: fidl::MethodType,
818 },
819}
820
821impl PlayerRequest {
822 #[allow(irrefutable_let_patterns)]
823 pub fn into_add_sound_from_file(
824 self,
825 ) -> Option<(
826 u32,
827 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
828 PlayerAddSoundFromFileResponder,
829 )> {
830 if let PlayerRequest::AddSoundFromFile { id, file, responder } = self {
831 Some((id, file, responder))
832 } else {
833 None
834 }
835 }
836
837 #[allow(irrefutable_let_patterns)]
838 pub fn into_add_sound_buffer(
839 self,
840 ) -> Option<(
841 u32,
842 fidl_fuchsia_mem::Buffer,
843 fidl_fuchsia_media::AudioStreamType,
844 PlayerControlHandle,
845 )> {
846 if let PlayerRequest::AddSoundBuffer { id, buffer, stream_type, control_handle } = self {
847 Some((id, buffer, stream_type, control_handle))
848 } else {
849 None
850 }
851 }
852
853 #[allow(irrefutable_let_patterns)]
854 pub fn into_remove_sound(self) -> Option<(u32, PlayerControlHandle)> {
855 if let PlayerRequest::RemoveSound { id, control_handle } = self {
856 Some((id, control_handle))
857 } else {
858 None
859 }
860 }
861
862 #[allow(irrefutable_let_patterns)]
863 pub fn into_play_sound(
864 self,
865 ) -> Option<(u32, fidl_fuchsia_media::AudioRenderUsage, PlayerPlaySoundResponder)> {
866 if let PlayerRequest::PlaySound { id, usage, responder } = self {
867 Some((id, usage, responder))
868 } else {
869 None
870 }
871 }
872
873 #[allow(irrefutable_let_patterns)]
874 pub fn into_play_sound2(
875 self,
876 ) -> Option<(u32, fidl_fuchsia_media::AudioRenderUsage2, PlayerPlaySound2Responder)> {
877 if let PlayerRequest::PlaySound2 { id, usage, responder } = self {
878 Some((id, usage, responder))
879 } else {
880 None
881 }
882 }
883
884 #[allow(irrefutable_let_patterns)]
885 pub fn into_stop_playing_sound(self) -> Option<(u32, PlayerControlHandle)> {
886 if let PlayerRequest::StopPlayingSound { id, control_handle } = self {
887 Some((id, control_handle))
888 } else {
889 None
890 }
891 }
892
893 pub fn method_name(&self) -> &'static str {
895 match *self {
896 PlayerRequest::AddSoundFromFile { .. } => "add_sound_from_file",
897 PlayerRequest::AddSoundBuffer { .. } => "add_sound_buffer",
898 PlayerRequest::RemoveSound { .. } => "remove_sound",
899 PlayerRequest::PlaySound { .. } => "play_sound",
900 PlayerRequest::PlaySound2 { .. } => "play_sound2",
901 PlayerRequest::StopPlayingSound { .. } => "stop_playing_sound",
902 PlayerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
903 "unknown one-way method"
904 }
905 PlayerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
906 "unknown two-way method"
907 }
908 }
909 }
910}
911
912#[derive(Debug, Clone)]
913pub struct PlayerControlHandle {
914 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
915}
916
917impl fidl::endpoints::ControlHandle for PlayerControlHandle {
918 fn shutdown(&self) {
919 self.inner.shutdown()
920 }
921 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
922 self.inner.shutdown_with_epitaph(status)
923 }
924
925 fn is_closed(&self) -> bool {
926 self.inner.channel().is_closed()
927 }
928 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
929 self.inner.channel().on_closed()
930 }
931
932 #[cfg(target_os = "fuchsia")]
933 fn signal_peer(
934 &self,
935 clear_mask: zx::Signals,
936 set_mask: zx::Signals,
937 ) -> Result<(), zx_status::Status> {
938 use fidl::Peered;
939 self.inner.channel().signal_peer(clear_mask, set_mask)
940 }
941}
942
943impl PlayerControlHandle {}
944
945#[must_use = "FIDL methods require a response to be sent"]
946#[derive(Debug)]
947pub struct PlayerAddSoundFromFileResponder {
948 control_handle: std::mem::ManuallyDrop<PlayerControlHandle>,
949 tx_id: u32,
950}
951
952impl std::ops::Drop for PlayerAddSoundFromFileResponder {
956 fn drop(&mut self) {
957 self.control_handle.shutdown();
958 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
960 }
961}
962
963impl fidl::endpoints::Responder for PlayerAddSoundFromFileResponder {
964 type ControlHandle = PlayerControlHandle;
965
966 fn control_handle(&self) -> &PlayerControlHandle {
967 &self.control_handle
968 }
969
970 fn drop_without_shutdown(mut self) {
971 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
973 std::mem::forget(self);
975 }
976}
977
978impl PlayerAddSoundFromFileResponder {
979 pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
983 let _result = self.send_raw(result);
984 if _result.is_err() {
985 self.control_handle.shutdown();
986 }
987 self.drop_without_shutdown();
988 _result
989 }
990
991 pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
993 let _result = self.send_raw(result);
994 self.drop_without_shutdown();
995 _result
996 }
997
998 fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
999 self.control_handle
1000 .inner
1001 .send::<fidl::encoding::ResultType<PlayerAddSoundFromFileResponse, i32>>(
1002 result.map(|duration| (duration,)),
1003 self.tx_id,
1004 0x2fd248cffbd53f06,
1005 fidl::encoding::DynamicFlags::empty(),
1006 )
1007 }
1008}
1009
1010#[must_use = "FIDL methods require a response to be sent"]
1011#[derive(Debug)]
1012pub struct PlayerPlaySoundResponder {
1013 control_handle: std::mem::ManuallyDrop<PlayerControlHandle>,
1014 tx_id: u32,
1015}
1016
1017impl std::ops::Drop for PlayerPlaySoundResponder {
1021 fn drop(&mut self) {
1022 self.control_handle.shutdown();
1023 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1025 }
1026}
1027
1028impl fidl::endpoints::Responder for PlayerPlaySoundResponder {
1029 type ControlHandle = PlayerControlHandle;
1030
1031 fn control_handle(&self) -> &PlayerControlHandle {
1032 &self.control_handle
1033 }
1034
1035 fn drop_without_shutdown(mut self) {
1036 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1038 std::mem::forget(self);
1040 }
1041}
1042
1043impl PlayerPlaySoundResponder {
1044 pub fn send(self, mut result: Result<(), PlaySoundError>) -> Result<(), fidl::Error> {
1048 let _result = self.send_raw(result);
1049 if _result.is_err() {
1050 self.control_handle.shutdown();
1051 }
1052 self.drop_without_shutdown();
1053 _result
1054 }
1055
1056 pub fn send_no_shutdown_on_err(
1058 self,
1059 mut result: Result<(), PlaySoundError>,
1060 ) -> Result<(), fidl::Error> {
1061 let _result = self.send_raw(result);
1062 self.drop_without_shutdown();
1063 _result
1064 }
1065
1066 fn send_raw(&self, mut result: Result<(), PlaySoundError>) -> Result<(), fidl::Error> {
1067 self.control_handle.inner.send::<fidl::encoding::ResultType<
1068 fidl::encoding::EmptyStruct,
1069 PlaySoundError,
1070 >>(
1071 result,
1072 self.tx_id,
1073 0x76f7d6bd8d1725c1,
1074 fidl::encoding::DynamicFlags::empty(),
1075 )
1076 }
1077}
1078
1079#[must_use = "FIDL methods require a response to be sent"]
1080#[derive(Debug)]
1081pub struct PlayerPlaySound2Responder {
1082 control_handle: std::mem::ManuallyDrop<PlayerControlHandle>,
1083 tx_id: u32,
1084}
1085
1086impl std::ops::Drop for PlayerPlaySound2Responder {
1090 fn drop(&mut self) {
1091 self.control_handle.shutdown();
1092 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1094 }
1095}
1096
1097impl fidl::endpoints::Responder for PlayerPlaySound2Responder {
1098 type ControlHandle = PlayerControlHandle;
1099
1100 fn control_handle(&self) -> &PlayerControlHandle {
1101 &self.control_handle
1102 }
1103
1104 fn drop_without_shutdown(mut self) {
1105 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1107 std::mem::forget(self);
1109 }
1110}
1111
1112impl PlayerPlaySound2Responder {
1113 pub fn send(self, mut result: Result<(), PlaySoundError>) -> Result<(), fidl::Error> {
1117 let _result = self.send_raw(result);
1118 if _result.is_err() {
1119 self.control_handle.shutdown();
1120 }
1121 self.drop_without_shutdown();
1122 _result
1123 }
1124
1125 pub fn send_no_shutdown_on_err(
1127 self,
1128 mut result: Result<(), PlaySoundError>,
1129 ) -> Result<(), fidl::Error> {
1130 let _result = self.send_raw(result);
1131 self.drop_without_shutdown();
1132 _result
1133 }
1134
1135 fn send_raw(&self, mut result: Result<(), PlaySoundError>) -> Result<(), fidl::Error> {
1136 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1137 fidl::encoding::EmptyStruct,
1138 PlaySoundError,
1139 >>(
1140 fidl::encoding::FlexibleResult::new(result),
1141 self.tx_id,
1142 0x5e68b5f96613bc39,
1143 fidl::encoding::DynamicFlags::FLEXIBLE,
1144 )
1145 }
1146}
1147
1148mod internal {
1149 use super::*;
1150
1151 impl fidl::encoding::ResourceTypeMarker for PlayerAddSoundBufferRequest {
1152 type Borrowed<'a> = &'a mut Self;
1153 fn take_or_borrow<'a>(
1154 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1155 ) -> Self::Borrowed<'a> {
1156 value
1157 }
1158 }
1159
1160 unsafe impl fidl::encoding::TypeMarker for PlayerAddSoundBufferRequest {
1161 type Owned = Self;
1162
1163 #[inline(always)]
1164 fn inline_align(_context: fidl::encoding::Context) -> usize {
1165 8
1166 }
1167
1168 #[inline(always)]
1169 fn inline_size(_context: fidl::encoding::Context) -> usize {
1170 40
1171 }
1172 }
1173
1174 unsafe impl
1175 fidl::encoding::Encode<
1176 PlayerAddSoundBufferRequest,
1177 fidl::encoding::DefaultFuchsiaResourceDialect,
1178 > for &mut PlayerAddSoundBufferRequest
1179 {
1180 #[inline]
1181 unsafe fn encode(
1182 self,
1183 encoder: &mut fidl::encoding::Encoder<
1184 '_,
1185 fidl::encoding::DefaultFuchsiaResourceDialect,
1186 >,
1187 offset: usize,
1188 _depth: fidl::encoding::Depth,
1189 ) -> fidl::Result<()> {
1190 encoder.debug_check_bounds::<PlayerAddSoundBufferRequest>(offset);
1191 fidl::encoding::Encode::<PlayerAddSoundBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1193 (
1194 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1195 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
1196 <fidl_fuchsia_media::AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),
1197 ),
1198 encoder, offset, _depth
1199 )
1200 }
1201 }
1202 unsafe impl<
1203 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1204 T1: fidl::encoding::Encode<
1205 fidl_fuchsia_mem::Buffer,
1206 fidl::encoding::DefaultFuchsiaResourceDialect,
1207 >,
1208 T2: fidl::encoding::Encode<
1209 fidl_fuchsia_media::AudioStreamType,
1210 fidl::encoding::DefaultFuchsiaResourceDialect,
1211 >,
1212 >
1213 fidl::encoding::Encode<
1214 PlayerAddSoundBufferRequest,
1215 fidl::encoding::DefaultFuchsiaResourceDialect,
1216 > for (T0, T1, T2)
1217 {
1218 #[inline]
1219 unsafe fn encode(
1220 self,
1221 encoder: &mut fidl::encoding::Encoder<
1222 '_,
1223 fidl::encoding::DefaultFuchsiaResourceDialect,
1224 >,
1225 offset: usize,
1226 depth: fidl::encoding::Depth,
1227 ) -> fidl::Result<()> {
1228 encoder.debug_check_bounds::<PlayerAddSoundBufferRequest>(offset);
1229 unsafe {
1232 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1233 (ptr as *mut u64).write_unaligned(0);
1234 }
1235 unsafe {
1236 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
1237 (ptr as *mut u64).write_unaligned(0);
1238 }
1239 self.0.encode(encoder, offset + 0, depth)?;
1241 self.1.encode(encoder, offset + 8, depth)?;
1242 self.2.encode(encoder, offset + 24, depth)?;
1243 Ok(())
1244 }
1245 }
1246
1247 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1248 for PlayerAddSoundBufferRequest
1249 {
1250 #[inline(always)]
1251 fn new_empty() -> Self {
1252 Self {
1253 id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
1254 buffer: fidl::new_empty!(
1255 fidl_fuchsia_mem::Buffer,
1256 fidl::encoding::DefaultFuchsiaResourceDialect
1257 ),
1258 stream_type: fidl::new_empty!(
1259 fidl_fuchsia_media::AudioStreamType,
1260 fidl::encoding::DefaultFuchsiaResourceDialect
1261 ),
1262 }
1263 }
1264
1265 #[inline]
1266 unsafe fn decode(
1267 &mut self,
1268 decoder: &mut fidl::encoding::Decoder<
1269 '_,
1270 fidl::encoding::DefaultFuchsiaResourceDialect,
1271 >,
1272 offset: usize,
1273 _depth: fidl::encoding::Depth,
1274 ) -> fidl::Result<()> {
1275 decoder.debug_check_bounds::<Self>(offset);
1276 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1278 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1279 let mask = 0xffffffff00000000u64;
1280 let maskedval = padval & mask;
1281 if maskedval != 0 {
1282 return Err(fidl::Error::NonZeroPadding {
1283 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1284 });
1285 }
1286 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
1287 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1288 let mask = 0xffffffff00000000u64;
1289 let maskedval = padval & mask;
1290 if maskedval != 0 {
1291 return Err(fidl::Error::NonZeroPadding {
1292 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
1293 });
1294 }
1295 fidl::decode!(
1296 u32,
1297 fidl::encoding::DefaultFuchsiaResourceDialect,
1298 &mut self.id,
1299 decoder,
1300 offset + 0,
1301 _depth
1302 )?;
1303 fidl::decode!(
1304 fidl_fuchsia_mem::Buffer,
1305 fidl::encoding::DefaultFuchsiaResourceDialect,
1306 &mut self.buffer,
1307 decoder,
1308 offset + 8,
1309 _depth
1310 )?;
1311 fidl::decode!(
1312 fidl_fuchsia_media::AudioStreamType,
1313 fidl::encoding::DefaultFuchsiaResourceDialect,
1314 &mut self.stream_type,
1315 decoder,
1316 offset + 24,
1317 _depth
1318 )?;
1319 Ok(())
1320 }
1321 }
1322
1323 impl fidl::encoding::ResourceTypeMarker for PlayerAddSoundFromFileRequest {
1324 type Borrowed<'a> = &'a mut Self;
1325 fn take_or_borrow<'a>(
1326 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1327 ) -> Self::Borrowed<'a> {
1328 value
1329 }
1330 }
1331
1332 unsafe impl fidl::encoding::TypeMarker for PlayerAddSoundFromFileRequest {
1333 type Owned = Self;
1334
1335 #[inline(always)]
1336 fn inline_align(_context: fidl::encoding::Context) -> usize {
1337 4
1338 }
1339
1340 #[inline(always)]
1341 fn inline_size(_context: fidl::encoding::Context) -> usize {
1342 8
1343 }
1344 }
1345
1346 unsafe impl
1347 fidl::encoding::Encode<
1348 PlayerAddSoundFromFileRequest,
1349 fidl::encoding::DefaultFuchsiaResourceDialect,
1350 > for &mut PlayerAddSoundFromFileRequest
1351 {
1352 #[inline]
1353 unsafe fn encode(
1354 self,
1355 encoder: &mut fidl::encoding::Encoder<
1356 '_,
1357 fidl::encoding::DefaultFuchsiaResourceDialect,
1358 >,
1359 offset: usize,
1360 _depth: fidl::encoding::Depth,
1361 ) -> fidl::Result<()> {
1362 encoder.debug_check_bounds::<PlayerAddSoundFromFileRequest>(offset);
1363 fidl::encoding::Encode::<
1365 PlayerAddSoundFromFileRequest,
1366 fidl::encoding::DefaultFuchsiaResourceDialect,
1367 >::encode(
1368 (
1369 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1370 <fidl::encoding::Endpoint<
1371 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1372 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1373 &mut self.file
1374 ),
1375 ),
1376 encoder,
1377 offset,
1378 _depth,
1379 )
1380 }
1381 }
1382 unsafe impl<
1383 T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1384 T1: fidl::encoding::Encode<
1385 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
1386 fidl::encoding::DefaultFuchsiaResourceDialect,
1387 >,
1388 >
1389 fidl::encoding::Encode<
1390 PlayerAddSoundFromFileRequest,
1391 fidl::encoding::DefaultFuchsiaResourceDialect,
1392 > for (T0, T1)
1393 {
1394 #[inline]
1395 unsafe fn encode(
1396 self,
1397 encoder: &mut fidl::encoding::Encoder<
1398 '_,
1399 fidl::encoding::DefaultFuchsiaResourceDialect,
1400 >,
1401 offset: usize,
1402 depth: fidl::encoding::Depth,
1403 ) -> fidl::Result<()> {
1404 encoder.debug_check_bounds::<PlayerAddSoundFromFileRequest>(offset);
1405 self.0.encode(encoder, offset + 0, depth)?;
1409 self.1.encode(encoder, offset + 4, depth)?;
1410 Ok(())
1411 }
1412 }
1413
1414 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1415 for PlayerAddSoundFromFileRequest
1416 {
1417 #[inline(always)]
1418 fn new_empty() -> Self {
1419 Self {
1420 id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
1421 file: fidl::new_empty!(
1422 fidl::encoding::Endpoint<
1423 fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
1424 >,
1425 fidl::encoding::DefaultFuchsiaResourceDialect
1426 ),
1427 }
1428 }
1429
1430 #[inline]
1431 unsafe fn decode(
1432 &mut self,
1433 decoder: &mut fidl::encoding::Decoder<
1434 '_,
1435 fidl::encoding::DefaultFuchsiaResourceDialect,
1436 >,
1437 offset: usize,
1438 _depth: fidl::encoding::Depth,
1439 ) -> fidl::Result<()> {
1440 decoder.debug_check_bounds::<Self>(offset);
1441 fidl::decode!(
1443 u32,
1444 fidl::encoding::DefaultFuchsiaResourceDialect,
1445 &mut self.id,
1446 decoder,
1447 offset + 0,
1448 _depth
1449 )?;
1450 fidl::decode!(
1451 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
1452 fidl::encoding::DefaultFuchsiaResourceDialect,
1453 &mut self.file,
1454 decoder,
1455 offset + 4,
1456 _depth
1457 )?;
1458 Ok(())
1459 }
1460 }
1461}