blob: 0d6777f5f9439d76b743cfe6a98dcbf3f0664b16 [file] [log] [blame]
// WARNING: This file is machine generated by fidlgen.
// fidl_experiment = output_index_json
#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
pub use fidl_test_protocols__common::*;
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ChannelProtocolMutateSocketRequest {
pub a: fidl::Socket,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ChannelProtocolMutateSocketRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ChannelProtocolMutateSocketResponse {
pub b: fidl::Socket,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ChannelProtocolMutateSocketResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ChannelProtocolTakeHandleRequest {
pub h: fidl::Handle,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ChannelProtocolTakeHandleRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HandleRightsProtocolAnEventRequest {
pub h: fidl::Socket,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HandleRightsProtocolAnEventRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HandleRightsProtocolNoResponseMethodRequest {
pub h: fidl::Socket,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HandleRightsProtocolNoResponseMethodRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HandleRightsProtocolResponseMethodRequest {
pub h: fidl::Socket,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HandleRightsProtocolResponseMethodRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HandleRightsProtocolResponseMethodResponse {
pub h: fidl::Socket,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HandleRightsProtocolResponseMethodResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProtocolEnds {
pub client: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
pub server: fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
pub client_opt: Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
pub server_opt: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProtocolEnds {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WithErrorSyntaxHandleInResultResponse {
pub h: fidl::Handle,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for WithErrorSyntaxHandleInResultResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WithProtocolEndsClientEndsRequest {
pub in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsClientEndsRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WithProtocolEndsClientEndsResponse {
pub out: Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsClientEndsResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WithProtocolEndsServerEndsRequest {
pub in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsServerEndsRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WithProtocolEndsServerEndsResponse {
pub out: fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsServerEndsResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WithProtocolEndsStructContainingEndsRequest {
pub in_: ProtocolEnds,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsStructContainingEndsRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct WithProtocolEndsStructContainingEndsResponse {
pub out: ProtocolEnds,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsStructContainingEndsResponse
{
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AnotherDiscoverableProtocolMarker;
impl fidl::endpoints::ProtocolMarker for AnotherDiscoverableProtocolMarker {
type Proxy = AnotherDiscoverableProtocolProxy;
type RequestStream = AnotherDiscoverableProtocolRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AnotherDiscoverableProtocolSynchronousProxy;
const DEBUG_NAME: &'static str = "fake.library.FakeProtocol";
}
impl fidl::endpoints::DiscoverableProtocolMarker for AnotherDiscoverableProtocolMarker {}
pub trait AnotherDiscoverableProtocolProxyInterface: Send + Sync {}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AnotherDiscoverableProtocolSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AnotherDiscoverableProtocolSynchronousProxy {
type Proxy = AnotherDiscoverableProtocolProxy;
type Protocol = AnotherDiscoverableProtocolMarker;
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 AnotherDiscoverableProtocolSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<AnotherDiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<AnotherDiscoverableProtocolEvent, fidl::Error> {
AnotherDiscoverableProtocolEvent::decode(self.client.wait_for_event(deadline)?)
}
}
#[cfg(target_os = "fuchsia")]
impl From<AnotherDiscoverableProtocolSynchronousProxy> for zx::Handle {
fn from(value: AnotherDiscoverableProtocolSynchronousProxy) -> Self {
value.into_channel().into()
}
}
#[cfg(target_os = "fuchsia")]
impl From<fidl::Channel> for AnotherDiscoverableProtocolSynchronousProxy {
fn from(value: fidl::Channel) -> Self {
Self::new(value)
}
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::FromClient for AnotherDiscoverableProtocolSynchronousProxy {
type Protocol = AnotherDiscoverableProtocolMarker;
fn from_client(value: fidl::endpoints::ClientEnd<AnotherDiscoverableProtocolMarker>) -> Self {
Self::new(value.into_channel())
}
}
#[derive(Debug, Clone)]
pub struct AnotherDiscoverableProtocolProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AnotherDiscoverableProtocolProxy {
type Protocol = AnotherDiscoverableProtocolMarker;
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 AnotherDiscoverableProtocolProxy {
/// Create a new Proxy for test.protocols/AnotherDiscoverableProtocol.
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<AnotherDiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the protocol.
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> AnotherDiscoverableProtocolEventStream {
AnotherDiscoverableProtocolEventStream { event_receiver: self.client.take_event_receiver() }
}
}
impl AnotherDiscoverableProtocolProxyInterface for AnotherDiscoverableProtocolProxy {}
pub struct AnotherDiscoverableProtocolEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AnotherDiscoverableProtocolEventStream {}
impl futures::stream::FusedStream for AnotherDiscoverableProtocolEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AnotherDiscoverableProtocolEventStream {
type Item = Result<AnotherDiscoverableProtocolEvent, 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(AnotherDiscoverableProtocolEvent::decode(buf)))
}
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AnotherDiscoverableProtocolEvent {}
impl AnotherDiscoverableProtocolEvent {
/// Decodes a message buffer as a [`AnotherDiscoverableProtocolEvent`].
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AnotherDiscoverableProtocolEvent, 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: <AnotherDiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
})
}
}
}
/// A Stream of incoming requests for test.protocols/AnotherDiscoverableProtocol.
pub struct AnotherDiscoverableProtocolRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AnotherDiscoverableProtocolRequestStream {}
impl futures::stream::FusedStream for AnotherDiscoverableProtocolRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AnotherDiscoverableProtocolRequestStream {
type Protocol = AnotherDiscoverableProtocolMarker;
type ControlHandle = AnotherDiscoverableProtocolControlHandle;
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 {
AnotherDiscoverableProtocolControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for AnotherDiscoverableProtocolRequestStream {
type Item = Result<AnotherDiscoverableProtocolRequest, 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 AnotherDiscoverableProtocolRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))));
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <AnotherDiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AnotherDiscoverableProtocolRequest {}
impl AnotherDiscoverableProtocolRequest {
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {}
}
}
#[derive(Debug, Clone)]
pub struct AnotherDiscoverableProtocolControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AnotherDiscoverableProtocolControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl AnotherDiscoverableProtocolControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ChannelProtocolMarker;
impl fidl::endpoints::ProtocolMarker for ChannelProtocolMarker {
type Proxy = ChannelProtocolProxy;
type RequestStream = ChannelProtocolRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ChannelProtocolSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ChannelProtocol";
}
pub trait ChannelProtocolProxyInterface: Send + Sync {
fn r#method_a(&self, a: i64, b: i64) -> Result<(), fidl::Error>;
type MethodBResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
fn r#method_b(&self, a: i64, b: i64) -> Self::MethodBResponseFut;
type TakeHandleResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#take_handle(&self, h: fidl::Handle) -> Self::TakeHandleResponseFut;
type MutateSocketResponseFut: std::future::Future<Output = Result<fidl::Socket, fidl::Error>>
+ Send;
fn r#mutate_socket(&self, a: fidl::Socket) -> Self::MutateSocketResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ChannelProtocolSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ChannelProtocolSynchronousProxy {
type Proxy = ChannelProtocolProxy;
type Protocol = ChannelProtocolMarker;
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 ChannelProtocolSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ChannelProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<ChannelProtocolEvent, fidl::Error> {
ChannelProtocolEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#method_a(&self, mut a: i64, mut b: i64) -> Result<(), fidl::Error> {
self.client.send::<ChannelProtocolMethodARequest>(
(a, b),
0x2bc8d7d32bc66ba2,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#method_b(
&self,
mut a: i64,
mut b: i64,
___deadline: zx::MonotonicInstant,
) -> Result<i64, fidl::Error> {
let _response = self
.client
.send_query::<ChannelProtocolMethodBRequest, ChannelProtocolMethodBResponse>(
(a, b),
0x7b8dd3d6c741c9c6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.result)
}
pub fn r#take_handle(
&self,
mut h: fidl::Handle,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<ChannelProtocolTakeHandleRequest, fidl::encoding::EmptyPayload>(
(h,),
0x836fa31201a0a65,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#mutate_socket(
&self,
mut a: fidl::Socket,
___deadline: zx::MonotonicInstant,
) -> Result<fidl::Socket, fidl::Error> {
let _response = self
.client
.send_query::<ChannelProtocolMutateSocketRequest, ChannelProtocolMutateSocketResponse>(
(a,),
0x66dbcccc06f7f14f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.b)
}
}
#[cfg(target_os = "fuchsia")]
impl From<ChannelProtocolSynchronousProxy> for zx::Handle {
fn from(value: ChannelProtocolSynchronousProxy) -> Self {
value.into_channel().into()
}
}
#[cfg(target_os = "fuchsia")]
impl From<fidl::Channel> for ChannelProtocolSynchronousProxy {
fn from(value: fidl::Channel) -> Self {
Self::new(value)
}
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::FromClient for ChannelProtocolSynchronousProxy {
type Protocol = ChannelProtocolMarker;
fn from_client(value: fidl::endpoints::ClientEnd<ChannelProtocolMarker>) -> Self {
Self::new(value.into_channel())
}
}
#[derive(Debug, Clone)]
pub struct ChannelProtocolProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ChannelProtocolProxy {
type Protocol = ChannelProtocolMarker;
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 ChannelProtocolProxy {
/// Create a new Proxy for test.protocols/ChannelProtocol.
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ChannelProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the protocol.
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> ChannelProtocolEventStream {
ChannelProtocolEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#method_a(&self, mut a: i64, mut b: i64) -> Result<(), fidl::Error> {
ChannelProtocolProxyInterface::r#method_a(self, a, b)
}
pub fn r#method_b(
&self,
mut a: i64,
mut b: i64,
) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
ChannelProtocolProxyInterface::r#method_b(self, a, b)
}
pub fn r#take_handle(
&self,
mut h: fidl::Handle,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ChannelProtocolProxyInterface::r#take_handle(self, h)
}
pub fn r#mutate_socket(
&self,
mut a: fidl::Socket,
) -> fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>
{
ChannelProtocolProxyInterface::r#mutate_socket(self, a)
}
}
impl ChannelProtocolProxyInterface for ChannelProtocolProxy {
fn r#method_a(&self, mut a: i64, mut b: i64) -> Result<(), fidl::Error> {
self.client.send::<ChannelProtocolMethodARequest>(
(a, b),
0x2bc8d7d32bc66ba2,
fidl::encoding::DynamicFlags::empty(),
)
}
type MethodBResponseFut =
fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#method_b(&self, mut a: i64, mut b: i64) -> Self::MethodBResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<i64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ChannelProtocolMethodBResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7b8dd3d6c741c9c6,
>(_buf?)?;
Ok(_response.result)
}
self.client.send_query_and_decode::<ChannelProtocolMethodBRequest, i64>(
(a, b),
0x7b8dd3d6c741c9c6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type TakeHandleResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#take_handle(&self, mut h: fidl::Handle) -> Self::TakeHandleResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x836fa31201a0a65,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ChannelProtocolTakeHandleRequest, ()>(
(h,),
0x836fa31201a0a65,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type MutateSocketResponseFut =
fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#mutate_socket(&self, mut a: fidl::Socket) -> Self::MutateSocketResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl::Socket, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ChannelProtocolMutateSocketResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x66dbcccc06f7f14f,
>(_buf?)?;
Ok(_response.b)
}
self.client.send_query_and_decode::<ChannelProtocolMutateSocketRequest, fidl::Socket>(
(a,),
0x66dbcccc06f7f14f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ChannelProtocolEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ChannelProtocolEventStream {}
impl futures::stream::FusedStream for ChannelProtocolEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ChannelProtocolEventStream {
type Item = Result<ChannelProtocolEvent, 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(ChannelProtocolEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ChannelProtocolEvent {
EventA { a: i64, b: i64 },
}
impl ChannelProtocolEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_event_a(self) -> Option<(i64, i64)> {
if let ChannelProtocolEvent::EventA { a, b } = self { Some((a, b)) } else { None }
}
/// Decodes a message buffer as a [`ChannelProtocolEvent`].
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ChannelProtocolEvent, 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 {
0x1ed0a220297145ce => {
let mut out = fidl::new_empty!(
ChannelProtocolEventARequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelProtocolEventARequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((ChannelProtocolEvent::EventA { a: out.a, b: out.b }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<ChannelProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for test.protocols/ChannelProtocol.
pub struct ChannelProtocolRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ChannelProtocolRequestStream {}
impl futures::stream::FusedStream for ChannelProtocolRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ChannelProtocolRequestStream {
type Protocol = ChannelProtocolMarker;
type ControlHandle = ChannelProtocolControlHandle;
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 {
ChannelProtocolControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ChannelProtocolRequestStream {
type Item = Result<ChannelProtocolRequest, 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 ChannelProtocolRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))));
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2bc8d7d32bc66ba2 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ChannelProtocolMethodARequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelProtocolMethodARequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ChannelProtocolControlHandle { inner: this.inner.clone() };
Ok(ChannelProtocolRequest::MethodA { a: req.a, b: req.b, control_handle })
}
0x7b8dd3d6c741c9c6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelProtocolMethodBRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelProtocolMethodBRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ChannelProtocolControlHandle { inner: this.inner.clone() };
Ok(ChannelProtocolRequest::MethodB {
a: req.a,
b: req.b,
responder: ChannelProtocolMethodBResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x836fa31201a0a65 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelProtocolTakeHandleRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelProtocolTakeHandleRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ChannelProtocolControlHandle { inner: this.inner.clone() };
Ok(ChannelProtocolRequest::TakeHandle {
h: req.h,
responder: ChannelProtocolTakeHandleResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x66dbcccc06f7f14f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ChannelProtocolMutateSocketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelProtocolMutateSocketRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ChannelProtocolControlHandle { inner: this.inner.clone() };
Ok(ChannelProtocolRequest::MutateSocket {
a: req.a,
responder: ChannelProtocolMutateSocketResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ChannelProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ChannelProtocolRequest {
MethodA { a: i64, b: i64, control_handle: ChannelProtocolControlHandle },
MethodB { a: i64, b: i64, responder: ChannelProtocolMethodBResponder },
TakeHandle { h: fidl::Handle, responder: ChannelProtocolTakeHandleResponder },
MutateSocket { a: fidl::Socket, responder: ChannelProtocolMutateSocketResponder },
}
impl ChannelProtocolRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_method_a(self) -> Option<(i64, i64, ChannelProtocolControlHandle)> {
if let ChannelProtocolRequest::MethodA { a, b, control_handle } = self {
Some((a, b, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_method_b(self) -> Option<(i64, i64, ChannelProtocolMethodBResponder)> {
if let ChannelProtocolRequest::MethodB { a, b, responder } = self {
Some((a, b, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_take_handle(self) -> Option<(fidl::Handle, ChannelProtocolTakeHandleResponder)> {
if let ChannelProtocolRequest::TakeHandle { h, responder } = self {
Some((h, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_mutate_socket(
self,
) -> Option<(fidl::Socket, ChannelProtocolMutateSocketResponder)> {
if let ChannelProtocolRequest::MutateSocket { a, responder } = self {
Some((a, responder))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
ChannelProtocolRequest::MethodA { .. } => "method_a",
ChannelProtocolRequest::MethodB { .. } => "method_b",
ChannelProtocolRequest::TakeHandle { .. } => "take_handle",
ChannelProtocolRequest::MutateSocket { .. } => "mutate_socket",
}
}
}
#[derive(Debug, Clone)]
pub struct ChannelProtocolControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ChannelProtocolControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl ChannelProtocolControlHandle {
pub fn send_event_a(&self, mut a: i64, mut b: i64) -> Result<(), fidl::Error> {
self.inner.send::<ChannelProtocolEventARequest>(
(a, b),
0,
0x1ed0a220297145ce,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ChannelProtocolMethodBResponder {
control_handle: std::mem::ManuallyDrop<ChannelProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`ChannelProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for ChannelProtocolMethodBResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ChannelProtocolMethodBResponder {
type ControlHandle = ChannelProtocolControlHandle;
fn control_handle(&self) -> &ChannelProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl ChannelProtocolMethodBResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut result: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut result: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: i64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ChannelProtocolMethodBResponse>(
(result,),
self.tx_id,
0x7b8dd3d6c741c9c6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ChannelProtocolTakeHandleResponder {
control_handle: std::mem::ManuallyDrop<ChannelProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`ChannelProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for ChannelProtocolTakeHandleResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ChannelProtocolTakeHandleResponder {
type ControlHandle = ChannelProtocolControlHandle;
fn control_handle(&self) -> &ChannelProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl ChannelProtocolTakeHandleResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x836fa31201a0a65,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ChannelProtocolMutateSocketResponder {
control_handle: std::mem::ManuallyDrop<ChannelProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`ChannelProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for ChannelProtocolMutateSocketResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ChannelProtocolMutateSocketResponder {
type ControlHandle = ChannelProtocolControlHandle;
fn control_handle(&self) -> &ChannelProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl ChannelProtocolMutateSocketResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut b: fidl::Socket) -> Result<(), fidl::Error> {
let _result = self.send_raw(b);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut b: fidl::Socket) -> Result<(), fidl::Error> {
let _result = self.send_raw(b);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut b: fidl::Socket) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ChannelProtocolMutateSocketResponse>(
(b,),
self.tx_id,
0x66dbcccc06f7f14f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DiscoverableProtocolMarker;
impl fidl::endpoints::ProtocolMarker for DiscoverableProtocolMarker {
type Proxy = DiscoverableProtocolProxy;
type RequestStream = DiscoverableProtocolRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DiscoverableProtocolSynchronousProxy;
const DEBUG_NAME: &'static str = "test.protocols.DiscoverableProtocol";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DiscoverableProtocolMarker {}
pub trait DiscoverableProtocolProxyInterface: Send + Sync {
fn r#method(&self) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DiscoverableProtocolSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DiscoverableProtocolSynchronousProxy {
type Proxy = DiscoverableProtocolProxy;
type Protocol = DiscoverableProtocolMarker;
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 DiscoverableProtocolSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<DiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<DiscoverableProtocolEvent, fidl::Error> {
DiscoverableProtocolEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#method(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x2ff5ba3a2bd170eb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[cfg(target_os = "fuchsia")]
impl From<DiscoverableProtocolSynchronousProxy> for zx::Handle {
fn from(value: DiscoverableProtocolSynchronousProxy) -> Self {
value.into_channel().into()
}
}
#[cfg(target_os = "fuchsia")]
impl From<fidl::Channel> for DiscoverableProtocolSynchronousProxy {
fn from(value: fidl::Channel) -> Self {
Self::new(value)
}
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::FromClient for DiscoverableProtocolSynchronousProxy {
type Protocol = DiscoverableProtocolMarker;
fn from_client(value: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>) -> Self {
Self::new(value.into_channel())
}
}
#[derive(Debug, Clone)]
pub struct DiscoverableProtocolProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DiscoverableProtocolProxy {
type Protocol = DiscoverableProtocolMarker;
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 DiscoverableProtocolProxy {
/// Create a new Proxy for test.protocols/DiscoverableProtocol.
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<DiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the protocol.
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> DiscoverableProtocolEventStream {
DiscoverableProtocolEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#method(&self) -> Result<(), fidl::Error> {
DiscoverableProtocolProxyInterface::r#method(self)
}
}
impl DiscoverableProtocolProxyInterface for DiscoverableProtocolProxy {
fn r#method(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x2ff5ba3a2bd170eb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct DiscoverableProtocolEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DiscoverableProtocolEventStream {}
impl futures::stream::FusedStream for DiscoverableProtocolEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DiscoverableProtocolEventStream {
type Item = Result<DiscoverableProtocolEvent, 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(DiscoverableProtocolEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DiscoverableProtocolEvent {}
impl DiscoverableProtocolEvent {
/// Decodes a message buffer as a [`DiscoverableProtocolEvent`].
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DiscoverableProtocolEvent, 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:
<DiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for test.protocols/DiscoverableProtocol.
pub struct DiscoverableProtocolRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DiscoverableProtocolRequestStream {}
impl futures::stream::FusedStream for DiscoverableProtocolRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DiscoverableProtocolRequestStream {
type Protocol = DiscoverableProtocolMarker;
type ControlHandle = DiscoverableProtocolControlHandle;
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 {
DiscoverableProtocolControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for DiscoverableProtocolRequestStream {
type Item = Result<DiscoverableProtocolRequest, 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 DiscoverableProtocolRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))));
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2ff5ba3a2bd170eb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DiscoverableProtocolControlHandle {
inner: this.inner.clone(),
};
Ok(DiscoverableProtocolRequest::Method {
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <DiscoverableProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DiscoverableProtocolRequest {
Method { control_handle: DiscoverableProtocolControlHandle },
}
impl DiscoverableProtocolRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_method(self) -> Option<(DiscoverableProtocolControlHandle)> {
if let DiscoverableProtocolRequest::Method { control_handle } = self {
Some((control_handle))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
DiscoverableProtocolRequest::Method { .. } => "method",
}
}
}
#[derive(Debug, Clone)]
pub struct DiscoverableProtocolControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DiscoverableProtocolControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl DiscoverableProtocolControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HandleRightsProtocolMarker;
impl fidl::endpoints::ProtocolMarker for HandleRightsProtocolMarker {
type Proxy = HandleRightsProtocolProxy;
type RequestStream = HandleRightsProtocolRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HandleRightsProtocolSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) HandleRightsProtocol";
}
pub trait HandleRightsProtocolProxyInterface: Send + Sync {
fn r#no_response_method(&self, h: fidl::Socket) -> Result<(), fidl::Error>;
type ResponseMethodResponseFut: std::future::Future<Output = Result<fidl::Socket, fidl::Error>>
+ Send;
fn r#response_method(&self, h: fidl::Socket) -> Self::ResponseMethodResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HandleRightsProtocolSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HandleRightsProtocolSynchronousProxy {
type Proxy = HandleRightsProtocolProxy;
type Protocol = HandleRightsProtocolMarker;
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 HandleRightsProtocolSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<HandleRightsProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<HandleRightsProtocolEvent, fidl::Error> {
HandleRightsProtocolEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#no_response_method(&self, mut h: fidl::Socket) -> Result<(), fidl::Error> {
self.client.send::<HandleRightsProtocolNoResponseMethodRequest>(
(h,),
0x10078afd320d2bfd,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#response_method(
&self,
mut h: fidl::Socket,
___deadline: zx::MonotonicInstant,
) -> Result<fidl::Socket, fidl::Error> {
let _response = self.client.send_query::<
HandleRightsProtocolResponseMethodRequest,
HandleRightsProtocolResponseMethodResponse,
>(
(h,),
0x52a8f194ac143547,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.h)
}
}
#[cfg(target_os = "fuchsia")]
impl From<HandleRightsProtocolSynchronousProxy> for zx::Handle {
fn from(value: HandleRightsProtocolSynchronousProxy) -> Self {
value.into_channel().into()
}
}
#[cfg(target_os = "fuchsia")]
impl From<fidl::Channel> for HandleRightsProtocolSynchronousProxy {
fn from(value: fidl::Channel) -> Self {
Self::new(value)
}
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::FromClient for HandleRightsProtocolSynchronousProxy {
type Protocol = HandleRightsProtocolMarker;
fn from_client(value: fidl::endpoints::ClientEnd<HandleRightsProtocolMarker>) -> Self {
Self::new(value.into_channel())
}
}
#[derive(Debug, Clone)]
pub struct HandleRightsProtocolProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HandleRightsProtocolProxy {
type Protocol = HandleRightsProtocolMarker;
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 HandleRightsProtocolProxy {
/// Create a new Proxy for test.protocols/HandleRightsProtocol.
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<HandleRightsProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the protocol.
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> HandleRightsProtocolEventStream {
HandleRightsProtocolEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#no_response_method(&self, mut h: fidl::Socket) -> Result<(), fidl::Error> {
HandleRightsProtocolProxyInterface::r#no_response_method(self, h)
}
pub fn r#response_method(
&self,
mut h: fidl::Socket,
) -> fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>
{
HandleRightsProtocolProxyInterface::r#response_method(self, h)
}
}
impl HandleRightsProtocolProxyInterface for HandleRightsProtocolProxy {
fn r#no_response_method(&self, mut h: fidl::Socket) -> Result<(), fidl::Error> {
self.client.send::<HandleRightsProtocolNoResponseMethodRequest>(
(h,),
0x10078afd320d2bfd,
fidl::encoding::DynamicFlags::empty(),
)
}
type ResponseMethodResponseFut =
fidl::client::QueryResponseFut<fidl::Socket, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#response_method(&self, mut h: fidl::Socket) -> Self::ResponseMethodResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl::Socket, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
HandleRightsProtocolResponseMethodResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x52a8f194ac143547,
>(_buf?)?;
Ok(_response.h)
}
self.client
.send_query_and_decode::<HandleRightsProtocolResponseMethodRequest, fidl::Socket>(
(h,),
0x52a8f194ac143547,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct HandleRightsProtocolEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HandleRightsProtocolEventStream {}
impl futures::stream::FusedStream for HandleRightsProtocolEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HandleRightsProtocolEventStream {
type Item = Result<HandleRightsProtocolEvent, 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(HandleRightsProtocolEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HandleRightsProtocolEvent {
AnEvent { h: fidl::Socket },
}
impl HandleRightsProtocolEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_an_event(self) -> Option<fidl::Socket> {
if let HandleRightsProtocolEvent::AnEvent { h } = self { Some((h)) } else { None }
}
/// Decodes a message buffer as a [`HandleRightsProtocolEvent`].
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HandleRightsProtocolEvent, 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 {
0x69dad41418eb133 => {
let mut out = fidl::new_empty!(
HandleRightsProtocolAnEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HandleRightsProtocolAnEventRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((HandleRightsProtocolEvent::AnEvent { h: out.h }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<HandleRightsProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for test.protocols/HandleRightsProtocol.
pub struct HandleRightsProtocolRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HandleRightsProtocolRequestStream {}
impl futures::stream::FusedStream for HandleRightsProtocolRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HandleRightsProtocolRequestStream {
type Protocol = HandleRightsProtocolMarker;
type ControlHandle = HandleRightsProtocolControlHandle;
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 {
HandleRightsProtocolControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for HandleRightsProtocolRequestStream {
type Item = Result<HandleRightsProtocolRequest, 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 HandleRightsProtocolRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))));
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x10078afd320d2bfd => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(HandleRightsProtocolNoResponseMethodRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HandleRightsProtocolNoResponseMethodRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HandleRightsProtocolControlHandle {
inner: this.inner.clone(),
};
Ok(HandleRightsProtocolRequest::NoResponseMethod {h: req.h,
control_handle,
})
}
0x52a8f194ac143547 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(HandleRightsProtocolResponseMethodRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HandleRightsProtocolResponseMethodRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HandleRightsProtocolControlHandle {
inner: this.inner.clone(),
};
Ok(HandleRightsProtocolRequest::ResponseMethod {h: req.h,
responder: HandleRightsProtocolResponseMethodResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <HandleRightsProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HandleRightsProtocolRequest {
NoResponseMethod { h: fidl::Socket, control_handle: HandleRightsProtocolControlHandle },
ResponseMethod { h: fidl::Socket, responder: HandleRightsProtocolResponseMethodResponder },
}
impl HandleRightsProtocolRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_no_response_method(
self,
) -> Option<(fidl::Socket, HandleRightsProtocolControlHandle)> {
if let HandleRightsProtocolRequest::NoResponseMethod { h, control_handle } = self {
Some((h, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_response_method(
self,
) -> Option<(fidl::Socket, HandleRightsProtocolResponseMethodResponder)> {
if let HandleRightsProtocolRequest::ResponseMethod { h, responder } = self {
Some((h, responder))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
HandleRightsProtocolRequest::NoResponseMethod { .. } => "no_response_method",
HandleRightsProtocolRequest::ResponseMethod { .. } => "response_method",
}
}
}
#[derive(Debug, Clone)]
pub struct HandleRightsProtocolControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HandleRightsProtocolControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl HandleRightsProtocolControlHandle {
pub fn send_an_event(&self, mut h: fidl::Socket) -> Result<(), fidl::Error> {
self.inner.send::<HandleRightsProtocolAnEventRequest>(
(h,),
0,
0x69dad41418eb133,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HandleRightsProtocolResponseMethodResponder {
control_handle: std::mem::ManuallyDrop<HandleRightsProtocolControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`HandleRightsProtocolControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for HandleRightsProtocolResponseMethodResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HandleRightsProtocolResponseMethodResponder {
type ControlHandle = HandleRightsProtocolControlHandle;
fn control_handle(&self) -> &HandleRightsProtocolControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl HandleRightsProtocolResponseMethodResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut h: fidl::Socket) -> Result<(), fidl::Error> {
let _result = self.send_raw(h);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut h: fidl::Socket) -> Result<(), fidl::Error> {
let _result = self.send_raw(h);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut h: fidl::Socket) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<HandleRightsProtocolResponseMethodResponse>(
(h,),
self.tx_id,
0x52a8f194ac143547,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ManyParametersMarker;
impl fidl::endpoints::ProtocolMarker for ManyParametersMarker {
type Proxy = ManyParametersProxy;
type RequestStream = ManyParametersRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ManyParametersSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ManyParameters";
}
pub trait ManyParametersProxyInterface: Send + Sync {
fn r#fifteen(
&self,
p1: bool,
p2: bool,
p3: bool,
p4: bool,
p5: bool,
p6: bool,
p7: bool,
p8: bool,
p9: bool,
p10: bool,
p11: bool,
p12: bool,
p13: bool,
p14: bool,
p15: bool,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ManyParametersSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ManyParametersSynchronousProxy {
type Proxy = ManyParametersProxy;
type Protocol = ManyParametersMarker;
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 ManyParametersSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ManyParametersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<ManyParametersEvent, fidl::Error> {
ManyParametersEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#fifteen(
&self,
mut p1: bool,
mut p2: bool,
mut p3: bool,
mut p4: bool,
mut p5: bool,
mut p6: bool,
mut p7: bool,
mut p8: bool,
mut p9: bool,
mut p10: bool,
mut p11: bool,
mut p12: bool,
mut p13: bool,
mut p14: bool,
mut p15: bool,
) -> Result<(), fidl::Error> {
self.client.send::<ManyParametersFifteenRequest>(
(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15),
0x59233bcecd338967,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[cfg(target_os = "fuchsia")]
impl From<ManyParametersSynchronousProxy> for zx::Handle {
fn from(value: ManyParametersSynchronousProxy) -> Self {
value.into_channel().into()
}
}
#[cfg(target_os = "fuchsia")]
impl From<fidl::Channel> for ManyParametersSynchronousProxy {
fn from(value: fidl::Channel) -> Self {
Self::new(value)
}
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::FromClient for ManyParametersSynchronousProxy {
type Protocol = ManyParametersMarker;
fn from_client(value: fidl::endpoints::ClientEnd<ManyParametersMarker>) -> Self {
Self::new(value.into_channel())
}
}
#[derive(Debug, Clone)]
pub struct ManyParametersProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ManyParametersProxy {
type Protocol = ManyParametersMarker;
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 ManyParametersProxy {
/// Create a new Proxy for test.protocols/ManyParameters.
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ManyParametersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the protocol.
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> ManyParametersEventStream {
ManyParametersEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#fifteen(
&self,
mut p1: bool,
mut p2: bool,
mut p3: bool,
mut p4: bool,
mut p5: bool,
mut p6: bool,
mut p7: bool,
mut p8: bool,
mut p9: bool,
mut p10: bool,
mut p11: bool,
mut p12: bool,
mut p13: bool,
mut p14: bool,
mut p15: bool,
) -> Result<(), fidl::Error> {
ManyParametersProxyInterface::r#fifteen(
self, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15,
)
}
}
impl ManyParametersProxyInterface for ManyParametersProxy {
fn r#fifteen(
&self,
mut p1: bool,
mut p2: bool,
mut p3: bool,
mut p4: bool,
mut p5: bool,
mut p6: bool,
mut p7: bool,
mut p8: bool,
mut p9: bool,
mut p10: bool,
mut p11: bool,
mut p12: bool,
mut p13: bool,
mut p14: bool,
mut p15: bool,
) -> Result<(), fidl::Error> {
self.client.send::<ManyParametersFifteenRequest>(
(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15),
0x59233bcecd338967,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct ManyParametersEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ManyParametersEventStream {}
impl futures::stream::FusedStream for ManyParametersEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ManyParametersEventStream {
type Item = Result<ManyParametersEvent, 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(ManyParametersEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ManyParametersEvent {}
impl ManyParametersEvent {
/// Decodes a message buffer as a [`ManyParametersEvent`].
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ManyParametersEvent, 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:
<ManyParametersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for test.protocols/ManyParameters.
pub struct ManyParametersRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ManyParametersRequestStream {}
impl futures::stream::FusedStream for ManyParametersRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ManyParametersRequestStream {
type Protocol = ManyParametersMarker;
type ControlHandle = ManyParametersControlHandle;
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 {
ManyParametersControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ManyParametersRequestStream {
type Item = Result<ManyParametersRequest, 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 ManyParametersRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))));
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x59233bcecd338967 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ManyParametersFifteenRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManyParametersFifteenRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ManyParametersControlHandle { inner: this.inner.clone() };
Ok(ManyParametersRequest::Fifteen {
p1: req.p1,
p2: req.p2,
p3: req.p3,
p4: req.p4,
p5: req.p5,
p6: req.p6,
p7: req.p7,
p8: req.p8,
p9: req.p9,
p10: req.p10,
p11: req.p11,
p12: req.p12,
p13: req.p13,
p14: req.p14,
p15: req.p15,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ManyParametersMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ManyParametersRequest {
Fifteen {
p1: bool,
p2: bool,
p3: bool,
p4: bool,
p5: bool,
p6: bool,
p7: bool,
p8: bool,
p9: bool,
p10: bool,
p11: bool,
p12: bool,
p13: bool,
p14: bool,
p15: bool,
control_handle: ManyParametersControlHandle,
},
}
impl ManyParametersRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_fifteen(
self,
) -> Option<(
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
ManyParametersControlHandle,
)> {
if let ManyParametersRequest::Fifteen {
p1,
p2,
p3,
p4,
p5,
p6,
p7,
p8,
p9,
p10,
p11,
p12,
p13,
p14,
p15,
control_handle,
} = self
{
Some((p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, control_handle))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
ManyParametersRequest::Fifteen { .. } => "fifteen",
}
}
}
#[derive(Debug, Clone)]
pub struct ManyParametersControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ManyParametersControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl ManyParametersControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct MethodWithUnionMarker;
impl fidl::endpoints::ProtocolMarker for MethodWithUnionMarker {
type Proxy = MethodWithUnionProxy;
type RequestStream = MethodWithUnionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = MethodWithUnionSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) MethodWithUnion";
}
pub trait MethodWithUnionProxyInterface: Send + Sync {
type UnionMethodResponseFut: std::future::Future<Output = Result<Option<Box<TheUnion>>, fidl::Error>>
+ Send;
fn r#union_method(&self, u: &TheUnion) -> Self::UnionMethodResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct MethodWithUnionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for MethodWithUnionSynchronousProxy {
type Proxy = MethodWithUnionProxy;
type Protocol = MethodWithUnionMarker;
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 MethodWithUnionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <MethodWithUnionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<MethodWithUnionEvent, fidl::Error> {
MethodWithUnionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#union_method(
&self,
mut u: &TheUnion,
___deadline: zx::MonotonicInstant,
) -> Result<Option<Box<TheUnion>>, fidl::Error> {
let _response = self
.client
.send_query::<MethodWithUnionUnionMethodRequest, MethodWithUnionUnionMethodResponse>(
(u,),
0x393e7f5b2b821218,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.u)
}
}
#[cfg(target_os = "fuchsia")]
impl From<MethodWithUnionSynchronousProxy> for zx::Handle {
fn from(value: MethodWithUnionSynchronousProxy) -> Self {
value.into_channel().into()
}
}
#[cfg(target_os = "fuchsia")]
impl From<fidl::Channel> for MethodWithUnionSynchronousProxy {
fn from(value: fidl::Channel) -> Self {
Self::new(value)
}
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::FromClient for MethodWithUnionSynchronousProxy {
type Protocol = MethodWithUnionMarker;
fn from_client(value: fidl::endpoints::ClientEnd<MethodWithUnionMarker>) -> Self {
Self::new(value.into_channel())
}
}
#[derive(Debug, Clone)]
pub struct MethodWithUnionProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for MethodWithUnionProxy {
type Protocol = MethodWithUnionMarker;
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 MethodWithUnionProxy {
/// Create a new Proxy for test.protocols/MethodWithUnion.
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <MethodWithUnionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the protocol.
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> MethodWithUnionEventStream {
MethodWithUnionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#union_method(
&self,
mut u: &TheUnion,
) -> fidl::client::QueryResponseFut<
Option<Box<TheUnion>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
MethodWithUnionProxyInterface::r#union_method(self, u)
}
}
impl MethodWithUnionProxyInterface for MethodWithUnionProxy {
type UnionMethodResponseFut = fidl::client::QueryResponseFut<
Option<Box<TheUnion>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#union_method(&self, mut u: &TheUnion) -> Self::UnionMethodResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Option<Box<TheUnion>>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
MethodWithUnionUnionMethodResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x393e7f5b2b821218,
>(_buf?)?;
Ok(_response.u)
}
self.client
.send_query_and_decode::<MethodWithUnionUnionMethodRequest, Option<Box<TheUnion>>>(
(u,),
0x393e7f5b2b821218,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct MethodWithUnionEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for MethodWithUnionEventStream {}
impl futures::stream::FusedStream for MethodWithUnionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for MethodWithUnionEventStream {
type Item = Result<MethodWithUnionEvent, 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(MethodWithUnionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum MethodWithUnionEvent {}
impl MethodWithUnionEvent {
/// Decodes a message buffer as a [`MethodWithUnionEvent`].
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<MethodWithUnionEvent, 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:
<MethodWithUnionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for test.protocols/MethodWithUnion.
pub struct MethodWithUnionRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for MethodWithUnionRequestStream {}
impl futures::stream::FusedStream for MethodWithUnionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for MethodWithUnionRequestStream {
type Protocol = MethodWithUnionMarker;
type ControlHandle = MethodWithUnionControlHandle;
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 {
MethodWithUnionControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for MethodWithUnionRequestStream {
type Item = Result<MethodWithUnionRequest, 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 MethodWithUnionRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))));
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x393e7f5b2b821218 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
MethodWithUnionUnionMethodRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MethodWithUnionUnionMethodRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
MethodWithUnionControlHandle { inner: this.inner.clone() };
Ok(MethodWithUnionRequest::UnionMethod {
u: req.u,
responder: MethodWithUnionUnionMethodResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<MethodWithUnionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum MethodWithUnionRequest {
UnionMethod { u: TheUnion, responder: MethodWithUnionUnionMethodResponder },
}
impl MethodWithUnionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_union_method(self) -> Option<(TheUnion, MethodWithUnionUnionMethodResponder)> {
if let MethodWithUnionRequest::UnionMethod { u, responder } = self {
Some((u, responder))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
MethodWithUnionRequest::UnionMethod { .. } => "union_method",
}
}
}
#[derive(Debug, Clone)]
pub struct MethodWithUnionControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for MethodWithUnionControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl MethodWithUnionControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct MethodWithUnionUnionMethodResponder {
control_handle: std::mem::ManuallyDrop<MethodWithUnionControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`MethodWithUnionControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for MethodWithUnionUnionMethodResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for MethodWithUnionUnionMethodResponder {
type ControlHandle = MethodWithUnionControlHandle;
fn control_handle(&self) -> &MethodWithUnionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl MethodWithUnionUnionMethodResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut u: Option<&TheUnion>) -> Result<(), fidl::Error> {
let _result = self.send_raw(u);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut u: Option<&TheUnion>) -> Result<(), fidl::Error> {
let _result = self.send_raw(u);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut u: Option<&TheUnion>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<MethodWithUnionUnionMethodResponse>(
(u,),
self.tx_id,
0x393e7f5b2b821218,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PlatformServer_Marker;
impl fidl::endpoints::ProtocolMarker for PlatformServer_Marker {
type Proxy = PlatformServer_Proxy;
type RequestStream = PlatformServer_RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PlatformServer_SynchronousProxy;
const DEBUG_NAME: &'static str = "test.protocols.PlatformServer";
}
impl fidl::endpoints::DiscoverableProtocolMarker for PlatformServer_Marker {}
pub trait PlatformServer_ProxyInterface: Send + Sync {}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PlatformServer_SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PlatformServer_SynchronousProxy {
type Proxy = PlatformServer_Proxy;
type Protocol = PlatformServer_Marker;
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 PlatformServer_SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PlatformServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<PlatformServer_Event, fidl::Error> {
PlatformServer_Event::decode(self.client.wait_for_event(deadline)?)
}
}
#[cfg(target_os = "fuchsia")]
impl From<PlatformServer_SynchronousProxy> for zx::Handle {
fn from(value: PlatformServer_SynchronousProxy) -> Self {
value.into_channel().into()
}
}
#[cfg(target_os = "fuchsia")]
impl From<fidl::Channel> for PlatformServer_SynchronousProxy {
fn from(value: fidl::Channel) -> Self {
Self::new(value)
}
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::FromClient for PlatformServer_SynchronousProxy {
type Protocol = PlatformServer_Marker;
fn from_client(value: fidl::endpoints::ClientEnd<PlatformServer_Marker>) -> Self {
Self::new(value.into_channel())
}
}
#[derive(Debug, Clone)]
pub struct PlatformServer_Proxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PlatformServer_Proxy {
type Protocol = PlatformServer_Marker;
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 PlatformServer_Proxy {
/// Create a new Proxy for test.protocols/PlatformServer.
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PlatformServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the protocol.
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> PlatformServer_EventStream {
PlatformServer_EventStream { event_receiver: self.client.take_event_receiver() }
}
}
impl PlatformServer_ProxyInterface for PlatformServer_Proxy {}
pub struct PlatformServer_EventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PlatformServer_EventStream {}
impl futures::stream::FusedStream for PlatformServer_EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PlatformServer_EventStream {
type Item = Result<PlatformServer_Event, 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(PlatformServer_Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PlatformServer_Event {}
impl PlatformServer_Event {
/// Decodes a message buffer as a [`PlatformServer_Event`].
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PlatformServer_Event, 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:
<PlatformServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for test.protocols/PlatformServer.
pub struct PlatformServer_RequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PlatformServer_RequestStream {}
impl futures::stream::FusedStream for PlatformServer_RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PlatformServer_RequestStream {
type Protocol = PlatformServer_Marker;
type ControlHandle = PlatformServer_ControlHandle;
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 {
PlatformServer_ControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for PlatformServer_RequestStream {
type Item = Result<PlatformServer_Request, 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 PlatformServer_RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))));
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PlatformServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PlatformServer_Request {}
impl PlatformServer_Request {
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {}
}
}
#[derive(Debug, Clone)]
pub struct PlatformServer_ControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PlatformServer_ControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl PlatformServer_ControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct WithAndWithoutRequestResponseMarker;
impl fidl::endpoints::ProtocolMarker for WithAndWithoutRequestResponseMarker {
type Proxy = WithAndWithoutRequestResponseProxy;
type RequestStream = WithAndWithoutRequestResponseRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = WithAndWithoutRequestResponseSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) WithAndWithoutRequestResponse";
}
pub trait WithAndWithoutRequestResponseProxyInterface: Send + Sync {
fn r#no_request_no_response(&self) -> Result<(), fidl::Error>;
type NoRequestEmptyResponseResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#no_request_empty_response(&self) -> Self::NoRequestEmptyResponseResponseFut;
type NoRequestWithResponseResponseFut: std::future::Future<Output = Result<String, fidl::Error>>
+ Send;
fn r#no_request_with_response(&self) -> Self::NoRequestWithResponseResponseFut;
fn r#with_request_no_response(&self, arg: &str) -> Result<(), fidl::Error>;
type WithRequestEmptyResponseResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#with_request_empty_response(&self, arg: &str)
-> Self::WithRequestEmptyResponseResponseFut;
type WithRequestWithResponseResponseFut: std::future::Future<Output = Result<String, fidl::Error>>
+ Send;
fn r#with_request_with_response(&self, arg: &str) -> Self::WithRequestWithResponseResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct WithAndWithoutRequestResponseSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for WithAndWithoutRequestResponseSynchronousProxy {
type Proxy = WithAndWithoutRequestResponseProxy;
type Protocol = WithAndWithoutRequestResponseMarker;
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 WithAndWithoutRequestResponseSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<WithAndWithoutRequestResponseMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<WithAndWithoutRequestResponseEvent, fidl::Error> {
WithAndWithoutRequestResponseEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#no_request_no_response(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x4b212a6c8c5f7bab,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#no_request_empty_response(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
(),
0x16a329d17f458668,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#no_request_with_response(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<String, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
WithAndWithoutRequestResponseNoRequestWithResponseResponse,
>(
(),
0x7d6b2fcf0e2a65bd,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.ret)
}
pub fn r#with_request_no_response(&self, mut arg: &str) -> Result<(), fidl::Error> {
self.client.send::<WithAndWithoutRequestResponseWithRequestNoResponseRequest>(
(arg,),
0x65ab625138c50a77,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#with_request_empty_response(
&self,
mut arg: &str,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
WithAndWithoutRequestResponseWithRequestEmptyResponseRequest,
fidl::encoding::EmptyPayload,
>(
(arg,),
0x27ee4d2bd405df5f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
pub fn r#with_request_with_response(
&self,
mut arg: &str,
___deadline: zx::MonotonicInstant,
) -> Result<String, fidl::Error> {
let _response = self.client.send_query::<
WithAndWithoutRequestResponseWithRequestWithResponseRequest,
WithAndWithoutRequestResponseWithRequestWithResponseResponse,
>(
(arg,),
0x590e91945d58f5b1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.ret)
}
}
#[cfg(target_os = "fuchsia")]
impl From<WithAndWithoutRequestResponseSynchronousProxy> for zx::Handle {
fn from(value: WithAndWithoutRequestResponseSynchronousProxy) -> Self {
value.into_channel().into()
}
}
#[cfg(target_os = "fuchsia")]
impl From<fidl::Channel> for WithAndWithoutRequestResponseSynchronousProxy {
fn from(value: fidl::Channel) -> Self {
Self::new(value)
}
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::FromClient for WithAndWithoutRequestResponseSynchronousProxy {
type Protocol = WithAndWithoutRequestResponseMarker;
fn from_client(value: fidl::endpoints::ClientEnd<WithAndWithoutRequestResponseMarker>) -> Self {
Self::new(value.into_channel())
}
}
#[derive(Debug, Clone)]
pub struct WithAndWithoutRequestResponseProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for WithAndWithoutRequestResponseProxy {
type Protocol = WithAndWithoutRequestResponseMarker;
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 WithAndWithoutRequestResponseProxy {
/// Create a new Proxy for test.protocols/WithAndWithoutRequestResponse.
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<WithAndWithoutRequestResponseMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the protocol.
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> WithAndWithoutRequestResponseEventStream {
WithAndWithoutRequestResponseEventStream {
event_receiver: self.client.take_event_receiver(),
}
}
pub fn r#no_request_no_response(&self) -> Result<(), fidl::Error> {
WithAndWithoutRequestResponseProxyInterface::r#no_request_no_response(self)
}
pub fn r#no_request_empty_response(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
WithAndWithoutRequestResponseProxyInterface::r#no_request_empty_response(self)
}
pub fn r#no_request_with_response(
&self,
) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
WithAndWithoutRequestResponseProxyInterface::r#no_request_with_response(self)
}
pub fn r#with_request_no_response(&self, mut arg: &str) -> Result<(), fidl::Error> {
WithAndWithoutRequestResponseProxyInterface::r#with_request_no_response(self, arg)
}
pub fn r#with_request_empty_response(
&self,
mut arg: &str,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
WithAndWithoutRequestResponseProxyInterface::r#with_request_empty_response(self, arg)
}
pub fn r#with_request_with_response(
&self,
mut arg: &str,
) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
WithAndWithoutRequestResponseProxyInterface::r#with_request_with_response(self, arg)
}
}
impl WithAndWithoutRequestResponseProxyInterface for WithAndWithoutRequestResponseProxy {
fn r#no_request_no_response(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x4b212a6c8c5f7bab,
fidl::encoding::DynamicFlags::empty(),
)
}
type NoRequestEmptyResponseResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#no_request_empty_response(&self) -> Self::NoRequestEmptyResponseResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x16a329d17f458668,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x16a329d17f458668,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type NoRequestWithResponseResponseFut =
fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#no_request_with_response(&self) -> Self::NoRequestWithResponseResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<String, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
WithAndWithoutRequestResponseNoRequestWithResponseResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7d6b2fcf0e2a65bd,
>(_buf?)?;
Ok(_response.ret)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
(),
0x7d6b2fcf0e2a65bd,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#with_request_no_response(&self, mut arg: &str) -> Result<(), fidl::Error> {
self.client.send::<WithAndWithoutRequestResponseWithRequestNoResponseRequest>(
(arg,),
0x65ab625138c50a77,
fidl::encoding::DynamicFlags::empty(),
)
}
type WithRequestEmptyResponseResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#with_request_empty_response(
&self,
mut arg: &str,
) -> Self::WithRequestEmptyResponseResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x27ee4d2bd405df5f,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<
WithAndWithoutRequestResponseWithRequestEmptyResponseRequest,
(),
>(
(arg,),
0x27ee4d2bd405df5f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WithRequestWithResponseResponseFut =
fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#with_request_with_response(
&self,
mut arg: &str,
) -> Self::WithRequestWithResponseResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<String, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
WithAndWithoutRequestResponseWithRequestWithResponseResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x590e91945d58f5b1,
>(_buf?)?;
Ok(_response.ret)
}
self.client.send_query_and_decode::<
WithAndWithoutRequestResponseWithRequestWithResponseRequest,
String,
>(
(arg,),
0x590e91945d58f5b1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct WithAndWithoutRequestResponseEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for WithAndWithoutRequestResponseEventStream {}
impl futures::stream::FusedStream for WithAndWithoutRequestResponseEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for WithAndWithoutRequestResponseEventStream {
type Item = Result<WithAndWithoutRequestResponseEvent, 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(WithAndWithoutRequestResponseEvent::decode(buf)))
}
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum WithAndWithoutRequestResponseEvent {
OnEmptyResponse {},
OnWithResponse { ret: String },
}
impl WithAndWithoutRequestResponseEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_empty_response(self) -> Option<()> {
if let WithAndWithoutRequestResponseEvent::OnEmptyResponse {} = self {
Some(())
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_with_response(self) -> Option<String> {
if let WithAndWithoutRequestResponseEvent::OnWithResponse { ret } = self {
Some((ret))
} else {
None
}
}
/// Decodes a message buffer as a [`WithAndWithoutRequestResponseEvent`].
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<WithAndWithoutRequestResponseEvent, 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 {
0x4ae85a2b8d7c2e56 => {
let mut out = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((
WithAndWithoutRequestResponseEvent::OnEmptyResponse {
}
))
}
0x50a6f21a322f31a8 => {
let mut out = fidl::new_empty!(WithAndWithoutRequestResponseOnWithResponseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WithAndWithoutRequestResponseOnWithResponseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((
WithAndWithoutRequestResponseEvent::OnWithResponse {ret: out.ret,
}
))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <WithAndWithoutRequestResponseMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
})
}
}
}
/// A Stream of incoming requests for test.protocols/WithAndWithoutRequestResponse.
pub struct WithAndWithoutRequestResponseRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for WithAndWithoutRequestResponseRequestStream {}
impl futures::stream::FusedStream for WithAndWithoutRequestResponseRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for WithAndWithoutRequestResponseRequestStream {
type Protocol = WithAndWithoutRequestResponseMarker;
type ControlHandle = WithAndWithoutRequestResponseControlHandle;
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 {
WithAndWithoutRequestResponseControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for WithAndWithoutRequestResponseRequestStream {
type Item = Result<WithAndWithoutRequestResponseRequest, 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 WithAndWithoutRequestResponseRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))));
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x4b212a6c8c5f7bab => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = WithAndWithoutRequestResponseControlHandle {
inner: this.inner.clone(),
};
Ok(WithAndWithoutRequestResponseRequest::NoRequestNoResponse {
control_handle,
})
}
0x16a329d17f458668 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = WithAndWithoutRequestResponseControlHandle {
inner: this.inner.clone(),
};
Ok(WithAndWithoutRequestResponseRequest::NoRequestEmptyResponse {
responder: WithAndWithoutRequestResponseNoRequestEmptyResponseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7d6b2fcf0e2a65bd => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = WithAndWithoutRequestResponseControlHandle {
inner: this.inner.clone(),
};
Ok(WithAndWithoutRequestResponseRequest::NoRequestWithResponse {
responder: WithAndWithoutRequestResponseNoRequestWithResponseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x65ab625138c50a77 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(WithAndWithoutRequestResponseWithRequestNoResponseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WithAndWithoutRequestResponseWithRequestNoResponseRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = WithAndWithoutRequestResponseControlHandle {
inner: this.inner.clone(),
};
Ok(WithAndWithoutRequestResponseRequest::WithRequestNoResponse {arg: req.arg,
control_handle,
})
}
0x27ee4d2bd405df5f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(WithAndWithoutRequestResponseWithRequestEmptyResponseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WithAndWithoutRequestResponseWithRequestEmptyResponseRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = WithAndWithoutRequestResponseControlHandle {
inner: this.inner.clone(),
};
Ok(WithAndWithoutRequestResponseRequest::WithRequestEmptyResponse {arg: req.arg,
responder: WithAndWithoutRequestResponseWithRequestEmptyResponseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x590e91945d58f5b1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(WithAndWithoutRequestResponseWithRequestWithResponseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WithAndWithoutRequestResponseWithRequestWithResponseRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = WithAndWithoutRequestResponseControlHandle {
inner: this.inner.clone(),
};
Ok(WithAndWithoutRequestResponseRequest::WithRequestWithResponse {arg: req.arg,
responder: WithAndWithoutRequestResponseWithRequestWithResponseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <WithAndWithoutRequestResponseMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum WithAndWithoutRequestResponseRequest {
NoRequestNoResponse {
control_handle: WithAndWithoutRequestResponseControlHandle,
},
NoRequestEmptyResponse {
responder: WithAndWithoutRequestResponseNoRequestEmptyResponseResponder,
},
NoRequestWithResponse {
responder: WithAndWithoutRequestResponseNoRequestWithResponseResponder,
},
WithRequestNoResponse {
arg: String,
control_handle: WithAndWithoutRequestResponseControlHandle,
},
WithRequestEmptyResponse {
arg: String,
responder: WithAndWithoutRequestResponseWithRequestEmptyResponseResponder,
},
WithRequestWithResponse {
arg: String,
responder: WithAndWithoutRequestResponseWithRequestWithResponseResponder,
},
}
impl WithAndWithoutRequestResponseRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_no_request_no_response(
self,
) -> Option<(WithAndWithoutRequestResponseControlHandle)> {
if let WithAndWithoutRequestResponseRequest::NoRequestNoResponse { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_no_request_empty_response(
self,
) -> Option<(WithAndWithoutRequestResponseNoRequestEmptyResponseResponder)> {
if let WithAndWithoutRequestResponseRequest::NoRequestEmptyResponse { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_no_request_with_response(
self,
) -> Option<(WithAndWithoutRequestResponseNoRequestWithResponseResponder)> {
if let WithAndWithoutRequestResponseRequest::NoRequestWithResponse { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_with_request_no_response(
self,
) -> Option<(String, WithAndWithoutRequestResponseControlHandle)> {
if let WithAndWithoutRequestResponseRequest::WithRequestNoResponse { arg, control_handle } =
self
{
Some((arg, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_with_request_empty_response(
self,
) -> Option<(String, WithAndWithoutRequestResponseWithRequestEmptyResponseResponder)> {
if let WithAndWithoutRequestResponseRequest::WithRequestEmptyResponse { arg, responder } =
self
{
Some((arg, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_with_request_with_response(
self,
) -> Option<(String, WithAndWithoutRequestResponseWithRequestWithResponseResponder)> {
if let WithAndWithoutRequestResponseRequest::WithRequestWithResponse { arg, responder } =
self
{
Some((arg, responder))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
WithAndWithoutRequestResponseRequest::NoRequestNoResponse { .. } => {
"no_request_no_response"
}
WithAndWithoutRequestResponseRequest::NoRequestEmptyResponse { .. } => {
"no_request_empty_response"
}
WithAndWithoutRequestResponseRequest::NoRequestWithResponse { .. } => {
"no_request_with_response"
}
WithAndWithoutRequestResponseRequest::WithRequestNoResponse { .. } => {
"with_request_no_response"
}
WithAndWithoutRequestResponseRequest::WithRequestEmptyResponse { .. } => {
"with_request_empty_response"
}
WithAndWithoutRequestResponseRequest::WithRequestWithResponse { .. } => {
"with_request_with_response"
}
}
}
}
#[derive(Debug, Clone)]
pub struct WithAndWithoutRequestResponseControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for WithAndWithoutRequestResponseControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl WithAndWithoutRequestResponseControlHandle {
pub fn send_on_empty_response(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x4ae85a2b8d7c2e56,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn send_on_with_response(&self, mut ret: &str) -> Result<(), fidl::Error> {
self.inner.send::<WithAndWithoutRequestResponseOnWithResponseRequest>(
(ret,),
0,
0x50a6f21a322f31a8,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WithAndWithoutRequestResponseNoRequestEmptyResponseResponder {
control_handle: std::mem::ManuallyDrop<WithAndWithoutRequestResponseControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`WithAndWithoutRequestResponseControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for WithAndWithoutRequestResponseNoRequestEmptyResponseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WithAndWithoutRequestResponseNoRequestEmptyResponseResponder {
type ControlHandle = WithAndWithoutRequestResponseControlHandle;
fn control_handle(&self) -> &WithAndWithoutRequestResponseControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl WithAndWithoutRequestResponseNoRequestEmptyResponseResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x16a329d17f458668,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WithAndWithoutRequestResponseNoRequestWithResponseResponder {
control_handle: std::mem::ManuallyDrop<WithAndWithoutRequestResponseControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`WithAndWithoutRequestResponseControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for WithAndWithoutRequestResponseNoRequestWithResponseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WithAndWithoutRequestResponseNoRequestWithResponseResponder {
type ControlHandle = WithAndWithoutRequestResponseControlHandle;
fn control_handle(&self) -> &WithAndWithoutRequestResponseControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl WithAndWithoutRequestResponseNoRequestWithResponseResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut ret: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(ret);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut ret: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(ret);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut ret: &str) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<WithAndWithoutRequestResponseNoRequestWithResponseResponse>(
(ret,),
self.tx_id,
0x7d6b2fcf0e2a65bd,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WithAndWithoutRequestResponseWithRequestEmptyResponseResponder {
control_handle: std::mem::ManuallyDrop<WithAndWithoutRequestResponseControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`WithAndWithoutRequestResponseControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for WithAndWithoutRequestResponseWithRequestEmptyResponseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WithAndWithoutRequestResponseWithRequestEmptyResponseResponder {
type ControlHandle = WithAndWithoutRequestResponseControlHandle;
fn control_handle(&self) -> &WithAndWithoutRequestResponseControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl WithAndWithoutRequestResponseWithRequestEmptyResponseResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x27ee4d2bd405df5f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WithAndWithoutRequestResponseWithRequestWithResponseResponder {
control_handle: std::mem::ManuallyDrop<WithAndWithoutRequestResponseControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`WithAndWithoutRequestResponseControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for WithAndWithoutRequestResponseWithRequestWithResponseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WithAndWithoutRequestResponseWithRequestWithResponseResponder {
type ControlHandle = WithAndWithoutRequestResponseControlHandle;
fn control_handle(&self) -> &WithAndWithoutRequestResponseControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl WithAndWithoutRequestResponseWithRequestWithResponseResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut ret: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(ret);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut ret: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(ret);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut ret: &str) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<WithAndWithoutRequestResponseWithRequestWithResponseResponse>(
(ret,),
self.tx_id,
0x590e91945d58f5b1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct WithErrorSyntaxMarker;
impl fidl::endpoints::ProtocolMarker for WithErrorSyntaxMarker {
type Proxy = WithErrorSyntaxProxy;
type RequestStream = WithErrorSyntaxRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = WithErrorSyntaxSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) WithErrorSyntax";
}
pub type WithErrorSyntaxResponseAsStructResult = Result<(i64, i64, i64), u32>;
pub type WithErrorSyntaxErrorAsPrimitiveResult = Result<(), u32>;
pub type WithErrorSyntaxErrorAsEnumResult = Result<(), ErrorEnum>;
pub type WithErrorSyntaxHandleInResultResult = Result<fidl::Handle, u32>;
pub trait WithErrorSyntaxProxyInterface: Send + Sync {
type ResponseAsStructResponseFut: std::future::Future<Output = Result<WithErrorSyntaxResponseAsStructResult, fidl::Error>>
+ Send;
fn r#response_as_struct(&self) -> Self::ResponseAsStructResponseFut;
type ErrorAsPrimitiveResponseFut: std::future::Future<Output = Result<WithErrorSyntaxErrorAsPrimitiveResult, fidl::Error>>
+ Send;
fn r#error_as_primitive(&self) -> Self::ErrorAsPrimitiveResponseFut;
type ErrorAsEnumResponseFut: std::future::Future<Output = Result<WithErrorSyntaxErrorAsEnumResult, fidl::Error>>
+ Send;
fn r#error_as_enum(&self) -> Self::ErrorAsEnumResponseFut;
type HandleInResultResponseFut: std::future::Future<Output = Result<WithErrorSyntaxHandleInResultResult, fidl::Error>>
+ Send;
fn r#handle_in_result(&self) -> Self::HandleInResultResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct WithErrorSyntaxSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for WithErrorSyntaxSynchronousProxy {
type Proxy = WithErrorSyntaxProxy;
type Protocol = WithErrorSyntaxMarker;
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 WithErrorSyntaxSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <WithErrorSyntaxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<WithErrorSyntaxEvent, fidl::Error> {
WithErrorSyntaxEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#response_as_struct(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<WithErrorSyntaxResponseAsStructResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<WithErrorSyntaxResponseAsStructResponse, u32>,
>(
(),
0x3b902a6d8d24693,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| (x.a, x.b, x.c)))
}
pub fn r#error_as_primitive(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<WithErrorSyntaxErrorAsPrimitiveResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, u32>,
>(
(),
0x602fd6bd920135e7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#error_as_enum(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<WithErrorSyntaxErrorAsEnumResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorEnum>,
>(
(),
0x4c371e1673212f43,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#handle_in_result(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<WithErrorSyntaxHandleInResultResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<WithErrorSyntaxHandleInResultResponse, u32>,
>(
(),
0x13092c5b835b0cbf,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.h))
}
}
#[cfg(target_os = "fuchsia")]
impl From<WithErrorSyntaxSynchronousProxy> for zx::Handle {
fn from(value: WithErrorSyntaxSynchronousProxy) -> Self {
value.into_channel().into()
}
}
#[cfg(target_os = "fuchsia")]
impl From<fidl::Channel> for WithErrorSyntaxSynchronousProxy {
fn from(value: fidl::Channel) -> Self {
Self::new(value)
}
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::FromClient for WithErrorSyntaxSynchronousProxy {
type Protocol = WithErrorSyntaxMarker;
fn from_client(value: fidl::endpoints::ClientEnd<WithErrorSyntaxMarker>) -> Self {
Self::new(value.into_channel())
}
}
#[derive(Debug, Clone)]
pub struct WithErrorSyntaxProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for WithErrorSyntaxProxy {
type Protocol = WithErrorSyntaxMarker;
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 WithErrorSyntaxProxy {
/// Create a new Proxy for test.protocols/WithErrorSyntax.
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <WithErrorSyntaxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the protocol.
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> WithErrorSyntaxEventStream {
WithErrorSyntaxEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#response_as_struct(
&self,
) -> fidl::client::QueryResponseFut<
WithErrorSyntaxResponseAsStructResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
WithErrorSyntaxProxyInterface::r#response_as_struct(self)
}
pub fn r#error_as_primitive(
&self,
) -> fidl::client::QueryResponseFut<
WithErrorSyntaxErrorAsPrimitiveResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
WithErrorSyntaxProxyInterface::r#error_as_primitive(self)
}
pub fn r#error_as_enum(
&self,
) -> fidl::client::QueryResponseFut<
WithErrorSyntaxErrorAsEnumResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
WithErrorSyntaxProxyInterface::r#error_as_enum(self)
}
pub fn r#handle_in_result(
&self,
) -> fidl::client::QueryResponseFut<
WithErrorSyntaxHandleInResultResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
WithErrorSyntaxProxyInterface::r#handle_in_result(self)
}
}
impl WithErrorSyntaxProxyInterface for WithErrorSyntaxProxy {
type ResponseAsStructResponseFut = fidl::client::QueryResponseFut<
WithErrorSyntaxResponseAsStructResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#response_as_struct(&self) -> Self::ResponseAsStructResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<WithErrorSyntaxResponseAsStructResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<WithErrorSyntaxResponseAsStructResponse, u32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3b902a6d8d24693,
>(_buf?)?;
Ok(_response.map(|x| (x.a, x.b, x.c)))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
WithErrorSyntaxResponseAsStructResult,
>(
(),
0x3b902a6d8d24693,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ErrorAsPrimitiveResponseFut = fidl::client::QueryResponseFut<
WithErrorSyntaxErrorAsPrimitiveResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#error_as_primitive(&self) -> Self::ErrorAsPrimitiveResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<WithErrorSyntaxErrorAsPrimitiveResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, u32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x602fd6bd920135e7,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
WithErrorSyntaxErrorAsPrimitiveResult,
>(
(),
0x602fd6bd920135e7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ErrorAsEnumResponseFut = fidl::client::QueryResponseFut<
WithErrorSyntaxErrorAsEnumResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#error_as_enum(&self) -> Self::ErrorAsEnumResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<WithErrorSyntaxErrorAsEnumResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorEnum>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4c371e1673212f43,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
WithErrorSyntaxErrorAsEnumResult,
>(
(),
0x4c371e1673212f43,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type HandleInResultResponseFut = fidl::client::QueryResponseFut<
WithErrorSyntaxHandleInResultResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#handle_in_result(&self) -> Self::HandleInResultResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<WithErrorSyntaxHandleInResultResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<WithErrorSyntaxHandleInResultResponse, u32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x13092c5b835b0cbf,
>(_buf?)?;
Ok(_response.map(|x| x.h))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
WithErrorSyntaxHandleInResultResult,
>(
(),
0x13092c5b835b0cbf,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct WithErrorSyntaxEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for WithErrorSyntaxEventStream {}
impl futures::stream::FusedStream for WithErrorSyntaxEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for WithErrorSyntaxEventStream {
type Item = Result<WithErrorSyntaxEvent, 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(WithErrorSyntaxEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum WithErrorSyntaxEvent {}
impl WithErrorSyntaxEvent {
/// Decodes a message buffer as a [`WithErrorSyntaxEvent`].
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<WithErrorSyntaxEvent, 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:
<WithErrorSyntaxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for test.protocols/WithErrorSyntax.
pub struct WithErrorSyntaxRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for WithErrorSyntaxRequestStream {}
impl futures::stream::FusedStream for WithErrorSyntaxRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for WithErrorSyntaxRequestStream {
type Protocol = WithErrorSyntaxMarker;
type ControlHandle = WithErrorSyntaxControlHandle;
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 {
WithErrorSyntaxControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for WithErrorSyntaxRequestStream {
type Item = Result<WithErrorSyntaxRequest, 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 WithErrorSyntaxRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))));
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x3b902a6d8d24693 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
WithErrorSyntaxControlHandle { inner: this.inner.clone() };
Ok(WithErrorSyntaxRequest::ResponseAsStruct {
responder: WithErrorSyntaxResponseAsStructResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x602fd6bd920135e7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
WithErrorSyntaxControlHandle { inner: this.inner.clone() };
Ok(WithErrorSyntaxRequest::ErrorAsPrimitive {
responder: WithErrorSyntaxErrorAsPrimitiveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4c371e1673212f43 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
WithErrorSyntaxControlHandle { inner: this.inner.clone() };
Ok(WithErrorSyntaxRequest::ErrorAsEnum {
responder: WithErrorSyntaxErrorAsEnumResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x13092c5b835b0cbf => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
WithErrorSyntaxControlHandle { inner: this.inner.clone() };
Ok(WithErrorSyntaxRequest::HandleInResult {
responder: WithErrorSyntaxHandleInResultResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<WithErrorSyntaxMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum WithErrorSyntaxRequest {
ResponseAsStruct { responder: WithErrorSyntaxResponseAsStructResponder },
ErrorAsPrimitive { responder: WithErrorSyntaxErrorAsPrimitiveResponder },
ErrorAsEnum { responder: WithErrorSyntaxErrorAsEnumResponder },
HandleInResult { responder: WithErrorSyntaxHandleInResultResponder },
}
impl WithErrorSyntaxRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_response_as_struct(self) -> Option<(WithErrorSyntaxResponseAsStructResponder)> {
if let WithErrorSyntaxRequest::ResponseAsStruct { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_error_as_primitive(self) -> Option<(WithErrorSyntaxErrorAsPrimitiveResponder)> {
if let WithErrorSyntaxRequest::ErrorAsPrimitive { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_error_as_enum(self) -> Option<(WithErrorSyntaxErrorAsEnumResponder)> {
if let WithErrorSyntaxRequest::ErrorAsEnum { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_handle_in_result(self) -> Option<(WithErrorSyntaxHandleInResultResponder)> {
if let WithErrorSyntaxRequest::HandleInResult { responder } = self {
Some((responder))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
WithErrorSyntaxRequest::ResponseAsStruct { .. } => "response_as_struct",
WithErrorSyntaxRequest::ErrorAsPrimitive { .. } => "error_as_primitive",
WithErrorSyntaxRequest::ErrorAsEnum { .. } => "error_as_enum",
WithErrorSyntaxRequest::HandleInResult { .. } => "handle_in_result",
}
}
}
#[derive(Debug, Clone)]
pub struct WithErrorSyntaxControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for WithErrorSyntaxControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl WithErrorSyntaxControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WithErrorSyntaxResponseAsStructResponder {
control_handle: std::mem::ManuallyDrop<WithErrorSyntaxControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`WithErrorSyntaxControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for WithErrorSyntaxResponseAsStructResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WithErrorSyntaxResponseAsStructResponder {
type ControlHandle = WithErrorSyntaxControlHandle;
fn control_handle(&self) -> &WithErrorSyntaxControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl WithErrorSyntaxResponseAsStructResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut result: Result<(i64, i64, i64), u32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(i64, i64, i64), u32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(i64, i64, i64), u32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
WithErrorSyntaxResponseAsStructResponse,
u32,
>>(
result,
self.tx_id,
0x3b902a6d8d24693,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WithErrorSyntaxErrorAsPrimitiveResponder {
control_handle: std::mem::ManuallyDrop<WithErrorSyntaxControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`WithErrorSyntaxControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for WithErrorSyntaxErrorAsPrimitiveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WithErrorSyntaxErrorAsPrimitiveResponder {
type ControlHandle = WithErrorSyntaxControlHandle;
fn control_handle(&self) -> &WithErrorSyntaxControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl WithErrorSyntaxErrorAsPrimitiveResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut result: Result<(), u32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut result: Result<(), u32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), u32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, u32>>(
result,
self.tx_id,
0x602fd6bd920135e7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WithErrorSyntaxErrorAsEnumResponder {
control_handle: std::mem::ManuallyDrop<WithErrorSyntaxControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`WithErrorSyntaxControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for WithErrorSyntaxErrorAsEnumResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WithErrorSyntaxErrorAsEnumResponder {
type ControlHandle = WithErrorSyntaxControlHandle;
fn control_handle(&self) -> &WithErrorSyntaxControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl WithErrorSyntaxErrorAsEnumResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut result: Result<(), ErrorEnum>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), ErrorEnum>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), ErrorEnum>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorEnum>>(
result,
self.tx_id,
0x4c371e1673212f43,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WithErrorSyntaxHandleInResultResponder {
control_handle: std::mem::ManuallyDrop<WithErrorSyntaxControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`WithErrorSyntaxControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for WithErrorSyntaxHandleInResultResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WithErrorSyntaxHandleInResultResponder {
type ControlHandle = WithErrorSyntaxControlHandle;
fn control_handle(&self) -> &WithErrorSyntaxControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl WithErrorSyntaxHandleInResultResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut result: Result<fidl::Handle, u32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::Handle, u32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::Handle, u32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
WithErrorSyntaxHandleInResultResponse,
u32,
>>(
result.map(|h| (h,)),
self.tx_id,
0x13092c5b835b0cbf,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct WithProtocolEndsMarker;
impl fidl::endpoints::ProtocolMarker for WithProtocolEndsMarker {
type Proxy = WithProtocolEndsProxy;
type RequestStream = WithProtocolEndsRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = WithProtocolEndsSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) WithProtocolEnds";
}
pub trait WithProtocolEndsProxyInterface: Send + Sync {
type ClientEndsResponseFut: std::future::Future<
Output = Result<
Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
fidl::Error,
>,
> + Send;
fn r#client_ends(
&self,
in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
) -> Self::ClientEndsResponseFut;
type ServerEndsResponseFut: std::future::Future<
Output = Result<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, fidl::Error>,
> + Send;
fn r#server_ends(
&self,
in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
) -> Self::ServerEndsResponseFut;
type StructContainingEndsResponseFut: std::future::Future<Output = Result<ProtocolEnds, fidl::Error>>
+ Send;
fn r#struct_containing_ends(&self, in_: ProtocolEnds) -> Self::StructContainingEndsResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct WithProtocolEndsSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for WithProtocolEndsSynchronousProxy {
type Proxy = WithProtocolEndsProxy;
type Protocol = WithProtocolEndsMarker;
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 WithProtocolEndsSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <WithProtocolEndsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
/// Waits until an event arrives and returns it. It is safe for other
/// threads to make concurrent requests while waiting for an event.
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<WithProtocolEndsEvent, fidl::Error> {
WithProtocolEndsEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#client_ends(
&self,
mut in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, fidl::Error> {
let _response = self
.client
.send_query::<WithProtocolEndsClientEndsRequest, WithProtocolEndsClientEndsResponse>(
(in_,),
0x51780563edb15042,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.out)
}
pub fn r#server_ends(
&self,
mut in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
___deadline: zx::MonotonicInstant,
) -> Result<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, fidl::Error> {
let _response = self
.client
.send_query::<WithProtocolEndsServerEndsRequest, WithProtocolEndsServerEndsResponse>(
(in_,),
0x70a02c2ba2228a33,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.out)
}
pub fn r#struct_containing_ends(
&self,
mut in_: ProtocolEnds,
___deadline: zx::MonotonicInstant,
) -> Result<ProtocolEnds, fidl::Error> {
let _response = self.client.send_query::<
WithProtocolEndsStructContainingEndsRequest,
WithProtocolEndsStructContainingEndsResponse,
>(
(&mut in_,),
0x3893f0baad26f5d5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.out)
}
}
#[cfg(target_os = "fuchsia")]
impl From<WithProtocolEndsSynchronousProxy> for zx::Handle {
fn from(value: WithProtocolEndsSynchronousProxy) -> Self {
value.into_channel().into()
}
}
#[cfg(target_os = "fuchsia")]
impl From<fidl::Channel> for WithProtocolEndsSynchronousProxy {
fn from(value: fidl::Channel) -> Self {
Self::new(value)
}
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::FromClient for WithProtocolEndsSynchronousProxy {
type Protocol = WithProtocolEndsMarker;
fn from_client(value: fidl::endpoints::ClientEnd<WithProtocolEndsMarker>) -> Self {
Self::new(value.into_channel())
}
}
#[derive(Debug, Clone)]
pub struct WithProtocolEndsProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for WithProtocolEndsProxy {
type Protocol = WithProtocolEndsMarker;
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 WithProtocolEndsProxy {
/// Create a new Proxy for test.protocols/WithProtocolEnds.
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <WithProtocolEndsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
/// Get a Stream of events from the remote end of the protocol.
///
/// # Panics
///
/// Panics if the event stream was already taken.
pub fn take_event_stream(&self) -> WithProtocolEndsEventStream {
WithProtocolEndsEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#client_ends(
&self,
mut in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
) -> fidl::client::QueryResponseFut<
Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
WithProtocolEndsProxyInterface::r#client_ends(self, in_)
}
pub fn r#server_ends(
&self,
mut in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
) -> fidl::client::QueryResponseFut<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
WithProtocolEndsProxyInterface::r#server_ends(self, in_)
}
pub fn r#struct_containing_ends(
&self,
mut in_: ProtocolEnds,
) -> fidl::client::QueryResponseFut<ProtocolEnds, fidl::encoding::DefaultFuchsiaResourceDialect>
{
WithProtocolEndsProxyInterface::r#struct_containing_ends(self, in_)
}
}
impl WithProtocolEndsProxyInterface for WithProtocolEndsProxy {
type ClientEndsResponseFut = fidl::client::QueryResponseFut<
Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#client_ends(
&self,
mut in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
) -> Self::ClientEndsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>, fidl::Error>
{
let _response = fidl::client::decode_transaction_body::<
WithProtocolEndsClientEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x51780563edb15042,
>(_buf?)?;
Ok(_response.out)
}
self.client.send_query_and_decode::<
WithProtocolEndsClientEndsRequest,
Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
>(
(in_,),
0x51780563edb15042,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ServerEndsResponseFut = fidl::client::QueryResponseFut<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#server_ends(
&self,
mut in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
) -> Self::ServerEndsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
WithProtocolEndsServerEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x70a02c2ba2228a33,
>(_buf?)?;
Ok(_response.out)
}
self.client.send_query_and_decode::<
WithProtocolEndsServerEndsRequest,
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
>(
(in_,),
0x70a02c2ba2228a33,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StructContainingEndsResponseFut =
fidl::client::QueryResponseFut<ProtocolEnds, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#struct_containing_ends(
&self,
mut in_: ProtocolEnds,
) -> Self::StructContainingEndsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ProtocolEnds, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
WithProtocolEndsStructContainingEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3893f0baad26f5d5,
>(_buf?)?;
Ok(_response.out)
}
self.client
.send_query_and_decode::<WithProtocolEndsStructContainingEndsRequest, ProtocolEnds>(
(&mut in_,),
0x3893f0baad26f5d5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct WithProtocolEndsEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for WithProtocolEndsEventStream {}
impl futures::stream::FusedStream for WithProtocolEndsEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for WithProtocolEndsEventStream {
type Item = Result<WithProtocolEndsEvent, 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(WithProtocolEndsEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum WithProtocolEndsEvent {}
impl WithProtocolEndsEvent {
/// Decodes a message buffer as a [`WithProtocolEndsEvent`].
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<WithProtocolEndsEvent, 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:
<WithProtocolEndsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
/// A Stream of incoming requests for test.protocols/WithProtocolEnds.
pub struct WithProtocolEndsRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for WithProtocolEndsRequestStream {}
impl futures::stream::FusedStream for WithProtocolEndsRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for WithProtocolEndsRequestStream {
type Protocol = WithProtocolEndsMarker;
type ControlHandle = WithProtocolEndsControlHandle;
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 {
WithProtocolEndsControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for WithProtocolEndsRequestStream {
type Item = Result<WithProtocolEndsRequest, 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 WithProtocolEndsRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))));
}
}
// A message has been received from the channel
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x51780563edb15042 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
WithProtocolEndsClientEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WithProtocolEndsClientEndsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
WithProtocolEndsControlHandle { inner: this.inner.clone() };
Ok(WithProtocolEndsRequest::ClientEnds {
in_: req.in_,
responder: WithProtocolEndsClientEndsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x70a02c2ba2228a33 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
WithProtocolEndsServerEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WithProtocolEndsServerEndsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
WithProtocolEndsControlHandle { inner: this.inner.clone() };
Ok(WithProtocolEndsRequest::ServerEnds {
in_: req.in_,
responder: WithProtocolEndsServerEndsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3893f0baad26f5d5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
WithProtocolEndsStructContainingEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WithProtocolEndsStructContainingEndsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
WithProtocolEndsControlHandle { inner: this.inner.clone() };
Ok(WithProtocolEndsRequest::StructContainingEnds {
in_: req.in_,
responder: WithProtocolEndsStructContainingEndsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<WithProtocolEndsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum WithProtocolEndsRequest {
ClientEnds {
in_: fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
responder: WithProtocolEndsClientEndsResponder,
},
ServerEnds {
in_: Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
responder: WithProtocolEndsServerEndsResponder,
},
StructContainingEnds {
in_: ProtocolEnds,
responder: WithProtocolEndsStructContainingEndsResponder,
},
}
impl WithProtocolEndsRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_client_ends(
self,
) -> Option<(
fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
WithProtocolEndsClientEndsResponder,
)> {
if let WithProtocolEndsRequest::ClientEnds { in_, responder } = self {
Some((in_, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_server_ends(
self,
) -> Option<(
Option<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
WithProtocolEndsServerEndsResponder,
)> {
if let WithProtocolEndsRequest::ServerEnds { in_, responder } = self {
Some((in_, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_struct_containing_ends(
self,
) -> Option<(ProtocolEnds, WithProtocolEndsStructContainingEndsResponder)> {
if let WithProtocolEndsRequest::StructContainingEnds { in_, responder } = self {
Some((in_, responder))
} else {
None
}
}
/// Name of the method defined in FIDL
pub fn method_name(&self) -> &'static str {
match *self {
WithProtocolEndsRequest::ClientEnds { .. } => "client_ends",
WithProtocolEndsRequest::ServerEnds { .. } => "server_ends",
WithProtocolEndsRequest::StructContainingEnds { .. } => "struct_containing_ends",
}
}
}
#[derive(Debug, Clone)]
pub struct WithProtocolEndsControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for WithProtocolEndsControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl WithProtocolEndsControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WithProtocolEndsClientEndsResponder {
control_handle: std::mem::ManuallyDrop<WithProtocolEndsControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`WithProtocolEndsControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for WithProtocolEndsClientEndsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WithProtocolEndsClientEndsResponder {
type ControlHandle = WithProtocolEndsControlHandle;
fn control_handle(&self) -> &WithProtocolEndsControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl WithProtocolEndsClientEndsResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(
self,
mut out: Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(out);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(
self,
mut out: Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(out);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut out: Option<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<WithProtocolEndsClientEndsResponse>(
(out,),
self.tx_id,
0x51780563edb15042,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WithProtocolEndsServerEndsResponder {
control_handle: std::mem::ManuallyDrop<WithProtocolEndsControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`WithProtocolEndsControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for WithProtocolEndsServerEndsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WithProtocolEndsServerEndsResponder {
type ControlHandle = WithProtocolEndsControlHandle;
fn control_handle(&self) -> &WithProtocolEndsControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl WithProtocolEndsServerEndsResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(
self,
mut out: fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(out);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(
self,
mut out: fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(out);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut out: fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<WithProtocolEndsServerEndsResponse>(
(out,),
self.tx_id,
0x70a02c2ba2228a33,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct WithProtocolEndsStructContainingEndsResponder {
control_handle: std::mem::ManuallyDrop<WithProtocolEndsControlHandle>,
tx_id: u32,
}
/// Set the the channel to be shutdown (see [`WithProtocolEndsControlHandle::shutdown`])
/// if the responder is dropped without sending a response, so that the client
/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
impl std::ops::Drop for WithProtocolEndsStructContainingEndsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
// Safety: drops once, never accessed again
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for WithProtocolEndsStructContainingEndsResponder {
type ControlHandle = WithProtocolEndsControlHandle;
fn control_handle(&self) -> &WithProtocolEndsControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
// Safety: drops once, never accessed again due to mem::forget
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
// Prevent Drop from running (which would shut down the channel)
std::mem::forget(self);
}
}
impl WithProtocolEndsStructContainingEndsResponder {
/// Sends a response to the FIDL transaction.
///
/// Sets the channel to shutdown if an error occurs.
pub fn send(self, mut out: ProtocolEnds) -> Result<(), fidl::Error> {
let _result = self.send_raw(out);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
/// Similar to "send" but does not shutdown the channel if an error occurs.
pub fn send_no_shutdown_on_err(self, mut out: ProtocolEnds) -> Result<(), fidl::Error> {
let _result = self.send_raw(out);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut out: ProtocolEnds) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<WithProtocolEndsStructContainingEndsResponse>(
(&mut out,),
self.tx_id,
0x3893f0baad26f5d5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ResourceTypeMarker for ChannelProtocolMutateSocketRequest {
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::TypeMarker for ChannelProtocolMutateSocketRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
ChannelProtocolMutateSocketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ChannelProtocolMutateSocketRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelProtocolMutateSocketRequest>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
ChannelProtocolMutateSocketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.a
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ChannelProtocolMutateSocketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelProtocolMutateSocketRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ChannelProtocolMutateSocketRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
a: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.a, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ChannelProtocolMutateSocketResponse {
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::TypeMarker for ChannelProtocolMutateSocketResponse {
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
}
}
unsafe impl
fidl::encoding::Encode<
ChannelProtocolMutateSocketResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ChannelProtocolMutateSocketResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelProtocolMutateSocketResponse>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
ChannelProtocolMutateSocketResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.b
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ChannelProtocolMutateSocketResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelProtocolMutateSocketResponse>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ChannelProtocolMutateSocketResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
b: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.b, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ChannelProtocolTakeHandleRequest {
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::TypeMarker for ChannelProtocolTakeHandleRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
ChannelProtocolTakeHandleRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ChannelProtocolTakeHandleRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelProtocolTakeHandleRequest>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
ChannelProtocolTakeHandleRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Handle,
{ fidl::ObjectType::NONE.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.h
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Handle,
{ fidl::ObjectType::NONE.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ChannelProtocolTakeHandleRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ChannelProtocolTakeHandleRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ChannelProtocolTakeHandleRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HandleRightsProtocolAnEventRequest {
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::TypeMarker for HandleRightsProtocolAnEventRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
HandleRightsProtocolAnEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HandleRightsProtocolAnEventRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleRightsProtocolAnEventRequest>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
HandleRightsProtocolAnEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
3,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.h
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
3,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HandleRightsProtocolAnEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleRightsProtocolAnEventRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HandleRightsProtocolAnEventRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HandleRightsProtocolNoResponseMethodRequest {
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::TypeMarker for HandleRightsProtocolNoResponseMethodRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
HandleRightsProtocolNoResponseMethodRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HandleRightsProtocolNoResponseMethodRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleRightsProtocolNoResponseMethodRequest>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
HandleRightsProtocolNoResponseMethodRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
3,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.h
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
3,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HandleRightsProtocolNoResponseMethodRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleRightsProtocolNoResponseMethodRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HandleRightsProtocolNoResponseMethodRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HandleRightsProtocolResponseMethodRequest {
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::TypeMarker for HandleRightsProtocolResponseMethodRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
HandleRightsProtocolResponseMethodRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HandleRightsProtocolResponseMethodRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleRightsProtocolResponseMethodRequest>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
HandleRightsProtocolResponseMethodRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
3,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.h
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
3,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HandleRightsProtocolResponseMethodRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleRightsProtocolResponseMethodRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HandleRightsProtocolResponseMethodRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HandleRightsProtocolResponseMethodResponse {
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::TypeMarker for HandleRightsProtocolResponseMethodResponse {
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
}
}
unsafe impl
fidl::encoding::Encode<
HandleRightsProtocolResponseMethodResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HandleRightsProtocolResponseMethodResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleRightsProtocolResponseMethodResponse>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
HandleRightsProtocolResponseMethodResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.h
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Socket,
{ fidl::ObjectType::SOCKET.into_raw() },
2,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HandleRightsProtocolResponseMethodResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HandleRightsProtocolResponseMethodResponse>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HandleRightsProtocolResponseMethodResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProtocolEnds {
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::TypeMarker for ProtocolEnds {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl fidl::encoding::Encode<ProtocolEnds, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut ProtocolEnds
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProtocolEnds>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<ProtocolEnds, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server),
<fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client_opt),
<fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_opt),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T3: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
> fidl::encoding::Encode<ProtocolEnds, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProtocolEnds>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 12, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for ProtocolEnds {
#[inline(always)]
fn new_empty() -> Self {
Self {
client: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
server: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
client_opt: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
server_opt: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.client,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.server,
decoder,
offset + 4,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.client_opt,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.server_opt,
decoder,
offset + 12,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for WithErrorSyntaxHandleInResultResponse {
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::TypeMarker for WithErrorSyntaxHandleInResultResponse {
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
}
}
unsafe impl
fidl::encoding::Encode<
WithErrorSyntaxHandleInResultResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut WithErrorSyntaxHandleInResultResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithErrorSyntaxHandleInResultResponse>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
WithErrorSyntaxHandleInResultResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Handle,
{ fidl::ObjectType::NONE.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.h
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Handle,
{ fidl::ObjectType::NONE.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
WithErrorSyntaxHandleInResultResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithErrorSyntaxHandleInResultResponse>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for WithErrorSyntaxHandleInResultResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
h: fidl::new_empty!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(fidl::encoding::HandleType<fidl::Handle, { fidl::ObjectType::NONE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.h, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsClientEndsRequest {
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::TypeMarker for WithProtocolEndsClientEndsRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
WithProtocolEndsClientEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut WithProtocolEndsClientEndsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsClientEndsRequest>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
WithProtocolEndsClientEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.in_
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
WithProtocolEndsClientEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsClientEndsRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsClientEndsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
in_: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.in_,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsClientEndsResponse {
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::TypeMarker for WithProtocolEndsClientEndsResponse {
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
}
}
unsafe impl
fidl::encoding::Encode<
WithProtocolEndsClientEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut WithProtocolEndsClientEndsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsClientEndsResponse>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
WithProtocolEndsClientEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.out
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
WithProtocolEndsClientEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsClientEndsResponse>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsClientEndsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
out: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.out,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsServerEndsRequest {
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::TypeMarker for WithProtocolEndsServerEndsRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
WithProtocolEndsServerEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut WithProtocolEndsServerEndsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsServerEndsRequest>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
WithProtocolEndsServerEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.in_
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
WithProtocolEndsServerEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsServerEndsRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsServerEndsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
in_: fidl::new_empty!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(
fidl::encoding::Optional<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.in_,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsServerEndsResponse {
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::TypeMarker for WithProtocolEndsServerEndsResponse {
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
}
}
unsafe impl
fidl::encoding::Encode<
WithProtocolEndsServerEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut WithProtocolEndsServerEndsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsServerEndsResponse>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
WithProtocolEndsServerEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.out
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
WithProtocolEndsServerEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsServerEndsResponse>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsServerEndsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
out: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverableProtocolMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.out,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsStructContainingEndsRequest {
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::TypeMarker for WithProtocolEndsStructContainingEndsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
WithProtocolEndsStructContainingEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut WithProtocolEndsStructContainingEndsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsStructContainingEndsRequest>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
WithProtocolEndsStructContainingEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<ProtocolEnds as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.in_,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<ProtocolEnds, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
WithProtocolEndsStructContainingEndsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsStructContainingEndsRequest>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsStructContainingEndsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
in_: fidl::new_empty!(ProtocolEnds, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(
ProtocolEnds,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.in_,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for WithProtocolEndsStructContainingEndsResponse {
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::TypeMarker for WithProtocolEndsStructContainingEndsResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
WithProtocolEndsStructContainingEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut WithProtocolEndsStructContainingEndsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsStructContainingEndsResponse>(offset);
// Delegate to tuple encoding.
fidl::encoding::Encode::<
WithProtocolEndsStructContainingEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<ProtocolEnds as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.out,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<ProtocolEnds, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
WithProtocolEndsStructContainingEndsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WithProtocolEndsStructContainingEndsResponse>(offset);
// Zero out padding regions. There's no need to apply masks
// because the unmasked parts will be overwritten by fields.
// Write the fields.
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for WithProtocolEndsStructContainingEndsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
out: fidl::new_empty!(ProtocolEnds, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
// Verify that padding bytes are zero.
fidl::decode!(
ProtocolEnds,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.out,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
}