#![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 const MAX_REBOOT_WATCHER_RESPONSE_TIME_SECONDS: u32 = 5;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum RebootReason {
UserRequest = 1,
SystemUpdate = 2,
RetrySystemUpdate = 8,
HighTemperature = 3,
FactoryDataReset = 6,
SessionFailure = 4,
SysmgrFailure = 5,
CriticalComponentFailure = 7,
ZbiSwap = 9,
OutOfMemory = 10,
}
impl RebootReason {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::UserRequest),
2 => Some(Self::SystemUpdate),
8 => Some(Self::RetrySystemUpdate),
3 => Some(Self::HighTemperature),
6 => Some(Self::FactoryDataReset),
4 => Some(Self::SessionFailure),
5 => Some(Self::SysmgrFailure),
7 => Some(Self::CriticalComponentFailure),
9 => Some(Self::ZbiSwap),
10 => Some(Self::OutOfMemory),
_ => 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 AdminMexecRequest {
pub kernel_zbi: fidl::Vmo,
pub data_zbi: fidl::Vmo,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for AdminMexecRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AdminRebootRequest {
pub reason: RebootReason,
}
impl fidl::Persistable for AdminRebootRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RebootMethodsWatcherOnRebootRequest {
pub reason: RebootReason,
}
impl fidl::Persistable for RebootMethodsWatcherOnRebootRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RebootMethodsWatcherRegisterRegisterRequest {
pub watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for RebootMethodsWatcherRegisterRegisterRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RebootMethodsWatcherRegisterRegisterWithAckRequest {
pub watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for RebootMethodsWatcherRegisterRegisterWithAckRequest
{
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AdminMarker;
impl fidl::endpoints::ProtocolMarker for AdminMarker {
type Proxy = AdminProxy;
type RequestStream = AdminRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AdminSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.hardware.power.statecontrol.Admin";
}
impl fidl::endpoints::DiscoverableProtocolMarker for AdminMarker {}
pub type AdminPowerFullyOnResult = Result<(), i32>;
pub type AdminRebootResult = Result<(), i32>;
pub type AdminRebootToBootloaderResult = Result<(), i32>;
pub type AdminRebootToRecoveryResult = Result<(), i32>;
pub type AdminPoweroffResult = Result<(), i32>;
pub type AdminMexecResult = Result<(), i32>;
pub type AdminSuspendToRamResult = Result<(), i32>;
pub trait AdminProxyInterface: Send + Sync {
type PowerFullyOnResponseFut: std::future::Future<Output = Result<AdminPowerFullyOnResult, fidl::Error>>
+ Send;
fn r#power_fully_on(&self) -> Self::PowerFullyOnResponseFut;
type RebootResponseFut: std::future::Future<Output = Result<AdminRebootResult, fidl::Error>>
+ Send;
fn r#reboot(&self, reason: RebootReason) -> Self::RebootResponseFut;
type RebootToBootloaderResponseFut: std::future::Future<Output = Result<AdminRebootToBootloaderResult, fidl::Error>>
+ Send;
fn r#reboot_to_bootloader(&self) -> Self::RebootToBootloaderResponseFut;
type RebootToRecoveryResponseFut: std::future::Future<Output = Result<AdminRebootToRecoveryResult, fidl::Error>>
+ Send;
fn r#reboot_to_recovery(&self) -> Self::RebootToRecoveryResponseFut;
type PoweroffResponseFut: std::future::Future<Output = Result<AdminPoweroffResult, fidl::Error>>
+ Send;
fn r#poweroff(&self) -> Self::PoweroffResponseFut;
type MexecResponseFut: std::future::Future<Output = Result<AdminMexecResult, fidl::Error>>
+ Send;
fn r#mexec(&self, kernel_zbi: fidl::Vmo, data_zbi: fidl::Vmo) -> Self::MexecResponseFut;
type SuspendToRamResponseFut: std::future::Future<Output = Result<AdminSuspendToRamResult, fidl::Error>>
+ Send;
fn r#suspend_to_ram(&self) -> Self::SuspendToRamResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AdminSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AdminSynchronousProxy {
type Proxy = AdminProxy;
type Protocol = AdminMarker;
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 AdminSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <AdminMarker 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<AdminEvent, fidl::Error> {
AdminEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#power_fully_on(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<AdminPowerFullyOnResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0xb3272d15e00712f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#reboot(
&self,
mut reason: RebootReason,
___deadline: zx::MonotonicInstant,
) -> Result<AdminRebootResult, fidl::Error> {
let _response = self.client.send_query::<
AdminRebootRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(reason,),
0x21f258bd20297368,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#reboot_to_bootloader(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<AdminRebootToBootloaderResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x6dce331b33786aa,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#reboot_to_recovery(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<AdminRebootToRecoveryResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x1575c566be54f505,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#poweroff(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<AdminPoweroffResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x24101c5d0b439748,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#mexec(
&self,
mut kernel_zbi: fidl::Vmo,
mut data_zbi: fidl::Vmo,
___deadline: zx::MonotonicInstant,
) -> Result<AdminMexecResult, fidl::Error> {
let _response = self.client.send_query::<
AdminMexecRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(kernel_zbi, data_zbi,),
0x1f91e77ec781a4c6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#suspend_to_ram(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<AdminSuspendToRamResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x3b0e356782e7620e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct AdminProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AdminProxy {
type Protocol = AdminMarker;
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 AdminProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AdminEventStream {
AdminEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#power_fully_on(
&self,
) -> fidl::client::QueryResponseFut<
AdminPowerFullyOnResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AdminProxyInterface::r#power_fully_on(self)
}
pub fn r#reboot(
&self,
mut reason: RebootReason,
) -> fidl::client::QueryResponseFut<
AdminRebootResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AdminProxyInterface::r#reboot(self, reason)
}
pub fn r#reboot_to_bootloader(
&self,
) -> fidl::client::QueryResponseFut<
AdminRebootToBootloaderResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AdminProxyInterface::r#reboot_to_bootloader(self)
}
pub fn r#reboot_to_recovery(
&self,
) -> fidl::client::QueryResponseFut<
AdminRebootToRecoveryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AdminProxyInterface::r#reboot_to_recovery(self)
}
pub fn r#poweroff(
&self,
) -> fidl::client::QueryResponseFut<
AdminPoweroffResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AdminProxyInterface::r#poweroff(self)
}
pub fn r#mexec(
&self,
mut kernel_zbi: fidl::Vmo,
mut data_zbi: fidl::Vmo,
) -> fidl::client::QueryResponseFut<
AdminMexecResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AdminProxyInterface::r#mexec(self, kernel_zbi, data_zbi)
}
pub fn r#suspend_to_ram(
&self,
) -> fidl::client::QueryResponseFut<
AdminSuspendToRamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AdminProxyInterface::r#suspend_to_ram(self)
}
}
impl AdminProxyInterface for AdminProxy {
type PowerFullyOnResponseFut = fidl::client::QueryResponseFut<
AdminPowerFullyOnResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#power_fully_on(&self) -> Self::PowerFullyOnResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AdminPowerFullyOnResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xb3272d15e00712f,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AdminPowerFullyOnResult>(
(),
0xb3272d15e00712f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RebootResponseFut = fidl::client::QueryResponseFut<
AdminRebootResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#reboot(&self, mut reason: RebootReason) -> Self::RebootResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AdminRebootResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x21f258bd20297368,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<AdminRebootRequest, AdminRebootResult>(
(reason,),
0x21f258bd20297368,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RebootToBootloaderResponseFut = fidl::client::QueryResponseFut<
AdminRebootToBootloaderResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#reboot_to_bootloader(&self) -> Self::RebootToBootloaderResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AdminRebootToBootloaderResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6dce331b33786aa,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, AdminRebootToBootloaderResult>(
(),
0x6dce331b33786aa,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RebootToRecoveryResponseFut = fidl::client::QueryResponseFut<
AdminRebootToRecoveryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#reboot_to_recovery(&self) -> Self::RebootToRecoveryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AdminRebootToRecoveryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1575c566be54f505,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, AdminRebootToRecoveryResult>(
(),
0x1575c566be54f505,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type PoweroffResponseFut = fidl::client::QueryResponseFut<
AdminPoweroffResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#poweroff(&self) -> Self::PoweroffResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AdminPoweroffResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x24101c5d0b439748,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AdminPoweroffResult>(
(),
0x24101c5d0b439748,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type MexecResponseFut = fidl::client::QueryResponseFut<
AdminMexecResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#mexec(
&self,
mut kernel_zbi: fidl::Vmo,
mut data_zbi: fidl::Vmo,
) -> Self::MexecResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AdminMexecResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1f91e77ec781a4c6,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<AdminMexecRequest, AdminMexecResult>(
(kernel_zbi, data_zbi),
0x1f91e77ec781a4c6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SuspendToRamResponseFut = fidl::client::QueryResponseFut<
AdminSuspendToRamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#suspend_to_ram(&self) -> Self::SuspendToRamResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AdminSuspendToRamResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3b0e356782e7620e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, AdminSuspendToRamResult>(
(),
0x3b0e356782e7620e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct AdminEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AdminEventStream {}
impl futures::stream::FusedStream for AdminEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AdminEventStream {
type Item = Result<AdminEvent, 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(AdminEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AdminEvent {}
impl AdminEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AdminEvent, 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: <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AdminRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AdminRequestStream {}
impl futures::stream::FusedStream for AdminRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AdminRequestStream {
type Protocol = AdminMarker;
type ControlHandle = AdminControlHandle;
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 {
AdminControlHandle { 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 AdminRequestStream {
type Item = Result<AdminRequest, 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 AdminRequestStream 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 {
0xb3272d15e00712f => {
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 = AdminControlHandle { inner: this.inner.clone() };
Ok(AdminRequest::PowerFullyOn {
responder: AdminPowerFullyOnResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x21f258bd20297368 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AdminRebootRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminRebootRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AdminControlHandle { inner: this.inner.clone() };
Ok(AdminRequest::Reboot {
reason: req.reason,
responder: AdminRebootResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6dce331b33786aa => {
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 = AdminControlHandle { inner: this.inner.clone() };
Ok(AdminRequest::RebootToBootloader {
responder: AdminRebootToBootloaderResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1575c566be54f505 => {
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 = AdminControlHandle { inner: this.inner.clone() };
Ok(AdminRequest::RebootToRecovery {
responder: AdminRebootToRecoveryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x24101c5d0b439748 => {
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 = AdminControlHandle { inner: this.inner.clone() };
Ok(AdminRequest::Poweroff {
responder: AdminPoweroffResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1f91e77ec781a4c6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AdminMexecRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminMexecRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AdminControlHandle { inner: this.inner.clone() };
Ok(AdminRequest::Mexec {
kernel_zbi: req.kernel_zbi,
data_zbi: req.data_zbi,
responder: AdminMexecResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3b0e356782e7620e => {
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 = AdminControlHandle { inner: this.inner.clone() };
Ok(AdminRequest::SuspendToRam {
responder: AdminSuspendToRamResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <AdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AdminRequest {
PowerFullyOn { responder: AdminPowerFullyOnResponder },
Reboot { reason: RebootReason, responder: AdminRebootResponder },
RebootToBootloader { responder: AdminRebootToBootloaderResponder },
RebootToRecovery { responder: AdminRebootToRecoveryResponder },
Poweroff { responder: AdminPoweroffResponder },
Mexec { kernel_zbi: fidl::Vmo, data_zbi: fidl::Vmo, responder: AdminMexecResponder },
SuspendToRam { responder: AdminSuspendToRamResponder },
}
impl AdminRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_power_fully_on(self) -> Option<(AdminPowerFullyOnResponder)> {
if let AdminRequest::PowerFullyOn { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reboot(self) -> Option<(RebootReason, AdminRebootResponder)> {
if let AdminRequest::Reboot { reason, responder } = self {
Some((reason, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reboot_to_bootloader(self) -> Option<(AdminRebootToBootloaderResponder)> {
if let AdminRequest::RebootToBootloader { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reboot_to_recovery(self) -> Option<(AdminRebootToRecoveryResponder)> {
if let AdminRequest::RebootToRecovery { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_poweroff(self) -> Option<(AdminPoweroffResponder)> {
if let AdminRequest::Poweroff { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_mexec(self) -> Option<(fidl::Vmo, fidl::Vmo, AdminMexecResponder)> {
if let AdminRequest::Mexec { kernel_zbi, data_zbi, responder } = self {
Some((kernel_zbi, data_zbi, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_suspend_to_ram(self) -> Option<(AdminSuspendToRamResponder)> {
if let AdminRequest::SuspendToRam { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AdminRequest::PowerFullyOn { .. } => "power_fully_on",
AdminRequest::Reboot { .. } => "reboot",
AdminRequest::RebootToBootloader { .. } => "reboot_to_bootloader",
AdminRequest::RebootToRecovery { .. } => "reboot_to_recovery",
AdminRequest::Poweroff { .. } => "poweroff",
AdminRequest::Mexec { .. } => "mexec",
AdminRequest::SuspendToRam { .. } => "suspend_to_ram",
}
}
}
#[derive(Debug, Clone)]
pub struct AdminControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AdminControlHandle {
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 AdminControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AdminPowerFullyOnResponder {
control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AdminPowerFullyOnResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AdminPowerFullyOnResponder {
type ControlHandle = AdminControlHandle;
fn control_handle(&self) -> &AdminControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AdminPowerFullyOnResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0xb3272d15e00712f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AdminRebootResponder {
control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AdminRebootResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AdminRebootResponder {
type ControlHandle = AdminControlHandle;
fn control_handle(&self) -> &AdminControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AdminRebootResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x21f258bd20297368,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AdminRebootToBootloaderResponder {
control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AdminRebootToBootloaderResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AdminRebootToBootloaderResponder {
type ControlHandle = AdminControlHandle;
fn control_handle(&self) -> &AdminControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AdminRebootToBootloaderResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x6dce331b33786aa,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AdminRebootToRecoveryResponder {
control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AdminRebootToRecoveryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AdminRebootToRecoveryResponder {
type ControlHandle = AdminControlHandle;
fn control_handle(&self) -> &AdminControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AdminRebootToRecoveryResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x1575c566be54f505,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AdminPoweroffResponder {
control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AdminPoweroffResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AdminPoweroffResponder {
type ControlHandle = AdminControlHandle;
fn control_handle(&self) -> &AdminControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AdminPoweroffResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x24101c5d0b439748,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AdminMexecResponder {
control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AdminMexecResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AdminMexecResponder {
type ControlHandle = AdminControlHandle;
fn control_handle(&self) -> &AdminControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AdminMexecResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x1f91e77ec781a4c6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AdminSuspendToRamResponder {
control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AdminSuspendToRamResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AdminSuspendToRamResponder {
type ControlHandle = AdminControlHandle;
fn control_handle(&self) -> &AdminControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AdminSuspendToRamResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x3b0e356782e7620e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RebootMethodsWatcherMarker;
impl fidl::endpoints::ProtocolMarker for RebootMethodsWatcherMarker {
type Proxy = RebootMethodsWatcherProxy;
type RequestStream = RebootMethodsWatcherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RebootMethodsWatcherSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) RebootMethodsWatcher";
}
pub trait RebootMethodsWatcherProxyInterface: Send + Sync {
type OnRebootResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_reboot(&self, reason: RebootReason) -> Self::OnRebootResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RebootMethodsWatcherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RebootMethodsWatcherSynchronousProxy {
type Proxy = RebootMethodsWatcherProxy;
type Protocol = RebootMethodsWatcherMarker;
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 RebootMethodsWatcherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<RebootMethodsWatcherMarker 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<RebootMethodsWatcherEvent, fidl::Error> {
RebootMethodsWatcherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_reboot(
&self,
mut reason: RebootReason,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<RebootMethodsWatcherOnRebootRequest, fidl::encoding::EmptyPayload>(
(reason,),
0x225a5f32436a1b13,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct RebootMethodsWatcherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for RebootMethodsWatcherProxy {
type Protocol = RebootMethodsWatcherMarker;
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 RebootMethodsWatcherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<RebootMethodsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RebootMethodsWatcherEventStream {
RebootMethodsWatcherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#on_reboot(
&self,
mut reason: RebootReason,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
RebootMethodsWatcherProxyInterface::r#on_reboot(self, reason)
}
}
impl RebootMethodsWatcherProxyInterface for RebootMethodsWatcherProxy {
type OnRebootResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_reboot(&self, mut reason: RebootReason) -> Self::OnRebootResponseFut {
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,
0x225a5f32436a1b13,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<RebootMethodsWatcherOnRebootRequest, ()>(
(reason,),
0x225a5f32436a1b13,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RebootMethodsWatcherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for RebootMethodsWatcherEventStream {}
impl futures::stream::FusedStream for RebootMethodsWatcherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RebootMethodsWatcherEventStream {
type Item = Result<RebootMethodsWatcherEvent, 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(RebootMethodsWatcherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RebootMethodsWatcherEvent {}
impl RebootMethodsWatcherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<RebootMethodsWatcherEvent, 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:
<RebootMethodsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RebootMethodsWatcherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for RebootMethodsWatcherRequestStream {}
impl futures::stream::FusedStream for RebootMethodsWatcherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RebootMethodsWatcherRequestStream {
type Protocol = RebootMethodsWatcherMarker;
type ControlHandle = RebootMethodsWatcherControlHandle;
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 {
RebootMethodsWatcherControlHandle { 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 RebootMethodsWatcherRequestStream {
type Item = Result<RebootMethodsWatcherRequest, 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 RebootMethodsWatcherRequestStream 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 {
0x225a5f32436a1b13 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RebootMethodsWatcherOnRebootRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootMethodsWatcherOnRebootRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RebootMethodsWatcherControlHandle {
inner: this.inner.clone(),
};
Ok(RebootMethodsWatcherRequest::OnReboot {reason: req.reason,
responder: RebootMethodsWatcherOnRebootResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <RebootMethodsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum RebootMethodsWatcherRequest {
OnReboot { reason: RebootReason, responder: RebootMethodsWatcherOnRebootResponder },
}
impl RebootMethodsWatcherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_on_reboot(self) -> Option<(RebootReason, RebootMethodsWatcherOnRebootResponder)> {
if let RebootMethodsWatcherRequest::OnReboot { reason, responder } = self {
Some((reason, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RebootMethodsWatcherRequest::OnReboot { .. } => "on_reboot",
}
}
}
#[derive(Debug, Clone)]
pub struct RebootMethodsWatcherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for RebootMethodsWatcherControlHandle {
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 RebootMethodsWatcherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RebootMethodsWatcherOnRebootResponder {
control_handle: std::mem::ManuallyDrop<RebootMethodsWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RebootMethodsWatcherOnRebootResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RebootMethodsWatcherOnRebootResponder {
type ControlHandle = RebootMethodsWatcherControlHandle;
fn control_handle(&self) -> &RebootMethodsWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RebootMethodsWatcherOnRebootResponder {
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,
0x225a5f32436a1b13,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RebootMethodsWatcherRegisterMarker;
impl fidl::endpoints::ProtocolMarker for RebootMethodsWatcherRegisterMarker {
type Proxy = RebootMethodsWatcherRegisterProxy;
type RequestStream = RebootMethodsWatcherRegisterRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RebootMethodsWatcherRegisterSynchronousProxy;
const DEBUG_NAME: &'static str =
"fuchsia.hardware.power.statecontrol.RebootMethodsWatcherRegister";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RebootMethodsWatcherRegisterMarker {}
pub trait RebootMethodsWatcherRegisterProxyInterface: Send + Sync {
fn r#register(
&self,
watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
) -> Result<(), fidl::Error>;
type RegisterWithAckResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#register_with_ack(
&self,
watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
) -> Self::RegisterWithAckResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RebootMethodsWatcherRegisterSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RebootMethodsWatcherRegisterSynchronousProxy {
type Proxy = RebootMethodsWatcherRegisterProxy;
type Protocol = RebootMethodsWatcherRegisterMarker;
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 RebootMethodsWatcherRegisterSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<RebootMethodsWatcherRegisterMarker 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<RebootMethodsWatcherRegisterEvent, fidl::Error> {
RebootMethodsWatcherRegisterEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#register(
&self,
mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<RebootMethodsWatcherRegisterRegisterRequest>(
(watcher,),
0x1fd793df8385f937,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#register_with_ack(
&self,
mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
RebootMethodsWatcherRegisterRegisterWithAckRequest,
fidl::encoding::EmptyPayload,
>(
(watcher,),
0x243cbccabdac17ec,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct RebootMethodsWatcherRegisterProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for RebootMethodsWatcherRegisterProxy {
type Protocol = RebootMethodsWatcherRegisterMarker;
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 RebootMethodsWatcherRegisterProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RebootMethodsWatcherRegisterEventStream {
RebootMethodsWatcherRegisterEventStream {
event_receiver: self.client.take_event_receiver(),
}
}
pub fn r#register(
&self,
mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
) -> Result<(), fidl::Error> {
RebootMethodsWatcherRegisterProxyInterface::r#register(self, watcher)
}
pub fn r#register_with_ack(
&self,
mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
RebootMethodsWatcherRegisterProxyInterface::r#register_with_ack(self, watcher)
}
}
impl RebootMethodsWatcherRegisterProxyInterface for RebootMethodsWatcherRegisterProxy {
fn r#register(
&self,
mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<RebootMethodsWatcherRegisterRegisterRequest>(
(watcher,),
0x1fd793df8385f937,
fidl::encoding::DynamicFlags::empty(),
)
}
type RegisterWithAckResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#register_with_ack(
&self,
mut watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
) -> Self::RegisterWithAckResponseFut {
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,
0x243cbccabdac17ec,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<RebootMethodsWatcherRegisterRegisterWithAckRequest, ()>(
(watcher,),
0x243cbccabdac17ec,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RebootMethodsWatcherRegisterEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for RebootMethodsWatcherRegisterEventStream {}
impl futures::stream::FusedStream for RebootMethodsWatcherRegisterEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RebootMethodsWatcherRegisterEventStream {
type Item = Result<RebootMethodsWatcherRegisterEvent, 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(RebootMethodsWatcherRegisterEvent::decode(buf)))
}
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RebootMethodsWatcherRegisterEvent {}
impl RebootMethodsWatcherRegisterEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<RebootMethodsWatcherRegisterEvent, 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: <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
})
}
}
}
pub struct RebootMethodsWatcherRegisterRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for RebootMethodsWatcherRegisterRequestStream {}
impl futures::stream::FusedStream for RebootMethodsWatcherRegisterRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RebootMethodsWatcherRegisterRequestStream {
type Protocol = RebootMethodsWatcherRegisterMarker;
type ControlHandle = RebootMethodsWatcherRegisterControlHandle;
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 {
RebootMethodsWatcherRegisterControlHandle { 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 RebootMethodsWatcherRegisterRequestStream {
type Item = Result<RebootMethodsWatcherRegisterRequest, 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 RebootMethodsWatcherRegisterRequestStream 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 {
0x1fd793df8385f937 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(RebootMethodsWatcherRegisterRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootMethodsWatcherRegisterRegisterRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RebootMethodsWatcherRegisterControlHandle {
inner: this.inner.clone(),
};
Ok(RebootMethodsWatcherRegisterRequest::Register {watcher: req.watcher,
control_handle,
})
}
0x243cbccabdac17ec => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RebootMethodsWatcherRegisterRegisterWithAckRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootMethodsWatcherRegisterRegisterWithAckRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RebootMethodsWatcherRegisterControlHandle {
inner: this.inner.clone(),
};
Ok(RebootMethodsWatcherRegisterRequest::RegisterWithAck {watcher: req.watcher,
responder: RebootMethodsWatcherRegisterRegisterWithAckResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <RebootMethodsWatcherRegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum RebootMethodsWatcherRegisterRequest {
Register {
watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
control_handle: RebootMethodsWatcherRegisterControlHandle,
},
RegisterWithAck {
watcher: fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
responder: RebootMethodsWatcherRegisterRegisterWithAckResponder,
},
}
impl RebootMethodsWatcherRegisterRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_register(
self,
) -> Option<(
fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
RebootMethodsWatcherRegisterControlHandle,
)> {
if let RebootMethodsWatcherRegisterRequest::Register { watcher, control_handle } = self {
Some((watcher, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_register_with_ack(
self,
) -> Option<(
fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
RebootMethodsWatcherRegisterRegisterWithAckResponder,
)> {
if let RebootMethodsWatcherRegisterRequest::RegisterWithAck { watcher, responder } = self {
Some((watcher, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RebootMethodsWatcherRegisterRequest::Register { .. } => "register",
RebootMethodsWatcherRegisterRequest::RegisterWithAck { .. } => "register_with_ack",
}
}
}
#[derive(Debug, Clone)]
pub struct RebootMethodsWatcherRegisterControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for RebootMethodsWatcherRegisterControlHandle {
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 RebootMethodsWatcherRegisterControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RebootMethodsWatcherRegisterRegisterWithAckResponder {
control_handle: std::mem::ManuallyDrop<RebootMethodsWatcherRegisterControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RebootMethodsWatcherRegisterRegisterWithAckResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RebootMethodsWatcherRegisterRegisterWithAckResponder {
type ControlHandle = RebootMethodsWatcherRegisterControlHandle;
fn control_handle(&self) -> &RebootMethodsWatcherRegisterControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RebootMethodsWatcherRegisterRegisterWithAckResponder {
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,
0x243cbccabdac17ec,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for RebootReason {
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 RebootReason {
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 RebootReason {
#[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 RebootReason {
#[inline(always)]
fn new_empty() -> Self {
Self::UserRequest
}
#[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 AdminMexecRequest {
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 AdminMexecRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl
fidl::encoding::Encode<AdminMexecRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut AdminMexecRequest
{
#[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::<AdminMexecRequest>(offset);
fidl::encoding::Encode::<AdminMexecRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.kernel_zbi),
<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data_zbi),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<AdminMexecRequest, 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::<AdminMexecRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AdminMexecRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
kernel_zbi: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
data_zbi: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, 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::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.kernel_zbi, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data_zbi, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AdminRebootRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AdminRebootRequest {
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<AdminRebootRequest, D>
for &AdminRebootRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AdminRebootRequest>(offset);
fidl::encoding::Encode::<AdminRebootRequest, D>::encode(
(<RebootReason as fidl::encoding::ValueTypeMarker>::borrow(&self.reason),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RebootReason, D>>
fidl::encoding::Encode<AdminRebootRequest, 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::<AdminRebootRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AdminRebootRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { reason: fidl::new_empty!(RebootReason, 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!(RebootReason, D, &mut self.reason, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RebootMethodsWatcherOnRebootRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RebootMethodsWatcherOnRebootRequest {
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<RebootMethodsWatcherOnRebootRequest, D>
for &RebootMethodsWatcherOnRebootRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RebootMethodsWatcherOnRebootRequest>(offset);
fidl::encoding::Encode::<RebootMethodsWatcherOnRebootRequest, D>::encode(
(<RebootReason as fidl::encoding::ValueTypeMarker>::borrow(&self.reason),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RebootReason, D>>
fidl::encoding::Encode<RebootMethodsWatcherOnRebootRequest, 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::<RebootMethodsWatcherOnRebootRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RebootMethodsWatcherOnRebootRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { reason: fidl::new_empty!(RebootReason, 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!(RebootReason, D, &mut self.reason, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for RebootMethodsWatcherRegisterRegisterRequest {
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 RebootMethodsWatcherRegisterRegisterRequest {
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<
RebootMethodsWatcherRegisterRegisterRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut RebootMethodsWatcherRegisterRegisterRequest
{
#[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::<RebootMethodsWatcherRegisterRegisterRequest>(offset);
fidl::encoding::Encode::<
RebootMethodsWatcherRegisterRegisterRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.watcher
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
RebootMethodsWatcherRegisterRegisterRequest,
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::<RebootMethodsWatcherRegisterRegisterRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for RebootMethodsWatcherRegisterRegisterRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
watcher: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
>,
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::ClientEnd<RebootMethodsWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.watcher,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for RebootMethodsWatcherRegisterRegisterWithAckRequest {
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 RebootMethodsWatcherRegisterRegisterWithAckRequest {
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<
RebootMethodsWatcherRegisterRegisterWithAckRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut RebootMethodsWatcherRegisterRegisterWithAckRequest
{
#[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::<RebootMethodsWatcherRegisterRegisterWithAckRequest>(offset);
fidl::encoding::Encode::<
RebootMethodsWatcherRegisterRegisterWithAckRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.watcher
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
RebootMethodsWatcherRegisterRegisterWithAckRequest,
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::<RebootMethodsWatcherRegisterRegisterWithAckRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for RebootMethodsWatcherRegisterRegisterWithAckRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
watcher: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<RebootMethodsWatcherMarker>,
>,
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::ClientEnd<RebootMethodsWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.watcher,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
}