#![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_MODE_MATCHES_PER_CLIENT: u32 = 0;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ModeRequestError {
Generic,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! ModeRequestErrorUnknown {
() => {
_
};
}
impl ModeRequestError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Generic),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Generic,
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::Generic => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum SystemMode {
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! SystemModeUnknown {
() => {
_
};
}
impl SystemMode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
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::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
}
}
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ClientConfig {
pub mode_matches: Vec<ModeMatch>,
pub default_level: u64,
}
impl fidl::Persistable for ClientConfig {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ClientConfiguratorGetRequest {
pub client_type: fidl_fuchsia_power_clientlevel::ClientType,
}
impl fidl::Persistable for ClientConfiguratorGetRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ClientConfiguratorGetResponse {
pub config: Option<Box<ClientConfig>>,
}
impl fidl::Persistable for ClientConfiguratorGetResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ClientConfiguratorSetRequest {
pub client_type: fidl_fuchsia_power_clientlevel::ClientType,
pub config: ClientConfig,
}
impl fidl::Persistable for ClientConfiguratorSetRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ModeMatch {
pub mode: SystemMode,
pub power_level: u64,
}
impl fidl::Persistable for ModeMatch {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RequesterRequestRequest {
pub mode: SystemMode,
pub set: bool,
}
impl fidl::Persistable for RequesterRequestRequest {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ClientConfiguratorMarker;
impl fidl::endpoints::ProtocolMarker for ClientConfiguratorMarker {
type Proxy = ClientConfiguratorProxy;
type RequestStream = ClientConfiguratorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ClientConfiguratorSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.power.systemmode.ClientConfigurator";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ClientConfiguratorMarker {}
pub trait ClientConfiguratorProxyInterface: Send + Sync {
type GetResponseFut: std::future::Future<Output = Result<Option<Box<ClientConfig>>, fidl::Error>>
+ Send;
fn r#get(
&self,
client_type: fidl_fuchsia_power_clientlevel::ClientType,
) -> Self::GetResponseFut;
type SetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#set(
&self,
client_type: fidl_fuchsia_power_clientlevel::ClientType,
config: &ClientConfig,
) -> Self::SetResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ClientConfiguratorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ClientConfiguratorSynchronousProxy {
type Proxy = ClientConfiguratorProxy;
type Protocol = ClientConfiguratorMarker;
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 ClientConfiguratorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ClientConfiguratorMarker 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<ClientConfiguratorEvent, fidl::Error> {
ClientConfiguratorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get(
&self,
mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
___deadline: zx::MonotonicInstant,
) -> Result<Option<Box<ClientConfig>>, fidl::Error> {
let _response =
self.client.send_query::<ClientConfiguratorGetRequest, ClientConfiguratorGetResponse>(
(client_type,),
0x1e37597b4d247d7b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.config)
}
pub fn r#set(
&self,
mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
mut config: &ClientConfig,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<ClientConfiguratorSetRequest, fidl::encoding::EmptyPayload>(
(client_type, config),
0x2204fb91b32f6435,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ClientConfiguratorProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ClientConfiguratorProxy {
type Protocol = ClientConfiguratorMarker;
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 ClientConfiguratorProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ClientConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ClientConfiguratorEventStream {
ClientConfiguratorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get(
&self,
mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
) -> fidl::client::QueryResponseFut<
Option<Box<ClientConfig>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ClientConfiguratorProxyInterface::r#get(self, client_type)
}
pub fn r#set(
&self,
mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
mut config: &ClientConfig,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ClientConfiguratorProxyInterface::r#set(self, client_type, config)
}
}
impl ClientConfiguratorProxyInterface for ClientConfiguratorProxy {
type GetResponseFut = fidl::client::QueryResponseFut<
Option<Box<ClientConfig>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get(
&self,
mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
) -> Self::GetResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Option<Box<ClientConfig>>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ClientConfiguratorGetResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1e37597b4d247d7b,
>(_buf?)?;
Ok(_response.config)
}
self.client
.send_query_and_decode::<ClientConfiguratorGetRequest, Option<Box<ClientConfig>>>(
(client_type,),
0x1e37597b4d247d7b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#set(
&self,
mut client_type: fidl_fuchsia_power_clientlevel::ClientType,
mut config: &ClientConfig,
) -> Self::SetResponseFut {
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,
0x2204fb91b32f6435,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ClientConfiguratorSetRequest, ()>(
(client_type, config),
0x2204fb91b32f6435,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ClientConfiguratorEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ClientConfiguratorEventStream {}
impl futures::stream::FusedStream for ClientConfiguratorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ClientConfiguratorEventStream {
type Item = Result<ClientConfiguratorEvent, 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(ClientConfiguratorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ClientConfiguratorEvent {}
impl ClientConfiguratorEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ClientConfiguratorEvent, 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:
<ClientConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ClientConfiguratorRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ClientConfiguratorRequestStream {}
impl futures::stream::FusedStream for ClientConfiguratorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ClientConfiguratorRequestStream {
type Protocol = ClientConfiguratorMarker;
type ControlHandle = ClientConfiguratorControlHandle;
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 {
ClientConfiguratorControlHandle { 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 ClientConfiguratorRequestStream {
type Item = Result<ClientConfiguratorRequest, 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 ClientConfiguratorRequestStream 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 {
0x1e37597b4d247d7b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ClientConfiguratorGetRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientConfiguratorGetRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ClientConfiguratorControlHandle {
inner: this.inner.clone(),
};
Ok(ClientConfiguratorRequest::Get {client_type: req.client_type,
responder: ClientConfiguratorGetResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2204fb91b32f6435 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ClientConfiguratorSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientConfiguratorSetRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ClientConfiguratorControlHandle {
inner: this.inner.clone(),
};
Ok(ClientConfiguratorRequest::Set {client_type: req.client_type,
config: req.config,
responder: ClientConfiguratorSetResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ClientConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ClientConfiguratorRequest {
Get {
client_type: fidl_fuchsia_power_clientlevel::ClientType,
responder: ClientConfiguratorGetResponder,
},
Set {
client_type: fidl_fuchsia_power_clientlevel::ClientType,
config: ClientConfig,
responder: ClientConfiguratorSetResponder,
},
}
impl ClientConfiguratorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get(
self,
) -> Option<(fidl_fuchsia_power_clientlevel::ClientType, ClientConfiguratorGetResponder)> {
if let ClientConfiguratorRequest::Get { client_type, responder } = self {
Some((client_type, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set(
self,
) -> Option<(
fidl_fuchsia_power_clientlevel::ClientType,
ClientConfig,
ClientConfiguratorSetResponder,
)> {
if let ClientConfiguratorRequest::Set { client_type, config, responder } = self {
Some((client_type, config, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ClientConfiguratorRequest::Get { .. } => "get",
ClientConfiguratorRequest::Set { .. } => "set",
}
}
}
#[derive(Debug, Clone)]
pub struct ClientConfiguratorControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ClientConfiguratorControlHandle {
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 ClientConfiguratorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ClientConfiguratorGetResponder {
control_handle: std::mem::ManuallyDrop<ClientConfiguratorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ClientConfiguratorGetResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ClientConfiguratorGetResponder {
type ControlHandle = ClientConfiguratorControlHandle;
fn control_handle(&self) -> &ClientConfiguratorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ClientConfiguratorGetResponder {
pub fn send(self, mut config: Option<&ClientConfig>) -> Result<(), fidl::Error> {
let _result = self.send_raw(config);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut config: Option<&ClientConfig>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(config);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut config: Option<&ClientConfig>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ClientConfiguratorGetResponse>(
(config,),
self.tx_id,
0x1e37597b4d247d7b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ClientConfiguratorSetResponder {
control_handle: std::mem::ManuallyDrop<ClientConfiguratorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ClientConfiguratorSetResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ClientConfiguratorSetResponder {
type ControlHandle = ClientConfiguratorControlHandle;
fn control_handle(&self) -> &ClientConfiguratorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ClientConfiguratorSetResponder {
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,
0x2204fb91b32f6435,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RequesterMarker;
impl fidl::endpoints::ProtocolMarker for RequesterMarker {
type Proxy = RequesterProxy;
type RequestStream = RequesterRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RequesterSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.power.systemmode.Requester";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RequesterMarker {}
pub type RequesterRequestResult = Result<(), ModeRequestError>;
pub trait RequesterProxyInterface: Send + Sync {
type RequestResponseFut: std::future::Future<Output = Result<RequesterRequestResult, fidl::Error>>
+ Send;
fn r#request(&self, mode: SystemMode, set: bool) -> Self::RequestResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RequesterSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RequesterSynchronousProxy {
type Proxy = RequesterProxy;
type Protocol = RequesterMarker;
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 RequesterSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RequesterMarker 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<RequesterEvent, fidl::Error> {
RequesterEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#request(
&self,
mut mode: SystemMode,
mut set: bool,
___deadline: zx::MonotonicInstant,
) -> Result<RequesterRequestResult, fidl::Error> {
let _response = self.client.send_query::<
RequesterRequestRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ModeRequestError>,
>(
(mode, set,),
0x5603afcd4421f425,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct RequesterProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for RequesterProxy {
type Protocol = RequesterMarker;
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 RequesterProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <RequesterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RequesterEventStream {
RequesterEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#request(
&self,
mut mode: SystemMode,
mut set: bool,
) -> fidl::client::QueryResponseFut<
RequesterRequestResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
RequesterProxyInterface::r#request(self, mode, set)
}
}
impl RequesterProxyInterface for RequesterProxy {
type RequestResponseFut = fidl::client::QueryResponseFut<
RequesterRequestResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#request(&self, mut mode: SystemMode, mut set: bool) -> Self::RequestResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<RequesterRequestResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ModeRequestError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5603afcd4421f425,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<RequesterRequestRequest, RequesterRequestResult>(
(mode, set),
0x5603afcd4421f425,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RequesterEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for RequesterEventStream {}
impl futures::stream::FusedStream for RequesterEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RequesterEventStream {
type Item = Result<RequesterEvent, 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(RequesterEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RequesterEvent {}
impl RequesterEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<RequesterEvent, 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: <RequesterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RequesterRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for RequesterRequestStream {}
impl futures::stream::FusedStream for RequesterRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RequesterRequestStream {
type Protocol = RequesterMarker;
type ControlHandle = RequesterControlHandle;
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 {
RequesterControlHandle { 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 RequesterRequestStream {
type Item = Result<RequesterRequest, 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 RequesterRequestStream 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 {
0x5603afcd4421f425 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RequesterRequestRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RequesterRequestRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RequesterControlHandle { inner: this.inner.clone() };
Ok(RequesterRequest::Request {
mode: req.mode,
set: req.set,
responder: RequesterRequestResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RequesterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum RequesterRequest {
Request { mode: SystemMode, set: bool, responder: RequesterRequestResponder },
}
impl RequesterRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_request(self) -> Option<(SystemMode, bool, RequesterRequestResponder)> {
if let RequesterRequest::Request { mode, set, responder } = self {
Some((mode, set, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RequesterRequest::Request { .. } => "request",
}
}
}
#[derive(Debug, Clone)]
pub struct RequesterControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for RequesterControlHandle {
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 RequesterControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RequesterRequestResponder {
control_handle: std::mem::ManuallyDrop<RequesterControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RequesterRequestResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RequesterRequestResponder {
type ControlHandle = RequesterControlHandle;
fn control_handle(&self) -> &RequesterControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RequesterRequestResponder {
pub fn send(self, mut result: Result<(), ModeRequestError>) -> 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<(), ModeRequestError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), ModeRequestError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
ModeRequestError,
>>(
result,
self.tx_id,
0x5603afcd4421f425,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for ModeRequestError {
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 ModeRequestError {
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 ModeRequestError
{
#[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 ModeRequestError {
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for SystemMode {
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 SystemMode {
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 SystemMode {
#[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 SystemMode {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ClientConfig {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ClientConfig {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClientConfig, D>
for &ClientConfig
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientConfig>(offset);
fidl::encoding::Encode::<ClientConfig, D>::encode(
(
<fidl::encoding::Vector<ModeMatch, 0> as fidl::encoding::ValueTypeMarker>::borrow(&self.mode_matches),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.default_level),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<ModeMatch, 0>, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<ClientConfig, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientConfig>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClientConfig {
#[inline(always)]
fn new_empty() -> Self {
Self {
mode_matches: fidl::new_empty!(fidl::encoding::Vector<ModeMatch, 0>, D),
default_level: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<ModeMatch, 0>, D, &mut self.mode_matches, decoder, offset + 0, _depth)?;
fidl::decode!(u64, D, &mut self.default_level, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ClientConfiguratorGetRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ClientConfiguratorGetRequest {
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<ClientConfiguratorGetRequest, D> for &ClientConfiguratorGetRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientConfiguratorGetRequest>(offset);
fidl::encoding::Encode::<ClientConfiguratorGetRequest, D>::encode(
(
<fidl_fuchsia_power_clientlevel::ClientType as fidl::encoding::ValueTypeMarker>::borrow(&self.client_type),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_power_clientlevel::ClientType, D>,
> fidl::encoding::Encode<ClientConfiguratorGetRequest, 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::<ClientConfiguratorGetRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ClientConfiguratorGetRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { client_type: fidl::new_empty!(fidl_fuchsia_power_clientlevel::ClientType, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_power_clientlevel::ClientType,
D,
&mut self.client_type,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ClientConfiguratorGetResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ClientConfiguratorGetResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ClientConfiguratorGetResponse, D>
for &ClientConfiguratorGetResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientConfiguratorGetResponse>(offset);
fidl::encoding::Encode::<ClientConfiguratorGetResponse, D>::encode(
(<fidl::encoding::Boxed<ClientConfig> as fidl::encoding::ValueTypeMarker>::borrow(
&self.config,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Boxed<ClientConfig>, D>,
> fidl::encoding::Encode<ClientConfiguratorGetResponse, 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::<ClientConfiguratorGetResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ClientConfiguratorGetResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { config: fidl::new_empty!(fidl::encoding::Boxed<ClientConfig>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Boxed<ClientConfig>,
D,
&mut self.config,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ClientConfiguratorSetRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ClientConfiguratorSetRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ClientConfiguratorSetRequest, D> for &ClientConfiguratorSetRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientConfiguratorSetRequest>(offset);
fidl::encoding::Encode::<ClientConfiguratorSetRequest, D>::encode(
(
<fidl_fuchsia_power_clientlevel::ClientType as fidl::encoding::ValueTypeMarker>::borrow(&self.client_type),
<ClientConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_power_clientlevel::ClientType, D>,
T1: fidl::encoding::Encode<ClientConfig, D>,
> fidl::encoding::Encode<ClientConfiguratorSetRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ClientConfiguratorSetRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ClientConfiguratorSetRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
client_type: fidl::new_empty!(fidl_fuchsia_power_clientlevel::ClientType, D),
config: fidl::new_empty!(ClientConfig, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_power_clientlevel::ClientType,
D,
&mut self.client_type,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(ClientConfig, D, &mut self.config, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ModeMatch {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ModeMatch {
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<ModeMatch, D>
for &ModeMatch
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ModeMatch>(offset);
fidl::encoding::Encode::<ModeMatch, D>::encode(
(
<SystemMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.power_level),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<SystemMode, D>,
T1: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<ModeMatch, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ModeMatch>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ModeMatch {
#[inline(always)]
fn new_empty() -> Self {
Self { mode: fidl::new_empty!(SystemMode, D), power_level: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(SystemMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
fidl::decode!(u64, D, &mut self.power_level, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RequesterRequestRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RequesterRequestRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<RequesterRequestRequest, D> for &RequesterRequestRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RequesterRequestRequest>(offset);
fidl::encoding::Encode::<RequesterRequestRequest, D>::encode(
(
<SystemMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.set),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<SystemMode, D>,
T1: fidl::encoding::Encode<bool, D>,
> fidl::encoding::Encode<RequesterRequestRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RequesterRequestRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for RequesterRequestRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { mode: fidl::new_empty!(SystemMode, D), set: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffffff00u32;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(SystemMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
fidl::decode!(bool, D, &mut self.set, decoder, offset + 4, _depth)?;
Ok(())
}
}
}