#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum PlaySoundError {
NoSuchSound = 1,
RendererFailed = 2,
Stopped = 3,
}
impl PlaySoundError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::NoSuchSound),
2 => Some(Self::RendererFailed),
3 => Some(Self::Stopped),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Debug, PartialEq)]
pub struct PlayerAddSoundBufferRequest {
pub id: u32,
pub buffer: fidl_fuchsia_mem::Buffer,
pub stream_type: fidl_fuchsia_media::AudioStreamType,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PlayerAddSoundBufferRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PlayerAddSoundFromFileRequest {
pub id: u32,
pub file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PlayerAddSoundFromFileRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PlayerPlaySoundRequest {
pub id: u32,
pub usage: fidl_fuchsia_media::AudioRenderUsage,
}
impl fidl::Persistable for PlayerPlaySoundRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PlayerRemoveSoundRequest {
pub id: u32,
}
impl fidl::Persistable for PlayerRemoveSoundRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PlayerStopPlayingSoundRequest {
pub id: u32,
}
impl fidl::Persistable for PlayerStopPlayingSoundRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PlayerAddSoundFromFileResponse {
pub duration: i64,
}
impl fidl::Persistable for PlayerAddSoundFromFileResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PlayerMarker;
impl fidl::endpoints::ProtocolMarker for PlayerMarker {
type Proxy = PlayerProxy;
type RequestStream = PlayerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PlayerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.sounds.Player";
}
impl fidl::endpoints::DiscoverableProtocolMarker for PlayerMarker {}
pub type PlayerAddSoundFromFileResult = Result<i64, i32>;
pub type PlayerPlaySoundResult = Result<(), PlaySoundError>;
pub trait PlayerProxyInterface: Send + Sync {
type AddSoundFromFileResponseFut: std::future::Future<Output = Result<PlayerAddSoundFromFileResult, fidl::Error>>
+ Send;
fn r#add_sound_from_file(
&self,
id: u32,
file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
) -> Self::AddSoundFromFileResponseFut;
fn r#add_sound_buffer(
&self,
id: u32,
buffer: fidl_fuchsia_mem::Buffer,
stream_type: &fidl_fuchsia_media::AudioStreamType,
) -> Result<(), fidl::Error>;
fn r#remove_sound(&self, id: u32) -> Result<(), fidl::Error>;
type PlaySoundResponseFut: std::future::Future<Output = Result<PlayerPlaySoundResult, fidl::Error>>
+ Send;
fn r#play_sound(
&self,
id: u32,
usage: fidl_fuchsia_media::AudioRenderUsage,
) -> Self::PlaySoundResponseFut;
fn r#stop_playing_sound(&self, id: u32) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PlayerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PlayerSynchronousProxy {
type Proxy = PlayerProxy;
type Protocol = PlayerMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl PlayerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<PlayerEvent, fidl::Error> {
PlayerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_sound_from_file(
&self,
mut id: u32,
mut file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<PlayerAddSoundFromFileResult, fidl::Error> {
let _response = self.client.send_query::<
PlayerAddSoundFromFileRequest,
fidl::encoding::ResultType<PlayerAddSoundFromFileResponse, i32>,
>(
(id, file,),
0x2fd248cffbd53f06,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.duration))
}
pub fn r#add_sound_buffer(
&self,
mut id: u32,
mut buffer: fidl_fuchsia_mem::Buffer,
mut stream_type: &fidl_fuchsia_media::AudioStreamType,
) -> Result<(), fidl::Error> {
self.client.send::<PlayerAddSoundBufferRequest>(
(id, &mut buffer, stream_type),
0x4eaa5c060d71da62,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#remove_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<PlayerRemoveSoundRequest>(
(id,),
0x1a066f9fcf9ef0c2,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#play_sound(
&self,
mut id: u32,
mut usage: fidl_fuchsia_media::AudioRenderUsage,
___deadline: zx::MonotonicInstant,
) -> Result<PlayerPlaySoundResult, fidl::Error> {
let _response = self.client.send_query::<
PlayerPlaySoundRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PlaySoundError>,
>(
(id, usage,),
0x76f7d6bd8d1725c1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#stop_playing_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<PlayerStopPlayingSoundRequest>(
(id,),
0x14487efba2de8152,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct PlayerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PlayerProxy {
type Protocol = PlayerMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl PlayerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PlayerEventStream {
PlayerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_sound_from_file(
&self,
mut id: u32,
mut file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
) -> fidl::client::QueryResponseFut<
PlayerAddSoundFromFileResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PlayerProxyInterface::r#add_sound_from_file(self, id, file)
}
pub fn r#add_sound_buffer(
&self,
mut id: u32,
mut buffer: fidl_fuchsia_mem::Buffer,
mut stream_type: &fidl_fuchsia_media::AudioStreamType,
) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#add_sound_buffer(self, id, buffer, stream_type)
}
pub fn r#remove_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#remove_sound(self, id)
}
pub fn r#play_sound(
&self,
mut id: u32,
mut usage: fidl_fuchsia_media::AudioRenderUsage,
) -> fidl::client::QueryResponseFut<
PlayerPlaySoundResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PlayerProxyInterface::r#play_sound(self, id, usage)
}
pub fn r#stop_playing_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#stop_playing_sound(self, id)
}
}
impl PlayerProxyInterface for PlayerProxy {
type AddSoundFromFileResponseFut = fidl::client::QueryResponseFut<
PlayerAddSoundFromFileResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#add_sound_from_file(
&self,
mut id: u32,
mut file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
) -> Self::AddSoundFromFileResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PlayerAddSoundFromFileResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<PlayerAddSoundFromFileResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2fd248cffbd53f06,
>(_buf?)?;
Ok(_response.map(|x| x.duration))
}
self.client
.send_query_and_decode::<PlayerAddSoundFromFileRequest, PlayerAddSoundFromFileResult>(
(id, file),
0x2fd248cffbd53f06,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#add_sound_buffer(
&self,
mut id: u32,
mut buffer: fidl_fuchsia_mem::Buffer,
mut stream_type: &fidl_fuchsia_media::AudioStreamType,
) -> Result<(), fidl::Error> {
self.client.send::<PlayerAddSoundBufferRequest>(
(id, &mut buffer, stream_type),
0x4eaa5c060d71da62,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#remove_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<PlayerRemoveSoundRequest>(
(id,),
0x1a066f9fcf9ef0c2,
fidl::encoding::DynamicFlags::empty(),
)
}
type PlaySoundResponseFut = fidl::client::QueryResponseFut<
PlayerPlaySoundResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#play_sound(
&self,
mut id: u32,
mut usage: fidl_fuchsia_media::AudioRenderUsage,
) -> Self::PlaySoundResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PlayerPlaySoundResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PlaySoundError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x76f7d6bd8d1725c1,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<PlayerPlaySoundRequest, PlayerPlaySoundResult>(
(id, usage),
0x76f7d6bd8d1725c1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#stop_playing_sound(&self, mut id: u32) -> Result<(), fidl::Error> {
self.client.send::<PlayerStopPlayingSoundRequest>(
(id,),
0x14487efba2de8152,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct PlayerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PlayerEventStream {}
impl futures::stream::FusedStream for PlayerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PlayerEventStream {
type Item = Result<PlayerEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(PlayerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PlayerEvent {}
impl PlayerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PlayerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PlayerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PlayerRequestStream {}
impl futures::stream::FusedStream for PlayerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PlayerRequestStream {
type Protocol = PlayerMarker;
type ControlHandle = PlayerControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
PlayerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for PlayerRequestStream {
type Item = Result<PlayerRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled PlayerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2fd248cffbd53f06 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PlayerAddSoundFromFileRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerAddSoundFromFileRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::AddSoundFromFile {
id: req.id,
file: req.file,
responder: PlayerAddSoundFromFileResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4eaa5c060d71da62 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerAddSoundBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerAddSoundBufferRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::AddSoundBuffer {
id: req.id,
buffer: req.buffer,
stream_type: req.stream_type,
control_handle,
})
}
0x1a066f9fcf9ef0c2 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerRemoveSoundRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerRemoveSoundRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::RemoveSound { id: req.id, control_handle })
}
0x76f7d6bd8d1725c1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PlayerPlaySoundRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerPlaySoundRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::PlaySound {
id: req.id,
usage: req.usage,
responder: PlayerPlaySoundResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x14487efba2de8152 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerStopPlayingSoundRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerStopPlayingSoundRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::StopPlayingSound { id: req.id, control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PlayerRequest {
AddSoundFromFile {
id: u32,
file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
responder: PlayerAddSoundFromFileResponder,
},
AddSoundBuffer {
id: u32,
buffer: fidl_fuchsia_mem::Buffer,
stream_type: fidl_fuchsia_media::AudioStreamType,
control_handle: PlayerControlHandle,
},
RemoveSound { id: u32, control_handle: PlayerControlHandle },
PlaySound {
id: u32,
usage: fidl_fuchsia_media::AudioRenderUsage,
responder: PlayerPlaySoundResponder,
},
StopPlayingSound { id: u32, control_handle: PlayerControlHandle },
}
impl PlayerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_sound_from_file(
self,
) -> Option<(
u32,
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
PlayerAddSoundFromFileResponder,
)> {
if let PlayerRequest::AddSoundFromFile { id, file, responder } = self {
Some((id, file, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_sound_buffer(
self,
) -> Option<(
u32,
fidl_fuchsia_mem::Buffer,
fidl_fuchsia_media::AudioStreamType,
PlayerControlHandle,
)> {
if let PlayerRequest::AddSoundBuffer { id, buffer, stream_type, control_handle } = self {
Some((id, buffer, stream_type, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_sound(self) -> Option<(u32, PlayerControlHandle)> {
if let PlayerRequest::RemoveSound { id, control_handle } = self {
Some((id, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_play_sound(
self,
) -> Option<(u32, fidl_fuchsia_media::AudioRenderUsage, PlayerPlaySoundResponder)> {
if let PlayerRequest::PlaySound { id, usage, responder } = self {
Some((id, usage, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop_playing_sound(self) -> Option<(u32, PlayerControlHandle)> {
if let PlayerRequest::StopPlayingSound { id, control_handle } = self {
Some((id, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PlayerRequest::AddSoundFromFile { .. } => "add_sound_from_file",
PlayerRequest::AddSoundBuffer { .. } => "add_sound_buffer",
PlayerRequest::RemoveSound { .. } => "remove_sound",
PlayerRequest::PlaySound { .. } => "play_sound",
PlayerRequest::StopPlayingSound { .. } => "stop_playing_sound",
}
}
}
#[derive(Debug, Clone)]
pub struct PlayerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PlayerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl PlayerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PlayerAddSoundFromFileResponder {
control_handle: std::mem::ManuallyDrop<PlayerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PlayerAddSoundFromFileResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PlayerAddSoundFromFileResponder {
type ControlHandle = PlayerControlHandle;
fn control_handle(&self) -> &PlayerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PlayerAddSoundFromFileResponder {
pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<PlayerAddSoundFromFileResponse, i32>>(
result.map(|duration| (duration,)),
self.tx_id,
0x2fd248cffbd53f06,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PlayerPlaySoundResponder {
control_handle: std::mem::ManuallyDrop<PlayerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PlayerPlaySoundResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PlayerPlaySoundResponder {
type ControlHandle = PlayerControlHandle;
fn control_handle(&self) -> &PlayerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PlayerPlaySoundResponder {
pub fn send(self, mut result: Result<(), PlaySoundError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), PlaySoundError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PlaySoundError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
PlaySoundError,
>>(
result,
self.tx_id,
0x76f7d6bd8d1725c1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for PlaySoundError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for PlaySoundError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PlaySoundError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlaySoundError {
#[inline(always)]
fn new_empty() -> Self {
Self::NoSuchSound
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PlayerAddSoundBufferRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerAddSoundBufferRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl
fidl::encoding::Encode<
PlayerAddSoundBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PlayerAddSoundBufferRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerAddSoundBufferRequest>(offset);
fidl::encoding::Encode::<PlayerAddSoundBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
<fidl_fuchsia_media::AudioStreamType as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_type),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl_fuchsia_media::AudioStreamType,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PlayerAddSoundBufferRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerAddSoundBufferRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PlayerAddSoundBufferRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
buffer: fidl::new_empty!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect
),
stream_type: fidl::new_empty!(
fidl_fuchsia_media::AudioStreamType,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
u32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.buffer,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl_fuchsia_media::AudioStreamType,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.stream_type,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PlayerAddSoundFromFileRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerAddSoundFromFileRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl
fidl::encoding::Encode<
PlayerAddSoundFromFileRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PlayerAddSoundFromFileRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerAddSoundFromFileRequest>(offset);
fidl::encoding::Encode::<
PlayerAddSoundFromFileRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.file
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PlayerAddSoundFromFileRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerAddSoundFromFileRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PlayerAddSoundFromFileRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
file: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
u32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.file,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PlayerPlaySoundRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerPlaySoundRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PlayerPlaySoundRequest, D> for &PlayerPlaySoundRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerPlaySoundRequest>(offset);
fidl::encoding::Encode::<PlayerPlaySoundRequest, D>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u32, D>,
T1: fidl::encoding::Encode<fidl_fuchsia_media::AudioRenderUsage, D>,
> fidl::encoding::Encode<PlayerPlaySoundRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerPlaySoundRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PlayerPlaySoundRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u32, D),
usage: fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u32, D, &mut self.id, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl_fuchsia_media::AudioRenderUsage,
D,
&mut self.usage,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PlayerRemoveSoundRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerRemoveSoundRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PlayerRemoveSoundRequest, D> for &PlayerRemoveSoundRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerRemoveSoundRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PlayerRemoveSoundRequest)
.write_unaligned((self as *const PlayerRemoveSoundRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<PlayerRemoveSoundRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerRemoveSoundRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PlayerRemoveSoundRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PlayerStopPlayingSoundRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerStopPlayingSoundRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PlayerStopPlayingSoundRequest, D>
for &PlayerStopPlayingSoundRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerStopPlayingSoundRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PlayerStopPlayingSoundRequest)
.write_unaligned((self as *const PlayerStopPlayingSoundRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<PlayerStopPlayingSoundRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerStopPlayingSoundRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PlayerStopPlayingSoundRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PlayerAddSoundFromFileResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerAddSoundFromFileResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PlayerAddSoundFromFileResponse, D>
for &PlayerAddSoundFromFileResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerAddSoundFromFileResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PlayerAddSoundFromFileResponse)
.write_unaligned((self as *const PlayerAddSoundFromFileResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<PlayerAddSoundFromFileResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerAddSoundFromFileResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PlayerAddSoundFromFileResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { duration: fidl::new_empty!(i64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
}