#![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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum VerifyError {
Internal,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! VerifyErrorUnknown {
() => {
_
};
}
impl VerifyError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Internal),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Internal,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Internal => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct VerifierVerifyRequest {
pub options: VerifyOptions,
}
impl fidl::Persistable for VerifierVerifyRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct VerifyOptions {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for VerifyOptions {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BlobfsVerifierMarker;
impl fidl::endpoints::ProtocolMarker for BlobfsVerifierMarker {
type Proxy = BlobfsVerifierProxy;
type RequestStream = BlobfsVerifierRequestStream;
const DEBUG_NAME: &'static str = "fuchsia.update.verify.BlobfsVerifier";
}
impl fidl::endpoints::DiscoverableProtocolMarker for BlobfsVerifierMarker {}
pub trait BlobfsVerifierProxyInterface: Send + Sync {
type VerifyResponseFut: std::future::Future<Output = Result<VerifierVerifyResult, fidl::Error>>
+ Send;
fn r#verify(&self, options: &VerifyOptions) -> Self::VerifyResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct BlobfsVerifierSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl BlobfsVerifierSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <BlobfsVerifierMarker 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<BlobfsVerifierEvent, fidl::Error> {
BlobfsVerifierEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#verify(
&self,
mut options: &VerifyOptions,
___deadline: zx::Time,
) -> Result<VerifierVerifyResult, fidl::Error> {
let _response = self.client.send_query::<
VerifierVerifyRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, VerifyError>,
>(
(options,),
0x7d89f7b04929049e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct BlobfsVerifierProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for BlobfsVerifierProxy {
type Protocol = BlobfsVerifierMarker;
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 BlobfsVerifierProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <BlobfsVerifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> BlobfsVerifierEventStream {
BlobfsVerifierEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#verify(
&self,
mut options: &VerifyOptions,
) -> fidl::client::QueryResponseFut<VerifierVerifyResult> {
BlobfsVerifierProxyInterface::r#verify(self, options)
}
}
impl BlobfsVerifierProxyInterface for BlobfsVerifierProxy {
type VerifyResponseFut = fidl::client::QueryResponseFut<VerifierVerifyResult>;
fn r#verify(&self, mut options: &VerifyOptions) -> Self::VerifyResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<VerifierVerifyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, VerifyError>,
0x7d89f7b04929049e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<VerifierVerifyRequest, VerifierVerifyResult>(
(options,),
0x7d89f7b04929049e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct BlobfsVerifierEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for BlobfsVerifierEventStream {}
impl futures::stream::FusedStream for BlobfsVerifierEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for BlobfsVerifierEventStream {
type Item = Result<BlobfsVerifierEvent, 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(BlobfsVerifierEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum BlobfsVerifierEvent {}
impl BlobfsVerifierEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<BlobfsVerifierEvent, 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:
<BlobfsVerifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct BlobfsVerifierRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for BlobfsVerifierRequestStream {}
impl futures::stream::FusedStream for BlobfsVerifierRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for BlobfsVerifierRequestStream {
type Protocol = BlobfsVerifierMarker;
type ControlHandle = BlobfsVerifierControlHandle;
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 {
BlobfsVerifierControlHandle { 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 BlobfsVerifierRequestStream {
type Item = Result<BlobfsVerifierRequest, 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 BlobfsVerifierRequestStream 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 {
0x7d89f7b04929049e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(VerifierVerifyRequest);
fidl::encoding::Decoder::decode_into::<VerifierVerifyRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BlobfsVerifierControlHandle { inner: this.inner.clone() };
Ok(BlobfsVerifierRequest::Verify {
options: req.options,
responder: BlobfsVerifierVerifyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<BlobfsVerifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum BlobfsVerifierRequest {
Verify { options: VerifyOptions, responder: BlobfsVerifierVerifyResponder },
}
impl BlobfsVerifierRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_verify(self) -> Option<(VerifyOptions, BlobfsVerifierVerifyResponder)> {
if let BlobfsVerifierRequest::Verify { options, responder } = self {
Some((options, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
BlobfsVerifierRequest::Verify { .. } => "verify",
}
}
}
#[derive(Debug, Clone)]
pub struct BlobfsVerifierControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for BlobfsVerifierControlHandle {
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<'a>(&'a self) -> fidl::OnSignals<'a> {
self.inner.channel().on_closed()
}
}
impl BlobfsVerifierControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BlobfsVerifierVerifyResponder {
control_handle: std::mem::ManuallyDrop<BlobfsVerifierControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BlobfsVerifierVerifyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BlobfsVerifierVerifyResponder {
type ControlHandle = BlobfsVerifierControlHandle;
fn control_handle(&self) -> &BlobfsVerifierControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BlobfsVerifierVerifyResponder {
pub fn send(self, mut result: Result<(), VerifyError>) -> 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<(), VerifyError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), VerifyError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
VerifyError,
>>(
result,
self.tx_id,
0x7d89f7b04929049e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct NetstackVerifierMarker;
impl fidl::endpoints::ProtocolMarker for NetstackVerifierMarker {
type Proxy = NetstackVerifierProxy;
type RequestStream = NetstackVerifierRequestStream;
const DEBUG_NAME: &'static str = "fuchsia.update.verify.NetstackVerifier";
}
impl fidl::endpoints::DiscoverableProtocolMarker for NetstackVerifierMarker {}
pub trait NetstackVerifierProxyInterface: Send + Sync {
type VerifyResponseFut: std::future::Future<Output = Result<VerifierVerifyResult, fidl::Error>>
+ Send;
fn r#verify(&self, options: &VerifyOptions) -> Self::VerifyResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct NetstackVerifierSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl NetstackVerifierSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <NetstackVerifierMarker 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<NetstackVerifierEvent, fidl::Error> {
NetstackVerifierEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#verify(
&self,
mut options: &VerifyOptions,
___deadline: zx::Time,
) -> Result<VerifierVerifyResult, fidl::Error> {
let _response = self.client.send_query::<
VerifierVerifyRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, VerifyError>,
>(
(options,),
0x7d89f7b04929049e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct NetstackVerifierProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for NetstackVerifierProxy {
type Protocol = NetstackVerifierMarker;
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 NetstackVerifierProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <NetstackVerifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> NetstackVerifierEventStream {
NetstackVerifierEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#verify(
&self,
mut options: &VerifyOptions,
) -> fidl::client::QueryResponseFut<VerifierVerifyResult> {
NetstackVerifierProxyInterface::r#verify(self, options)
}
}
impl NetstackVerifierProxyInterface for NetstackVerifierProxy {
type VerifyResponseFut = fidl::client::QueryResponseFut<VerifierVerifyResult>;
fn r#verify(&self, mut options: &VerifyOptions) -> Self::VerifyResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<VerifierVerifyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, VerifyError>,
0x7d89f7b04929049e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<VerifierVerifyRequest, VerifierVerifyResult>(
(options,),
0x7d89f7b04929049e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct NetstackVerifierEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for NetstackVerifierEventStream {}
impl futures::stream::FusedStream for NetstackVerifierEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for NetstackVerifierEventStream {
type Item = Result<NetstackVerifierEvent, 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(NetstackVerifierEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum NetstackVerifierEvent {}
impl NetstackVerifierEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<NetstackVerifierEvent, 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:
<NetstackVerifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct NetstackVerifierRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for NetstackVerifierRequestStream {}
impl futures::stream::FusedStream for NetstackVerifierRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for NetstackVerifierRequestStream {
type Protocol = NetstackVerifierMarker;
type ControlHandle = NetstackVerifierControlHandle;
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 {
NetstackVerifierControlHandle { 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 NetstackVerifierRequestStream {
type Item = Result<NetstackVerifierRequest, 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 NetstackVerifierRequestStream 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 {
0x7d89f7b04929049e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(VerifierVerifyRequest);
fidl::encoding::Decoder::decode_into::<VerifierVerifyRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
NetstackVerifierControlHandle { inner: this.inner.clone() };
Ok(NetstackVerifierRequest::Verify {
options: req.options,
responder: NetstackVerifierVerifyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<NetstackVerifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum NetstackVerifierRequest {
Verify { options: VerifyOptions, responder: NetstackVerifierVerifyResponder },
}
impl NetstackVerifierRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_verify(self) -> Option<(VerifyOptions, NetstackVerifierVerifyResponder)> {
if let NetstackVerifierRequest::Verify { options, responder } = self {
Some((options, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
NetstackVerifierRequest::Verify { .. } => "verify",
}
}
}
#[derive(Debug, Clone)]
pub struct NetstackVerifierControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for NetstackVerifierControlHandle {
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<'a>(&'a self) -> fidl::OnSignals<'a> {
self.inner.channel().on_closed()
}
}
impl NetstackVerifierControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct NetstackVerifierVerifyResponder {
control_handle: std::mem::ManuallyDrop<NetstackVerifierControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for NetstackVerifierVerifyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for NetstackVerifierVerifyResponder {
type ControlHandle = NetstackVerifierControlHandle;
fn control_handle(&self) -> &NetstackVerifierControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl NetstackVerifierVerifyResponder {
pub fn send(self, mut result: Result<(), VerifyError>) -> 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<(), VerifyError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), VerifyError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
VerifyError,
>>(
result,
self.tx_id,
0x7d89f7b04929049e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VerifierMarker;
impl fidl::endpoints::ProtocolMarker for VerifierMarker {
type Proxy = VerifierProxy;
type RequestStream = VerifierRequestStream;
const DEBUG_NAME: &'static str = "(anonymous) Verifier";
}
pub type VerifierVerifyResult = Result<(), VerifyError>;
pub trait VerifierProxyInterface: Send + Sync {
type VerifyResponseFut: std::future::Future<Output = Result<VerifierVerifyResult, fidl::Error>>
+ Send;
fn r#verify(&self, options: &VerifyOptions) -> Self::VerifyResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VerifierSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl VerifierSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VerifierMarker 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<VerifierEvent, fidl::Error> {
VerifierEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#verify(
&self,
mut options: &VerifyOptions,
___deadline: zx::Time,
) -> Result<VerifierVerifyResult, fidl::Error> {
let _response = self.client.send_query::<
VerifierVerifyRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, VerifyError>,
>(
(options,),
0x7d89f7b04929049e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct VerifierProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for VerifierProxy {
type Protocol = VerifierMarker;
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 VerifierProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <VerifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VerifierEventStream {
VerifierEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#verify(
&self,
mut options: &VerifyOptions,
) -> fidl::client::QueryResponseFut<VerifierVerifyResult> {
VerifierProxyInterface::r#verify(self, options)
}
}
impl VerifierProxyInterface for VerifierProxy {
type VerifyResponseFut = fidl::client::QueryResponseFut<VerifierVerifyResult>;
fn r#verify(&self, mut options: &VerifyOptions) -> Self::VerifyResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<VerifierVerifyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, VerifyError>,
0x7d89f7b04929049e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<VerifierVerifyRequest, VerifierVerifyResult>(
(options,),
0x7d89f7b04929049e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct VerifierEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for VerifierEventStream {}
impl futures::stream::FusedStream for VerifierEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VerifierEventStream {
type Item = Result<VerifierEvent, 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(VerifierEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VerifierEvent {}
impl VerifierEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<VerifierEvent, 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: <VerifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VerifierRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for VerifierRequestStream {}
impl futures::stream::FusedStream for VerifierRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VerifierRequestStream {
type Protocol = VerifierMarker;
type ControlHandle = VerifierControlHandle;
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 {
VerifierControlHandle { 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 VerifierRequestStream {
type Item = Result<VerifierRequest, 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 VerifierRequestStream 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 {
0x7d89f7b04929049e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(VerifierVerifyRequest);
fidl::encoding::Decoder::decode_into::<VerifierVerifyRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = VerifierControlHandle { inner: this.inner.clone() };
Ok(VerifierRequest::Verify {
options: req.options,
responder: VerifierVerifyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <VerifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum VerifierRequest {
Verify { options: VerifyOptions, responder: VerifierVerifyResponder },
}
impl VerifierRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_verify(self) -> Option<(VerifyOptions, VerifierVerifyResponder)> {
if let VerifierRequest::Verify { options, responder } = self {
Some((options, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VerifierRequest::Verify { .. } => "verify",
}
}
}
#[derive(Debug, Clone)]
pub struct VerifierControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for VerifierControlHandle {
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<'a>(&'a self) -> fidl::OnSignals<'a> {
self.inner.channel().on_closed()
}
}
impl VerifierControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VerifierVerifyResponder {
control_handle: std::mem::ManuallyDrop<VerifierControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VerifierVerifyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VerifierVerifyResponder {
type ControlHandle = VerifierControlHandle;
fn control_handle(&self) -> &VerifierControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VerifierVerifyResponder {
pub fn send(self, mut result: Result<(), VerifyError>) -> 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<(), VerifyError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), VerifyError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
VerifyError,
>>(
result,
self.tx_id,
0x7d89f7b04929049e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for VerifyError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for VerifyError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for VerifyError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for VerifyError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for VerifierVerifyRequest {
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 VerifierVerifyRequest {
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<VerifierVerifyRequest> for &VerifierVerifyRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VerifierVerifyRequest>(offset);
fidl::encoding::Encode::<VerifierVerifyRequest>::encode(
(<VerifyOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<VerifyOptions>>
fidl::encoding::Encode<VerifierVerifyRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VerifierVerifyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for VerifierVerifyRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { options: fidl::new_empty!(VerifyOptions) }
}
#[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!(VerifyOptions, &mut self.options, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl VerifyOptions {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
unsafe impl fidl::encoding::TypeMarker for VerifyOptions {
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 VerifyOptions {
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<VerifyOptions> for &VerifyOptions {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VerifyOptions>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for VerifyOptions {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
}