#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub const MAX_PROTOCOL_LEN: u64 = fidl_fuchsia_io::MAX_NAME_LENGTH as u64;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum OperationError {
Invalid,
Failed,
Unsupported,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! OperationErrorUnknown {
() => {
_
};
}
impl OperationError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
0 => Some(Self::Invalid),
1 => Some(Self::Failed),
2 => Some(Self::Unsupported),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
0 => Self::Invalid,
1 => Self::Failed,
2 => Self::Unsupported,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Invalid => 0,
Self::Failed => 1,
Self::Unsupported => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RealmProxyConnectToNamedProtocolRequest {
pub protocol: String,
pub server_end: fidl::Channel,
}
impl fidl::Standalone for RealmProxyConnectToNamedProtocolRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RealmProxyConnectToServiceInstanceRequest {
pub service: String,
pub instance: String,
pub server_end: fidl::Channel,
}
impl fidl::Standalone for RealmProxyConnectToServiceInstanceRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RealmProxyOpenServiceRequest {
pub service: String,
pub server_end: fidl::Channel,
}
impl fidl::Standalone for RealmProxyOpenServiceRequest {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RealmProxy_Marker;
impl fidl::endpoints::ProtocolMarker for RealmProxy_Marker {
type Proxy = RealmProxy_Proxy;
type RequestStream = RealmProxy_RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RealmProxy_SynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.testing.harness.RealmProxy";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RealmProxy_Marker {}
pub type RealmProxyConnectToNamedProtocolResult = Result<(), OperationError>;
pub type RealmProxyOpenServiceResult = Result<(), OperationError>;
pub type RealmProxyConnectToServiceInstanceResult = Result<(), OperationError>;
pub trait RealmProxy_ProxyInterface: Send + Sync {
type ConnectToNamedProtocolResponseFut: std::future::Future<Output = Result<RealmProxyConnectToNamedProtocolResult, fidl::Error>>
+ Send;
fn r#connect_to_named_protocol(
&self,
protocol: &str,
server_end: fidl::Channel,
) -> Self::ConnectToNamedProtocolResponseFut;
type OpenServiceResponseFut: std::future::Future<Output = Result<RealmProxyOpenServiceResult, fidl::Error>>
+ Send;
fn r#open_service(
&self,
service: &str,
server_end: fidl::Channel,
) -> Self::OpenServiceResponseFut;
type ConnectToServiceInstanceResponseFut: std::future::Future<Output = Result<RealmProxyConnectToServiceInstanceResult, fidl::Error>>
+ Send;
fn r#connect_to_service_instance(
&self,
service: &str,
instance: &str,
server_end: fidl::Channel,
) -> Self::ConnectToServiceInstanceResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RealmProxy_SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RealmProxy_SynchronousProxy {
type Proxy = RealmProxy_Proxy;
type Protocol = RealmProxy_Marker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl RealmProxy_SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RealmProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<RealmProxy_Event, fidl::Error> {
RealmProxy_Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#connect_to_named_protocol(
&self,
mut protocol: &str,
mut server_end: fidl::Channel,
___deadline: zx::MonotonicInstant,
) -> Result<RealmProxyConnectToNamedProtocolResult, fidl::Error> {
let _response = self.client.send_query::<
RealmProxyConnectToNamedProtocolRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OperationError>,
>(
(protocol, server_end,),
0x159b4ba0b614ecc4,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#open_service(
&self,
mut service: &str,
mut server_end: fidl::Channel,
___deadline: zx::MonotonicInstant,
) -> Result<RealmProxyOpenServiceResult, fidl::Error> {
let _response = self.client.send_query::<
RealmProxyOpenServiceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OperationError>,
>(
(service, server_end,),
0x7e4f670a6ec5986a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#connect_to_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut server_end: fidl::Channel,
___deadline: zx::MonotonicInstant,
) -> Result<RealmProxyConnectToServiceInstanceResult, fidl::Error> {
let _response = self.client.send_query::<
RealmProxyConnectToServiceInstanceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OperationError>,
>(
(service, instance, server_end,),
0x39111e790d55bbf,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct RealmProxy_Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RealmProxy_Proxy {
type Protocol = RealmProxy_Marker;
fn from_channel(inner: fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl RealmProxy_Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RealmProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RealmProxy_EventStream {
RealmProxy_EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#connect_to_named_protocol(
&self,
mut protocol: &str,
mut server_end: fidl::Channel,
) -> fidl::client::QueryResponseFut<RealmProxyConnectToNamedProtocolResult> {
RealmProxy_ProxyInterface::r#connect_to_named_protocol(self, protocol, server_end)
}
pub fn r#open_service(
&self,
mut service: &str,
mut server_end: fidl::Channel,
) -> fidl::client::QueryResponseFut<RealmProxyOpenServiceResult> {
RealmProxy_ProxyInterface::r#open_service(self, service, server_end)
}
pub fn r#connect_to_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut server_end: fidl::Channel,
) -> fidl::client::QueryResponseFut<RealmProxyConnectToServiceInstanceResult> {
RealmProxy_ProxyInterface::r#connect_to_service_instance(
self, service, instance, server_end,
)
}
}
impl RealmProxy_ProxyInterface for RealmProxy_Proxy {
type ConnectToNamedProtocolResponseFut =
fidl::client::QueryResponseFut<RealmProxyConnectToNamedProtocolResult>;
fn r#connect_to_named_protocol(
&self,
mut protocol: &str,
mut server_end: fidl::Channel,
) -> Self::ConnectToNamedProtocolResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmProxyConnectToNamedProtocolResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OperationError>,
0x159b4ba0b614ecc4,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RealmProxyConnectToNamedProtocolRequest,
RealmProxyConnectToNamedProtocolResult,
>(
(protocol, server_end,),
0x159b4ba0b614ecc4,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type OpenServiceResponseFut = fidl::client::QueryResponseFut<RealmProxyOpenServiceResult>;
fn r#open_service(
&self,
mut service: &str,
mut server_end: fidl::Channel,
) -> Self::OpenServiceResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmProxyOpenServiceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OperationError>,
0x7e4f670a6ec5986a,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<RealmProxyOpenServiceRequest, RealmProxyOpenServiceResult>(
(service, server_end),
0x7e4f670a6ec5986a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ConnectToServiceInstanceResponseFut =
fidl::client::QueryResponseFut<RealmProxyConnectToServiceInstanceResult>;
fn r#connect_to_service_instance(
&self,
mut service: &str,
mut instance: &str,
mut server_end: fidl::Channel,
) -> Self::ConnectToServiceInstanceResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RealmProxyConnectToServiceInstanceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, OperationError>,
0x39111e790d55bbf,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RealmProxyConnectToServiceInstanceRequest,
RealmProxyConnectToServiceInstanceResult,
>(
(service, instance, server_end,),
0x39111e790d55bbf,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RealmProxy_EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RealmProxy_EventStream {}
impl futures::stream::FusedStream for RealmProxy_EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RealmProxy_EventStream {
type Item = Result<RealmProxy_Event, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(RealmProxy_Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RealmProxy_Event {}
impl RealmProxy_Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RealmProxy_Event, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <RealmProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RealmProxy_RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RealmProxy_RequestStream {}
impl futures::stream::FusedStream for RealmProxy_RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RealmProxy_RequestStream {
type Protocol = RealmProxy_Marker;
type ControlHandle = RealmProxy_ControlHandle;
fn from_channel(channel: fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
RealmProxy_ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RealmProxy_RequestStream {
type Item = Result<RealmProxy_Request, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled RealmProxy_RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x159b4ba0b614ecc4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RealmProxyConnectToNamedProtocolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmProxyConnectToNamedProtocolRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RealmProxy_ControlHandle { inner: this.inner.clone() };
Ok(RealmProxy_Request::ConnectToNamedProtocol {
protocol: req.protocol,
server_end: req.server_end,
responder: RealmProxy_ConnectToNamedProtocolResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7e4f670a6ec5986a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RealmProxyOpenServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmProxyOpenServiceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RealmProxy_ControlHandle { inner: this.inner.clone() };
Ok(RealmProxy_Request::OpenService {
service: req.service,
server_end: req.server_end,
responder: RealmProxy_OpenServiceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x39111e790d55bbf => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
RealmProxyConnectToServiceInstanceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmProxyConnectToServiceInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RealmProxy_ControlHandle { inner: this.inner.clone() };
Ok(RealmProxy_Request::ConnectToServiceInstance {
service: req.service,
instance: req.instance,
server_end: req.server_end,
responder: RealmProxy_ConnectToServiceInstanceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RealmProxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RealmProxy_Request {
ConnectToNamedProtocol {
protocol: String,
server_end: fidl::Channel,
responder: RealmProxy_ConnectToNamedProtocolResponder,
},
OpenService {
service: String,
server_end: fidl::Channel,
responder: RealmProxy_OpenServiceResponder,
},
ConnectToServiceInstance {
service: String,
instance: String,
server_end: fidl::Channel,
responder: RealmProxy_ConnectToServiceInstanceResponder,
},
}
impl RealmProxy_Request {
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_named_protocol(
self,
) -> Option<(String, fidl::Channel, RealmProxy_ConnectToNamedProtocolResponder)> {
if let RealmProxy_Request::ConnectToNamedProtocol { protocol, server_end, responder } = self
{
Some((protocol, server_end, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_service(
self,
) -> Option<(String, fidl::Channel, RealmProxy_OpenServiceResponder)> {
if let RealmProxy_Request::OpenService { service, server_end, responder } = self {
Some((service, server_end, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_service_instance(
self,
) -> Option<(String, String, fidl::Channel, RealmProxy_ConnectToServiceInstanceResponder)> {
if let RealmProxy_Request::ConnectToServiceInstance {
service,
instance,
server_end,
responder,
} = self
{
Some((service, instance, server_end, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RealmProxy_Request::ConnectToNamedProtocol { .. } => "connect_to_named_protocol",
RealmProxy_Request::OpenService { .. } => "open_service",
RealmProxy_Request::ConnectToServiceInstance { .. } => "connect_to_service_instance",
}
}
}
#[derive(Debug, Clone)]
pub struct RealmProxy_ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RealmProxy_ControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().as_ref().signal_peer(clear_mask, set_mask)
}
}
impl RealmProxy_ControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmProxy_ConnectToNamedProtocolResponder {
control_handle: std::mem::ManuallyDrop<RealmProxy_ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmProxy_ConnectToNamedProtocolResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmProxy_ConnectToNamedProtocolResponder {
type ControlHandle = RealmProxy_ControlHandle;
fn control_handle(&self) -> &RealmProxy_ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmProxy_ConnectToNamedProtocolResponder {
pub fn send(self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), OperationError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
OperationError,
>>(
result,
self.tx_id,
0x159b4ba0b614ecc4,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmProxy_OpenServiceResponder {
control_handle: std::mem::ManuallyDrop<RealmProxy_ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmProxy_OpenServiceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmProxy_OpenServiceResponder {
type ControlHandle = RealmProxy_ControlHandle;
fn control_handle(&self) -> &RealmProxy_ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmProxy_OpenServiceResponder {
pub fn send(self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), OperationError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
OperationError,
>>(
result,
self.tx_id,
0x7e4f670a6ec5986a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RealmProxy_ConnectToServiceInstanceResponder {
control_handle: std::mem::ManuallyDrop<RealmProxy_ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RealmProxy_ConnectToServiceInstanceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RealmProxy_ConnectToServiceInstanceResponder {
type ControlHandle = RealmProxy_ControlHandle;
fn control_handle(&self) -> &RealmProxy_ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RealmProxy_ConnectToServiceInstanceResponder {
pub fn send(self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), OperationError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
OperationError,
>>(
result,
self.tx_id,
0x39111e790d55bbf,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for OperationError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for OperationError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for OperationError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OperationError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for RealmProxyConnectToNamedProtocolRequest {
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 RealmProxyConnectToNamedProtocolRequest {
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<
RealmProxyConnectToNamedProtocolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut RealmProxyConnectToNamedProtocolRequest
{
#[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::<RealmProxyConnectToNamedProtocolRequest>(offset);
fidl::encoding::Encode::<
RealmProxyConnectToNamedProtocolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.protocol,
),
<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.server_end
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
RealmProxyConnectToNamedProtocolRequest,
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::<RealmProxyConnectToNamedProtocolRequest>(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 RealmProxyConnectToNamedProtocolRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
protocol: fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
server_end: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
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<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.protocol,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server_end, decoder, offset + 16, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for RealmProxyConnectToServiceInstanceRequest {
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 RealmProxyConnectToServiceInstanceRequest {
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<
RealmProxyConnectToServiceInstanceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut RealmProxyConnectToServiceInstanceRequest
{
#[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::<RealmProxyConnectToServiceInstanceRequest>(offset);
fidl::encoding::Encode::<
RealmProxyConnectToServiceInstanceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.service,
),
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.instance,
),
<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.server_end
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
RealmProxyConnectToServiceInstanceRequest,
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::<RealmProxyConnectToServiceInstanceRequest>(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 RealmProxyConnectToServiceInstanceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
service: fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
instance: fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
server_end: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
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::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.service,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.instance,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server_end, decoder, offset + 32, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for RealmProxyOpenServiceRequest {
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 RealmProxyOpenServiceRequest {
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<
RealmProxyOpenServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut RealmProxyOpenServiceRequest
{
#[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::<RealmProxyOpenServiceRequest>(offset);
fidl::encoding::Encode::<
RealmProxyOpenServiceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.service,
),
<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.server_end
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
RealmProxyOpenServiceRequest,
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::<RealmProxyOpenServiceRequest>(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 RealmProxyOpenServiceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
service: fidl::new_empty!(
fidl::encoding::BoundedString<255>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
server_end: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
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<255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.service,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server_end, decoder, offset + 16, _depth)?;
Ok(())
}
}
}