blob: aa6a108e770542bf6d06d348527105272ae227d2 [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
#![allow(
unused_parens, // one-element-tuple-case is not a tuple
unused_mut, // not all args require mutation, but many do
nonstandard_style, // auto-caps does its best, but is not always successful
)]
#![recursion_limit = "512"]
#[cfg(target_os = "fuchsia")]
#[allow(unused_imports)]
use fuchsia_zircon as zx;
#[allow(unused_imports)]
use {
bitflags::bitflags,
fidl::{
client::{decode_transaction_body_fut, QueryResponseFut},
encoding::{Decodable as _, Encodable as _},
endpoints::{ControlHandle as _, Responder as _},
fidl_bits, fidl_empty_struct, fidl_enum, fidl_struct, fidl_struct_copy, fidl_table,
fidl_union, wrap_handle_metadata,
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
const _FIDL_TRACE_BINDINGS_RUST: u32 = 6;
pub type MainProtocolTwoWayImportWithErrorResult =
Result<(fidl_test_protocollayouts_imported::ImportUnionPayload), u32>;
/// Handle-type validating wrapper for MainProtocolTwoWayImportWithErrorResult responses, used internally by
/// FIDL bindings to decode method results. This should only be used by
/// generated APIs, API users should never need to use this type. It is public
/// because it is shared with composed protocols.
#[doc(hidden)]
pub type MainProtocolTwoWayImportWithErrorResultHandleWrapper =
Result<(fidl_test_protocollayouts_imported::ImportUnionPayload,), u32>;
pub type MainProtocolOnImportWithErrorResult =
Result<(fidl_test_protocollayouts_imported::ImportTablePayload), u32>;
/// Handle-type validating wrapper for MainProtocolOnImportWithErrorResult responses, used internally by
/// FIDL bindings to decode method results. This should only be used by
/// generated APIs, API users should never need to use this type. It is public
/// because it is shared with composed protocols.
#[doc(hidden)]
pub type MainProtocolOnImportWithErrorResultHandleWrapper =
Result<(fidl_test_protocollayouts_imported::ImportTablePayload,), u32>;
pub type MainProtocolTwoWayLocalWithErrorResult = Result<(LocalUnionPayload), u32>;
/// Handle-type validating wrapper for MainProtocolTwoWayLocalWithErrorResult responses, used internally by
/// FIDL bindings to decode method results. This should only be used by
/// generated APIs, API users should never need to use this type. It is public
/// because it is shared with composed protocols.
#[doc(hidden)]
pub type MainProtocolTwoWayLocalWithErrorResultHandleWrapper = Result<(LocalUnionPayload,), u32>;
pub type MainProtocolOnLocalWithErrorResult = Result<(LocalTablePayload), u32>;
/// Handle-type validating wrapper for MainProtocolOnLocalWithErrorResult responses, used internally by
/// FIDL bindings to decode method results. This should only be used by
/// generated APIs, API users should never need to use this type. It is public
/// because it is shared with composed protocols.
#[doc(hidden)]
pub type MainProtocolOnLocalWithErrorResultHandleWrapper = Result<(LocalTablePayload,), u32>;
pub type MainProtocolTwoWayAnonWithErrorResult =
Result<(MainProtocolTwoWayAnonWithErrorResponse), u32>;
/// Handle-type validating wrapper for MainProtocolTwoWayAnonWithErrorResult responses, used internally by
/// FIDL bindings to decode method results. This should only be used by
/// generated APIs, API users should never need to use this type. It is public
/// because it is shared with composed protocols.
#[doc(hidden)]
pub type MainProtocolTwoWayAnonWithErrorResultHandleWrapper =
Result<(MainProtocolTwoWayAnonWithErrorResponse,), u32>;
pub type MainProtocolOnAnonWithErrorResult = Result<(MainProtocolOnAnonWithErrorResponse), u32>;
/// Handle-type validating wrapper for MainProtocolOnAnonWithErrorResult responses, used internally by
/// FIDL bindings to decode method results. This should only be used by
/// generated APIs, API users should never need to use this type. It is public
/// because it is shared with composed protocols.
#[doc(hidden)]
pub type MainProtocolOnAnonWithErrorResultHandleWrapper =
Result<(MainProtocolOnAnonWithErrorResponse,), u32>;
#[derive(Debug, Clone, PartialEq)]
pub enum LocalUnionPayload {
B(bool),
#[deprecated = "Use `LocalUnionPayload::unknown()` to construct and `LocalUnionPayloadUnknown!()` to exhaustively match."]
#[doc(hidden)]
__Unknown {
ordinal: u64,
bytes: Vec<u8>,
},
}
/// Pattern that matches an unknown `LocalUnionPayload` member.
#[macro_export]
macro_rules! LocalUnionPayloadUnknown {
() => {
_
};
}
impl LocalUnionPayload {
#[inline]
pub fn unknown(ordinal: u64, bytes: Vec<u8>) -> Self {
#[allow(deprecated)]
Self::__Unknown { ordinal, bytes }
}
#[inline]
pub fn validate(self) -> std::result::Result<Self, (u64, Vec<u8>)> {
match self {
#[allow(deprecated)]
Self::__Unknown { ordinal, bytes } => Err((ordinal, bytes)),
_ => Ok(self),
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
#[allow(deprecated)]
Self::__Unknown { .. } => true,
_ => false,
}
}
}
impl fidl::encoding::Persistable for LocalUnionPayload {}
fidl_union! {
name: LocalUnionPayload,
members: [
B {
ty: bool,
ordinal: 1,
},
],
value_unknown_member: __Unknown,
}
#[derive(Debug, Clone, PartialEq)]
pub enum MainProtocolOnAnonRequest {
B(bool),
#[deprecated = "Use `MainProtocolOnAnonRequest::unknown()` to construct and `MainProtocolOnAnonRequestUnknown!()` to exhaustively match."]
#[doc(hidden)]
__Unknown {
ordinal: u64,
bytes: Vec<u8>,
},
}
/// Pattern that matches an unknown `MainProtocolOnAnonRequest` member.
#[macro_export]
macro_rules! MainProtocolOnAnonRequestUnknown {
() => {
_
};
}
impl MainProtocolOnAnonRequest {
#[inline]
pub fn unknown(ordinal: u64, bytes: Vec<u8>) -> Self {
#[allow(deprecated)]
Self::__Unknown { ordinal, bytes }
}
#[inline]
pub fn validate(self) -> std::result::Result<Self, (u64, Vec<u8>)> {
match self {
#[allow(deprecated)]
Self::__Unknown { ordinal, bytes } => Err((ordinal, bytes)),
_ => Ok(self),
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
#[allow(deprecated)]
Self::__Unknown { .. } => true,
_ => false,
}
}
}
impl fidl::encoding::Persistable for MainProtocolOnAnonRequest {}
fidl_union! {
name: MainProtocolOnAnonRequest,
members: [
B {
ty: bool,
ordinal: 1,
},
],
value_unknown_member: __Unknown,
}
#[derive(Debug, Clone, PartialEq)]
pub enum MainProtocolTwoWayAnonRequest {
B(bool),
#[deprecated = "Use `MainProtocolTwoWayAnonRequest::unknown()` to construct and `MainProtocolTwoWayAnonRequestUnknown!()` to exhaustively match."]
#[doc(hidden)]
__Unknown {
ordinal: u64,
bytes: Vec<u8>,
},
}
/// Pattern that matches an unknown `MainProtocolTwoWayAnonRequest` member.
#[macro_export]
macro_rules! MainProtocolTwoWayAnonRequestUnknown {
() => {
_
};
}
impl MainProtocolTwoWayAnonRequest {
#[inline]
pub fn unknown(ordinal: u64, bytes: Vec<u8>) -> Self {
#[allow(deprecated)]
Self::__Unknown { ordinal, bytes }
}
#[inline]
pub fn validate(self) -> std::result::Result<Self, (u64, Vec<u8>)> {
match self {
#[allow(deprecated)]
Self::__Unknown { ordinal, bytes } => Err((ordinal, bytes)),
_ => Ok(self),
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
#[allow(deprecated)]
Self::__Unknown { .. } => true,
_ => false,
}
}
}
impl fidl::encoding::Persistable for MainProtocolTwoWayAnonRequest {}
fidl_union! {
name: MainProtocolTwoWayAnonRequest,
members: [
B {
ty: bool,
ordinal: 1,
},
],
value_unknown_member: __Unknown,
}
#[derive(Debug, Clone, PartialEq)]
pub enum MainProtocolTwoWayAnonWithErrorResponse {
B(bool),
#[deprecated = "Use `MainProtocolTwoWayAnonWithErrorResponse::unknown()` to construct and `MainProtocolTwoWayAnonWithErrorResponseUnknown!()` to exhaustively match."]
#[doc(hidden)]
__Unknown {
ordinal: u64,
bytes: Vec<u8>,
},
}
/// Pattern that matches an unknown `MainProtocolTwoWayAnonWithErrorResponse` member.
#[macro_export]
macro_rules! MainProtocolTwoWayAnonWithErrorResponseUnknown {
() => {
_
};
}
impl MainProtocolTwoWayAnonWithErrorResponse {
#[inline]
pub fn unknown(ordinal: u64, bytes: Vec<u8>) -> Self {
#[allow(deprecated)]
Self::__Unknown { ordinal, bytes }
}
#[inline]
pub fn validate(self) -> std::result::Result<Self, (u64, Vec<u8>)> {
match self {
#[allow(deprecated)]
Self::__Unknown { ordinal, bytes } => Err((ordinal, bytes)),
_ => Ok(self),
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
#[allow(deprecated)]
Self::__Unknown { .. } => true,
_ => false,
}
}
}
impl fidl::encoding::Persistable for MainProtocolTwoWayAnonWithErrorResponse {}
fidl_union! {
name: MainProtocolTwoWayAnonWithErrorResponse,
members: [
B {
ty: bool,
ordinal: 1,
},
],
value_unknown_member: __Unknown,
}
#[derive(Debug, Clone, PartialEq)]
pub struct LocalTablePayload {
pub a: Option<u16>,
/// (FIDL-generated) Unknown fields encountered during decoding, stored as a
/// map from ordinals to raw data. The `Some` case is always nonempty.
pub unknown_data: Option<std::collections::BTreeMap<u64, Vec<u8>>>,
#[deprecated = "Use `..LocalTablePayload::EMPTY` to construct and `..` to match."]
#[doc(hidden)]
pub __non_exhaustive: (),
}
impl LocalTablePayload {
/// An empty table with every field set to `None`.
#[allow(deprecated)]
pub const EMPTY: Self = Self { a: None, unknown_data: None, __non_exhaustive: () };
}
impl fidl::encoding::Persistable for LocalTablePayload {}
fidl_table! {
name: LocalTablePayload,
members: [
a {
ty: u16,
ordinal: 1,
},
],
value_unknown_member: unknown_data,
}
#[derive(Debug, Clone, PartialEq)]
pub struct MainProtocolOneWayAnonRequest {
pub a: Option<u16>,
/// (FIDL-generated) Unknown fields encountered during decoding, stored as a
/// map from ordinals to raw data. The `Some` case is always nonempty.
pub unknown_data: Option<std::collections::BTreeMap<u64, Vec<u8>>>,
#[deprecated = "Use `..MainProtocolOneWayAnonRequest::EMPTY` to construct and `..` to match."]
#[doc(hidden)]
pub __non_exhaustive: (),
}
impl MainProtocolOneWayAnonRequest {
/// An empty table with every field set to `None`.
#[allow(deprecated)]
pub const EMPTY: Self = Self { a: None, unknown_data: None, __non_exhaustive: () };
}
impl fidl::encoding::Persistable for MainProtocolOneWayAnonRequest {}
fidl_table! {
name: MainProtocolOneWayAnonRequest,
members: [
a {
ty: u16,
ordinal: 1,
},
],
value_unknown_member: unknown_data,
}
#[derive(Debug, Clone, PartialEq)]
pub struct MainProtocolTwoWayAnonResponse {
pub a: Option<u16>,
/// (FIDL-generated) Unknown fields encountered during decoding, stored as a
/// map from ordinals to raw data. The `Some` case is always nonempty.
pub unknown_data: Option<std::collections::BTreeMap<u64, Vec<u8>>>,
#[deprecated = "Use `..MainProtocolTwoWayAnonResponse::EMPTY` to construct and `..` to match."]
#[doc(hidden)]
pub __non_exhaustive: (),
}
impl MainProtocolTwoWayAnonResponse {
/// An empty table with every field set to `None`.
#[allow(deprecated)]
pub const EMPTY: Self = Self { a: None, unknown_data: None, __non_exhaustive: () };
}
impl fidl::encoding::Persistable for MainProtocolTwoWayAnonResponse {}
fidl_table! {
name: MainProtocolTwoWayAnonResponse,
members: [
a {
ty: u16,
ordinal: 1,
},
],
value_unknown_member: unknown_data,
}
#[derive(Debug, Clone, PartialEq)]
pub struct MainProtocolTwoWayAnonWithErrorRequest {
pub a: Option<u16>,
/// (FIDL-generated) Unknown fields encountered during decoding, stored as a
/// map from ordinals to raw data. The `Some` case is always nonempty.
pub unknown_data: Option<std::collections::BTreeMap<u64, Vec<u8>>>,
#[deprecated = "Use `..MainProtocolTwoWayAnonWithErrorRequest::EMPTY` to construct and `..` to match."]
#[doc(hidden)]
pub __non_exhaustive: (),
}
impl MainProtocolTwoWayAnonWithErrorRequest {
/// An empty table with every field set to `None`.
#[allow(deprecated)]
pub const EMPTY: Self = Self { a: None, unknown_data: None, __non_exhaustive: () };
}
impl fidl::encoding::Persistable for MainProtocolTwoWayAnonWithErrorRequest {}
fidl_table! {
name: MainProtocolTwoWayAnonWithErrorRequest,
members: [
a {
ty: u16,
ordinal: 1,
},
],
value_unknown_member: unknown_data,
}
#[derive(Debug, Clone, PartialEq)]
pub struct MainProtocolOnAnonWithErrorResponse {
pub a: Option<u16>,
/// (FIDL-generated) Unknown fields encountered during decoding, stored as a
/// map from ordinals to raw data. The `Some` case is always nonempty.
pub unknown_data: Option<std::collections::BTreeMap<u64, Vec<u8>>>,
#[deprecated = "Use `..MainProtocolOnAnonWithErrorResponse::EMPTY` to construct and `..` to match."]
#[doc(hidden)]
pub __non_exhaustive: (),
}
impl MainProtocolOnAnonWithErrorResponse {
/// An empty table with every field set to `None`.
#[allow(deprecated)]
pub const EMPTY: Self = Self { a: None, unknown_data: None, __non_exhaustive: () };
}
impl fidl::encoding::Persistable for MainProtocolOnAnonWithErrorResponse {}
fidl_table! {
name: MainProtocolOnAnonWithErrorResponse,
members: [
a {
ty: u16,
ordinal: 1,
},
],
value_unknown_member: unknown_data,
}
#[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 trait MainProtocolProxyInterface: Send + Sync {
fn r#one_way_anon_composed(
&self,
payload: fidl_test_protocollayouts_imported::ComposedProtocolOneWayAnonComposedRequest,
) -> Result<(), fidl::Error>;
type TwoWayAnonComposedResponseFut: std::future::Future<
Output = Result<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedResponse),
fidl::Error,
>,
> + Send;
fn r#two_way_anon_composed(
&self,
payload: &mut fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedRequest,
) -> Self::TwoWayAnonComposedResponseFut;
type TwoWayAnonComposedWithErrorResponseFut: std::future::Future<Output = Result<(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorResult), fidl::Error>> + Send;
fn r#two_way_anon_composed_with_error(
&self,
payload: fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorRequest,
) -> Self::TwoWayAnonComposedWithErrorResponseFut;
type OnAnonComposedResponseFut: std::future::Future<
Output = Result<
(fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedRequest),
fidl::Error,
>,
> + Send;
type OnAnonComposedWithErrorResponseFut: std::future::Future<
Output = Result<
(fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedWithErrorResult),
fidl::Error,
>,
> + Send;
fn r#one_way_named_composed(
&self,
payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error>;
type TwoWayNamedComposedResponseFut: std::future::Future<
Output = Result<(fidl_test_protocollayouts_imported::ImportTablePayload), fidl::Error>,
> + Send;
fn r#two_way_named_composed(
&self,
payload: &mut fidl_test_protocollayouts_imported::ImportUnionPayload,
) -> Self::TwoWayNamedComposedResponseFut;
type TwoWayNamedComposedWithErrorResponseFut: std::future::Future<Output = Result<(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayNamedComposedWithErrorResult), fidl::Error>> + Send;
fn r#two_way_named_composed_with_error(
&self,
payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Self::TwoWayNamedComposedWithErrorResponseFut;
type OnNamedComposedResponseFut: std::future::Future<
Output = Result<(fidl_test_protocollayouts_imported::ImportUnionPayload), fidl::Error>,
> + Send;
type OnNamedComposedWithErrorResponseFut: std::future::Future<Output = Result<(fidl_test_protocollayouts_imported::ComposedProtocolOnNamedComposedWithErrorResult), fidl::Error>> + Send;
fn r#one_way_import(
&self,
payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error>;
type TwoWayImportResponseFut: std::future::Future<
Output = Result<(fidl_test_protocollayouts_imported::ImportTablePayload), fidl::Error>,
> + Send;
fn r#two_way_import(
&self,
payload: &mut fidl_test_protocollayouts_imported::ImportUnionPayload,
) -> Self::TwoWayImportResponseFut;
type TwoWayImportWithErrorResponseFut: std::future::Future<Output = Result<(MainProtocolTwoWayImportWithErrorResult), fidl::Error>>
+ Send;
fn r#two_way_import_with_error(
&self,
payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Self::TwoWayImportWithErrorResponseFut;
type OnImportResponseFut: std::future::Future<
Output = Result<(fidl_test_protocollayouts_imported::ImportUnionPayload), fidl::Error>,
> + Send;
type OnImportWithErrorResponseFut: std::future::Future<Output = Result<(MainProtocolOnImportWithErrorResult), fidl::Error>>
+ Send;
fn r#one_way_local(&self, payload: LocalTablePayload) -> Result<(), fidl::Error>;
type TwoWayLocalResponseFut: std::future::Future<Output = Result<(LocalTablePayload), fidl::Error>>
+ Send;
fn r#two_way_local(&self, payload: &mut LocalUnionPayload) -> Self::TwoWayLocalResponseFut;
type TwoWayLocalWithErrorResponseFut: std::future::Future<Output = Result<(MainProtocolTwoWayLocalWithErrorResult), fidl::Error>>
+ Send;
fn r#two_way_local_with_error(
&self,
payload: LocalTablePayload,
) -> Self::TwoWayLocalWithErrorResponseFut;
type OnLocalResponseFut: std::future::Future<Output = Result<(LocalUnionPayload), fidl::Error>>
+ Send;
type OnLocalWithErrorResponseFut: std::future::Future<Output = Result<(MainProtocolOnLocalWithErrorResult), fidl::Error>>
+ Send;
fn r#one_way_anon(&self, payload: MainProtocolOneWayAnonRequest) -> Result<(), fidl::Error>;
type TwoWayAnonResponseFut: std::future::Future<Output = Result<(MainProtocolTwoWayAnonResponse), fidl::Error>>
+ Send;
fn r#two_way_anon(
&self,
payload: &mut MainProtocolTwoWayAnonRequest,
) -> Self::TwoWayAnonResponseFut;
type TwoWayAnonWithErrorResponseFut: std::future::Future<Output = Result<(MainProtocolTwoWayAnonWithErrorResult), fidl::Error>>
+ Send;
fn r#two_way_anon_with_error(
&self,
payload: MainProtocolTwoWayAnonWithErrorRequest,
) -> Self::TwoWayAnonWithErrorResponseFut;
type OnAnonResponseFut: std::future::Future<Output = Result<(MainProtocolOnAnonRequest), fidl::Error>>
+ Send;
type OnAnonWithErrorResponseFut: std::future::Future<Output = Result<(MainProtocolOnAnonWithErrorResult), fidl::Error>>
+ Send;
}
#[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_anon_composed(
&self,
mut payload: fidl_test_protocollayouts_imported::ComposedProtocolOneWayAnonComposedRequest,
) -> Result<(), fidl::Error> {
self.client.send(&mut (payload,), 0x67da05e1ae3f5e1, fidl::encoding::DynamicFlags::empty())
}
pub fn r#two_way_anon_composed(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedRequest,
___deadline: zx::Time,
) -> Result<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedResponse),
fidl::Error,
> {
let _value: (
fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedResponse,
) = self.client.send_query(
&mut (payload),
0x16afa17ea70d3370,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_value.0)
}
pub fn r#two_way_anon_composed_with_error(
&self,
mut payload: fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorRequest,
___deadline: zx::Time,
) -> Result<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorResult),
fidl::Error,
> {
let _value: fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorResultHandleWrapper = self.client.send_query(&mut (payload),
0x2ed33746b7bb119d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_value.map(|_value| _value.0))
}
pub fn r#one_way_named_composed(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
self.client.send(&mut (payload,), 0x5d78ce13958eee58, fidl::encoding::DynamicFlags::empty())
}
pub fn r#two_way_named_composed(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ImportUnionPayload,
___deadline: zx::Time,
) -> Result<(fidl_test_protocollayouts_imported::ImportTablePayload), fidl::Error> {
let _value: (fidl_test_protocollayouts_imported::ImportTablePayload,) =
self.client.send_query(
&mut (payload),
0xf67f27cae663810,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_value.0)
}
pub fn r#two_way_named_composed_with_error(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
___deadline: zx::Time,
) -> Result<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayNamedComposedWithErrorResult),
fidl::Error,
> {
let _value: fidl_test_protocollayouts_imported::ComposedProtocolTwoWayNamedComposedWithErrorResultHandleWrapper = self.client.send_query(&mut (payload),
0x30dac4182813ef7f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_value.map(|_value| _value.0))
}
pub fn r#one_way_import(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
self.client.send(&mut (payload,), 0x530db65f2691d3b, fidl::encoding::DynamicFlags::empty())
}
pub fn r#two_way_import(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ImportUnionPayload,
___deadline: zx::Time,
) -> Result<(fidl_test_protocollayouts_imported::ImportTablePayload), fidl::Error> {
let _value: (fidl_test_protocollayouts_imported::ImportTablePayload,) =
self.client.send_query(
&mut (payload),
0x2bf680c8f0d40604,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_value.0)
}
pub fn r#two_way_import_with_error(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
___deadline: zx::Time,
) -> Result<(MainProtocolTwoWayImportWithErrorResult), fidl::Error> {
let _value: MainProtocolTwoWayImportWithErrorResultHandleWrapper = self.client.send_query(
&mut (payload),
0x432093586084ff0a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_value.map(|_value| _value.0))
}
pub fn r#one_way_local(&self, mut payload: LocalTablePayload) -> Result<(), fidl::Error> {
self.client.send(&mut (payload,), 0x54759b55efd60f43, fidl::encoding::DynamicFlags::empty())
}
pub fn r#two_way_local(
&self,
mut payload: &mut LocalUnionPayload,
___deadline: zx::Time,
) -> Result<(LocalTablePayload), fidl::Error> {
let _value: (LocalTablePayload,) = self.client.send_query(
&mut (payload),
0x6bbeeb18f39c539b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_value.0)
}
pub fn r#two_way_local_with_error(
&self,
mut payload: LocalTablePayload,
___deadline: zx::Time,
) -> Result<(MainProtocolTwoWayLocalWithErrorResult), fidl::Error> {
let _value: MainProtocolTwoWayLocalWithErrorResultHandleWrapper = self.client.send_query(
&mut (payload),
0x4dd8e7287c4c9b57,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_value.map(|_value| _value.0))
}
pub fn r#one_way_anon(
&self,
mut payload: MainProtocolOneWayAnonRequest,
) -> Result<(), fidl::Error> {
self.client.send(&mut (payload,), 0x3a552f30c77c76ec, fidl::encoding::DynamicFlags::empty())
}
pub fn r#two_way_anon(
&self,
mut payload: &mut MainProtocolTwoWayAnonRequest,
___deadline: zx::Time,
) -> Result<(MainProtocolTwoWayAnonResponse), fidl::Error> {
let _value: (MainProtocolTwoWayAnonResponse,) = self.client.send_query(
&mut (payload),
0x672eb5e71efdabcf,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_value.0)
}
pub fn r#two_way_anon_with_error(
&self,
mut payload: MainProtocolTwoWayAnonWithErrorRequest,
___deadline: zx::Time,
) -> Result<(MainProtocolTwoWayAnonWithErrorResult), fidl::Error> {
let _value: MainProtocolTwoWayAnonWithErrorResultHandleWrapper = self.client.send_query(
&mut (payload),
0x6bd5fcf6f7b46df1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_value.map(|_value| _value.0))
}
}
#[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_anon_composed(
&self,
mut payload: fidl_test_protocollayouts_imported::ComposedProtocolOneWayAnonComposedRequest,
) -> Result<(), fidl::Error> {
MainProtocolProxyInterface::r#one_way_anon_composed(self, payload)
}
pub fn r#two_way_anon_composed(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedRequest,
) -> fidl::client::QueryResponseFut<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedResponse),
> {
MainProtocolProxyInterface::r#two_way_anon_composed(self, payload)
}
pub fn r#two_way_anon_composed_with_error(
&self,
mut payload: fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorRequest,
) -> fidl::client::QueryResponseFut<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorResult),
> {
MainProtocolProxyInterface::r#two_way_anon_composed_with_error(self, payload)
}
pub fn r#one_way_named_composed(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
MainProtocolProxyInterface::r#one_way_named_composed(self, payload)
}
pub fn r#two_way_named_composed(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ImportUnionPayload,
) -> fidl::client::QueryResponseFut<(fidl_test_protocollayouts_imported::ImportTablePayload)>
{
MainProtocolProxyInterface::r#two_way_named_composed(self, payload)
}
pub fn r#two_way_named_composed_with_error(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> fidl::client::QueryResponseFut<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayNamedComposedWithErrorResult),
> {
MainProtocolProxyInterface::r#two_way_named_composed_with_error(self, payload)
}
pub fn r#one_way_import(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
MainProtocolProxyInterface::r#one_way_import(self, payload)
}
pub fn r#two_way_import(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ImportUnionPayload,
) -> fidl::client::QueryResponseFut<(fidl_test_protocollayouts_imported::ImportTablePayload)>
{
MainProtocolProxyInterface::r#two_way_import(self, payload)
}
pub fn r#two_way_import_with_error(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> fidl::client::QueryResponseFut<(MainProtocolTwoWayImportWithErrorResult)> {
MainProtocolProxyInterface::r#two_way_import_with_error(self, payload)
}
pub fn r#one_way_local(&self, mut payload: LocalTablePayload) -> Result<(), fidl::Error> {
MainProtocolProxyInterface::r#one_way_local(self, payload)
}
pub fn r#two_way_local(
&self,
mut payload: &mut LocalUnionPayload,
) -> fidl::client::QueryResponseFut<(LocalTablePayload)> {
MainProtocolProxyInterface::r#two_way_local(self, payload)
}
pub fn r#two_way_local_with_error(
&self,
mut payload: LocalTablePayload,
) -> fidl::client::QueryResponseFut<(MainProtocolTwoWayLocalWithErrorResult)> {
MainProtocolProxyInterface::r#two_way_local_with_error(self, payload)
}
pub fn r#one_way_anon(
&self,
mut payload: MainProtocolOneWayAnonRequest,
) -> Result<(), fidl::Error> {
MainProtocolProxyInterface::r#one_way_anon(self, payload)
}
pub fn r#two_way_anon(
&self,
mut payload: &mut MainProtocolTwoWayAnonRequest,
) -> fidl::client::QueryResponseFut<(MainProtocolTwoWayAnonResponse)> {
MainProtocolProxyInterface::r#two_way_anon(self, payload)
}
pub fn r#two_way_anon_with_error(
&self,
mut payload: MainProtocolTwoWayAnonWithErrorRequest,
) -> fidl::client::QueryResponseFut<(MainProtocolTwoWayAnonWithErrorResult)> {
MainProtocolProxyInterface::r#two_way_anon_with_error(self, payload)
}
}
impl MainProtocolProxyInterface for MainProtocolProxy {
fn r#one_way_anon_composed(
&self,
mut payload: fidl_test_protocollayouts_imported::ComposedProtocolOneWayAnonComposedRequest,
) -> Result<(), fidl::Error> {
self.client.send(&mut (payload), 0x67da05e1ae3f5e1, fidl::encoding::DynamicFlags::empty())
}
type TwoWayAnonComposedResponseFut = fidl::client::QueryResponseFut<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedResponse),
>;
fn r#two_way_anon_composed(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedRequest,
) -> Self::TwoWayAnonComposedResponseFut {
fn transform(
result: Result<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedResponse,),
fidl::Error,
>,
) -> Result<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedResponse),
fidl::Error,
> {
result.map(|_value| _value.0)
}
let send_result = self.client.call_send_raw_query(
&mut (payload),
0x16afa17ea70d3370,
fidl::encoding::DynamicFlags::empty(),
);
QueryResponseFut(match send_result {
Ok(res_fut) => future::maybe_done(
res_fut.and_then(|buf| decode_transaction_body_fut(buf, transform)),
),
Err(e) => MaybeDone::Done(Err(e)),
})
}
type TwoWayAnonComposedWithErrorResponseFut = fidl::client::QueryResponseFut<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorResult),
>;
fn r#two_way_anon_composed_with_error(
&self,
mut payload: fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorRequest,
) -> Self::TwoWayAnonComposedWithErrorResponseFut {
fn transform(
result: Result<fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorResultHandleWrapper, fidl::Error>,
) -> Result<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorResult),
fidl::Error,
> {
result.map(|_value| _value.map(|_value| _value.0))
}
let send_result = self.client.call_send_raw_query(
&mut (payload),
0x2ed33746b7bb119d,
fidl::encoding::DynamicFlags::empty(),
);
QueryResponseFut(match send_result {
Ok(res_fut) => future::maybe_done(
res_fut.and_then(|buf| decode_transaction_body_fut(buf, transform)),
),
Err(e) => MaybeDone::Done(Err(e)),
})
}
type OnAnonComposedResponseFut = fidl::client::QueryResponseFut<
(fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedRequest),
>;
type OnAnonComposedWithErrorResponseFut = fidl::client::QueryResponseFut<
(fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedWithErrorResult),
>;
fn r#one_way_named_composed(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
self.client.send(&mut (payload), 0x5d78ce13958eee58, fidl::encoding::DynamicFlags::empty())
}
type TwoWayNamedComposedResponseFut =
fidl::client::QueryResponseFut<(fidl_test_protocollayouts_imported::ImportTablePayload)>;
fn r#two_way_named_composed(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ImportUnionPayload,
) -> Self::TwoWayNamedComposedResponseFut {
fn transform(
result: Result<(fidl_test_protocollayouts_imported::ImportTablePayload,), fidl::Error>,
) -> Result<(fidl_test_protocollayouts_imported::ImportTablePayload), fidl::Error> {
result.map(|_value| _value.0)
}
let send_result = self.client.call_send_raw_query(
&mut (payload),
0xf67f27cae663810,
fidl::encoding::DynamicFlags::empty(),
);
QueryResponseFut(match send_result {
Ok(res_fut) => future::maybe_done(
res_fut.and_then(|buf| decode_transaction_body_fut(buf, transform)),
),
Err(e) => MaybeDone::Done(Err(e)),
})
}
type TwoWayNamedComposedWithErrorResponseFut = fidl::client::QueryResponseFut<
(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayNamedComposedWithErrorResult),
>;
fn r#two_way_named_composed_with_error(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Self::TwoWayNamedComposedWithErrorResponseFut {
fn transform(result: Result<fidl_test_protocollayouts_imported::ComposedProtocolTwoWayNamedComposedWithErrorResultHandleWrapper, fidl::Error>) -> Result<(fidl_test_protocollayouts_imported::ComposedProtocolTwoWayNamedComposedWithErrorResult), fidl::Error>{
result.map(|_value| _value.map(|_value| _value.0))
}
let send_result = self.client.call_send_raw_query(
&mut (payload),
0x30dac4182813ef7f,
fidl::encoding::DynamicFlags::empty(),
);
QueryResponseFut(match send_result {
Ok(res_fut) => future::maybe_done(
res_fut.and_then(|buf| decode_transaction_body_fut(buf, transform)),
),
Err(e) => MaybeDone::Done(Err(e)),
})
}
type OnNamedComposedResponseFut =
fidl::client::QueryResponseFut<(fidl_test_protocollayouts_imported::ImportUnionPayload)>;
type OnNamedComposedWithErrorResponseFut = fidl::client::QueryResponseFut<
(fidl_test_protocollayouts_imported::ComposedProtocolOnNamedComposedWithErrorResult),
>;
fn r#one_way_import(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
self.client.send(&mut (payload), 0x530db65f2691d3b, fidl::encoding::DynamicFlags::empty())
}
type TwoWayImportResponseFut =
fidl::client::QueryResponseFut<(fidl_test_protocollayouts_imported::ImportTablePayload)>;
fn r#two_way_import(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ImportUnionPayload,
) -> Self::TwoWayImportResponseFut {
fn transform(
result: Result<(fidl_test_protocollayouts_imported::ImportTablePayload,), fidl::Error>,
) -> Result<(fidl_test_protocollayouts_imported::ImportTablePayload), fidl::Error> {
result.map(|_value| _value.0)
}
let send_result = self.client.call_send_raw_query(
&mut (payload),
0x2bf680c8f0d40604,
fidl::encoding::DynamicFlags::empty(),
);
QueryResponseFut(match send_result {
Ok(res_fut) => future::maybe_done(
res_fut.and_then(|buf| decode_transaction_body_fut(buf, transform)),
),
Err(e) => MaybeDone::Done(Err(e)),
})
}
type TwoWayImportWithErrorResponseFut =
fidl::client::QueryResponseFut<(MainProtocolTwoWayImportWithErrorResult)>;
fn r#two_way_import_with_error(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Self::TwoWayImportWithErrorResponseFut {
fn transform(
result: Result<MainProtocolTwoWayImportWithErrorResultHandleWrapper, fidl::Error>,
) -> Result<(MainProtocolTwoWayImportWithErrorResult), fidl::Error> {
result.map(|_value| _value.map(|_value| _value.0))
}
let send_result = self.client.call_send_raw_query(
&mut (payload),
0x432093586084ff0a,
fidl::encoding::DynamicFlags::empty(),
);
QueryResponseFut(match send_result {
Ok(res_fut) => future::maybe_done(
res_fut.and_then(|buf| decode_transaction_body_fut(buf, transform)),
),
Err(e) => MaybeDone::Done(Err(e)),
})
}
type OnImportResponseFut =
fidl::client::QueryResponseFut<(fidl_test_protocollayouts_imported::ImportUnionPayload)>;
type OnImportWithErrorResponseFut =
fidl::client::QueryResponseFut<(MainProtocolOnImportWithErrorResult)>;
fn r#one_way_local(&self, mut payload: LocalTablePayload) -> Result<(), fidl::Error> {
self.client.send(&mut (payload), 0x54759b55efd60f43, fidl::encoding::DynamicFlags::empty())
}
type TwoWayLocalResponseFut = fidl::client::QueryResponseFut<(LocalTablePayload)>;
fn r#two_way_local(&self, mut payload: &mut LocalUnionPayload) -> Self::TwoWayLocalResponseFut {
fn transform(
result: Result<(LocalTablePayload,), fidl::Error>,
) -> Result<(LocalTablePayload), fidl::Error> {
result.map(|_value| _value.0)
}
let send_result = self.client.call_send_raw_query(
&mut (payload),
0x6bbeeb18f39c539b,
fidl::encoding::DynamicFlags::empty(),
);
QueryResponseFut(match send_result {
Ok(res_fut) => future::maybe_done(
res_fut.and_then(|buf| decode_transaction_body_fut(buf, transform)),
),
Err(e) => MaybeDone::Done(Err(e)),
})
}
type TwoWayLocalWithErrorResponseFut =
fidl::client::QueryResponseFut<(MainProtocolTwoWayLocalWithErrorResult)>;
fn r#two_way_local_with_error(
&self,
mut payload: LocalTablePayload,
) -> Self::TwoWayLocalWithErrorResponseFut {
fn transform(
result: Result<MainProtocolTwoWayLocalWithErrorResultHandleWrapper, fidl::Error>,
) -> Result<(MainProtocolTwoWayLocalWithErrorResult), fidl::Error> {
result.map(|_value| _value.map(|_value| _value.0))
}
let send_result = self.client.call_send_raw_query(
&mut (payload),
0x4dd8e7287c4c9b57,
fidl::encoding::DynamicFlags::empty(),
);
QueryResponseFut(match send_result {
Ok(res_fut) => future::maybe_done(
res_fut.and_then(|buf| decode_transaction_body_fut(buf, transform)),
),
Err(e) => MaybeDone::Done(Err(e)),
})
}
type OnLocalResponseFut = fidl::client::QueryResponseFut<(LocalUnionPayload)>;
type OnLocalWithErrorResponseFut =
fidl::client::QueryResponseFut<(MainProtocolOnLocalWithErrorResult)>;
fn r#one_way_anon(
&self,
mut payload: MainProtocolOneWayAnonRequest,
) -> Result<(), fidl::Error> {
self.client.send(&mut (payload), 0x3a552f30c77c76ec, fidl::encoding::DynamicFlags::empty())
}
type TwoWayAnonResponseFut = fidl::client::QueryResponseFut<(MainProtocolTwoWayAnonResponse)>;
fn r#two_way_anon(
&self,
mut payload: &mut MainProtocolTwoWayAnonRequest,
) -> Self::TwoWayAnonResponseFut {
fn transform(
result: Result<(MainProtocolTwoWayAnonResponse,), fidl::Error>,
) -> Result<(MainProtocolTwoWayAnonResponse), fidl::Error> {
result.map(|_value| _value.0)
}
let send_result = self.client.call_send_raw_query(
&mut (payload),
0x672eb5e71efdabcf,
fidl::encoding::DynamicFlags::empty(),
);
QueryResponseFut(match send_result {
Ok(res_fut) => future::maybe_done(
res_fut.and_then(|buf| decode_transaction_body_fut(buf, transform)),
),
Err(e) => MaybeDone::Done(Err(e)),
})
}
type TwoWayAnonWithErrorResponseFut =
fidl::client::QueryResponseFut<(MainProtocolTwoWayAnonWithErrorResult)>;
fn r#two_way_anon_with_error(
&self,
mut payload: MainProtocolTwoWayAnonWithErrorRequest,
) -> Self::TwoWayAnonWithErrorResponseFut {
fn transform(
result: Result<MainProtocolTwoWayAnonWithErrorResultHandleWrapper, fidl::Error>,
) -> Result<(MainProtocolTwoWayAnonWithErrorResult), fidl::Error> {
result.map(|_value| _value.map(|_value| _value.0))
}
let send_result = self.client.call_send_raw_query(
&mut (payload),
0x6bd5fcf6f7b46df1,
fidl::encoding::DynamicFlags::empty(),
);
QueryResponseFut(match send_result {
Ok(res_fut) => future::maybe_done(
res_fut.and_then(|buf| decode_transaction_body_fut(buf, transform)),
),
Err(e) => MaybeDone::Done(Err(e)),
})
}
type OnAnonResponseFut = fidl::client::QueryResponseFut<(MainProtocolOnAnonRequest)>;
type OnAnonWithErrorResponseFut =
fidl::client::QueryResponseFut<(MainProtocolOnAnonWithErrorResult)>;
}
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 {
OnAnonComposed {
payload: fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedRequest,
},
OnAnonComposedWithError {
result: fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedWithErrorResult,
},
OnNamedComposed {
payload: fidl_test_protocollayouts_imported::ImportUnionPayload,
},
OnNamedComposedWithError {
result: fidl_test_protocollayouts_imported::ComposedProtocolOnNamedComposedWithErrorResult,
},
OnImport {
payload: fidl_test_protocollayouts_imported::ImportUnionPayload,
},
OnImportWithError {
result: MainProtocolOnImportWithErrorResult,
},
OnLocal {
payload: LocalUnionPayload,
},
OnLocalWithError {
result: MainProtocolOnLocalWithErrorResult,
},
OnAnon {
payload: MainProtocolOnAnonRequest,
},
OnAnonWithError {
result: MainProtocolOnAnonWithErrorResult,
},
}
impl MainProtocolEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_anon_composed(
self,
) -> Option<(fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedRequest)> {
if let MainProtocolEvent::OnAnonComposed { payload } = self {
Some((payload))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_anon_composed_with_error(
self,
) -> Option<(fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedWithErrorResult)>
{
if let MainProtocolEvent::OnAnonComposedWithError { result } = self {
Some((result))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_named_composed(
self,
) -> Option<(fidl_test_protocollayouts_imported::ImportUnionPayload)> {
if let MainProtocolEvent::OnNamedComposed { payload } = self {
Some((payload))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_named_composed_with_error(
self,
) -> Option<(fidl_test_protocollayouts_imported::ComposedProtocolOnNamedComposedWithErrorResult)>
{
if let MainProtocolEvent::OnNamedComposedWithError { result } = self {
Some((result))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_import(
self,
) -> Option<(fidl_test_protocollayouts_imported::ImportUnionPayload)> {
if let MainProtocolEvent::OnImport { payload } = self {
Some((payload))
} 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_local(self) -> Option<(LocalUnionPayload)> {
if let MainProtocolEvent::OnLocal { payload } = self {
Some((payload))
} 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_anon(self) -> Option<(MainProtocolOnAnonRequest)> {
if let MainProtocolEvent::OnAnon { payload } = self {
Some((payload))
} 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
}
}
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() {
0x7fa8a0bf08128a0b => {
let mut out_tuple: (
fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedRequest,
) = fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOnAnonComposedEvent");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(
&tx_header,
_body_bytes,
_handles,
&mut out_tuple,
)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => _handles.len() as u32);
Ok((MainProtocolEvent::OnAnonComposed { payload: out_tuple.0 }))
}
0x9e24af9a2790a3b => {
let mut out_tuple: (fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedWithErrorResult,) = fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOnAnonComposedWithErrorEvent");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(
&tx_header,
_body_bytes,
_handles,
&mut out_tuple,
)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => _handles.len() as u32);
Ok((MainProtocolEvent::OnAnonComposedWithError { result: out_tuple.0 }))
}
0x5e68f92a5b28cdea => {
let mut out_tuple: (fidl_test_protocollayouts_imported::ImportUnionPayload,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOnNamedComposedEvent");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(
&tx_header,
_body_bytes,
_handles,
&mut out_tuple,
)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => _handles.len() as u32);
Ok((MainProtocolEvent::OnNamedComposed { payload: out_tuple.0 }))
}
0x67eb74dad2a05c0b => {
let mut out_tuple: (fidl_test_protocollayouts_imported::ComposedProtocolOnNamedComposedWithErrorResult,) = fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOnNamedComposedWithErrorEvent");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(
&tx_header,
_body_bytes,
_handles,
&mut out_tuple,
)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => _handles.len() as u32);
Ok((MainProtocolEvent::OnNamedComposedWithError { result: out_tuple.0 }))
}
0x5b61e3156b09acd0 => {
let mut out_tuple: (fidl_test_protocollayouts_imported::ImportUnionPayload,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOnImportEvent");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(
&tx_header,
_body_bytes,
_handles,
&mut out_tuple,
)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => _handles.len() as u32);
Ok((MainProtocolEvent::OnImport { payload: out_tuple.0 }))
}
0xf988d72f8ee4fd7 => {
let mut out_tuple: (MainProtocolOnImportWithErrorResult,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOnImportWithErrorEvent");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(
&tx_header,
_body_bytes,
_handles,
&mut out_tuple,
)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => _handles.len() as u32);
Ok((MainProtocolEvent::OnImportWithError { result: out_tuple.0 }))
}
0x3a46c48153f0437c => {
let mut out_tuple: (LocalUnionPayload,) = fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOnLocalEvent");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(
&tx_header,
_body_bytes,
_handles,
&mut out_tuple,
)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => _handles.len() as u32);
Ok((MainProtocolEvent::OnLocal { payload: out_tuple.0 }))
}
0x79ac5bbdc7114e24 => {
let mut out_tuple: (MainProtocolOnLocalWithErrorResult,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOnLocalWithErrorEvent");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(
&tx_header,
_body_bytes,
_handles,
&mut out_tuple,
)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => _handles.len() as u32);
Ok((MainProtocolEvent::OnLocalWithError { result: out_tuple.0 }))
}
0x64f7b1ec1ba0810b => {
let mut out_tuple: (MainProtocolOnAnonRequest,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOnAnonEvent");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(
&tx_header,
_body_bytes,
_handles,
&mut out_tuple,
)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => _handles.len() as u32);
Ok((MainProtocolEvent::OnAnon { payload: out_tuple.0 }))
}
0x32f63a6e25a83699 => {
let mut out_tuple: (MainProtocolOnAnonWithErrorResult,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOnAnonWithErrorEvent");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(
&tx_header,
_body_bytes,
_handles,
&mut out_tuple,
)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => _handles.len() as u32);
Ok((MainProtocolEvent::OnAnonWithError { result: out_tuple.0 }))
}
_ => 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() {
0x67da05e1ae3f5e1 => {
let mut req: (fidl_test_protocollayouts_imported::ComposedProtocolOneWayAnonComposedRequest,) = fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOneWayAnonComposedRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::OneWayAnonComposed { payload: req.0, control_handle })
}
0x16afa17ea70d3370 => {
let mut req: (fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedRequest,) = fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayAnonComposedRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayAnonComposed {
payload: req.0,
responder: MainProtocolTwoWayAnonComposedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id(),
ordinal: header.ordinal(),
},
})
}
0x2ed33746b7bb119d => {
let mut req: (fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorRequest,) = fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayAnonComposedWithErrorRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayAnonComposedWithError {
payload: req.0,
responder: MainProtocolTwoWayAnonComposedWithErrorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id(),
ordinal: header.ordinal(),
},
})
}
0x5d78ce13958eee58 => {
let mut req: (fidl_test_protocollayouts_imported::ImportTablePayload,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOneWayNamedComposedRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::OneWayNamedComposed { payload: req.0, control_handle })
}
0xf67f27cae663810 => {
let mut req: (fidl_test_protocollayouts_imported::ImportUnionPayload,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayNamedComposedRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayNamedComposed {
payload: req.0,
responder: MainProtocolTwoWayNamedComposedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id(),
ordinal: header.ordinal(),
},
})
}
0x30dac4182813ef7f => {
let mut req: (fidl_test_protocollayouts_imported::ImportTablePayload,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayNamedComposedWithErrorRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayNamedComposedWithError {
payload: req.0,
responder: MainProtocolTwoWayNamedComposedWithErrorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id(),
ordinal: header.ordinal(),
},
})
}
0x530db65f2691d3b => {
let mut req: (fidl_test_protocollayouts_imported::ImportTablePayload,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOneWayImportRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::OneWayImport { payload: req.0, control_handle })
}
0x2bf680c8f0d40604 => {
let mut req: (fidl_test_protocollayouts_imported::ImportUnionPayload,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayImportRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayImport {
payload: req.0,
responder: MainProtocolTwoWayImportResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id(),
ordinal: header.ordinal(),
},
})
}
0x432093586084ff0a => {
let mut req: (fidl_test_protocollayouts_imported::ImportTablePayload,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayImportWithErrorRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayImportWithError {
payload: req.0,
responder: MainProtocolTwoWayImportWithErrorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id(),
ordinal: header.ordinal(),
},
})
}
0x54759b55efd60f43 => {
let mut req: (LocalTablePayload,) = fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOneWayLocalRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::OneWayLocal { payload: req.0, control_handle })
}
0x6bbeeb18f39c539b => {
let mut req: (LocalUnionPayload,) = fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayLocalRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayLocal {
payload: req.0,
responder: MainProtocolTwoWayLocalResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id(),
ordinal: header.ordinal(),
},
})
}
0x4dd8e7287c4c9b57 => {
let mut req: (LocalTablePayload,) = fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayLocalWithErrorRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayLocalWithError {
payload: req.0,
responder: MainProtocolTwoWayLocalWithErrorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id(),
ordinal: header.ordinal(),
},
})
}
0x3a552f30c77c76ec => {
let mut req: (MainProtocolOneWayAnonRequest,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolOneWayAnonRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::OneWayAnon { payload: req.0, control_handle })
}
0x672eb5e71efdabcf => {
let mut req: (MainProtocolTwoWayAnonRequest,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayAnonRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayAnon {
payload: req.0,
responder: MainProtocolTwoWayAnonResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id(),
ordinal: header.ordinal(),
},
})
}
0x6bd5fcf6f7b46df1 => {
let mut req: (MainProtocolTwoWayAnonWithErrorRequest,) =
fidl::encoding::Decodable::new_empty();
fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayAnonWithErrorRequest");
fidl::trace_blob!("fidl:blob", "decode", bytes);
fidl::encoding::Decoder::decode_into(&header, _body_bytes, handles, &mut req)?;
fidl::duration_end!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
let control_handle = MainProtocolControlHandle { inner: this.inner.clone() };
Ok(MainProtocolRequest::TwoWayAnonWithError {
payload: req.0,
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 {
OneWayAnonComposed {
payload: fidl_test_protocollayouts_imported::ComposedProtocolOneWayAnonComposedRequest,
control_handle: MainProtocolControlHandle,
},
TwoWayAnonComposed {
payload: fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedRequest,
responder: MainProtocolTwoWayAnonComposedResponder,
},
TwoWayAnonComposedWithError {
payload:
fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorRequest,
responder: MainProtocolTwoWayAnonComposedWithErrorResponder,
},
OneWayNamedComposed {
payload: fidl_test_protocollayouts_imported::ImportTablePayload,
control_handle: MainProtocolControlHandle,
},
TwoWayNamedComposed {
payload: fidl_test_protocollayouts_imported::ImportUnionPayload,
responder: MainProtocolTwoWayNamedComposedResponder,
},
TwoWayNamedComposedWithError {
payload: fidl_test_protocollayouts_imported::ImportTablePayload,
responder: MainProtocolTwoWayNamedComposedWithErrorResponder,
},
OneWayImport {
payload: fidl_test_protocollayouts_imported::ImportTablePayload,
control_handle: MainProtocolControlHandle,
},
TwoWayImport {
payload: fidl_test_protocollayouts_imported::ImportUnionPayload,
responder: MainProtocolTwoWayImportResponder,
},
TwoWayImportWithError {
payload: fidl_test_protocollayouts_imported::ImportTablePayload,
responder: MainProtocolTwoWayImportWithErrorResponder,
},
OneWayLocal {
payload: LocalTablePayload,
control_handle: MainProtocolControlHandle,
},
TwoWayLocal {
payload: LocalUnionPayload,
responder: MainProtocolTwoWayLocalResponder,
},
TwoWayLocalWithError {
payload: LocalTablePayload,
responder: MainProtocolTwoWayLocalWithErrorResponder,
},
OneWayAnon {
payload: MainProtocolOneWayAnonRequest,
control_handle: MainProtocolControlHandle,
},
TwoWayAnon {
payload: MainProtocolTwoWayAnonRequest,
responder: MainProtocolTwoWayAnonResponder,
},
TwoWayAnonWithError {
payload: MainProtocolTwoWayAnonWithErrorRequest,
responder: MainProtocolTwoWayAnonWithErrorResponder,
},
}
impl MainProtocolRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_one_way_anon_composed(
self,
) -> Option<(
fidl_test_protocollayouts_imported::ComposedProtocolOneWayAnonComposedRequest,
MainProtocolControlHandle,
)> {
if let MainProtocolRequest::OneWayAnonComposed { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_anon_composed(
self,
) -> Option<(
fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedRequest,
MainProtocolTwoWayAnonComposedResponder,
)> {
if let MainProtocolRequest::TwoWayAnonComposed { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_anon_composed_with_error(
self,
) -> Option<(
fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorRequest,
MainProtocolTwoWayAnonComposedWithErrorResponder,
)> {
if let MainProtocolRequest::TwoWayAnonComposedWithError { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_one_way_named_composed(
self,
) -> Option<(fidl_test_protocollayouts_imported::ImportTablePayload, MainProtocolControlHandle)>
{
if let MainProtocolRequest::OneWayNamedComposed { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_named_composed(
self,
) -> Option<(
fidl_test_protocollayouts_imported::ImportUnionPayload,
MainProtocolTwoWayNamedComposedResponder,
)> {
if let MainProtocolRequest::TwoWayNamedComposed { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_named_composed_with_error(
self,
) -> Option<(
fidl_test_protocollayouts_imported::ImportTablePayload,
MainProtocolTwoWayNamedComposedWithErrorResponder,
)> {
if let MainProtocolRequest::TwoWayNamedComposedWithError { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_one_way_import(
self,
) -> Option<(fidl_test_protocollayouts_imported::ImportTablePayload, MainProtocolControlHandle)>
{
if let MainProtocolRequest::OneWayImport { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_import(
self,
) -> Option<(
fidl_test_protocollayouts_imported::ImportUnionPayload,
MainProtocolTwoWayImportResponder,
)> {
if let MainProtocolRequest::TwoWayImport { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_import_with_error(
self,
) -> Option<(
fidl_test_protocollayouts_imported::ImportTablePayload,
MainProtocolTwoWayImportWithErrorResponder,
)> {
if let MainProtocolRequest::TwoWayImportWithError { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_one_way_local(self) -> Option<(LocalTablePayload, MainProtocolControlHandle)> {
if let MainProtocolRequest::OneWayLocal { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_local(
self,
) -> Option<(LocalUnionPayload, MainProtocolTwoWayLocalResponder)> {
if let MainProtocolRequest::TwoWayLocal { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_local_with_error(
self,
) -> Option<(LocalTablePayload, MainProtocolTwoWayLocalWithErrorResponder)> {
if let MainProtocolRequest::TwoWayLocalWithError { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_one_way_anon(
self,
) -> Option<(MainProtocolOneWayAnonRequest, MainProtocolControlHandle)> {
if let MainProtocolRequest::OneWayAnon { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_anon(
self,
) -> Option<(MainProtocolTwoWayAnonRequest, MainProtocolTwoWayAnonResponder)> {
if let MainProtocolRequest::TwoWayAnon { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_two_way_anon_with_error(
self,
) -> Option<(MainProtocolTwoWayAnonWithErrorRequest, MainProtocolTwoWayAnonWithErrorResponder)>
{
if let MainProtocolRequest::TwoWayAnonWithError { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
MainProtocolRequest::OneWayAnonComposed { .. } => "one_way_anon_composed",
MainProtocolRequest::TwoWayAnonComposed { .. } => "two_way_anon_composed",
MainProtocolRequest::TwoWayAnonComposedWithError { .. } => {
"two_way_anon_composed_with_error"
}
MainProtocolRequest::OneWayNamedComposed { .. } => "one_way_named_composed",
MainProtocolRequest::TwoWayNamedComposed { .. } => "two_way_named_composed",
MainProtocolRequest::TwoWayNamedComposedWithError { .. } => {
"two_way_named_composed_with_error"
}
MainProtocolRequest::OneWayImport { .. } => "one_way_import",
MainProtocolRequest::TwoWayImport { .. } => "two_way_import",
MainProtocolRequest::TwoWayImportWithError { .. } => "two_way_import_with_error",
MainProtocolRequest::OneWayLocal { .. } => "one_way_local",
MainProtocolRequest::TwoWayLocal { .. } => "two_way_local",
MainProtocolRequest::TwoWayLocalWithError { .. } => "two_way_local_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)
}
}
impl MainProtocolControlHandle {
pub fn send_on_anon_composed(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedRequest,
) -> Result<(), fidl::Error> {
let mut response = (payload);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
0,
0x7fa8a0bf08128a0b,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encoded(&mut msg, |bytes, handles| {
self.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)
})?;
Ok(())
}
pub fn send_on_anon_composed_with_error(
&self,
mut result: &mut fidl_test_protocollayouts_imported::ComposedProtocolOnAnonComposedWithErrorResult,
) -> Result<(), fidl::Error> {
let mut response = (result);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
0,
0x9e24af9a2790a3b,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encoded(&mut msg, |bytes, handles| {
self.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)
})?;
Ok(())
}
pub fn send_on_named_composed(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ImportUnionPayload,
) -> Result<(), fidl::Error> {
let mut response = (payload);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
0,
0x5e68f92a5b28cdea,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encoded(&mut msg, |bytes, handles| {
self.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)
})?;
Ok(())
}
pub fn send_on_named_composed_with_error(
&self,
mut result: &mut fidl_test_protocollayouts_imported::ComposedProtocolOnNamedComposedWithErrorResult,
) -> Result<(), fidl::Error> {
let mut response = (result);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
0,
0x67eb74dad2a05c0b,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encoded(&mut msg, |bytes, handles| {
self.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)
})?;
Ok(())
}
pub fn send_on_import(
&self,
mut payload: &mut fidl_test_protocollayouts_imported::ImportUnionPayload,
) -> Result<(), fidl::Error> {
let mut response = (payload);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
0,
0x5b61e3156b09acd0,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encoded(&mut msg, |bytes, handles| {
self.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)
})?;
Ok(())
}
pub fn send_on_import_with_error(
&self,
mut result: &mut MainProtocolOnImportWithErrorResult,
) -> Result<(), fidl::Error> {
let mut response = (result);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
0,
0xf988d72f8ee4fd7,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encoded(&mut msg, |bytes, handles| {
self.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)
})?;
Ok(())
}
pub fn send_on_local(&self, mut payload: &mut LocalUnionPayload) -> Result<(), fidl::Error> {
let mut response = (payload);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
0,
0x3a46c48153f0437c,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encoded(&mut msg, |bytes, handles| {
self.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)
})?;
Ok(())
}
pub fn send_on_local_with_error(
&self,
mut result: &mut MainProtocolOnLocalWithErrorResult,
) -> Result<(), fidl::Error> {
let mut response = (result);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
0,
0x79ac5bbdc7114e24,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encoded(&mut msg, |bytes, handles| {
self.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)
})?;
Ok(())
}
pub fn send_on_anon(
&self,
mut payload: &mut MainProtocolOnAnonRequest,
) -> Result<(), fidl::Error> {
let mut response = (payload);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
0,
0x64f7b1ec1ba0810b,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encoded(&mut msg, |bytes, handles| {
self.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)
})?;
Ok(())
}
pub fn send_on_anon_with_error(
&self,
mut result: &mut MainProtocolOnAnonWithErrorResult,
) -> Result<(), fidl::Error> {
let mut response = (result);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
0,
0x32f63a6e25a83699,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encoded(&mut msg, |bytes, handles| {
self.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)
})?;
Ok(())
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayAnonComposedResponder {
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 MainProtocolTwoWayAnonComposedResponder {
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 MainProtocolTwoWayAnonComposedResponder {
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 MainProtocolTwoWayAnonComposedResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(
self,
mut payload: fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedResponse,
) -> Result<(), fidl::Error> {
let r = self.send_raw(payload);
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 payload: fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedResponse,
) -> Result<(), fidl::Error> {
let r = self.send_raw(payload);
self.drop_without_shutdown();
r
}
fn send_raw(
&self,
mut payload: fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedResponse,
) -> Result<(), fidl::Error> {
let mut response = (payload);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::duration_begin!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayAnonComposedResponse");
fidl::encoding::Encoder::encode(bytes, handles, &mut msg)?;
fidl::trace_blob!("fidl:blob", "encode", bytes.as_slice());
fidl::duration_end!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
self.control_handle
.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)?;
Ok(())
})
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayAnonComposedWithErrorResponder {
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 MainProtocolTwoWayAnonComposedWithErrorResponder {
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 MainProtocolTwoWayAnonComposedWithErrorResponder {
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 MainProtocolTwoWayAnonComposedWithErrorResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(
self,
mut result: &mut fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorResult,
) -> 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: &mut fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorResult,
) -> Result<(), fidl::Error> {
let r = self.send_raw(result);
self.drop_without_shutdown();
r
}
fn send_raw(
&self,
mut _result: &mut fidl_test_protocollayouts_imported::ComposedProtocolTwoWayAnonComposedWithErrorResult,
) -> Result<(), fidl::Error> {
let mut response = (_result);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::duration_begin!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayAnonComposedWithErrorResponse");
fidl::encoding::Encoder::encode(bytes, handles, &mut msg)?;
fidl::trace_blob!("fidl:blob", "encode", bytes.as_slice());
fidl::duration_end!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
self.control_handle
.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)?;
Ok(())
})
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayNamedComposedResponder {
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 MainProtocolTwoWayNamedComposedResponder {
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 MainProtocolTwoWayNamedComposedResponder {
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 MainProtocolTwoWayNamedComposedResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(
self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
let r = self.send_raw(payload);
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 payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
let r = self.send_raw(payload);
self.drop_without_shutdown();
r
}
fn send_raw(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
let mut response = (payload);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::duration_begin!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayNamedComposedResponse");
fidl::encoding::Encoder::encode(bytes, handles, &mut msg)?;
fidl::trace_blob!("fidl:blob", "encode", bytes.as_slice());
fidl::duration_end!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
self.control_handle
.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)?;
Ok(())
})
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MainProtocolTwoWayNamedComposedWithErrorResponder {
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 MainProtocolTwoWayNamedComposedWithErrorResponder {
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 MainProtocolTwoWayNamedComposedWithErrorResponder {
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 MainProtocolTwoWayNamedComposedWithErrorResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(
self,
mut result: &mut fidl_test_protocollayouts_imported::ComposedProtocolTwoWayNamedComposedWithErrorResult,
) -> 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: &mut fidl_test_protocollayouts_imported::ComposedProtocolTwoWayNamedComposedWithErrorResult,
) -> Result<(), fidl::Error> {
let r = self.send_raw(result);
self.drop_without_shutdown();
r
}
fn send_raw(
&self,
mut _result: &mut fidl_test_protocollayouts_imported::ComposedProtocolTwoWayNamedComposedWithErrorResult,
) -> Result<(), fidl::Error> {
let mut response = (_result);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::duration_begin!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayNamedComposedWithErrorResponse");
fidl::encoding::Encoder::encode(bytes, handles, &mut msg)?;
fidl::trace_blob!("fidl:blob", "encode", bytes.as_slice());
fidl::duration_end!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
self.control_handle
.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)?;
Ok(())
})
}
}
#[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 payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
let r = self.send_raw(payload);
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 payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
let r = self.send_raw(payload);
self.drop_without_shutdown();
r
}
fn send_raw(
&self,
mut payload: fidl_test_protocollayouts_imported::ImportTablePayload,
) -> Result<(), fidl::Error> {
let mut response = (payload);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::duration_begin!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayImportResponse");
fidl::encoding::Encoder::encode(bytes, handles, &mut msg)?;
fidl::trace_blob!("fidl:blob", "encode", bytes.as_slice());
fidl::duration_end!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
self.control_handle
.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)?;
Ok(())
})
}
}
#[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: &mut MainProtocolTwoWayImportWithErrorResult,
) -> 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: &mut MainProtocolTwoWayImportWithErrorResult,
) -> Result<(), fidl::Error> {
let r = self.send_raw(result);
self.drop_without_shutdown();
r
}
fn send_raw(
&self,
mut _result: &mut MainProtocolTwoWayImportWithErrorResult,
) -> Result<(), fidl::Error> {
let mut response = (_result);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::duration_begin!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayImportWithErrorResponse");
fidl::encoding::Encoder::encode(bytes, handles, &mut msg)?;
fidl::trace_blob!("fidl:blob", "encode", bytes.as_slice());
fidl::duration_end!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
self.control_handle
.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)?;
Ok(())
})
}
}
#[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 payload: LocalTablePayload) -> Result<(), fidl::Error> {
let r = self.send_raw(payload);
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 payload: LocalTablePayload,
) -> Result<(), fidl::Error> {
let r = self.send_raw(payload);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut payload: LocalTablePayload) -> Result<(), fidl::Error> {
let mut response = (payload);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::duration_begin!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayLocalResponse");
fidl::encoding::Encoder::encode(bytes, handles, &mut msg)?;
fidl::trace_blob!("fidl:blob", "encode", bytes.as_slice());
fidl::duration_end!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
self.control_handle
.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)?;
Ok(())
})
}
}
#[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: &mut MainProtocolTwoWayLocalWithErrorResult,
) -> 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: &mut MainProtocolTwoWayLocalWithErrorResult,
) -> Result<(), fidl::Error> {
let r = self.send_raw(result);
self.drop_without_shutdown();
r
}
fn send_raw(
&self,
mut _result: &mut MainProtocolTwoWayLocalWithErrorResult,
) -> Result<(), fidl::Error> {
let mut response = (_result);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::duration_begin!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayLocalWithErrorResponse");
fidl::encoding::Encoder::encode(bytes, handles, &mut msg)?;
fidl::trace_blob!("fidl:blob", "encode", bytes.as_slice());
fidl::duration_end!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
self.control_handle
.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)?;
Ok(())
})
}
}
#[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 payload: MainProtocolTwoWayAnonResponse) -> Result<(), fidl::Error> {
let r = self.send_raw(payload);
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 payload: MainProtocolTwoWayAnonResponse,
) -> Result<(), fidl::Error> {
let r = self.send_raw(payload);
self.drop_without_shutdown();
r
}
fn send_raw(&self, mut payload: MainProtocolTwoWayAnonResponse) -> Result<(), fidl::Error> {
let mut response = (payload);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::duration_begin!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayAnonResponse");
fidl::encoding::Encoder::encode(bytes, handles, &mut msg)?;
fidl::trace_blob!("fidl:blob", "encode", bytes.as_slice());
fidl::duration_end!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
self.control_handle
.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)?;
Ok(())
})
}
}
#[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: &mut MainProtocolTwoWayAnonWithErrorResult,
) -> 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: &mut MainProtocolTwoWayAnonWithErrorResult,
) -> Result<(), fidl::Error> {
let r = self.send_raw(result);
self.drop_without_shutdown();
r
}
fn send_raw(
&self,
mut _result: &mut MainProtocolTwoWayAnonWithErrorResult,
) -> Result<(), fidl::Error> {
let mut response = (_result);
let mut msg = fidl::encoding::TransactionMessage {
header: fidl::encoding::TransactionHeader::new(
self.tx_id,
self.ordinal,
fidl::encoding::DynamicFlags::empty(),
),
body: &mut response,
};
fidl::encoding::with_tls_encode_buf(|bytes, handles| {
fidl::duration_begin!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayouts/MainProtocolTwoWayAnonWithErrorResponse");
fidl::encoding::Encoder::encode(bytes, handles, &mut msg)?;
fidl::trace_blob!("fidl:blob", "encode", bytes.as_slice());
fidl::duration_end!("fidl", "encode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "size" => bytes.len() as u32, "handle_count" => handles.len() as u32);
self.control_handle
.inner
.channel()
.write_etc(&*bytes, &mut *handles)
.map_err(fidl::Error::ServerResponseWrite)?;
Ok(())
})
}
}