| // WARNING: This file is machine generated by fidlgen. |
| |
| // experiment = no_optional_structs |
| // experiment = output_index_json |
| // experiment = simple_empty_response_syntax |
| // experiment = unknown_interactions |
| |
| #![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::{zerocopy, 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 ComposedProtocolTwoWayAnonComposedWithErrorResult = |
| Result<(ComposedProtocolTwoWayAnonComposedWithErrorResponse), u32>; |
| |
| /// Handle-type validating wrapper for ComposedProtocolTwoWayAnonComposedWithErrorResult 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 ComposedProtocolTwoWayAnonComposedWithErrorResultHandleWrapper = |
| Result<(ComposedProtocolTwoWayAnonComposedWithErrorResponse,), u32>; |
| |
| pub type ComposedProtocolOnAnonComposedWithErrorResult = |
| Result<(ComposedProtocolOnAnonComposedWithErrorResponse), u32>; |
| |
| /// Handle-type validating wrapper for ComposedProtocolOnAnonComposedWithErrorResult 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 ComposedProtocolOnAnonComposedWithErrorResultHandleWrapper = |
| Result<(ComposedProtocolOnAnonComposedWithErrorResponse,), u32>; |
| |
| pub type ComposedProtocolTwoWayNamedComposedWithErrorResult = Result<(UnionPayload), u32>; |
| |
| /// Handle-type validating wrapper for ComposedProtocolTwoWayNamedComposedWithErrorResult 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 ComposedProtocolTwoWayNamedComposedWithErrorResultHandleWrapper = |
| Result<(UnionPayload,), u32>; |
| |
| pub type ComposedProtocolOnNamedComposedWithErrorResult = Result<(TablePayload), u32>; |
| |
| /// Handle-type validating wrapper for ComposedProtocolOnNamedComposedWithErrorResult 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 ComposedProtocolOnNamedComposedWithErrorResultHandleWrapper = Result<(TablePayload,), u32>; |
| |
| pub type MainProtocolTwoWayLocalWithErrorResult = Result<(UnionPayload), 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<(UnionPayload,), u32>; |
| |
| pub type MainProtocolOnLocalWithErrorResult = Result<(TablePayload), 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<(TablePayload,), 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, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub enum ComposedProtocolOnAnonComposedRequest { |
| B(bool), |
| } |
| |
| impl ComposedProtocolOnAnonComposedRequest { |
| #[deprecated = "Strict unions should not use `validate`"] |
| #[inline] |
| pub fn validate(self) -> std::result::Result<Self, (u64, Vec<u8>)> { |
| Ok(self) |
| } |
| |
| #[deprecated = "Strict unions should not use `is_unknown`"] |
| #[inline] |
| pub fn is_unknown(&self) -> bool { |
| false |
| } |
| } |
| |
| impl fidl::encoding::TopLevel for ComposedProtocolOnAnonComposedRequest {} |
| |
| impl fidl::encoding::Persistable for ComposedProtocolOnAnonComposedRequest {} |
| |
| fidl_union! { |
| name: ComposedProtocolOnAnonComposedRequest, |
| members: [ |
| B { |
| ty: bool, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub enum ComposedProtocolTwoWayAnonComposedRequest { |
| B(bool), |
| } |
| |
| impl ComposedProtocolTwoWayAnonComposedRequest { |
| #[deprecated = "Strict unions should not use `validate`"] |
| #[inline] |
| pub fn validate(self) -> std::result::Result<Self, (u64, Vec<u8>)> { |
| Ok(self) |
| } |
| |
| #[deprecated = "Strict unions should not use `is_unknown`"] |
| #[inline] |
| pub fn is_unknown(&self) -> bool { |
| false |
| } |
| } |
| |
| impl fidl::encoding::TopLevel for ComposedProtocolTwoWayAnonComposedRequest {} |
| |
| impl fidl::encoding::Persistable for ComposedProtocolTwoWayAnonComposedRequest {} |
| |
| fidl_union! { |
| name: ComposedProtocolTwoWayAnonComposedRequest, |
| members: [ |
| B { |
| ty: bool, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub enum ComposedProtocolTwoWayAnonComposedWithErrorResponse { |
| B(bool), |
| } |
| |
| impl ComposedProtocolTwoWayAnonComposedWithErrorResponse { |
| #[deprecated = "Strict unions should not use `validate`"] |
| #[inline] |
| pub fn validate(self) -> std::result::Result<Self, (u64, Vec<u8>)> { |
| Ok(self) |
| } |
| |
| #[deprecated = "Strict unions should not use `is_unknown`"] |
| #[inline] |
| pub fn is_unknown(&self) -> bool { |
| false |
| } |
| } |
| |
| impl fidl::encoding::TopLevel for ComposedProtocolTwoWayAnonComposedWithErrorResponse {} |
| |
| impl fidl::encoding::Persistable for ComposedProtocolTwoWayAnonComposedWithErrorResponse {} |
| |
| fidl_union! { |
| name: ComposedProtocolTwoWayAnonComposedWithErrorResponse, |
| members: [ |
| B { |
| ty: bool, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Clone, PartialEq)] |
| pub enum MainProtocolOnAnonRequest { |
| B(bool), |
| #[deprecated = "Use `MainProtocolOnAnonRequest::unknown()` to construct and `MainProtocolOnAnonRequestUnknown!()` to exhaustively match."] |
| #[doc(hidden)] |
| #[non_exhaustive] |
| __Unknown { |
| ordinal: u64, |
| }, |
| } |
| /// Pattern that matches an unknown `MainProtocolOnAnonRequest` member. |
| #[macro_export] |
| macro_rules! MainProtocolOnAnonRequestUnknown { |
| () => { |
| _ |
| }; |
| } |
| |
| impl MainProtocolOnAnonRequest { |
| #[inline] |
| pub fn unknown_variant_for_testing() -> Self { |
| #[allow(deprecated)] |
| Self::__Unknown { ordinal: 0 } |
| } |
| |
| #[inline] |
| pub fn validate(self) -> std::result::Result<Self, u64> { |
| match self { |
| #[allow(deprecated)] |
| Self::__Unknown { ordinal } => Err(ordinal), |
| _ => Ok(self), |
| } |
| } |
| |
| #[inline] |
| pub fn is_unknown(&self) -> bool { |
| match self { |
| #[allow(deprecated)] |
| Self::__Unknown { .. } => true, |
| _ => false, |
| } |
| } |
| } |
| |
| impl fidl::encoding::TopLevel for MainProtocolOnAnonRequest {} |
| |
| impl fidl::encoding::Persistable for MainProtocolOnAnonRequest {} |
| |
| fidl_union! { |
| name: MainProtocolOnAnonRequest, |
| members: [ |
| B { |
| ty: bool, |
| ordinal: 1, |
| }, |
| ], |
| 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)] |
| #[non_exhaustive] |
| __Unknown { |
| ordinal: u64, |
| }, |
| } |
| /// Pattern that matches an unknown `MainProtocolTwoWayAnonRequest` member. |
| #[macro_export] |
| macro_rules! MainProtocolTwoWayAnonRequestUnknown { |
| () => { |
| _ |
| }; |
| } |
| |
| impl MainProtocolTwoWayAnonRequest { |
| #[inline] |
| pub fn unknown_variant_for_testing() -> Self { |
| #[allow(deprecated)] |
| Self::__Unknown { ordinal: 0 } |
| } |
| |
| #[inline] |
| pub fn validate(self) -> std::result::Result<Self, u64> { |
| match self { |
| #[allow(deprecated)] |
| Self::__Unknown { ordinal } => Err(ordinal), |
| _ => Ok(self), |
| } |
| } |
| |
| #[inline] |
| pub fn is_unknown(&self) -> bool { |
| match self { |
| #[allow(deprecated)] |
| Self::__Unknown { .. } => true, |
| _ => false, |
| } |
| } |
| } |
| |
| impl fidl::encoding::TopLevel for MainProtocolTwoWayAnonRequest {} |
| |
| impl fidl::encoding::Persistable for MainProtocolTwoWayAnonRequest {} |
| |
| fidl_union! { |
| name: MainProtocolTwoWayAnonRequest, |
| members: [ |
| B { |
| ty: bool, |
| ordinal: 1, |
| }, |
| ], |
| 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)] |
| #[non_exhaustive] |
| __Unknown { |
| ordinal: u64, |
| }, |
| } |
| /// Pattern that matches an unknown `MainProtocolTwoWayAnonWithErrorResponse` member. |
| #[macro_export] |
| macro_rules! MainProtocolTwoWayAnonWithErrorResponseUnknown { |
| () => { |
| _ |
| }; |
| } |
| |
| impl MainProtocolTwoWayAnonWithErrorResponse { |
| #[inline] |
| pub fn unknown_variant_for_testing() -> Self { |
| #[allow(deprecated)] |
| Self::__Unknown { ordinal: 0 } |
| } |
| |
| #[inline] |
| pub fn validate(self) -> std::result::Result<Self, u64> { |
| match self { |
| #[allow(deprecated)] |
| Self::__Unknown { ordinal } => Err(ordinal), |
| _ => Ok(self), |
| } |
| } |
| |
| #[inline] |
| pub fn is_unknown(&self) -> bool { |
| match self { |
| #[allow(deprecated)] |
| Self::__Unknown { .. } => true, |
| _ => false, |
| } |
| } |
| } |
| |
| impl fidl::encoding::TopLevel for MainProtocolTwoWayAnonWithErrorResponse {} |
| |
| impl fidl::encoding::Persistable for MainProtocolTwoWayAnonWithErrorResponse {} |
| |
| fidl_union! { |
| name: MainProtocolTwoWayAnonWithErrorResponse, |
| members: [ |
| B { |
| ty: bool, |
| ordinal: 1, |
| }, |
| ], |
| unknown_member: __Unknown, |
| } |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub enum UnionPayload { |
| B(bool), |
| } |
| |
| impl UnionPayload { |
| #[deprecated = "Strict unions should not use `validate`"] |
| #[inline] |
| pub fn validate(self) -> std::result::Result<Self, (u64, Vec<u8>)> { |
| Ok(self) |
| } |
| |
| #[deprecated = "Strict unions should not use `is_unknown`"] |
| #[inline] |
| pub fn is_unknown(&self) -> bool { |
| false |
| } |
| } |
| |
| impl fidl::encoding::TopLevel for UnionPayload {} |
| |
| impl fidl::encoding::Persistable for UnionPayload {} |
| |
| fidl_union! { |
| name: UnionPayload, |
| members: [ |
| B { |
| ty: bool, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Clone, PartialEq)] |
| pub struct ComposedProtocolOneWayAnonComposedRequest { |
| pub a: Option<u16>, |
| #[deprecated = "Use `..ComposedProtocolOneWayAnonComposedRequest::EMPTY` to construct and `..` to match."] |
| #[doc(hidden)] |
| pub __non_exhaustive: (), |
| } |
| |
| impl ComposedProtocolOneWayAnonComposedRequest { |
| /// An empty table with every field set to `None`. |
| #[allow(deprecated)] |
| pub const EMPTY: Self = Self { a: None, __non_exhaustive: () }; |
| } |
| |
| impl fidl::encoding::TopLevel for ComposedProtocolOneWayAnonComposedRequest {} |
| |
| impl fidl::encoding::Persistable for ComposedProtocolOneWayAnonComposedRequest {} |
| |
| fidl_table! { |
| name: ComposedProtocolOneWayAnonComposedRequest, |
| members: [ |
| a { |
| ty: u16, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Clone, PartialEq)] |
| pub struct ComposedProtocolTwoWayAnonComposedResponse { |
| pub a: Option<u16>, |
| #[deprecated = "Use `..ComposedProtocolTwoWayAnonComposedResponse::EMPTY` to construct and `..` to match."] |
| #[doc(hidden)] |
| pub __non_exhaustive: (), |
| } |
| |
| impl ComposedProtocolTwoWayAnonComposedResponse { |
| /// An empty table with every field set to `None`. |
| #[allow(deprecated)] |
| pub const EMPTY: Self = Self { a: None, __non_exhaustive: () }; |
| } |
| |
| impl fidl::encoding::TopLevel for ComposedProtocolTwoWayAnonComposedResponse {} |
| |
| impl fidl::encoding::Persistable for ComposedProtocolTwoWayAnonComposedResponse {} |
| |
| fidl_table! { |
| name: ComposedProtocolTwoWayAnonComposedResponse, |
| members: [ |
| a { |
| ty: u16, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Clone, PartialEq)] |
| pub struct ComposedProtocolTwoWayAnonComposedWithErrorRequest { |
| pub a: Option<u16>, |
| #[deprecated = "Use `..ComposedProtocolTwoWayAnonComposedWithErrorRequest::EMPTY` to construct and `..` to match."] |
| #[doc(hidden)] |
| pub __non_exhaustive: (), |
| } |
| |
| impl ComposedProtocolTwoWayAnonComposedWithErrorRequest { |
| /// An empty table with every field set to `None`. |
| #[allow(deprecated)] |
| pub const EMPTY: Self = Self { a: None, __non_exhaustive: () }; |
| } |
| |
| impl fidl::encoding::TopLevel for ComposedProtocolTwoWayAnonComposedWithErrorRequest {} |
| |
| impl fidl::encoding::Persistable for ComposedProtocolTwoWayAnonComposedWithErrorRequest {} |
| |
| fidl_table! { |
| name: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| members: [ |
| a { |
| ty: u16, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Clone, PartialEq)] |
| pub struct ComposedProtocolOnAnonComposedWithErrorResponse { |
| pub a: Option<u16>, |
| #[deprecated = "Use `..ComposedProtocolOnAnonComposedWithErrorResponse::EMPTY` to construct and `..` to match."] |
| #[doc(hidden)] |
| pub __non_exhaustive: (), |
| } |
| |
| impl ComposedProtocolOnAnonComposedWithErrorResponse { |
| /// An empty table with every field set to `None`. |
| #[allow(deprecated)] |
| pub const EMPTY: Self = Self { a: None, __non_exhaustive: () }; |
| } |
| |
| impl fidl::encoding::TopLevel for ComposedProtocolOnAnonComposedWithErrorResponse {} |
| |
| impl fidl::encoding::Persistable for ComposedProtocolOnAnonComposedWithErrorResponse {} |
| |
| fidl_table! { |
| name: ComposedProtocolOnAnonComposedWithErrorResponse, |
| members: [ |
| a { |
| ty: u16, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Clone, PartialEq)] |
| pub struct MainProtocolOneWayAnonRequest { |
| pub a: Option<u16>, |
| #[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, __non_exhaustive: () }; |
| } |
| |
| impl fidl::encoding::TopLevel for MainProtocolOneWayAnonRequest {} |
| |
| impl fidl::encoding::Persistable for MainProtocolOneWayAnonRequest {} |
| |
| fidl_table! { |
| name: MainProtocolOneWayAnonRequest, |
| members: [ |
| a { |
| ty: u16, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Clone, PartialEq)] |
| pub struct MainProtocolTwoWayAnonResponse { |
| pub a: Option<u16>, |
| #[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, __non_exhaustive: () }; |
| } |
| |
| impl fidl::encoding::TopLevel for MainProtocolTwoWayAnonResponse {} |
| |
| impl fidl::encoding::Persistable for MainProtocolTwoWayAnonResponse {} |
| |
| fidl_table! { |
| name: MainProtocolTwoWayAnonResponse, |
| members: [ |
| a { |
| ty: u16, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Clone, PartialEq)] |
| pub struct MainProtocolTwoWayAnonWithErrorRequest { |
| pub a: Option<u16>, |
| #[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, __non_exhaustive: () }; |
| } |
| |
| impl fidl::encoding::TopLevel for MainProtocolTwoWayAnonWithErrorRequest {} |
| |
| impl fidl::encoding::Persistable for MainProtocolTwoWayAnonWithErrorRequest {} |
| |
| fidl_table! { |
| name: MainProtocolTwoWayAnonWithErrorRequest, |
| members: [ |
| a { |
| ty: u16, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Clone, PartialEq)] |
| pub struct MainProtocolOnAnonWithErrorResponse { |
| pub a: Option<u16>, |
| #[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, __non_exhaustive: () }; |
| } |
| |
| impl fidl::encoding::TopLevel for MainProtocolOnAnonWithErrorResponse {} |
| |
| impl fidl::encoding::Persistable for MainProtocolOnAnonWithErrorResponse {} |
| |
| fidl_table! { |
| name: MainProtocolOnAnonWithErrorResponse, |
| members: [ |
| a { |
| ty: u16, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Clone, PartialEq)] |
| pub struct TablePayload { |
| pub a: Option<u16>, |
| #[deprecated = "Use `..TablePayload::EMPTY` to construct and `..` to match."] |
| #[doc(hidden)] |
| pub __non_exhaustive: (), |
| } |
| |
| impl TablePayload { |
| /// An empty table with every field set to `None`. |
| #[allow(deprecated)] |
| pub const EMPTY: Self = Self { a: None, __non_exhaustive: () }; |
| } |
| |
| impl fidl::encoding::TopLevel for TablePayload {} |
| |
| impl fidl::encoding::Persistable for TablePayload {} |
| |
| fidl_table! { |
| name: TablePayload, |
| members: [ |
| a { |
| ty: u16, |
| ordinal: 1, |
| }, |
| ], |
| } |
| |
| #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] |
| pub struct ComposedProtocolMarker; |
| |
| impl fidl::endpoints::ProtocolMarker for ComposedProtocolMarker { |
| type Proxy = ComposedProtocolProxy; |
| type RequestStream = ComposedProtocolRequestStream; |
| const DEBUG_NAME: &'static str = "(anonymous) ComposedProtocol"; |
| } |
| |
| pub trait ComposedProtocolProxyInterface: Send + Sync { |
| fn r#one_way_anon_composed( |
| &self, |
| payload: ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error>; |
| type TwoWayAnonComposedResponseFut: std::future::Future< |
| Output = Result<(ComposedProtocolTwoWayAnonComposedResponse), fidl::Error>, |
| > + Send; |
| fn r#two_way_anon_composed( |
| &self, |
| payload: &mut ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> Self::TwoWayAnonComposedResponseFut; |
| type TwoWayAnonComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<(ComposedProtocolTwoWayAnonComposedWithErrorResult), fidl::Error>, |
| > + Send; |
| fn r#two_way_anon_composed_with_error( |
| &self, |
| payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> Self::TwoWayAnonComposedWithErrorResponseFut; |
| type OnAnonComposedResponseFut: std::future::Future<Output = Result<(ComposedProtocolOnAnonComposedRequest), fidl::Error>> |
| + Send; |
| type OnAnonComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<(ComposedProtocolOnAnonComposedWithErrorResult), fidl::Error>, |
| > + Send; |
| fn r#one_way_named_composed(&self, payload: TablePayload) -> Result<(), fidl::Error>; |
| type TwoWayNamedComposedResponseFut: std::future::Future<Output = Result<(TablePayload), fidl::Error>> |
| + Send; |
| fn r#two_way_named_composed( |
| &self, |
| payload: &mut UnionPayload, |
| ) -> Self::TwoWayNamedComposedResponseFut; |
| type TwoWayNamedComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<(ComposedProtocolTwoWayNamedComposedWithErrorResult), fidl::Error>, |
| > + Send; |
| fn r#two_way_named_composed_with_error( |
| &self, |
| payload: TablePayload, |
| ) -> Self::TwoWayNamedComposedWithErrorResponseFut; |
| type OnNamedComposedResponseFut: std::future::Future<Output = Result<(UnionPayload), fidl::Error>> |
| + Send; |
| type OnNamedComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<(ComposedProtocolOnNamedComposedWithErrorResult), fidl::Error>, |
| > + Send; |
| } |
| |
| #[derive(Debug)] |
| #[cfg(target_os = "fuchsia")] |
| pub struct ComposedProtocolSynchronousProxy { |
| client: fidl::client::sync::Client, |
| } |
| |
| #[cfg(target_os = "fuchsia")] |
| impl ComposedProtocolSynchronousProxy { |
| pub fn new(channel: fidl::Channel) -> Self { |
| let protocol_name = <ComposedProtocolMarker 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<ComposedProtocolEvent, fidl::Error> { |
| ComposedProtocolEvent::decode(self.client.wait_for_event(deadline)?) |
| } |
| pub fn r#one_way_anon_composed( |
| &self, |
| mut payload: ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<_, false>( |
| &mut (payload,), |
| 0x6e7a205bdad7941f, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| pub fn r#two_way_anon_composed( |
| &self, |
| mut payload: &mut ComposedProtocolTwoWayAnonComposedRequest, |
| ___deadline: zx::Time, |
| ) -> Result<(ComposedProtocolTwoWayAnonComposedResponse), fidl::Error> { |
| let _value: (ComposedProtocolTwoWayAnonComposedResponse,) = |
| self.client.send_query::<_, _, false, true>( |
| &mut (payload), |
| 0x7083713dee9435f4, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_value.0) |
| } |
| pub fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ___deadline: zx::Time, |
| ) -> Result<(ComposedProtocolTwoWayAnonComposedWithErrorResult), fidl::Error> { |
| let _value: ComposedProtocolTwoWayAnonComposedWithErrorResultHandleWrapper = |
| self.client.send_query::<_, _, false, false>( |
| &mut (payload), |
| 0x4fd32c5e2ffa6828, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_value.map(|_value| _value.0)) |
| } |
| pub fn r#one_way_named_composed(&self, mut payload: TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<_, false>( |
| &mut (payload,), |
| 0x101636a8fa3e69b8, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| pub fn r#two_way_named_composed( |
| &self, |
| mut payload: &mut UnionPayload, |
| ___deadline: zx::Time, |
| ) -> Result<(TablePayload), fidl::Error> { |
| let _value: (TablePayload,) = self.client.send_query::<_, _, false, true>( |
| &mut (payload), |
| 0x45b4d3d31b374054, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_value.0) |
| } |
| pub fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: TablePayload, |
| ___deadline: zx::Time, |
| ) -> Result<(ComposedProtocolTwoWayNamedComposedWithErrorResult), fidl::Error> { |
| let _value: ComposedProtocolTwoWayNamedComposedWithErrorResultHandleWrapper = |
| self.client.send_query::<_, _, false, false>( |
| &mut (payload), |
| 0x450531e2d20c52ef, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_value.map(|_value| _value.0)) |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ComposedProtocolProxy { |
| client: fidl::client::Client, |
| } |
| |
| impl fidl::endpoints::Proxy for ComposedProtocolProxy { |
| type Protocol = ComposedProtocolMarker; |
| |
| 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 ComposedProtocolProxy { |
| /// Create a new Proxy for ComposedProtocol |
| pub fn new(channel: fidl::AsyncChannel) -> Self { |
| let protocol_name = <ComposedProtocolMarker 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 ComposedProtocol protocol |
| /// |
| /// # Panics |
| /// |
| /// Panics if the event stream was already taken. |
| pub fn take_event_stream(&self) -> ComposedProtocolEventStream { |
| ComposedProtocolEventStream { event_receiver: self.client.take_event_receiver() } |
| } |
| pub fn r#one_way_anon_composed( |
| &self, |
| mut payload: ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| ComposedProtocolProxyInterface::r#one_way_anon_composed(self, payload) |
| } |
| pub fn r#two_way_anon_composed( |
| &self, |
| mut payload: &mut ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> fidl::client::QueryResponseFut<(ComposedProtocolTwoWayAnonComposedResponse)> { |
| ComposedProtocolProxyInterface::r#two_way_anon_composed(self, payload) |
| } |
| pub fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> fidl::client::QueryResponseFut<(ComposedProtocolTwoWayAnonComposedWithErrorResult)> { |
| ComposedProtocolProxyInterface::r#two_way_anon_composed_with_error(self, payload) |
| } |
| pub fn r#one_way_named_composed(&self, mut payload: TablePayload) -> Result<(), fidl::Error> { |
| ComposedProtocolProxyInterface::r#one_way_named_composed(self, payload) |
| } |
| pub fn r#two_way_named_composed( |
| &self, |
| mut payload: &mut UnionPayload, |
| ) -> fidl::client::QueryResponseFut<(TablePayload)> { |
| ComposedProtocolProxyInterface::r#two_way_named_composed(self, payload) |
| } |
| pub fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: TablePayload, |
| ) -> fidl::client::QueryResponseFut<(ComposedProtocolTwoWayNamedComposedWithErrorResult)> { |
| ComposedProtocolProxyInterface::r#two_way_named_composed_with_error(self, payload) |
| } |
| } |
| |
| impl ComposedProtocolProxyInterface for ComposedProtocolProxy { |
| fn r#one_way_anon_composed( |
| &self, |
| mut payload: ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<_, false>( |
| &mut (payload), |
| 0x6e7a205bdad7941f, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| type TwoWayAnonComposedResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolTwoWayAnonComposedResponse)>; |
| fn r#two_way_anon_composed( |
| &self, |
| mut payload: &mut ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> Self::TwoWayAnonComposedResponseFut { |
| fn transform( |
| result: Result<(ComposedProtocolTwoWayAnonComposedResponse,), fidl::Error>, |
| ) -> Result<(ComposedProtocolTwoWayAnonComposedResponse), fidl::Error> { |
| result.map(|_value| _value.0) |
| } |
| let send_result = self.client.call_send_raw_query::<_, false>( |
| &mut (payload), |
| 0x7083713dee9435f4, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, true>(buf, transform)), |
| ), |
| Err(e) => MaybeDone::Done(Err(e)), |
| }) |
| } |
| type TwoWayAnonComposedWithErrorResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolTwoWayAnonComposedWithErrorResult)>; |
| fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> Self::TwoWayAnonComposedWithErrorResponseFut { |
| fn transform( |
| result: Result< |
| ComposedProtocolTwoWayAnonComposedWithErrorResultHandleWrapper, |
| fidl::Error, |
| >, |
| ) -> Result<(ComposedProtocolTwoWayAnonComposedWithErrorResult), fidl::Error> { |
| result.map(|_value| _value.map(|_value| _value.0)) |
| } |
| let send_result = self.client.call_send_raw_query::<_, false>( |
| &mut (payload), |
| 0x4fd32c5e2ffa6828, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, false>(buf, transform)), |
| ), |
| Err(e) => MaybeDone::Done(Err(e)), |
| }) |
| } |
| type OnAnonComposedResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolOnAnonComposedRequest)>; |
| type OnAnonComposedWithErrorResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolOnAnonComposedWithErrorResult)>; |
| fn r#one_way_named_composed(&self, mut payload: TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<_, false>( |
| &mut (payload), |
| 0x101636a8fa3e69b8, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| type TwoWayNamedComposedResponseFut = fidl::client::QueryResponseFut<(TablePayload)>; |
| fn r#two_way_named_composed( |
| &self, |
| mut payload: &mut UnionPayload, |
| ) -> Self::TwoWayNamedComposedResponseFut { |
| fn transform( |
| result: Result<(TablePayload,), fidl::Error>, |
| ) -> Result<(TablePayload), fidl::Error> { |
| result.map(|_value| _value.0) |
| } |
| let send_result = self.client.call_send_raw_query::<_, false>( |
| &mut (payload), |
| 0x45b4d3d31b374054, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, true>(buf, transform)), |
| ), |
| Err(e) => MaybeDone::Done(Err(e)), |
| }) |
| } |
| type TwoWayNamedComposedWithErrorResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolTwoWayNamedComposedWithErrorResult)>; |
| fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: TablePayload, |
| ) -> Self::TwoWayNamedComposedWithErrorResponseFut { |
| fn transform( |
| result: Result< |
| ComposedProtocolTwoWayNamedComposedWithErrorResultHandleWrapper, |
| fidl::Error, |
| >, |
| ) -> Result<(ComposedProtocolTwoWayNamedComposedWithErrorResult), fidl::Error> { |
| result.map(|_value| _value.map(|_value| _value.0)) |
| } |
| let send_result = self.client.call_send_raw_query::<_, false>( |
| &mut (payload), |
| 0x450531e2d20c52ef, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, false>(buf, transform)), |
| ), |
| Err(e) => MaybeDone::Done(Err(e)), |
| }) |
| } |
| type OnNamedComposedResponseFut = fidl::client::QueryResponseFut<(UnionPayload)>; |
| type OnNamedComposedWithErrorResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolOnNamedComposedWithErrorResult)>; |
| } |
| |
| pub struct ComposedProtocolEventStream { |
| event_receiver: fidl::client::EventReceiver, |
| } |
| |
| impl std::marker::Unpin for ComposedProtocolEventStream {} |
| |
| impl futures::stream::FusedStream for ComposedProtocolEventStream { |
| fn is_terminated(&self) -> bool { |
| self.event_receiver.is_terminated() |
| } |
| } |
| |
| impl futures::Stream for ComposedProtocolEventStream { |
| type Item = Result<ComposedProtocolEvent, 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(ComposedProtocolEvent::decode(buf))) |
| } |
| } |
| |
| #[derive(Debug)] |
| pub enum ComposedProtocolEvent { |
| OnAnonComposed { payload: ComposedProtocolOnAnonComposedRequest }, |
| |
| OnAnonComposedWithError { result: ComposedProtocolOnAnonComposedWithErrorResult }, |
| |
| OnNamedComposed { payload: UnionPayload }, |
| |
| OnNamedComposedWithError { result: ComposedProtocolOnNamedComposedWithErrorResult }, |
| } |
| |
| impl ComposedProtocolEvent { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_anon_composed(self) -> Option<(ComposedProtocolOnAnonComposedRequest)> { |
| if let ComposedProtocolEvent::OnAnonComposed { payload } = self { |
| Some((payload)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_anon_composed_with_error( |
| self, |
| ) -> Option<(ComposedProtocolOnAnonComposedWithErrorResult)> { |
| if let ComposedProtocolEvent::OnAnonComposedWithError { result } = self { |
| Some((result)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_named_composed(self) -> Option<(UnionPayload)> { |
| if let ComposedProtocolEvent::OnNamedComposed { payload } = self { |
| Some((payload)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_named_composed_with_error( |
| self, |
| ) -> Option<(ComposedProtocolOnNamedComposedWithErrorResult)> { |
| if let ComposedProtocolEvent::OnNamedComposedWithError { result } = self { |
| Some((result)) |
| } else { |
| None |
| } |
| } |
| |
| /// Decodes a message buffer as a [`ComposedProtocolEvent`]. Transaction |
| /// ID in the message must be zero; this method does not check TXID. |
| fn decode(mut buf: fidl::MessageBufEtc) -> Result<ComposedProtocolEvent, fidl::Error> { |
| let (bytes, _handles) = buf.split_mut(); |
| let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?; |
| |
| match tx_header.ordinal() { |
| 0x49a6eee3a0300e28 => { |
| let mut out_tuple: (ComposedProtocolOnAnonComposedRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/ComposedProtocolOnAnonComposedEvent"); |
| 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((ComposedProtocolEvent::OnAnonComposed { payload: out_tuple.0 })) |
| } |
| 0x297a909727d08a60 => { |
| let mut out_tuple: (ComposedProtocolOnAnonComposedWithErrorResult,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/ComposedProtocolOnAnonComposedWithErrorEvent"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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((ComposedProtocolEvent::OnAnonComposedWithError { result: out_tuple.0 })) |
| } |
| 0x17c4edb4a4a36d7b => { |
| let mut out_tuple: (UnionPayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/ComposedProtocolOnNamedComposedEvent"); |
| 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((ComposedProtocolEvent::OnNamedComposed { payload: out_tuple.0 })) |
| } |
| 0x3ff74c1cafdbabcf => { |
| let mut out_tuple: (ComposedProtocolOnNamedComposedWithErrorResult,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/ComposedProtocolOnNamedComposedWithErrorEvent"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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((ComposedProtocolEvent::OnNamedComposedWithError { result: out_tuple.0 })) |
| } |
| _ => Err(fidl::Error::UnknownOrdinal { |
| ordinal: tx_header.ordinal(), |
| protocol_name: |
| <ComposedProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| } |
| } |
| } |
| |
| /// A Stream of incoming requests for ComposedProtocol |
| pub struct ComposedProtocolRequestStream { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| is_terminated: bool, |
| } |
| |
| impl std::marker::Unpin for ComposedProtocolRequestStream {} |
| |
| impl futures::stream::FusedStream for ComposedProtocolRequestStream { |
| fn is_terminated(&self) -> bool { |
| self.is_terminated |
| } |
| } |
| |
| impl fidl::endpoints::RequestStream for ComposedProtocolRequestStream { |
| type Protocol = ComposedProtocolMarker; |
| type ControlHandle = ComposedProtocolControlHandle; |
| |
| 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 { |
| ComposedProtocolControlHandle { 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 ComposedProtocolRequestStream { |
| type Item = Result<ComposedProtocolRequest, 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 ComposedProtocolRequestStream 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() { |
| 0x6e7a205bdad7941f => { |
| let mut req: (ComposedProtocolOneWayAnonComposedRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/ComposedProtocolOneWayAnonComposedRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| |
| Ok(ComposedProtocolRequest::OneWayAnonComposed { |
| payload: req.0, |
| control_handle, |
| }) |
| } |
| 0x7083713dee9435f4 => { |
| let mut req: (ComposedProtocolTwoWayAnonComposedRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/ComposedProtocolTwoWayAnonComposedRequest"); |
| 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 = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| |
| Ok(ComposedProtocolRequest::TwoWayAnonComposed { |
| payload: req.0, |
| responder: ComposedProtocolTwoWayAnonComposedResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id(), |
| ordinal: header.ordinal(), |
| }, |
| }) |
| } |
| 0x4fd32c5e2ffa6828 => { |
| let mut req: (ComposedProtocolTwoWayAnonComposedWithErrorRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/ComposedProtocolTwoWayAnonComposedWithErrorRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| |
| Ok(ComposedProtocolRequest::TwoWayAnonComposedWithError { |
| payload: req.0, |
| responder: ComposedProtocolTwoWayAnonComposedWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id(), |
| ordinal: header.ordinal(), |
| }, |
| }) |
| } |
| 0x101636a8fa3e69b8 => { |
| let mut req: (TablePayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/ComposedProtocolOneWayNamedComposedRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| |
| Ok(ComposedProtocolRequest::OneWayNamedComposed { |
| payload: req.0, |
| control_handle, |
| }) |
| } |
| 0x45b4d3d31b374054 => { |
| let mut req: (UnionPayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/ComposedProtocolTwoWayNamedComposedRequest"); |
| 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 = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| |
| Ok(ComposedProtocolRequest::TwoWayNamedComposed { |
| payload: req.0, |
| responder: ComposedProtocolTwoWayNamedComposedResponder { |
| control_handle: std::mem::ManuallyDrop::new(control_handle), |
| tx_id: header.tx_id(), |
| ordinal: header.ordinal(), |
| }, |
| }) |
| } |
| 0x450531e2d20c52ef => { |
| let mut req: (TablePayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/ComposedProtocolTwoWayNamedComposedWithErrorRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 = |
| ComposedProtocolControlHandle { inner: this.inner.clone() }; |
| |
| Ok(ComposedProtocolRequest::TwoWayNamedComposedWithError { |
| payload: req.0, |
| responder: ComposedProtocolTwoWayNamedComposedWithErrorResponder { |
| 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: |
| <ComposedProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME, |
| }), |
| })) |
| }) |
| } |
| } |
| #[derive(Debug)] |
| pub enum ComposedProtocolRequest { |
| OneWayAnonComposed { |
| payload: ComposedProtocolOneWayAnonComposedRequest, |
| control_handle: ComposedProtocolControlHandle, |
| }, |
| TwoWayAnonComposed { |
| payload: ComposedProtocolTwoWayAnonComposedRequest, |
| responder: ComposedProtocolTwoWayAnonComposedResponder, |
| }, |
| TwoWayAnonComposedWithError { |
| payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| responder: ComposedProtocolTwoWayAnonComposedWithErrorResponder, |
| }, |
| OneWayNamedComposed { |
| payload: TablePayload, |
| control_handle: ComposedProtocolControlHandle, |
| }, |
| TwoWayNamedComposed { |
| payload: UnionPayload, |
| responder: ComposedProtocolTwoWayNamedComposedResponder, |
| }, |
| TwoWayNamedComposedWithError { |
| payload: TablePayload, |
| responder: ComposedProtocolTwoWayNamedComposedWithErrorResponder, |
| }, |
| } |
| |
| impl ComposedProtocolRequest { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_one_way_anon_composed( |
| self, |
| ) -> Option<(ComposedProtocolOneWayAnonComposedRequest, ComposedProtocolControlHandle)> { |
| if let ComposedProtocolRequest::OneWayAnonComposed { payload, control_handle } = self { |
| Some((payload, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_anon_composed( |
| self, |
| ) -> Option<( |
| ComposedProtocolTwoWayAnonComposedRequest, |
| ComposedProtocolTwoWayAnonComposedResponder, |
| )> { |
| if let ComposedProtocolRequest::TwoWayAnonComposed { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_anon_composed_with_error( |
| self, |
| ) -> Option<( |
| ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ComposedProtocolTwoWayAnonComposedWithErrorResponder, |
| )> { |
| if let ComposedProtocolRequest::TwoWayAnonComposedWithError { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_one_way_named_composed( |
| self, |
| ) -> Option<(TablePayload, ComposedProtocolControlHandle)> { |
| if let ComposedProtocolRequest::OneWayNamedComposed { payload, control_handle } = self { |
| Some((payload, control_handle)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_named_composed( |
| self, |
| ) -> Option<(UnionPayload, ComposedProtocolTwoWayNamedComposedResponder)> { |
| if let ComposedProtocolRequest::TwoWayNamedComposed { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_two_way_named_composed_with_error( |
| self, |
| ) -> Option<(TablePayload, ComposedProtocolTwoWayNamedComposedWithErrorResponder)> { |
| if let ComposedProtocolRequest::TwoWayNamedComposedWithError { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| /// Name of the method defined in FIDL |
| pub fn method_name(&self) -> &'static str { |
| match *self { |
| ComposedProtocolRequest::OneWayAnonComposed { .. } => "one_way_anon_composed", |
| ComposedProtocolRequest::TwoWayAnonComposed { .. } => "two_way_anon_composed", |
| ComposedProtocolRequest::TwoWayAnonComposedWithError { .. } => { |
| "two_way_anon_composed_with_error" |
| } |
| ComposedProtocolRequest::OneWayNamedComposed { .. } => "one_way_named_composed", |
| ComposedProtocolRequest::TwoWayNamedComposed { .. } => "two_way_named_composed", |
| ComposedProtocolRequest::TwoWayNamedComposedWithError { .. } => { |
| "two_way_named_composed_with_error" |
| } |
| } |
| } |
| } |
| |
| #[derive(Debug, Clone)] |
| pub struct ComposedProtocolControlHandle { |
| inner: std::sync::Arc<fidl::ServeInner>, |
| } |
| |
| impl fidl::endpoints::ControlHandle for ComposedProtocolControlHandle { |
| fn shutdown(&self) { |
| self.inner.shutdown() |
| } |
| |
| fn shutdown_with_epitaph(&self, status: zx_status::Status) { |
| self.inner.shutdown_with_epitaph(status) |
| } |
| } |
| |
| impl ComposedProtocolControlHandle { |
| pub fn send_on_anon_composed( |
| &self, |
| mut payload: &mut ComposedProtocolOnAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| let mut response = (payload); |
| |
| let mut msg = fidl::encoding::TransactionMessage { |
| header: fidl::encoding::TransactionHeader::new( |
| 0, |
| 0x49a6eee3a0300e28, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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 ComposedProtocolOnAnonComposedWithErrorResult, |
| ) -> Result<(), fidl::Error> { |
| let mut response = (result); |
| |
| let mut msg = fidl::encoding::TransactionMessage { |
| header: fidl::encoding::TransactionHeader::new( |
| 0, |
| 0x297a909727d08a60, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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 UnionPayload, |
| ) -> Result<(), fidl::Error> { |
| let mut response = (payload); |
| |
| let mut msg = fidl::encoding::TransactionMessage { |
| header: fidl::encoding::TransactionHeader::new( |
| 0, |
| 0x17c4edb4a4a36d7b, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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 ComposedProtocolOnNamedComposedWithErrorResult, |
| ) -> Result<(), fidl::Error> { |
| let mut response = (result); |
| |
| let mut msg = fidl::encoding::TransactionMessage { |
| header: fidl::encoding::TransactionHeader::new( |
| 0, |
| 0x3ff74c1cafdbabcf, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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 ComposedProtocolTwoWayAnonComposedResponder { |
| control_handle: std::mem::ManuallyDrop<ComposedProtocolControlHandle>, |
| tx_id: u32, |
| ordinal: u64, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ComposedProtocolControlHandle::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 ComposedProtocolTwoWayAnonComposedResponder { |
| 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 ComposedProtocolTwoWayAnonComposedResponder { |
| type ControlHandle = ComposedProtocolControlHandle; |
| |
| fn control_handle(&self) -> &ComposedProtocolControlHandle { |
| &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 ComposedProtocolTwoWayAnonComposedResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send( |
| self, |
| mut payload: 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: ComposedProtocolTwoWayAnonComposedResponse, |
| ) -> Result<(), fidl::Error> { |
| let r = self.send_raw(payload); |
| self.drop_without_shutdown(); |
| r |
| } |
| |
| fn send_raw( |
| &self, |
| mut payload: 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.protocollayoutssamelibrary/ComposedProtocolTwoWayAnonComposedResponse"); |
| 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 ComposedProtocolTwoWayAnonComposedWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop<ComposedProtocolControlHandle>, |
| tx_id: u32, |
| ordinal: u64, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ComposedProtocolControlHandle::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 ComposedProtocolTwoWayAnonComposedWithErrorResponder { |
| 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 ComposedProtocolTwoWayAnonComposedWithErrorResponder { |
| type ControlHandle = ComposedProtocolControlHandle; |
| |
| fn control_handle(&self) -> &ComposedProtocolControlHandle { |
| &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 ComposedProtocolTwoWayAnonComposedWithErrorResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send( |
| self, |
| mut result: &mut 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 ComposedProtocolTwoWayAnonComposedWithErrorResult, |
| ) -> Result<(), fidl::Error> { |
| let r = self.send_raw(result); |
| self.drop_without_shutdown(); |
| r |
| } |
| |
| fn send_raw( |
| &self, |
| mut _result: &mut 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.protocollayoutssamelibrary/ComposedProtocolTwoWayAnonComposedWithErrorResponse"); |
| 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 ComposedProtocolTwoWayNamedComposedResponder { |
| control_handle: std::mem::ManuallyDrop<ComposedProtocolControlHandle>, |
| tx_id: u32, |
| ordinal: u64, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ComposedProtocolControlHandle::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 ComposedProtocolTwoWayNamedComposedResponder { |
| 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 ComposedProtocolTwoWayNamedComposedResponder { |
| type ControlHandle = ComposedProtocolControlHandle; |
| |
| fn control_handle(&self) -> &ComposedProtocolControlHandle { |
| &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 ComposedProtocolTwoWayNamedComposedResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send(self, mut payload: TablePayload) -> 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: TablePayload) -> Result<(), fidl::Error> { |
| let r = self.send_raw(payload); |
| self.drop_without_shutdown(); |
| r |
| } |
| |
| fn send_raw(&self, mut payload: TablePayload) -> 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.protocollayoutssamelibrary/ComposedProtocolTwoWayNamedComposedResponse"); |
| 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 ComposedProtocolTwoWayNamedComposedWithErrorResponder { |
| control_handle: std::mem::ManuallyDrop<ComposedProtocolControlHandle>, |
| tx_id: u32, |
| ordinal: u64, |
| } |
| |
| /// Set the the channel to be shutdown (see [`ComposedProtocolControlHandle::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 ComposedProtocolTwoWayNamedComposedWithErrorResponder { |
| 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 ComposedProtocolTwoWayNamedComposedWithErrorResponder { |
| type ControlHandle = ComposedProtocolControlHandle; |
| |
| fn control_handle(&self) -> &ComposedProtocolControlHandle { |
| &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 ComposedProtocolTwoWayNamedComposedWithErrorResponder { |
| /// Sends a response to the FIDL transaction. |
| /// |
| /// Sets the channel to shutdown if an error occurs. |
| pub fn send( |
| self, |
| mut result: &mut 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 ComposedProtocolTwoWayNamedComposedWithErrorResult, |
| ) -> Result<(), fidl::Error> { |
| let r = self.send_raw(result); |
| self.drop_without_shutdown(); |
| r |
| } |
| |
| fn send_raw( |
| &self, |
| mut _result: &mut 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.protocollayoutssamelibrary/ComposedProtocolTwoWayNamedComposedWithErrorResponse"); |
| 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(()) |
| }) |
| } |
| } |
| |
| #[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: ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error>; |
| type TwoWayAnonComposedResponseFut: std::future::Future< |
| Output = Result<(ComposedProtocolTwoWayAnonComposedResponse), fidl::Error>, |
| > + Send; |
| fn r#two_way_anon_composed( |
| &self, |
| payload: &mut ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> Self::TwoWayAnonComposedResponseFut; |
| type TwoWayAnonComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<(ComposedProtocolTwoWayAnonComposedWithErrorResult), fidl::Error>, |
| > + Send; |
| fn r#two_way_anon_composed_with_error( |
| &self, |
| payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> Self::TwoWayAnonComposedWithErrorResponseFut; |
| type OnAnonComposedResponseFut: std::future::Future<Output = Result<(ComposedProtocolOnAnonComposedRequest), fidl::Error>> |
| + Send; |
| type OnAnonComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<(ComposedProtocolOnAnonComposedWithErrorResult), fidl::Error>, |
| > + Send; |
| fn r#one_way_named_composed(&self, payload: TablePayload) -> Result<(), fidl::Error>; |
| type TwoWayNamedComposedResponseFut: std::future::Future<Output = Result<(TablePayload), fidl::Error>> |
| + Send; |
| fn r#two_way_named_composed( |
| &self, |
| payload: &mut UnionPayload, |
| ) -> Self::TwoWayNamedComposedResponseFut; |
| type TwoWayNamedComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<(ComposedProtocolTwoWayNamedComposedWithErrorResult), fidl::Error>, |
| > + Send; |
| fn r#two_way_named_composed_with_error( |
| &self, |
| payload: TablePayload, |
| ) -> Self::TwoWayNamedComposedWithErrorResponseFut; |
| type OnNamedComposedResponseFut: std::future::Future<Output = Result<(UnionPayload), fidl::Error>> |
| + Send; |
| type OnNamedComposedWithErrorResponseFut: std::future::Future< |
| Output = Result<(ComposedProtocolOnNamedComposedWithErrorResult), fidl::Error>, |
| > + Send; |
| fn r#one_way_local(&self, payload: TablePayload) -> Result<(), fidl::Error>; |
| type TwoWayLocalResponseFut: std::future::Future<Output = Result<(TablePayload), fidl::Error>> |
| + Send; |
| fn r#two_way_local(&self, payload: &mut UnionPayload) -> Self::TwoWayLocalResponseFut; |
| type TwoWayLocalWithErrorResponseFut: std::future::Future<Output = Result<(MainProtocolTwoWayLocalWithErrorResult), fidl::Error>> |
| + Send; |
| fn r#two_way_local_with_error( |
| &self, |
| payload: TablePayload, |
| ) -> Self::TwoWayLocalWithErrorResponseFut; |
| type OnLocalResponseFut: std::future::Future<Output = Result<(UnionPayload), 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: ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<_, false>( |
| &mut (payload,), |
| 0x6e7a205bdad7941f, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| pub fn r#two_way_anon_composed( |
| &self, |
| mut payload: &mut ComposedProtocolTwoWayAnonComposedRequest, |
| ___deadline: zx::Time, |
| ) -> Result<(ComposedProtocolTwoWayAnonComposedResponse), fidl::Error> { |
| let _value: (ComposedProtocolTwoWayAnonComposedResponse,) = |
| self.client.send_query::<_, _, false, true>( |
| &mut (payload), |
| 0x7083713dee9435f4, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_value.0) |
| } |
| pub fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ___deadline: zx::Time, |
| ) -> Result<(ComposedProtocolTwoWayAnonComposedWithErrorResult), fidl::Error> { |
| let _value: ComposedProtocolTwoWayAnonComposedWithErrorResultHandleWrapper = |
| self.client.send_query::<_, _, false, false>( |
| &mut (payload), |
| 0x4fd32c5e2ffa6828, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_value.map(|_value| _value.0)) |
| } |
| pub fn r#one_way_named_composed(&self, mut payload: TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<_, false>( |
| &mut (payload,), |
| 0x101636a8fa3e69b8, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| pub fn r#two_way_named_composed( |
| &self, |
| mut payload: &mut UnionPayload, |
| ___deadline: zx::Time, |
| ) -> Result<(TablePayload), fidl::Error> { |
| let _value: (TablePayload,) = self.client.send_query::<_, _, false, true>( |
| &mut (payload), |
| 0x45b4d3d31b374054, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_value.0) |
| } |
| pub fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: TablePayload, |
| ___deadline: zx::Time, |
| ) -> Result<(ComposedProtocolTwoWayNamedComposedWithErrorResult), fidl::Error> { |
| let _value: ComposedProtocolTwoWayNamedComposedWithErrorResultHandleWrapper = |
| self.client.send_query::<_, _, false, false>( |
| &mut (payload), |
| 0x450531e2d20c52ef, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_value.map(|_value| _value.0)) |
| } |
| pub fn r#one_way_local(&self, mut payload: TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<_, false>( |
| &mut (payload,), |
| 0x3954b4c6b80956c1, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| pub fn r#two_way_local( |
| &self, |
| mut payload: &mut UnionPayload, |
| ___deadline: zx::Time, |
| ) -> Result<(TablePayload), fidl::Error> { |
| let _value: (TablePayload,) = self.client.send_query::<_, _, false, true>( |
| &mut (payload), |
| 0x26998b4c1e8a9a57, |
| fidl::encoding::DynamicFlags::empty(), |
| ___deadline, |
| )?; |
| Ok(_value.0) |
| } |
| pub fn r#two_way_local_with_error( |
| &self, |
| mut payload: TablePayload, |
| ___deadline: zx::Time, |
| ) -> Result<(MainProtocolTwoWayLocalWithErrorResult), fidl::Error> { |
| let _value: MainProtocolTwoWayLocalWithErrorResultHandleWrapper = |
| self.client.send_query::<_, _, false, false>( |
| &mut (payload), |
| 0x4a7bf9ce881afde7, |
| 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::<_, false>( |
| &mut (payload,), |
| 0x774bf445f584ce2c, |
| 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::<_, _, false, true>( |
| &mut (payload), |
| 0x3fd7ad8e52b07e2e, |
| 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::<_, _, false, true>( |
| &mut (payload), |
| 0x1d33061a424eb245, |
| 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: ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| MainProtocolProxyInterface::r#one_way_anon_composed(self, payload) |
| } |
| pub fn r#two_way_anon_composed( |
| &self, |
| mut payload: &mut ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> fidl::client::QueryResponseFut<(ComposedProtocolTwoWayAnonComposedResponse)> { |
| MainProtocolProxyInterface::r#two_way_anon_composed(self, payload) |
| } |
| pub fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> fidl::client::QueryResponseFut<(ComposedProtocolTwoWayAnonComposedWithErrorResult)> { |
| MainProtocolProxyInterface::r#two_way_anon_composed_with_error(self, payload) |
| } |
| pub fn r#one_way_named_composed(&self, mut payload: TablePayload) -> Result<(), fidl::Error> { |
| MainProtocolProxyInterface::r#one_way_named_composed(self, payload) |
| } |
| pub fn r#two_way_named_composed( |
| &self, |
| mut payload: &mut UnionPayload, |
| ) -> fidl::client::QueryResponseFut<(TablePayload)> { |
| MainProtocolProxyInterface::r#two_way_named_composed(self, payload) |
| } |
| pub fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: TablePayload, |
| ) -> fidl::client::QueryResponseFut<(ComposedProtocolTwoWayNamedComposedWithErrorResult)> { |
| MainProtocolProxyInterface::r#two_way_named_composed_with_error(self, payload) |
| } |
| pub fn r#one_way_local(&self, mut payload: TablePayload) -> Result<(), fidl::Error> { |
| MainProtocolProxyInterface::r#one_way_local(self, payload) |
| } |
| pub fn r#two_way_local( |
| &self, |
| mut payload: &mut UnionPayload, |
| ) -> fidl::client::QueryResponseFut<(TablePayload)> { |
| MainProtocolProxyInterface::r#two_way_local(self, payload) |
| } |
| pub fn r#two_way_local_with_error( |
| &self, |
| mut payload: TablePayload, |
| ) -> 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: ComposedProtocolOneWayAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<_, false>( |
| &mut (payload), |
| 0x6e7a205bdad7941f, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| type TwoWayAnonComposedResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolTwoWayAnonComposedResponse)>; |
| fn r#two_way_anon_composed( |
| &self, |
| mut payload: &mut ComposedProtocolTwoWayAnonComposedRequest, |
| ) -> Self::TwoWayAnonComposedResponseFut { |
| fn transform( |
| result: Result<(ComposedProtocolTwoWayAnonComposedResponse,), fidl::Error>, |
| ) -> Result<(ComposedProtocolTwoWayAnonComposedResponse), fidl::Error> { |
| result.map(|_value| _value.0) |
| } |
| let send_result = self.client.call_send_raw_query::<_, false>( |
| &mut (payload), |
| 0x7083713dee9435f4, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, true>(buf, transform)), |
| ), |
| Err(e) => MaybeDone::Done(Err(e)), |
| }) |
| } |
| type TwoWayAnonComposedWithErrorResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolTwoWayAnonComposedWithErrorResult)>; |
| fn r#two_way_anon_composed_with_error( |
| &self, |
| mut payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| ) -> Self::TwoWayAnonComposedWithErrorResponseFut { |
| fn transform( |
| result: Result< |
| ComposedProtocolTwoWayAnonComposedWithErrorResultHandleWrapper, |
| fidl::Error, |
| >, |
| ) -> Result<(ComposedProtocolTwoWayAnonComposedWithErrorResult), fidl::Error> { |
| result.map(|_value| _value.map(|_value| _value.0)) |
| } |
| let send_result = self.client.call_send_raw_query::<_, false>( |
| &mut (payload), |
| 0x4fd32c5e2ffa6828, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, false>(buf, transform)), |
| ), |
| Err(e) => MaybeDone::Done(Err(e)), |
| }) |
| } |
| type OnAnonComposedResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolOnAnonComposedRequest)>; |
| type OnAnonComposedWithErrorResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolOnAnonComposedWithErrorResult)>; |
| fn r#one_way_named_composed(&self, mut payload: TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<_, false>( |
| &mut (payload), |
| 0x101636a8fa3e69b8, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| type TwoWayNamedComposedResponseFut = fidl::client::QueryResponseFut<(TablePayload)>; |
| fn r#two_way_named_composed( |
| &self, |
| mut payload: &mut UnionPayload, |
| ) -> Self::TwoWayNamedComposedResponseFut { |
| fn transform( |
| result: Result<(TablePayload,), fidl::Error>, |
| ) -> Result<(TablePayload), fidl::Error> { |
| result.map(|_value| _value.0) |
| } |
| let send_result = self.client.call_send_raw_query::<_, false>( |
| &mut (payload), |
| 0x45b4d3d31b374054, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, true>(buf, transform)), |
| ), |
| Err(e) => MaybeDone::Done(Err(e)), |
| }) |
| } |
| type TwoWayNamedComposedWithErrorResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolTwoWayNamedComposedWithErrorResult)>; |
| fn r#two_way_named_composed_with_error( |
| &self, |
| mut payload: TablePayload, |
| ) -> Self::TwoWayNamedComposedWithErrorResponseFut { |
| fn transform( |
| result: Result< |
| ComposedProtocolTwoWayNamedComposedWithErrorResultHandleWrapper, |
| fidl::Error, |
| >, |
| ) -> Result<(ComposedProtocolTwoWayNamedComposedWithErrorResult), fidl::Error> { |
| result.map(|_value| _value.map(|_value| _value.0)) |
| } |
| let send_result = self.client.call_send_raw_query::<_, false>( |
| &mut (payload), |
| 0x450531e2d20c52ef, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, false>(buf, transform)), |
| ), |
| Err(e) => MaybeDone::Done(Err(e)), |
| }) |
| } |
| type OnNamedComposedResponseFut = fidl::client::QueryResponseFut<(UnionPayload)>; |
| type OnNamedComposedWithErrorResponseFut = |
| fidl::client::QueryResponseFut<(ComposedProtocolOnNamedComposedWithErrorResult)>; |
| fn r#one_way_local(&self, mut payload: TablePayload) -> Result<(), fidl::Error> { |
| self.client.send::<_, false>( |
| &mut (payload), |
| 0x3954b4c6b80956c1, |
| fidl::encoding::DynamicFlags::empty(), |
| ) |
| } |
| type TwoWayLocalResponseFut = fidl::client::QueryResponseFut<(TablePayload)>; |
| fn r#two_way_local(&self, mut payload: &mut UnionPayload) -> Self::TwoWayLocalResponseFut { |
| fn transform( |
| result: Result<(TablePayload,), fidl::Error>, |
| ) -> Result<(TablePayload), fidl::Error> { |
| result.map(|_value| _value.0) |
| } |
| let send_result = self.client.call_send_raw_query::<_, false>( |
| &mut (payload), |
| 0x26998b4c1e8a9a57, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, true>(buf, transform)), |
| ), |
| Err(e) => MaybeDone::Done(Err(e)), |
| }) |
| } |
| type TwoWayLocalWithErrorResponseFut = |
| fidl::client::QueryResponseFut<(MainProtocolTwoWayLocalWithErrorResult)>; |
| fn r#two_way_local_with_error( |
| &self, |
| mut payload: TablePayload, |
| ) -> 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::<_, false>( |
| &mut (payload), |
| 0x4a7bf9ce881afde7, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, false>(buf, transform)), |
| ), |
| Err(e) => MaybeDone::Done(Err(e)), |
| }) |
| } |
| type OnLocalResponseFut = fidl::client::QueryResponseFut<(UnionPayload)>; |
| type OnLocalWithErrorResponseFut = |
| fidl::client::QueryResponseFut<(MainProtocolOnLocalWithErrorResult)>; |
| fn r#one_way_anon( |
| &self, |
| mut payload: MainProtocolOneWayAnonRequest, |
| ) -> Result<(), fidl::Error> { |
| self.client.send::<_, false>( |
| &mut (payload), |
| 0x774bf445f584ce2c, |
| 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::<_, false>( |
| &mut (payload), |
| 0x3fd7ad8e52b07e2e, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, true>(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::<_, false>( |
| &mut (payload), |
| 0x1d33061a424eb245, |
| fidl::encoding::DynamicFlags::empty(), |
| ); |
| QueryResponseFut(match send_result { |
| Ok(res_fut) => future::maybe_done( |
| res_fut.and_then(|buf| decode_transaction_body_fut::<_, _, true>(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: ComposedProtocolOnAnonComposedRequest }, |
| |
| OnAnonComposedWithError { result: ComposedProtocolOnAnonComposedWithErrorResult }, |
| |
| OnNamedComposed { payload: UnionPayload }, |
| |
| OnNamedComposedWithError { result: ComposedProtocolOnNamedComposedWithErrorResult }, |
| |
| OnLocal { payload: UnionPayload }, |
| |
| OnLocalWithError { result: MainProtocolOnLocalWithErrorResult }, |
| |
| OnAnon { payload: MainProtocolOnAnonRequest }, |
| |
| OnAnonWithError { result: MainProtocolOnAnonWithErrorResult }, |
| } |
| |
| impl MainProtocolEvent { |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_anon_composed(self) -> Option<(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<(ComposedProtocolOnAnonComposedWithErrorResult)> { |
| if let MainProtocolEvent::OnAnonComposedWithError { result } = self { |
| Some((result)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_named_composed(self) -> Option<(UnionPayload)> { |
| if let MainProtocolEvent::OnNamedComposed { payload } = self { |
| Some((payload)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_named_composed_with_error( |
| self, |
| ) -> Option<(ComposedProtocolOnNamedComposedWithErrorResult)> { |
| if let MainProtocolEvent::OnNamedComposedWithError { result } = self { |
| Some((result)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_on_local(self) -> Option<(UnionPayload)> { |
| 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 |
| } |
| } |
| |
| /// Decodes a message buffer as a [`MainProtocolEvent`]. Transaction |
| /// ID in the message must be zero; this method does not check TXID. |
| fn decode(mut buf: fidl::MessageBufEtc) -> Result<MainProtocolEvent, fidl::Error> { |
| let (bytes, _handles) = buf.split_mut(); |
| let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?; |
| |
| match tx_header.ordinal() { |
| 0x49a6eee3a0300e28 => { |
| let mut out_tuple: (ComposedProtocolOnAnonComposedRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/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 })) |
| } |
| 0x297a909727d08a60 => { |
| let mut out_tuple: (ComposedProtocolOnAnonComposedWithErrorResult,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolOnAnonComposedWithErrorEvent"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 })) |
| } |
| 0x17c4edb4a4a36d7b => { |
| let mut out_tuple: (UnionPayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/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 })) |
| } |
| 0x3ff74c1cafdbabcf => { |
| let mut out_tuple: (ComposedProtocolOnNamedComposedWithErrorResult,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolOnNamedComposedWithErrorEvent"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 })) |
| } |
| 0x71e90a3d364d2e8d => { |
| let mut out_tuple: (UnionPayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/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 })) |
| } |
| 0x2dac7e32bd351bdb => { |
| let mut out_tuple: (MainProtocolOnLocalWithErrorResult,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolOnLocalWithErrorEvent"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 })) |
| } |
| 0xd8fa6d0f5fabb94 => { |
| let mut out_tuple: (MainProtocolOnAnonRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolOnAnonEvent"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 })) |
| } |
| 0x6658cf43e550fa02 => { |
| let mut out_tuple: (MainProtocolOnAnonWithErrorResult,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolOnAnonWithErrorEvent"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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() { |
| 0x6e7a205bdad7941f => { |
| let mut req: (ComposedProtocolOneWayAnonComposedRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolOneWayAnonComposedRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 }) |
| } |
| 0x7083713dee9435f4 => { |
| let mut req: (ComposedProtocolTwoWayAnonComposedRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/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(), |
| }, |
| }) |
| } |
| 0x4fd32c5e2ffa6828 => { |
| let mut req: (ComposedProtocolTwoWayAnonComposedWithErrorRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolTwoWayAnonComposedWithErrorRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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(), |
| }, |
| }) |
| } |
| 0x101636a8fa3e69b8 => { |
| let mut req: (TablePayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolOneWayNamedComposedRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 }) |
| } |
| 0x45b4d3d31b374054 => { |
| let mut req: (UnionPayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/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(), |
| }, |
| }) |
| } |
| 0x450531e2d20c52ef => { |
| let mut req: (TablePayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolTwoWayNamedComposedWithErrorRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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(), |
| }, |
| }) |
| } |
| 0x3954b4c6b80956c1 => { |
| let mut req: (TablePayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolOneWayLocalRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 }) |
| } |
| 0x26998b4c1e8a9a57 => { |
| let mut req: (UnionPayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/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(), |
| }, |
| }) |
| } |
| 0x4a7bf9ce881afde7 => { |
| let mut req: (TablePayload,) = fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolTwoWayLocalWithErrorRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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(), |
| }, |
| }) |
| } |
| 0x774bf445f584ce2c => { |
| let mut req: (MainProtocolOneWayAnonRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolOneWayAnonRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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 }) |
| } |
| 0x3fd7ad8e52b07e2e => { |
| let mut req: (MainProtocolTwoWayAnonRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolTwoWayAnonRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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(), |
| }, |
| }) |
| } |
| 0x1d33061a424eb245 => { |
| let mut req: (MainProtocolTwoWayAnonWithErrorRequest,) = |
| fidl::encoding::Decodable::new_empty(); |
| fidl::duration_begin!("fidl", "decode", "bindings" => _FIDL_TRACE_BINDINGS_RUST, "name" => "test.protocollayoutssamelibrary/MainProtocolTwoWayAnonWithErrorRequest"); |
| fidl::trace_blob!("fidl:blob", "decode", bytes); |
| fidl::encoding::maybe_overflowing_decode( |
| &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: ComposedProtocolOneWayAnonComposedRequest, |
| control_handle: MainProtocolControlHandle, |
| }, |
| TwoWayAnonComposed { |
| payload: ComposedProtocolTwoWayAnonComposedRequest, |
| responder: MainProtocolTwoWayAnonComposedResponder, |
| }, |
| TwoWayAnonComposedWithError { |
| payload: ComposedProtocolTwoWayAnonComposedWithErrorRequest, |
| responder: MainProtocolTwoWayAnonComposedWithErrorResponder, |
| }, |
| OneWayNamedComposed { |
| payload: TablePayload, |
| control_handle: MainProtocolControlHandle, |
| }, |
| TwoWayNamedComposed { |
| payload: UnionPayload, |
| responder: MainProtocolTwoWayNamedComposedResponder, |
| }, |
| TwoWayNamedComposedWithError { |
| payload: TablePayload, |
| responder: MainProtocolTwoWayNamedComposedWithErrorResponder, |
| }, |
| OneWayLocal { |
| payload: TablePayload, |
| control_handle: MainProtocolControlHandle, |
| }, |
| TwoWayLocal { |
| payload: UnionPayload, |
| responder: MainProtocolTwoWayLocalResponder, |
| }, |
| TwoWayLocalWithError { |
| payload: TablePayload, |
| 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<(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<(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<( |
| 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<(TablePayload, 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<(UnionPayload, 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<(TablePayload, MainProtocolTwoWayNamedComposedWithErrorResponder)> { |
| if let MainProtocolRequest::TwoWayNamedComposedWithError { payload, responder } = self { |
| Some((payload, responder)) |
| } else { |
| None |
| } |
| } |
| |
| #[allow(irrefutable_let_patterns)] |
| pub fn into_one_way_local(self) -> Option<(TablePayload, 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<(UnionPayload, 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<(TablePayload, 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::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 ComposedProtocolOnAnonComposedRequest, |
| ) -> Result<(), fidl::Error> { |
| let mut response = (payload); |
| |
| let mut msg = fidl::encoding::TransactionMessage { |
| header: fidl::encoding::TransactionHeader::new( |
| 0, |
| 0x49a6eee3a0300e28, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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 ComposedProtocolOnAnonComposedWithErrorResult, |
| ) -> Result<(), fidl::Error> { |
| let mut response = (result); |
| |
| let mut msg = fidl::encoding::TransactionMessage { |
| header: fidl::encoding::TransactionHeader::new( |
| 0, |
| 0x297a909727d08a60, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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 UnionPayload, |
| ) -> Result<(), fidl::Error> { |
| let mut response = (payload); |
| |
| let mut msg = fidl::encoding::TransactionMessage { |
| header: fidl::encoding::TransactionHeader::new( |
| 0, |
| 0x17c4edb4a4a36d7b, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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 ComposedProtocolOnNamedComposedWithErrorResult, |
| ) -> Result<(), fidl::Error> { |
| let mut response = (result); |
| |
| let mut msg = fidl::encoding::TransactionMessage { |
| header: fidl::encoding::TransactionHeader::new( |
| 0, |
| 0x3ff74c1cafdbabcf, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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 UnionPayload) -> Result<(), fidl::Error> { |
| let mut response = (payload); |
| |
| let mut msg = fidl::encoding::TransactionMessage { |
| header: fidl::encoding::TransactionHeader::new( |
| 0, |
| 0x71e90a3d364d2e8d, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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, |
| 0x2dac7e32bd351bdb, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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, |
| 0xd8fa6d0f5fabb94, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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, |
| 0x6658cf43e550fa02, |
| fidl::encoding::DynamicFlags::empty(), |
| ), |
| body: &mut response, |
| }; |
| |
| fidl::encoding::with_tls_encoded::<_, _, false>(&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: 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: ComposedProtocolTwoWayAnonComposedResponse, |
| ) -> Result<(), fidl::Error> { |
| let r = self.send_raw(payload); |
| self.drop_without_shutdown(); |
| r |
| } |
| |
| fn send_raw( |
| &self, |
| mut payload: 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.protocollayoutssamelibrary/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 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 ComposedProtocolTwoWayAnonComposedWithErrorResult, |
| ) -> Result<(), fidl::Error> { |
| let r = self.send_raw(result); |
| self.drop_without_shutdown(); |
| r |
| } |
| |
| fn send_raw( |
| &self, |
| mut _result: &mut 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.protocollayoutssamelibrary/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: TablePayload) -> 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: TablePayload) -> Result<(), fidl::Error> { |
| let r = self.send_raw(payload); |
| self.drop_without_shutdown(); |
| r |
| } |
| |
| fn send_raw(&self, mut payload: TablePayload) -> 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.protocollayoutssamelibrary/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 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 ComposedProtocolTwoWayNamedComposedWithErrorResult, |
| ) -> Result<(), fidl::Error> { |
| let r = self.send_raw(result); |
| self.drop_without_shutdown(); |
| r |
| } |
| |
| fn send_raw( |
| &self, |
| mut _result: &mut 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.protocollayoutssamelibrary/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 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: TablePayload) -> 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: TablePayload) -> Result<(), fidl::Error> { |
| let r = self.send_raw(payload); |
| self.drop_without_shutdown(); |
| r |
| } |
| |
| fn send_raw(&self, mut payload: TablePayload) -> 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.protocollayoutssamelibrary/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.protocollayoutssamelibrary/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.protocollayoutssamelibrary/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.protocollayoutssamelibrary/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(()) |
| }) |
| } |
| } |