#![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;
pub type Domain = String;
pub type SessionId = u64;
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct PlayerCapabilityFlags: u32 {
const PLAY = 1;
const PAUSE = 4;
const SEEK = 8;
const SKIP_FORWARD = 16;
const SKIP_REVERSE = 32;
const SHUFFLE = 64;
const CHANGE_TO_NEXT_ITEM = 128;
const CHANGE_TO_PREV_ITEM = 256;
const HAS_GAIN_CONTROL = 512;
const REPEAT_GROUPS = 1024;
const REPEAT_SINGLE = 2048;
const SET_PLAYBACK_RATE = 4096;
}
}
impl PlayerCapabilityFlags {
#[deprecated = "Strict bits should not use `has_unknown_bits`"]
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
false
}
#[deprecated = "Strict bits should not use `get_unknown_bits`"]
#[inline(always)]
pub fn get_unknown_bits(&self) -> u32 {
0
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum ContentType {
Other = 1,
Audio = 2,
Video = 3,
Music = 4,
TvShow = 5,
Movie = 6,
}
impl ContentType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Other),
2 => Some(Self::Audio),
3 => Some(Self::Video),
4 => Some(Self::Music),
5 => Some(Self::TvShow),
6 => Some(Self::Movie),
_ => 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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Error {
Other = 1,
}
impl Error {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Other),
_ => 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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum InterruptionBehavior {
None = 0,
Pause = 1,
}
impl InterruptionBehavior {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::None),
1 => Some(Self::Pause),
_ => 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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum MediaImageType {
Artwork = 0,
SourceIcon = 1,
}
impl MediaImageType {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Artwork),
1 => Some(Self::SourceIcon),
_ => 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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum PlayerState {
Idle = 0,
Playing = 1,
Paused = 2,
Buffering = 3,
Error = 4,
}
impl PlayerState {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Idle),
1 => Some(Self::Playing),
2 => Some(Self::Paused),
3 => Some(Self::Buffering),
4 => Some(Self::Error),
_ => 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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum RepeatMode {
Off = 0,
Group = 1,
Single = 2,
}
impl RepeatMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Off),
1 => Some(Self::Group),
2 => Some(Self::Single),
_ => 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, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ActiveSessionWatchActiveSessionResponse {
pub session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ActiveSessionWatchActiveSessionResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DiscoveryConnectToSessionRequest {
pub session_id: u64,
pub session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for DiscoveryConnectToSessionRequest
{
}
#[derive(Debug, PartialEq)]
pub struct DiscoveryWatchSessionsRequest {
pub watch_options: WatchOptions,
pub session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for DiscoveryWatchSessionsRequest
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ImageSizeVariant {
pub url: String,
pub width: u32,
pub height: u32,
}
impl fidl::Persistable for ImageSizeVariant {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ObserverDiscoveryConnectToSessionRequest {
pub session_id: u64,
pub session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ObserverDiscoveryConnectToSessionRequest
{
}
#[derive(Debug, PartialEq)]
pub struct ObserverDiscoveryWatchSessionsRequest {
pub watch_options: WatchOptions,
pub sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ObserverDiscoveryWatchSessionsRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PlayerControlBindVolumeControlRequest {
pub volume_control_request:
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for PlayerControlBindVolumeControlRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PlayerControlSeekRequest {
pub position: i64,
}
impl fidl::Persistable for PlayerControlSeekRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct PlayerControlSetPlaybackRateRequest {
pub playback_rate: f32,
}
impl fidl::Persistable for PlayerControlSetPlaybackRateRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PlayerControlSetRepeatModeRequest {
pub repeat_mode: RepeatMode,
}
impl fidl::Persistable for PlayerControlSetRepeatModeRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PlayerControlSetShuffleModeRequest {
pub shuffle_on: bool,
}
impl fidl::Persistable for PlayerControlSetShuffleModeRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct PlayerWatchInfoChangeResponse {
pub player_info_delta: PlayerInfoDelta,
}
impl fidl::Persistable for PlayerWatchInfoChangeResponse {}
#[derive(Debug, PartialEq)]
pub struct PublisherPublishRequest {
pub player: fidl::endpoints::ClientEnd<PlayerMarker>,
pub registration: PlayerRegistration,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PublisherPublishRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct PublisherPublishResponse {
pub session_id: u64,
}
impl fidl::Persistable for PublisherPublishResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SessionControlBindVolumeControlRequest {
pub volume_control_request:
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for SessionControlBindVolumeControlRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SessionControlSeekRequest {
pub position: i64,
}
impl fidl::Persistable for SessionControlSeekRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct SessionControlSetPlaybackRateRequest {
pub playback_rate: f32,
}
impl fidl::Persistable for SessionControlSetPlaybackRateRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SessionControlSetRepeatModeRequest {
pub repeat_mode: RepeatMode,
}
impl fidl::Persistable for SessionControlSetRepeatModeRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SessionControlSetShuffleModeRequest {
pub shuffle_on: bool,
}
impl fidl::Persistable for SessionControlSetShuffleModeRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct SessionControlWatchStatusResponse {
pub session_info_delta: SessionInfoDelta,
}
impl fidl::Persistable for SessionControlWatchStatusResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct SessionObserverWatchStatusResponse {
pub session_info_delta: SessionInfoDelta,
}
impl fidl::Persistable for SessionObserverWatchStatusResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SessionsWatcherSessionRemovedRequest {
pub session_id: u64,
}
impl fidl::Persistable for SessionsWatcherSessionRemovedRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct SessionsWatcherSessionUpdatedRequest {
pub session_id: u64,
pub session_info_delta: SessionInfoDelta,
}
impl fidl::Persistable for SessionsWatcherSessionUpdatedRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct MediaImage {
pub image_type: Option<MediaImageType>,
pub sizes: Option<Vec<ImageSizeVariant>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for MediaImage {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PlayerCapabilities {
pub flags: Option<PlayerCapabilityFlags>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PlayerCapabilities {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PlayerInfoDelta {
pub local: Option<bool>,
pub player_status: Option<PlayerStatus>,
pub metadata: Option<fidl_fuchsia_media::Metadata>,
pub media_images: Option<Vec<MediaImage>>,
pub player_capabilities: Option<PlayerCapabilities>,
pub interruption_behavior: Option<InterruptionBehavior>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PlayerInfoDelta {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PlayerRegistration {
pub domain: Option<String>,
pub usage: Option<fidl_fuchsia_media::AudioRenderUsage>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PlayerRegistration {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PlayerStatus {
pub duration: Option<i64>,
pub player_state: Option<PlayerState>,
pub timeline_function: Option<fidl_fuchsia_media::TimelineFunction>,
pub repeat_mode: Option<RepeatMode>,
pub shuffle_on: Option<bool>,
pub content_type: Option<ContentType>,
pub error: Option<Error>,
pub is_live: Option<bool>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PlayerStatus {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SessionInfoDelta {
pub domain: Option<String>,
pub is_local: Option<bool>,
pub is_locally_active: Option<bool>,
pub player_status: Option<PlayerStatus>,
pub metadata: Option<fidl_fuchsia_media::Metadata>,
pub media_images: Option<Vec<MediaImage>>,
pub player_capabilities: Option<PlayerCapabilities>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for SessionInfoDelta {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct WatchOptions {
pub only_active: Option<bool>,
pub allowed_sessions: Option<Vec<u64>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for WatchOptions {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ActiveSessionMarker;
impl fidl::endpoints::ProtocolMarker for ActiveSessionMarker {
type Proxy = ActiveSessionProxy;
type RequestStream = ActiveSessionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ActiveSessionSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.ActiveSession";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ActiveSessionMarker {}
pub trait ActiveSessionProxyInterface: Send + Sync {
type WatchActiveSessionResponseFut: std::future::Future<
Output = Result<Option<fidl::endpoints::ClientEnd<SessionControlMarker>>, fidl::Error>,
> + Send;
fn r#watch_active_session(&self) -> Self::WatchActiveSessionResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ActiveSessionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ActiveSessionSynchronousProxy {
type Proxy = ActiveSessionProxy;
type Protocol = ActiveSessionMarker;
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 ActiveSessionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ActiveSessionMarker 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<ActiveSessionEvent, fidl::Error> {
ActiveSessionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_active_session(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Option<fidl::endpoints::ClientEnd<SessionControlMarker>>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, ActiveSessionWatchActiveSessionResponse>(
(),
0xc072168d525fff8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.session)
}
}
#[derive(Debug, Clone)]
pub struct ActiveSessionProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ActiveSessionProxy {
type Protocol = ActiveSessionMarker;
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 ActiveSessionProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ActiveSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ActiveSessionEventStream {
ActiveSessionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_active_session(
&self,
) -> fidl::client::QueryResponseFut<
Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ActiveSessionProxyInterface::r#watch_active_session(self)
}
}
impl ActiveSessionProxyInterface for ActiveSessionProxy {
type WatchActiveSessionResponseFut = fidl::client::QueryResponseFut<
Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_active_session(&self) -> Self::WatchActiveSessionResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Option<fidl::endpoints::ClientEnd<SessionControlMarker>>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ActiveSessionWatchActiveSessionResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xc072168d525fff8,
>(_buf?)?;
Ok(_response.session)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
>(
(),
0xc072168d525fff8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ActiveSessionEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ActiveSessionEventStream {}
impl futures::stream::FusedStream for ActiveSessionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ActiveSessionEventStream {
type Item = Result<ActiveSessionEvent, 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(ActiveSessionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ActiveSessionEvent {}
impl ActiveSessionEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ActiveSessionEvent, 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: <ActiveSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ActiveSessionRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ActiveSessionRequestStream {}
impl futures::stream::FusedStream for ActiveSessionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ActiveSessionRequestStream {
type Protocol = ActiveSessionMarker;
type ControlHandle = ActiveSessionControlHandle;
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 {
ActiveSessionControlHandle { 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 ActiveSessionRequestStream {
type Item = Result<ActiveSessionRequest, 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 ActiveSessionRequestStream 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 {
0xc072168d525fff8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ActiveSessionControlHandle { inner: this.inner.clone() };
Ok(ActiveSessionRequest::WatchActiveSession {
responder: ActiveSessionWatchActiveSessionResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ActiveSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ActiveSessionRequest {
WatchActiveSession { responder: ActiveSessionWatchActiveSessionResponder },
}
impl ActiveSessionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_active_session(self) -> Option<(ActiveSessionWatchActiveSessionResponder)> {
if let ActiveSessionRequest::WatchActiveSession { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ActiveSessionRequest::WatchActiveSession { .. } => "watch_active_session",
}
}
}
#[derive(Debug, Clone)]
pub struct ActiveSessionControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ActiveSessionControlHandle {
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 ActiveSessionControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ActiveSessionWatchActiveSessionResponder {
control_handle: std::mem::ManuallyDrop<ActiveSessionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ActiveSessionWatchActiveSessionResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ActiveSessionWatchActiveSessionResponder {
type ControlHandle = ActiveSessionControlHandle;
fn control_handle(&self) -> &ActiveSessionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ActiveSessionWatchActiveSessionResponder {
pub fn send(
self,
mut session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(session);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(session);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ActiveSessionWatchActiveSessionResponse>(
(session,),
self.tx_id,
0xc072168d525fff8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DiscoveryMarker;
impl fidl::endpoints::ProtocolMarker for DiscoveryMarker {
type Proxy = DiscoveryProxy;
type RequestStream = DiscoveryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DiscoverySynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.Discovery";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DiscoveryMarker {}
pub trait DiscoveryProxyInterface: Send + Sync {
fn r#watch_sessions(
&self,
watch_options: &WatchOptions,
session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
) -> Result<(), fidl::Error>;
fn r#connect_to_session(
&self,
session_id: u64,
session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DiscoverySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DiscoverySynchronousProxy {
type Proxy = DiscoveryProxy;
type Protocol = DiscoveryMarker;
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 DiscoverySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DiscoveryMarker 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<DiscoveryEvent, fidl::Error> {
DiscoveryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_sessions(
&self,
mut watch_options: &WatchOptions,
mut session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DiscoveryWatchSessionsRequest>(
(watch_options, session_watcher),
0x4231b30d98dcd2fe,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#connect_to_session(
&self,
mut session_id: u64,
mut session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DiscoveryConnectToSessionRequest>(
(session_id, session_control_request),
0x37da54e09f63ca3d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct DiscoveryProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DiscoveryProxy {
type Protocol = DiscoveryMarker;
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 DiscoveryProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DiscoveryEventStream {
DiscoveryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_sessions(
&self,
mut watch_options: &WatchOptions,
mut session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
) -> Result<(), fidl::Error> {
DiscoveryProxyInterface::r#watch_sessions(self, watch_options, session_watcher)
}
pub fn r#connect_to_session(
&self,
mut session_id: u64,
mut session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
) -> Result<(), fidl::Error> {
DiscoveryProxyInterface::r#connect_to_session(self, session_id, session_control_request)
}
}
impl DiscoveryProxyInterface for DiscoveryProxy {
fn r#watch_sessions(
&self,
mut watch_options: &WatchOptions,
mut session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DiscoveryWatchSessionsRequest>(
(watch_options, session_watcher),
0x4231b30d98dcd2fe,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#connect_to_session(
&self,
mut session_id: u64,
mut session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DiscoveryConnectToSessionRequest>(
(session_id, session_control_request),
0x37da54e09f63ca3d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct DiscoveryEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DiscoveryEventStream {}
impl futures::stream::FusedStream for DiscoveryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DiscoveryEventStream {
type Item = Result<DiscoveryEvent, 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(DiscoveryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DiscoveryEvent {}
impl DiscoveryEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DiscoveryEvent, 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: <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DiscoveryRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DiscoveryRequestStream {}
impl futures::stream::FusedStream for DiscoveryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DiscoveryRequestStream {
type Protocol = DiscoveryMarker;
type ControlHandle = DiscoveryControlHandle;
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 {
DiscoveryControlHandle { 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 DiscoveryRequestStream {
type Item = Result<DiscoveryRequest, 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 DiscoveryRequestStream 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 {
0x4231b30d98dcd2fe => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
DiscoveryWatchSessionsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiscoveryWatchSessionsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DiscoveryControlHandle { inner: this.inner.clone() };
Ok(DiscoveryRequest::WatchSessions {
watch_options: req.watch_options,
session_watcher: req.session_watcher,
control_handle,
})
}
0x37da54e09f63ca3d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
DiscoveryConnectToSessionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiscoveryConnectToSessionRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DiscoveryControlHandle { inner: this.inner.clone() };
Ok(DiscoveryRequest::ConnectToSession {
session_id: req.session_id,
session_control_request: req.session_control_request,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DiscoveryRequest {
WatchSessions {
watch_options: WatchOptions,
session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
control_handle: DiscoveryControlHandle,
},
ConnectToSession {
session_id: u64,
session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
control_handle: DiscoveryControlHandle,
},
}
impl DiscoveryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_sessions(
self,
) -> Option<(
WatchOptions,
fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
DiscoveryControlHandle,
)> {
if let DiscoveryRequest::WatchSessions { watch_options, session_watcher, control_handle } =
self
{
Some((watch_options, session_watcher, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_session(
self,
) -> Option<(u64, fidl::endpoints::ServerEnd<SessionControlMarker>, DiscoveryControlHandle)>
{
if let DiscoveryRequest::ConnectToSession {
session_id,
session_control_request,
control_handle,
} = self
{
Some((session_id, session_control_request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DiscoveryRequest::WatchSessions { .. } => "watch_sessions",
DiscoveryRequest::ConnectToSession { .. } => "connect_to_session",
}
}
}
#[derive(Debug, Clone)]
pub struct DiscoveryControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DiscoveryControlHandle {
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 DiscoveryControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ObserverDiscoveryMarker;
impl fidl::endpoints::ProtocolMarker for ObserverDiscoveryMarker {
type Proxy = ObserverDiscoveryProxy;
type RequestStream = ObserverDiscoveryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ObserverDiscoverySynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.ObserverDiscovery";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ObserverDiscoveryMarker {}
pub trait ObserverDiscoveryProxyInterface: Send + Sync {
fn r#watch_sessions(
&self,
watch_options: &WatchOptions,
sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
) -> Result<(), fidl::Error>;
fn r#connect_to_session(
&self,
session_id: u64,
session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ObserverDiscoverySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ObserverDiscoverySynchronousProxy {
type Proxy = ObserverDiscoveryProxy;
type Protocol = ObserverDiscoveryMarker;
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 ObserverDiscoverySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ObserverDiscoveryMarker 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<ObserverDiscoveryEvent, fidl::Error> {
ObserverDiscoveryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_sessions(
&self,
mut watch_options: &WatchOptions,
mut sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ObserverDiscoveryWatchSessionsRequest>(
(watch_options, sessions_watcher),
0x3d95eaa20624a1fe,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#connect_to_session(
&self,
mut session_id: u64,
mut session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ObserverDiscoveryConnectToSessionRequest>(
(session_id, session_request),
0x2c9b99aacfaac87a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct ObserverDiscoveryProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ObserverDiscoveryProxy {
type Protocol = ObserverDiscoveryMarker;
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 ObserverDiscoveryProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ObserverDiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ObserverDiscoveryEventStream {
ObserverDiscoveryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_sessions(
&self,
mut watch_options: &WatchOptions,
mut sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
) -> Result<(), fidl::Error> {
ObserverDiscoveryProxyInterface::r#watch_sessions(self, watch_options, sessions_watcher)
}
pub fn r#connect_to_session(
&self,
mut session_id: u64,
mut session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
) -> Result<(), fidl::Error> {
ObserverDiscoveryProxyInterface::r#connect_to_session(self, session_id, session_request)
}
}
impl ObserverDiscoveryProxyInterface for ObserverDiscoveryProxy {
fn r#watch_sessions(
&self,
mut watch_options: &WatchOptions,
mut sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ObserverDiscoveryWatchSessionsRequest>(
(watch_options, sessions_watcher),
0x3d95eaa20624a1fe,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#connect_to_session(
&self,
mut session_id: u64,
mut session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ObserverDiscoveryConnectToSessionRequest>(
(session_id, session_request),
0x2c9b99aacfaac87a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct ObserverDiscoveryEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ObserverDiscoveryEventStream {}
impl futures::stream::FusedStream for ObserverDiscoveryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ObserverDiscoveryEventStream {
type Item = Result<ObserverDiscoveryEvent, 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(ObserverDiscoveryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ObserverDiscoveryEvent {}
impl ObserverDiscoveryEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ObserverDiscoveryEvent, 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:
<ObserverDiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ObserverDiscoveryRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ObserverDiscoveryRequestStream {}
impl futures::stream::FusedStream for ObserverDiscoveryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ObserverDiscoveryRequestStream {
type Protocol = ObserverDiscoveryMarker;
type ControlHandle = ObserverDiscoveryControlHandle;
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 {
ObserverDiscoveryControlHandle { 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 ObserverDiscoveryRequestStream {
type Item = Result<ObserverDiscoveryRequest, 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 ObserverDiscoveryRequestStream 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 {
0x3d95eaa20624a1fe => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ObserverDiscoveryWatchSessionsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ObserverDiscoveryWatchSessionsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ObserverDiscoveryControlHandle { inner: this.inner.clone() };
Ok(ObserverDiscoveryRequest::WatchSessions {
watch_options: req.watch_options,
sessions_watcher: req.sessions_watcher,
control_handle,
})
}
0x2c9b99aacfaac87a => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ObserverDiscoveryConnectToSessionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ObserverDiscoveryConnectToSessionRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ObserverDiscoveryControlHandle { inner: this.inner.clone() };
Ok(ObserverDiscoveryRequest::ConnectToSession {
session_id: req.session_id,
session_request: req.session_request,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ObserverDiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ObserverDiscoveryRequest {
WatchSessions {
watch_options: WatchOptions,
sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
control_handle: ObserverDiscoveryControlHandle,
},
ConnectToSession {
session_id: u64,
session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
control_handle: ObserverDiscoveryControlHandle,
},
}
impl ObserverDiscoveryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_sessions(
self,
) -> Option<(
WatchOptions,
fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
ObserverDiscoveryControlHandle,
)> {
if let ObserverDiscoveryRequest::WatchSessions {
watch_options,
sessions_watcher,
control_handle,
} = self
{
Some((watch_options, sessions_watcher, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_session(
self,
) -> Option<(
u64,
fidl::endpoints::ServerEnd<SessionObserverMarker>,
ObserverDiscoveryControlHandle,
)> {
if let ObserverDiscoveryRequest::ConnectToSession {
session_id,
session_request,
control_handle,
} = self
{
Some((session_id, session_request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ObserverDiscoveryRequest::WatchSessions { .. } => "watch_sessions",
ObserverDiscoveryRequest::ConnectToSession { .. } => "connect_to_session",
}
}
}
#[derive(Debug, Clone)]
pub struct ObserverDiscoveryControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ObserverDiscoveryControlHandle {
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 ObserverDiscoveryControlHandle {}
#[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 = "(anonymous) Player";
}
pub trait PlayerProxyInterface: Send + Sync {
fn r#play(&self) -> Result<(), fidl::Error>;
fn r#pause(&self) -> Result<(), fidl::Error>;
fn r#stop(&self) -> Result<(), fidl::Error>;
fn r#seek(&self, position: i64) -> Result<(), fidl::Error>;
fn r#skip_forward(&self) -> Result<(), fidl::Error>;
fn r#skip_reverse(&self) -> Result<(), fidl::Error>;
fn r#next_item(&self) -> Result<(), fidl::Error>;
fn r#prev_item(&self) -> Result<(), fidl::Error>;
fn r#set_playback_rate(&self, playback_rate: f32) -> Result<(), fidl::Error>;
fn r#set_repeat_mode(&self, repeat_mode: RepeatMode) -> Result<(), fidl::Error>;
fn r#set_shuffle_mode(&self, shuffle_on: bool) -> Result<(), fidl::Error>;
fn r#bind_volume_control(
&self,
volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error>;
type WatchInfoChangeResponseFut: std::future::Future<Output = Result<PlayerInfoDelta, fidl::Error>>
+ Send;
fn r#watch_info_change(&self) -> Self::WatchInfoChangeResponseFut;
}
#[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#play(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x164120d5bdb26f8e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#pause(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x1536d16f202ece1,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x1946e5fc6c2362ae,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSeekRequest>(
(position,),
0x4e7237d293e22125,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6ee04477076dac1b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0xa4e05644ce33a28,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#next_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x73307b32e35ff260,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x680444f03a759a3c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetPlaybackRateRequest>(
(playback_rate,),
0x3831b8b161e1bccf,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetRepeatModeRequest>(
(repeat_mode,),
0x21b9b1b17b7f01c2,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetShuffleModeRequest>(
(shuffle_on,),
0x7451a349ddb543c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlBindVolumeControlRequest>(
(volume_control_request,),
0x11d61e878cf808bc,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#watch_info_change(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PlayerInfoDelta, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, PlayerWatchInfoChangeResponse>(
(),
0x69196e240c62a732,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.player_info_delta)
}
}
#[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#play(&self) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#play(self)
}
pub fn r#pause(&self) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#pause(self)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#stop(self)
}
pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#seek(self, position)
}
pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#skip_forward(self)
}
pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#skip_reverse(self)
}
pub fn r#next_item(&self) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#next_item(self)
}
pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#prev_item(self)
}
pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#set_playback_rate(self, playback_rate)
}
pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#set_repeat_mode(self, repeat_mode)
}
pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#set_shuffle_mode(self, shuffle_on)
}
pub fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
PlayerProxyInterface::r#bind_volume_control(self, volume_control_request)
}
pub fn r#watch_info_change(
&self,
) -> fidl::client::QueryResponseFut<
PlayerInfoDelta,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PlayerProxyInterface::r#watch_info_change(self)
}
}
impl PlayerProxyInterface for PlayerProxy {
fn r#play(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x164120d5bdb26f8e,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#pause(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x1536d16f202ece1,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x1946e5fc6c2362ae,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSeekRequest>(
(position,),
0x4e7237d293e22125,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#skip_forward(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6ee04477076dac1b,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0xa4e05644ce33a28,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#next_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x73307b32e35ff260,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#prev_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x680444f03a759a3c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetPlaybackRateRequest>(
(playback_rate,),
0x3831b8b161e1bccf,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetRepeatModeRequest>(
(repeat_mode,),
0x21b9b1b17b7f01c2,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetShuffleModeRequest>(
(shuffle_on,),
0x7451a349ddb543c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlBindVolumeControlRequest>(
(volume_control_request,),
0x11d61e878cf808bc,
fidl::encoding::DynamicFlags::empty(),
)
}
type WatchInfoChangeResponseFut = fidl::client::QueryResponseFut<
PlayerInfoDelta,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_info_change(&self) -> Self::WatchInfoChangeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PlayerInfoDelta, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PlayerWatchInfoChangeResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x69196e240c62a732,
>(_buf?)?;
Ok(_response.player_info_delta)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlayerInfoDelta>(
(),
0x69196e240c62a732,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
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 {
0x164120d5bdb26f8e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::Play { control_handle })
}
0x1536d16f202ece1 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::Pause { control_handle })
}
0x1946e5fc6c2362ae => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::Stop { control_handle })
}
0x4e7237d293e22125 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerControlSeekRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSeekRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::Seek { position: req.position, control_handle })
}
0x6ee04477076dac1b => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::SkipForward { control_handle })
}
0xa4e05644ce33a28 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::SkipReverse { control_handle })
}
0x73307b32e35ff260 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::NextItem { control_handle })
}
0x680444f03a759a3c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::PrevItem { control_handle })
}
0x3831b8b161e1bccf => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerControlSetPlaybackRateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetPlaybackRateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::SetPlaybackRate {
playback_rate: req.playback_rate,
control_handle,
})
}
0x21b9b1b17b7f01c2 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerControlSetRepeatModeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetRepeatModeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::SetRepeatMode {
repeat_mode: req.repeat_mode,
control_handle,
})
}
0x7451a349ddb543c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerControlSetShuffleModeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetShuffleModeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::SetShuffleMode {
shuffle_on: req.shuffle_on,
control_handle,
})
}
0x11d61e878cf808bc => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerControlBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlBindVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::BindVolumeControl {
volume_control_request: req.volume_control_request,
control_handle,
})
}
0x69196e240c62a732 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PlayerControlHandle { inner: this.inner.clone() };
Ok(PlayerRequest::WatchInfoChange {
responder: PlayerWatchInfoChangeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PlayerRequest {
Play { control_handle: PlayerControlHandle },
Pause { control_handle: PlayerControlHandle },
Stop { control_handle: PlayerControlHandle },
Seek { position: i64, control_handle: PlayerControlHandle },
SkipForward { control_handle: PlayerControlHandle },
SkipReverse { control_handle: PlayerControlHandle },
NextItem { control_handle: PlayerControlHandle },
PrevItem { control_handle: PlayerControlHandle },
SetPlaybackRate { playback_rate: f32, control_handle: PlayerControlHandle },
SetRepeatMode { repeat_mode: RepeatMode, control_handle: PlayerControlHandle },
SetShuffleMode { shuffle_on: bool, control_handle: PlayerControlHandle },
BindVolumeControl {
volume_control_request:
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
control_handle: PlayerControlHandle,
},
WatchInfoChange { responder: PlayerWatchInfoChangeResponder },
}
impl PlayerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_play(self) -> Option<(PlayerControlHandle)> {
if let PlayerRequest::Play { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_pause(self) -> Option<(PlayerControlHandle)> {
if let PlayerRequest::Pause { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop(self) -> Option<(PlayerControlHandle)> {
if let PlayerRequest::Stop { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_seek(self) -> Option<(i64, PlayerControlHandle)> {
if let PlayerRequest::Seek { position, control_handle } = self {
Some((position, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_skip_forward(self) -> Option<(PlayerControlHandle)> {
if let PlayerRequest::SkipForward { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_skip_reverse(self) -> Option<(PlayerControlHandle)> {
if let PlayerRequest::SkipReverse { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_next_item(self) -> Option<(PlayerControlHandle)> {
if let PlayerRequest::NextItem { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_prev_item(self) -> Option<(PlayerControlHandle)> {
if let PlayerRequest::PrevItem { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_playback_rate(self) -> Option<(f32, PlayerControlHandle)> {
if let PlayerRequest::SetPlaybackRate { playback_rate, control_handle } = self {
Some((playback_rate, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_repeat_mode(self) -> Option<(RepeatMode, PlayerControlHandle)> {
if let PlayerRequest::SetRepeatMode { repeat_mode, control_handle } = self {
Some((repeat_mode, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_shuffle_mode(self) -> Option<(bool, PlayerControlHandle)> {
if let PlayerRequest::SetShuffleMode { shuffle_on, control_handle } = self {
Some((shuffle_on, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_bind_volume_control(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
PlayerControlHandle,
)> {
if let PlayerRequest::BindVolumeControl { volume_control_request, control_handle } = self {
Some((volume_control_request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_info_change(self) -> Option<(PlayerWatchInfoChangeResponder)> {
if let PlayerRequest::WatchInfoChange { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PlayerRequest::Play { .. } => "play",
PlayerRequest::Pause { .. } => "pause",
PlayerRequest::Stop { .. } => "stop",
PlayerRequest::Seek { .. } => "seek",
PlayerRequest::SkipForward { .. } => "skip_forward",
PlayerRequest::SkipReverse { .. } => "skip_reverse",
PlayerRequest::NextItem { .. } => "next_item",
PlayerRequest::PrevItem { .. } => "prev_item",
PlayerRequest::SetPlaybackRate { .. } => "set_playback_rate",
PlayerRequest::SetRepeatMode { .. } => "set_repeat_mode",
PlayerRequest::SetShuffleMode { .. } => "set_shuffle_mode",
PlayerRequest::BindVolumeControl { .. } => "bind_volume_control",
PlayerRequest::WatchInfoChange { .. } => "watch_info_change",
}
}
}
#[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 PlayerWatchInfoChangeResponder {
control_handle: std::mem::ManuallyDrop<PlayerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PlayerWatchInfoChangeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PlayerWatchInfoChangeResponder {
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 PlayerWatchInfoChangeResponder {
pub fn send(self, mut player_info_delta: &PlayerInfoDelta) -> Result<(), fidl::Error> {
let _result = self.send_raw(player_info_delta);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut player_info_delta: &PlayerInfoDelta,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(player_info_delta);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut player_info_delta: &PlayerInfoDelta) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PlayerWatchInfoChangeResponse>(
(player_info_delta,),
self.tx_id,
0x69196e240c62a732,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PlayerControlMarker;
impl fidl::endpoints::ProtocolMarker for PlayerControlMarker {
type Proxy = PlayerControlProxy;
type RequestStream = PlayerControlRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PlayerControlSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PlayerControl";
}
pub trait PlayerControlProxyInterface: Send + Sync {
fn r#play(&self) -> Result<(), fidl::Error>;
fn r#pause(&self) -> Result<(), fidl::Error>;
fn r#stop(&self) -> Result<(), fidl::Error>;
fn r#seek(&self, position: i64) -> Result<(), fidl::Error>;
fn r#skip_forward(&self) -> Result<(), fidl::Error>;
fn r#skip_reverse(&self) -> Result<(), fidl::Error>;
fn r#next_item(&self) -> Result<(), fidl::Error>;
fn r#prev_item(&self) -> Result<(), fidl::Error>;
fn r#set_playback_rate(&self, playback_rate: f32) -> Result<(), fidl::Error>;
fn r#set_repeat_mode(&self, repeat_mode: RepeatMode) -> Result<(), fidl::Error>;
fn r#set_shuffle_mode(&self, shuffle_on: bool) -> Result<(), fidl::Error>;
fn r#bind_volume_control(
&self,
volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PlayerControlSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PlayerControlSynchronousProxy {
type Proxy = PlayerControlProxy;
type Protocol = PlayerControlMarker;
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 PlayerControlSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PlayerControlMarker 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<PlayerControlEvent, fidl::Error> {
PlayerControlEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#play(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x164120d5bdb26f8e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#pause(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x1536d16f202ece1,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x1946e5fc6c2362ae,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSeekRequest>(
(position,),
0x4e7237d293e22125,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6ee04477076dac1b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0xa4e05644ce33a28,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#next_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x73307b32e35ff260,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x680444f03a759a3c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetPlaybackRateRequest>(
(playback_rate,),
0x3831b8b161e1bccf,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetRepeatModeRequest>(
(repeat_mode,),
0x21b9b1b17b7f01c2,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetShuffleModeRequest>(
(shuffle_on,),
0x7451a349ddb543c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlBindVolumeControlRequest>(
(volume_control_request,),
0x11d61e878cf808bc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct PlayerControlProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PlayerControlProxy {
type Protocol = PlayerControlMarker;
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 PlayerControlProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PlayerControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PlayerControlEventStream {
PlayerControlEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#play(&self) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#play(self)
}
pub fn r#pause(&self) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#pause(self)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#stop(self)
}
pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#seek(self, position)
}
pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#skip_forward(self)
}
pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#skip_reverse(self)
}
pub fn r#next_item(&self) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#next_item(self)
}
pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#prev_item(self)
}
pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#set_playback_rate(self, playback_rate)
}
pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#set_repeat_mode(self, repeat_mode)
}
pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#set_shuffle_mode(self, shuffle_on)
}
pub fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
PlayerControlProxyInterface::r#bind_volume_control(self, volume_control_request)
}
}
impl PlayerControlProxyInterface for PlayerControlProxy {
fn r#play(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x164120d5bdb26f8e,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#pause(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x1536d16f202ece1,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x1946e5fc6c2362ae,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSeekRequest>(
(position,),
0x4e7237d293e22125,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#skip_forward(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x6ee04477076dac1b,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0xa4e05644ce33a28,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#next_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x73307b32e35ff260,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#prev_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x680444f03a759a3c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetPlaybackRateRequest>(
(playback_rate,),
0x3831b8b161e1bccf,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetRepeatModeRequest>(
(repeat_mode,),
0x21b9b1b17b7f01c2,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlSetShuffleModeRequest>(
(shuffle_on,),
0x7451a349ddb543c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<PlayerControlBindVolumeControlRequest>(
(volume_control_request,),
0x11d61e878cf808bc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct PlayerControlEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PlayerControlEventStream {}
impl futures::stream::FusedStream for PlayerControlEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PlayerControlEventStream {
type Item = Result<PlayerControlEvent, 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(PlayerControlEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PlayerControlEvent {}
impl PlayerControlEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PlayerControlEvent, 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: <PlayerControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PlayerControlRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PlayerControlRequestStream {}
impl futures::stream::FusedStream for PlayerControlRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PlayerControlRequestStream {
type Protocol = PlayerControlMarker;
type ControlHandle = PlayerControlControlHandle;
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 {
PlayerControlControlHandle { 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 PlayerControlRequestStream {
type Item = Result<PlayerControlRequest, 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 PlayerControlRequestStream 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 {
0x164120d5bdb26f8e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::Play { control_handle })
}
0x1536d16f202ece1 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::Pause { control_handle })
}
0x1946e5fc6c2362ae => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::Stop { control_handle })
}
0x4e7237d293e22125 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerControlSeekRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSeekRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::Seek { position: req.position, control_handle })
}
0x6ee04477076dac1b => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::SkipForward { control_handle })
}
0xa4e05644ce33a28 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::SkipReverse { control_handle })
}
0x73307b32e35ff260 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::NextItem { control_handle })
}
0x680444f03a759a3c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::PrevItem { control_handle })
}
0x3831b8b161e1bccf => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerControlSetPlaybackRateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetPlaybackRateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::SetPlaybackRate {
playback_rate: req.playback_rate,
control_handle,
})
}
0x21b9b1b17b7f01c2 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerControlSetRepeatModeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetRepeatModeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::SetRepeatMode {
repeat_mode: req.repeat_mode,
control_handle,
})
}
0x7451a349ddb543c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerControlSetShuffleModeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetShuffleModeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::SetShuffleMode {
shuffle_on: req.shuffle_on,
control_handle,
})
}
0x11d61e878cf808bc => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PlayerControlBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlBindVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
PlayerControlControlHandle { inner: this.inner.clone() };
Ok(PlayerControlRequest::BindVolumeControl {
volume_control_request: req.volume_control_request,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PlayerControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PlayerControlRequest {
Play { control_handle: PlayerControlControlHandle },
Pause { control_handle: PlayerControlControlHandle },
Stop { control_handle: PlayerControlControlHandle },
Seek { position: i64, control_handle: PlayerControlControlHandle },
SkipForward { control_handle: PlayerControlControlHandle },
SkipReverse { control_handle: PlayerControlControlHandle },
NextItem { control_handle: PlayerControlControlHandle },
PrevItem { control_handle: PlayerControlControlHandle },
SetPlaybackRate { playback_rate: f32, control_handle: PlayerControlControlHandle },
SetRepeatMode { repeat_mode: RepeatMode, control_handle: PlayerControlControlHandle },
SetShuffleMode { shuffle_on: bool, control_handle: PlayerControlControlHandle },
BindVolumeControl {
volume_control_request:
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
control_handle: PlayerControlControlHandle,
},
}
impl PlayerControlRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_play(self) -> Option<(PlayerControlControlHandle)> {
if let PlayerControlRequest::Play { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_pause(self) -> Option<(PlayerControlControlHandle)> {
if let PlayerControlRequest::Pause { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop(self) -> Option<(PlayerControlControlHandle)> {
if let PlayerControlRequest::Stop { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_seek(self) -> Option<(i64, PlayerControlControlHandle)> {
if let PlayerControlRequest::Seek { position, control_handle } = self {
Some((position, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_skip_forward(self) -> Option<(PlayerControlControlHandle)> {
if let PlayerControlRequest::SkipForward { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_skip_reverse(self) -> Option<(PlayerControlControlHandle)> {
if let PlayerControlRequest::SkipReverse { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_next_item(self) -> Option<(PlayerControlControlHandle)> {
if let PlayerControlRequest::NextItem { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_prev_item(self) -> Option<(PlayerControlControlHandle)> {
if let PlayerControlRequest::PrevItem { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_playback_rate(self) -> Option<(f32, PlayerControlControlHandle)> {
if let PlayerControlRequest::SetPlaybackRate { playback_rate, control_handle } = self {
Some((playback_rate, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_repeat_mode(self) -> Option<(RepeatMode, PlayerControlControlHandle)> {
if let PlayerControlRequest::SetRepeatMode { repeat_mode, control_handle } = self {
Some((repeat_mode, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_shuffle_mode(self) -> Option<(bool, PlayerControlControlHandle)> {
if let PlayerControlRequest::SetShuffleMode { shuffle_on, control_handle } = self {
Some((shuffle_on, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_bind_volume_control(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
PlayerControlControlHandle,
)> {
if let PlayerControlRequest::BindVolumeControl { volume_control_request, control_handle } =
self
{
Some((volume_control_request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PlayerControlRequest::Play { .. } => "play",
PlayerControlRequest::Pause { .. } => "pause",
PlayerControlRequest::Stop { .. } => "stop",
PlayerControlRequest::Seek { .. } => "seek",
PlayerControlRequest::SkipForward { .. } => "skip_forward",
PlayerControlRequest::SkipReverse { .. } => "skip_reverse",
PlayerControlRequest::NextItem { .. } => "next_item",
PlayerControlRequest::PrevItem { .. } => "prev_item",
PlayerControlRequest::SetPlaybackRate { .. } => "set_playback_rate",
PlayerControlRequest::SetRepeatMode { .. } => "set_repeat_mode",
PlayerControlRequest::SetShuffleMode { .. } => "set_shuffle_mode",
PlayerControlRequest::BindVolumeControl { .. } => "bind_volume_control",
}
}
}
#[derive(Debug, Clone)]
pub struct PlayerControlControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PlayerControlControlHandle {
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 PlayerControlControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PublisherMarker;
impl fidl::endpoints::ProtocolMarker for PublisherMarker {
type Proxy = PublisherProxy;
type RequestStream = PublisherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PublisherSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.Publisher";
}
impl fidl::endpoints::DiscoverableProtocolMarker for PublisherMarker {}
pub trait PublisherProxyInterface: Send + Sync {
type PublishResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
fn r#publish(
&self,
player: fidl::endpoints::ClientEnd<PlayerMarker>,
registration: &PlayerRegistration,
) -> Self::PublishResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PublisherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PublisherSynchronousProxy {
type Proxy = PublisherProxy;
type Protocol = PublisherMarker;
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 PublisherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PublisherMarker 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<PublisherEvent, fidl::Error> {
PublisherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#publish(
&self,
mut player: fidl::endpoints::ClientEnd<PlayerMarker>,
mut registration: &PlayerRegistration,
___deadline: zx::MonotonicInstant,
) -> Result<u64, fidl::Error> {
let _response =
self.client.send_query::<PublisherPublishRequest, PublisherPublishResponse>(
(player, registration),
0x2e4a501ede5a1ad3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.session_id)
}
}
#[derive(Debug, Clone)]
pub struct PublisherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PublisherProxy {
type Protocol = PublisherMarker;
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 PublisherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PublisherEventStream {
PublisherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#publish(
&self,
mut player: fidl::endpoints::ClientEnd<PlayerMarker>,
mut registration: &PlayerRegistration,
) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
PublisherProxyInterface::r#publish(self, player, registration)
}
}
impl PublisherProxyInterface for PublisherProxy {
type PublishResponseFut =
fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#publish(
&self,
mut player: fidl::endpoints::ClientEnd<PlayerMarker>,
mut registration: &PlayerRegistration,
) -> Self::PublishResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<u64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PublisherPublishResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2e4a501ede5a1ad3,
>(_buf?)?;
Ok(_response.session_id)
}
self.client.send_query_and_decode::<PublisherPublishRequest, u64>(
(player, registration),
0x2e4a501ede5a1ad3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PublisherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PublisherEventStream {}
impl futures::stream::FusedStream for PublisherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PublisherEventStream {
type Item = Result<PublisherEvent, 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(PublisherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PublisherEvent {}
impl PublisherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PublisherEvent, 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: <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PublisherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PublisherRequestStream {}
impl futures::stream::FusedStream for PublisherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PublisherRequestStream {
type Protocol = PublisherMarker;
type ControlHandle = PublisherControlHandle;
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 {
PublisherControlHandle { 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 PublisherRequestStream {
type Item = Result<PublisherRequest, 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 PublisherRequestStream 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 {
0x2e4a501ede5a1ad3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PublisherPublishRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublisherPublishRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PublisherControlHandle { inner: this.inner.clone() };
Ok(PublisherRequest::Publish {
player: req.player,
registration: req.registration,
responder: PublisherPublishResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PublisherRequest {
Publish {
player: fidl::endpoints::ClientEnd<PlayerMarker>,
registration: PlayerRegistration,
responder: PublisherPublishResponder,
},
}
impl PublisherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_publish(
self,
) -> Option<(
fidl::endpoints::ClientEnd<PlayerMarker>,
PlayerRegistration,
PublisherPublishResponder,
)> {
if let PublisherRequest::Publish { player, registration, responder } = self {
Some((player, registration, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PublisherRequest::Publish { .. } => "publish",
}
}
}
#[derive(Debug, Clone)]
pub struct PublisherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PublisherControlHandle {
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 PublisherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PublisherPublishResponder {
control_handle: std::mem::ManuallyDrop<PublisherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PublisherPublishResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PublisherPublishResponder {
type ControlHandle = PublisherControlHandle;
fn control_handle(&self) -> &PublisherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PublisherPublishResponder {
pub fn send(self, mut session_id: u64) -> Result<(), fidl::Error> {
let _result = self.send_raw(session_id);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut session_id: u64) -> Result<(), fidl::Error> {
let _result = self.send_raw(session_id);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut session_id: u64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PublisherPublishResponse>(
(session_id,),
self.tx_id,
0x2e4a501ede5a1ad3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SessionControlMarker;
impl fidl::endpoints::ProtocolMarker for SessionControlMarker {
type Proxy = SessionControlProxy;
type RequestStream = SessionControlRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SessionControlSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) SessionControl";
}
pub trait SessionControlProxyInterface: Send + Sync {
fn r#play(&self) -> Result<(), fidl::Error>;
fn r#pause(&self) -> Result<(), fidl::Error>;
fn r#stop(&self) -> Result<(), fidl::Error>;
fn r#seek(&self, position: i64) -> Result<(), fidl::Error>;
fn r#skip_forward(&self) -> Result<(), fidl::Error>;
fn r#skip_reverse(&self) -> Result<(), fidl::Error>;
fn r#next_item(&self) -> Result<(), fidl::Error>;
fn r#prev_item(&self) -> Result<(), fidl::Error>;
fn r#set_playback_rate(&self, playback_rate: f32) -> Result<(), fidl::Error>;
fn r#set_repeat_mode(&self, repeat_mode: RepeatMode) -> Result<(), fidl::Error>;
fn r#set_shuffle_mode(&self, shuffle_on: bool) -> Result<(), fidl::Error>;
fn r#bind_volume_control(
&self,
volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error>;
type WatchStatusResponseFut: std::future::Future<Output = Result<SessionInfoDelta, fidl::Error>>
+ Send;
fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SessionControlSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SessionControlSynchronousProxy {
type Proxy = SessionControlProxy;
type Protocol = SessionControlMarker;
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 SessionControlSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SessionControlMarker 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<SessionControlEvent, fidl::Error> {
SessionControlEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#play(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x43c91c558f7b2946,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#pause(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x4e2d75c91ff7d22d,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x53da6661beb2e817,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
self.client.send::<SessionControlSeekRequest>(
(position,),
0x380280556aba53d4,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x3674bb00f0f12079,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x5edc786c1a6b087c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#next_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x13cab0e8bc316138,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x7f7150e8bd6082cc,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
self.client.send::<SessionControlSetPlaybackRateRequest>(
(playback_rate,),
0x3e382e2b70c5121d,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
self.client.send::<SessionControlSetRepeatModeRequest>(
(repeat_mode,),
0x29381bedf7f29e5,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
self.client.send::<SessionControlSetShuffleModeRequest>(
(shuffle_on,),
0x34d8d4c0f35e89e,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<SessionControlBindVolumeControlRequest>(
(volume_control_request,),
0x1e3c091a08e88710,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#watch_status(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<SessionInfoDelta, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, SessionControlWatchStatusResponse>(
(),
0x4ce5727251eb4b74,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.session_info_delta)
}
}
#[derive(Debug, Clone)]
pub struct SessionControlProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SessionControlProxy {
type Protocol = SessionControlMarker;
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 SessionControlProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SessionControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SessionControlEventStream {
SessionControlEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#play(&self) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#play(self)
}
pub fn r#pause(&self) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#pause(self)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#stop(self)
}
pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#seek(self, position)
}
pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#skip_forward(self)
}
pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#skip_reverse(self)
}
pub fn r#next_item(&self) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#next_item(self)
}
pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#prev_item(self)
}
pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#set_playback_rate(self, playback_rate)
}
pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#set_repeat_mode(self, repeat_mode)
}
pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#set_shuffle_mode(self, shuffle_on)
}
pub fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
SessionControlProxyInterface::r#bind_volume_control(self, volume_control_request)
}
pub fn r#watch_status(
&self,
) -> fidl::client::QueryResponseFut<
SessionInfoDelta,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SessionControlProxyInterface::r#watch_status(self)
}
}
impl SessionControlProxyInterface for SessionControlProxy {
fn r#play(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x43c91c558f7b2946,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#pause(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x4e2d75c91ff7d22d,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x53da6661beb2e817,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
self.client.send::<SessionControlSeekRequest>(
(position,),
0x380280556aba53d4,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#skip_forward(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x3674bb00f0f12079,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x5edc786c1a6b087c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#next_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x13cab0e8bc316138,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#prev_item(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x7f7150e8bd6082cc,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
self.client.send::<SessionControlSetPlaybackRateRequest>(
(playback_rate,),
0x3e382e2b70c5121d,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
self.client.send::<SessionControlSetRepeatModeRequest>(
(repeat_mode,),
0x29381bedf7f29e5,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
self.client.send::<SessionControlSetShuffleModeRequest>(
(shuffle_on,),
0x34d8d4c0f35e89e,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#bind_volume_control(
&self,
mut volume_control_request: fidl::endpoints::ServerEnd<
fidl_fuchsia_media_audio::VolumeControlMarker,
>,
) -> Result<(), fidl::Error> {
self.client.send::<SessionControlBindVolumeControlRequest>(
(volume_control_request,),
0x1e3c091a08e88710,
fidl::encoding::DynamicFlags::empty(),
)
}
type WatchStatusResponseFut = fidl::client::QueryResponseFut<
SessionInfoDelta,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SessionInfoDelta, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
SessionControlWatchStatusResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4ce5727251eb4b74,
>(_buf?)?;
Ok(_response.session_info_delta)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionInfoDelta>(
(),
0x4ce5727251eb4b74,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct SessionControlEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SessionControlEventStream {}
impl futures::stream::FusedStream for SessionControlEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SessionControlEventStream {
type Item = Result<SessionControlEvent, 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(SessionControlEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SessionControlEvent {}
impl SessionControlEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SessionControlEvent, 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:
<SessionControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SessionControlRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SessionControlRequestStream {}
impl futures::stream::FusedStream for SessionControlRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SessionControlRequestStream {
type Protocol = SessionControlMarker;
type ControlHandle = SessionControlControlHandle;
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 {
SessionControlControlHandle { 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 SessionControlRequestStream {
type Item = Result<SessionControlRequest, 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 SessionControlRequestStream 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 {
0x43c91c558f7b2946 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::Play { control_handle })
}
0x4e2d75c91ff7d22d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::Pause { control_handle })
}
0x53da6661beb2e817 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::Stop { control_handle })
}
0x380280556aba53d4 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
SessionControlSeekRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSeekRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::Seek { position: req.position, control_handle })
}
0x3674bb00f0f12079 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::SkipForward { control_handle })
}
0x5edc786c1a6b087c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::SkipReverse { control_handle })
}
0x13cab0e8bc316138 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::NextItem { control_handle })
}
0x7f7150e8bd6082cc => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::PrevItem { control_handle })
}
0x3e382e2b70c5121d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
SessionControlSetPlaybackRateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSetPlaybackRateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::SetPlaybackRate {
playback_rate: req.playback_rate,
control_handle,
})
}
0x29381bedf7f29e5 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
SessionControlSetRepeatModeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSetRepeatModeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::SetRepeatMode {
repeat_mode: req.repeat_mode,
control_handle,
})
}
0x34d8d4c0f35e89e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
SessionControlSetShuffleModeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSetShuffleModeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::SetShuffleMode {
shuffle_on: req.shuffle_on,
control_handle,
})
}
0x1e3c091a08e88710 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
SessionControlBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlBindVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::BindVolumeControl {
volume_control_request: req.volume_control_request,
control_handle,
})
}
0x4ce5727251eb4b74 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionControlControlHandle { inner: this.inner.clone() };
Ok(SessionControlRequest::WatchStatus {
responder: SessionControlWatchStatusResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SessionControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SessionControlRequest {
Play { control_handle: SessionControlControlHandle },
Pause { control_handle: SessionControlControlHandle },
Stop { control_handle: SessionControlControlHandle },
Seek { position: i64, control_handle: SessionControlControlHandle },
SkipForward { control_handle: SessionControlControlHandle },
SkipReverse { control_handle: SessionControlControlHandle },
NextItem { control_handle: SessionControlControlHandle },
PrevItem { control_handle: SessionControlControlHandle },
SetPlaybackRate { playback_rate: f32, control_handle: SessionControlControlHandle },
SetRepeatMode { repeat_mode: RepeatMode, control_handle: SessionControlControlHandle },
SetShuffleMode { shuffle_on: bool, control_handle: SessionControlControlHandle },
BindVolumeControl {
volume_control_request:
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
control_handle: SessionControlControlHandle,
},
WatchStatus { responder: SessionControlWatchStatusResponder },
}
impl SessionControlRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_play(self) -> Option<(SessionControlControlHandle)> {
if let SessionControlRequest::Play { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_pause(self) -> Option<(SessionControlControlHandle)> {
if let SessionControlRequest::Pause { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop(self) -> Option<(SessionControlControlHandle)> {
if let SessionControlRequest::Stop { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_seek(self) -> Option<(i64, SessionControlControlHandle)> {
if let SessionControlRequest::Seek { position, control_handle } = self {
Some((position, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_skip_forward(self) -> Option<(SessionControlControlHandle)> {
if let SessionControlRequest::SkipForward { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_skip_reverse(self) -> Option<(SessionControlControlHandle)> {
if let SessionControlRequest::SkipReverse { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_next_item(self) -> Option<(SessionControlControlHandle)> {
if let SessionControlRequest::NextItem { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_prev_item(self) -> Option<(SessionControlControlHandle)> {
if let SessionControlRequest::PrevItem { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_playback_rate(self) -> Option<(f32, SessionControlControlHandle)> {
if let SessionControlRequest::SetPlaybackRate { playback_rate, control_handle } = self {
Some((playback_rate, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_repeat_mode(self) -> Option<(RepeatMode, SessionControlControlHandle)> {
if let SessionControlRequest::SetRepeatMode { repeat_mode, control_handle } = self {
Some((repeat_mode, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_shuffle_mode(self) -> Option<(bool, SessionControlControlHandle)> {
if let SessionControlRequest::SetShuffleMode { shuffle_on, control_handle } = self {
Some((shuffle_on, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_bind_volume_control(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
SessionControlControlHandle,
)> {
if let SessionControlRequest::BindVolumeControl { volume_control_request, control_handle } =
self
{
Some((volume_control_request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_status(self) -> Option<(SessionControlWatchStatusResponder)> {
if let SessionControlRequest::WatchStatus { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SessionControlRequest::Play { .. } => "play",
SessionControlRequest::Pause { .. } => "pause",
SessionControlRequest::Stop { .. } => "stop",
SessionControlRequest::Seek { .. } => "seek",
SessionControlRequest::SkipForward { .. } => "skip_forward",
SessionControlRequest::SkipReverse { .. } => "skip_reverse",
SessionControlRequest::NextItem { .. } => "next_item",
SessionControlRequest::PrevItem { .. } => "prev_item",
SessionControlRequest::SetPlaybackRate { .. } => "set_playback_rate",
SessionControlRequest::SetRepeatMode { .. } => "set_repeat_mode",
SessionControlRequest::SetShuffleMode { .. } => "set_shuffle_mode",
SessionControlRequest::BindVolumeControl { .. } => "bind_volume_control",
SessionControlRequest::WatchStatus { .. } => "watch_status",
}
}
}
#[derive(Debug, Clone)]
pub struct SessionControlControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SessionControlControlHandle {
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 SessionControlControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SessionControlWatchStatusResponder {
control_handle: std::mem::ManuallyDrop<SessionControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SessionControlWatchStatusResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SessionControlWatchStatusResponder {
type ControlHandle = SessionControlControlHandle;
fn control_handle(&self) -> &SessionControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SessionControlWatchStatusResponder {
pub fn send(self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
let _result = self.send_raw(session_info_delta);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut session_info_delta: &SessionInfoDelta,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(session_info_delta);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<SessionControlWatchStatusResponse>(
(session_info_delta,),
self.tx_id,
0x4ce5727251eb4b74,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SessionObserverMarker;
impl fidl::endpoints::ProtocolMarker for SessionObserverMarker {
type Proxy = SessionObserverProxy;
type RequestStream = SessionObserverRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SessionObserverSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) SessionObserver";
}
pub trait SessionObserverProxyInterface: Send + Sync {
type WatchStatusResponseFut: std::future::Future<Output = Result<SessionInfoDelta, fidl::Error>>
+ Send;
fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SessionObserverSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SessionObserverSynchronousProxy {
type Proxy = SessionObserverProxy;
type Protocol = SessionObserverMarker;
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 SessionObserverSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SessionObserverMarker 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<SessionObserverEvent, fidl::Error> {
SessionObserverEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#watch_status(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<SessionInfoDelta, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, SessionObserverWatchStatusResponse>(
(),
0x24618b709ca18f4d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.session_info_delta)
}
}
#[derive(Debug, Clone)]
pub struct SessionObserverProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SessionObserverProxy {
type Protocol = SessionObserverMarker;
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 SessionObserverProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SessionObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SessionObserverEventStream {
SessionObserverEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#watch_status(
&self,
) -> fidl::client::QueryResponseFut<
SessionInfoDelta,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SessionObserverProxyInterface::r#watch_status(self)
}
}
impl SessionObserverProxyInterface for SessionObserverProxy {
type WatchStatusResponseFut = fidl::client::QueryResponseFut<
SessionInfoDelta,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SessionInfoDelta, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
SessionObserverWatchStatusResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x24618b709ca18f4d,
>(_buf?)?;
Ok(_response.session_info_delta)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionInfoDelta>(
(),
0x24618b709ca18f4d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct SessionObserverEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SessionObserverEventStream {}
impl futures::stream::FusedStream for SessionObserverEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SessionObserverEventStream {
type Item = Result<SessionObserverEvent, 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(SessionObserverEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SessionObserverEvent {}
impl SessionObserverEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SessionObserverEvent, 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:
<SessionObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SessionObserverRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SessionObserverRequestStream {}
impl futures::stream::FusedStream for SessionObserverRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SessionObserverRequestStream {
type Protocol = SessionObserverMarker;
type ControlHandle = SessionObserverControlHandle;
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 {
SessionObserverControlHandle { 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 SessionObserverRequestStream {
type Item = Result<SessionObserverRequest, 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 SessionObserverRequestStream 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 {
0x24618b709ca18f4d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionObserverControlHandle { inner: this.inner.clone() };
Ok(SessionObserverRequest::WatchStatus {
responder: SessionObserverWatchStatusResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SessionObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SessionObserverRequest {
WatchStatus { responder: SessionObserverWatchStatusResponder },
}
impl SessionObserverRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_watch_status(self) -> Option<(SessionObserverWatchStatusResponder)> {
if let SessionObserverRequest::WatchStatus { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SessionObserverRequest::WatchStatus { .. } => "watch_status",
}
}
}
#[derive(Debug, Clone)]
pub struct SessionObserverControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SessionObserverControlHandle {
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 SessionObserverControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SessionObserverWatchStatusResponder {
control_handle: std::mem::ManuallyDrop<SessionObserverControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SessionObserverWatchStatusResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SessionObserverWatchStatusResponder {
type ControlHandle = SessionObserverControlHandle;
fn control_handle(&self) -> &SessionObserverControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SessionObserverWatchStatusResponder {
pub fn send(self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
let _result = self.send_raw(session_info_delta);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut session_info_delta: &SessionInfoDelta,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(session_info_delta);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<SessionObserverWatchStatusResponse>(
(session_info_delta,),
self.tx_id,
0x24618b709ca18f4d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SessionsWatcherMarker;
impl fidl::endpoints::ProtocolMarker for SessionsWatcherMarker {
type Proxy = SessionsWatcherProxy;
type RequestStream = SessionsWatcherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SessionsWatcherSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) SessionsWatcher";
}
pub trait SessionsWatcherProxyInterface: Send + Sync {
type SessionUpdatedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#session_updated(
&self,
session_id: u64,
session_info_delta: &SessionInfoDelta,
) -> Self::SessionUpdatedResponseFut;
type SessionRemovedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#session_removed(&self, session_id: u64) -> Self::SessionRemovedResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SessionsWatcherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SessionsWatcherSynchronousProxy {
type Proxy = SessionsWatcherProxy;
type Protocol = SessionsWatcherMarker;
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 SessionsWatcherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SessionsWatcherMarker 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<SessionsWatcherEvent, fidl::Error> {
SessionsWatcherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#session_updated(
&self,
mut session_id: u64,
mut session_info_delta: &SessionInfoDelta,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<SessionsWatcherSessionUpdatedRequest, fidl::encoding::EmptyPayload>(
(session_id, session_info_delta),
0x47d25ef93c58c2d9,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#session_removed(
&self,
mut session_id: u64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<SessionsWatcherSessionRemovedRequest, fidl::encoding::EmptyPayload>(
(session_id,),
0x407556ecd5a2400e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct SessionsWatcherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SessionsWatcherProxy {
type Protocol = SessionsWatcherMarker;
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 SessionsWatcherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SessionsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SessionsWatcherEventStream {
SessionsWatcherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#session_updated(
&self,
mut session_id: u64,
mut session_info_delta: &SessionInfoDelta,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
SessionsWatcherProxyInterface::r#session_updated(self, session_id, session_info_delta)
}
pub fn r#session_removed(
&self,
mut session_id: u64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
SessionsWatcherProxyInterface::r#session_removed(self, session_id)
}
}
impl SessionsWatcherProxyInterface for SessionsWatcherProxy {
type SessionUpdatedResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#session_updated(
&self,
mut session_id: u64,
mut session_info_delta: &SessionInfoDelta,
) -> Self::SessionUpdatedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x47d25ef93c58c2d9,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<SessionsWatcherSessionUpdatedRequest, ()>(
(session_id, session_info_delta),
0x47d25ef93c58c2d9,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SessionRemovedResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#session_removed(&self, mut session_id: u64) -> Self::SessionRemovedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x407556ecd5a2400e,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<SessionsWatcherSessionRemovedRequest, ()>(
(session_id,),
0x407556ecd5a2400e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct SessionsWatcherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SessionsWatcherEventStream {}
impl futures::stream::FusedStream for SessionsWatcherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SessionsWatcherEventStream {
type Item = Result<SessionsWatcherEvent, 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(SessionsWatcherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SessionsWatcherEvent {}
impl SessionsWatcherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SessionsWatcherEvent, 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:
<SessionsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SessionsWatcherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SessionsWatcherRequestStream {}
impl futures::stream::FusedStream for SessionsWatcherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SessionsWatcherRequestStream {
type Protocol = SessionsWatcherMarker;
type ControlHandle = SessionsWatcherControlHandle;
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 {
SessionsWatcherControlHandle { 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 SessionsWatcherRequestStream {
type Item = Result<SessionsWatcherRequest, 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 SessionsWatcherRequestStream 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 {
0x47d25ef93c58c2d9 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SessionsWatcherSessionUpdatedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionsWatcherSessionUpdatedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionsWatcherControlHandle { inner: this.inner.clone() };
Ok(SessionsWatcherRequest::SessionUpdated {
session_id: req.session_id,
session_info_delta: req.session_info_delta,
responder: SessionsWatcherSessionUpdatedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x407556ecd5a2400e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SessionsWatcherSessionRemovedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionsWatcherSessionRemovedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SessionsWatcherControlHandle { inner: this.inner.clone() };
Ok(SessionsWatcherRequest::SessionRemoved {
session_id: req.session_id,
responder: SessionsWatcherSessionRemovedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SessionsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SessionsWatcherRequest {
SessionUpdated {
session_id: u64,
session_info_delta: SessionInfoDelta,
responder: SessionsWatcherSessionUpdatedResponder,
},
SessionRemoved { session_id: u64, responder: SessionsWatcherSessionRemovedResponder },
}
impl SessionsWatcherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_session_updated(
self,
) -> Option<(u64, SessionInfoDelta, SessionsWatcherSessionUpdatedResponder)> {
if let SessionsWatcherRequest::SessionUpdated {
session_id,
session_info_delta,
responder,
} = self
{
Some((session_id, session_info_delta, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_session_removed(self) -> Option<(u64, SessionsWatcherSessionRemovedResponder)> {
if let SessionsWatcherRequest::SessionRemoved { session_id, responder } = self {
Some((session_id, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SessionsWatcherRequest::SessionUpdated { .. } => "session_updated",
SessionsWatcherRequest::SessionRemoved { .. } => "session_removed",
}
}
}
#[derive(Debug, Clone)]
pub struct SessionsWatcherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SessionsWatcherControlHandle {
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 SessionsWatcherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SessionsWatcherSessionUpdatedResponder {
control_handle: std::mem::ManuallyDrop<SessionsWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SessionsWatcherSessionUpdatedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SessionsWatcherSessionUpdatedResponder {
type ControlHandle = SessionsWatcherControlHandle;
fn control_handle(&self) -> &SessionsWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SessionsWatcherSessionUpdatedResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x47d25ef93c58c2d9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SessionsWatcherSessionRemovedResponder {
control_handle: std::mem::ManuallyDrop<SessionsWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SessionsWatcherSessionRemovedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SessionsWatcherSessionRemovedResponder {
type ControlHandle = SessionsWatcherControlHandle;
fn control_handle(&self) -> &SessionsWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SessionsWatcherSessionRemovedResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x407556ecd5a2400e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for PlayerCapabilityFlags {
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
}
}
impl fidl::encoding::ValueTypeMarker for PlayerCapabilityFlags {
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 PlayerCapabilityFlags
{
#[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);
if self.bits() & Self::all().bits() != self.bits() {
return Err(fidl::Error::InvalidBitsValue);
}
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerCapabilityFlags {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[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_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ContentType {
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 ContentType {
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 ContentType {
#[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 ContentType {
#[inline(always)]
fn new_empty() -> Self {
Self::Other
}
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for Error {
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 Error {
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 Error {
#[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 Error {
#[inline(always)]
fn new_empty() -> Self {
Self::Other
}
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for InterruptionBehavior {
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 InterruptionBehavior {
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 InterruptionBehavior
{
#[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 InterruptionBehavior {
#[inline(always)]
fn new_empty() -> Self {
Self::None
}
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for MediaImageType {
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 MediaImageType {
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 MediaImageType {
#[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 MediaImageType {
#[inline(always)]
fn new_empty() -> Self {
Self::Artwork
}
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerState {
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 PlayerState {
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 PlayerState {
#[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 PlayerState {
#[inline(always)]
fn new_empty() -> Self {
Self::Idle
}
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for RepeatMode {
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 RepeatMode {
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 RepeatMode {
#[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 RepeatMode {
#[inline(always)]
fn new_empty() -> Self {
Self::Off
}
#[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 ActiveSessionWatchActiveSessionResponse {
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 ActiveSessionWatchActiveSessionResponse {
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
}
}
unsafe impl
fidl::encoding::Encode<
ActiveSessionWatchActiveSessionResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ActiveSessionWatchActiveSessionResponse
{
#[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::<ActiveSessionWatchActiveSessionResponse>(offset);
fidl::encoding::Encode::<
ActiveSessionWatchActiveSessionResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.session
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ActiveSessionWatchActiveSessionResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[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::<ActiveSessionWatchActiveSessionResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ActiveSessionWatchActiveSessionResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
session: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
>,
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!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.session,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DiscoveryConnectToSessionRequest {
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 DiscoveryConnectToSessionRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
DiscoveryConnectToSessionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DiscoveryConnectToSessionRequest
{
#[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::<DiscoveryConnectToSessionRequest>(offset);
fidl::encoding::Encode::<DiscoveryConnectToSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session_control_request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DiscoveryConnectToSessionRequest,
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::<DiscoveryConnectToSessionRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DiscoveryConnectToSessionRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
session_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
session_control_request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>>,
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(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.session_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.session_control_request,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DiscoveryWatchSessionsRequest {
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 DiscoveryWatchSessionsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
DiscoveryWatchSessionsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DiscoveryWatchSessionsRequest
{
#[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::<DiscoveryWatchSessionsRequest>(offset);
fidl::encoding::Encode::<DiscoveryWatchSessionsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<WatchOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.watch_options),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session_watcher),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<WatchOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DiscoveryWatchSessionsRequest,
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::<DiscoveryWatchSessionsRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DiscoveryWatchSessionsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
watch_options: fidl::new_empty!(
WatchOptions,
fidl::encoding::DefaultFuchsiaResourceDialect
),
session_watcher: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
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(16) };
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 + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
WatchOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.watch_options,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.session_watcher,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ImageSizeVariant {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ImageSizeVariant {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ImageSizeVariant, D>
for &ImageSizeVariant
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ImageSizeVariant>(offset);
fidl::encoding::Encode::<ImageSizeVariant, D>::encode(
(
<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.height),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
T1: fidl::encoding::Encode<u32, D>,
T2: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<ImageSizeVariant, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ImageSizeVariant>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 20, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImageSizeVariant {
#[inline(always)]
fn new_empty() -> Self {
Self {
url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D),
width: fidl::new_empty!(u32, D),
height: 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);
fidl::decode!(
fidl::encoding::BoundedString<4096>,
D,
&mut self.url,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u32, D, &mut self.width, decoder, offset + 16, _depth)?;
fidl::decode!(u32, D, &mut self.height, decoder, offset + 20, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ObserverDiscoveryConnectToSessionRequest {
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 ObserverDiscoveryConnectToSessionRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
ObserverDiscoveryConnectToSessionRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ObserverDiscoveryConnectToSessionRequest
{
#[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::<ObserverDiscoveryConnectToSessionRequest>(offset);
fidl::encoding::Encode::<ObserverDiscoveryConnectToSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session_request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ObserverDiscoveryConnectToSessionRequest,
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::<ObserverDiscoveryConnectToSessionRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ObserverDiscoveryConnectToSessionRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
session_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
session_request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>>,
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(8) };
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 + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.session_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.session_request,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ObserverDiscoveryWatchSessionsRequest {
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 ObserverDiscoveryWatchSessionsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
ObserverDiscoveryWatchSessionsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ObserverDiscoveryWatchSessionsRequest
{
#[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::<ObserverDiscoveryWatchSessionsRequest>(offset);
fidl::encoding::Encode::<ObserverDiscoveryWatchSessionsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<WatchOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.watch_options),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.sessions_watcher),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<WatchOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ObserverDiscoveryWatchSessionsRequest,
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::<ObserverDiscoveryWatchSessionsRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ObserverDiscoveryWatchSessionsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
watch_options: fidl::new_empty!(
WatchOptions,
fidl::encoding::DefaultFuchsiaResourceDialect
),
sessions_watcher: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
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(16) };
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 + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
WatchOptions,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.watch_options,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.sessions_watcher,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PlayerControlBindVolumeControlRequest {
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 PlayerControlBindVolumeControlRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
PlayerControlBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PlayerControlBindVolumeControlRequest
{
#[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::<PlayerControlBindVolumeControlRequest>(offset);
fidl::encoding::Encode::<
PlayerControlBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.volume_control_request,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PlayerControlBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[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::<PlayerControlBindVolumeControlRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PlayerControlBindVolumeControlRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
volume_control_request: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
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!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.volume_control_request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PlayerControlSeekRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerControlSeekRequest {
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<PlayerControlSeekRequest, D> for &PlayerControlSeekRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerControlSeekRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PlayerControlSeekRequest)
.write_unaligned((self as *const PlayerControlSeekRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<PlayerControlSeekRequest, 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::<PlayerControlSeekRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PlayerControlSeekRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { position: 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(())
}
}
impl fidl::encoding::ValueTypeMarker for PlayerControlSetPlaybackRateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerControlSetPlaybackRateRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PlayerControlSetPlaybackRateRequest, D>
for &PlayerControlSetPlaybackRateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerControlSetPlaybackRateRequest>(offset);
fidl::encoding::Encode::<PlayerControlSetPlaybackRateRequest, D>::encode(
(<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.playback_rate),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
fidl::encoding::Encode<PlayerControlSetPlaybackRateRequest, 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::<PlayerControlSetPlaybackRateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PlayerControlSetPlaybackRateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { playback_rate: fidl::new_empty!(f32, 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!(f32, D, &mut self.playback_rate, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PlayerControlSetRepeatModeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerControlSetRepeatModeRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PlayerControlSetRepeatModeRequest, D>
for &PlayerControlSetRepeatModeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerControlSetRepeatModeRequest>(offset);
fidl::encoding::Encode::<PlayerControlSetRepeatModeRequest, D>::encode(
(<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow(&self.repeat_mode),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RepeatMode, D>>
fidl::encoding::Encode<PlayerControlSetRepeatModeRequest, 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::<PlayerControlSetRepeatModeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PlayerControlSetRepeatModeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { repeat_mode: fidl::new_empty!(RepeatMode, 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!(RepeatMode, D, &mut self.repeat_mode, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PlayerControlSetShuffleModeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerControlSetShuffleModeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PlayerControlSetShuffleModeRequest, D>
for &PlayerControlSetShuffleModeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerControlSetShuffleModeRequest>(offset);
fidl::encoding::Encode::<PlayerControlSetShuffleModeRequest, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.shuffle_on),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<PlayerControlSetShuffleModeRequest, 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::<PlayerControlSetShuffleModeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PlayerControlSetShuffleModeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { shuffle_on: fidl::new_empty!(bool, 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!(bool, D, &mut self.shuffle_on, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PlayerWatchInfoChangeResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerWatchInfoChangeResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PlayerWatchInfoChangeResponse, D>
for &PlayerWatchInfoChangeResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerWatchInfoChangeResponse>(offset);
fidl::encoding::Encode::<PlayerWatchInfoChangeResponse, D>::encode(
(<PlayerInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
&self.player_info_delta,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PlayerInfoDelta, D>>
fidl::encoding::Encode<PlayerWatchInfoChangeResponse, 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::<PlayerWatchInfoChangeResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PlayerWatchInfoChangeResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { player_info_delta: fidl::new_empty!(PlayerInfoDelta, 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!(
PlayerInfoDelta,
D,
&mut self.player_info_delta,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PublisherPublishRequest {
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 PublisherPublishRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
PublisherPublishRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PublisherPublishRequest
{
#[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::<PublisherPublishRequest>(offset);
fidl::encoding::Encode::<PublisherPublishRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.player),
<PlayerRegistration as fidl::encoding::ValueTypeMarker>::borrow(&self.registration),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
PlayerRegistration,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PublisherPublishRequest,
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::<PublisherPublishRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PublisherPublishRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
player: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
registration: fidl::new_empty!(
PlayerRegistration,
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,
});
}
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.player,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
PlayerRegistration,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.registration,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PublisherPublishResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PublisherPublishResponse {
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<PublisherPublishResponse, D> for &PublisherPublishResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PublisherPublishResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut PublisherPublishResponse)
.write_unaligned((self as *const PublisherPublishResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<PublisherPublishResponse, 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::<PublisherPublishResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PublisherPublishResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { session_id: fidl::new_empty!(u64, 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(())
}
}
impl fidl::encoding::ResourceTypeMarker for SessionControlBindVolumeControlRequest {
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 SessionControlBindVolumeControlRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
SessionControlBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut SessionControlBindVolumeControlRequest
{
#[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::<SessionControlBindVolumeControlRequest>(offset);
fidl::encoding::Encode::<
SessionControlBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.volume_control_request,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
SessionControlBindVolumeControlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[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::<SessionControlBindVolumeControlRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for SessionControlBindVolumeControlRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
volume_control_request: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
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!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.volume_control_request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SessionControlSeekRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SessionControlSeekRequest {
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<SessionControlSeekRequest, D> for &SessionControlSeekRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionControlSeekRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SessionControlSeekRequest)
.write_unaligned((self as *const SessionControlSeekRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<SessionControlSeekRequest, 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::<SessionControlSeekRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SessionControlSeekRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { position: 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(())
}
}
impl fidl::encoding::ValueTypeMarker for SessionControlSetPlaybackRateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SessionControlSetPlaybackRateRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SessionControlSetPlaybackRateRequest, D>
for &SessionControlSetPlaybackRateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionControlSetPlaybackRateRequest>(offset);
fidl::encoding::Encode::<SessionControlSetPlaybackRateRequest, D>::encode(
(<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.playback_rate),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
fidl::encoding::Encode<SessionControlSetPlaybackRateRequest, 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::<SessionControlSetPlaybackRateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SessionControlSetPlaybackRateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { playback_rate: fidl::new_empty!(f32, 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!(f32, D, &mut self.playback_rate, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SessionControlSetRepeatModeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SessionControlSetRepeatModeRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SessionControlSetRepeatModeRequest, D>
for &SessionControlSetRepeatModeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionControlSetRepeatModeRequest>(offset);
fidl::encoding::Encode::<SessionControlSetRepeatModeRequest, D>::encode(
(<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow(&self.repeat_mode),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RepeatMode, D>>
fidl::encoding::Encode<SessionControlSetRepeatModeRequest, 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::<SessionControlSetRepeatModeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SessionControlSetRepeatModeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { repeat_mode: fidl::new_empty!(RepeatMode, 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!(RepeatMode, D, &mut self.repeat_mode, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SessionControlSetShuffleModeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SessionControlSetShuffleModeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SessionControlSetShuffleModeRequest, D>
for &SessionControlSetShuffleModeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionControlSetShuffleModeRequest>(offset);
fidl::encoding::Encode::<SessionControlSetShuffleModeRequest, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.shuffle_on),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<SessionControlSetShuffleModeRequest, 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::<SessionControlSetShuffleModeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SessionControlSetShuffleModeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { shuffle_on: fidl::new_empty!(bool, 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!(bool, D, &mut self.shuffle_on, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SessionControlWatchStatusResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SessionControlWatchStatusResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SessionControlWatchStatusResponse, D>
for &SessionControlWatchStatusResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionControlWatchStatusResponse>(offset);
fidl::encoding::Encode::<SessionControlWatchStatusResponse, D>::encode(
(<SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
&self.session_info_delta,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SessionInfoDelta, D>>
fidl::encoding::Encode<SessionControlWatchStatusResponse, 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::<SessionControlWatchStatusResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SessionControlWatchStatusResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { session_info_delta: fidl::new_empty!(SessionInfoDelta, 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!(
SessionInfoDelta,
D,
&mut self.session_info_delta,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SessionObserverWatchStatusResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SessionObserverWatchStatusResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SessionObserverWatchStatusResponse, D>
for &SessionObserverWatchStatusResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionObserverWatchStatusResponse>(offset);
fidl::encoding::Encode::<SessionObserverWatchStatusResponse, D>::encode(
(<SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
&self.session_info_delta,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SessionInfoDelta, D>>
fidl::encoding::Encode<SessionObserverWatchStatusResponse, 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::<SessionObserverWatchStatusResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SessionObserverWatchStatusResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { session_info_delta: fidl::new_empty!(SessionInfoDelta, 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!(
SessionInfoDelta,
D,
&mut self.session_info_delta,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SessionsWatcherSessionRemovedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SessionsWatcherSessionRemovedRequest {
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<SessionsWatcherSessionRemovedRequest, D>
for &SessionsWatcherSessionRemovedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionsWatcherSessionRemovedRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SessionsWatcherSessionRemovedRequest)
.write_unaligned((self as *const SessionsWatcherSessionRemovedRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<SessionsWatcherSessionRemovedRequest, 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::<SessionsWatcherSessionRemovedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SessionsWatcherSessionRemovedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { session_id: fidl::new_empty!(u64, 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(())
}
}
impl fidl::encoding::ValueTypeMarker for SessionsWatcherSessionUpdatedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SessionsWatcherSessionUpdatedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SessionsWatcherSessionUpdatedRequest, D>
for &SessionsWatcherSessionUpdatedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionsWatcherSessionUpdatedRequest>(offset);
fidl::encoding::Encode::<SessionsWatcherSessionUpdatedRequest, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
<SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
&self.session_info_delta,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<SessionInfoDelta, D>,
> fidl::encoding::Encode<SessionsWatcherSessionUpdatedRequest, 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::<SessionsWatcherSessionUpdatedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SessionsWatcherSessionUpdatedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
session_id: fidl::new_empty!(u64, D),
session_info_delta: fidl::new_empty!(SessionInfoDelta, 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!(u64, D, &mut self.session_id, decoder, offset + 0, _depth)?;
fidl::decode!(
SessionInfoDelta,
D,
&mut self.session_info_delta,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl MediaImage {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.sizes {
return 2;
}
if let Some(_) = self.image_type {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for MediaImage {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for MediaImage {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaImage, D>
for &MediaImage
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MediaImage>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<MediaImageType, D>(
self.image_type
.as_ref()
.map(<MediaImageType as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ImageSizeVariant, 16>, D>(
self.sizes.as_ref().map(<fidl::encoding::Vector<ImageSizeVariant, 16> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaImage {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<MediaImageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.image_type.get_or_insert_with(|| fidl::new_empty!(MediaImageType, D));
fidl::decode!(MediaImageType, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Vector<ImageSizeVariant, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.sizes.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<ImageSizeVariant, 16>, D),
);
fidl::decode!(fidl::encoding::Vector<ImageSizeVariant, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PlayerCapabilities {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.flags {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PlayerCapabilities {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerCapabilities {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerCapabilities, D>
for &PlayerCapabilities
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerCapabilities>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<PlayerCapabilityFlags, D>(
self.flags
.as_ref()
.map(<PlayerCapabilityFlags as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerCapabilities {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PlayerCapabilityFlags as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.flags.get_or_insert_with(|| fidl::new_empty!(PlayerCapabilityFlags, D));
fidl::decode!(
PlayerCapabilityFlags,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PlayerInfoDelta {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.interruption_behavior {
return 6;
}
if let Some(_) = self.player_capabilities {
return 5;
}
if let Some(_) = self.media_images {
return 4;
}
if let Some(_) = self.metadata {
return 3;
}
if let Some(_) = self.player_status {
return 2;
}
if let Some(_) = self.local {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PlayerInfoDelta {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerInfoDelta {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerInfoDelta, D>
for &PlayerInfoDelta
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerInfoDelta>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.local.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<PlayerStatus, D>(
self.player_status
.as_ref()
.map(<PlayerStatus as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::Metadata, D>(
self.metadata
.as_ref()
.map(<fidl_fuchsia_media::Metadata as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MediaImage, 16>, D>(
self.media_images.as_ref().map(<fidl::encoding::Vector<MediaImage, 16> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<PlayerCapabilities, D>(
self.player_capabilities
.as_ref()
.map(<PlayerCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<InterruptionBehavior, D>(
self.interruption_behavior
.as_ref()
.map(<InterruptionBehavior as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerInfoDelta {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.local.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PlayerStatus as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.player_status.get_or_insert_with(|| fidl::new_empty!(PlayerStatus, D));
fidl::decode!(PlayerStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_fuchsia_media::Metadata as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.metadata
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media::Metadata, D));
fidl::decode!(
fidl_fuchsia_media::Metadata,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Vector<MediaImage, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.media_images.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<MediaImage, 16>, D),
);
fidl::decode!(fidl::encoding::Vector<MediaImage, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PlayerCapabilities as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.player_capabilities
.get_or_insert_with(|| fidl::new_empty!(PlayerCapabilities, D));
fidl::decode!(PlayerCapabilities, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<InterruptionBehavior as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.interruption_behavior
.get_or_insert_with(|| fidl::new_empty!(InterruptionBehavior, D));
fidl::decode!(
InterruptionBehavior,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PlayerRegistration {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.usage {
return 2;
}
if let Some(_) = self.domain {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PlayerRegistration {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerRegistration {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerRegistration, D>
for &PlayerRegistration
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerRegistration>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1000>, D>(
self.domain.as_ref().map(<fidl::encoding::BoundedString<1000> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::AudioRenderUsage, D>(
self.usage.as_ref().map(<fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerRegistration {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::BoundedString<1000> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.domain.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::BoundedString<1000>, D)
});
fidl::decode!(
fidl::encoding::BoundedString<1000>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.usage.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage, D)
});
fidl::decode!(
fidl_fuchsia_media::AudioRenderUsage,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PlayerStatus {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.is_live {
return 8;
}
if let Some(_) = self.error {
return 7;
}
if let Some(_) = self.content_type {
return 6;
}
if let Some(_) = self.shuffle_on {
return 5;
}
if let Some(_) = self.repeat_mode {
return 4;
}
if let Some(_) = self.timeline_function {
return 3;
}
if let Some(_) = self.player_state {
return 2;
}
if let Some(_) = self.duration {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PlayerStatus {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PlayerStatus {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerStatus, D>
for &PlayerStatus
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PlayerStatus>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<i64, D>(
self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<PlayerState, D>(
self.player_state
.as_ref()
.map(<PlayerState as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::TimelineFunction, D>(
self.timeline_function.as_ref().map(<fidl_fuchsia_media::TimelineFunction as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<RepeatMode, D>(
self.repeat_mode
.as_ref()
.map(<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.shuffle_on.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<ContentType, D>(
self.content_type
.as_ref()
.map(<ContentType as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<Error, D>(
self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 8 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (8 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.is_live.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerStatus {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.duration.get_or_insert_with(|| fidl::new_empty!(i64, D));
fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PlayerState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.player_state.get_or_insert_with(|| fidl::new_empty!(PlayerState, D));
fidl::decode!(PlayerState, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_media::TimelineFunction as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.timeline_function.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_media::TimelineFunction, D)
});
fidl::decode!(
fidl_fuchsia_media::TimelineFunction,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<RepeatMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.repeat_mode.get_or_insert_with(|| fidl::new_empty!(RepeatMode, D));
fidl::decode!(RepeatMode, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.shuffle_on.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ContentType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.content_type.get_or_insert_with(|| fidl::new_empty!(ContentType, D));
fidl::decode!(ContentType, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 7 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.error.get_or_insert_with(|| fidl::new_empty!(Error, D));
fidl::decode!(Error, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 8 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.is_live.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl SessionInfoDelta {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.player_capabilities {
return 7;
}
if let Some(_) = self.media_images {
return 6;
}
if let Some(_) = self.metadata {
return 5;
}
if let Some(_) = self.player_status {
return 4;
}
if let Some(_) = self.is_locally_active {
return 3;
}
if let Some(_) = self.is_local {
return 2;
}
if let Some(_) = self.domain {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for SessionInfoDelta {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SessionInfoDelta {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionInfoDelta, D>
for &SessionInfoDelta
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SessionInfoDelta>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1000>, D>(
self.domain.as_ref().map(<fidl::encoding::BoundedString<1000> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.is_local.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.is_locally_active
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<PlayerStatus, D>(
self.player_status
.as_ref()
.map(<PlayerStatus as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::Metadata, D>(
self.metadata
.as_ref()
.map(<fidl_fuchsia_media::Metadata as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<MediaImage>, D>(
self.media_images.as_ref().map(<fidl::encoding::UnboundedVector<MediaImage> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<PlayerCapabilities, D>(
self.player_capabilities
.as_ref()
.map(<PlayerCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionInfoDelta {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::BoundedString<1000> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.domain.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::BoundedString<1000>, D)
});
fidl::decode!(
fidl::encoding::BoundedString<1000>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.is_local.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.is_locally_active.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PlayerStatus as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.player_status.get_or_insert_with(|| fidl::new_empty!(PlayerStatus, D));
fidl::decode!(PlayerStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_fuchsia_media::Metadata as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.metadata
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media::Metadata, D));
fidl::decode!(
fidl_fuchsia_media::Metadata,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::UnboundedVector<MediaImage> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.media_images.get_or_insert_with(|| {
fidl::new_empty!(fidl::encoding::UnboundedVector<MediaImage>, D)
});
fidl::decode!(
fidl::encoding::UnboundedVector<MediaImage>,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 7 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<PlayerCapabilities as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.player_capabilities
.get_or_insert_with(|| fidl::new_empty!(PlayerCapabilities, D));
fidl::decode!(PlayerCapabilities, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl WatchOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.allowed_sessions {
return 2;
}
if let Some(_) = self.only_active {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for WatchOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for WatchOptions {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatchOptions, D>
for &WatchOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WatchOptions>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.only_active.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u64, 1000>, D>(
self.allowed_sessions.as_ref().map(
<fidl::encoding::Vector<u64, 1000> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.only_active.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::Vector<u64, 1000> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.allowed_sessions
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u64, 1000>, D));
fidl::decode!(fidl::encoding::Vector<u64, 1000>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
}