#![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 _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ReadOnlyAccountGetBalanceResponse {
pub balance: i64,
}
impl fidl::Persistable for ReadOnlyAccountGetBalanceResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ReadOnlyAccountGetOwnerResponse {
pub owner: String,
}
impl fidl::Persistable for ReadOnlyAccountGetOwnerResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ReadWriteAccountCreditRequest {
pub amount: i64,
}
impl fidl::Persistable for ReadWriteAccountCreditRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ReadWriteAccountDebitRequest {
pub amount: i64,
}
impl fidl::Persistable for ReadWriteAccountDebitRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ReadWriteAccountDebitResponse {
pub succeeded: bool,
}
impl fidl::Persistable for ReadWriteAccountDebitResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ReadOnlyAccountMarker;
impl fidl::endpoints::ProtocolMarker for ReadOnlyAccountMarker {
type Proxy = ReadOnlyAccountProxy;
type RequestStream = ReadOnlyAccountRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ReadOnlyAccountSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ReadOnlyAccount";
}
pub trait ReadOnlyAccountProxyInterface: Send + Sync {
type GetOwnerResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
fn r#get_owner(&self) -> Self::GetOwnerResponseFut;
type GetBalanceResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
fn r#get_balance(&self) -> Self::GetBalanceResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ReadOnlyAccountSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ReadOnlyAccountSynchronousProxy {
type Proxy = ReadOnlyAccountProxy;
type Protocol = ReadOnlyAccountMarker;
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 ReadOnlyAccountSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ReadOnlyAccountMarker 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::MonotonicInstant,
) -> Result<ReadOnlyAccountEvent, fidl::Error> {
ReadOnlyAccountEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_owner(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, ReadOnlyAccountGetOwnerResponse>(
(),
0x553f661d27b2273a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.owner)
}
pub fn r#get_balance(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, ReadOnlyAccountGetBalanceResponse>(
(),
0x35ffed4715b1b3ac,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.balance)
}
}
#[derive(Debug, Clone)]
pub struct ReadOnlyAccountProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ReadOnlyAccountProxy {
type Protocol = ReadOnlyAccountMarker;
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 ReadOnlyAccountProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ReadOnlyAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ReadOnlyAccountEventStream {
ReadOnlyAccountEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_owner(
&self,
) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
ReadOnlyAccountProxyInterface::r#get_owner(self)
}
pub fn r#get_balance(
&self,
) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
ReadOnlyAccountProxyInterface::r#get_balance(self)
}
}
impl ReadOnlyAccountProxyInterface for ReadOnlyAccountProxy {
type GetOwnerResponseFut =
fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_owner(&self) -> Self::GetOwnerResponseFut {
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::<
ReadOnlyAccountGetOwnerResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x553f661d27b2273a,
>(_buf?)?;
Ok(_response.owner)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
(),
0x553f661d27b2273a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetBalanceResponseFut =
fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_balance(&self) -> Self::GetBalanceResponseFut {
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::<
ReadOnlyAccountGetBalanceResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x35ffed4715b1b3ac,
>(_buf?)?;
Ok(_response.balance)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
(),
0x35ffed4715b1b3ac,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ReadOnlyAccountEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ReadOnlyAccountEventStream {}
impl futures::stream::FusedStream for ReadOnlyAccountEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ReadOnlyAccountEventStream {
type Item = Result<ReadOnlyAccountEvent, 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(ReadOnlyAccountEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ReadOnlyAccountEvent {}
impl ReadOnlyAccountEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ReadOnlyAccountEvent, 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:
<ReadOnlyAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ReadOnlyAccountRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ReadOnlyAccountRequestStream {}
impl futures::stream::FusedStream for ReadOnlyAccountRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ReadOnlyAccountRequestStream {
type Protocol = ReadOnlyAccountMarker;
type ControlHandle = ReadOnlyAccountControlHandle;
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 {
ReadOnlyAccountControlHandle { 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 ReadOnlyAccountRequestStream {
type Item = Result<ReadOnlyAccountRequest, 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 ReadOnlyAccountRequestStream 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(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x553f661d27b2273a => {
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 =
ReadOnlyAccountControlHandle { inner: this.inner.clone() };
Ok(ReadOnlyAccountRequest::GetOwner {
responder: ReadOnlyAccountGetOwnerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x35ffed4715b1b3ac => {
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 =
ReadOnlyAccountControlHandle { inner: this.inner.clone() };
Ok(ReadOnlyAccountRequest::GetBalance {
responder: ReadOnlyAccountGetBalanceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ReadOnlyAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ReadOnlyAccountRequest {
GetOwner { responder: ReadOnlyAccountGetOwnerResponder },
GetBalance { responder: ReadOnlyAccountGetBalanceResponder },
}
impl ReadOnlyAccountRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_owner(self) -> Option<(ReadOnlyAccountGetOwnerResponder)> {
if let ReadOnlyAccountRequest::GetOwner { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_balance(self) -> Option<(ReadOnlyAccountGetBalanceResponder)> {
if let ReadOnlyAccountRequest::GetBalance { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ReadOnlyAccountRequest::GetOwner { .. } => "get_owner",
ReadOnlyAccountRequest::GetBalance { .. } => "get_balance",
}
}
}
#[derive(Debug, Clone)]
pub struct ReadOnlyAccountControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ReadOnlyAccountControlHandle {
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 ReadOnlyAccountControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ReadOnlyAccountGetOwnerResponder {
control_handle: std::mem::ManuallyDrop<ReadOnlyAccountControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ReadOnlyAccountGetOwnerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ReadOnlyAccountGetOwnerResponder {
type ControlHandle = ReadOnlyAccountControlHandle;
fn control_handle(&self) -> &ReadOnlyAccountControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ReadOnlyAccountGetOwnerResponder {
pub fn send(self, mut owner: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(owner);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut owner: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(owner);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut owner: &str) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ReadOnlyAccountGetOwnerResponse>(
(owner,),
self.tx_id,
0x553f661d27b2273a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ReadOnlyAccountGetBalanceResponder {
control_handle: std::mem::ManuallyDrop<ReadOnlyAccountControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ReadOnlyAccountGetBalanceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ReadOnlyAccountGetBalanceResponder {
type ControlHandle = ReadOnlyAccountControlHandle;
fn control_handle(&self) -> &ReadOnlyAccountControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ReadOnlyAccountGetBalanceResponder {
pub fn send(self, mut balance: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(balance);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut balance: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(balance);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut balance: i64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ReadOnlyAccountGetBalanceResponse>(
(balance,),
self.tx_id,
0x35ffed4715b1b3ac,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ReadWriteAccountMarker;
impl fidl::endpoints::ProtocolMarker for ReadWriteAccountMarker {
type Proxy = ReadWriteAccountProxy;
type RequestStream = ReadWriteAccountRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ReadWriteAccountSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ReadWriteAccount";
}
pub trait ReadWriteAccountProxyInterface: Send + Sync {
type GetOwnerResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
fn r#get_owner(&self) -> Self::GetOwnerResponseFut;
type GetBalanceResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
fn r#get_balance(&self) -> Self::GetBalanceResponseFut;
type DebitResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
fn r#debit(&self, amount: i64) -> Self::DebitResponseFut;
type CreditResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#credit(&self, amount: i64) -> Self::CreditResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ReadWriteAccountSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ReadWriteAccountSynchronousProxy {
type Proxy = ReadWriteAccountProxy;
type Protocol = ReadWriteAccountMarker;
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 ReadWriteAccountSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ReadWriteAccountMarker 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::MonotonicInstant,
) -> Result<ReadWriteAccountEvent, fidl::Error> {
ReadWriteAccountEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_owner(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, ReadOnlyAccountGetOwnerResponse>(
(),
0x553f661d27b2273a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.owner)
}
pub fn r#get_balance(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, ReadOnlyAccountGetBalanceResponse>(
(),
0x35ffed4715b1b3ac,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.balance)
}
pub fn r#debit(
&self,
mut amount: i64,
___deadline: zx::MonotonicInstant,
) -> Result<bool, fidl::Error> {
let _response =
self.client.send_query::<ReadWriteAccountDebitRequest, ReadWriteAccountDebitResponse>(
(amount,),
0x2fa6ce7839974858,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.succeeded)
}
pub fn r#credit(
&self,
mut amount: i64,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<ReadWriteAccountCreditRequest, fidl::encoding::EmptyPayload>(
(amount,),
0x37c216ac70d94bd5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ReadWriteAccountProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ReadWriteAccountProxy {
type Protocol = ReadWriteAccountMarker;
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 ReadWriteAccountProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ReadWriteAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ReadWriteAccountEventStream {
ReadWriteAccountEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_owner(
&self,
) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
ReadWriteAccountProxyInterface::r#get_owner(self)
}
pub fn r#get_balance(
&self,
) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
ReadWriteAccountProxyInterface::r#get_balance(self)
}
pub fn r#debit(
&self,
mut amount: i64,
) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
ReadWriteAccountProxyInterface::r#debit(self, amount)
}
pub fn r#credit(
&self,
mut amount: i64,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ReadWriteAccountProxyInterface::r#credit(self, amount)
}
}
impl ReadWriteAccountProxyInterface for ReadWriteAccountProxy {
type GetOwnerResponseFut =
fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_owner(&self) -> Self::GetOwnerResponseFut {
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::<
ReadOnlyAccountGetOwnerResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x553f661d27b2273a,
>(_buf?)?;
Ok(_response.owner)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
(),
0x553f661d27b2273a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetBalanceResponseFut =
fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_balance(&self) -> Self::GetBalanceResponseFut {
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::<
ReadOnlyAccountGetBalanceResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x35ffed4715b1b3ac,
>(_buf?)?;
Ok(_response.balance)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
(),
0x35ffed4715b1b3ac,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type DebitResponseFut =
fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#debit(&self, mut amount: i64) -> Self::DebitResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<bool, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
ReadWriteAccountDebitResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2fa6ce7839974858,
>(_buf?)?;
Ok(_response.succeeded)
}
self.client.send_query_and_decode::<ReadWriteAccountDebitRequest, bool>(
(amount,),
0x2fa6ce7839974858,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type CreditResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#credit(&self, mut amount: i64) -> Self::CreditResponseFut {
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,
0x37c216ac70d94bd5,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<ReadWriteAccountCreditRequest, ()>(
(amount,),
0x37c216ac70d94bd5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ReadWriteAccountEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ReadWriteAccountEventStream {}
impl futures::stream::FusedStream for ReadWriteAccountEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ReadWriteAccountEventStream {
type Item = Result<ReadWriteAccountEvent, 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(ReadWriteAccountEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ReadWriteAccountEvent {}
impl ReadWriteAccountEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ReadWriteAccountEvent, 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:
<ReadWriteAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ReadWriteAccountRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ReadWriteAccountRequestStream {}
impl futures::stream::FusedStream for ReadWriteAccountRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ReadWriteAccountRequestStream {
type Protocol = ReadWriteAccountMarker;
type ControlHandle = ReadWriteAccountControlHandle;
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 {
ReadWriteAccountControlHandle { 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 ReadWriteAccountRequestStream {
type Item = Result<ReadWriteAccountRequest, 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 ReadWriteAccountRequestStream 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(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x553f661d27b2273a => {
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 =
ReadWriteAccountControlHandle { inner: this.inner.clone() };
Ok(ReadWriteAccountRequest::GetOwner {
responder: ReadWriteAccountGetOwnerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x35ffed4715b1b3ac => {
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 =
ReadWriteAccountControlHandle { inner: this.inner.clone() };
Ok(ReadWriteAccountRequest::GetBalance {
responder: ReadWriteAccountGetBalanceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2fa6ce7839974858 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ReadWriteAccountDebitRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ReadWriteAccountDebitRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ReadWriteAccountControlHandle { inner: this.inner.clone() };
Ok(ReadWriteAccountRequest::Debit {
amount: req.amount,
responder: ReadWriteAccountDebitResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x37c216ac70d94bd5 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ReadWriteAccountCreditRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ReadWriteAccountCreditRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ReadWriteAccountControlHandle { inner: this.inner.clone() };
Ok(ReadWriteAccountRequest::Credit {
amount: req.amount,
responder: ReadWriteAccountCreditResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ReadWriteAccountMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ReadWriteAccountRequest {
GetOwner { responder: ReadWriteAccountGetOwnerResponder },
GetBalance { responder: ReadWriteAccountGetBalanceResponder },
Debit { amount: i64, responder: ReadWriteAccountDebitResponder },
Credit { amount: i64, responder: ReadWriteAccountCreditResponder },
}
impl ReadWriteAccountRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_owner(self) -> Option<(ReadWriteAccountGetOwnerResponder)> {
if let ReadWriteAccountRequest::GetOwner { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_balance(self) -> Option<(ReadWriteAccountGetBalanceResponder)> {
if let ReadWriteAccountRequest::GetBalance { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_debit(self) -> Option<(i64, ReadWriteAccountDebitResponder)> {
if let ReadWriteAccountRequest::Debit { amount, responder } = self {
Some((amount, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_credit(self) -> Option<(i64, ReadWriteAccountCreditResponder)> {
if let ReadWriteAccountRequest::Credit { amount, responder } = self {
Some((amount, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ReadWriteAccountRequest::GetOwner { .. } => "get_owner",
ReadWriteAccountRequest::GetBalance { .. } => "get_balance",
ReadWriteAccountRequest::Debit { .. } => "debit",
ReadWriteAccountRequest::Credit { .. } => "credit",
}
}
}
#[derive(Debug, Clone)]
pub struct ReadWriteAccountControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ReadWriteAccountControlHandle {
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 ReadWriteAccountControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ReadWriteAccountGetOwnerResponder {
control_handle: std::mem::ManuallyDrop<ReadWriteAccountControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ReadWriteAccountGetOwnerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ReadWriteAccountGetOwnerResponder {
type ControlHandle = ReadWriteAccountControlHandle;
fn control_handle(&self) -> &ReadWriteAccountControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ReadWriteAccountGetOwnerResponder {
pub fn send(self, mut owner: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(owner);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut owner: &str) -> Result<(), fidl::Error> {
let _result = self.send_raw(owner);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut owner: &str) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ReadOnlyAccountGetOwnerResponse>(
(owner,),
self.tx_id,
0x553f661d27b2273a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ReadWriteAccountGetBalanceResponder {
control_handle: std::mem::ManuallyDrop<ReadWriteAccountControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ReadWriteAccountGetBalanceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ReadWriteAccountGetBalanceResponder {
type ControlHandle = ReadWriteAccountControlHandle;
fn control_handle(&self) -> &ReadWriteAccountControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ReadWriteAccountGetBalanceResponder {
pub fn send(self, mut balance: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(balance);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut balance: i64) -> Result<(), fidl::Error> {
let _result = self.send_raw(balance);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut balance: i64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ReadOnlyAccountGetBalanceResponse>(
(balance,),
self.tx_id,
0x35ffed4715b1b3ac,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ReadWriteAccountDebitResponder {
control_handle: std::mem::ManuallyDrop<ReadWriteAccountControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ReadWriteAccountDebitResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ReadWriteAccountDebitResponder {
type ControlHandle = ReadWriteAccountControlHandle;
fn control_handle(&self) -> &ReadWriteAccountControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ReadWriteAccountDebitResponder {
pub fn send(self, mut succeeded: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(succeeded);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut succeeded: bool) -> Result<(), fidl::Error> {
let _result = self.send_raw(succeeded);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut succeeded: bool) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<ReadWriteAccountDebitResponse>(
(succeeded,),
self.tx_id,
0x2fa6ce7839974858,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ReadWriteAccountCreditResponder {
control_handle: std::mem::ManuallyDrop<ReadWriteAccountControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ReadWriteAccountCreditResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ReadWriteAccountCreditResponder {
type ControlHandle = ReadWriteAccountControlHandle;
fn control_handle(&self) -> &ReadWriteAccountControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ReadWriteAccountCreditResponder {
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
}
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,
0x37c216ac70d94bd5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BankAccountMarker;
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceMarker for BankAccountMarker {
type Proxy = BankAccountProxy;
type Request = BankAccountRequest;
const SERVICE_NAME: &'static str = "fuchsia.examples.services.BankAccount";
}
#[cfg(target_os = "fuchsia")]
pub enum BankAccountRequest {
ReadOnly(ReadOnlyAccountRequestStream),
ReadWrite(ReadWriteAccountRequestStream),
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceRequest for BankAccountRequest {
type Service = BankAccountMarker;
fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
match name {
"read_only" => Self::ReadOnly(
<ReadOnlyAccountRequestStream as fidl::endpoints::RequestStream>::from_channel(
_channel,
),
),
"read_write" => Self::ReadWrite(
<ReadWriteAccountRequestStream as fidl::endpoints::RequestStream>::from_channel(
_channel,
),
),
_ => panic!("no such member protocol name for service BankAccount"),
}
}
fn member_names() -> &'static [&'static str] {
&["read_only", "read_write"]
}
}
#[cfg(target_os = "fuchsia")]
pub struct BankAccountProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceProxy for BankAccountProxy {
type Service = BankAccountMarker;
fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
Self(opener)
}
}
#[cfg(target_os = "fuchsia")]
impl BankAccountProxy {
pub fn connect_to_read_only(&self) -> Result<ReadOnlyAccountProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_proxy::<ReadOnlyAccountMarker>();
self.connect_channel_to_read_only(server_end)?;
Ok(proxy)
}
pub fn connect_to_read_only_sync(
&self,
) -> Result<ReadOnlyAccountSynchronousProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ReadOnlyAccountMarker>();
self.connect_channel_to_read_only(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_read_only(
&self,
server_end: fidl::endpoints::ServerEnd<ReadOnlyAccountMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("read_only", server_end.into_channel())
}
pub fn connect_to_read_write(&self) -> Result<ReadWriteAccountProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_proxy::<ReadWriteAccountMarker>();
self.connect_channel_to_read_write(server_end)?;
Ok(proxy)
}
pub fn connect_to_read_write_sync(
&self,
) -> Result<ReadWriteAccountSynchronousProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ReadWriteAccountMarker>();
self.connect_channel_to_read_write(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_read_write(
&self,
server_end: fidl::endpoints::ServerEnd<ReadWriteAccountMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("read_write", server_end.into_channel())
}
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for ReadOnlyAccountGetBalanceResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ReadOnlyAccountGetBalanceResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ReadOnlyAccountGetBalanceResponse, D>
for &ReadOnlyAccountGetBalanceResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadOnlyAccountGetBalanceResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ReadOnlyAccountGetBalanceResponse)
.write_unaligned((self as *const ReadOnlyAccountGetBalanceResponse).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<ReadOnlyAccountGetBalanceResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadOnlyAccountGetBalanceResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ReadOnlyAccountGetBalanceResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { balance: fidl::new_empty!(i64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ReadOnlyAccountGetOwnerResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ReadOnlyAccountGetOwnerResponse {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ReadOnlyAccountGetOwnerResponse, D>
for &ReadOnlyAccountGetOwnerResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadOnlyAccountGetOwnerResponse>(offset);
fidl::encoding::Encode::<ReadOnlyAccountGetOwnerResponse, D>::encode(
(<fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
&self.owner,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
> fidl::encoding::Encode<ReadOnlyAccountGetOwnerResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadOnlyAccountGetOwnerResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ReadOnlyAccountGetOwnerResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { owner: fidl::new_empty!(fidl::encoding::UnboundedString, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedString,
D,
&mut self.owner,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ReadWriteAccountCreditRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ReadWriteAccountCreditRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ReadWriteAccountCreditRequest, D>
for &ReadWriteAccountCreditRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadWriteAccountCreditRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ReadWriteAccountCreditRequest)
.write_unaligned((self as *const ReadWriteAccountCreditRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<ReadWriteAccountCreditRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadWriteAccountCreditRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ReadWriteAccountCreditRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { amount: fidl::new_empty!(i64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ReadWriteAccountDebitRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ReadWriteAccountDebitRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ReadWriteAccountDebitRequest, D> for &ReadWriteAccountDebitRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadWriteAccountDebitRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ReadWriteAccountDebitRequest)
.write_unaligned((self as *const ReadWriteAccountDebitRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
fidl::encoding::Encode<ReadWriteAccountDebitRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadWriteAccountDebitRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ReadWriteAccountDebitRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { amount: fidl::new_empty!(i64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ReadWriteAccountDebitResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ReadWriteAccountDebitResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ReadWriteAccountDebitResponse, D>
for &ReadWriteAccountDebitResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadWriteAccountDebitResponse>(offset);
fidl::encoding::Encode::<ReadWriteAccountDebitResponse, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.succeeded),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<ReadWriteAccountDebitResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReadWriteAccountDebitResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ReadWriteAccountDebitResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { succeeded: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.succeeded, decoder, offset + 0, _depth)?;
Ok(())
}
}
}