#![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 AlarmId = String;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum WakeError {
Unspecified,
Dropped,
Internal,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! WakeErrorUnknown {
() => {
_
};
}
impl WakeError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Unspecified),
2 => Some(Self::Dropped),
3 => Some(Self::Internal),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Unspecified,
2 => Self::Dropped,
3 => Self::Internal,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Unspecified => 1,
Self::Dropped => 2,
Self::Internal => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ClientSideBatonManagementCancelRequest {
pub alarm_id: String,
}
impl fidl::Persistable for ClientSideBatonManagementCancelRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ClientSideBatonManagementSetAndWaitResponse {
pub keep_alive: fidl::EventPair,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ClientSideBatonManagementSetAndWaitResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SetAndWaitArgs {
pub deadline: fidl::BootInstant,
pub keep_alive: fidl::EventPair,
pub alarm_id: String,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SetAndWaitArgs {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ClientSideBatonManagementMarker;
impl fidl::endpoints::ProtocolMarker for ClientSideBatonManagementMarker {
type Proxy = ClientSideBatonManagementProxy;
type RequestStream = ClientSideBatonManagementRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ClientSideBatonManagementSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ClientSideBatonManagement";
}
pub type ClientSideBatonManagementSetAndWaitResult = Result<fidl::EventPair, WakeError>;
pub type ClientSideBatonManagementCancelResult = Result<(), WakeError>;
pub trait ClientSideBatonManagementProxyInterface: Send + Sync {
type SetAndWaitResponseFut: std::future::Future<Output = Result<ClientSideBatonManagementSetAndWaitResult, fidl::Error>>
+ Send;
fn r#set_and_wait(
&self,
deadline: fidl::BootInstant,
keep_alive: fidl::EventPair,
alarm_id: &str,
) -> Self::SetAndWaitResponseFut;
type CancelResponseFut: std::future::Future<Output = Result<ClientSideBatonManagementCancelResult, fidl::Error>>
+ Send;
fn r#cancel(&self, alarm_id: &str) -> Self::CancelResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ClientSideBatonManagementSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ClientSideBatonManagementSynchronousProxy {
type Proxy = ClientSideBatonManagementProxy;
type Protocol = ClientSideBatonManagementMarker;
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 ClientSideBatonManagementSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ClientSideBatonManagementMarker 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<ClientSideBatonManagementEvent, fidl::Error> {
ClientSideBatonManagementEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_and_wait(
&self,
mut deadline: fidl::BootInstant,
mut keep_alive: fidl::EventPair,
mut alarm_id: &str,
___deadline: zx::MonotonicInstant,
) -> Result<ClientSideBatonManagementSetAndWaitResult, fidl::Error> {
let _response = self
.client
.send_query::<SetAndWaitArgs, fidl::encoding::FlexibleResultType<
ClientSideBatonManagementSetAndWaitResponse,
WakeError,
>>(
(deadline, keep_alive, alarm_id),
0x46ea462fcd0246c0,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ClientSideBatonManagementMarker>("set_and_wait")?;
Ok(_response.map(|x| x.keep_alive))
}
pub fn r#cancel(
&self,
mut alarm_id: &str,
___deadline: zx::MonotonicInstant,
) -> Result<ClientSideBatonManagementCancelResult, fidl::Error> {
let _response = self.client.send_query::<
ClientSideBatonManagementCancelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WakeError>,
>(
(alarm_id,),
0x2d59ccae0bda24e3,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ClientSideBatonManagementMarker>("cancel")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct ClientSideBatonManagementProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ClientSideBatonManagementProxy {
type Protocol = ClientSideBatonManagementMarker;
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 ClientSideBatonManagementProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ClientSideBatonManagementMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ClientSideBatonManagementEventStream {
ClientSideBatonManagementEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_and_wait(
&self,
mut deadline: fidl::BootInstant,
mut keep_alive: fidl::EventPair,
mut alarm_id: &str,
) -> fidl::client::QueryResponseFut<
ClientSideBatonManagementSetAndWaitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ClientSideBatonManagementProxyInterface::r#set_and_wait(
self, deadline, keep_alive, alarm_id,
)
}
pub fn r#cancel(
&self,
mut alarm_id: &str,
) -> fidl::client::QueryResponseFut<
ClientSideBatonManagementCancelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ClientSideBatonManagementProxyInterface::r#cancel(self, alarm_id)
}
}
impl ClientSideBatonManagementProxyInterface for ClientSideBatonManagementProxy {
type SetAndWaitResponseFut = fidl::client::QueryResponseFut<
ClientSideBatonManagementSetAndWaitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_and_wait(
&self,
mut deadline: fidl::BootInstant,
mut keep_alive: fidl::EventPair,
mut alarm_id: &str,
) -> Self::SetAndWaitResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ClientSideBatonManagementSetAndWaitResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
ClientSideBatonManagementSetAndWaitResponse,
WakeError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x46ea462fcd0246c0,
>(_buf?)?
.into_result::<ClientSideBatonManagementMarker>("set_and_wait")?;
Ok(_response.map(|x| x.keep_alive))
}
self.client
.send_query_and_decode::<SetAndWaitArgs, ClientSideBatonManagementSetAndWaitResult>(
(deadline, keep_alive, alarm_id),
0x46ea462fcd0246c0,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type CancelResponseFut = fidl::client::QueryResponseFut<
ClientSideBatonManagementCancelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#cancel(&self, mut alarm_id: &str) -> Self::CancelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ClientSideBatonManagementCancelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WakeError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2d59ccae0bda24e3,
>(_buf?)?
.into_result::<ClientSideBatonManagementMarker>("cancel")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ClientSideBatonManagementCancelRequest,
ClientSideBatonManagementCancelResult,
>(
(alarm_id,),
0x2d59ccae0bda24e3,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct ClientSideBatonManagementEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ClientSideBatonManagementEventStream {}
impl futures::stream::FusedStream for ClientSideBatonManagementEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ClientSideBatonManagementEventStream {
type Item = Result<ClientSideBatonManagementEvent, 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(ClientSideBatonManagementEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ClientSideBatonManagementEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ClientSideBatonManagementEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ClientSideBatonManagementEvent, 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 {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ClientSideBatonManagementEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<ClientSideBatonManagementMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ClientSideBatonManagementRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ClientSideBatonManagementRequestStream {}
impl futures::stream::FusedStream for ClientSideBatonManagementRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ClientSideBatonManagementRequestStream {
type Protocol = ClientSideBatonManagementMarker;
type ControlHandle = ClientSideBatonManagementControlHandle;
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 {
ClientSideBatonManagementControlHandle { 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 ClientSideBatonManagementRequestStream {
type Item = Result<ClientSideBatonManagementRequest, 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 ClientSideBatonManagementRequestStream 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 {
0x46ea462fcd0246c0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(SetAndWaitArgs, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SetAndWaitArgs>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ClientSideBatonManagementControlHandle {
inner: this.inner.clone(),
};
Ok(ClientSideBatonManagementRequest::SetAndWait {deadline: req.deadline,
keep_alive: req.keep_alive,
alarm_id: req.alarm_id,
responder: ClientSideBatonManagementSetAndWaitResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2d59ccae0bda24e3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ClientSideBatonManagementCancelRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientSideBatonManagementCancelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ClientSideBatonManagementControlHandle {
inner: this.inner.clone(),
};
Ok(ClientSideBatonManagementRequest::Cancel {alarm_id: req.alarm_id,
responder: ClientSideBatonManagementCancelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ClientSideBatonManagementRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ClientSideBatonManagementControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(ClientSideBatonManagementRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ClientSideBatonManagementControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ClientSideBatonManagementMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ClientSideBatonManagementRequest {
SetAndWait {
deadline: fidl::BootInstant,
keep_alive: fidl::EventPair,
alarm_id: String,
responder: ClientSideBatonManagementSetAndWaitResponder,
},
Cancel { alarm_id: String, responder: ClientSideBatonManagementCancelResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ClientSideBatonManagementControlHandle,
method_type: fidl::MethodType,
},
}
impl ClientSideBatonManagementRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_and_wait(
self,
) -> Option<(
fidl::BootInstant,
fidl::EventPair,
String,
ClientSideBatonManagementSetAndWaitResponder,
)> {
if let ClientSideBatonManagementRequest::SetAndWait {
deadline,
keep_alive,
alarm_id,
responder,
} = self
{
Some((deadline, keep_alive, alarm_id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_cancel(self) -> Option<(String, ClientSideBatonManagementCancelResponder)> {
if let ClientSideBatonManagementRequest::Cancel { alarm_id, responder } = self {
Some((alarm_id, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ClientSideBatonManagementRequest::SetAndWait { .. } => "set_and_wait",
ClientSideBatonManagementRequest::Cancel { .. } => "cancel",
ClientSideBatonManagementRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
ClientSideBatonManagementRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct ClientSideBatonManagementControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ClientSideBatonManagementControlHandle {
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 ClientSideBatonManagementControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ClientSideBatonManagementSetAndWaitResponder {
control_handle: std::mem::ManuallyDrop<ClientSideBatonManagementControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ClientSideBatonManagementSetAndWaitResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ClientSideBatonManagementSetAndWaitResponder {
type ControlHandle = ClientSideBatonManagementControlHandle;
fn control_handle(&self) -> &ClientSideBatonManagementControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ClientSideBatonManagementSetAndWaitResponder {
pub fn send(self, mut result: Result<fidl::EventPair, WakeError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::EventPair, WakeError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::EventPair, WakeError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
ClientSideBatonManagementSetAndWaitResponse,
WakeError,
>>(
fidl::encoding::FlexibleResult::new(result.map(|keep_alive| (keep_alive,))),
self.tx_id,
0x46ea462fcd0246c0,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ClientSideBatonManagementCancelResponder {
control_handle: std::mem::ManuallyDrop<ClientSideBatonManagementControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ClientSideBatonManagementCancelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ClientSideBatonManagementCancelResponder {
type ControlHandle = ClientSideBatonManagementControlHandle;
fn control_handle(&self) -> &ClientSideBatonManagementControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ClientSideBatonManagementCancelResponder {
pub fn send(self, mut result: Result<(), WakeError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), WakeError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), WakeError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
WakeError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x2d59ccae0bda24e3,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct WakeMarker;
impl fidl::endpoints::ProtocolMarker for WakeMarker {
type Proxy = WakeProxy;
type RequestStream = WakeRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = WakeSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.time.alarms.Wake";
}
impl fidl::endpoints::DiscoverableProtocolMarker for WakeMarker {}
pub trait WakeProxyInterface: Send + Sync {
type SetAndWaitResponseFut: std::future::Future<Output = Result<ClientSideBatonManagementSetAndWaitResult, fidl::Error>>
+ Send;
fn r#set_and_wait(
&self,
deadline: fidl::BootInstant,
keep_alive: fidl::EventPair,
alarm_id: &str,
) -> Self::SetAndWaitResponseFut;
type CancelResponseFut: std::future::Future<Output = Result<ClientSideBatonManagementCancelResult, fidl::Error>>
+ Send;
fn r#cancel(&self, alarm_id: &str) -> Self::CancelResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct WakeSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for WakeSynchronousProxy {
type Proxy = WakeProxy;
type Protocol = WakeMarker;
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 WakeSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <WakeMarker 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<WakeEvent, fidl::Error> {
WakeEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_and_wait(
&self,
mut deadline: fidl::BootInstant,
mut keep_alive: fidl::EventPair,
mut alarm_id: &str,
___deadline: zx::MonotonicInstant,
) -> Result<ClientSideBatonManagementSetAndWaitResult, fidl::Error> {
let _response = self
.client
.send_query::<SetAndWaitArgs, fidl::encoding::FlexibleResultType<
ClientSideBatonManagementSetAndWaitResponse,
WakeError,
>>(
(deadline, keep_alive, alarm_id),
0x46ea462fcd0246c0,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<WakeMarker>("set_and_wait")?;
Ok(_response.map(|x| x.keep_alive))
}
pub fn r#cancel(
&self,
mut alarm_id: &str,
___deadline: zx::MonotonicInstant,
) -> Result<ClientSideBatonManagementCancelResult, fidl::Error> {
let _response = self.client.send_query::<
ClientSideBatonManagementCancelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WakeError>,
>(
(alarm_id,),
0x2d59ccae0bda24e3,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<WakeMarker>("cancel")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct WakeProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for WakeProxy {
type Protocol = WakeMarker;
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 WakeProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <WakeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> WakeEventStream {
WakeEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_and_wait(
&self,
mut deadline: fidl::BootInstant,
mut keep_alive: fidl::EventPair,
mut alarm_id: &str,
) -> fidl::client::QueryResponseFut<
ClientSideBatonManagementSetAndWaitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
WakeProxyInterface::r#set_and_wait(self, deadline, keep_alive, alarm_id)
}
pub fn r#cancel(
&self,
mut alarm_id: &str,
) -> fidl::client::QueryResponseFut<
ClientSideBatonManagementCancelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
WakeProxyInterface::r#cancel(self, alarm_id)
}
}
impl WakeProxyInterface for WakeProxy {
type SetAndWaitResponseFut = fidl::client::QueryResponseFut<
ClientSideBatonManagementSetAndWaitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_and_wait(
&self,
mut deadline: fidl::BootInstant,
mut keep_alive: fidl::EventPair,
mut alarm_id: &str,
) -> Self::SetAndWaitResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ClientSideBatonManagementSetAndWaitResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
ClientSideBatonManagementSetAndWaitResponse,
WakeError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x46ea462fcd0246c0,
>(_buf?)?
.into_result::<WakeMarker>("set_and_wait")?;
Ok(_response.map(|x| x.keep_alive))
}
self.client
.send_query_and_decode::<SetAndWaitArgs, ClientSideBatonManagementSetAndWaitResult>(
(deadline, keep_alive, alarm_id),
0x46ea462fcd0246c0,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type CancelResponseFut = fidl::client::QueryResponseFut<
ClientSideBatonManagementCancelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#cancel(&self, mut alarm_id: &str) -> Self::CancelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ClientSideBatonManagementCancelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WakeError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2d59ccae0bda24e3,
>(_buf?)?
.into_result::<WakeMarker>("cancel")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ClientSideBatonManagementCancelRequest,
ClientSideBatonManagementCancelResult,
>(
(alarm_id,),
0x2d59ccae0bda24e3,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct WakeEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for WakeEventStream {}
impl futures::stream::FusedStream for WakeEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for WakeEventStream {
type Item = Result<WakeEvent, 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(WakeEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum WakeEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl WakeEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<WakeEvent, 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 {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(WakeEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <WakeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct WakeRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for WakeRequestStream {}
impl futures::stream::FusedStream for WakeRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for WakeRequestStream {
type Protocol = WakeMarker;
type ControlHandle = WakeControlHandle;
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 {
WakeControlHandle { 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 WakeRequestStream {
type Item = Result<WakeRequest, 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 WakeRequestStream 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 {
0x46ea462fcd0246c0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SetAndWaitArgs,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SetAndWaitArgs>(&header, _body_bytes, handles, &mut req)?;
let control_handle = WakeControlHandle { inner: this.inner.clone() };
Ok(WakeRequest::SetAndWait {
deadline: req.deadline,
keep_alive: req.keep_alive,
alarm_id: req.alarm_id,
responder: WakeSetAndWaitResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2d59ccae0bda24e3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ClientSideBatonManagementCancelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientSideBatonManagementCancelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = WakeControlHandle { inner: this.inner.clone() };
Ok(WakeRequest::Cancel {
alarm_id: req.alarm_id,
responder: WakeCancelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(WakeRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: WakeControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(WakeRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: WakeControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <WakeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum WakeRequest {
SetAndWait {
deadline: fidl::BootInstant,
keep_alive: fidl::EventPair,
alarm_id: String,
responder: WakeSetAndWaitResponder,
},
Cancel { alarm_id: String, responder: WakeCancelResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: WakeControlHandle,
method_type: fidl::MethodType,
},
}
impl WakeRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_and_wait(
self,
) -> Option<(fidl::BootInstant, fidl::EventPair, String, WakeSetAndWaitResponder)> {
if let WakeRequest::SetAndWait { deadline, keep_alive, alarm_id, responder } = self {
Some((deadline, keep_alive, alarm_id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_cancel(self) -> Option<(String, WakeCancelResponder)> {
if let WakeRequest::Cancel { alarm_id, responder } = self {
Some((alarm_id, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
WakeRequest::SetAndWait { .. } => "set_and_wait",
WakeRequest::Cancel { .. } => "cancel",
WakeRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
WakeRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct WakeControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for WakeControlHandle {
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 WakeControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WakeSetAndWaitResponder {
control_handle: std::mem::ManuallyDrop<WakeControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for WakeSetAndWaitResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WakeSetAndWaitResponder {
type ControlHandle = WakeControlHandle;
fn control_handle(&self) -> &WakeControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl WakeSetAndWaitResponder {
pub fn send(self, mut result: Result<fidl::EventPair, WakeError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::EventPair, WakeError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::EventPair, WakeError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
ClientSideBatonManagementSetAndWaitResponse,
WakeError,
>>(
fidl::encoding::FlexibleResult::new(result.map(|keep_alive| (keep_alive,))),
self.tx_id,
0x46ea462fcd0246c0,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WakeCancelResponder {
control_handle: std::mem::ManuallyDrop<WakeControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for WakeCancelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WakeCancelResponder {
type ControlHandle = WakeControlHandle;
fn control_handle(&self) -> &WakeControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl WakeCancelResponder {
pub fn send(self, mut result: Result<(), WakeError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), WakeError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), WakeError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
WakeError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x2d59ccae0bda24e3,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for WakeError {
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 {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for WakeError {
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 WakeError {
#[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 WakeError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[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_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ClientSideBatonManagementCancelRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ClientSideBatonManagementCancelRequest {
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<ClientSideBatonManagementCancelRequest, D>
for &ClientSideBatonManagementCancelRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientSideBatonManagementCancelRequest>(offset);
fidl::encoding::Encode::<ClientSideBatonManagementCancelRequest, D>::encode(
(<fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
&self.alarm_id,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
> fidl::encoding::Encode<ClientSideBatonManagementCancelRequest, 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::<ClientSideBatonManagementCancelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ClientSideBatonManagementCancelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { alarm_id: fidl::new_empty!(fidl::encoding::BoundedString<128>, 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<128>,
D,
&mut self.alarm_id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ClientSideBatonManagementSetAndWaitResponse {
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 ClientSideBatonManagementSetAndWaitResponse {
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<
ClientSideBatonManagementSetAndWaitResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ClientSideBatonManagementSetAndWaitResponse
{
#[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::<ClientSideBatonManagementSetAndWaitResponse>(offset);
fidl::encoding::Encode::<
ClientSideBatonManagementSetAndWaitResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
16387,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.keep_alive
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
16387,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ClientSideBatonManagementSetAndWaitResponse,
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::<ClientSideBatonManagementSetAndWaitResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ClientSideBatonManagementSetAndWaitResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
keep_alive: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, 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::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.keep_alive, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for SetAndWaitArgs {
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 SetAndWaitArgs {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl
fidl::encoding::Encode<SetAndWaitArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut SetAndWaitArgs
{
#[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::<SetAndWaitArgs>(offset);
fidl::encoding::Encode::<SetAndWaitArgs, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::BootInstant as fidl::encoding::ValueTypeMarker>::borrow(&self.deadline),
<fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.keep_alive),
<fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(&self.alarm_id),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::BootInstant,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
16387,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::BoundedString<128>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
> fidl::encoding::Encode<SetAndWaitArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SetAndWaitArgs>(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)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for SetAndWaitArgs
{
#[inline(always)]
fn new_empty() -> Self {
Self {
deadline: fidl::new_empty!(
fidl::BootInstant,
fidl::encoding::DefaultFuchsiaResourceDialect
),
keep_alive: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect),
alarm_id: fidl::new_empty!(
fidl::encoding::BoundedString<128>,
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!(
fidl::BootInstant,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.deadline,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 16387>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.keep_alive, decoder, offset + 8, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<128>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.alarm_id,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
}