#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CloneableClone2Request {
pub request: fidl::endpoints::ServerEnd<CloneableMarker>,
}
impl fidl::Standalone for CloneableClone2Request {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct QueryableQueryResponse {
pub protocol: Vec<u8>,
}
impl fidl::Persistable for QueryableQueryResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct CloneableMarker;
impl fidl::endpoints::ProtocolMarker for CloneableMarker {
type Proxy = CloneableProxy;
type RequestStream = CloneableRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = CloneableSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Cloneable";
}
pub trait CloneableProxyInterface: Send + Sync {
fn r#clone2(
&self,
request: fidl::endpoints::ServerEnd<CloneableMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct CloneableSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for CloneableSynchronousProxy {
type Proxy = CloneableProxy;
type Protocol = CloneableMarker;
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 CloneableSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <CloneableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<CloneableEvent, fidl::Error> {
CloneableEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#clone2(
&self,
mut request: fidl::endpoints::ServerEnd<CloneableMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<CloneableClone2Request>(
(request,),
0x20d8a7aba2168a79,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct CloneableProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for CloneableProxy {
type Protocol = CloneableMarker;
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 CloneableProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <CloneableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> CloneableEventStream {
CloneableEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#clone2(
&self,
mut request: fidl::endpoints::ServerEnd<CloneableMarker>,
) -> Result<(), fidl::Error> {
CloneableProxyInterface::r#clone2(self, request)
}
}
impl CloneableProxyInterface for CloneableProxy {
fn r#clone2(
&self,
mut request: fidl::endpoints::ServerEnd<CloneableMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<CloneableClone2Request>(
(request,),
0x20d8a7aba2168a79,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct CloneableEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for CloneableEventStream {}
impl futures::stream::FusedStream for CloneableEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for CloneableEventStream {
type Item = Result<CloneableEvent, 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(CloneableEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum CloneableEvent {}
impl CloneableEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<CloneableEvent, 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: <CloneableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct CloneableRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for CloneableRequestStream {}
impl futures::stream::FusedStream for CloneableRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for CloneableRequestStream {
type Protocol = CloneableMarker;
type ControlHandle = CloneableControlHandle;
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 {
CloneableControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for CloneableRequestStream {
type Item = Result<CloneableRequest, 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 CloneableRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x20d8a7aba2168a79 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(CloneableClone2Request);
fidl::encoding::Decoder::decode_into::<CloneableClone2Request>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = CloneableControlHandle { inner: this.inner.clone() };
Ok(CloneableRequest::Clone2 { request: req.request, control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <CloneableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum CloneableRequest {
Clone2 {
request: fidl::endpoints::ServerEnd<CloneableMarker>,
control_handle: CloneableControlHandle,
},
}
impl CloneableRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_clone2(
self,
) -> Option<(fidl::endpoints::ServerEnd<CloneableMarker>, CloneableControlHandle)> {
if let CloneableRequest::Clone2 { request, control_handle } = self {
Some((request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
CloneableRequest::Clone2 { .. } => "clone2",
}
}
}
#[derive(Debug, Clone)]
pub struct CloneableControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for CloneableControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl CloneableControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct CloseableMarker;
impl fidl::endpoints::ProtocolMarker for CloseableMarker {
type Proxy = CloseableProxy;
type RequestStream = CloseableRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = CloseableSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Closeable";
}
pub type CloseableCloseResult = Result<(), i32>;
pub trait CloseableProxyInterface: Send + Sync {
type CloseResponseFut: std::future::Future<Output = Result<CloseableCloseResult, fidl::Error>>
+ Send;
fn r#close(&self) -> Self::CloseResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct CloseableSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for CloseableSynchronousProxy {
type Proxy = CloseableProxy;
type Protocol = CloseableMarker;
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 CloseableSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<CloseableEvent, fidl::Error> {
CloseableEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#close(&self, ___deadline: zx::Time) -> Result<CloseableCloseResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x5ac5d459ad7f657e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct CloseableProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for CloseableProxy {
type Protocol = CloseableMarker;
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 CloseableProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> CloseableEventStream {
CloseableEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#close(&self) -> fidl::client::QueryResponseFut<CloseableCloseResult> {
CloseableProxyInterface::r#close(self)
}
}
impl CloseableProxyInterface for CloseableProxy {
type CloseResponseFut = fidl::client::QueryResponseFut<CloseableCloseResult>;
fn r#close(&self) -> Self::CloseResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<CloseableCloseResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
0x5ac5d459ad7f657e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CloseableCloseResult>(
(),
0x5ac5d459ad7f657e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct CloseableEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for CloseableEventStream {}
impl futures::stream::FusedStream for CloseableEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for CloseableEventStream {
type Item = Result<CloseableEvent, 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(CloseableEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum CloseableEvent {}
impl CloseableEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<CloseableEvent, 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: <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct CloseableRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for CloseableRequestStream {}
impl futures::stream::FusedStream for CloseableRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for CloseableRequestStream {
type Protocol = CloseableMarker;
type ControlHandle = CloseableControlHandle;
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 {
CloseableControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for CloseableRequestStream {
type Item = Result<CloseableRequest, 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 CloseableRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x5ac5d459ad7f657e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = CloseableControlHandle { inner: this.inner.clone() };
Ok(CloseableRequest::Close {
responder: CloseableCloseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <CloseableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum CloseableRequest {
Close { responder: CloseableCloseResponder },
}
impl CloseableRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_close(self) -> Option<(CloseableCloseResponder)> {
if let CloseableRequest::Close { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
CloseableRequest::Close { .. } => "close",
}
}
}
#[derive(Debug, Clone)]
pub struct CloseableControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for CloseableControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl CloseableControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CloseableCloseResponder {
control_handle: std::mem::ManuallyDrop<CloseableControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CloseableCloseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CloseableCloseResponder {
type ControlHandle = CloseableControlHandle;
fn control_handle(&self) -> &CloseableControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CloseableCloseResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x5ac5d459ad7f657e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct QueryableMarker;
impl fidl::endpoints::ProtocolMarker for QueryableMarker {
type Proxy = QueryableProxy;
type RequestStream = QueryableRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = QueryableSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Queryable";
}
pub trait QueryableProxyInterface: Send + Sync {
type QueryResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>> + Send;
fn r#query(&self) -> Self::QueryResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct QueryableSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for QueryableSynchronousProxy {
type Proxy = QueryableProxy;
type Protocol = QueryableMarker;
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 QueryableSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::Time) -> Result<QueryableEvent, fidl::Error> {
QueryableEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#query(&self, ___deadline: zx::Time) -> Result<Vec<u8>, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, QueryableQueryResponse>(
(),
0x2658edee9decfc06,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.protocol)
}
}
#[derive(Debug, Clone)]
pub struct QueryableProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for QueryableProxy {
type Protocol = QueryableMarker;
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 QueryableProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> QueryableEventStream {
QueryableEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#query(&self) -> fidl::client::QueryResponseFut<Vec<u8>> {
QueryableProxyInterface::r#query(self)
}
}
impl QueryableProxyInterface for QueryableProxy {
type QueryResponseFut = fidl::client::QueryResponseFut<Vec<u8>>;
fn r#query(&self) -> Self::QueryResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<Vec<u8>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
QueryableQueryResponse,
0x2658edee9decfc06,
>(_buf?)?;
Ok(_response.protocol)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<u8>>(
(),
0x2658edee9decfc06,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct QueryableEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for QueryableEventStream {}
impl futures::stream::FusedStream for QueryableEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for QueryableEventStream {
type Item = Result<QueryableEvent, 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(QueryableEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum QueryableEvent {}
impl QueryableEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<QueryableEvent, 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: <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct QueryableRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for QueryableRequestStream {}
impl futures::stream::FusedStream for QueryableRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for QueryableRequestStream {
type Protocol = QueryableMarker;
type ControlHandle = QueryableControlHandle;
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 {
QueryableControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for QueryableRequestStream {
type Item = Result<QueryableRequest, 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 QueryableRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2658edee9decfc06 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = QueryableControlHandle { inner: this.inner.clone() };
Ok(QueryableRequest::Query {
responder: QueryableQueryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <QueryableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum QueryableRequest {
Query { responder: QueryableQueryResponder },
}
impl QueryableRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_query(self) -> Option<(QueryableQueryResponder)> {
if let QueryableRequest::Query { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
QueryableRequest::Query { .. } => "query",
}
}
}
#[derive(Debug, Clone)]
pub struct QueryableControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for QueryableControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
}
impl QueryableControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct QueryableQueryResponder {
control_handle: std::mem::ManuallyDrop<QueryableControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for QueryableQueryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for QueryableQueryResponder {
type ControlHandle = QueryableControlHandle;
fn control_handle(&self) -> &QueryableControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl QueryableQueryResponder {
pub fn send(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
let _result = self.send_raw(protocol);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
let _result = self.send_raw(protocol);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<QueryableQueryResponse>(
(protocol,),
self.tx_id,
0x2658edee9decfc06,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for CloneableClone2Request {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for CloneableClone2Request {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CloneableClone2Request> for &mut CloneableClone2Request {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CloneableClone2Request>(offset);
fidl::encoding::Encode::<CloneableClone2Request>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>>,
>,
> fidl::encoding::Encode<CloneableClone2Request> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CloneableClone2Request>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CloneableClone2Request {
#[inline(always)]
fn new_empty() -> Self {
Self {
request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CloneableMarker>>,
&mut self.request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for QueryableQueryResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
impl fidl::encoding::ValueTypeMarker for QueryableQueryResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<QueryableQueryResponse> for &QueryableQueryResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<QueryableQueryResponse>(offset);
fidl::encoding::Encode::<QueryableQueryResponse>::encode(
(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
&self.protocol,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>>>
fidl::encoding::Encode<QueryableQueryResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<QueryableQueryResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for QueryableQueryResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { protocol: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
&mut self.protocol,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
}