#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
#[derive(Clone, Debug, PartialEq)]
pub struct AcceptorAcceptRequest {
pub addr: fidl_fuchsia_hardware_vsock::Addr,
}
impl fidl::Persistable for AcceptorAcceptRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AcceptorAcceptResponse {
pub con: Option<Box<ConnectionTransport>>,
}
impl fidl::Standalone for AcceptorAcceptResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ConnectionSendVmoRequest {
pub vmo: fidl::Vmo,
pub off: u64,
pub len: u64,
}
impl fidl::Standalone for ConnectionSendVmoRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ConnectionSendVmoResponse {
pub status: i32,
}
impl fidl::Persistable for ConnectionSendVmoResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ConnectionTransport {
pub data: fidl::Socket,
pub con: fidl::endpoints::ServerEnd<ConnectionMarker>,
}
impl fidl::Standalone for ConnectionTransport {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ConnectorConnectRequest {
pub remote_cid: u32,
pub remote_port: u32,
pub con: ConnectionTransport,
}
impl fidl::Standalone for ConnectorConnectRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ConnectorConnectResponse {
pub status: i32,
pub local_port: u32,
}
impl fidl::Persistable for ConnectorConnectResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ConnectorListenRequest {
pub local_port: u32,
pub acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
}
impl fidl::Standalone for ConnectorListenRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ConnectorListenResponse {
pub status: i32,
}
impl fidl::Persistable for ConnectorListenResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AcceptorMarker;
impl fidl::endpoints::ProtocolMarker for AcceptorMarker {
type Proxy = AcceptorProxy;
type RequestStream = AcceptorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AcceptorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Acceptor";
}
pub trait AcceptorProxyInterface: Send + Sync {
type AcceptResponseFut: std::future::Future<Output = Result<Option<Box<ConnectionTransport>>, fidl::Error>>
+ Send;
fn r#accept(&self, addr: &fidl_fuchsia_hardware_vsock::Addr) -> Self::AcceptResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AcceptorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AcceptorSynchronousProxy {
type Proxy = AcceptorProxy;
type Protocol = AcceptorMarker;
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 AcceptorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <AcceptorMarker 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::Time) -> Result<AcceptorEvent, fidl::Error> {
AcceptorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#accept(
&self,
mut addr: &fidl_fuchsia_hardware_vsock::Addr,
___deadline: zx::Time,
) -> Result<Option<Box<ConnectionTransport>>, fidl::Error> {
let _response = self.client.send_query::<AcceptorAcceptRequest, AcceptorAcceptResponse>(
(addr,),
0x21fd057ad9c9f443,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.con)
}
}
#[derive(Debug, Clone)]
pub struct AcceptorProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for AcceptorProxy {
type Protocol = AcceptorMarker;
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 AcceptorProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <AcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AcceptorEventStream {
AcceptorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#accept(
&self,
mut addr: &fidl_fuchsia_hardware_vsock::Addr,
) -> fidl::client::QueryResponseFut<Option<Box<ConnectionTransport>>> {
AcceptorProxyInterface::r#accept(self, addr)
}
}
impl AcceptorProxyInterface for AcceptorProxy {
type AcceptResponseFut = fidl::client::QueryResponseFut<Option<Box<ConnectionTransport>>>;
fn r#accept(&self, mut addr: &fidl_fuchsia_hardware_vsock::Addr) -> Self::AcceptResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<Option<Box<ConnectionTransport>>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
AcceptorAcceptResponse,
0x21fd057ad9c9f443,
>(_buf?)?;
Ok(_response.con)
}
self.client
.send_query_and_decode::<AcceptorAcceptRequest, Option<Box<ConnectionTransport>>>(
(addr,),
0x21fd057ad9c9f443,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct AcceptorEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for AcceptorEventStream {}
impl futures::stream::FusedStream for AcceptorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AcceptorEventStream {
type Item = Result<AcceptorEvent, 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(AcceptorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AcceptorEvent {}
impl AcceptorEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<AcceptorEvent, 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: <AcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AcceptorRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for AcceptorRequestStream {}
impl futures::stream::FusedStream for AcceptorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AcceptorRequestStream {
type Protocol = AcceptorMarker;
type ControlHandle = AcceptorControlHandle;
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 {
AcceptorControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for AcceptorRequestStream {
type Item = Result<AcceptorRequest, 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 AcceptorRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x21fd057ad9c9f443 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(AcceptorAcceptRequest);
fidl::encoding::Decoder::decode_into::<AcceptorAcceptRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = AcceptorControlHandle { inner: this.inner.clone() };
Ok(AcceptorRequest::Accept {
addr: req.addr,
responder: AcceptorAcceptResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <AcceptorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum AcceptorRequest {
Accept { addr: fidl_fuchsia_hardware_vsock::Addr, responder: AcceptorAcceptResponder },
}
impl AcceptorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_accept(
self,
) -> Option<(fidl_fuchsia_hardware_vsock::Addr, AcceptorAcceptResponder)> {
if let AcceptorRequest::Accept { addr, responder } = self {
Some((addr, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AcceptorRequest::Accept { .. } => "accept",
}
}
}
#[derive(Debug, Clone)]
pub struct AcceptorControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for AcceptorControlHandle {
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()
}
}
impl AcceptorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AcceptorAcceptResponder {
control_handle: std::mem::ManuallyDrop<AcceptorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AcceptorAcceptResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AcceptorAcceptResponder {
type ControlHandle = AcceptorControlHandle;
fn control_handle(&self) -> &AcceptorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AcceptorAcceptResponder {
pub fn send(self, mut con: Option<ConnectionTransport>) -> Result<(), fidl::Error> {
let _result = self.send_raw(con);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut con: Option<ConnectionTransport>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(con);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut con: Option<ConnectionTransport>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<AcceptorAcceptResponse>(
(con.as_mut(),),
self.tx_id,
0x21fd057ad9c9f443,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ConnectionMarker;
impl fidl::endpoints::ProtocolMarker for ConnectionMarker {
type Proxy = ConnectionProxy;
type RequestStream = ConnectionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ConnectionSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Connection";
}
pub trait ConnectionProxyInterface: Send + Sync {
fn r#shutdown(&self) -> Result<(), fidl::Error>;
type SendVmoResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#send_vmo(&self, vmo: fidl::Vmo, off: u64, len: u64) -> Self::SendVmoResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ConnectionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ConnectionSynchronousProxy {
type Proxy = ConnectionProxy;
type Protocol = ConnectionMarker;
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 ConnectionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ConnectionMarker 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::Time) -> Result<ConnectionEvent, fidl::Error> {
ConnectionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x40da7ca487466971,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#send_vmo(
&self,
mut vmo: fidl::Vmo,
mut off: u64,
mut len: u64,
___deadline: zx::Time,
) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<ConnectionSendVmoRequest, ConnectionSendVmoResponse>(
(vmo, off, len),
0x6b1dd042f8d1348b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
}
#[derive(Debug, Clone)]
pub struct ConnectionProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for ConnectionProxy {
type Protocol = ConnectionMarker;
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 ConnectionProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ConnectionEventStream {
ConnectionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
ConnectionProxyInterface::r#shutdown(self)
}
pub fn r#send_vmo(
&self,
mut vmo: fidl::Vmo,
mut off: u64,
mut len: u64,
) -> fidl::client::QueryResponseFut<i32> {
ConnectionProxyInterface::r#send_vmo(self, vmo, off, len)
}
}
impl ConnectionProxyInterface for ConnectionProxy {
fn r#shutdown(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x40da7ca487466971,
fidl::encoding::DynamicFlags::empty(),
)
}
type SendVmoResponseFut = fidl::client::QueryResponseFut<i32>;
fn r#send_vmo(
&self,
mut vmo: fidl::Vmo,
mut off: u64,
mut len: u64,
) -> Self::SendVmoResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ConnectionSendVmoResponse,
0x6b1dd042f8d1348b,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<ConnectionSendVmoRequest, i32>(
(vmo, off, len),
0x6b1dd042f8d1348b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ConnectionEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for ConnectionEventStream {}
impl futures::stream::FusedStream for ConnectionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ConnectionEventStream {
type Item = Result<ConnectionEvent, 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(ConnectionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ConnectionEvent {}
impl ConnectionEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<ConnectionEvent, 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: <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ConnectionRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for ConnectionRequestStream {}
impl futures::stream::FusedStream for ConnectionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ConnectionRequestStream {
type Protocol = ConnectionMarker;
type ControlHandle = ConnectionControlHandle;
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 {
ConnectionControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ConnectionRequestStream {
type Item = Result<ConnectionRequest, 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 ConnectionRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x40da7ca487466971 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
Ok(ConnectionRequest::Shutdown { control_handle })
}
0x6b1dd042f8d1348b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ConnectionSendVmoRequest);
fidl::encoding::Decoder::decode_into::<ConnectionSendVmoRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
Ok(ConnectionRequest::SendVmo {
vmo: req.vmo,
off: req.off,
len: req.len,
responder: ConnectionSendVmoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum ConnectionRequest {
Shutdown { control_handle: ConnectionControlHandle },
SendVmo { vmo: fidl::Vmo, off: u64, len: u64, responder: ConnectionSendVmoResponder },
}
impl ConnectionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_shutdown(self) -> Option<(ConnectionControlHandle)> {
if let ConnectionRequest::Shutdown { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_send_vmo(self) -> Option<(fidl::Vmo, u64, u64, ConnectionSendVmoResponder)> {
if let ConnectionRequest::SendVmo { vmo, off, len, responder } = self {
Some((vmo, off, len, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ConnectionRequest::Shutdown { .. } => "shutdown",
ConnectionRequest::SendVmo { .. } => "send_vmo",
}
}
}
#[derive(Debug, Clone)]
pub struct ConnectionControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for ConnectionControlHandle {
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()
}
}
impl ConnectionControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ConnectionSendVmoResponder {
control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ConnectionSendVmoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ConnectionSendVmoResponder {
type ControlHandle = ConnectionControlHandle;
fn control_handle(&self) -> &ConnectionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ConnectionSendVmoResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ConnectionSendVmoResponse>(
(status,),
self.tx_id,
0x6b1dd042f8d1348b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[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 = "fuchsia.vsock.Connector";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ConnectorMarker {}
pub trait ConnectorProxyInterface: Send + Sync {
type ConnectResponseFut: std::future::Future<Output = Result<(i32, u32), fidl::Error>> + Send;
fn r#connect(
&self,
remote_cid: u32,
remote_port: u32,
con: ConnectionTransport,
) -> Self::ConnectResponseFut;
type ListenResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#listen(
&self,
local_port: u32,
acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
) -> Self::ListenResponseFut;
}
#[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::Time) -> Result<ConnectorEvent, fidl::Error> {
ConnectorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#connect(
&self,
mut remote_cid: u32,
mut remote_port: u32,
mut con: ConnectionTransport,
___deadline: zx::Time,
) -> Result<(i32, u32), fidl::Error> {
let _response =
self.client.send_query::<ConnectorConnectRequest, ConnectorConnectResponse>(
(remote_cid, remote_port, &mut con),
0xdf55c5e6a6a4117,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.status, _response.local_port))
}
pub fn r#listen(
&self,
mut local_port: u32,
mut acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
___deadline: zx::Time,
) -> Result<i32, fidl::Error> {
let _response = self.client.send_query::<ConnectorListenRequest, ConnectorListenResponse>(
(local_port, acceptor),
0x17c1371908bacf73,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
}
#[derive(Debug, Clone)]
pub struct ConnectorProxy {
client: fidl::client::Client,
}
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 remote_cid: u32,
mut remote_port: u32,
mut con: ConnectionTransport,
) -> fidl::client::QueryResponseFut<(i32, u32)> {
ConnectorProxyInterface::r#connect(self, remote_cid, remote_port, con)
}
pub fn r#listen(
&self,
mut local_port: u32,
mut acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
) -> fidl::client::QueryResponseFut<i32> {
ConnectorProxyInterface::r#listen(self, local_port, acceptor)
}
}
impl ConnectorProxyInterface for ConnectorProxy {
type ConnectResponseFut = fidl::client::QueryResponseFut<(i32, u32)>;
fn r#connect(
&self,
mut remote_cid: u32,
mut remote_port: u32,
mut con: ConnectionTransport,
) -> Self::ConnectResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<(i32, u32), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ConnectorConnectResponse,
0xdf55c5e6a6a4117,
>(_buf?)?;
Ok((_response.status, _response.local_port))
}
self.client.send_query_and_decode::<ConnectorConnectRequest, (i32, u32)>(
(remote_cid, remote_port, &mut con),
0xdf55c5e6a6a4117,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ListenResponseFut = fidl::client::QueryResponseFut<i32>;
fn r#listen(
&self,
mut local_port: u32,
mut acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
) -> Self::ListenResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ConnectorListenResponse,
0x17c1371908bacf73,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<ConnectorListenRequest, i32>(
(local_port, acceptor),
0x17c1371908bacf73,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ConnectorEventStream {
event_receiver: fidl::client::EventReceiver,
}
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::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>,
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>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, 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(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0xdf55c5e6a6a4117 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ConnectorConnectRequest);
fidl::encoding::Decoder::decode_into::<ConnectorConnectRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
Ok(ConnectorRequest::Connect {
remote_cid: req.remote_cid,
remote_port: req.remote_port,
con: req.con,
responder: ConnectorConnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x17c1371908bacf73 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ConnectorListenRequest);
fidl::encoding::Decoder::decode_into::<ConnectorListenRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
Ok(ConnectorRequest::Listen {
local_port: req.local_port,
acceptor: req.acceptor,
responder: ConnectorListenResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum ConnectorRequest {
Connect {
remote_cid: u32,
remote_port: u32,
con: ConnectionTransport,
responder: ConnectorConnectResponder,
},
Listen {
local_port: u32,
acceptor: fidl::endpoints::ClientEnd<AcceptorMarker>,
responder: ConnectorListenResponder,
},
}
impl ConnectorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_connect(
self,
) -> Option<(u32, u32, ConnectionTransport, ConnectorConnectResponder)> {
if let ConnectorRequest::Connect { remote_cid, remote_port, con, responder } = self {
Some((remote_cid, remote_port, con, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_listen(
self,
) -> Option<(u32, fidl::endpoints::ClientEnd<AcceptorMarker>, ConnectorListenResponder)> {
if let ConnectorRequest::Listen { local_port, acceptor, responder } = self {
Some((local_port, acceptor, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ConnectorRequest::Connect { .. } => "connect",
ConnectorRequest::Listen { .. } => "listen",
}
}
}
#[derive(Debug, Clone)]
pub struct ConnectorControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
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()
}
}
impl ConnectorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ConnectorConnectResponder {
control_handle: std::mem::ManuallyDrop<ConnectorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ConnectorConnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ConnectorConnectResponder {
type ControlHandle = ConnectorControlHandle;
fn control_handle(&self) -> &ConnectorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ConnectorConnectResponder {
pub fn send(self, mut status: i32, mut local_port: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, local_port);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut status: i32,
mut local_port: u32,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(status, local_port);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32, mut local_port: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ConnectorConnectResponse>(
(status, local_port),
self.tx_id,
0xdf55c5e6a6a4117,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ConnectorListenResponder {
control_handle: std::mem::ManuallyDrop<ConnectorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ConnectorListenResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ConnectorListenResponder {
type ControlHandle = ConnectorControlHandle;
fn control_handle(&self) -> &ConnectorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ConnectorListenResponder {
pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(status);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ConnectorListenResponse>(
(status,),
self.tx_id,
0x17c1371908bacf73,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for AcceptorAcceptRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
impl fidl::encoding::ValueTypeMarker for AcceptorAcceptRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<AcceptorAcceptRequest> for &AcceptorAcceptRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AcceptorAcceptRequest>(offset);
fidl::encoding::Encode::<AcceptorAcceptRequest>::encode(
(<fidl_fuchsia_hardware_vsock::Addr as fidl::encoding::ValueTypeMarker>::borrow(
&self.addr,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl_fuchsia_hardware_vsock::Addr>>
fidl::encoding::Encode<AcceptorAcceptRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AcceptorAcceptRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AcceptorAcceptRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { addr: fidl::new_empty!(fidl_fuchsia_hardware_vsock::Addr) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_hardware_vsock::Addr,
&mut self.addr,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AcceptorAcceptResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ResourceTypeMarker for AcceptorAcceptResponse {
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::Encode<AcceptorAcceptResponse> for &mut AcceptorAcceptResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AcceptorAcceptResponse>(offset);
fidl::encoding::Encode::<AcceptorAcceptResponse>::encode(
(
<fidl::encoding::Boxed<ConnectionTransport> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.con),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::Boxed<ConnectionTransport>>>
fidl::encoding::Encode<AcceptorAcceptResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AcceptorAcceptResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AcceptorAcceptResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { con: fidl::new_empty!(fidl::encoding::Boxed<ConnectionTransport>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Boxed<ConnectionTransport>,
&mut self.con,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ConnectionSendVmoRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for ConnectionSendVmoRequest {
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::Encode<ConnectionSendVmoRequest> for &mut ConnectionSendVmoRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectionSendVmoRequest>(offset);
fidl::encoding::Encode::<ConnectionSendVmoRequest>::encode(
(
<fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.vmo
),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.off),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.len),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
>,
T1: fidl::encoding::Encode<u64>,
T2: fidl::encoding::Encode<u64>,
> fidl::encoding::Encode<ConnectionSendVmoRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectionSendVmoRequest>(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)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ConnectionSendVmoRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>),
off: fidl::new_empty!(u64),
len: fidl::new_empty!(u64),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, &mut self.vmo, decoder, offset + 0, _depth)?;
fidl::decode!(u64, &mut self.off, decoder, offset + 8, _depth)?;
fidl::decode!(u64, &mut self.len, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ConnectionSendVmoResponse {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for ConnectionSendVmoResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ConnectionSendVmoResponse> for &ConnectionSendVmoResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectionSendVmoResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ConnectionSendVmoResponse)
.write_unaligned((self as *const ConnectionSendVmoResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>> fidl::encoding::Encode<ConnectionSendVmoResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectionSendVmoResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ConnectionSendVmoResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ConnectionTransport {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ResourceTypeMarker for ConnectionTransport {
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::Encode<ConnectionTransport> for &mut ConnectionTransport {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectionTransport>(offset);
fidl::encoding::Encode::<ConnectionTransport>::encode(
(
<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.con),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
>,
> fidl::encoding::Encode<ConnectionTransport> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectionTransport>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ConnectionTransport {
#[inline(always)]
fn new_empty() -> Self {
Self {
data: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>),
con: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, &mut self.data, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
&mut self.con,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
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 {
16
}
}
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::Encode<ConnectorConnectRequest> for &mut ConnectorConnectRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
fidl::encoding::Encode::<ConnectorConnectRequest>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_cid),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_port),
<ConnectionTransport as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.con,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<u32>,
T2: fidl::encoding::Encode<ConnectionTransport>,
> fidl::encoding::Encode<ConnectorConnectRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ConnectorConnectRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
remote_cid: fidl::new_empty!(u32),
remote_port: fidl::new_empty!(u32),
con: fidl::new_empty!(ConnectionTransport),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u32, &mut self.remote_cid, decoder, offset + 0, _depth)?;
fidl::decode!(u32, &mut self.remote_port, decoder, offset + 4, _depth)?;
fidl::decode!(ConnectionTransport, &mut self.con, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ConnectorConnectResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for ConnectorConnectResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ConnectorConnectResponse> for &ConnectorConnectResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectorConnectResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ConnectorConnectResponse)
.write_unaligned((self as *const ConnectorConnectResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>, T1: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<ConnectorConnectResponse> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectorConnectResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ConnectorConnectResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32), local_port: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ConnectorListenRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ResourceTypeMarker for ConnectorListenRequest {
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::Encode<ConnectorListenRequest> for &mut ConnectorListenRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectorListenRequest>(offset);
fidl::encoding::Encode::<ConnectorListenRequest>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.local_port),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AcceptorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.acceptor),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AcceptorMarker>>,
>,
> fidl::encoding::Encode<ConnectorListenRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectorListenRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ConnectorListenRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
local_port: fidl::new_empty!(u32),
acceptor: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AcceptorMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u32, &mut self.local_port, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AcceptorMarker>>,
&mut self.acceptor,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ConnectorListenResponse {
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
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for ConnectorListenResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ConnectorListenResponse> for &ConnectorListenResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectorListenResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ConnectorListenResponse)
.write_unaligned((self as *const ConnectorListenResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<i32>> fidl::encoding::Encode<ConnectorListenResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ConnectorListenResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ConnectorListenResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
}