blob: a6889d0127f6714b373bd6d9bbc68b1159a5431d [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
// fidl_experiment = no_optional_structs
// fidl_experiment = output_index_json
// fidl_experiment = simple_empty_response_syntax
// fidl_experiment = unknown_interactions
// fidl_experiment = unknown_interactions_mandate
#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct LocalStructPayload {
pub a: u32,
pub b: u32,
}
impl fidl::Persistable for LocalStructPayload {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MainProtocolOnAnonRequest {
pub a: u32,
pub b: u32,
}
impl fidl::Persistable for MainProtocolOnAnonRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MainProtocolOneWayAnonRequest {
pub a: u32,
pub b: u32,
}
impl fidl::Persistable for MainProtocolOneWayAnonRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MainProtocolTwoWayAnonRequest {
pub a: u32,
pub b: u32,
}
impl fidl::Persistable for MainProtocolTwoWayAnonRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MainProtocolTwoWayAnonResponse {
pub a: u32,
pub b: u32,
}
impl fidl::Persistable for MainProtocolTwoWayAnonResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MainProtocolTwoWayAnonWithErrorRequest {
pub a: u32,
pub b: u32,
}
impl fidl::Persistable for MainProtocolTwoWayAnonWithErrorRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MainProtocolOnAnonWithErrorResponse {
pub a: u32,
pub b: u32,
}
impl fidl::Persistable for MainProtocolOnAnonWithErrorResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct MainProtocolTwoWayAnonWithErrorResponse {
pub a: u32,
pub b: u32,
}
impl fidl::Persistable for MainProtocolTwoWayAnonWithErrorResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct MainProtocolMarker;
impl fidl::endpoints::ProtocolMarker for MainProtocolMarker {
type Proxy = MainProtocolProxy;
type RequestStream = MainProtocolRequestStream;
const DEBUG_NAME: &'static str = "(anonymous) MainProtocol";
}
pub type MainProtocolTwoWayLocalWithErrorResult = Result<(u32, u32), u32>;
pub type MainProtocolOnLocalWithErrorResult = Result<(u32, u32), u32>;
pub type MainProtocolTwoWayImportWithErrorResult = Result<i32, u32>;
pub type MainProtocolOnImportWithErrorResult = Result<i32, u32>;
pub type MainProtocolTwoWayAnonWithErrorResult = Result<(u32, u32), u32>;
pub type MainProtocolOnAnonWithErrorResult = 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 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::Time) -> 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::Time,
) -> 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::Time,
) -> 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::Time,
) -> 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::Time,
) -> 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::Time) -> 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::Time,
) -> 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::Time,
) -> 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::Time,
) -> 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)))
}
}
#[derive(Debug, Clone)]
pub struct MainProtocolProxy {
client: fidl::client::Client,
}
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 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 MainProtocol 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> {
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,
> {
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)> {
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> {
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> {
MainProtocolProxyInterface::r#two_way_import(self, a)
}
pub fn r#two_way_import_with_error(
&self,
mut a: i32,
) -> fidl::client::QueryResponseFut<MainProtocolTwoWayImportWithErrorResult> {
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)> {
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> {
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>;
fn r#two_way_composed(&self, mut a: i32) -> Self::TwoWayComposedResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
>(_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,
>;
fn r#two_way_composed_with_error(
&self,
mut a: i32,
) -> Self::TwoWayComposedWithErrorResponseFut {
fn _decode(
mut _buf: Result<fidl::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,
>,
>(_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)>;
fn r#two_way_local(&self, mut a: u32, mut b: u32) -> Self::TwoWayLocalResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<(u32, u32), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<LocalStructPayload>(_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>;
fn r#two_way_local_with_error(
&self,
mut a: u32,
mut b: u32,
) -> Self::TwoWayLocalWithErrorResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<MainProtocolTwoWayLocalWithErrorResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<LocalStructPayload, u32>,
>(_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>;
fn r#two_way_import(&self, mut a: i32) -> Self::TwoWayImportResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<i32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
>(_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>;
fn r#two_way_import_with_error(&self, mut a: i32) -> Self::TwoWayImportWithErrorResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<MainProtocolTwoWayImportWithErrorResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
u32,
>,
>(_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)>;
fn r#two_way_anon(&self, mut a: u32, mut b: u32) -> Self::TwoWayAnonResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<(u32, u32), fidl::Error> {
let _response =
fidl::client::decode_transaction_body::<MainProtocolTwoWayAnonResponse>(_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>;
fn r#two_way_anon_with_error(
&self,
mut a: u32,
mut b: u32,
) -> Self::TwoWayAnonWithErrorResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<MainProtocolTwoWayAnonWithErrorResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<MainProtocolTwoWayAnonWithErrorResponse, u32>,
>(_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,
}
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>> {
let buf = match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => buf,
None => return std::task::Poll::Ready(None),
};
std::task::Poll::Ready(Some(MainProtocolEvent::decode(buf)))
}
}
#[derive(Debug)]
pub enum MainProtocolEvent {
OnComposed {
a: i32,
},
OnComposedWithError {
result: fidl_test_protocolpayloads_imported::ComposedProtocolOnComposedWithErrorResult,
},
OnLocal {
a: u32,
b: u32,
},
OnLocalWithError {
result: MainProtocolOnLocalWithErrorResult,
},
OnImport {
a: i32,
},
OnImportWithError {
result: MainProtocolOnImportWithErrorResult,
},
OnAnon {
a: u32,
b: u32,
},
OnAnonWithError {
result: MainProtocolOnAnonWithErrorResult,
},
}
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_composed_with_error(
self,
) -> Option<fidl_test_protocolpayloads_imported::ComposedProtocolOnComposedWithErrorResult>
{
if let MainProtocolEvent::OnComposedWithError { result } = self {
Some((result))
} 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_local_with_error(self) -> Option<MainProtocolOnLocalWithErrorResult> {
if let MainProtocolEvent::OnLocalWithError { result } = self {
Some((result))
} 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_import_with_error(self) -> Option<MainProtocolOnImportWithErrorResult> {
if let MainProtocolEvent::OnImportWithError { result } = self {
Some((result))
} 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
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_anon_with_error(self) -> Option<MainProtocolOnAnonWithErrorResult> {
if let MainProtocolEvent::OnAnonWithError { result } = self {
Some((result))
} else {
None
}
}
/// Decodes a message buffer as a [`MainProtocolEvent`]. Transaction
/// ID in the message must be zero; this method does not check TXID.
fn decode(mut buf: fidl::MessageBufEtc) -> Result<MainProtocolEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
match tx_header.ordinal() {
0x19fbe2b2f6f9273a => {
let mut out =
fidl::new_empty!(fidl_test_protocolpayloads_imported::ImportStructPayload);
fidl::encoding::Decoder::decode_into::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((MainProtocolEvent::OnComposed { a: out.a }))
}
0x63774db677215e98 => {
let mut out = fidl::new_empty!(fidl::encoding::ResultType<fidl_test_protocolpayloads_imported::ImportStructPayload, u32>);
fidl::encoding::Decoder::decode_into::<
fidl::encoding::ResultType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
u32,
>,
>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((MainProtocolEvent::OnComposedWithError { result: out.map(|x| x.a) }))
}
0x4745f7438cd80819 => {
let mut out = fidl::new_empty!(LocalStructPayload);
fidl::encoding::Decoder::decode_into::<LocalStructPayload>(
&tx_header,
_body_bytes,
_handles,
&mut out,
)?;
Ok((MainProtocolEvent::OnLocal { a: out.a, b: out.b }))
}
0x4ecd4b3982e221af => {
let mut out = fidl::new_empty!(fidl::encoding::ResultType<LocalStructPayload, u32>);
fidl::encoding::Decoder::decode_into::<
fidl::encoding::ResultType<LocalStructPayload, u32>,
>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((MainProtocolEvent::OnLocalWithError { result: out.map(|x| (x.a, x.b)) }))
}
0x1bb4f4c30b6f8909 => {
let mut out =
fidl::new_empty!(fidl_test_protocolpayloads_imported::ImportStructPayload);
fidl::encoding::Decoder::decode_into::<
fidl_test_protocolpayloads_imported::ImportStructPayload,
>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((MainProtocolEvent::OnImport { a: out.a }))
}
0x6292b793d728f205 => {
let mut out = fidl::new_empty!(fidl::encoding::ResultType<fidl_test_protocolpayloads_imported::ImportStructPayload, u32>);
fidl::encoding::Decoder::decode_into::<
fidl::encoding::ResultType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
u32,
>,
>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((MainProtocolEvent::OnImportWithError { result: out.map(|x| x.a) }))
}
0x42d321dacc4df000 => {
let mut out = fidl::new_empty!(MainProtocolOnAnonRequest);
fidl::encoding::Decoder::decode_into::<MainProtocolOnAnonRequest>(
&tx_header,
_body_bytes,
_handles,
&mut out,
)?;
Ok((MainProtocolEvent::OnAnon { a: out.a, b: out.b }))
}
0x45bc24ef47b44a02 => {
let mut out = fidl::new_empty!(fidl::encoding::ResultType<MainProtocolOnAnonWithErrorResponse, u32>);
fidl::encoding::Decoder::decode_into::<
fidl::encoding::ResultType<MainProtocolOnAnonWithErrorResponse, u32>,
>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((MainProtocolEvent::OnAnonWithError { result: out.map(|x| (x.a, x.b)) }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal(),
protocol_name: <MainProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for MainProtocol
pub struct MainProtocolRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
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>, 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 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.poll_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(|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))))
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
if !header.is_compatible() {
return std::task::Poll::Ready(Some(Err(fidl::Error::IncompatibleMagicNumber(
header.magic_number(),
))));
}
std::task::Poll::Ready(Some(match header.ordinal() {
0x241e4384443ccb10 => {
let mut req =
fidl::new_empty!(fidl_test_protocolpayloads_imported::ImportStructPayload);
fidl::encoding::Decoder::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 => {
let mut req =
fidl::new_empty!(fidl_test_protocolpayloads_imported::ImportStructPayload);
fidl::encoding::Decoder::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(),
ordinal: header.ordinal(),
},
})
}
0x6a9be48b574d1557 => {
let mut req =
fidl::new_empty!(fidl_test_protocolpayloads_imported::ImportStructPayload);
fidl::encoding::Decoder::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(),
ordinal: header.ordinal(),
},
})
}
0x6b9feaf9305b0715 => {
let mut req = fidl::new_empty!(LocalStructPayload);
fidl::encoding::Decoder::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 => {
let mut req = fidl::new_empty!(LocalStructPayload);
fidl::encoding::Decoder::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(),
ordinal: header.ordinal(),
},
})
}
0x2839c029915cb8fc => {
let mut req = fidl::new_empty!(LocalStructPayload);
fidl::encoding::Decoder::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(),
ordinal: header.ordinal(),
},
})
}
0x2e6b091ae4cee40c => {
let mut req =
fidl::new_empty!(fidl_test_protocolpayloads_imported::ImportStructPayload);
fidl::encoding::Decoder::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 => {
let mut req =
fidl::new_empty!(fidl_test_protocolpayloads_imported::ImportStructPayload);
fidl::encoding::Decoder::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(),
ordinal: header.ordinal(),
},
})
}
0x3b7b706d42eb9bbd => {
let mut req =
fidl::new_empty!(fidl_test_protocolpayloads_imported::ImportStructPayload);
fidl::encoding::Decoder::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(),
ordinal: header.ordinal(),
},
})
}
0xb43565c01ab54ac => {
let mut req = fidl::new_empty!(MainProtocolOneWayAnonRequest);
fidl::encoding::Decoder::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 => {
let mut req = fidl::new_empty!(MainProtocolTwoWayAnonRequest);
fidl::encoding::Decoder::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(),
ordinal: header.ordinal(),
},
})
}
0x5862bf8170c87a36 => {
let mut req = fidl::new_empty!(MainProtocolTwoWayAnonWithErrorRequest);
fidl::encoding::Decoder::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(),
ordinal: header.ordinal(),
},
})
}
_ => 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>,
}
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<'a>(&'a self) -> fidl::OnSignals<'a> {
self.inner.channel().on_closed()
}
}
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_composed_with_error(
&self,
mut result: Result<i32, u32>,
) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::ResultType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
u32,
>>(
result.map(|a| (a,)),
0,
0x63774db677215e98,
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_local_with_error(
&self,
mut result: Result<(u32, u32), u32>,
) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::ResultType<LocalStructPayload, u32>>(
result,
0,
0x4ecd4b3982e221af,
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_import_with_error(
&self,
mut result: Result<i32, u32>,
) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::ResultType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
u32,
>>(
result.map(|a| (a,)),
0,
0x6292b793d728f205,
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(),
)
}
pub fn send_on_anon_with_error(
&self,
mut result: Result<(u32, u32), u32>,
) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::ResultType<MainProtocolOnAnonWithErrorResponse, u32>>(
result,
0,
0x45bc24ef47b44a02,
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,
ordinal: u64,
}
/// 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 r = self.send_raw(a);
if r.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
r
}
/// 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 r = self.send_raw(a);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut a: i32) -> Result<(), fidl::Error> {
let msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: (a,),
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::encoding::Encoder::encode::<
fidl::encoding::TransactionMessageType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
>,
>(bytes, handles, msg)?;
self.control_handle.inner.send_raw_msg(&*bytes, &mut *handles)
})
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayComposedWithErrorResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
ordinal: u64,
}
/// 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 r = self.send_raw(result);
if r.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
r
}
/// 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 r = self.send_raw(result);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut result: Result<i32, u32>) -> Result<(), fidl::Error> {
let msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: result.map(|a| (a,)),
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::encoding::Encoder::encode::<
fidl::encoding::TransactionMessageType<
fidl::encoding::ResultType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
u32,
>,
>,
>(bytes, handles, msg)?;
self.control_handle.inner.send_raw_msg(&*bytes, &mut *handles)
})
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayLocalResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
ordinal: u64,
}
/// 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 r = self.send_raw(a, b);
if r.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
r
}
/// 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 r = self.send_raw(a, b);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
let msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: (a, b),
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::encoding::Encoder::encode::<
fidl::encoding::TransactionMessageType<LocalStructPayload>,
>(bytes, handles, msg)?;
self.control_handle.inner.send_raw_msg(&*bytes, &mut *handles)
})
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayLocalWithErrorResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
ordinal: u64,
}
/// 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 r = self.send_raw(result);
if r.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
r
}
/// 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 r = self.send_raw(result);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut result: Result<(u32, u32), u32>) -> Result<(), fidl::Error> {
let msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: result,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::encoding::Encoder::encode::<
fidl::encoding::TransactionMessageType<
fidl::encoding::ResultType<LocalStructPayload, u32>,
>,
>(bytes, handles, msg)?;
self.control_handle.inner.send_raw_msg(&*bytes, &mut *handles)
})
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayImportResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
ordinal: u64,
}
/// 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 r = self.send_raw(a);
if r.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
r
}
/// 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 r = self.send_raw(a);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut a: i32) -> Result<(), fidl::Error> {
let msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: (a,),
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::encoding::Encoder::encode::<
fidl::encoding::TransactionMessageType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
>,
>(bytes, handles, msg)?;
self.control_handle.inner.send_raw_msg(&*bytes, &mut *handles)
})
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayImportWithErrorResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
ordinal: u64,
}
/// 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 r = self.send_raw(result);
if r.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
r
}
/// 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 r = self.send_raw(result);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut result: Result<i32, u32>) -> Result<(), fidl::Error> {
let msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: result.map(|a| (a,)),
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::encoding::Encoder::encode::<
fidl::encoding::TransactionMessageType<
fidl::encoding::ResultType<
fidl_test_protocolpayloads_imported::ImportStructPayload,
u32,
>,
>,
>(bytes, handles, msg)?;
self.control_handle.inner.send_raw_msg(&*bytes, &mut *handles)
})
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayAnonResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
ordinal: u64,
}
/// 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 r = self.send_raw(a, b);
if r.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
r
}
/// 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 r = self.send_raw(a, b);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut a: u32, mut b: u32) -> Result<(), fidl::Error> {
let msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: (a, b),
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::encoding::Encoder::encode::<
fidl::encoding::TransactionMessageType<MainProtocolTwoWayAnonResponse>,
>(bytes, handles, msg)?;
self.control_handle.inner.send_raw_msg(&*bytes, &mut *handles)
})
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayAnonWithErrorResponder {
control_handle: std::mem::ManuallyDrop<MainProtocolControlHandle>,
tx_id: u32,
ordinal: u64,
}
/// 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 r = self.send_raw(result);
if r.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
r
}
/// 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 r = self.send_raw(result);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut result: Result<(u32, u32), u32>) -> Result<(), fidl::Error> {
let msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: result,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::encoding::Encoder::encode::<
fidl::encoding::TransactionMessageType<
fidl::encoding::ResultType<MainProtocolTwoWayAnonWithErrorResponse, u32>,
>,
>(bytes, handles, msg)?;
self.control_handle.inner.send_raw_msg(&*bytes, &mut *handles)
})
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for LocalStructPayload {
type Owned = Self;
#[inline(always)]
fn inline_align(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
}
}
#[inline(always)]
fn inline_size(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 8,
fidl::encoding::WireFormatVersion::V2 => 8,
}
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for LocalStructPayload {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<LocalStructPayload> for &LocalStructPayload {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalStructPayload>(offset);
unsafe {
// Copy the object into the buffer.
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut LocalStructPayload)
.write_unaligned((self as *const LocalStructPayload).read());
// Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
// done second because the memcpy will write garbage to these bytes.
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>, T1: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<LocalStructPayload> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LocalStructPayload>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => {}
fidl::encoding::WireFormatVersion::V2 => {}
};
// Write the fields.
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 0,
fidl::encoding::WireFormatVersion::V2 => 0,
};
self.0.encode(encoder, offset + member_offset, depth)?;
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
};
self.1.encode(encoder, offset + member_offset, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for LocalStructPayload {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(u32), b: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
// Verify that padding bytes are zero.
// Copy from the buffer into the object.
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MainProtocolOnAnonRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
}
}
#[inline(always)]
fn inline_size(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 8,
fidl::encoding::WireFormatVersion::V2 => 8,
}
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for MainProtocolOnAnonRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MainProtocolOnAnonRequest> for &MainProtocolOnAnonRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolOnAnonRequest>(offset);
unsafe {
// Copy the object into the buffer.
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MainProtocolOnAnonRequest)
.write_unaligned((self as *const MainProtocolOnAnonRequest).read());
// Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
// done second because the memcpy will write garbage to these bytes.
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>, T1: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<MainProtocolOnAnonRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolOnAnonRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => {}
fidl::encoding::WireFormatVersion::V2 => {}
};
// Write the fields.
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 0,
fidl::encoding::WireFormatVersion::V2 => 0,
};
self.0.encode(encoder, offset + member_offset, depth)?;
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
};
self.1.encode(encoder, offset + member_offset, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MainProtocolOnAnonRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(u32), b: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
// Verify that padding bytes are zero.
// Copy from the buffer into the object.
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MainProtocolOneWayAnonRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
}
}
#[inline(always)]
fn inline_size(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 8,
fidl::encoding::WireFormatVersion::V2 => 8,
}
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for MainProtocolOneWayAnonRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MainProtocolOneWayAnonRequest>
for &MainProtocolOneWayAnonRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolOneWayAnonRequest>(offset);
unsafe {
// Copy the object into the buffer.
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MainProtocolOneWayAnonRequest)
.write_unaligned((self as *const MainProtocolOneWayAnonRequest).read());
// Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
// done second because the memcpy will write garbage to these bytes.
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>, T1: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<MainProtocolOneWayAnonRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolOneWayAnonRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => {}
fidl::encoding::WireFormatVersion::V2 => {}
};
// Write the fields.
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 0,
fidl::encoding::WireFormatVersion::V2 => 0,
};
self.0.encode(encoder, offset + member_offset, depth)?;
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
};
self.1.encode(encoder, offset + member_offset, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MainProtocolOneWayAnonRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(u32), b: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
// Verify that padding bytes are zero.
// Copy from the buffer into the object.
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MainProtocolTwoWayAnonRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
}
}
#[inline(always)]
fn inline_size(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 8,
fidl::encoding::WireFormatVersion::V2 => 8,
}
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for MainProtocolTwoWayAnonRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MainProtocolTwoWayAnonRequest>
for &MainProtocolTwoWayAnonRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolTwoWayAnonRequest>(offset);
unsafe {
// Copy the object into the buffer.
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MainProtocolTwoWayAnonRequest)
.write_unaligned((self as *const MainProtocolTwoWayAnonRequest).read());
// Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
// done second because the memcpy will write garbage to these bytes.
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>, T1: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<MainProtocolTwoWayAnonRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolTwoWayAnonRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => {}
fidl::encoding::WireFormatVersion::V2 => {}
};
// Write the fields.
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 0,
fidl::encoding::WireFormatVersion::V2 => 0,
};
self.0.encode(encoder, offset + member_offset, depth)?;
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
};
self.1.encode(encoder, offset + member_offset, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MainProtocolTwoWayAnonRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(u32), b: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
// Verify that padding bytes are zero.
// Copy from the buffer into the object.
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MainProtocolTwoWayAnonResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
}
}
#[inline(always)]
fn inline_size(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 8,
fidl::encoding::WireFormatVersion::V2 => 8,
}
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for MainProtocolTwoWayAnonResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MainProtocolTwoWayAnonResponse>
for &MainProtocolTwoWayAnonResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolTwoWayAnonResponse>(offset);
unsafe {
// Copy the object into the buffer.
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MainProtocolTwoWayAnonResponse)
.write_unaligned((self as *const MainProtocolTwoWayAnonResponse).read());
// Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
// done second because the memcpy will write garbage to these bytes.
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>, T1: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<MainProtocolTwoWayAnonResponse> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolTwoWayAnonResponse>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => {}
fidl::encoding::WireFormatVersion::V2 => {}
};
// Write the fields.
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 0,
fidl::encoding::WireFormatVersion::V2 => 0,
};
self.0.encode(encoder, offset + member_offset, depth)?;
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
};
self.1.encode(encoder, offset + member_offset, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MainProtocolTwoWayAnonResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(u32), b: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
// Verify that padding bytes are zero.
// Copy from the buffer into the object.
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MainProtocolTwoWayAnonWithErrorRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
}
}
#[inline(always)]
fn inline_size(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 8,
fidl::encoding::WireFormatVersion::V2 => 8,
}
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for MainProtocolTwoWayAnonWithErrorRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MainProtocolTwoWayAnonWithErrorRequest>
for &MainProtocolTwoWayAnonWithErrorRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolTwoWayAnonWithErrorRequest>(offset);
unsafe {
// Copy the object into the buffer.
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MainProtocolTwoWayAnonWithErrorRequest).write_unaligned(
(self as *const MainProtocolTwoWayAnonWithErrorRequest).read(),
);
// Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
// done second because the memcpy will write garbage to these bytes.
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>, T1: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<MainProtocolTwoWayAnonWithErrorRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolTwoWayAnonWithErrorRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => {}
fidl::encoding::WireFormatVersion::V2 => {}
};
// Write the fields.
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 0,
fidl::encoding::WireFormatVersion::V2 => 0,
};
self.0.encode(encoder, offset + member_offset, depth)?;
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
};
self.1.encode(encoder, offset + member_offset, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MainProtocolTwoWayAnonWithErrorRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(u32), b: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
// Verify that padding bytes are zero.
// Copy from the buffer into the object.
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MainProtocolOnAnonWithErrorResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
}
}
#[inline(always)]
fn inline_size(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 8,
fidl::encoding::WireFormatVersion::V2 => 8,
}
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for MainProtocolOnAnonWithErrorResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MainProtocolOnAnonWithErrorResponse>
for &MainProtocolOnAnonWithErrorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolOnAnonWithErrorResponse>(offset);
unsafe {
// Copy the object into the buffer.
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MainProtocolOnAnonWithErrorResponse)
.write_unaligned((self as *const MainProtocolOnAnonWithErrorResponse).read());
// Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
// done second because the memcpy will write garbage to these bytes.
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>, T1: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<MainProtocolOnAnonWithErrorResponse> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolOnAnonWithErrorResponse>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => {}
fidl::encoding::WireFormatVersion::V2 => {}
};
// Write the fields.
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 0,
fidl::encoding::WireFormatVersion::V2 => 0,
};
self.0.encode(encoder, offset + member_offset, depth)?;
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
};
self.1.encode(encoder, offset + member_offset, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MainProtocolOnAnonWithErrorResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(u32), b: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
// Verify that padding bytes are zero.
// Copy from the buffer into the object.
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for MainProtocolTwoWayAnonWithErrorResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
}
}
#[inline(always)]
fn inline_size(context: fidl::encoding::Context) -> usize {
match context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 8,
fidl::encoding::WireFormatVersion::V2 => 8,
}
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for MainProtocolTwoWayAnonWithErrorResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<MainProtocolTwoWayAnonWithErrorResponse>
for &MainProtocolTwoWayAnonWithErrorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolTwoWayAnonWithErrorResponse>(offset);
unsafe {
// Copy the object into the buffer.
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut MainProtocolTwoWayAnonWithErrorResponse).write_unaligned(
(self as *const MainProtocolTwoWayAnonWithErrorResponse).read(),
);
// Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
// done second because the memcpy will write garbage to these bytes.
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>, T1: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<MainProtocolTwoWayAnonWithErrorResponse> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<MainProtocolTwoWayAnonWithErrorResponse>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => {}
fidl::encoding::WireFormatVersion::V2 => {}
};
// Write the fields.
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 0,
fidl::encoding::WireFormatVersion::V2 => 0,
};
self.0.encode(encoder, offset + member_offset, depth)?;
let member_offset = match encoder.context.wire_format_version {
fidl::encoding::WireFormatVersion::V1 => 4,
fidl::encoding::WireFormatVersion::V2 => 4,
};
self.1.encode(encoder, offset + member_offset, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for MainProtocolTwoWayAnonWithErrorResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(u32), b: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
// Verify that padding bytes are zero.
// Copy from the buffer into the object.
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
}