#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub type DependencyType = fidl_fuchsia_power_broker::DependencyType;
pub type ElementName = String;
pub type PowerLevel = u8;
pub const MAX_DEPENDENCIES: u16 = MAX_VALID_POWER_LEVELS as u16;
pub const MAX_ELEMENTS: u16 = 256;
pub const MAX_ELEMENT_NAME_LEN: u16 = fidl_fuchsia_power_broker::MAX_ELEMENT_NAME_LEN as u16;
pub const MAX_VALID_POWER_LEVELS: u16 = fidl_fuchsia_power_broker::MAX_VALID_POWER_LEVELS as u16;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum CreateTopologyGraphError {
Internal = 1,
InvalidTopology = 2,
}
impl CreateTopologyGraphError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Internal),
2 => Some(Self::InvalidTopology),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum LeaseControlError {
Internal = 1,
InvalidElement = 2,
}
impl LeaseControlError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Internal),
2 => Some(Self::InvalidElement),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum OpenStatusChannelError {
Internal = 1,
InvalidElement = 2,
}
impl OpenStatusChannelError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Internal),
2 => Some(Self::InvalidElement),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum SystemActivityControlError {
Internal = 1,
}
impl SystemActivityControlError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Internal),
_ => 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(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Element {
pub element_name: String,
pub initial_current_level: u8,
pub valid_levels: Vec<u8>,
pub dependencies: Vec<LevelDependency>,
}
impl fidl::Persistable for Element {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LevelDependency {
pub dependency_type: fidl_fuchsia_power_broker::DependencyType,
pub dependent_level: u8,
pub requires_element: String,
pub requires_level: u8,
}
impl fidl::Persistable for LevelDependency {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TopologyControlAcquireLeaseRequest {
pub element_name: String,
pub level: u8,
}
impl fidl::Persistable for TopologyControlAcquireLeaseRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TopologyControlCreateRequest {
pub elements: Vec<Element>,
}
impl fidl::Persistable for TopologyControlCreateRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TopologyControlDropLeaseRequest {
pub element_name: String,
}
impl fidl::Persistable for TopologyControlDropLeaseRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TopologyControlOpenStatusChannelRequest {
pub element_name: String,
pub status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for TopologyControlOpenStatusChannelRequest
{
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SystemActivityControlMarker;
impl fidl::endpoints::ProtocolMarker for SystemActivityControlMarker {
type Proxy = SystemActivityControlProxy;
type RequestStream = SystemActivityControlRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SystemActivityControlSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.power.topology.test.SystemActivityControl";
}
impl fidl::endpoints::DiscoverableProtocolMarker for SystemActivityControlMarker {}
pub type SystemActivityControlStartApplicationActivityResult =
Result<(), SystemActivityControlError>;
pub type SystemActivityControlStopApplicationActivityResult =
Result<(), SystemActivityControlError>;
pub trait SystemActivityControlProxyInterface: Send + Sync {
type StartApplicationActivityResponseFut: std::future::Future<
Output = Result<SystemActivityControlStartApplicationActivityResult, fidl::Error>,
> + Send;
fn r#start_application_activity(&self) -> Self::StartApplicationActivityResponseFut;
type StopApplicationActivityResponseFut: std::future::Future<
Output = Result<SystemActivityControlStopApplicationActivityResult, fidl::Error>,
> + Send;
fn r#stop_application_activity(&self) -> Self::StopApplicationActivityResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SystemActivityControlSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SystemActivityControlSynchronousProxy {
type Proxy = SystemActivityControlProxy;
type Protocol = SystemActivityControlMarker;
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 SystemActivityControlSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<SystemActivityControlMarker 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<SystemActivityControlEvent, fidl::Error> {
SystemActivityControlEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#start_application_activity(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<SystemActivityControlStartApplicationActivityResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
SystemActivityControlError,
>>(
(),
0x61de6f5d5285a4e3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#stop_application_activity(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<SystemActivityControlStopApplicationActivityResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
SystemActivityControlError,
>>(
(),
0x294ea5c8d0e2e0c0,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct SystemActivityControlProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SystemActivityControlProxy {
type Protocol = SystemActivityControlMarker;
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 SystemActivityControlProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<SystemActivityControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SystemActivityControlEventStream {
SystemActivityControlEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#start_application_activity(
&self,
) -> fidl::client::QueryResponseFut<
SystemActivityControlStartApplicationActivityResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SystemActivityControlProxyInterface::r#start_application_activity(self)
}
pub fn r#stop_application_activity(
&self,
) -> fidl::client::QueryResponseFut<
SystemActivityControlStopApplicationActivityResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
SystemActivityControlProxyInterface::r#stop_application_activity(self)
}
}
impl SystemActivityControlProxyInterface for SystemActivityControlProxy {
type StartApplicationActivityResponseFut = fidl::client::QueryResponseFut<
SystemActivityControlStartApplicationActivityResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#start_application_activity(&self) -> Self::StartApplicationActivityResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SystemActivityControlStartApplicationActivityResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SystemActivityControlError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x61de6f5d5285a4e3,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
SystemActivityControlStartApplicationActivityResult,
>(
(),
0x61de6f5d5285a4e3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StopApplicationActivityResponseFut = fidl::client::QueryResponseFut<
SystemActivityControlStopApplicationActivityResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#stop_application_activity(&self) -> Self::StopApplicationActivityResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<SystemActivityControlStopApplicationActivityResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SystemActivityControlError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x294ea5c8d0e2e0c0,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
SystemActivityControlStopApplicationActivityResult,
>(
(),
0x294ea5c8d0e2e0c0,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct SystemActivityControlEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SystemActivityControlEventStream {}
impl futures::stream::FusedStream for SystemActivityControlEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SystemActivityControlEventStream {
type Item = Result<SystemActivityControlEvent, 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(SystemActivityControlEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SystemActivityControlEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl SystemActivityControlEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SystemActivityControlEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(SystemActivityControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<SystemActivityControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SystemActivityControlRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SystemActivityControlRequestStream {}
impl futures::stream::FusedStream for SystemActivityControlRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SystemActivityControlRequestStream {
type Protocol = SystemActivityControlMarker;
type ControlHandle = SystemActivityControlControlHandle;
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 {
SystemActivityControlControlHandle { 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 SystemActivityControlRequestStream {
type Item = Result<SystemActivityControlRequest, 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 SystemActivityControlRequestStream 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 {
0x61de6f5d5285a4e3 => {
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 = SystemActivityControlControlHandle {
inner: this.inner.clone(),
};
Ok(SystemActivityControlRequest::StartApplicationActivity {
responder: SystemActivityControlStartApplicationActivityResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x294ea5c8d0e2e0c0 => {
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 = SystemActivityControlControlHandle {
inner: this.inner.clone(),
};
Ok(SystemActivityControlRequest::StopApplicationActivity {
responder: SystemActivityControlStopApplicationActivityResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(SystemActivityControlRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SystemActivityControlControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(SystemActivityControlRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SystemActivityControlControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <SystemActivityControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SystemActivityControlRequest {
StartApplicationActivity { responder: SystemActivityControlStartApplicationActivityResponder },
StopApplicationActivity { responder: SystemActivityControlStopApplicationActivityResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: SystemActivityControlControlHandle,
method_type: fidl::MethodType,
},
}
impl SystemActivityControlRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_start_application_activity(
self,
) -> Option<(SystemActivityControlStartApplicationActivityResponder)> {
if let SystemActivityControlRequest::StartApplicationActivity { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop_application_activity(
self,
) -> Option<(SystemActivityControlStopApplicationActivityResponder)> {
if let SystemActivityControlRequest::StopApplicationActivity { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SystemActivityControlRequest::StartApplicationActivity { .. } => {
"start_application_activity"
}
SystemActivityControlRequest::StopApplicationActivity { .. } => {
"stop_application_activity"
}
SystemActivityControlRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
SystemActivityControlRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct SystemActivityControlControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SystemActivityControlControlHandle {
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 SystemActivityControlControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SystemActivityControlStartApplicationActivityResponder {
control_handle: std::mem::ManuallyDrop<SystemActivityControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SystemActivityControlStartApplicationActivityResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SystemActivityControlStartApplicationActivityResponder {
type ControlHandle = SystemActivityControlControlHandle;
fn control_handle(&self) -> &SystemActivityControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SystemActivityControlStartApplicationActivityResponder {
pub fn send(
self,
mut result: Result<(), SystemActivityControlError>,
) -> 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<(), SystemActivityControlError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), SystemActivityControlError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
SystemActivityControlError,
>>(
result,
self.tx_id,
0x61de6f5d5285a4e3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SystemActivityControlStopApplicationActivityResponder {
control_handle: std::mem::ManuallyDrop<SystemActivityControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SystemActivityControlStopApplicationActivityResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SystemActivityControlStopApplicationActivityResponder {
type ControlHandle = SystemActivityControlControlHandle;
fn control_handle(&self) -> &SystemActivityControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SystemActivityControlStopApplicationActivityResponder {
pub fn send(
self,
mut result: Result<(), SystemActivityControlError>,
) -> 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<(), SystemActivityControlError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), SystemActivityControlError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
SystemActivityControlError,
>>(
result,
self.tx_id,
0x294ea5c8d0e2e0c0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct TopologyControlMarker;
impl fidl::endpoints::ProtocolMarker for TopologyControlMarker {
type Proxy = TopologyControlProxy;
type RequestStream = TopologyControlRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = TopologyControlSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.power.topology.test.TopologyControl";
}
impl fidl::endpoints::DiscoverableProtocolMarker for TopologyControlMarker {}
pub type TopologyControlCreateResult = Result<(), CreateTopologyGraphError>;
pub type TopologyControlAcquireLeaseResult = Result<(), LeaseControlError>;
pub type TopologyControlDropLeaseResult = Result<(), LeaseControlError>;
pub type TopologyControlOpenStatusChannelResult = Result<(), OpenStatusChannelError>;
pub trait TopologyControlProxyInterface: Send + Sync {
type CreateResponseFut: std::future::Future<Output = Result<TopologyControlCreateResult, fidl::Error>>
+ Send;
fn r#create(&self, elements: &[Element]) -> Self::CreateResponseFut;
type AcquireLeaseResponseFut: std::future::Future<Output = Result<TopologyControlAcquireLeaseResult, fidl::Error>>
+ Send;
fn r#acquire_lease(&self, element_name: &str, level: u8) -> Self::AcquireLeaseResponseFut;
type DropLeaseResponseFut: std::future::Future<Output = Result<TopologyControlDropLeaseResult, fidl::Error>>
+ Send;
fn r#drop_lease(&self, element_name: &str) -> Self::DropLeaseResponseFut;
type OpenStatusChannelResponseFut: std::future::Future<Output = Result<TopologyControlOpenStatusChannelResult, fidl::Error>>
+ Send;
fn r#open_status_channel(
&self,
element_name: &str,
status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
) -> Self::OpenStatusChannelResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct TopologyControlSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for TopologyControlSynchronousProxy {
type Proxy = TopologyControlProxy;
type Protocol = TopologyControlMarker;
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 TopologyControlSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <TopologyControlMarker 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<TopologyControlEvent, fidl::Error> {
TopologyControlEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create(
&self,
mut elements: &[Element],
___deadline: zx::MonotonicInstant,
) -> Result<TopologyControlCreateResult, fidl::Error> {
let _response =
self.client.send_query::<TopologyControlCreateRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
CreateTopologyGraphError,
>>(
(elements,),
0x12033976b88716fa,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#acquire_lease(
&self,
mut element_name: &str,
mut level: u8,
___deadline: zx::MonotonicInstant,
) -> Result<TopologyControlAcquireLeaseResult, fidl::Error> {
let _response = self.client.send_query::<
TopologyControlAcquireLeaseRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LeaseControlError>,
>(
(element_name, level,),
0x1bedc35d9b68bac8,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#drop_lease(
&self,
mut element_name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<TopologyControlDropLeaseResult, fidl::Error> {
let _response =
self.client.send_query::<TopologyControlDropLeaseRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
LeaseControlError,
>>(
(element_name,),
0x7107f8f1080faddc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#open_status_channel(
&self,
mut element_name: &str,
mut status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<TopologyControlOpenStatusChannelResult, fidl::Error> {
let _response = self.client.send_query::<
TopologyControlOpenStatusChannelRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OpenStatusChannelError>,
>(
(element_name, status_channel,),
0x69fba616c3ee2e90,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct TopologyControlProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for TopologyControlProxy {
type Protocol = TopologyControlMarker;
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 TopologyControlProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <TopologyControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> TopologyControlEventStream {
TopologyControlEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create(
&self,
mut elements: &[Element],
) -> fidl::client::QueryResponseFut<
TopologyControlCreateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
TopologyControlProxyInterface::r#create(self, elements)
}
pub fn r#acquire_lease(
&self,
mut element_name: &str,
mut level: u8,
) -> fidl::client::QueryResponseFut<
TopologyControlAcquireLeaseResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
TopologyControlProxyInterface::r#acquire_lease(self, element_name, level)
}
pub fn r#drop_lease(
&self,
mut element_name: &str,
) -> fidl::client::QueryResponseFut<
TopologyControlDropLeaseResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
TopologyControlProxyInterface::r#drop_lease(self, element_name)
}
pub fn r#open_status_channel(
&self,
mut element_name: &str,
mut status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
) -> fidl::client::QueryResponseFut<
TopologyControlOpenStatusChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
TopologyControlProxyInterface::r#open_status_channel(self, element_name, status_channel)
}
}
impl TopologyControlProxyInterface for TopologyControlProxy {
type CreateResponseFut = fidl::client::QueryResponseFut<
TopologyControlCreateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create(&self, mut elements: &[Element]) -> Self::CreateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<TopologyControlCreateResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, CreateTopologyGraphError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x12033976b88716fa,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<TopologyControlCreateRequest, TopologyControlCreateResult>(
(elements,),
0x12033976b88716fa,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AcquireLeaseResponseFut = fidl::client::QueryResponseFut<
TopologyControlAcquireLeaseResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#acquire_lease(
&self,
mut element_name: &str,
mut level: u8,
) -> Self::AcquireLeaseResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<TopologyControlAcquireLeaseResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LeaseControlError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1bedc35d9b68bac8,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
TopologyControlAcquireLeaseRequest,
TopologyControlAcquireLeaseResult,
>(
(element_name, level,),
0x1bedc35d9b68bac8,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type DropLeaseResponseFut = fidl::client::QueryResponseFut<
TopologyControlDropLeaseResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#drop_lease(&self, mut element_name: &str) -> Self::DropLeaseResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<TopologyControlDropLeaseResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, LeaseControlError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7107f8f1080faddc,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
TopologyControlDropLeaseRequest,
TopologyControlDropLeaseResult,
>(
(element_name,),
0x7107f8f1080faddc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type OpenStatusChannelResponseFut = fidl::client::QueryResponseFut<
TopologyControlOpenStatusChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#open_status_channel(
&self,
mut element_name: &str,
mut status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
) -> Self::OpenStatusChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<TopologyControlOpenStatusChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OpenStatusChannelError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x69fba616c3ee2e90,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
TopologyControlOpenStatusChannelRequest,
TopologyControlOpenStatusChannelResult,
>(
(element_name, status_channel,),
0x69fba616c3ee2e90,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct TopologyControlEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for TopologyControlEventStream {}
impl futures::stream::FusedStream for TopologyControlEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for TopologyControlEventStream {
type Item = Result<TopologyControlEvent, 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(TopologyControlEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum TopologyControlEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl TopologyControlEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<TopologyControlEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(TopologyControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<TopologyControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct TopologyControlRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for TopologyControlRequestStream {}
impl futures::stream::FusedStream for TopologyControlRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for TopologyControlRequestStream {
type Protocol = TopologyControlMarker;
type ControlHandle = TopologyControlControlHandle;
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 {
TopologyControlControlHandle { 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 TopologyControlRequestStream {
type Item = Result<TopologyControlRequest, 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 TopologyControlRequestStream 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 {
0x12033976b88716fa => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
TopologyControlCreateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TopologyControlCreateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
TopologyControlControlHandle { inner: this.inner.clone() };
Ok(TopologyControlRequest::Create {
elements: req.elements,
responder: TopologyControlCreateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1bedc35d9b68bac8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
TopologyControlAcquireLeaseRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TopologyControlAcquireLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
TopologyControlControlHandle { inner: this.inner.clone() };
Ok(TopologyControlRequest::AcquireLease {
element_name: req.element_name,
level: req.level,
responder: TopologyControlAcquireLeaseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7107f8f1080faddc => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
TopologyControlDropLeaseRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TopologyControlDropLeaseRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
TopologyControlControlHandle { inner: this.inner.clone() };
Ok(TopologyControlRequest::DropLease {
element_name: req.element_name,
responder: TopologyControlDropLeaseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x69fba616c3ee2e90 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
TopologyControlOpenStatusChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TopologyControlOpenStatusChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
TopologyControlControlHandle { inner: this.inner.clone() };
Ok(TopologyControlRequest::OpenStatusChannel {
element_name: req.element_name,
status_channel: req.status_channel,
responder: TopologyControlOpenStatusChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(TopologyControlRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: TopologyControlControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(TopologyControlRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: TopologyControlControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<TopologyControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum TopologyControlRequest {
Create {
elements: Vec<Element>,
responder: TopologyControlCreateResponder,
},
AcquireLease {
element_name: String,
level: u8,
responder: TopologyControlAcquireLeaseResponder,
},
DropLease {
element_name: String,
responder: TopologyControlDropLeaseResponder,
},
OpenStatusChannel {
element_name: String,
status_channel: fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
responder: TopologyControlOpenStatusChannelResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: TopologyControlControlHandle,
method_type: fidl::MethodType,
},
}
impl TopologyControlRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create(self) -> Option<(Vec<Element>, TopologyControlCreateResponder)> {
if let TopologyControlRequest::Create { elements, responder } = self {
Some((elements, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_acquire_lease(self) -> Option<(String, u8, TopologyControlAcquireLeaseResponder)> {
if let TopologyControlRequest::AcquireLease { element_name, level, responder } = self {
Some((element_name, level, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_drop_lease(self) -> Option<(String, TopologyControlDropLeaseResponder)> {
if let TopologyControlRequest::DropLease { element_name, responder } = self {
Some((element_name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_status_channel(
self,
) -> Option<(
String,
fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
TopologyControlOpenStatusChannelResponder,
)> {
if let TopologyControlRequest::OpenStatusChannel {
element_name,
status_channel,
responder,
} = self
{
Some((element_name, status_channel, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
TopologyControlRequest::Create { .. } => "create",
TopologyControlRequest::AcquireLease { .. } => "acquire_lease",
TopologyControlRequest::DropLease { .. } => "drop_lease",
TopologyControlRequest::OpenStatusChannel { .. } => "open_status_channel",
TopologyControlRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
TopologyControlRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct TopologyControlControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for TopologyControlControlHandle {
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 TopologyControlControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TopologyControlCreateResponder {
control_handle: std::mem::ManuallyDrop<TopologyControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TopologyControlCreateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TopologyControlCreateResponder {
type ControlHandle = TopologyControlControlHandle;
fn control_handle(&self) -> &TopologyControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TopologyControlCreateResponder {
pub fn send(self, mut result: Result<(), CreateTopologyGraphError>) -> 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<(), CreateTopologyGraphError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), CreateTopologyGraphError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
CreateTopologyGraphError,
>>(
result,
self.tx_id,
0x12033976b88716fa,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TopologyControlAcquireLeaseResponder {
control_handle: std::mem::ManuallyDrop<TopologyControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TopologyControlAcquireLeaseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TopologyControlAcquireLeaseResponder {
type ControlHandle = TopologyControlControlHandle;
fn control_handle(&self) -> &TopologyControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TopologyControlAcquireLeaseResponder {
pub fn send(self, mut result: Result<(), LeaseControlError>) -> 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<(), LeaseControlError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), LeaseControlError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
LeaseControlError,
>>(
result,
self.tx_id,
0x1bedc35d9b68bac8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TopologyControlDropLeaseResponder {
control_handle: std::mem::ManuallyDrop<TopologyControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TopologyControlDropLeaseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TopologyControlDropLeaseResponder {
type ControlHandle = TopologyControlControlHandle;
fn control_handle(&self) -> &TopologyControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TopologyControlDropLeaseResponder {
pub fn send(self, mut result: Result<(), LeaseControlError>) -> 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<(), LeaseControlError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), LeaseControlError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
LeaseControlError,
>>(
result,
self.tx_id,
0x7107f8f1080faddc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TopologyControlOpenStatusChannelResponder {
control_handle: std::mem::ManuallyDrop<TopologyControlControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TopologyControlOpenStatusChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TopologyControlOpenStatusChannelResponder {
type ControlHandle = TopologyControlControlHandle;
fn control_handle(&self) -> &TopologyControlControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TopologyControlOpenStatusChannelResponder {
pub fn send(self, mut result: Result<(), OpenStatusChannelError>) -> 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<(), OpenStatusChannelError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), OpenStatusChannelError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
OpenStatusChannelError,
>>(
result,
self.tx_id,
0x69fba616c3ee2e90,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for CreateTopologyGraphError {
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 CreateTopologyGraphError {
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 CreateTopologyGraphError
{
#[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 CreateTopologyGraphError
{
#[inline(always)]
fn new_empty() -> Self {
Self::Internal
}
#[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 LeaseControlError {
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 LeaseControlError {
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 LeaseControlError
{
#[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 LeaseControlError {
#[inline(always)]
fn new_empty() -> Self {
Self::Internal
}
#[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 OpenStatusChannelError {
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 OpenStatusChannelError {
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 OpenStatusChannelError
{
#[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 OpenStatusChannelError
{
#[inline(always)]
fn new_empty() -> Self {
Self::Internal
}
#[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 SystemActivityControlError {
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 SystemActivityControlError {
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 SystemActivityControlError
{
#[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 SystemActivityControlError
{
#[inline(always)]
fn new_empty() -> Self {
Self::Internal
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Element {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Element {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Element, D> for &Element {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Element>(offset);
fidl::encoding::Encode::<Element, D>::encode(
(
<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(&self.element_name),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.initial_current_level),
<fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.valid_levels),
<fidl::encoding::Vector<LevelDependency, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.dependencies),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
T1: fidl::encoding::Encode<u8, D>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>, D>,
T3: fidl::encoding::Encode<fidl::encoding::Vector<LevelDependency, 256>, D>,
> fidl::encoding::Encode<Element, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Element>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
self.3.encode(encoder, offset + 40, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Element {
#[inline(always)]
fn new_empty() -> Self {
Self {
element_name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
initial_current_level: fidl::new_empty!(u8, D),
valid_levels: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, D),
dependencies: fidl::new_empty!(fidl::encoding::Vector<LevelDependency, 256>, 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(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<64>,
D,
&mut self.element_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u8, D, &mut self.initial_current_level, decoder, offset + 16, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 256>, D, &mut self.valid_levels, decoder, offset + 24, _depth)?;
fidl::decode!(fidl::encoding::Vector<LevelDependency, 256>, D, &mut self.dependencies, decoder, offset + 40, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LevelDependency {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LevelDependency {
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<LevelDependency, D>
for &LevelDependency
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LevelDependency>(offset);
fidl::encoding::Encode::<LevelDependency, D>::encode(
(
<fidl_fuchsia_power_broker::DependencyType as fidl::encoding::ValueTypeMarker>::borrow(&self.dependency_type),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.dependent_level),
<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(&self.requires_element),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.requires_level),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_power_broker::DependencyType, D>,
T1: fidl::encoding::Encode<u8, D>,
T2: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
T3: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<LevelDependency, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LevelDependency>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LevelDependency {
#[inline(always)]
fn new_empty() -> Self {
Self {
dependency_type: fidl::new_empty!(fidl_fuchsia_power_broker::DependencyType, D),
dependent_level: fidl::new_empty!(u8, D),
requires_element: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
requires_level: fidl::new_empty!(u8, 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 = 0xffffff0000000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_power_broker::DependencyType,
D,
&mut self.dependency_type,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u8, D, &mut self.dependent_level, decoder, offset + 4, _depth)?;
fidl::decode!(
fidl::encoding::BoundedString<64>,
D,
&mut self.requires_element,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(u8, D, &mut self.requires_level, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TopologyControlAcquireLeaseRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TopologyControlAcquireLeaseRequest {
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<TopologyControlAcquireLeaseRequest, D>
for &TopologyControlAcquireLeaseRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TopologyControlAcquireLeaseRequest>(offset);
fidl::encoding::Encode::<TopologyControlAcquireLeaseRequest, D>::encode(
(
<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.element_name,
),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.level),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
T1: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<TopologyControlAcquireLeaseRequest, 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::<TopologyControlAcquireLeaseRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TopologyControlAcquireLeaseRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
element_name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
level: fidl::new_empty!(u8, 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(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<64>,
D,
&mut self.element_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u8, D, &mut self.level, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TopologyControlCreateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TopologyControlCreateRequest {
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<TopologyControlCreateRequest, D> for &TopologyControlCreateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TopologyControlCreateRequest>(offset);
fidl::encoding::Encode::<TopologyControlCreateRequest, D>::encode(
(
<fidl::encoding::Vector<Element, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.elements),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<Element, 256>, D>,
> fidl::encoding::Encode<TopologyControlCreateRequest, 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::<TopologyControlCreateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TopologyControlCreateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { elements: fidl::new_empty!(fidl::encoding::Vector<Element, 256>, 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<Element, 256>, D, &mut self.elements, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TopologyControlDropLeaseRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TopologyControlDropLeaseRequest {
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<TopologyControlDropLeaseRequest, D>
for &TopologyControlDropLeaseRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TopologyControlDropLeaseRequest>(offset);
fidl::encoding::Encode::<TopologyControlDropLeaseRequest, D>::encode(
(<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.element_name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
> fidl::encoding::Encode<TopologyControlDropLeaseRequest, 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::<TopologyControlDropLeaseRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TopologyControlDropLeaseRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { element_name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<64>,
D,
&mut self.element_name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for TopologyControlOpenStatusChannelRequest {
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 TopologyControlOpenStatusChannelRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
TopologyControlOpenStatusChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut TopologyControlOpenStatusChannelRequest
{
#[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::<TopologyControlOpenStatusChannelRequest>(offset);
fidl::encoding::Encode::<
TopologyControlOpenStatusChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
&self.element_name,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.status_channel,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<64>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
TopologyControlOpenStatusChannelRequest,
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::<TopologyControlOpenStatusChannelRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for TopologyControlOpenStatusChannelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
element_name: fidl::new_empty!(
fidl::encoding::BoundedString<64>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
status_channel: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<64>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.element_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_power_broker::StatusMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.status_channel,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
}