#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub const MAX_ARGS_LENGTH: u64 = 1024;
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct StatusFlags: u32 {
const ONLINE = 1;
}
}
impl StatusFlags {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u32) -> 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) -> u32 {
self.bits() & !Self::all().bits()
}
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceStartRequest {
pub interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceStartRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProviderConnectToServiceRequest {
pub socket: fidl::Socket,
pub args: Option<String>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ProviderConnectToServiceRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct UsbAdbImplOnStatusChangedRequest {
pub status: StatusFlags,
}
impl fidl::Persistable for UsbAdbImplOnStatusChangedRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct UsbAdbImplQueueTxRequest {
pub data: Vec<u8>,
}
impl fidl::Persistable for UsbAdbImplQueueTxRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct UsbAdbImplReceiveResponse {
pub data: Vec<u8>,
}
impl fidl::Persistable for UsbAdbImplReceiveResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DeviceMarker;
impl fidl::endpoints::ProtocolMarker for DeviceMarker {
type Proxy = DeviceProxy;
type RequestStream = DeviceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DeviceSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.hardware.adb.Device";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
pub type DeviceStartResult = Result<(), i32>;
pub type DeviceStopResult = Result<(), i32>;
pub trait DeviceProxyInterface: Send + Sync {
type StartResponseFut: std::future::Future<Output = Result<DeviceStartResult, fidl::Error>>
+ Send;
fn r#start(
&self,
interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
) -> Self::StartResponseFut;
type StopResponseFut: std::future::Future<Output = Result<DeviceStopResult, fidl::Error>> + Send;
fn r#stop(&self) -> Self::StopResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DeviceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
type Proxy = DeviceProxy;
type Protocol = DeviceMarker;
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 DeviceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DeviceMarker 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<DeviceEvent, fidl::Error> {
DeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#start(
&self,
mut interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceStartResult, fidl::Error> {
let _response = self.client.send_query::<
DeviceStartRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(interface,),
0x3deba8333d0b3574,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#stop(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceStopResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x6d49f07a20fdfde0,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct DeviceProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DeviceProxy {
type Protocol = DeviceMarker;
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 DeviceProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DeviceEventStream {
DeviceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#start(
&self,
mut interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
) -> fidl::client::QueryResponseFut<
DeviceStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#start(self, interface)
}
pub fn r#stop(
&self,
) -> fidl::client::QueryResponseFut<
DeviceStopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#stop(self)
}
}
impl DeviceProxyInterface for DeviceProxy {
type StartResponseFut = fidl::client::QueryResponseFut<
DeviceStartResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#start(
&self,
mut interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
) -> Self::StartResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceStartResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3deba8333d0b3574,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<DeviceStartRequest, DeviceStartResult>(
(interface,),
0x3deba8333d0b3574,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StopResponseFut = fidl::client::QueryResponseFut<
DeviceStopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#stop(&self) -> Self::StopResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceStopResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6d49f07a20fdfde0,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceStopResult>(
(),
0x6d49f07a20fdfde0,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct DeviceEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DeviceEventStream {}
impl futures::stream::FusedStream for DeviceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DeviceEventStream {
type Item = Result<DeviceEvent, 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(DeviceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DeviceEvent {}
impl DeviceEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DeviceEvent, 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: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DeviceRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DeviceRequestStream {}
impl futures::stream::FusedStream for DeviceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DeviceRequestStream {
type Protocol = DeviceMarker;
type ControlHandle = DeviceControlHandle;
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 {
DeviceControlHandle { 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 DeviceRequestStream {
type Item = Result<DeviceRequest, 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 DeviceRequestStream 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 {
0x3deba8333d0b3574 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceStartRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceStartRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::Start {
interface: req.interface,
responder: DeviceStartResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6d49f07a20fdfde0 => {
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 = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::Stop {
responder: DeviceStopResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DeviceRequest {
Start {
interface: fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>,
responder: DeviceStartResponder,
},
Stop { responder: DeviceStopResponder },
}
impl DeviceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_start(
self,
) -> Option<(fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>, DeviceStartResponder)> {
if let DeviceRequest::Start { interface, responder } = self {
Some((interface, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop(self) -> Option<(DeviceStopResponder)> {
if let DeviceRequest::Stop { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DeviceRequest::Start { .. } => "start",
DeviceRequest::Stop { .. } => "stop",
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DeviceControlHandle {
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 DeviceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceStartResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceStartResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceStartResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceStartResponder {
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,
0x3deba8333d0b3574,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceStopResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceStopResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceStopResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceStopResponder {
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,
0x6d49f07a20fdfde0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProviderMarker;
impl fidl::endpoints::ProtocolMarker for ProviderMarker {
type Proxy = ProviderProxy;
type RequestStream = ProviderRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProviderSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.hardware.adb.Provider";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
pub type ProviderConnectToServiceResult = Result<(), i32>;
pub trait ProviderProxyInterface: Send + Sync {
type ConnectToServiceResponseFut: std::future::Future<Output = Result<ProviderConnectToServiceResult, fidl::Error>>
+ Send;
fn r#connect_to_service(
&self,
socket: fidl::Socket,
args: Option<&str>,
) -> Self::ConnectToServiceResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProviderSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
type Proxy = ProviderProxy;
type Protocol = ProviderMarker;
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 ProviderSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ProviderMarker 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<ProviderEvent, fidl::Error> {
ProviderEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#connect_to_service(
&self,
mut socket: fidl::Socket,
mut args: Option<&str>,
___deadline: zx::MonotonicInstant,
) -> Result<ProviderConnectToServiceResult, fidl::Error> {
let _response = self.client.send_query::<
ProviderConnectToServiceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(socket, args,),
0x303e4a312d85292b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct ProviderProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ProviderProxy {
type Protocol = ProviderMarker;
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 ProviderProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProviderEventStream {
ProviderEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#connect_to_service(
&self,
mut socket: fidl::Socket,
mut args: Option<&str>,
) -> fidl::client::QueryResponseFut<
ProviderConnectToServiceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProviderProxyInterface::r#connect_to_service(self, socket, args)
}
}
impl ProviderProxyInterface for ProviderProxy {
type ConnectToServiceResponseFut = fidl::client::QueryResponseFut<
ProviderConnectToServiceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#connect_to_service(
&self,
mut socket: fidl::Socket,
mut args: Option<&str>,
) -> Self::ConnectToServiceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ProviderConnectToServiceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x303e4a312d85292b,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ProviderConnectToServiceRequest,
ProviderConnectToServiceResult,
>(
(socket, args,),
0x303e4a312d85292b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ProviderEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ProviderEventStream {}
impl futures::stream::FusedStream for ProviderEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProviderEventStream {
type Item = Result<ProviderEvent, 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(ProviderEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProviderEvent {}
impl ProviderEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ProviderEvent, 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: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProviderRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ProviderRequestStream {}
impl futures::stream::FusedStream for ProviderRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProviderRequestStream {
type Protocol = ProviderMarker;
type ControlHandle = ProviderControlHandle;
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 {
ProviderControlHandle { 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 ProviderRequestStream {
type Item = Result<ProviderRequest, 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 ProviderRequestStream 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 {
0x303e4a312d85292b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProviderConnectToServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderConnectToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProviderControlHandle { inner: this.inner.clone() };
Ok(ProviderRequest::ConnectToService {
socket: req.socket,
args: req.args,
responder: ProviderConnectToServiceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ProviderRequest {
ConnectToService {
socket: fidl::Socket,
args: Option<String>,
responder: ProviderConnectToServiceResponder,
},
}
impl ProviderRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_service(
self,
) -> Option<(fidl::Socket, Option<String>, ProviderConnectToServiceResponder)> {
if let ProviderRequest::ConnectToService { socket, args, responder } = self {
Some((socket, args, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ProviderRequest::ConnectToService { .. } => "connect_to_service",
}
}
}
#[derive(Debug, Clone)]
pub struct ProviderControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ProviderControlHandle {
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 ProviderControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProviderConnectToServiceResponder {
control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProviderConnectToServiceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProviderConnectToServiceResponder {
type ControlHandle = ProviderControlHandle;
fn control_handle(&self) -> &ProviderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProviderConnectToServiceResponder {
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,
0x303e4a312d85292b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct UsbAdbImpl_Marker;
impl fidl::endpoints::ProtocolMarker for UsbAdbImpl_Marker {
type Proxy = UsbAdbImpl_Proxy;
type RequestStream = UsbAdbImpl_RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = UsbAdbImpl_SynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) UsbAdbImpl_";
}
pub type UsbAdbImplQueueTxResult = Result<(), i32>;
pub type UsbAdbImplReceiveResult = Result<Vec<u8>, i32>;
pub trait UsbAdbImpl_ProxyInterface: Send + Sync {
type QueueTxResponseFut: std::future::Future<Output = Result<UsbAdbImplQueueTxResult, fidl::Error>>
+ Send;
fn r#queue_tx(&self, data: &[u8]) -> Self::QueueTxResponseFut;
type ReceiveResponseFut: std::future::Future<Output = Result<UsbAdbImplReceiveResult, fidl::Error>>
+ Send;
fn r#receive(&self) -> Self::ReceiveResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct UsbAdbImpl_SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for UsbAdbImpl_SynchronousProxy {
type Proxy = UsbAdbImpl_Proxy;
type Protocol = UsbAdbImpl_Marker;
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 UsbAdbImpl_SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <UsbAdbImpl_Marker 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<UsbAdbImpl_Event, fidl::Error> {
UsbAdbImpl_Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#queue_tx(
&self,
mut data: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<UsbAdbImplQueueTxResult, fidl::Error> {
let _response = self.client.send_query::<
UsbAdbImplQueueTxRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(data,),
0x4c0af0efa9701dc9,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#receive(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<UsbAdbImplReceiveResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<UsbAdbImplReceiveResponse, i32>,
>(
(),
0x68382fff953be5c4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.data))
}
}
#[derive(Debug, Clone)]
pub struct UsbAdbImpl_Proxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for UsbAdbImpl_Proxy {
type Protocol = UsbAdbImpl_Marker;
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 UsbAdbImpl_Proxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <UsbAdbImpl_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> UsbAdbImpl_EventStream {
UsbAdbImpl_EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#queue_tx(
&self,
mut data: &[u8],
) -> fidl::client::QueryResponseFut<
UsbAdbImplQueueTxResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
UsbAdbImpl_ProxyInterface::r#queue_tx(self, data)
}
pub fn r#receive(
&self,
) -> fidl::client::QueryResponseFut<
UsbAdbImplReceiveResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
UsbAdbImpl_ProxyInterface::r#receive(self)
}
}
impl UsbAdbImpl_ProxyInterface for UsbAdbImpl_Proxy {
type QueueTxResponseFut = fidl::client::QueryResponseFut<
UsbAdbImplQueueTxResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#queue_tx(&self, mut data: &[u8]) -> Self::QueueTxResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<UsbAdbImplQueueTxResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4c0af0efa9701dc9,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<UsbAdbImplQueueTxRequest, UsbAdbImplQueueTxResult>(
(data,),
0x4c0af0efa9701dc9,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReceiveResponseFut = fidl::client::QueryResponseFut<
UsbAdbImplReceiveResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#receive(&self) -> Self::ReceiveResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<UsbAdbImplReceiveResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<UsbAdbImplReceiveResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x68382fff953be5c4,
>(_buf?)?;
Ok(_response.map(|x| x.data))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, UsbAdbImplReceiveResult>(
(),
0x68382fff953be5c4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct UsbAdbImpl_EventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for UsbAdbImpl_EventStream {}
impl futures::stream::FusedStream for UsbAdbImpl_EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for UsbAdbImpl_EventStream {
type Item = Result<UsbAdbImpl_Event, 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(UsbAdbImpl_Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum UsbAdbImpl_Event {
OnStatusChanged { status: StatusFlags },
}
impl UsbAdbImpl_Event {
#[allow(irrefutable_let_patterns)]
pub fn into_on_status_changed(self) -> Option<StatusFlags> {
if let UsbAdbImpl_Event::OnStatusChanged { status } = self {
Some((status))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<UsbAdbImpl_Event, 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 {
0x2f2926086c0a5b6e => {
let mut out = fidl::new_empty!(
UsbAdbImplOnStatusChangedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbAdbImplOnStatusChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((UsbAdbImpl_Event::OnStatusChanged { status: out.status }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <UsbAdbImpl_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct UsbAdbImpl_RequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for UsbAdbImpl_RequestStream {}
impl futures::stream::FusedStream for UsbAdbImpl_RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for UsbAdbImpl_RequestStream {
type Protocol = UsbAdbImpl_Marker;
type ControlHandle = UsbAdbImpl_ControlHandle;
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 {
UsbAdbImpl_ControlHandle { 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 UsbAdbImpl_RequestStream {
type Item = Result<UsbAdbImpl_Request, 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 UsbAdbImpl_RequestStream 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 {
0x4c0af0efa9701dc9 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
UsbAdbImplQueueTxRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<UsbAdbImplQueueTxRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = UsbAdbImpl_ControlHandle { inner: this.inner.clone() };
Ok(UsbAdbImpl_Request::QueueTx {
data: req.data,
responder: UsbAdbImpl_QueueTxResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x68382fff953be5c4 => {
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 = UsbAdbImpl_ControlHandle { inner: this.inner.clone() };
Ok(UsbAdbImpl_Request::Receive {
responder: UsbAdbImpl_ReceiveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<UsbAdbImpl_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum UsbAdbImpl_Request {
QueueTx { data: Vec<u8>, responder: UsbAdbImpl_QueueTxResponder },
Receive { responder: UsbAdbImpl_ReceiveResponder },
}
impl UsbAdbImpl_Request {
#[allow(irrefutable_let_patterns)]
pub fn into_queue_tx(self) -> Option<(Vec<u8>, UsbAdbImpl_QueueTxResponder)> {
if let UsbAdbImpl_Request::QueueTx { data, responder } = self {
Some((data, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_receive(self) -> Option<(UsbAdbImpl_ReceiveResponder)> {
if let UsbAdbImpl_Request::Receive { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
UsbAdbImpl_Request::QueueTx { .. } => "queue_tx",
UsbAdbImpl_Request::Receive { .. } => "receive",
}
}
}
#[derive(Debug, Clone)]
pub struct UsbAdbImpl_ControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for UsbAdbImpl_ControlHandle {
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 UsbAdbImpl_ControlHandle {
pub fn send_on_status_changed(&self, mut status: StatusFlags) -> Result<(), fidl::Error> {
self.inner.send::<UsbAdbImplOnStatusChangedRequest>(
(status,),
0,
0x2f2926086c0a5b6e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct UsbAdbImpl_QueueTxResponder {
control_handle: std::mem::ManuallyDrop<UsbAdbImpl_ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for UsbAdbImpl_QueueTxResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for UsbAdbImpl_QueueTxResponder {
type ControlHandle = UsbAdbImpl_ControlHandle;
fn control_handle(&self) -> &UsbAdbImpl_ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl UsbAdbImpl_QueueTxResponder {
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,
0x4c0af0efa9701dc9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct UsbAdbImpl_ReceiveResponder {
control_handle: std::mem::ManuallyDrop<UsbAdbImpl_ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for UsbAdbImpl_ReceiveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for UsbAdbImpl_ReceiveResponder {
type ControlHandle = UsbAdbImpl_ControlHandle;
fn control_handle(&self) -> &UsbAdbImpl_ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl UsbAdbImpl_ReceiveResponder {
pub fn send(self, mut result: Result<&[u8], 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<&[u8], i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<UsbAdbImplReceiveResponse, i32>>(
result.map(|data| (data,)),
self.tx_id,
0x68382fff953be5c4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for StatusFlags {
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
}
}
impl fidl::encoding::ValueTypeMarker for StatusFlags {
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 StatusFlags {
#[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 StatusFlags {
#[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::<u32>(offset);
*self = Self::from_bits_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DeviceStartRequest {
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 DeviceStartRequest {
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<DeviceStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut DeviceStartRequest
{
#[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::<DeviceStartRequest>(offset);
fidl::encoding::Encode::<DeviceStartRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.interface),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<DeviceStartRequest, 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::<DeviceStartRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceStartRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
interface: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<UsbAdbImpl_Marker>>,
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<UsbAdbImpl_Marker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.interface,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProviderConnectToServiceRequest {
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 ProviderConnectToServiceRequest {
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<
ProviderConnectToServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProviderConnectToServiceRequest
{
#[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::<ProviderConnectToServiceRequest>(offset);
fidl::encoding::Encode::<ProviderConnectToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.socket),
<fidl::encoding::Optional<fidl::encoding::BoundedString<1024>> as fidl::encoding::ValueTypeMarker>::borrow(&self.args),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ProviderConnectToServiceRequest,
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::<ProviderConnectToServiceRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProviderConnectToServiceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
args: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
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(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.args,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for UsbAdbImplOnStatusChangedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for UsbAdbImplOnStatusChangedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<UsbAdbImplOnStatusChangedRequest, D>
for &UsbAdbImplOnStatusChangedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsbAdbImplOnStatusChangedRequest>(offset);
fidl::encoding::Encode::<UsbAdbImplOnStatusChangedRequest, D>::encode(
(<StatusFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StatusFlags, D>>
fidl::encoding::Encode<UsbAdbImplOnStatusChangedRequest, 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::<UsbAdbImplOnStatusChangedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for UsbAdbImplOnStatusChangedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(StatusFlags, 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!(StatusFlags, D, &mut self.status, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for UsbAdbImplQueueTxRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for UsbAdbImplQueueTxRequest {
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<UsbAdbImplQueueTxRequest, D> for &UsbAdbImplQueueTxRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsbAdbImplQueueTxRequest>(offset);
fidl::encoding::Encode::<UsbAdbImplQueueTxRequest, D>::encode(
(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<UsbAdbImplQueueTxRequest, 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::<UsbAdbImplQueueTxRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for UsbAdbImplQueueTxRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { data: fidl::new_empty!(fidl::encoding::UnboundedVector<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);
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.data,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for UsbAdbImplReceiveResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for UsbAdbImplReceiveResponse {
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<UsbAdbImplReceiveResponse, D> for &UsbAdbImplReceiveResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UsbAdbImplReceiveResponse>(offset);
fidl::encoding::Encode::<UsbAdbImplReceiveResponse, D>::encode(
(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<UsbAdbImplReceiveResponse, 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::<UsbAdbImplReceiveResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for UsbAdbImplReceiveResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { data: fidl::new_empty!(fidl::encoding::UnboundedVector<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);
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.data,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
}