#![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 DEVICE_CONTROLLER_NAME: &str = "device_controller";
pub const DEVICE_PROTOCOL_NAME: &str = "device_protocol";
pub const MAX_DEVICE_PATH_LEN: u64 = 1024;
pub const MAX_DRIVER_PATH_LEN: u64 = 1024;
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ConnectionType: u8 {
const NODE = 1;
const CONTROLLER = 2;
const DEVICE = 4;
}
}
impl ConnectionType {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u8) -> Self {
Self::from_bits_retain(bits)
}
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
self.get_unknown_bits() != 0
}
#[inline(always)]
pub fn get_unknown_bits(&self) -> u8 {
self.bits() & !Self::all().bits()
}
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ConnectorConnectRequest {
pub server: fidl::Channel,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ConnectorConnectRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ControllerBindRequest {
pub driver: String,
}
impl fidl::Persistable for ControllerBindRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ControllerConnectToControllerRequest {
pub server: fidl::endpoints::ServerEnd<ControllerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ControllerConnectToControllerRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ControllerConnectToDeviceFidlRequest {
pub server: fidl::Channel,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ControllerConnectToDeviceFidlRequest
{
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ControllerRebindRequest {
pub driver: String,
}
impl fidl::Persistable for ControllerRebindRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ControllerGetTopologicalPathResponse {
pub path: String,
}
impl fidl::Persistable for ControllerGetTopologicalPathResponse {}
#[derive(Debug, Default, PartialEq)]
pub struct DevfsAddArgs {
pub connector: Option<fidl::endpoints::ClientEnd<ConnectorMarker>>,
pub class_name: Option<String>,
pub inspect: Option<fidl::Vmo>,
pub connector_supports: Option<ConnectionType>,
pub controller_connector: Option<fidl::endpoints::ClientEnd<ConnectorMarker>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DevfsAddArgs {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ConnectorMarker;
impl fidl::endpoints::ProtocolMarker for ConnectorMarker {
type Proxy = ConnectorProxy;
type RequestStream = ConnectorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ConnectorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Connector";
}
pub trait ConnectorProxyInterface: Send + Sync {
fn r#connect(&self, server: fidl::Channel) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ConnectorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ConnectorSynchronousProxy {
type Proxy = ConnectorProxy;
type Protocol = ConnectorMarker;
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 ConnectorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ConnectorMarker 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<ConnectorEvent, fidl::Error> {
ConnectorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#connect(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
self.client.send::<ConnectorConnectRequest>(
(server,),
0x2bfd50a6209194f9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct ConnectorProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ConnectorProxy {
type Protocol = ConnectorMarker;
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 ConnectorProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ConnectorEventStream {
ConnectorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#connect(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
ConnectorProxyInterface::r#connect(self, server)
}
}
impl ConnectorProxyInterface for ConnectorProxy {
fn r#connect(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
self.client.send::<ConnectorConnectRequest>(
(server,),
0x2bfd50a6209194f9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct ConnectorEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ConnectorEventStream {}
impl futures::stream::FusedStream for ConnectorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ConnectorEventStream {
type Item = Result<ConnectorEvent, 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(ConnectorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ConnectorEvent {}
impl ConnectorEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ConnectorEvent, 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: <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ConnectorRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ConnectorRequestStream {}
impl futures::stream::FusedStream for ConnectorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ConnectorRequestStream {
type Protocol = ConnectorMarker;
type ControlHandle = ConnectorControlHandle;
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 {
ConnectorControlHandle { 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 ConnectorRequestStream {
type Item = Result<ConnectorRequest, 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 ConnectorRequestStream 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 {
0x2bfd50a6209194f9 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ConnectorConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
Ok(ConnectorRequest::Connect { server: req.server, control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ConnectorRequest {
Connect { server: fidl::Channel, control_handle: ConnectorControlHandle },
}
impl ConnectorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_connect(self) -> Option<(fidl::Channel, ConnectorControlHandle)> {
if let ConnectorRequest::Connect { server, control_handle } = self {
Some((server, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ConnectorRequest::Connect { .. } => "connect",
}
}
}
#[derive(Debug, Clone)]
pub struct ConnectorControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ConnectorControlHandle {
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 ConnectorControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ControllerMarker;
impl fidl::endpoints::ProtocolMarker for ControllerMarker {
type Proxy = ControllerProxy;
type RequestStream = ControllerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ControllerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Controller";
}
pub type ControllerBindResult = Result<(), i32>;
pub type ControllerRebindResult = Result<(), i32>;
pub type ControllerUnbindChildrenResult = Result<(), i32>;
pub type ControllerScheduleUnbindResult = Result<(), i32>;
pub type ControllerGetTopologicalPathResult = Result<String, i32>;
pub trait ControllerProxyInterface: Send + Sync {
fn r#connect_to_device_fidl(&self, server: fidl::Channel) -> Result<(), fidl::Error>;
fn r#connect_to_controller(
&self,
server: fidl::endpoints::ServerEnd<ControllerMarker>,
) -> Result<(), fidl::Error>;
type BindResponseFut: std::future::Future<Output = Result<ControllerBindResult, fidl::Error>>
+ Send;
fn r#bind(&self, driver: &str) -> Self::BindResponseFut;
type RebindResponseFut: std::future::Future<Output = Result<ControllerRebindResult, fidl::Error>>
+ Send;
fn r#rebind(&self, driver: &str) -> Self::RebindResponseFut;
type UnbindChildrenResponseFut: std::future::Future<Output = Result<ControllerUnbindChildrenResult, fidl::Error>>
+ Send;
fn r#unbind_children(&self) -> Self::UnbindChildrenResponseFut;
type ScheduleUnbindResponseFut: std::future::Future<Output = Result<ControllerScheduleUnbindResult, fidl::Error>>
+ Send;
fn r#schedule_unbind(&self) -> Self::ScheduleUnbindResponseFut;
type GetTopologicalPathResponseFut: std::future::Future<Output = Result<ControllerGetTopologicalPathResult, fidl::Error>>
+ Send;
fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ControllerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
type Proxy = ControllerProxy;
type Protocol = ControllerMarker;
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 ControllerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ControllerMarker 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<ControllerEvent, fidl::Error> {
ControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#connect_to_device_fidl(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
self.client.send::<ControllerConnectToDeviceFidlRequest>(
(server,),
0x16470b1ad6b72a1c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#connect_to_controller(
&self,
mut server: fidl::endpoints::ServerEnd<ControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ControllerConnectToControllerRequest>(
(server,),
0x5ecb2bd80e259518,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#bind(
&self,
mut driver: &str,
___deadline: zx::MonotonicInstant,
) -> Result<ControllerBindResult, fidl::Error> {
let _response = self.client.send_query::<
ControllerBindRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(driver,),
0x29ba03b8581bc29c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#rebind(
&self,
mut driver: &str,
___deadline: zx::MonotonicInstant,
) -> Result<ControllerRebindResult, fidl::Error> {
let _response = self.client.send_query::<
ControllerRebindRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(driver,),
0xbb3310a56d9021d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#unbind_children(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<ControllerUnbindChildrenResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x6c384152c9a33527,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#schedule_unbind(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<ControllerScheduleUnbindResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x4b74fd2f31a9664e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_topological_path(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<ControllerGetTopologicalPathResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<ControllerGetTopologicalPathResponse, i32>,
>(
(),
0x7855cbd851303260,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.path))
}
}
#[derive(Debug, Clone)]
pub struct ControllerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ControllerProxy {
type Protocol = ControllerMarker;
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 ControllerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ControllerEventStream {
ControllerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#connect_to_device_fidl(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
ControllerProxyInterface::r#connect_to_device_fidl(self, server)
}
pub fn r#connect_to_controller(
&self,
mut server: fidl::endpoints::ServerEnd<ControllerMarker>,
) -> Result<(), fidl::Error> {
ControllerProxyInterface::r#connect_to_controller(self, server)
}
pub fn r#bind(
&self,
mut driver: &str,
) -> fidl::client::QueryResponseFut<
ControllerBindResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ControllerProxyInterface::r#bind(self, driver)
}
pub fn r#rebind(
&self,
mut driver: &str,
) -> fidl::client::QueryResponseFut<
ControllerRebindResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ControllerProxyInterface::r#rebind(self, driver)
}
pub fn r#unbind_children(
&self,
) -> fidl::client::QueryResponseFut<
ControllerUnbindChildrenResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ControllerProxyInterface::r#unbind_children(self)
}
pub fn r#schedule_unbind(
&self,
) -> fidl::client::QueryResponseFut<
ControllerScheduleUnbindResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ControllerProxyInterface::r#schedule_unbind(self)
}
pub fn r#get_topological_path(
&self,
) -> fidl::client::QueryResponseFut<
ControllerGetTopologicalPathResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ControllerProxyInterface::r#get_topological_path(self)
}
}
impl ControllerProxyInterface for ControllerProxy {
fn r#connect_to_device_fidl(&self, mut server: fidl::Channel) -> Result<(), fidl::Error> {
self.client.send::<ControllerConnectToDeviceFidlRequest>(
(server,),
0x16470b1ad6b72a1c,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#connect_to_controller(
&self,
mut server: fidl::endpoints::ServerEnd<ControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ControllerConnectToControllerRequest>(
(server,),
0x5ecb2bd80e259518,
fidl::encoding::DynamicFlags::empty(),
)
}
type BindResponseFut = fidl::client::QueryResponseFut<
ControllerBindResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#bind(&self, mut driver: &str) -> Self::BindResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ControllerBindResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x29ba03b8581bc29c,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<ControllerBindRequest, ControllerBindResult>(
(driver,),
0x29ba03b8581bc29c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RebindResponseFut = fidl::client::QueryResponseFut<
ControllerRebindResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#rebind(&self, mut driver: &str) -> Self::RebindResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ControllerRebindResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xbb3310a56d9021d,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<ControllerRebindRequest, ControllerRebindResult>(
(driver,),
0xbb3310a56d9021d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type UnbindChildrenResponseFut = fidl::client::QueryResponseFut<
ControllerUnbindChildrenResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#unbind_children(&self) -> Self::UnbindChildrenResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ControllerUnbindChildrenResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6c384152c9a33527,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerUnbindChildrenResult>(
(),
0x6c384152c9a33527,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ScheduleUnbindResponseFut = fidl::client::QueryResponseFut<
ControllerScheduleUnbindResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#schedule_unbind(&self) -> Self::ScheduleUnbindResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ControllerScheduleUnbindResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4b74fd2f31a9664e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerScheduleUnbindResult>(
(),
0x4b74fd2f31a9664e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetTopologicalPathResponseFut = fidl::client::QueryResponseFut<
ControllerGetTopologicalPathResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_topological_path(&self) -> Self::GetTopologicalPathResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ControllerGetTopologicalPathResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<ControllerGetTopologicalPathResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7855cbd851303260,
>(_buf?)?;
Ok(_response.map(|x| x.path))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
ControllerGetTopologicalPathResult,
>(
(),
0x7855cbd851303260,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ControllerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ControllerEventStream {}
impl futures::stream::FusedStream for ControllerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ControllerEventStream {
type Item = Result<ControllerEvent, 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(ControllerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ControllerEvent {}
impl ControllerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ControllerEvent, 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: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ControllerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ControllerRequestStream {}
impl futures::stream::FusedStream for ControllerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ControllerRequestStream {
type Protocol = ControllerMarker;
type ControlHandle = ControllerControlHandle;
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 {
ControllerControlHandle { 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 ControllerRequestStream {
type Item = Result<ControllerRequest, 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 ControllerRequestStream 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 {
0x16470b1ad6b72a1c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ControllerConnectToDeviceFidlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerConnectToDeviceFidlRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ControllerControlHandle { inner: this.inner.clone() };
Ok(ControllerRequest::ConnectToDeviceFidl {
server: req.server,
control_handle,
})
}
0x5ecb2bd80e259518 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ControllerConnectToControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerConnectToControllerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ControllerControlHandle { inner: this.inner.clone() };
Ok(ControllerRequest::ConnectToController {
server: req.server,
control_handle,
})
}
0x29ba03b8581bc29c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ControllerBindRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerBindRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ControllerControlHandle { inner: this.inner.clone() };
Ok(ControllerRequest::Bind {
driver: req.driver,
responder: ControllerBindResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xbb3310a56d9021d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ControllerRebindRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerRebindRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ControllerControlHandle { inner: this.inner.clone() };
Ok(ControllerRequest::Rebind {
driver: req.driver,
responder: ControllerRebindResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6c384152c9a33527 => {
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 = ControllerControlHandle { inner: this.inner.clone() };
Ok(ControllerRequest::UnbindChildren {
responder: ControllerUnbindChildrenResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4b74fd2f31a9664e => {
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 = ControllerControlHandle { inner: this.inner.clone() };
Ok(ControllerRequest::ScheduleUnbind {
responder: ControllerScheduleUnbindResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7855cbd851303260 => {
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 = ControllerControlHandle { inner: this.inner.clone() };
Ok(ControllerRequest::GetTopologicalPath {
responder: ControllerGetTopologicalPathResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ControllerRequest {
ConnectToDeviceFidl { server: fidl::Channel, control_handle: ControllerControlHandle },
ConnectToController {
server: fidl::endpoints::ServerEnd<ControllerMarker>,
control_handle: ControllerControlHandle,
},
Bind { driver: String, responder: ControllerBindResponder },
Rebind { driver: String, responder: ControllerRebindResponder },
UnbindChildren { responder: ControllerUnbindChildrenResponder },
ScheduleUnbind { responder: ControllerScheduleUnbindResponder },
GetTopologicalPath { responder: ControllerGetTopologicalPathResponder },
}
impl ControllerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_device_fidl(self) -> Option<(fidl::Channel, ControllerControlHandle)> {
if let ControllerRequest::ConnectToDeviceFidl { server, control_handle } = self {
Some((server, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_controller(
self,
) -> Option<(fidl::endpoints::ServerEnd<ControllerMarker>, ControllerControlHandle)> {
if let ControllerRequest::ConnectToController { server, control_handle } = self {
Some((server, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_bind(self) -> Option<(String, ControllerBindResponder)> {
if let ControllerRequest::Bind { driver, responder } = self {
Some((driver, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_rebind(self) -> Option<(String, ControllerRebindResponder)> {
if let ControllerRequest::Rebind { driver, responder } = self {
Some((driver, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_unbind_children(self) -> Option<(ControllerUnbindChildrenResponder)> {
if let ControllerRequest::UnbindChildren { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_schedule_unbind(self) -> Option<(ControllerScheduleUnbindResponder)> {
if let ControllerRequest::ScheduleUnbind { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_topological_path(self) -> Option<(ControllerGetTopologicalPathResponder)> {
if let ControllerRequest::GetTopologicalPath { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ControllerRequest::ConnectToDeviceFidl { .. } => "connect_to_device_fidl",
ControllerRequest::ConnectToController { .. } => "connect_to_controller",
ControllerRequest::Bind { .. } => "bind",
ControllerRequest::Rebind { .. } => "rebind",
ControllerRequest::UnbindChildren { .. } => "unbind_children",
ControllerRequest::ScheduleUnbind { .. } => "schedule_unbind",
ControllerRequest::GetTopologicalPath { .. } => "get_topological_path",
}
}
}
#[derive(Debug, Clone)]
pub struct ControllerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ControllerControlHandle {
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 ControllerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ControllerBindResponder {
control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ControllerBindResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ControllerBindResponder {
type ControlHandle = ControllerControlHandle;
fn control_handle(&self) -> &ControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ControllerBindResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x29ba03b8581bc29c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ControllerRebindResponder {
control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ControllerRebindResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ControllerRebindResponder {
type ControlHandle = ControllerControlHandle;
fn control_handle(&self) -> &ControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ControllerRebindResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0xbb3310a56d9021d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ControllerUnbindChildrenResponder {
control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ControllerUnbindChildrenResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ControllerUnbindChildrenResponder {
type ControlHandle = ControllerControlHandle;
fn control_handle(&self) -> &ControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ControllerUnbindChildrenResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x6c384152c9a33527,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ControllerScheduleUnbindResponder {
control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ControllerScheduleUnbindResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ControllerScheduleUnbindResponder {
type ControlHandle = ControllerControlHandle;
fn control_handle(&self) -> &ControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ControllerScheduleUnbindResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x4b74fd2f31a9664e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ControllerGetTopologicalPathResponder {
control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ControllerGetTopologicalPathResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ControllerGetTopologicalPathResponder {
type ControlHandle = ControllerControlHandle;
fn control_handle(&self) -> &ControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ControllerGetTopologicalPathResponder {
pub fn send(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&str, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
ControllerGetTopologicalPathResponse,
i32,
>>(
result.map(|path| (path,)),
self.tx_id,
0x7855cbd851303260,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for ConnectionType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
impl fidl::encoding::ValueTypeMarker for ConnectionType {
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 ConnectionType {
#[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.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectionType {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[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::<u8>(offset);
*self = Self::from_bits_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ConnectorConnectRequest {
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 ConnectorConnectRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
ConnectorConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ConnectorConnectRequest
{
#[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::<ConnectorConnectRequest>(offset);
fidl::encoding::Encode::<
ConnectorConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.server
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ConnectorConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ConnectorConnectRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
server: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ControllerBindRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControllerBindRequest {
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<ControllerBindRequest, D>
for &ControllerBindRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControllerBindRequest>(offset);
fidl::encoding::Encode::<ControllerBindRequest, D>::encode(
(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(
&self.driver,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>, D>,
> fidl::encoding::Encode<ControllerBindRequest, 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::<ControllerBindRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControllerBindRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { driver: fidl::new_empty!(fidl::encoding::BoundedString<1024>, 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<1024>,
D,
&mut self.driver,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ControllerConnectToControllerRequest {
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 ControllerConnectToControllerRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
ControllerConnectToControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ControllerConnectToControllerRequest
{
#[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::<ControllerConnectToControllerRequest>(offset);
fidl::encoding::Encode::<ControllerConnectToControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ControllerConnectToControllerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControllerConnectToControllerRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ControllerConnectToControllerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
server: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.server,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ControllerConnectToDeviceFidlRequest {
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 ControllerConnectToDeviceFidlRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
ControllerConnectToDeviceFidlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ControllerConnectToDeviceFidlRequest
{
#[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::<ControllerConnectToDeviceFidlRequest>(offset);
fidl::encoding::Encode::<
ControllerConnectToDeviceFidlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.server
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ControllerConnectToDeviceFidlRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControllerConnectToDeviceFidlRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ControllerConnectToDeviceFidlRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
server: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ControllerRebindRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControllerRebindRequest {
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<ControllerRebindRequest, D> for &ControllerRebindRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControllerRebindRequest>(offset);
fidl::encoding::Encode::<ControllerRebindRequest, D>::encode(
(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(
&self.driver,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>, D>,
> fidl::encoding::Encode<ControllerRebindRequest, 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::<ControllerRebindRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ControllerRebindRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { driver: fidl::new_empty!(fidl::encoding::BoundedString<1024>, 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<1024>,
D,
&mut self.driver,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ControllerGetTopologicalPathResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControllerGetTopologicalPathResponse {
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<ControllerGetTopologicalPathResponse, D>
for &ControllerGetTopologicalPathResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControllerGetTopologicalPathResponse>(offset);
fidl::encoding::Encode::<ControllerGetTopologicalPathResponse, D>::encode(
(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(
&self.path,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>, D>,
> fidl::encoding::Encode<ControllerGetTopologicalPathResponse, 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::<ControllerGetTopologicalPathResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ControllerGetTopologicalPathResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { path: fidl::new_empty!(fidl::encoding::BoundedString<1024>, 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<1024>,
D,
&mut self.path,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl DevfsAddArgs {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.controller_connector {
return 5;
}
if let Some(_) = self.connector_supports {
return 4;
}
if let Some(_) = self.inspect {
return 3;
}
if let Some(_) = self.class_name {
return 2;
}
if let Some(_) = self.connector {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for DevfsAddArgs {
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 DevfsAddArgs {
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 fidl::encoding::Encode<DevfsAddArgs, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut DevfsAddArgs
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DevfsAddArgs>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.connector.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.class_name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.inspect.as_mut().map(
<fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
ConnectionType,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.connector_supports
.as_ref()
.map(<ConnectionType as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.controller_connector.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for DevfsAddArgs {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ConnectorMarker>,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.connector.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.class_name.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.inspect.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ConnectionType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.connector_supports.get_or_insert_with(|| {
fidl::new_empty!(ConnectionType, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
ConnectionType,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 5 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<ConnectorMarker>,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.controller_connector.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectorMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
}