#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
pub type DictionaryKey = String;
pub const MAX_DATA_LENGTH: u32 = 8192;
pub const MAX_DICTIONARY_ITEMS_CHUNK: u32 = 128;
pub const MAX_NAME_LENGTH: u64 = fidl_fuchsia_io::MAX_NAME_LENGTH as u64;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Availability {
Required = 1,
Optional = 2,
SameAsTarget = 3,
Transitional = 4,
}
impl Availability {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Required),
2 => Some(Self::Optional),
3 => Some(Self::SameAsTarget),
4 => Some(Self::Transitional),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum DictionaryError {
NotFound,
AlreadyExists,
BadCapability,
InvalidKey,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! DictionaryErrorUnknown {
() => {
_
};
}
impl DictionaryError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::NotFound),
2 => Some(Self::AlreadyExists),
3 => Some(Self::BadCapability),
4 => Some(Self::InvalidKey),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::NotFound,
2 => Self::AlreadyExists,
3 => Self::BadCapability,
4 => Self::InvalidKey,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::NotFound => 1,
Self::AlreadyExists => 2,
Self::BadCapability => 3,
Self::InvalidKey => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum HandleCapabilityError {
Unavailable = 1,
}
impl HandleCapabilityError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Unavailable),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum RouterError {
NotFound,
InvalidArgs,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! RouterErrorUnknown {
() => {
_
};
}
impl RouterError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::NotFound),
2 => Some(Self::InvalidArgs),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::NotFound,
2 => Self::InvalidArgs,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::NotFound => 1,
Self::InvalidArgs => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ComponentToken {
pub token: fidl::EventPair,
}
impl fidl::Standalone for ComponentToken {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DictionaryDrainRequest {
pub contents: Option<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
}
impl fidl::Standalone for DictionaryDrainRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DictionaryEnumerateRequest {
pub contents: fidl::endpoints::ServerEnd<DictionaryIteratorMarker>,
}
impl fidl::Standalone for DictionaryEnumerateRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DictionaryGetRequest {
pub key: String,
}
impl fidl::Persistable for DictionaryGetRequest {}
#[derive(Debug, PartialEq)]
pub struct DictionaryItem {
pub key: String,
pub value: Capability,
}
impl fidl::Standalone for DictionaryItem {}
#[derive(Debug, PartialEq)]
pub struct DictionaryIteratorGetNextResponse {
pub items: Vec<DictionaryItem>,
}
impl fidl::Standalone for DictionaryIteratorGetNextResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DictionaryRemoveRequest {
pub key: String,
}
impl fidl::Persistable for DictionaryRemoveRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DictionaryCloneResponse {
pub dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
}
impl fidl::Standalone for DictionaryCloneResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DictionaryCopyResponse {
pub dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
}
impl fidl::Standalone for DictionaryCopyResponse {}
#[derive(Debug, PartialEq)]
pub struct DictionaryGetResponse {
pub capability: Capability,
}
impl fidl::Standalone for DictionaryGetResponse {}
#[derive(Debug, PartialEq)]
pub struct DictionaryReadResponse {
pub items: Vec<DictionaryItem>,
}
impl fidl::Standalone for DictionaryReadResponse {}
#[derive(Debug, PartialEq)]
pub struct DictionaryRemoveResponse {
pub capability: Capability,
}
impl fidl::Standalone for DictionaryRemoveResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FactoryConnectToSenderRequest {
pub capability: SenderCapability,
pub server_end: fidl::endpoints::ServerEnd<SenderMarker>,
}
impl fidl::Standalone for FactoryConnectToSenderRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FactoryCreateSenderRequest {
pub receiver: fidl::endpoints::ClientEnd<ReceiverMarker>,
}
impl fidl::Standalone for FactoryCreateSenderRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FactoryCreateDictionaryResponse {
pub dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
}
impl fidl::Standalone for FactoryCreateDictionaryResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FactoryCreateSenderResponse {
pub capability: SenderCapability,
}
impl fidl::Standalone for FactoryCreateSenderResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HandleCapabilityGetHandleResponse {
pub handle: fidl::Handle,
}
impl fidl::Standalone for HandleCapabilityGetHandleResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProtocolPayload {
pub channel: fidl::Channel,
}
impl fidl::Standalone for ProtocolPayload {}
#[derive(Debug, PartialEq)]
pub struct RouterRouteResponse {
pub capability: Capability,
}
impl fidl::Standalone for RouterRouteResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct SenderCapability {
pub token: fidl::EventPair,
}
impl fidl::Standalone for SenderCapability {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct UnitCapability;
impl fidl::Persistable for UnitCapability {}
#[derive(Debug, Default, PartialEq)]
pub struct RouteRequest {
pub availability: Option<Availability>,
pub requesting: Option<ComponentToken>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone for RouteRequest {}
#[derive(Debug)]
pub enum Capability {
Unit(UnitCapability),
Handle(fidl::endpoints::ClientEnd<HandleCapabilityMarker>),
Data(DataCapability),
Dictionary(fidl::endpoints::ClientEnd<DictionaryMarker>),
Sender(SenderCapability),
Directory(fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>),
Router(fidl::endpoints::ClientEnd<RouterMarker>),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! CapabilityUnknown {
() => {
_
};
}
impl PartialEq for Capability {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Unit(x), Self::Unit(y)) => *x == *y,
(Self::Handle(x), Self::Handle(y)) => *x == *y,
(Self::Data(x), Self::Data(y)) => *x == *y,
(Self::Dictionary(x), Self::Dictionary(y)) => *x == *y,
(Self::Sender(x), Self::Sender(y)) => *x == *y,
(Self::Directory(x), Self::Directory(y)) => *x == *y,
(Self::Router(x), Self::Router(y)) => *x == *y,
_ => false,
}
}
}
impl Capability {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Unit(_) => 1,
Self::Handle(_) => 2,
Self::Data(_) => 3,
Self::Dictionary(_) => 4,
Self::Sender(_) => 5,
Self::Directory(_) => 6,
Self::Router(_) => 7,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Standalone for Capability {}
#[derive(Clone, Debug)]
pub enum DataCapability {
Bytes(Vec<u8>),
String(String),
Int64(i64),
Uint64(u64),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! DataCapabilityUnknown {
() => {
_
};
}
impl PartialEq for DataCapability {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Bytes(x), Self::Bytes(y)) => *x == *y,
(Self::String(x), Self::String(y)) => *x == *y,
(Self::Int64(x), Self::Int64(y)) => *x == *y,
(Self::Uint64(x), Self::Uint64(y)) => *x == *y,
_ => false,
}
}
}
impl DataCapability {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Bytes(_) => 1,
Self::String(_) => 2,
Self::Int64(_) => 3,
Self::Uint64(_) => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for DataCapability {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DictionaryMarker;
impl fidl::endpoints::ProtocolMarker for DictionaryMarker {
type Proxy = DictionaryProxy;
type RequestStream = DictionaryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DictionarySynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.component.sandbox.Dictionary";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DictionaryMarker {}
pub type DictionaryInsertResult = Result<(), DictionaryError>;
pub type DictionaryGetResult = Result<Capability, DictionaryError>;
pub type DictionaryRemoveResult = Result<Capability, DictionaryError>;
pub trait DictionaryProxyInterface: Send + Sync {
type InsertResponseFut: std::future::Future<Output = Result<DictionaryInsertResult, fidl::Error>>
+ Send;
fn r#insert(&self, key: &str, value: Capability) -> Self::InsertResponseFut;
type GetResponseFut: std::future::Future<Output = Result<DictionaryGetResult, fidl::Error>>
+ Send;
fn r#get(&self, key: &str) -> Self::GetResponseFut;
type RemoveResponseFut: std::future::Future<Output = Result<DictionaryRemoveResult, fidl::Error>>
+ Send;
fn r#remove(&self, key: &str) -> Self::RemoveResponseFut;
type ReadResponseFut: std::future::Future<Output = Result<Vec<DictionaryItem>, fidl::Error>>
+ Send;
fn r#read(&self) -> Self::ReadResponseFut;
type CloneResponseFut: std::future::Future<
Output = Result<fidl::endpoints::ClientEnd<DictionaryMarker>, fidl::Error>,
> + Send;
fn r#clone(&self) -> Self::CloneResponseFut;
type CopyResponseFut: std::future::Future<
Output = Result<fidl::endpoints::ClientEnd<DictionaryMarker>, fidl::Error>,
> + Send;
fn r#copy(&self) -> Self::CopyResponseFut;
fn r#enumerate(
&self,
contents: fidl::endpoints::ServerEnd<DictionaryIteratorMarker>,
) -> Result<(), fidl::Error>;
fn r#drain(
&self,
contents: Option<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DictionarySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DictionarySynchronousProxy {
type Proxy = DictionaryProxy;
type Protocol = DictionaryMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl DictionarySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DictionaryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<DictionaryEvent, fidl::Error> {
DictionaryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#insert(
&self,
mut key: &str,
mut value: Capability,
___deadline: zx::Time,
) -> Result<DictionaryInsertResult, fidl::Error> {
let _response = self.client.send_query::<
DictionaryItem,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DictionaryError>,
>(
(key, &mut value,),
0x33b191b94eafd60f,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<DictionaryMarker>("insert")?;
Ok(_response.map(|x| x))
}
pub fn r#get(
&self,
mut key: &str,
___deadline: zx::Time,
) -> Result<DictionaryGetResult, fidl::Error> {
let _response = self.client.send_query::<
DictionaryGetRequest,
fidl::encoding::FlexibleResultType<DictionaryGetResponse, DictionaryError>,
>(
(key,),
0x2c0e19f3011835cf,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<DictionaryMarker>("get")?;
Ok(_response.map(|x| x.capability))
}
pub fn r#remove(
&self,
mut key: &str,
___deadline: zx::Time,
) -> Result<DictionaryRemoveResult, fidl::Error> {
let _response = self.client.send_query::<
DictionaryRemoveRequest,
fidl::encoding::FlexibleResultType<DictionaryRemoveResponse, DictionaryError>,
>(
(key,),
0x62a2caad5921866,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<DictionaryMarker>("remove")?;
Ok(_response.map(|x| x.capability))
}
pub fn r#read(&self, ___deadline: zx::Time) -> Result<Vec<DictionaryItem>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<DictionaryReadResponse>,
>(
(),
0x75692d8786d77dca,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<DictionaryMarker>("read")?;
Ok(_response.items)
}
pub fn r#clone(
&self,
___deadline: zx::Time,
) -> Result<fidl::endpoints::ClientEnd<DictionaryMarker>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<DictionaryCloneResponse>,
>(
(),
0x20180e484dcf4d08,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<DictionaryMarker>("clone")?;
Ok(_response.dictionary)
}
pub fn r#copy(
&self,
___deadline: zx::Time,
) -> Result<fidl::endpoints::ClientEnd<DictionaryMarker>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<DictionaryCopyResponse>,
>(
(),
0x1d683a6e3fe82d03,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<DictionaryMarker>("copy")?;
Ok(_response.dictionary)
}
pub fn r#enumerate(
&self,
mut contents: fidl::endpoints::ServerEnd<DictionaryIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DictionaryEnumerateRequest>(
(contents,),
0x79446337d61e676,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#drain(
&self,
mut contents: Option<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
) -> Result<(), fidl::Error> {
self.client.send::<DictionaryDrainRequest>(
(contents,),
0x7ee76acdf210a4aa,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct DictionaryProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for DictionaryProxy {
type Protocol = DictionaryMarker;
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 DictionaryProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <DictionaryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DictionaryEventStream {
DictionaryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#insert(
&self,
mut key: &str,
mut value: Capability,
) -> fidl::client::QueryResponseFut<DictionaryInsertResult> {
DictionaryProxyInterface::r#insert(self, key, value)
}
pub fn r#get(&self, mut key: &str) -> fidl::client::QueryResponseFut<DictionaryGetResult> {
DictionaryProxyInterface::r#get(self, key)
}
pub fn r#remove(
&self,
mut key: &str,
) -> fidl::client::QueryResponseFut<DictionaryRemoveResult> {
DictionaryProxyInterface::r#remove(self, key)
}
pub fn r#read(&self) -> fidl::client::QueryResponseFut<Vec<DictionaryItem>> {
DictionaryProxyInterface::r#read(self)
}
pub fn r#clone(
&self,
) -> fidl::client::QueryResponseFut<fidl::endpoints::ClientEnd<DictionaryMarker>> {
DictionaryProxyInterface::r#clone(self)
}
pub fn r#copy(
&self,
) -> fidl::client::QueryResponseFut<fidl::endpoints::ClientEnd<DictionaryMarker>> {
DictionaryProxyInterface::r#copy(self)
}
pub fn r#enumerate(
&self,
mut contents: fidl::endpoints::ServerEnd<DictionaryIteratorMarker>,
) -> Result<(), fidl::Error> {
DictionaryProxyInterface::r#enumerate(self, contents)
}
pub fn r#drain(
&self,
mut contents: Option<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
) -> Result<(), fidl::Error> {
DictionaryProxyInterface::r#drain(self, contents)
}
}
impl DictionaryProxyInterface for DictionaryProxy {
type InsertResponseFut = fidl::client::QueryResponseFut<DictionaryInsertResult>;
fn r#insert(&self, mut key: &str, mut value: Capability) -> Self::InsertResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<DictionaryInsertResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, DictionaryError>,
0x33b191b94eafd60f,
>(_buf?)?
.into_result::<DictionaryMarker>("insert")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<DictionaryItem, DictionaryInsertResult>(
(key, &mut value),
0x33b191b94eafd60f,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type GetResponseFut = fidl::client::QueryResponseFut<DictionaryGetResult>;
fn r#get(&self, mut key: &str) -> Self::GetResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<DictionaryGetResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<DictionaryGetResponse, DictionaryError>,
0x2c0e19f3011835cf,
>(_buf?)?
.into_result::<DictionaryMarker>("get")?;
Ok(_response.map(|x| x.capability))
}
self.client.send_query_and_decode::<DictionaryGetRequest, DictionaryGetResult>(
(key,),
0x2c0e19f3011835cf,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type RemoveResponseFut = fidl::client::QueryResponseFut<DictionaryRemoveResult>;
fn r#remove(&self, mut key: &str) -> Self::RemoveResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<DictionaryRemoveResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<DictionaryRemoveResponse, DictionaryError>,
0x62a2caad5921866,
>(_buf?)?
.into_result::<DictionaryMarker>("remove")?;
Ok(_response.map(|x| x.capability))
}
self.client.send_query_and_decode::<DictionaryRemoveRequest, DictionaryRemoveResult>(
(key,),
0x62a2caad5921866,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ReadResponseFut = fidl::client::QueryResponseFut<Vec<DictionaryItem>>;
fn r#read(&self) -> Self::ReadResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<Vec<DictionaryItem>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<DictionaryReadResponse>,
0x75692d8786d77dca,
>(_buf?)?
.into_result::<DictionaryMarker>("read")?;
Ok(_response.items)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<DictionaryItem>>(
(),
0x75692d8786d77dca,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type CloneResponseFut =
fidl::client::QueryResponseFut<fidl::endpoints::ClientEnd<DictionaryMarker>>;
fn r#clone(&self) -> Self::CloneResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<fidl::endpoints::ClientEnd<DictionaryMarker>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<DictionaryCloneResponse>,
0x20180e484dcf4d08,
>(_buf?)?
.into_result::<DictionaryMarker>("clone")?;
Ok(_response.dictionary)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
fidl::endpoints::ClientEnd<DictionaryMarker>,
>(
(),
0x20180e484dcf4d08,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type CopyResponseFut =
fidl::client::QueryResponseFut<fidl::endpoints::ClientEnd<DictionaryMarker>>;
fn r#copy(&self) -> Self::CopyResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<fidl::endpoints::ClientEnd<DictionaryMarker>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<DictionaryCopyResponse>,
0x1d683a6e3fe82d03,
>(_buf?)?
.into_result::<DictionaryMarker>("copy")?;
Ok(_response.dictionary)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
fidl::endpoints::ClientEnd<DictionaryMarker>,
>(
(),
0x1d683a6e3fe82d03,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#enumerate(
&self,
mut contents: fidl::endpoints::ServerEnd<DictionaryIteratorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<DictionaryEnumerateRequest>(
(contents,),
0x79446337d61e676,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
fn r#drain(
&self,
mut contents: Option<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
) -> Result<(), fidl::Error> {
self.client.send::<DictionaryDrainRequest>(
(contents,),
0x7ee76acdf210a4aa,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct DictionaryEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for DictionaryEventStream {}
impl futures::stream::FusedStream for DictionaryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DictionaryEventStream {
type Item = Result<DictionaryEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(DictionaryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DictionaryEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl DictionaryEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<DictionaryEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(DictionaryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <DictionaryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DictionaryRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for DictionaryRequestStream {}
impl futures::stream::FusedStream for DictionaryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DictionaryRequestStream {
type Protocol = DictionaryMarker;
type ControlHandle = DictionaryControlHandle;
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 {
DictionaryControlHandle { 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 DictionaryRequestStream {
type Item = Result<DictionaryRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled DictionaryRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x33b191b94eafd60f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(DictionaryItem);
fidl::encoding::Decoder::decode_into::<DictionaryItem>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DictionaryControlHandle { inner: this.inner.clone() };
Ok(DictionaryRequest::Insert {
key: req.key,
value: req.value,
responder: DictionaryInsertResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2c0e19f3011835cf => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(DictionaryGetRequest);
fidl::encoding::Decoder::decode_into::<DictionaryGetRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DictionaryControlHandle { inner: this.inner.clone() };
Ok(DictionaryRequest::Get {
key: req.key,
responder: DictionaryGetResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x62a2caad5921866 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(DictionaryRemoveRequest);
fidl::encoding::Decoder::decode_into::<DictionaryRemoveRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DictionaryControlHandle { inner: this.inner.clone() };
Ok(DictionaryRequest::Remove {
key: req.key,
responder: DictionaryRemoveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x75692d8786d77dca => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DictionaryControlHandle { inner: this.inner.clone() };
Ok(DictionaryRequest::Read {
responder: DictionaryReadResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x20180e484dcf4d08 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DictionaryControlHandle { inner: this.inner.clone() };
Ok(DictionaryRequest::Clone {
responder: DictionaryCloneResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1d683a6e3fe82d03 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DictionaryControlHandle { inner: this.inner.clone() };
Ok(DictionaryRequest::Copy {
responder: DictionaryCopyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x79446337d61e676 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DictionaryEnumerateRequest);
fidl::encoding::Decoder::decode_into::<DictionaryEnumerateRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DictionaryControlHandle { inner: this.inner.clone() };
Ok(DictionaryRequest::Enumerate { contents: req.contents, control_handle })
}
0x7ee76acdf210a4aa => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(DictionaryDrainRequest);
fidl::encoding::Decoder::decode_into::<DictionaryDrainRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = DictionaryControlHandle { inner: this.inner.clone() };
Ok(DictionaryRequest::Drain { contents: req.contents, control_handle })
}
_ if header.tx_id == 0
&& header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(DictionaryRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: DictionaryControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(DictionaryRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: DictionaryControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DictionaryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum DictionaryRequest {
Insert { key: String, value: Capability, responder: DictionaryInsertResponder },
Get { key: String, responder: DictionaryGetResponder },
Remove { key: String, responder: DictionaryRemoveResponder },
Read { responder: DictionaryReadResponder },
Clone { responder: DictionaryCloneResponder },
Copy { responder: DictionaryCopyResponder },
Enumerate {
contents: fidl::endpoints::ServerEnd<DictionaryIteratorMarker>,
control_handle: DictionaryControlHandle,
},
Drain {
contents: Option<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
control_handle: DictionaryControlHandle,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: DictionaryControlHandle,
method_type: fidl::MethodType,
},
}
impl DictionaryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_insert(self) -> Option<(String, Capability, DictionaryInsertResponder)> {
if let DictionaryRequest::Insert { key, value, responder } = self {
Some((key, value, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get(self) -> Option<(String, DictionaryGetResponder)> {
if let DictionaryRequest::Get { key, responder } = self {
Some((key, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove(self) -> Option<(String, DictionaryRemoveResponder)> {
if let DictionaryRequest::Remove { key, responder } = self {
Some((key, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read(self) -> Option<(DictionaryReadResponder)> {
if let DictionaryRequest::Read { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_clone(self) -> Option<(DictionaryCloneResponder)> {
if let DictionaryRequest::Clone { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_copy(self) -> Option<(DictionaryCopyResponder)> {
if let DictionaryRequest::Copy { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_enumerate(
self,
) -> Option<(fidl::endpoints::ServerEnd<DictionaryIteratorMarker>, DictionaryControlHandle)>
{
if let DictionaryRequest::Enumerate { contents, control_handle } = self {
Some((contents, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_drain(
self,
) -> Option<(
Option<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
DictionaryControlHandle,
)> {
if let DictionaryRequest::Drain { contents, control_handle } = self {
Some((contents, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DictionaryRequest::Insert { .. } => "insert",
DictionaryRequest::Get { .. } => "get",
DictionaryRequest::Remove { .. } => "remove",
DictionaryRequest::Read { .. } => "read",
DictionaryRequest::Clone { .. } => "clone",
DictionaryRequest::Copy { .. } => "copy",
DictionaryRequest::Enumerate { .. } => "enumerate",
DictionaryRequest::Drain { .. } => "drain",
DictionaryRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
DictionaryRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct DictionaryControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for DictionaryControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl DictionaryControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DictionaryInsertResponder {
control_handle: std::mem::ManuallyDrop<DictionaryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DictionaryInsertResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DictionaryInsertResponder {
type ControlHandle = DictionaryControlHandle;
fn control_handle(&self) -> &DictionaryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DictionaryInsertResponder {
pub fn send(self, mut result: Result<(), DictionaryError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), DictionaryError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), DictionaryError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
DictionaryError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x33b191b94eafd60f,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DictionaryGetResponder {
control_handle: std::mem::ManuallyDrop<DictionaryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DictionaryGetResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DictionaryGetResponder {
type ControlHandle = DictionaryControlHandle;
fn control_handle(&self) -> &DictionaryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DictionaryGetResponder {
pub fn send(self, mut result: Result<Capability, DictionaryError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<Capability, DictionaryError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<Capability, DictionaryError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
DictionaryGetResponse,
DictionaryError,
>>(
fidl::encoding::FlexibleResult::new(
result.as_mut().map_err(|e| *e).map(|capability| (capability,)),
),
self.tx_id,
0x2c0e19f3011835cf,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DictionaryRemoveResponder {
control_handle: std::mem::ManuallyDrop<DictionaryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DictionaryRemoveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DictionaryRemoveResponder {
type ControlHandle = DictionaryControlHandle;
fn control_handle(&self) -> &DictionaryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DictionaryRemoveResponder {
pub fn send(self, mut result: Result<Capability, DictionaryError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<Capability, DictionaryError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<Capability, DictionaryError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
DictionaryRemoveResponse,
DictionaryError,
>>(
fidl::encoding::FlexibleResult::new(
result.as_mut().map_err(|e| *e).map(|capability| (capability,)),
),
self.tx_id,
0x62a2caad5921866,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DictionaryReadResponder {
control_handle: std::mem::ManuallyDrop<DictionaryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DictionaryReadResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DictionaryReadResponder {
type ControlHandle = DictionaryControlHandle;
fn control_handle(&self) -> &DictionaryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DictionaryReadResponder {
pub fn send(self, mut items: Vec<DictionaryItem>) -> Result<(), fidl::Error> {
let _result = self.send_raw(items);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut items: Vec<DictionaryItem>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(items);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut items: Vec<DictionaryItem>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<DictionaryReadResponse>>(
fidl::encoding::Flexible::new((items.as_mut(),)),
self.tx_id,
0x75692d8786d77dca,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DictionaryCloneResponder {
control_handle: std::mem::ManuallyDrop<DictionaryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DictionaryCloneResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DictionaryCloneResponder {
type ControlHandle = DictionaryControlHandle;
fn control_handle(&self) -> &DictionaryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DictionaryCloneResponder {
pub fn send(
self,
mut dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(dictionary);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(dictionary);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<DictionaryCloneResponse>>(
fidl::encoding::Flexible::new((dictionary,)),
self.tx_id,
0x20180e484dcf4d08,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DictionaryCopyResponder {
control_handle: std::mem::ManuallyDrop<DictionaryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DictionaryCopyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DictionaryCopyResponder {
type ControlHandle = DictionaryControlHandle;
fn control_handle(&self) -> &DictionaryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DictionaryCopyResponder {
pub fn send(
self,
mut dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(dictionary);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(dictionary);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<DictionaryCopyResponse>>(
fidl::encoding::Flexible::new((dictionary,)),
self.tx_id,
0x1d683a6e3fe82d03,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DictionaryIteratorMarker;
impl fidl::endpoints::ProtocolMarker for DictionaryIteratorMarker {
type Proxy = DictionaryIteratorProxy;
type RequestStream = DictionaryIteratorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DictionaryIteratorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) DictionaryIterator";
}
pub trait DictionaryIteratorProxyInterface: Send + Sync {
type GetNextResponseFut: std::future::Future<Output = Result<Vec<DictionaryItem>, fidl::Error>>
+ Send;
fn r#get_next(&self) -> Self::GetNextResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DictionaryIteratorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DictionaryIteratorSynchronousProxy {
type Proxy = DictionaryIteratorProxy;
type Protocol = DictionaryIteratorMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl DictionaryIteratorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<DictionaryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::Time,
) -> Result<DictionaryIteratorEvent, fidl::Error> {
DictionaryIteratorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_next(&self, ___deadline: zx::Time) -> Result<Vec<DictionaryItem>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<DictionaryIteratorGetNextResponse>,
>(
(),
0x64b85e789ad9d2c6,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<DictionaryIteratorMarker>("get_next")?;
Ok(_response.items)
}
}
#[derive(Debug, Clone)]
pub struct DictionaryIteratorProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for DictionaryIteratorProxy {
type Protocol = DictionaryIteratorMarker;
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 DictionaryIteratorProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<DictionaryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DictionaryIteratorEventStream {
DictionaryIteratorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_next(&self) -> fidl::client::QueryResponseFut<Vec<DictionaryItem>> {
DictionaryIteratorProxyInterface::r#get_next(self)
}
}
impl DictionaryIteratorProxyInterface for DictionaryIteratorProxy {
type GetNextResponseFut = fidl::client::QueryResponseFut<Vec<DictionaryItem>>;
fn r#get_next(&self) -> Self::GetNextResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<Vec<DictionaryItem>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<DictionaryIteratorGetNextResponse>,
0x64b85e789ad9d2c6,
>(_buf?)?
.into_result::<DictionaryIteratorMarker>("get_next")?;
Ok(_response.items)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<DictionaryItem>>(
(),
0x64b85e789ad9d2c6,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct DictionaryIteratorEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for DictionaryIteratorEventStream {}
impl futures::stream::FusedStream for DictionaryIteratorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DictionaryIteratorEventStream {
type Item = Result<DictionaryIteratorEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(DictionaryIteratorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DictionaryIteratorEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl DictionaryIteratorEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<DictionaryIteratorEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(DictionaryIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<DictionaryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DictionaryIteratorRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for DictionaryIteratorRequestStream {}
impl futures::stream::FusedStream for DictionaryIteratorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DictionaryIteratorRequestStream {
type Protocol = DictionaryIteratorMarker;
type ControlHandle = DictionaryIteratorControlHandle;
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 {
DictionaryIteratorControlHandle { 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 DictionaryIteratorRequestStream {
type Item = Result<DictionaryIteratorRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled DictionaryIteratorRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x64b85e789ad9d2c6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
DictionaryIteratorControlHandle { inner: this.inner.clone() };
Ok(DictionaryIteratorRequest::GetNext {
responder: DictionaryIteratorGetNextResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(DictionaryIteratorRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: DictionaryIteratorControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::OneWay,
})
}
_ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(DictionaryIteratorRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: DictionaryIteratorControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DictionaryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum DictionaryIteratorRequest {
GetNext {
responder: DictionaryIteratorGetNextResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: DictionaryIteratorControlHandle,
method_type: fidl::MethodType,
},
}
impl DictionaryIteratorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_next(self) -> Option<(DictionaryIteratorGetNextResponder)> {
if let DictionaryIteratorRequest::GetNext { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DictionaryIteratorRequest::GetNext { .. } => "get_next",
DictionaryIteratorRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
DictionaryIteratorRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct DictionaryIteratorControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for DictionaryIteratorControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl DictionaryIteratorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DictionaryIteratorGetNextResponder {
control_handle: std::mem::ManuallyDrop<DictionaryIteratorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DictionaryIteratorGetNextResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DictionaryIteratorGetNextResponder {
type ControlHandle = DictionaryIteratorControlHandle;
fn control_handle(&self) -> &DictionaryIteratorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DictionaryIteratorGetNextResponder {
pub fn send(self, mut items: Vec<DictionaryItem>) -> Result<(), fidl::Error> {
let _result = self.send_raw(items);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut items: Vec<DictionaryItem>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(items);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut items: Vec<DictionaryItem>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleType<DictionaryIteratorGetNextResponse>>(
fidl::encoding::Flexible::new((items.as_mut(),)),
self.tx_id,
0x64b85e789ad9d2c6,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct FactoryMarker;
impl fidl::endpoints::ProtocolMarker for FactoryMarker {
type Proxy = FactoryProxy;
type RequestStream = FactoryRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = FactorySynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.component.sandbox.Factory";
}
impl fidl::endpoints::DiscoverableProtocolMarker for FactoryMarker {}
pub trait FactoryProxyInterface: Send + Sync {
fn r#connect_to_sender(
&self,
capability: SenderCapability,
server_end: fidl::endpoints::ServerEnd<SenderMarker>,
) -> Result<(), fidl::Error>;
type CreateSenderResponseFut: std::future::Future<Output = Result<SenderCapability, fidl::Error>>
+ Send;
fn r#create_sender(
&self,
receiver: fidl::endpoints::ClientEnd<ReceiverMarker>,
) -> Self::CreateSenderResponseFut;
type CreateDictionaryResponseFut: std::future::Future<
Output = Result<fidl::endpoints::ClientEnd<DictionaryMarker>, fidl::Error>,
> + Send;
fn r#create_dictionary(&self) -> Self::CreateDictionaryResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct FactorySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for FactorySynchronousProxy {
type Proxy = FactoryProxy;
type Protocol = FactoryMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl FactorySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<FactoryEvent, fidl::Error> {
FactoryEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#connect_to_sender(
&self,
mut capability: SenderCapability,
mut server_end: fidl::endpoints::ServerEnd<SenderMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<FactoryConnectToSenderRequest>(
(&mut capability, server_end),
0x5b826ed74574994f,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#create_sender(
&self,
mut receiver: fidl::endpoints::ClientEnd<ReceiverMarker>,
___deadline: zx::Time,
) -> Result<SenderCapability, fidl::Error> {
let _response = self.client.send_query::<
FactoryCreateSenderRequest,
fidl::encoding::FlexibleType<FactoryCreateSenderResponse>,
>(
(receiver,),
0x1c9551b4c87fa688,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FactoryMarker>("create_sender")?;
Ok(_response.capability)
}
pub fn r#create_dictionary(
&self,
___deadline: zx::Time,
) -> Result<fidl::endpoints::ClientEnd<DictionaryMarker>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<FactoryCreateDictionaryResponse>,
>(
(),
0x2b1ce0263b8f1b7b,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<FactoryMarker>("create_dictionary")?;
Ok(_response.dictionary)
}
}
#[derive(Debug, Clone)]
pub struct FactoryProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for FactoryProxy {
type Protocol = FactoryMarker;
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 FactoryProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> FactoryEventStream {
FactoryEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#connect_to_sender(
&self,
mut capability: SenderCapability,
mut server_end: fidl::endpoints::ServerEnd<SenderMarker>,
) -> Result<(), fidl::Error> {
FactoryProxyInterface::r#connect_to_sender(self, capability, server_end)
}
pub fn r#create_sender(
&self,
mut receiver: fidl::endpoints::ClientEnd<ReceiverMarker>,
) -> fidl::client::QueryResponseFut<SenderCapability> {
FactoryProxyInterface::r#create_sender(self, receiver)
}
pub fn r#create_dictionary(
&self,
) -> fidl::client::QueryResponseFut<fidl::endpoints::ClientEnd<DictionaryMarker>> {
FactoryProxyInterface::r#create_dictionary(self)
}
}
impl FactoryProxyInterface for FactoryProxy {
fn r#connect_to_sender(
&self,
mut capability: SenderCapability,
mut server_end: fidl::endpoints::ServerEnd<SenderMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<FactoryConnectToSenderRequest>(
(&mut capability, server_end),
0x5b826ed74574994f,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
type CreateSenderResponseFut = fidl::client::QueryResponseFut<SenderCapability>;
fn r#create_sender(
&self,
mut receiver: fidl::endpoints::ClientEnd<ReceiverMarker>,
) -> Self::CreateSenderResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<SenderCapability, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<FactoryCreateSenderResponse>,
0x1c9551b4c87fa688,
>(_buf?)?
.into_result::<FactoryMarker>("create_sender")?;
Ok(_response.capability)
}
self.client.send_query_and_decode::<FactoryCreateSenderRequest, SenderCapability>(
(receiver,),
0x1c9551b4c87fa688,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type CreateDictionaryResponseFut =
fidl::client::QueryResponseFut<fidl::endpoints::ClientEnd<DictionaryMarker>>;
fn r#create_dictionary(&self) -> Self::CreateDictionaryResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<fidl::endpoints::ClientEnd<DictionaryMarker>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<FactoryCreateDictionaryResponse>,
0x2b1ce0263b8f1b7b,
>(_buf?)?
.into_result::<FactoryMarker>("create_dictionary")?;
Ok(_response.dictionary)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
fidl::endpoints::ClientEnd<DictionaryMarker>,
>(
(),
0x2b1ce0263b8f1b7b,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct FactoryEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for FactoryEventStream {}
impl futures::stream::FusedStream for FactoryEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for FactoryEventStream {
type Item = Result<FactoryEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(FactoryEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum FactoryEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl FactoryEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<FactoryEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(FactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct FactoryRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for FactoryRequestStream {}
impl futures::stream::FusedStream for FactoryRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for FactoryRequestStream {
type Protocol = FactoryMarker;
type ControlHandle = FactoryControlHandle;
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 {
FactoryControlHandle { 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 FactoryRequestStream {
type Item = Result<FactoryRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled FactoryRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x5b826ed74574994f => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(FactoryConnectToSenderRequest);
fidl::encoding::Decoder::decode_into::<FactoryConnectToSenderRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = FactoryControlHandle { inner: this.inner.clone() };
Ok(FactoryRequest::ConnectToSender {
capability: req.capability,
server_end: req.server_end,
control_handle,
})
}
0x1c9551b4c87fa688 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(FactoryCreateSenderRequest);
fidl::encoding::Decoder::decode_into::<FactoryCreateSenderRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = FactoryControlHandle { inner: this.inner.clone() };
Ok(FactoryRequest::CreateSender {
receiver: req.receiver,
responder: FactoryCreateSenderResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2b1ce0263b8f1b7b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = FactoryControlHandle { inner: this.inner.clone() };
Ok(FactoryRequest::CreateDictionary {
responder: FactoryCreateDictionaryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(FactoryRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: FactoryControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(FactoryRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: FactoryControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <FactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum FactoryRequest {
ConnectToSender {
capability: SenderCapability,
server_end: fidl::endpoints::ServerEnd<SenderMarker>,
control_handle: FactoryControlHandle,
},
CreateSender {
receiver: fidl::endpoints::ClientEnd<ReceiverMarker>,
responder: FactoryCreateSenderResponder,
},
CreateDictionary { responder: FactoryCreateDictionaryResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: FactoryControlHandle,
method_type: fidl::MethodType,
},
}
impl FactoryRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_connect_to_sender(
self,
) -> Option<(SenderCapability, fidl::endpoints::ServerEnd<SenderMarker>, FactoryControlHandle)>
{
if let FactoryRequest::ConnectToSender { capability, server_end, control_handle } = self {
Some((capability, server_end, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_sender(
self,
) -> Option<(fidl::endpoints::ClientEnd<ReceiverMarker>, FactoryCreateSenderResponder)> {
if let FactoryRequest::CreateSender { receiver, responder } = self {
Some((receiver, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_dictionary(self) -> Option<(FactoryCreateDictionaryResponder)> {
if let FactoryRequest::CreateDictionary { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
FactoryRequest::ConnectToSender { .. } => "connect_to_sender",
FactoryRequest::CreateSender { .. } => "create_sender",
FactoryRequest::CreateDictionary { .. } => "create_dictionary",
FactoryRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
FactoryRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct FactoryControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for FactoryControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl FactoryControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FactoryCreateSenderResponder {
control_handle: std::mem::ManuallyDrop<FactoryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FactoryCreateSenderResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FactoryCreateSenderResponder {
type ControlHandle = FactoryControlHandle;
fn control_handle(&self) -> &FactoryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FactoryCreateSenderResponder {
pub fn send(self, mut capability: SenderCapability) -> Result<(), fidl::Error> {
let _result = self.send_raw(capability);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut capability: SenderCapability,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(capability);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut capability: SenderCapability) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<FactoryCreateSenderResponse>>(
fidl::encoding::Flexible::new((&mut capability,)),
self.tx_id,
0x1c9551b4c87fa688,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct FactoryCreateDictionaryResponder {
control_handle: std::mem::ManuallyDrop<FactoryControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for FactoryCreateDictionaryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for FactoryCreateDictionaryResponder {
type ControlHandle = FactoryControlHandle;
fn control_handle(&self) -> &FactoryControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl FactoryCreateDictionaryResponder {
pub fn send(
self,
mut dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(dictionary);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(dictionary);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut dictionary: fidl::endpoints::ClientEnd<DictionaryMarker>,
) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleType<FactoryCreateDictionaryResponse>>(
fidl::encoding::Flexible::new((dictionary,)),
self.tx_id,
0x2b1ce0263b8f1b7b,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HandleCapabilityMarker;
impl fidl::endpoints::ProtocolMarker for HandleCapabilityMarker {
type Proxy = HandleCapabilityProxy;
type RequestStream = HandleCapabilityRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HandleCapabilitySynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) HandleCapability";
}
pub type HandleCapabilityGetHandleResult = Result<fidl::Handle, HandleCapabilityError>;
pub trait HandleCapabilityProxyInterface: Send + Sync {
fn r#clone2(
&self,
request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
) -> Result<(), fidl::Error>;
type GetHandleResponseFut: std::future::Future<Output = Result<HandleCapabilityGetHandleResult, fidl::Error>>
+ Send;
fn r#get_handle(&self) -> Self::GetHandleResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HandleCapabilitySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HandleCapabilitySynchronousProxy {
type Proxy = HandleCapabilityProxy;
type Protocol = HandleCapabilityMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl HandleCapabilitySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <HandleCapabilityMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<HandleCapabilityEvent, fidl::Error> {
HandleCapabilityEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#clone2(
&self,
mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<fidl_fuchsia_unknown::CloneableClone2Request>(
(request,),
0x20d8a7aba2168a79,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#get_handle(
&self,
___deadline: zx::Time,
) -> Result<HandleCapabilityGetHandleResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
HandleCapabilityGetHandleResponse,
HandleCapabilityError,
>>(
(),
0x45f85b7d28c2eeb7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.handle))
}
}
#[derive(Debug, Clone)]
pub struct HandleCapabilityProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for HandleCapabilityProxy {
type Protocol = HandleCapabilityMarker;
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 HandleCapabilityProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <HandleCapabilityMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HandleCapabilityEventStream {
HandleCapabilityEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#clone2(
&self,
mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
) -> Result<(), fidl::Error> {
HandleCapabilityProxyInterface::r#clone2(self, request)
}
pub fn r#get_handle(&self) -> fidl::client::QueryResponseFut<HandleCapabilityGetHandleResult> {
HandleCapabilityProxyInterface::r#get_handle(self)
}
}
impl HandleCapabilityProxyInterface for HandleCapabilityProxy {
fn r#clone2(
&self,
mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<fidl_fuchsia_unknown::CloneableClone2Request>(
(request,),
0x20d8a7aba2168a79,
fidl::encoding::DynamicFlags::empty(),
)
}
type GetHandleResponseFut = fidl::client::QueryResponseFut<HandleCapabilityGetHandleResult>;
fn r#get_handle(&self) -> Self::GetHandleResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<HandleCapabilityGetHandleResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
HandleCapabilityGetHandleResponse,
HandleCapabilityError,
>,
0x45f85b7d28c2eeb7,
>(_buf?)?;
Ok(_response.map(|x| x.handle))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, HandleCapabilityGetHandleResult>(
(),
0x45f85b7d28c2eeb7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct HandleCapabilityEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for HandleCapabilityEventStream {}
impl futures::stream::FusedStream for HandleCapabilityEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HandleCapabilityEventStream {
type Item = Result<HandleCapabilityEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(HandleCapabilityEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HandleCapabilityEvent {}
impl HandleCapabilityEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<HandleCapabilityEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<HandleCapabilityMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HandleCapabilityRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for HandleCapabilityRequestStream {}
impl futures::stream::FusedStream for HandleCapabilityRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HandleCapabilityRequestStream {
type Protocol = HandleCapabilityMarker;
type ControlHandle = HandleCapabilityControlHandle;
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 {
HandleCapabilityControlHandle { 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 HandleCapabilityRequestStream {
type Item = Result<HandleCapabilityRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled HandleCapabilityRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x20d8a7aba2168a79 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl_fuchsia_unknown::CloneableClone2Request);
fidl::encoding::Decoder::decode_into::<
fidl_fuchsia_unknown::CloneableClone2Request,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
HandleCapabilityControlHandle { inner: this.inner.clone() };
Ok(HandleCapabilityRequest::Clone2 { request: req.request, control_handle })
}
0x45f85b7d28c2eeb7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
HandleCapabilityControlHandle { inner: this.inner.clone() };
Ok(HandleCapabilityRequest::GetHandle {
responder: HandleCapabilityGetHandleResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<HandleCapabilityMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum HandleCapabilityRequest {
Clone2 {
request: fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
control_handle: HandleCapabilityControlHandle,
},
GetHandle {
responder: HandleCapabilityGetHandleResponder,
},
}
impl HandleCapabilityRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_clone2(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_unknown::CloneableMarker>,
HandleCapabilityControlHandle,
)> {
if let HandleCapabilityRequest::Clone2 { request, control_handle } = self {
Some((request, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_handle(self) -> Option<(HandleCapabilityGetHandleResponder)> {
if let HandleCapabilityRequest::GetHandle { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HandleCapabilityRequest::Clone2 { .. } => "clone2",
HandleCapabilityRequest::GetHandle { .. } => "get_handle",
}
}
}
#[derive(Debug, Clone)]
pub struct HandleCapabilityControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for HandleCapabilityControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl HandleCapabilityControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HandleCapabilityGetHandleResponder {
control_handle: std::mem::ManuallyDrop<HandleCapabilityControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HandleCapabilityGetHandleResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HandleCapabilityGetHandleResponder {
type ControlHandle = HandleCapabilityControlHandle;
fn control_handle(&self) -> &HandleCapabilityControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HandleCapabilityGetHandleResponder {
pub fn send(
self,
mut result: Result<fidl::Handle, HandleCapabilityError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::Handle, HandleCapabilityError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<fidl::Handle, HandleCapabilityError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
HandleCapabilityGetHandleResponse,
HandleCapabilityError,
>>(
result.map(|handle| (handle,)),
self.tx_id,
0x45f85b7d28c2eeb7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ReceiverMarker;
impl fidl::endpoints::ProtocolMarker for ReceiverMarker {
type Proxy = ReceiverProxy;
type RequestStream = ReceiverRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ReceiverSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.component.sandbox.Receiver";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ReceiverMarker {}
pub trait ReceiverProxyInterface: Send + Sync {
fn r#receive(&self, channel: fidl::Channel) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ReceiverSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ReceiverSynchronousProxy {
type Proxy = ReceiverProxy;
type Protocol = ReceiverMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl ReceiverSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<ReceiverEvent, fidl::Error> {
ReceiverEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#receive(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
self.client.send::<ProtocolPayload>(
(channel,),
0x4bae18ab7aa1a94,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct ReceiverProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for ReceiverProxy {
type Protocol = ReceiverMarker;
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 ReceiverProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ReceiverEventStream {
ReceiverEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#receive(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
ReceiverProxyInterface::r#receive(self, channel)
}
}
impl ReceiverProxyInterface for ReceiverProxy {
fn r#receive(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
self.client.send::<ProtocolPayload>(
(channel,),
0x4bae18ab7aa1a94,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct ReceiverEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for ReceiverEventStream {}
impl futures::stream::FusedStream for ReceiverEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ReceiverEventStream {
type Item = Result<ReceiverEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(ReceiverEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ReceiverEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ReceiverEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<ReceiverEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ReceiverEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ReceiverRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for ReceiverRequestStream {}
impl futures::stream::FusedStream for ReceiverRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ReceiverRequestStream {
type Protocol = ReceiverMarker;
type ControlHandle = ReceiverControlHandle;
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 {
ReceiverControlHandle { 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 ReceiverRequestStream {
type Item = Result<ReceiverRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled ReceiverRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x4bae18ab7aa1a94 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ProtocolPayload);
fidl::encoding::Decoder::decode_into::<ProtocolPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = ReceiverControlHandle { inner: this.inner.clone() };
Ok(ReceiverRequest::Receive { channel: req.channel, control_handle })
}
_ if header.tx_id == 0
&& header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(ReceiverRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ReceiverControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(ReceiverRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ReceiverControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum ReceiverRequest {
Receive { channel: fidl::Channel, control_handle: ReceiverControlHandle },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ReceiverControlHandle,
method_type: fidl::MethodType,
},
}
impl ReceiverRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_receive(self) -> Option<(fidl::Channel, ReceiverControlHandle)> {
if let ReceiverRequest::Receive { channel, control_handle } = self {
Some((channel, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ReceiverRequest::Receive { .. } => "receive",
ReceiverRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
ReceiverRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct ReceiverControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for ReceiverControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl ReceiverControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RouterMarker;
impl fidl::endpoints::ProtocolMarker for RouterMarker {
type Proxy = RouterProxy;
type RequestStream = RouterRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RouterSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Router";
}
pub type RouterRouteResult = Result<Capability, RouterError>;
pub trait RouterProxyInterface: Send + Sync {
type RouteResponseFut: std::future::Future<Output = Result<RouterRouteResult, fidl::Error>>
+ Send;
fn r#route(&self, payload: RouteRequest) -> Self::RouteResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RouterSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RouterSynchronousProxy {
type Proxy = RouterProxy;
type Protocol = RouterMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl RouterSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RouterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<RouterEvent, fidl::Error> {
RouterEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#route(
&self,
mut payload: RouteRequest,
___deadline: zx::Time,
) -> Result<RouterRouteResult, fidl::Error> {
let _response = self.client.send_query::<
RouteRequest,
fidl::encoding::FlexibleResultType<RouterRouteResponse, RouterError>,
>(
&mut payload,
0x76506492af67a4f1,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<RouterMarker>("route")?;
Ok(_response.map(|x| x.capability))
}
}
#[derive(Debug, Clone)]
pub struct RouterProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RouterProxy {
type Protocol = RouterMarker;
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 RouterProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RouterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RouterEventStream {
RouterEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#route(
&self,
mut payload: RouteRequest,
) -> fidl::client::QueryResponseFut<RouterRouteResult> {
RouterProxyInterface::r#route(self, payload)
}
}
impl RouterProxyInterface for RouterProxy {
type RouteResponseFut = fidl::client::QueryResponseFut<RouterRouteResult>;
fn r#route(&self, mut payload: RouteRequest) -> Self::RouteResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RouterRouteResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<RouterRouteResponse, RouterError>,
0x76506492af67a4f1,
>(_buf?)?
.into_result::<RouterMarker>("route")?;
Ok(_response.map(|x| x.capability))
}
self.client.send_query_and_decode::<RouteRequest, RouterRouteResult>(
&mut payload,
0x76506492af67a4f1,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct RouterEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RouterEventStream {}
impl futures::stream::FusedStream for RouterEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RouterEventStream {
type Item = Result<RouterEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(RouterEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RouterEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl RouterEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RouterEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(RouterEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <RouterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RouterRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RouterRequestStream {}
impl futures::stream::FusedStream for RouterRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RouterRequestStream {
type Protocol = RouterMarker;
type ControlHandle = RouterControlHandle;
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 {
RouterControlHandle { 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 RouterRequestStream {
type Item = Result<RouterRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled RouterRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x76506492af67a4f1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RouteRequest);
fidl::encoding::Decoder::decode_into::<RouteRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouterControlHandle { inner: this.inner.clone() };
Ok(RouterRequest::Route {
payload: req,
responder: RouterRouteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(RouterRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: RouterControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(RouterRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: RouterControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <RouterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RouterRequest {
Route {
payload: RouteRequest,
responder: RouterRouteResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: RouterControlHandle,
method_type: fidl::MethodType,
},
}
impl RouterRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_route(self) -> Option<(RouteRequest, RouterRouteResponder)> {
if let RouterRequest::Route { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RouterRequest::Route { .. } => "route",
RouterRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
RouterRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct RouterControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RouterControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl RouterControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouterRouteResponder {
control_handle: std::mem::ManuallyDrop<RouterControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouterRouteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouterRouteResponder {
type ControlHandle = RouterControlHandle;
fn control_handle(&self) -> &RouterControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouterRouteResponder {
pub fn send(self, mut result: Result<Capability, RouterError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<Capability, RouterError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<Capability, RouterError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
RouterRouteResponse,
RouterError,
>>(
fidl::encoding::FlexibleResult::new(
result.as_mut().map_err(|e| *e).map(|capability| (capability,)),
),
self.tx_id,
0x76506492af67a4f1,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SenderMarker;
impl fidl::endpoints::ProtocolMarker for SenderMarker {
type Proxy = SenderProxy;
type RequestStream = SenderRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SenderSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.component.sandbox.Sender";
}
impl fidl::endpoints::DiscoverableProtocolMarker for SenderMarker {}
pub trait SenderProxyInterface: Send + Sync {
fn r#send_(&self, channel: fidl::Channel) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SenderSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SenderSynchronousProxy {
type Proxy = SenderProxy;
type Protocol = SenderMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl SenderSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<SenderEvent, fidl::Error> {
SenderEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#send_(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
self.client.send::<ProtocolPayload>(
(channel,),
0x311b367ee28e9d44,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct SenderProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for SenderProxy {
type Protocol = SenderMarker;
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 SenderProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <SenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SenderEventStream {
SenderEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#send_(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
SenderProxyInterface::r#send_(self, channel)
}
}
impl SenderProxyInterface for SenderProxy {
fn r#send_(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
self.client.send::<ProtocolPayload>(
(channel,),
0x311b367ee28e9d44,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct SenderEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for SenderEventStream {}
impl futures::stream::FusedStream for SenderEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SenderEventStream {
type Item = Result<SenderEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(SenderEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SenderEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl SenderEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<SenderEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(SenderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <SenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SenderRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for SenderRequestStream {}
impl futures::stream::FusedStream for SenderRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SenderRequestStream {
type Protocol = SenderMarker;
type ControlHandle = SenderControlHandle;
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 {
SenderControlHandle { 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 SenderRequestStream {
type Item = Result<SenderRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled SenderRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x311b367ee28e9d44 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ProtocolPayload);
fidl::encoding::Decoder::decode_into::<ProtocolPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = SenderControlHandle { inner: this.inner.clone() };
Ok(SenderRequest::Send_ { channel: req.channel, control_handle })
}
_ if header.tx_id == 0
&& header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(SenderRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SenderControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(SenderRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SenderControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <SenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum SenderRequest {
Send_ { channel: fidl::Channel, control_handle: SenderControlHandle },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: SenderControlHandle,
method_type: fidl::MethodType,
},
}
impl SenderRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_send_(self) -> Option<(fidl::Channel, SenderControlHandle)> {
if let SenderRequest::Send_ { channel, control_handle } = self {
Some((channel, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SenderRequest::Send_ { .. } => "send_",
SenderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
SenderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct SenderControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for SenderControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl SenderControlHandle {}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for Availability {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Availability {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for Availability {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for Availability {
#[inline(always)]
fn new_empty() -> Self {
Self::Required
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for DictionaryError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for DictionaryError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HandleCapabilityError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for HandleCapabilityError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for HandleCapabilityError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for HandleCapabilityError {
#[inline(always)]
fn new_empty() -> Self {
Self::Unavailable
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouterError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for RouterError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for RouterError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouterError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ComponentToken {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for ComponentToken {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ComponentToken> for &mut ComponentToken {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ComponentToken>(offset);
fidl::encoding::Encode::<ComponentToken>::encode(
(<fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.token
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<ComponentToken> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ComponentToken>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ComponentToken {
#[inline(always)]
fn new_empty() -> Self {
Self {
token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, &mut self.token, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryDrainRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for DictionaryDrainRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DictionaryDrainRequest> for &mut DictionaryDrainRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryDrainRequest>(offset);
fidl::encoding::Encode::<DictionaryDrainRequest>::encode(
(<fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.contents
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
>,
>,
> fidl::encoding::Encode<DictionaryDrainRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryDrainRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryDrainRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
contents: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DictionaryIteratorMarker>,
>,
>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
>,
&mut self.contents,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryEnumerateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for DictionaryEnumerateRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DictionaryEnumerateRequest> for &mut DictionaryEnumerateRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryEnumerateRequest>(offset);
fidl::encoding::Encode::<DictionaryEnumerateRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.contents),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
>,
> fidl::encoding::Encode<DictionaryEnumerateRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryEnumerateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryEnumerateRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
contents: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DictionaryIteratorMarker>>,
&mut self.contents,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryGetRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for DictionaryGetRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DictionaryGetRequest> for &DictionaryGetRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryGetRequest>(offset);
fidl::encoding::Encode::<DictionaryGetRequest>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>>
fidl::encoding::Encode<DictionaryGetRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryGetRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryGetRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { key: fidl::new_empty!(fidl::encoding::BoundedString<255>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryItem {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
impl fidl::encoding::ResourceTypeMarker for DictionaryItem {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DictionaryItem> for &mut DictionaryItem {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryItem>(offset);
fidl::encoding::Encode::<DictionaryItem>::encode(
(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),
<Capability as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.value,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>,
T1: fidl::encoding::Encode<Capability>,
> fidl::encoding::Encode<DictionaryItem> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryItem>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryItem {
#[inline(always)]
fn new_empty() -> Self {
Self {
key: fidl::new_empty!(fidl::encoding::BoundedString<255>),
value: fidl::new_empty!(Capability),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(Capability, &mut self.value, decoder, offset + 16, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryIteratorGetNextResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for DictionaryIteratorGetNextResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DictionaryIteratorGetNextResponse>
for &mut DictionaryIteratorGetNextResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryIteratorGetNextResponse>(offset);
fidl::encoding::Encode::<DictionaryIteratorGetNextResponse>::encode(
(
<fidl::encoding::Vector<DictionaryItem, 128> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.items),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::Vector<DictionaryItem, 128>>>
fidl::encoding::Encode<DictionaryIteratorGetNextResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryIteratorGetNextResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryIteratorGetNextResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { items: fidl::new_empty!(fidl::encoding::Vector<DictionaryItem, 128>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<DictionaryItem, 128>, &mut self.items, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryRemoveRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for DictionaryRemoveRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DictionaryRemoveRequest> for &DictionaryRemoveRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryRemoveRequest>(offset);
fidl::encoding::Encode::<DictionaryRemoveRequest>::encode(
(<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>>>
fidl::encoding::Encode<DictionaryRemoveRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryRemoveRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryRemoveRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { key: fidl::new_empty!(fidl::encoding::BoundedString<255>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<255>,
&mut self.key,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryCloneResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for DictionaryCloneResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DictionaryCloneResponse> for &mut DictionaryCloneResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryCloneResponse>(offset);
fidl::encoding::Encode::<DictionaryCloneResponse>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>,
>,
> fidl::encoding::Encode<DictionaryCloneResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryCloneResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryCloneResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
dictionary: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>,
&mut self.dictionary,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryCopyResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for DictionaryCopyResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DictionaryCopyResponse> for &mut DictionaryCopyResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryCopyResponse>(offset);
fidl::encoding::Encode::<DictionaryCopyResponse>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>,
>,
> fidl::encoding::Encode<DictionaryCopyResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryCopyResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryCopyResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
dictionary: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>,
&mut self.dictionary,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryGetResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for DictionaryGetResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DictionaryGetResponse> for &mut DictionaryGetResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryGetResponse>(offset);
fidl::encoding::Encode::<DictionaryGetResponse>::encode(
(<Capability as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.capability,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<Capability>>
fidl::encoding::Encode<DictionaryGetResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryGetResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryGetResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { capability: fidl::new_empty!(Capability) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Capability, &mut self.capability, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryReadResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for DictionaryReadResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DictionaryReadResponse> for &mut DictionaryReadResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryReadResponse>(offset);
fidl::encoding::Encode::<DictionaryReadResponse>::encode(
(
<fidl::encoding::UnboundedVector<DictionaryItem> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.items),
),
encoder, offset, _depth
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<DictionaryItem>>>
fidl::encoding::Encode<DictionaryReadResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryReadResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryReadResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { items: fidl::new_empty!(fidl::encoding::UnboundedVector<DictionaryItem>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<DictionaryItem>,
&mut self.items,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DictionaryRemoveResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for DictionaryRemoveResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DictionaryRemoveResponse> for &mut DictionaryRemoveResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryRemoveResponse>(offset);
fidl::encoding::Encode::<DictionaryRemoveResponse>::encode(
(<Capability as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.capability,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<Capability>>
fidl::encoding::Encode<DictionaryRemoveResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DictionaryRemoveResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for DictionaryRemoveResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { capability: fidl::new_empty!(Capability) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Capability, &mut self.capability, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for FactoryConnectToSenderRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ResourceTypeMarker for FactoryConnectToSenderRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<FactoryConnectToSenderRequest>
for &mut FactoryConnectToSenderRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FactoryConnectToSenderRequest>(offset);
fidl::encoding::Encode::<FactoryConnectToSenderRequest>::encode(
(
<SenderCapability as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.capability),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SenderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<SenderCapability>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SenderMarker>>,
>,
> fidl::encoding::Encode<FactoryConnectToSenderRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FactoryConnectToSenderRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for FactoryConnectToSenderRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
capability: fidl::new_empty!(SenderCapability),
server_end: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SenderMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(SenderCapability, &mut self.capability, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SenderMarker>>,
&mut self.server_end,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for FactoryCreateSenderRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for FactoryCreateSenderRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<FactoryCreateSenderRequest> for &mut FactoryCreateSenderRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FactoryCreateSenderRequest>(offset);
fidl::encoding::Encode::<FactoryCreateSenderRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ReceiverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.receiver),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ReceiverMarker>>,
>,
> fidl::encoding::Encode<FactoryCreateSenderRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FactoryCreateSenderRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for FactoryCreateSenderRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
receiver: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ReceiverMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ReceiverMarker>>,
&mut self.receiver,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for FactoryCreateDictionaryResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for FactoryCreateDictionaryResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<FactoryCreateDictionaryResponse>
for &mut FactoryCreateDictionaryResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FactoryCreateDictionaryResponse>(offset);
fidl::encoding::Encode::<FactoryCreateDictionaryResponse>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dictionary),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>,
>,
> fidl::encoding::Encode<FactoryCreateDictionaryResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FactoryCreateDictionaryResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for FactoryCreateDictionaryResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
dictionary: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>,
&mut self.dictionary,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for FactoryCreateSenderResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for FactoryCreateSenderResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<FactoryCreateSenderResponse>
for &mut FactoryCreateSenderResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FactoryCreateSenderResponse>(offset);
fidl::encoding::Encode::<FactoryCreateSenderResponse>::encode(
(<SenderCapability as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.capability,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<SenderCapability>>
fidl::encoding::Encode<FactoryCreateSenderResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<FactoryCreateSenderResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for FactoryCreateSenderResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { capability: fidl::new_empty!(SenderCapability) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(SenderCapability, &mut self.capability, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HandleCapabilityGetHandleResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for HandleCapabilityGetHandleResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<HandleCapabilityGetHandleResponse>
for &mut HandleCapabilityGetHandleResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleCapabilityGetHandleResponse>(offset);
fidl::encoding::Encode::<HandleCapabilityGetHandleResponse>::encode(
(<fidl::encoding::HandleType<
fidl::Handle,
{ fidl::ObjectType::NONE.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.handle
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Handle,
{ fidl::ObjectType::NONE.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<HandleCapabilityGetHandleResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleCapabilityGetHandleResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for HandleCapabilityGetHandleResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
handle: fidl::new_empty!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, &mut self.handle, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ProtocolPayload {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for ProtocolPayload {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<ProtocolPayload> for &mut ProtocolPayload {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProtocolPayload>(offset);
fidl::encoding::Encode::<ProtocolPayload>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<ProtocolPayload> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProtocolPayload>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ProtocolPayload {
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouterRouteResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for RouterRouteResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RouterRouteResponse> for &mut RouterRouteResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouterRouteResponse>(offset);
fidl::encoding::Encode::<RouterRouteResponse>::encode(
(<Capability as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.capability,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<Capability>> fidl::encoding::Encode<RouterRouteResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouterRouteResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouterRouteResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { capability: fidl::new_empty!(Capability) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Capability, &mut self.capability, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for SenderCapability {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for SenderCapability {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<SenderCapability> for &mut SenderCapability {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SenderCapability>(offset);
fidl::encoding::Encode::<SenderCapability>::encode(
(<fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.token
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::EventPair,
{ fidl::ObjectType::EVENTPAIR.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<SenderCapability> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SenderCapability>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for SenderCapability {
#[inline(always)]
fn new_empty() -> Self {
Self {
token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, &mut self.token, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for UnitCapability {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
impl fidl::encoding::ValueTypeMarker for UnitCapability {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<UnitCapability> for &UnitCapability {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UnitCapability>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for UnitCapability {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl RouteRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.requesting {
return 2;
}
if let Some(_) = self.availability {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for RouteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for RouteRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RouteRequest> for &mut RouteRequest {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<Availability>(
self.availability
.as_ref()
.map(<Availability as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<ComponentToken>(
self.requesting
.as_mut()
.map(<ComponentToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteRequest {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<Availability as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.availability.get_or_insert_with(|| fidl::new_empty!(Availability));
fidl::decode!(Availability, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ComponentToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref =
self.requesting.get_or_insert_with(|| fidl::new_empty!(ComponentToken));
fidl::decode!(ComponentToken, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Capability {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ResourceTypeMarker for Capability {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<Capability> for &mut Capability {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Capability>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Capability::Unit(ref val) => {
fidl::encoding::encode_in_envelope::<UnitCapability>(
<UnitCapability as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
Capability::Handle(ref mut val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HandleCapabilityMarker>>>(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HandleCapabilityMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
encoder, offset + 8, _depth
)
}
Capability::Data(ref val) => {
fidl::encoding::encode_in_envelope::<DataCapability>(
<DataCapability as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
Capability::Dictionary(ref mut val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>>(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
encoder, offset + 8, _depth
)
}
Capability::Sender(ref mut val) => {
fidl::encoding::encode_in_envelope::<SenderCapability>(
<SenderCapability as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
encoder, offset + 8, _depth
)
}
Capability::Directory(ref mut val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>>(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
encoder, offset + 8, _depth
)
}
Capability::Router(ref mut val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouterMarker>>>(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouterMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
encoder, offset + 8, _depth
)
}
Capability::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for Capability {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <UnitCapability as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HandleCapabilityMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <DataCapability as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5 => <SenderCapability as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6 => <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7 => <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouterMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let Capability::Unit(_) = self {
} else {
*self = Capability::Unit(fidl::new_empty!(UnitCapability));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Unit(ref mut val) = self {
fidl::decode!(UnitCapability, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let Capability::Handle(_) = self {
} else {
*self = Capability::Handle(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<HandleCapabilityMarker>,
>
));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Handle(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<HandleCapabilityMarker>,
>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let Capability::Data(_) = self {
} else {
*self = Capability::Data(fidl::new_empty!(DataCapability));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Data(ref mut val) = self {
fidl::decode!(DataCapability, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let Capability::Dictionary(_) = self {
} else {
*self = Capability::Dictionary(fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>
));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Dictionary(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DictionaryMarker>>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let Capability::Sender(_) = self {
} else {
*self = Capability::Sender(fidl::new_empty!(SenderCapability));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Sender(ref mut val) = self {
fidl::decode!(SenderCapability, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
6 => {
#[allow(irrefutable_let_patterns)]
if let Capability::Directory(_) = self {
} else {
*self = Capability::Directory(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>
));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Directory(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
7 => {
#[allow(irrefutable_let_patterns)]
if let Capability::Router(_) = self {
} else {
*self = Capability::Router(fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouterMarker>>
));
}
#[allow(irrefutable_let_patterns)]
if let Capability::Router(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouterMarker>>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = Capability::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DataCapability {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for DataCapability {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<DataCapability> for &DataCapability {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DataCapability>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
DataCapability::Bytes(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<u8, 8192>>(
<fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataCapability::String(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<8192>>(
<fidl::encoding::BoundedString<8192> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataCapability::Int64(ref val) => {
fidl::encoding::encode_in_envelope::<i64>(
<i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataCapability::Uint64(ref val) => {
fidl::encoding::encode_in_envelope::<u64>(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
DataCapability::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for DataCapability {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => {
<fidl::encoding::BoundedString<8192> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
3 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let DataCapability::Bytes(_) = self {
} else {
*self = DataCapability::Bytes(
fidl::new_empty!(fidl::encoding::Vector<u8, 8192>),
);
}
#[allow(irrefutable_let_patterns)]
if let DataCapability::Bytes(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 8192>, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let DataCapability::String(_) = self {
} else {
*self = DataCapability::String(fidl::new_empty!(
fidl::encoding::BoundedString<8192>
));
}
#[allow(irrefutable_let_patterns)]
if let DataCapability::String(ref mut val) = self {
fidl::decode!(
fidl::encoding::BoundedString<8192>,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let DataCapability::Int64(_) = self {
} else {
*self = DataCapability::Int64(fidl::new_empty!(i64));
}
#[allow(irrefutable_let_patterns)]
if let DataCapability::Int64(ref mut val) = self {
fidl::decode!(i64, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let DataCapability::Uint64(_) = self {
} else {
*self = DataCapability::Uint64(fidl::new_empty!(u64));
}
#[allow(irrefutable_let_patterns)]
if let DataCapability::Uint64(ref mut val) = self {
fidl::decode!(u64, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = DataCapability::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}