#![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_REASONS: u8 = 100;
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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum RebootReason2 {
UserRequest,
SystemUpdate,
RetrySystemUpdate,
HighTemperature,
FactoryDataReset,
SessionFailure,
SysmgrFailure,
CriticalComponentFailure,
ZbiSwap,
OutOfMemory,
NetstackMigration,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! RebootReason2Unknown {
() => {
_
};
}
impl RebootReason2 {
#[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),
11 => Some(Self::NetstackMigration),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::UserRequest,
2 => Self::SystemUpdate,
8 => Self::RetrySystemUpdate,
3 => Self::HighTemperature,
6 => Self::FactoryDataReset,
4 => Self::SessionFailure,
5 => Self::SysmgrFailure,
7 => Self::CriticalComponentFailure,
9 => Self::ZbiSwap,
10 => Self::OutOfMemory,
11 => Self::NetstackMigration,
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::UserRequest => 1,
Self::SystemUpdate => 2,
Self::RetrySystemUpdate => 8,
Self::HighTemperature => 3,
Self::FactoryDataReset => 6,
Self::SessionFailure => 4,
Self::SysmgrFailure => 5,
Self::CriticalComponentFailure => 7,
Self::ZbiSwap => 9,
Self::OutOfMemory => 10,
Self::NetstackMigration => 11,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => 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, Debug, PartialEq)]
pub struct AdminPerformRebootRequest {
pub options: RebootOptions,
}
impl fidl::Persistable for AdminPerformRebootRequest {}
#[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 RebootMethodsWatcherRegisterRegisterWatcherRequest {
pub watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for RebootMethodsWatcherRegisterRegisterWatcherRequest
{
}
#[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(Clone, Debug, PartialEq)]
pub struct RebootWatcherOnRebootRequest {
pub options: RebootOptions,
}
impl fidl::Persistable for RebootWatcherOnRebootRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct RebootOptions {
pub reasons: Option<Vec<RebootReason2>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for RebootOptions {}
#[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 AdminPerformRebootResult = 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 PerformRebootResponseFut: std::future::Future<Output = Result<AdminPerformRebootResult, fidl::Error>>
+ Send;
fn r#perform_reboot(&self, options: &RebootOptions) -> Self::PerformRebootResponseFut;
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#perform_reboot(
&self,
mut options: &RebootOptions,
___deadline: zx::MonotonicInstant,
) -> Result<AdminPerformRebootResult, fidl::Error> {
let _response = self.client.send_query::<
AdminPerformRebootRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(options,),
0x9416b4d36a80b4,
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#perform_reboot(
&self,
mut options: &RebootOptions,
) -> fidl::client::QueryResponseFut<
AdminPerformRebootResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AdminProxyInterface::r#perform_reboot(self, options)
}
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 PerformRebootResponseFut = fidl::client::QueryResponseFut<
AdminPerformRebootResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#perform_reboot(&self, mut options: &RebootOptions) -> Self::PerformRebootResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AdminPerformRebootResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x9416b4d36a80b4,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<AdminPerformRebootRequest, AdminPerformRebootResult>(
(options,),
0x9416b4d36a80b4,
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,
},
})
}
0x9416b4d36a80b4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AdminPerformRebootRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdminPerformRebootRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AdminControlHandle { inner: this.inner.clone() };
Ok(AdminRequest::PerformReboot {
options: req.options,
responder: AdminPerformRebootResponder {
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 },
PerformReboot { options: RebootOptions, responder: AdminPerformRebootResponder },
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_perform_reboot(self) -> Option<(RebootOptions, AdminPerformRebootResponder)> {
if let AdminRequest::PerformReboot { options, responder } = self {
Some((options, 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::PerformReboot { .. } => "perform_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 AdminPerformRebootResponder {
control_handle: std::mem::ManuallyDrop<AdminControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AdminPerformRebootResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AdminPerformRebootResponder {
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 AdminPerformRebootResponder {
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,
0x9416b4d36a80b4,
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;
type RegisterWatcherResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#register_watcher(
&self,
watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
) -> Self::RegisterWatcherResponseFut;
}
#[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)
}
pub fn r#register_watcher(
&self,
mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
RebootMethodsWatcherRegisterRegisterWatcherRequest,
fidl::encoding::EmptyPayload,
>(
(watcher,),
0x3e6610e78471238,
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)
}
pub fn r#register_watcher(
&self,
mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
RebootMethodsWatcherRegisterProxyInterface::r#register_watcher(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,
)
}
type RegisterWatcherResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#register_watcher(
&self,
mut watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
) -> Self::RegisterWatcherResponseFut {
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,
0x3e6610e78471238,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<RebootMethodsWatcherRegisterRegisterWatcherRequest, ()>(
(watcher,),
0x3e6610e78471238,
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,
},
})
}
0x3e6610e78471238 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RebootMethodsWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RebootMethodsWatcherRegisterControlHandle {
inner: this.inner.clone(),
};
Ok(RebootMethodsWatcherRegisterRequest::RegisterWatcher {watcher: req.watcher,
responder: RebootMethodsWatcherRegisterRegisterWatcherResponder {
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,
},
RegisterWatcher {
watcher: fidl::endpoints::ClientEnd<RebootWatcherMarker>,
responder: RebootMethodsWatcherRegisterRegisterWatcherResponder,
},
}
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
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_register_watcher(
self,
) -> Option<(
fidl::endpoints::ClientEnd<RebootWatcherMarker>,
RebootMethodsWatcherRegisterRegisterWatcherResponder,
)> {
if let RebootMethodsWatcherRegisterRequest::RegisterWatcher { 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",
RebootMethodsWatcherRegisterRequest::RegisterWatcher { .. } => "register_watcher",
}
}
}
#[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(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RebootMethodsWatcherRegisterRegisterWatcherResponder {
control_handle: std::mem::ManuallyDrop<RebootMethodsWatcherRegisterControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RebootMethodsWatcherRegisterRegisterWatcherResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RebootMethodsWatcherRegisterRegisterWatcherResponder {
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 RebootMethodsWatcherRegisterRegisterWatcherResponder {
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,
0x3e6610e78471238,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RebootWatcherMarker;
impl fidl::endpoints::ProtocolMarker for RebootWatcherMarker {
type Proxy = RebootWatcherProxy;
type RequestStream = RebootWatcherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RebootWatcherSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) RebootWatcher";
}
pub trait RebootWatcherProxyInterface: Send + Sync {
type OnRebootResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#on_reboot(&self, options: &RebootOptions) -> Self::OnRebootResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RebootWatcherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RebootWatcherSynchronousProxy {
type Proxy = RebootWatcherProxy;
type Protocol = RebootWatcherMarker;
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 RebootWatcherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RebootWatcherMarker 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<RebootWatcherEvent, fidl::Error> {
RebootWatcherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#on_reboot(
&self,
mut options: &RebootOptions,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<RebootWatcherOnRebootRequest, fidl::encoding::EmptyPayload>(
(options,),
0x5334bbbe774f13c3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct RebootWatcherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for RebootWatcherProxy {
type Protocol = RebootWatcherMarker;
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 RebootWatcherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RebootWatcherEventStream {
RebootWatcherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#on_reboot(
&self,
mut options: &RebootOptions,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
RebootWatcherProxyInterface::r#on_reboot(self, options)
}
}
impl RebootWatcherProxyInterface for RebootWatcherProxy {
type OnRebootResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#on_reboot(&self, mut options: &RebootOptions) -> 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,
0x5334bbbe774f13c3,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<RebootWatcherOnRebootRequest, ()>(
(options,),
0x5334bbbe774f13c3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RebootWatcherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for RebootWatcherEventStream {}
impl futures::stream::FusedStream for RebootWatcherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RebootWatcherEventStream {
type Item = Result<RebootWatcherEvent, 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(RebootWatcherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RebootWatcherEvent {}
impl RebootWatcherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<RebootWatcherEvent, 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: <RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RebootWatcherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for RebootWatcherRequestStream {}
impl futures::stream::FusedStream for RebootWatcherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RebootWatcherRequestStream {
type Protocol = RebootWatcherMarker;
type ControlHandle = RebootWatcherControlHandle;
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 {
RebootWatcherControlHandle { 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 RebootWatcherRequestStream {
type Item = Result<RebootWatcherRequest, 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 RebootWatcherRequestStream 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 {
0x5334bbbe774f13c3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RebootWatcherOnRebootRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RebootWatcherOnRebootRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
RebootWatcherControlHandle { inner: this.inner.clone() };
Ok(RebootWatcherRequest::OnReboot {
options: req.options,
responder: RebootWatcherOnRebootResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RebootWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum RebootWatcherRequest {
OnReboot { options: RebootOptions, responder: RebootWatcherOnRebootResponder },
}
impl RebootWatcherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_on_reboot(self) -> Option<(RebootOptions, RebootWatcherOnRebootResponder)> {
if let RebootWatcherRequest::OnReboot { options, responder } = self {
Some((options, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RebootWatcherRequest::OnReboot { .. } => "on_reboot",
}
}
}
#[derive(Debug, Clone)]
pub struct RebootWatcherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for RebootWatcherControlHandle {
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 RebootWatcherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RebootWatcherOnRebootResponder {
control_handle: std::mem::ManuallyDrop<RebootWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RebootWatcherOnRebootResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RebootWatcherOnRebootResponder {
type ControlHandle = RebootWatcherControlHandle;
fn control_handle(&self) -> &RebootWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RebootWatcherOnRebootResponder {
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,
0x5334bbbe774f13c3,
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(())
}
}
unsafe impl fidl::encoding::TypeMarker for RebootReason2 {
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 RebootReason2 {
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 RebootReason2 {
#[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 RebootReason2 {
#[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::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 AdminPerformRebootRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AdminPerformRebootRequest {
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<AdminPerformRebootRequest, D> for &AdminPerformRebootRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AdminPerformRebootRequest>(offset);
fidl::encoding::Encode::<AdminPerformRebootRequest, D>::encode(
(<RebootOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RebootOptions, D>>
fidl::encoding::Encode<AdminPerformRebootRequest, 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::<AdminPerformRebootRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AdminPerformRebootRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { options: fidl::new_empty!(RebootOptions, 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!(RebootOptions, D, &mut self.options, decoder, offset + 0, _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 RebootMethodsWatcherRegisterRegisterWatcherRequest {
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 RebootMethodsWatcherRegisterRegisterWatcherRequest {
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<
RebootMethodsWatcherRegisterRegisterWatcherRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut RebootMethodsWatcherRegisterRegisterWatcherRequest
{
#[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::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(offset);
fidl::encoding::Encode::<RebootMethodsWatcherRegisterRegisterWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>> 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<RebootWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
RebootMethodsWatcherRegisterRegisterWatcherRequest,
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::<RebootMethodsWatcherRegisterRegisterWatcherRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for RebootMethodsWatcherRegisterRegisterWatcherRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
watcher: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RebootWatcherMarker>>,
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<RebootWatcherMarker>>,
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(())
}
}
impl fidl::encoding::ValueTypeMarker for RebootWatcherOnRebootRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RebootWatcherOnRebootRequest {
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<RebootWatcherOnRebootRequest, D> for &RebootWatcherOnRebootRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RebootWatcherOnRebootRequest>(offset);
fidl::encoding::Encode::<RebootWatcherOnRebootRequest, D>::encode(
(<RebootOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RebootOptions, D>>
fidl::encoding::Encode<RebootWatcherOnRebootRequest, 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::<RebootWatcherOnRebootRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RebootWatcherOnRebootRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { options: fidl::new_empty!(RebootOptions, 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!(RebootOptions, D, &mut self.options, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl RebootOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.reasons {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for RebootOptions {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RebootOptions {
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<RebootOptions, D>
for &RebootOptions
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RebootOptions>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<RebootReason2, 100>, D>(
self.reasons.as_ref().map(<fidl::encoding::Vector<RebootReason2, 100> as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RebootOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Vector<RebootReason2, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.reasons.get_or_insert_with(
|| fidl::new_empty!(fidl::encoding::Vector<RebootReason2, 100>, D),
);
fidl::decode!(fidl::encoding::Vector<RebootReason2, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
}