#![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;
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LoaderCloneRequest {
pub loader: fidl::endpoints::ServerEnd<LoaderMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoaderCloneRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct LoaderCloneResponse {
pub rv: i32,
}
impl fidl::Persistable for LoaderCloneResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LoaderConfigRequest {
pub config: String,
}
impl fidl::Persistable for LoaderConfigRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct LoaderConfigResponse {
pub rv: i32,
}
impl fidl::Persistable for LoaderConfigResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LoaderLoadObjectRequest {
pub object_name: String,
}
impl fidl::Persistable for LoaderLoadObjectRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LoaderLoadObjectResponse {
pub rv: i32,
pub object: Option<fidl::Vmo>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoaderLoadObjectResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct LoaderMarker;
impl fidl::endpoints::ProtocolMarker for LoaderMarker {
type Proxy = LoaderProxy;
type RequestStream = LoaderRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = LoaderSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Loader";
}
pub trait LoaderProxyInterface: Send + Sync {
fn r#done(&self) -> Result<(), fidl::Error>;
type LoadObjectResponseFut: std::future::Future<Output = Result<(i32, Option<fidl::Vmo>), fidl::Error>>
+ Send;
fn r#load_object(&self, object_name: &str) -> Self::LoadObjectResponseFut;
type ConfigResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#config(&self, config: &str) -> Self::ConfigResponseFut;
type CloneResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#clone(&self, loader: fidl::endpoints::ServerEnd<LoaderMarker>) -> Self::CloneResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct LoaderSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for LoaderSynchronousProxy {
type Proxy = LoaderProxy;
type Protocol = LoaderMarker;
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 LoaderSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <LoaderMarker 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<LoaderEvent, fidl::Error> {
LoaderEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#done(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x63ba6b76d3671001,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#load_object(
&self,
mut object_name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<(i32, Option<fidl::Vmo>), fidl::Error> {
let _response =
self.client.send_query::<LoaderLoadObjectRequest, LoaderLoadObjectResponse>(
(object_name,),
0x48c5a151d6df2853,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.rv, _response.object))
}
pub fn r#config(
&self,
mut config: &str,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response = self.client.send_query::<LoaderConfigRequest, LoaderConfigResponse>(
(config,),
0x6a8a1a1464632841,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.rv)
}
pub fn r#clone(
&self,
mut loader: fidl::endpoints::ServerEnd<LoaderMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response = self.client.send_query::<LoaderCloneRequest, LoaderCloneResponse>(
(loader,),
0x57e643a9ab6e4c29,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.rv)
}
}
#[derive(Debug, Clone)]
pub struct LoaderProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for LoaderProxy {
type Protocol = LoaderMarker;
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 LoaderProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> LoaderEventStream {
LoaderEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#done(&self) -> Result<(), fidl::Error> {
LoaderProxyInterface::r#done(self)
}
pub fn r#load_object(
&self,
mut object_name: &str,
) -> fidl::client::QueryResponseFut<
(i32, Option<fidl::Vmo>),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
LoaderProxyInterface::r#load_object(self, object_name)
}
pub fn r#config(
&self,
mut config: &str,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
LoaderProxyInterface::r#config(self, config)
}
pub fn r#clone(
&self,
mut loader: fidl::endpoints::ServerEnd<LoaderMarker>,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
LoaderProxyInterface::r#clone(self, loader)
}
}
impl LoaderProxyInterface for LoaderProxy {
fn r#done(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x63ba6b76d3671001,
fidl::encoding::DynamicFlags::empty(),
)
}
type LoadObjectResponseFut = fidl::client::QueryResponseFut<
(i32, Option<fidl::Vmo>),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#load_object(&self, mut object_name: &str) -> Self::LoadObjectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(i32, Option<fidl::Vmo>), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
LoaderLoadObjectResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x48c5a151d6df2853,
>(_buf?)?;
Ok((_response.rv, _response.object))
}
self.client.send_query_and_decode::<LoaderLoadObjectRequest, (i32, Option<fidl::Vmo>)>(
(object_name,),
0x48c5a151d6df2853,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ConfigResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#config(&self, mut config: &str) -> Self::ConfigResponseFut {
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::<
LoaderConfigResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6a8a1a1464632841,
>(_buf?)?;
Ok(_response.rv)
}
self.client.send_query_and_decode::<LoaderConfigRequest, i32>(
(config,),
0x6a8a1a1464632841,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CloneResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#clone(
&self,
mut loader: fidl::endpoints::ServerEnd<LoaderMarker>,
) -> Self::CloneResponseFut {
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::<
LoaderCloneResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x57e643a9ab6e4c29,
>(_buf?)?;
Ok(_response.rv)
}
self.client.send_query_and_decode::<LoaderCloneRequest, i32>(
(loader,),
0x57e643a9ab6e4c29,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct LoaderEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for LoaderEventStream {}
impl futures::stream::FusedStream for LoaderEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for LoaderEventStream {
type Item = Result<LoaderEvent, 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(LoaderEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum LoaderEvent {}
impl LoaderEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<LoaderEvent, 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: <LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct LoaderRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for LoaderRequestStream {}
impl futures::stream::FusedStream for LoaderRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for LoaderRequestStream {
type Protocol = LoaderMarker;
type ControlHandle = LoaderControlHandle;
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 {
LoaderControlHandle { 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 LoaderRequestStream {
type Item = Result<LoaderRequest, 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 LoaderRequestStream 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 {
0x63ba6b76d3671001 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LoaderControlHandle { inner: this.inner.clone() };
Ok(LoaderRequest::Done { control_handle })
}
0x48c5a151d6df2853 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LoaderLoadObjectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderLoadObjectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LoaderControlHandle { inner: this.inner.clone() };
Ok(LoaderRequest::LoadObject {
object_name: req.object_name,
responder: LoaderLoadObjectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6a8a1a1464632841 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LoaderConfigRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderConfigRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LoaderControlHandle { inner: this.inner.clone() };
Ok(LoaderRequest::Config {
config: req.config,
responder: LoaderConfigResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x57e643a9ab6e4c29 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LoaderCloneRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LoaderCloneRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LoaderControlHandle { inner: this.inner.clone() };
Ok(LoaderRequest::Clone {
loader: req.loader,
responder: LoaderCloneResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<LoaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum LoaderRequest {
Done { control_handle: LoaderControlHandle },
LoadObject { object_name: String, responder: LoaderLoadObjectResponder },
Config { config: String, responder: LoaderConfigResponder },
Clone { loader: fidl::endpoints::ServerEnd<LoaderMarker>, responder: LoaderCloneResponder },
}
impl LoaderRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_done(self) -> Option<(LoaderControlHandle)> {
if let LoaderRequest::Done { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_load_object(self) -> Option<(String, LoaderLoadObjectResponder)> {
if let LoaderRequest::LoadObject { object_name, responder } = self {
Some((object_name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_config(self) -> Option<(String, LoaderConfigResponder)> {
if let LoaderRequest::Config { config, responder } = self {
Some((config, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_clone(
self,
) -> Option<(fidl::endpoints::ServerEnd<LoaderMarker>, LoaderCloneResponder)> {
if let LoaderRequest::Clone { loader, responder } = self {
Some((loader, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
LoaderRequest::Done { .. } => "done",
LoaderRequest::LoadObject { .. } => "load_object",
LoaderRequest::Config { .. } => "config",
LoaderRequest::Clone { .. } => "clone",
}
}
}
#[derive(Debug, Clone)]
pub struct LoaderControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for LoaderControlHandle {
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 LoaderControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LoaderLoadObjectResponder {
control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LoaderLoadObjectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LoaderLoadObjectResponder {
type ControlHandle = LoaderControlHandle;
fn control_handle(&self) -> &LoaderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LoaderLoadObjectResponder {
pub fn send(self, mut rv: i32, mut object: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
let _result = self.send_raw(rv, object);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut rv: i32,
mut object: Option<fidl::Vmo>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(rv, object);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut rv: i32, mut object: Option<fidl::Vmo>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<LoaderLoadObjectResponse>(
(rv, object),
self.tx_id,
0x48c5a151d6df2853,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LoaderConfigResponder {
control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LoaderConfigResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LoaderConfigResponder {
type ControlHandle = LoaderControlHandle;
fn control_handle(&self) -> &LoaderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LoaderConfigResponder {
pub fn send(self, mut rv: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(rv);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut rv: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(rv);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut rv: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<LoaderConfigResponse>(
(rv,),
self.tx_id,
0x6a8a1a1464632841,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LoaderCloneResponder {
control_handle: std::mem::ManuallyDrop<LoaderControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LoaderCloneResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LoaderCloneResponder {
type ControlHandle = LoaderControlHandle;
fn control_handle(&self) -> &LoaderControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LoaderCloneResponder {
pub fn send(self, mut rv: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(rv);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut rv: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(rv);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut rv: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<LoaderCloneResponse>(
(rv,),
self.tx_id,
0x57e643a9ab6e4c29,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ResourceTypeMarker for LoaderCloneRequest {
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 LoaderCloneRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<LoaderCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut LoaderCloneRequest
{
#[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::<LoaderCloneRequest>(offset);
fidl::encoding::Encode::<LoaderCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.loader),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<LoaderCloneRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LoaderCloneRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for LoaderCloneRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
loader: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LoaderMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.loader,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LoaderCloneResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LoaderCloneResponse {
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<LoaderCloneResponse, D>
for &LoaderCloneResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LoaderCloneResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut LoaderCloneResponse)
.write_unaligned((self as *const LoaderCloneResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<LoaderCloneResponse, 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::<LoaderCloneResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LoaderCloneResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { rv: 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 LoaderConfigRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LoaderConfigRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LoaderConfigRequest, D>
for &LoaderConfigRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LoaderConfigRequest>(offset);
fidl::encoding::Encode::<LoaderConfigRequest, D>::encode(
(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(
&self.config,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>, D>,
> fidl::encoding::Encode<LoaderConfigRequest, 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::<LoaderConfigRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LoaderConfigRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { config: 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.config,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LoaderConfigResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LoaderConfigResponse {
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<LoaderConfigResponse, D>
for &LoaderConfigResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LoaderConfigResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut LoaderConfigResponse)
.write_unaligned((self as *const LoaderConfigResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<LoaderConfigResponse, 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::<LoaderConfigResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LoaderConfigResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { rv: 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 LoaderLoadObjectRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LoaderLoadObjectRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<LoaderLoadObjectRequest, D> for &LoaderLoadObjectRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LoaderLoadObjectRequest>(offset);
fidl::encoding::Encode::<LoaderLoadObjectRequest, D>::encode(
(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow(
&self.object_name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<1024>, D>,
> fidl::encoding::Encode<LoaderLoadObjectRequest, 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::<LoaderLoadObjectRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LoaderLoadObjectRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { object_name: 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.object_name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for LoaderLoadObjectResponse {
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 LoaderLoadObjectResponse {
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
}
}
unsafe impl
fidl::encoding::Encode<
LoaderLoadObjectResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut LoaderLoadObjectResponse
{
#[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::<LoaderLoadObjectResponse>(offset);
fidl::encoding::Encode::<
LoaderLoadObjectResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.rv),
<fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.object
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
LoaderLoadObjectResponse,
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::<LoaderLoadObjectResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for LoaderLoadObjectResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
rv: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
object: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
i32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.rv,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.object,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
}