blob: bd75942ecb93291fb916ba0e856e3b100422f613 [file] [log] [blame] [edit]
// WARNING: This file is machine generated by fidlgen.
// fidl_experiment = output_index_json
#![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 _};
pub use fidl_test_protocolpayloads__common::*;
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct MainProtocolMarker;
impl fidl::endpoints::ProtocolMarker for MainProtocolMarker {
type Proxy = MainProtocolProxy;
type RequestStream = MainProtocolRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = MainProtocolSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) MainProtocol";
}
pub type MainProtocolTwoWayLocalWithErrorResult = Result<(u32, u32), u32>;
pub type MainProtocolTwoWayImportWithErrorResult = Result<i32, u32>;
pub type MainProtocolTwoWayAnonWithErrorResult = Result<(u32, u32), u32>;
pub trait MainProtocolProxyInterface: Send + Sync {
fn r#one_way_composed(&self, a: i32) -> Result<(), fidl::Error>;
type TwoWayComposedResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#two_way_composed(&self, a: i32) -> Self::TwoWayComposedResponseFut;
type TwoWayComposedWithErrorResponseFut: std::future::Future<
Output = Result<
fidl_test_protocolpayloads_imported::ComposedProtocolTwoWayComposedWithErrorResult,
fidl::Error,
>,
> + Send;
fn r#two_way_composed_with_error(&self, a: i32) -> Self::TwoWayComposedWithErrorResponseFut;
fn r#one_way_local(&self, a: u32, b: u32) -> Result<(), fidl::Error>;
type TwoWayLocalResponseFut: std::future::Future<Output = Result<(u32, u32), fidl::Error>>
+ Send;
fn r#two_way_local(&self, a: u32, b: u32) -> Self::TwoWayLocalResponseFut;
type TwoWayLocalWithErrorResponseFut: std::future::Future<Output = Result<MainProtocolTwoWayLocalWithErrorResult, fidl::Error>>
+ Send;
fn r#two_way_local_with_error(&self, a: u32, b: u32) -> Self::TwoWayLocalWithErrorResponseFut;
fn r#one_way_import(&self, a: i32) -> Result<(), fidl::Error>;
type TwoWayImportResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
fn r#two_way_import(&self, a: i32) -> Self::TwoWayImportResponseFut;
type TwoWayImportWithErrorResponseFut: std::future::Future<Output = Result<MainProtocolTwoWayImportWithErrorResult, fidl::Error>>
+ Send;
fn r#two_way_import_with_error(&self, a: i32) -> Self::TwoWayImportWithErrorResponseFut;
fn r#one_way_anon(&self, a: u32, b: u32) -> Result<(), fidl::Error>;
type TwoWayAnonResponseFut: std::future::Future<Output = Result<(u32, u32), fidl::Error>> + Send;
fn r#two_way_anon(&self, a: u32, b: u32) -> Self::TwoWayAnonResponseFut;
type TwoWayAnonWithErrorResponseFut: std::future::Future<Output = Result<MainProtocolTwoWayAnonWithErrorResult, fidl::Error>>
+ Send;
fn r#two_way_anon_with_error(&self, a: u32, b: u32) -> Self::TwoWayAnonWithErrorResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct MainProtocolSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for MainProtocolSynchronousProxy {
type Proxy = MainProtocolProxy;
type Protocol = MainProtocolMarker;
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 MainProtocolSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <MainProtocolMarker 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()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<MainProtocolEvent, fidl::Error> {
MainProtocolEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#one_way_composed(&self, mut a: i32) -> Result<(), fidl::Error> {
self.client.send::<fidl_test_protocolpayloads_imported::ImportStructPayload>(
(a,),
0x241e4384443ccb10,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#two_way_composed(
&self,
mut a: i32,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response = self.client.send_query::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl_test_protocolpayloads_imported::ImportStructPayload,
>(
(a,),
0x2348a1331ca4cfb0,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.a)
}
pub fn r#two_way_composed_with_error(
&self,
mut a: i32,
___deadline: zx::MonotonicInstant,
) -> Result<
fidl_test_protocolpayloads_imported::ComposedProtocolTwoWayComposedWithErrorResult,
fidl::Error,
> {
let _response = self.client.send_query::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::ResultType<fidl_test_protocolpayloads_imported::ImportStructPayload, u32>,
>(
(a,),
0x6a9be48b574d1557,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.a))
}
pub fn r#one_way_local(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
self.client.send::<LocalStructPayload>(
(a, b),
0x6b9feaf9305b0715,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#two_way_local(
&self,
mut a: u32,
mut b: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(u32, u32), fidl::Error> {
let _response = self.client.send_query::<LocalStructPayload, LocalStructPayload>(
(a, b),
0x743776548de3af0f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.a, _response.b))
}
pub fn r#two_way_local_with_error(
&self,
mut a: u32,
mut b: u32,
___deadline: zx::MonotonicInstant,
) -> Result<MainProtocolTwoWayLocalWithErrorResult, fidl::Error> {
let _response = self
.client
.send_query::<LocalStructPayload, fidl::encoding::ResultType<LocalStructPayload, u32>>(
(a, b),
0x2839c029915cb8fc,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| (x.a, x.b)))
}
pub fn r#one_way_import(&self, mut a: i32) -> Result<(), fidl::Error> {
self.client.send::<fidl_test_protocolpayloads_imported::ImportStructPayload>(
(a,),
0x2e6b091ae4cee40c,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#two_way_import(
&self,
mut a: i32,
___deadline: zx::MonotonicInstant,
) -> Result<i32, fidl::Error> {
let _response = self.client.send_query::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl_test_protocolpayloads_imported::ImportStructPayload,
>(
(a,),
0x20f4a8f65ff69473,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.a)
}
pub fn r#two_way_import_with_error(
&self,
mut a: i32,
___deadline: zx::MonotonicInstant,
) -> Result<MainProtocolTwoWayImportWithErrorResult, fidl::Error> {
let _response = self.client.send_query::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::ResultType<fidl_test_protocolpayloads_imported::ImportStructPayload, u32>,
>(
(a,),
0x3b7b706d42eb9bbd,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.a))
}
pub fn r#one_way_anon(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
self.client.send::<MainProtocolOneWayAnonRequest>(
(a, b),
0xb43565c01ab54ac,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#two_way_anon(
&self,
mut a: u32,
mut b: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(u32, u32), fidl::Error> {
let _response = self
.client
.send_query::<MainProtocolTwoWayAnonRequest, MainProtocolTwoWayAnonResponse>(
(a, b),
0x8bdc969ff7dd759,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.a, _response.b))
}
pub fn r#two_way_anon_with_error(
&self,
mut a: u32,
mut b: u32,
___deadline: zx::MonotonicInstant,
) -> Result<MainProtocolTwoWayAnonWithErrorResult, fidl::Error> {
let _response = self.client.send_query::<
MainProtocolTwoWayAnonWithErrorRequest,
fidl::encoding::ResultType<MainProtocolTwoWayAnonWithErrorResponse, u32>,
>(
(a, b,),
0x5862bf8170c87a36,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| (x.a, x.b)))
}
}
#[cfg(target_os = "fuchsia")]
impl From<MainProtocolSynchronousProxy> for zx::Handle {
fn from(value: MainProtocolSynchronousProxy) -> Self {
value.into_channel().into()
}
}
#[cfg(target_os = "fuchsia")]
impl From<fidl::Channel> for MainProtocolSynchronousProxy {
fn from(value: fidl::Channel) -> Self {
Self::new(value)
}
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::FromClient for MainProtocolSynchronousProxy {
type Protocol = MainProtocolMarker;
fn from_client(value: fidl::endpoints::ClientEnd<MainProtocolMarker>) -> Self {
Self::new(value.into_channel())
}
}
#[derive(Debug, Clone)]
pub struct MainProtocolProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for MainProtocolProxy {
type Protocol = MainProtocolMarker;
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 MainProtocolProxy {
/// Create a new Proxy for test.protocolpayloads/MainProtocol.
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <MainProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the protocol.
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> MainProtocolEventStream {
MainProtocolEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#one_way_composed(&self, mut a: i32) -> Result<(), fidl::Error> {
MainProtocolProxyInterface::r#one_way_composed(self, a)
}
pub fn r#two_way_composed(
&self,
mut a: i32,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
MainProtocolProxyInterface::r#two_way_composed(self, a)
}
pub fn r#two_way_composed_with_error(
&self,
mut a: i32,
) -> fidl::client::QueryResponseFut<
fidl_test_protocolpayloads_imported::ComposedProtocolTwoWayComposedWithErrorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MainProtocolProxyInterface::r#two_way_composed_with_error(self, a)
}
pub fn r#one_way_local(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
MainProtocolProxyInterface::r#one_way_local(self, a, b)
}
pub fn r#two_way_local(
&self,
mut a: u32,
mut b: u32,
) -> fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
{
MainProtocolProxyInterface::r#two_way_local(self, a, b)
}
pub fn r#two_way_local_with_error(
&self,
mut a: u32,
mut b: u32,
) -> fidl::client::QueryResponseFut<
MainProtocolTwoWayLocalWithErrorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MainProtocolProxyInterface::r#two_way_local_with_error(self, a, b)
}
pub fn r#one_way_import(&self, mut a: i32) -> Result<(), fidl::Error> {
MainProtocolProxyInterface::r#one_way_import(self, a)
}
pub fn r#two_way_import(
&self,
mut a: i32,
) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
MainProtocolProxyInterface::r#two_way_import(self, a)
}
pub fn r#two_way_import_with_error(
&self,
mut a: i32,
) -> fidl::client::QueryResponseFut<
MainProtocolTwoWayImportWithErrorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MainProtocolProxyInterface::r#two_way_import_with_error(self, a)
}
pub fn r#one_way_anon(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
MainProtocolProxyInterface::r#one_way_anon(self, a, b)
}
pub fn r#two_way_anon(
&self,
mut a: u32,
mut b: u32,
) -> fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>
{
MainProtocolProxyInterface::r#two_way_anon(self, a, b)
}
pub fn r#two_way_anon_with_error(
&self,
mut a: u32,
mut b: u32,
) -> fidl::client::QueryResponseFut<
MainProtocolTwoWayAnonWithErrorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MainProtocolProxyInterface::r#two_way_anon_with_error(self, a, b)
}
}
impl MainProtocolProxyInterface for MainProtocolProxy {
fn r#one_way_composed(&self, mut a: i32) -> Result<(), fidl::Error> {
self.client.send::<fidl_test_protocolpayloads_imported::ImportStructPayload>(
(a,),
0x241e4384443ccb10,
fidl::encoding::DynamicFlags::empty(),
)
}
type TwoWayComposedResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#two_way_composed(&self, mut a: i32) -> Self::TwoWayComposedResponseFut {
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::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2348a1331ca4cfb0,
>(_buf?)?;
Ok(_response.a)
}
self.client
.send_query_and_decode::<fidl_test_protocolpayloads_imported::ImportStructPayload, i32>(
(a,),
0x2348a1331ca4cfb0,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type TwoWayComposedWithErrorResponseFut = fidl::client::QueryResponseFut<
fidl_test_protocolpayloads_imported::ComposedProtocolTwoWayComposedWithErrorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#two_way_composed_with_error(
&self,
mut a: i32,
) -> Self::TwoWayComposedWithErrorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<
fidl_test_protocolpayloads_imported::ComposedProtocolTwoWayComposedWithErrorResult,
fidl::Error,
> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
u32,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6a9be48b574d1557,
>(_buf?)?;
Ok(_response.map(|x| x.a))
}
self.client.send_query_and_decode::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl_test_protocolpayloads_imported::ComposedProtocolTwoWayComposedWithErrorResult,
>(
(a,),
0x6a9be48b574d1557,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#one_way_local(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
self.client.send::<LocalStructPayload>(
(a, b),
0x6b9feaf9305b0715,
fidl::encoding::DynamicFlags::empty(),
)
}
type TwoWayLocalResponseFut =
fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#two_way_local(&self, mut a: u32, mut b: u32) -> Self::TwoWayLocalResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(u32, u32), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
LocalStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x743776548de3af0f,
>(_buf?)?;
Ok((_response.a, _response.b))
}
self.client.send_query_and_decode::<LocalStructPayload, (u32, u32)>(
(a, b),
0x743776548de3af0f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type TwoWayLocalWithErrorResponseFut = fidl::client::QueryResponseFut<
MainProtocolTwoWayLocalWithErrorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#two_way_local_with_error(
&self,
mut a: u32,
mut b: u32,
) -> Self::TwoWayLocalWithErrorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<MainProtocolTwoWayLocalWithErrorResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<LocalStructPayload, u32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2839c029915cb8fc,
>(_buf?)?;
Ok(_response.map(|x| (x.a, x.b)))
}
self.client
.send_query_and_decode::<LocalStructPayload, MainProtocolTwoWayLocalWithErrorResult>(
(a, b),
0x2839c029915cb8fc,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#one_way_import(&self, mut a: i32) -> Result<(), fidl::Error> {
self.client.send::<fidl_test_protocolpayloads_imported::ImportStructPayload>(
(a,),
0x2e6b091ae4cee40c,
fidl::encoding::DynamicFlags::empty(),
)
}
type TwoWayImportResponseFut =
fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#two_way_import(&self, mut a: i32) -> Self::TwoWayImportResponseFut {
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::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x20f4a8f65ff69473,
>(_buf?)?;
Ok(_response.a)
}
self.client
.send_query_and_decode::<fidl_test_protocolpayloads_imported::ImportStructPayload, i32>(
(a,),
0x20f4a8f65ff69473,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type TwoWayImportWithErrorResponseFut = fidl::client::QueryResponseFut<
MainProtocolTwoWayImportWithErrorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#two_way_import_with_error(&self, mut a: i32) -> Self::TwoWayImportWithErrorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<MainProtocolTwoWayImportWithErrorResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
u32,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3b7b706d42eb9bbd,
>(_buf?)?;
Ok(_response.map(|x| x.a))
}
self.client.send_query_and_decode::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
MainProtocolTwoWayImportWithErrorResult,
>(
(a,),
0x3b7b706d42eb9bbd,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#one_way_anon(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
self.client.send::<MainProtocolOneWayAnonRequest>(
(a, b),
0xb43565c01ab54ac,
fidl::encoding::DynamicFlags::empty(),
)
}
type TwoWayAnonResponseFut =
fidl::client::QueryResponseFut<(u32, u32), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#two_way_anon(&self, mut a: u32, mut b: u32) -> Self::TwoWayAnonResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(u32, u32), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
MainProtocolTwoWayAnonResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x8bdc969ff7dd759,
>(_buf?)?;
Ok((_response.a, _response.b))
}
self.client.send_query_and_decode::<MainProtocolTwoWayAnonRequest, (u32, u32)>(
(a, b),
0x8bdc969ff7dd759,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type TwoWayAnonWithErrorResponseFut = fidl::client::QueryResponseFut<
MainProtocolTwoWayAnonWithErrorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#two_way_anon_with_error(
&self,
mut a: u32,
mut b: u32,
) -> Self::TwoWayAnonWithErrorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<MainProtocolTwoWayAnonWithErrorResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<MainProtocolTwoWayAnonWithErrorResponse, u32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5862bf8170c87a36,
>(_buf?)?;
Ok(_response.map(|x| (x.a, x.b)))
}
self.client.send_query_and_decode::<
MainProtocolTwoWayAnonWithErrorRequest,
MainProtocolTwoWayAnonWithErrorResult,
>(
(a, b,),
0x5862bf8170c87a36,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct MainProtocolEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for MainProtocolEventStream {}
impl futures::stream::FusedStream for MainProtocolEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for MainProtocolEventStream {
type Item = Result<MainProtocolEvent, 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(MainProtocolEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum MainProtocolEvent {
OnComposed { a: i32 },
OnLocal { a: u32, b: u32 },
OnImport { a: i32 },
OnAnon { a: u32, b: u32 },
}
impl MainProtocolEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_composed(self) -> Option<i32> {
if let MainProtocolEvent::OnComposed { a } = self { Some((a)) } else { None }
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_local(self) -> Option<(u32, u32)> {
if let MainProtocolEvent::OnLocal { a, b } = self { Some((a, b)) } else { None }
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_import(self) -> Option<i32> {
if let MainProtocolEvent::OnImport { a } = self { Some((a)) } else { None }
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_anon(self) -> Option<(u32, u32)> {
if let MainProtocolEvent::OnAnon { a, b } = self { Some((a, b)) } else { None }
}
/// Decodes a message buffer as a [`MainProtocolEvent`].
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<MainProtocolEvent, 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 {
0x19fbe2b2f6f9273a => {
let mut out = fidl::new_empty!(
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_test_protocolpayloads_imported::ImportStructPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((MainProtocolEvent::OnComposed { a: out.a }))
}
0x4745f7438cd80819 => {
let mut out = fidl::new_empty!(
LocalStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalStructPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((MainProtocolEvent::OnLocal { a: out.a, b: out.b }))
}
0x1bb4f4c30b6f8909 => {
let mut out = fidl::new_empty!(
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_test_protocolpayloads_imported::ImportStructPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((MainProtocolEvent::OnImport { a: out.a }))
}
0x42d321dacc4df000 => {
let mut out = fidl::new_empty!(
MainProtocolOnAnonRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MainProtocolOnAnonRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((MainProtocolEvent::OnAnon { a: out.a, b: out.b }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <MainProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for test.protocolpayloads/MainProtocol.
pub struct MainProtocolRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for MainProtocolRequestStream {}
impl futures::stream::FusedStream for MainProtocolRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for MainProtocolRequestStream {
type Protocol = MainProtocolMarker;
type ControlHandle = MainProtocolControlHandle;
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 {
MainProtocolControlHandle { 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 MainProtocolRequestStream {
type Item = Result<MainProtocolRequest, 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 MainProtocolRequestStream 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(),
))));
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x241e4384443ccb10 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_test_protocolpayloads_imported::ImportStructPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::OneWayComposed { a: req.a, control_handle })
}
0x2348a1331ca4cfb0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_test_protocolpayloads_imported::ImportStructPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayComposed {
a: req.a,
responder: MainProtocolTwoWayComposedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6a9be48b574d1557 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_test_protocolpayloads_imported::ImportStructPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayComposedWithError {
a: req.a,
responder: MainProtocolTwoWayComposedWithErrorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6b9feaf9305b0715 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
LocalStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalStructPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::OneWayLocal { a: req.a, b: req.b, control_handle })
}
0x743776548de3af0f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LocalStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalStructPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayLocal {
a: req.a,
b: req.b,
responder: MainProtocolTwoWayLocalResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2839c029915cb8fc => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LocalStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalStructPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayLocalWithError {
a: req.a,
b: req.b,
responder: MainProtocolTwoWayLocalWithErrorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2e6b091ae4cee40c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_test_protocolpayloads_imported::ImportStructPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::OneWayImport { a: req.a, control_handle })
}
0x20f4a8f65ff69473 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_test_protocolpayloads_imported::ImportStructPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayImport {
a: req.a,
responder: MainProtocolTwoWayImportResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3b7b706d42eb9bbd => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl_test_protocolpayloads_imported::ImportStructPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_test_protocolpayloads_imported::ImportStructPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayImportWithError {
a: req.a,
responder: MainProtocolTwoWayImportWithErrorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xb43565c01ab54ac => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
MainProtocolOneWayAnonRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MainProtocolOneWayAnonRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::OneWayAnon { a: req.a, b: req.b, control_handle })
}
0x8bdc969ff7dd759 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
MainProtocolTwoWayAnonRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MainProtocolTwoWayAnonRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayAnon {
a: req.a,
b: req.b,
responder: MainProtocolTwoWayAnonResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5862bf8170c87a36 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
MainProtocolTwoWayAnonWithErrorRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MainProtocolTwoWayAnonWithErrorRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayAnonWithError {
a: req.a,
b: req.b,
responder: MainProtocolTwoWayAnonWithErrorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<MainProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum MainProtocolRequest {
OneWayComposed { a: i32, control_handle: MainProtocolControlHandle },
TwoWayComposed { a: i32, responder: MainProtocolTwoWayComposedResponder },
TwoWayComposedWithError { a: i32, responder: MainProtocolTwoWayComposedWithErrorResponder },
OneWayLocal { a: u32, b: u32, control_handle: MainProtocolControlHandle },
TwoWayLocal { a: u32, b: u32, responder: MainProtocolTwoWayLocalResponder },
TwoWayLocalWithError { a: u32, b: u32, responder: MainProtocolTwoWayLocalWithErrorResponder },
OneWayImport { a: i32, control_handle: MainProtocolControlHandle },
TwoWayImport { a: i32, responder: MainProtocolTwoWayImportResponder },
TwoWayImportWithError { a: i32, responder: MainProtocolTwoWayImportWithErrorResponder },
OneWayAnon { a: u32, b: u32, control_handle: MainProtocolControlHandle },
TwoWayAnon { a: u32, b: u32, responder: MainProtocolTwoWayAnonResponder },
TwoWayAnonWithError { a: u32, b: u32, responder: MainProtocolTwoWayAnonWithErrorResponder },
}
impl MainProtocolRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_one_way_composed(self) -> Option<(i32, MainProtocolControlHandle)> {
if let MainProtocolRequest::OneWayComposed { a, control_handle } = self {
Some((a, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_composed(self) -> Option<(i32, MainProtocolTwoWayComposedResponder)> {
if let MainProtocolRequest::TwoWayComposed { a, responder } = self {
Some((a, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_composed_with_error(
self,
) -> Option<(i32, MainProtocolTwoWayComposedWithErrorResponder)> {
if let MainProtocolRequest::TwoWayComposedWithError { a, responder } = self {
Some((a, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_one_way_local(self) -> Option<(u32, u32, MainProtocolControlHandle)> {
if let MainProtocolRequest::OneWayLocal { a, b, control_handle } = self {
Some((a, b, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_local(self) -> Option<(u32, u32, MainProtocolTwoWayLocalResponder)> {
if let MainProtocolRequest::TwoWayLocal { a, b, responder } = self {
Some((a, b, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_local_with_error(
self,
) -> Option<(u32, u32, MainProtocolTwoWayLocalWithErrorResponder)> {
if let MainProtocolRequest::TwoWayLocalWithError { a, b, responder } = self {
Some((a, b, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_one_way_import(self) -> Option<(i32, MainProtocolControlHandle)> {
if let MainProtocolRequest::OneWayImport { a, control_handle } = self {
Some((a, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_import(self) -> Option<(i32, MainProtocolTwoWayImportResponder)> {
if let MainProtocolRequest::TwoWayImport { a, responder } = self {
Some((a, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_import_with_error(
self,
) -> Option<(i32, MainProtocolTwoWayImportWithErrorResponder)> {
if let MainProtocolRequest::TwoWayImportWithError { a, responder } = self {
Some((a, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_one_way_anon(self) -> Option<(u32, u32, MainProtocolControlHandle)> {
if let MainProtocolRequest::OneWayAnon { a, b, control_handle } = self {
Some((a, b, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_anon(self) -> Option<(u32, u32, MainProtocolTwoWayAnonResponder)> {
if let MainProtocolRequest::TwoWayAnon { a, b, responder } = self {
Some((a, b, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_anon_with_error(
self,
) -> Option<(u32, u32, MainProtocolTwoWayAnonWithErrorResponder)> {
if let MainProtocolRequest::TwoWayAnonWithError { a, b, responder } = self {
Some((a, b, responder))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
MainProtocolRequest::OneWayComposed { .. } => "one_way_composed",
MainProtocolRequest::TwoWayComposed { .. } => "two_way_composed",
MainProtocolRequest::TwoWayComposedWithError { .. } => "two_way_composed_with_error",
MainProtocolRequest::OneWayLocal { .. } => "one_way_local",
MainProtocolRequest::TwoWayLocal { .. } => "two_way_local",
MainProtocolRequest::TwoWayLocalWithError { .. } => "two_way_local_with_error",
MainProtocolRequest::OneWayImport { .. } => "one_way_import",
MainProtocolRequest::TwoWayImport { .. } => "two_way_import",
MainProtocolRequest::TwoWayImportWithError { .. } => "two_way_import_with_error",
MainProtocolRequest::OneWayAnon { .. } => "one_way_anon",
MainProtocolRequest::TwoWayAnon { .. } => "two_way_anon",
MainProtocolRequest::TwoWayAnonWithError { .. } => "two_way_anon_with_error",
}
}
}
#[derive(Debug, Clone)]
pub struct MainProtocolControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for MainProtocolControlHandle {
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 MainProtocolControlHandle {
pub fn send_on_composed(&self, mut a: i32) -> Result<(), fidl::Error> {
self.inner.send::<fidl_test_protocolpayloads_imported::ImportStructPayload>(
(a,),
0,
0x19fbe2b2f6f9273a,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_local(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
self.inner.send::<LocalStructPayload>(
(a, b),
0,
0x4745f7438cd80819,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_import(&self, mut a: i32) -> Result<(), fidl::Error> {
self.inner.send::<fidl_test_protocolpayloads_imported::ImportStructPayload>(
(a,),
0,
0x1bb4f4c30b6f8909,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_anon(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
self.inner.send::<MainProtocolOnAnonRequest>(
(a, b),
0,
0x42d321dacc4df000,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayComposedResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for MainProtocolTwoWayComposedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MainProtocolTwoWayComposedResponder {
type ControlHandle = MainProtocolControlHandle;
fn control_handle(&self) -> &MainProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl MainProtocolTwoWayComposedResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut a: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(a);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut a: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(a);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut a: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl_test_protocolpayloads_imported::ImportStructPayload>(
(a,),
self.tx_id,
0x2348a1331ca4cfb0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayComposedWithErrorResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for MainProtocolTwoWayComposedWithErrorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MainProtocolTwoWayComposedWithErrorResponder {
type ControlHandle = MainProtocolControlHandle;
fn control_handle(&self) -> &MainProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl MainProtocolTwoWayComposedWithErrorResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut result: Result<i32, u32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut result: Result<i32, u32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<i32, u32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
u32,
>>(
result.map(|a| (a,)),
self.tx_id,
0x6a9be48b574d1557,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayLocalResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for MainProtocolTwoWayLocalResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MainProtocolTwoWayLocalResponder {
type ControlHandle = MainProtocolControlHandle;
fn control_handle(&self) -> &MainProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl MainProtocolTwoWayLocalResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(a, b);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(a, b);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<LocalStructPayload>(
(a, b),
self.tx_id,
0x743776548de3af0f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayLocalWithErrorResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for MainProtocolTwoWayLocalWithErrorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MainProtocolTwoWayLocalWithErrorResponder {
type ControlHandle = MainProtocolControlHandle;
fn control_handle(&self) -> &MainProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl MainProtocolTwoWayLocalWithErrorResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut result: Result<(u32, u32), u32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(u32, u32), u32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(u32, u32), u32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<LocalStructPayload, u32>>(
result,
self.tx_id,
0x2839c029915cb8fc,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayImportResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for MainProtocolTwoWayImportResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MainProtocolTwoWayImportResponder {
type ControlHandle = MainProtocolControlHandle;
fn control_handle(&self) -> &MainProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl MainProtocolTwoWayImportResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut a: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(a);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut a: i32) -> Result<(), fidl::Error> {
let _result = self.send_raw(a);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut a: i32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl_test_protocolpayloads_imported::ImportStructPayload>(
(a,),
self.tx_id,
0x20f4a8f65ff69473,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayImportWithErrorResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for MainProtocolTwoWayImportWithErrorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MainProtocolTwoWayImportWithErrorResponder {
type ControlHandle = MainProtocolControlHandle;
fn control_handle(&self) -> &MainProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl MainProtocolTwoWayImportWithErrorResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut result: Result<i32, u32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut result: Result<i32, u32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<i32, u32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
u32,
>>(
result.map(|a| (a,)),
self.tx_id,
0x3b7b706d42eb9bbd,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayAnonResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for MainProtocolTwoWayAnonResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MainProtocolTwoWayAnonResponder {
type ControlHandle = MainProtocolControlHandle;
fn control_handle(&self) -> &MainProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl MainProtocolTwoWayAnonResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(a, b);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(a, b);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<MainProtocolTwoWayAnonResponse>(
(a, b),
self.tx_id,
0x8bdc969ff7dd759,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayAnonWithErrorResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`MainProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for MainProtocolTwoWayAnonWithErrorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MainProtocolTwoWayAnonWithErrorResponder {
type ControlHandle = MainProtocolControlHandle;
fn control_handle(&self) -> &MainProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl MainProtocolTwoWayAnonWithErrorResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut result: Result<(u32, u32), u32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(u32, u32), u32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(u32, u32), u32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
MainProtocolTwoWayAnonWithErrorResponse,
u32,
>>(
result,
self.tx_id,
0x5862bf8170c87a36,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
}