#![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 DEFAULT_REALM: &str = "gis_default";
pub const GUEST_INTERACTION_MAX_LENGTH: u32 = 1024;
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct CommandListenerOnStartedRequest {
pub status: i32,
}
impl fidl::Persistable for CommandListenerOnStartedRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct CommandListenerOnTerminatedRequest {
pub status: i32,
pub return_code: i32,
}
impl fidl::Persistable for CommandListenerOnTerminatedRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DiscoveryGetGuestRequest {
pub realm_name: Option<String>,
pub guest_name: String,
pub guest: fidl::endpoints::ServerEnd<InteractionMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DiscoveryGetGuestRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EnvironmentVariable {
pub key: String,
pub value: String,
}
impl fidl::Persistable for EnvironmentVariable {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InteractionExecuteCommandRequest {
pub command: String,
pub env: Vec<EnvironmentVariable>,
pub stdin: Option<fidl::Socket>,
pub stdout: Option<fidl::Socket>,
pub stderr: Option<fidl::Socket>,
pub command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for InteractionExecuteCommandRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InteractionGetFileRequest {
pub remote_path: String,
pub local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InteractionGetFileRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct InteractionGetFileResponse {
pub status: i32,
}
impl fidl::Persistable for InteractionGetFileResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InteractionPutFileRequest {
pub local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
pub remote_path: String,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InteractionPutFileRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct InteractionPutFileResponse {
pub status: i32,
}
impl fidl::Persistable for InteractionPutFileResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct CommandListenerMarker;
impl fidl::endpoints::ProtocolMarker for CommandListenerMarker {
type Proxy = CommandListenerProxy;
type RequestStream = CommandListenerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = CommandListenerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) CommandListener";
}
pub trait CommandListenerProxyInterface: Send + Sync {}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct CommandListenerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for CommandListenerSynchronousProxy {
type Proxy = CommandListenerProxy;
type Protocol = CommandListenerMarker;
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 CommandListenerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <CommandListenerMarker 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<CommandListenerEvent, fidl::Error> {
CommandListenerEvent::decode(self.client.wait_for_event(deadline)?)
}
}
#[derive(Debug, Clone)]
pub struct CommandListenerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for CommandListenerProxy {
type Protocol = CommandListenerMarker;
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 CommandListenerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> CommandListenerEventStream {
CommandListenerEventStream { event_receiver: self.client.take_event_receiver() }
}
}
impl CommandListenerProxyInterface for CommandListenerProxy {}
pub struct CommandListenerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for CommandListenerEventStream {}
impl futures::stream::FusedStream for CommandListenerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for CommandListenerEventStream {
type Item = Result<CommandListenerEvent, 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(CommandListenerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum CommandListenerEvent {
OnStarted { status: i32 },
OnTerminated { status: i32, return_code: i32 },
}
impl CommandListenerEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_started(self) -> Option<i32> {
if let CommandListenerEvent::OnStarted { status } = self {
Some((status))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_terminated(self) -> Option<(i32, i32)> {
if let CommandListenerEvent::OnTerminated { status, return_code } = self {
Some((status, return_code))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<CommandListenerEvent, 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 {
0x3a3693a7e54a5f09 => {
let mut out = fidl::new_empty!(
CommandListenerOnStartedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CommandListenerOnStartedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((CommandListenerEvent::OnStarted { status: out.status }))
}
0x5a08413bdea2446a => {
let mut out = fidl::new_empty!(
CommandListenerOnTerminatedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CommandListenerOnTerminatedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((CommandListenerEvent::OnTerminated {
status: out.status,
return_code: out.return_code,
}))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct CommandListenerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for CommandListenerRequestStream {}
impl futures::stream::FusedStream for CommandListenerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for CommandListenerRequestStream {
type Protocol = CommandListenerMarker;
type ControlHandle = CommandListenerControlHandle;
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 {
CommandListenerControlHandle { 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 CommandListenerRequestStream {
type Item = Result<CommandListenerRequest, 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 CommandListenerRequestStream 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 {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<CommandListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum CommandListenerRequest {}
impl CommandListenerRequest {
pub fn method_name(&self) -> &'static str {
match *self {}
}
}
#[derive(Debug, Clone)]
pub struct CommandListenerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for CommandListenerControlHandle {
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 CommandListenerControlHandle {
pub fn send_on_started(&self, mut status: i32) -> Result<(), fidl::Error> {
self.inner.send::<CommandListenerOnStartedRequest>(
(status,),
0,
0x3a3693a7e54a5f09,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_terminated(
&self,
mut status: i32,
mut return_code: i32,
) -> Result<(), fidl::Error> {
self.inner.send::<CommandListenerOnTerminatedRequest>(
(status, return_code),
0,
0x5a08413bdea2446a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DiscoveryMarker;
impl fidl::endpoints::ProtocolMarker for DiscoveryMarker {
type Proxy = DiscoveryProxy;
type RequestStream = DiscoveryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DiscoverySynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.virtualization.guest.interaction.Discovery";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DiscoveryMarker {}
pub trait DiscoveryProxyInterface: Send + Sync {
fn r#get_guest(
&self,
realm_name: Option<&str>,
guest_name: &str,
guest: fidl::endpoints::ServerEnd<InteractionMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DiscoverySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DiscoverySynchronousProxy {
type Proxy = DiscoveryProxy;
type Protocol = DiscoveryMarker;
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 DiscoverySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DiscoveryMarker 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<DiscoveryEvent, fidl::Error> {
DiscoveryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_guest(
&self,
mut realm_name: Option<&str>,
mut guest_name: &str,
mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DiscoveryGetGuestRequest>(
(realm_name, guest_name, guest),
0x60538587bdd80a32,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct DiscoveryProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DiscoveryProxy {
type Protocol = DiscoveryMarker;
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 DiscoveryProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DiscoveryEventStream {
DiscoveryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_guest(
&self,
mut realm_name: Option<&str>,
mut guest_name: &str,
mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
) -> Result<(), fidl::Error> {
DiscoveryProxyInterface::r#get_guest(self, realm_name, guest_name, guest)
}
}
impl DiscoveryProxyInterface for DiscoveryProxy {
fn r#get_guest(
&self,
mut realm_name: Option<&str>,
mut guest_name: &str,
mut guest: fidl::endpoints::ServerEnd<InteractionMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DiscoveryGetGuestRequest>(
(realm_name, guest_name, guest),
0x60538587bdd80a32,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct DiscoveryEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DiscoveryEventStream {}
impl futures::stream::FusedStream for DiscoveryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DiscoveryEventStream {
type Item = Result<DiscoveryEvent, 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(DiscoveryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DiscoveryEvent {}
impl DiscoveryEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DiscoveryEvent, 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: <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DiscoveryRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DiscoveryRequestStream {}
impl futures::stream::FusedStream for DiscoveryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DiscoveryRequestStream {
type Protocol = DiscoveryMarker;
type ControlHandle = DiscoveryControlHandle;
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 {
DiscoveryControlHandle { 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 DiscoveryRequestStream {
type Item = Result<DiscoveryRequest, 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 DiscoveryRequestStream 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 {
0x60538587bdd80a32 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
DiscoveryGetGuestRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiscoveryGetGuestRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DiscoveryControlHandle { inner: this.inner.clone() };
Ok(DiscoveryRequest::GetGuest {
realm_name: req.realm_name,
guest_name: req.guest_name,
guest: req.guest,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DiscoveryRequest {
GetGuest {
realm_name: Option<String>,
guest_name: String,
guest: fidl::endpoints::ServerEnd<InteractionMarker>,
control_handle: DiscoveryControlHandle,
},
}
impl DiscoveryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_guest(
self,
) -> Option<(
Option<String>,
String,
fidl::endpoints::ServerEnd<InteractionMarker>,
DiscoveryControlHandle,
)> {
if let DiscoveryRequest::GetGuest { realm_name, guest_name, guest, control_handle } = self {
Some((realm_name, guest_name, guest, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DiscoveryRequest::GetGuest { .. } => "get_guest",
}
}
}
#[derive(Debug, Clone)]
pub struct DiscoveryControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DiscoveryControlHandle {
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 DiscoveryControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct InteractionMarker;
impl fidl::endpoints::ProtocolMarker for InteractionMarker {
type Proxy = InteractionProxy;
type RequestStream = InteractionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = InteractionSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Interaction";
}
pub trait InteractionProxyInterface: Send + Sync {
type PutFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#put_file(
&self,
local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
remote_path: &str,
) -> Self::PutFileResponseFut;
type GetFileResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#get_file(
&self,
remote_path: &str,
local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
) -> Self::GetFileResponseFut;
fn r#execute_command(
&self,
command: &str,
env: &[EnvironmentVariable],
stdin: Option<fidl::Socket>,
stdout: Option<fidl::Socket>,
stderr: Option<fidl::Socket>,
command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct InteractionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for InteractionSynchronousProxy {
type Proxy = InteractionProxy;
type Protocol = InteractionMarker;
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 InteractionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <InteractionMarker 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<InteractionEvent, fidl::Error> {
InteractionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#put_file(
&self,
mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
mut remote_path: &str,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<InteractionPutFileRequest, InteractionPutFileResponse>(
(local_file, remote_path),
0x223bc20da4a7cddd,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#get_file(
&self,
mut remote_path: &str,
mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response =
self.client.send_query::<InteractionGetFileRequest, InteractionGetFileResponse>(
(remote_path, local_file),
0x7696bea472ca0f2d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.status)
}
pub fn r#execute_command(
&self,
mut command: &str,
mut env: &[EnvironmentVariable],
mut stdin: Option<fidl::Socket>,
mut stdout: Option<fidl::Socket>,
mut stderr: Option<fidl::Socket>,
mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<InteractionExecuteCommandRequest>(
(command, env, stdin, stdout, stderr, command_listener),
0x612641220a1556d8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct InteractionProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for InteractionProxy {
type Protocol = InteractionMarker;
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 InteractionProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> InteractionEventStream {
InteractionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#put_file(
&self,
mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
mut remote_path: &str,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
InteractionProxyInterface::r#put_file(self, local_file, remote_path)
}
pub fn r#get_file(
&self,
mut remote_path: &str,
mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
InteractionProxyInterface::r#get_file(self, remote_path, local_file)
}
pub fn r#execute_command(
&self,
mut command: &str,
mut env: &[EnvironmentVariable],
mut stdin: Option<fidl::Socket>,
mut stdout: Option<fidl::Socket>,
mut stderr: Option<fidl::Socket>,
mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
) -> Result<(), fidl::Error> {
InteractionProxyInterface::r#execute_command(
self,
command,
env,
stdin,
stdout,
stderr,
command_listener,
)
}
}
impl InteractionProxyInterface for InteractionProxy {
type PutFileResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#put_file(
&self,
mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
mut remote_path: &str,
) -> Self::PutFileResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
InteractionPutFileResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x223bc20da4a7cddd,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<InteractionPutFileRequest, i32>(
(local_file, remote_path),
0x223bc20da4a7cddd,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetFileResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_file(
&self,
mut remote_path: &str,
mut local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
) -> Self::GetFileResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
InteractionGetFileResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7696bea472ca0f2d,
>(_buf?)?;
Ok(_response.status)
}
self.client.send_query_and_decode::<InteractionGetFileRequest, i32>(
(remote_path, local_file),
0x7696bea472ca0f2d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#execute_command(
&self,
mut command: &str,
mut env: &[EnvironmentVariable],
mut stdin: Option<fidl::Socket>,
mut stdout: Option<fidl::Socket>,
mut stderr: Option<fidl::Socket>,
mut command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<InteractionExecuteCommandRequest>(
(command, env, stdin, stdout, stderr, command_listener),
0x612641220a1556d8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct InteractionEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for InteractionEventStream {}
impl futures::stream::FusedStream for InteractionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for InteractionEventStream {
type Item = Result<InteractionEvent, 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(InteractionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum InteractionEvent {}
impl InteractionEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<InteractionEvent, 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: <InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct InteractionRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for InteractionRequestStream {}
impl futures::stream::FusedStream for InteractionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for InteractionRequestStream {
type Protocol = InteractionMarker;
type ControlHandle = InteractionControlHandle;
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 {
InteractionControlHandle { 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 InteractionRequestStream {
type Item = Result<InteractionRequest, 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 InteractionRequestStream 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 {
0x223bc20da4a7cddd => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
InteractionPutFileRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionPutFileRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = InteractionControlHandle { inner: this.inner.clone() };
Ok(InteractionRequest::PutFile {
local_file: req.local_file,
remote_path: req.remote_path,
responder: InteractionPutFileResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7696bea472ca0f2d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
InteractionGetFileRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionGetFileRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = InteractionControlHandle { inner: this.inner.clone() };
Ok(InteractionRequest::GetFile {
remote_path: req.remote_path,
local_file: req.local_file,
responder: InteractionGetFileResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x612641220a1556d8 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
InteractionExecuteCommandRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InteractionExecuteCommandRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = InteractionControlHandle { inner: this.inner.clone() };
Ok(InteractionRequest::ExecuteCommand {
command: req.command,
env: req.env,
stdin: req.stdin,
stdout: req.stdout,
stderr: req.stderr,
command_listener: req.command_listener,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<InteractionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum InteractionRequest {
PutFile {
local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
remote_path: String,
responder: InteractionPutFileResponder,
},
GetFile {
remote_path: String,
local_file: fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
responder: InteractionGetFileResponder,
},
ExecuteCommand {
command: String,
env: Vec<EnvironmentVariable>,
stdin: Option<fidl::Socket>,
stdout: Option<fidl::Socket>,
stderr: Option<fidl::Socket>,
command_listener: fidl::endpoints::ServerEnd<CommandListenerMarker>,
control_handle: InteractionControlHandle,
},
}
impl InteractionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_put_file(
self,
) -> Option<(
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
String,
InteractionPutFileResponder,
)> {
if let InteractionRequest::PutFile { local_file, remote_path, responder } = self {
Some((local_file, remote_path, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_file(
self,
) -> Option<(
String,
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
InteractionGetFileResponder,
)> {
if let InteractionRequest::GetFile { remote_path, local_file, responder } = self {
Some((remote_path, local_file, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_execute_command(
self,
) -> Option<(
String,
Vec<EnvironmentVariable>,
Option<fidl::Socket>,
Option<fidl::Socket>,
Option<fidl::Socket>,
fidl::endpoints::ServerEnd<CommandListenerMarker>,
InteractionControlHandle,
)> {
if let InteractionRequest::ExecuteCommand {
command,
env,
stdin,
stdout,
stderr,
command_listener,
control_handle,
} = self
{
Some((command, env, stdin, stdout, stderr, command_listener, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
InteractionRequest::PutFile { .. } => "put_file",
InteractionRequest::GetFile { .. } => "get_file",
InteractionRequest::ExecuteCommand { .. } => "execute_command",
}
}
}
#[derive(Debug, Clone)]
pub struct InteractionControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for InteractionControlHandle {
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 InteractionControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct InteractionPutFileResponder {
control_handle: std::mem::ManuallyDrop<InteractionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for InteractionPutFileResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for InteractionPutFileResponder {
type ControlHandle = InteractionControlHandle;
fn control_handle(&self) -> &InteractionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl InteractionPutFileResponder {
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::<InteractionPutFileResponse>(
(status,),
self.tx_id,
0x223bc20da4a7cddd,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct InteractionGetFileResponder {
control_handle: std::mem::ManuallyDrop<InteractionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for InteractionGetFileResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for InteractionGetFileResponder {
type ControlHandle = InteractionControlHandle;
fn control_handle(&self) -> &InteractionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl InteractionGetFileResponder {
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::<InteractionGetFileResponse>(
(status,),
self.tx_id,
0x7696bea472ca0f2d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for CommandListenerOnStartedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CommandListenerOnStartedRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<CommandListenerOnStartedRequest, D>
for &CommandListenerOnStartedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CommandListenerOnStartedRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut CommandListenerOnStartedRequest)
.write_unaligned((self as *const CommandListenerOnStartedRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<CommandListenerOnStartedRequest, 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::<CommandListenerOnStartedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CommandListenerOnStartedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let 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(())
}
}
impl fidl::encoding::ValueTypeMarker for CommandListenerOnTerminatedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CommandListenerOnTerminatedRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<CommandListenerOnTerminatedRequest, D>
for &CommandListenerOnTerminatedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CommandListenerOnTerminatedRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut CommandListenerOnTerminatedRequest)
.write_unaligned((self as *const CommandListenerOnTerminatedRequest).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<i32, D>,
T1: fidl::encoding::Encode<i32, D>,
> fidl::encoding::Encode<CommandListenerOnTerminatedRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CommandListenerOnTerminatedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CommandListenerOnTerminatedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, D), return_code: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let 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(())
}
}
impl fidl::encoding::ResourceTypeMarker for DiscoveryGetGuestRequest {
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 DiscoveryGetGuestRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl
fidl::encoding::Encode<
DiscoveryGetGuestRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DiscoveryGetGuestRequest
{
#[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::<DiscoveryGetGuestRequest>(offset);
fidl::encoding::Encode::<DiscoveryGetGuestRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Optional<fidl::encoding::BoundedString<1024>> as fidl::encoding::ValueTypeMarker>::borrow(&self.realm_name),
<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.guest_name),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.guest),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::BoundedString<1024>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DiscoveryGetGuestRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[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::<DiscoveryGetGuestRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DiscoveryGetGuestRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
realm_name: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
guest_name: fidl::new_empty!(
fidl::encoding::BoundedString<1024>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
guest: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
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(32) };
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 + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<1024>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.realm_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<1024>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.guest_name,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InteractionMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.guest,
decoder,
offset + 32,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EnvironmentVariable {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EnvironmentVariable {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EnvironmentVariable, D>
for &EnvironmentVariable
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EnvironmentVariable>(offset);
fidl::encoding::Encode::<EnvironmentVariable, D>::encode(
(
<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>, D>,
T1: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>, D>,
> fidl::encoding::Encode<EnvironmentVariable, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EnvironmentVariable>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EnvironmentVariable {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(fidl::encoding::BoundedString<1024>, D),
value: fidl::new_empty!(fidl::encoding::BoundedString<1024>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<1024>,
D,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<1024>,
D,
&mut self.value,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for InteractionExecuteCommandRequest {
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 InteractionExecuteCommandRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl
fidl::encoding::Encode<
InteractionExecuteCommandRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut InteractionExecuteCommandRequest
{
#[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::<InteractionExecuteCommandRequest>(offset);
fidl::encoding::Encode::<InteractionExecuteCommandRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.command),
<fidl::encoding::Vector<EnvironmentVariable, 1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.env),
<fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stdin),
<fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stdout),
<fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stderr),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.command_listener),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<1024>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Vector<EnvironmentVariable, 1024>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T3: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T4: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T5: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
InteractionExecuteCommandRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2, T3, T4, T5)
{
#[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::<InteractionExecuteCommandRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 36, depth)?;
self.4.encode(encoder, offset + 40, depth)?;
self.5.encode(encoder, offset + 44, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for InteractionExecuteCommandRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
command: fidl::new_empty!(
fidl::encoding::BoundedString<1024>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
env: fidl::new_empty!(fidl::encoding::Vector<EnvironmentVariable, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect),
stdin: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
stdout: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
stderr: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
command_listener: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
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::BoundedString<1024>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.command,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<EnvironmentVariable, 1024>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.env, decoder, offset + 16, _depth)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.stdin,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.stdout,
decoder,
offset + 36,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.stderr,
decoder,
offset + 40,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CommandListenerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.command_listener,
decoder,
offset + 44,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for InteractionGetFileRequest {
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 InteractionGetFileRequest {
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<
InteractionGetFileRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut InteractionGetFileRequest
{
#[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::<InteractionGetFileRequest>(offset);
fidl::encoding::Encode::<InteractionGetFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_path),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.local_file),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<1024>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
InteractionGetFileRequest,
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::<InteractionGetFileRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for InteractionGetFileRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
remote_path: fidl::new_empty!(
fidl::encoding::BoundedString<1024>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
local_file: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<1024>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.remote_path,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.local_file,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InteractionGetFileResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for InteractionGetFileResponse {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<InteractionGetFileResponse, D> for &InteractionGetFileResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InteractionGetFileResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut InteractionGetFileResponse)
.write_unaligned((self as *const InteractionGetFileResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<InteractionGetFileResponse, 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::<InteractionGetFileResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InteractionGetFileResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let 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(())
}
}
impl fidl::encoding::ResourceTypeMarker for InteractionPutFileRequest {
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 InteractionPutFileRequest {
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<
InteractionPutFileRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut InteractionPutFileRequest
{
#[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::<InteractionPutFileRequest>(offset);
fidl::encoding::Encode::<InteractionPutFileRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.local_file),
<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(&self.remote_path),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::BoundedString<1024>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
InteractionPutFileRequest,
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::<InteractionPutFileRequest>(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 InteractionPutFileRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
local_file: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
remote_path: fidl::new_empty!(
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::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::FileMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.local_file,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<1024>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.remote_path,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InteractionPutFileResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for InteractionPutFileResponse {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<InteractionPutFileResponse, D> for &InteractionPutFileResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InteractionPutFileResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut InteractionPutFileResponse)
.write_unaligned((self as *const InteractionPutFileResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<InteractionPutFileResponse, 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::<InteractionPutFileResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for InteractionPutFileResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let 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(())
}
}
}