#![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, PartialEq, PartialOrd)]
pub struct CalculatorAddRequest {
pub a: f64,
pub b: f64,
}
impl fidl::Persistable for CalculatorAddRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct CalculatorAddResponse {
pub sum: f64,
}
impl fidl::Persistable for CalculatorAddResponse {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct CalculatorDivideRequest {
pub dividend: f64,
pub divisor: f64,
}
impl fidl::Persistable for CalculatorDivideRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct CalculatorDivideResponse {
pub quotient: f64,
}
impl fidl::Persistable for CalculatorDivideResponse {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct CalculatorMultiplyRequest {
pub a: f64,
pub b: f64,
}
impl fidl::Persistable for CalculatorMultiplyRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct CalculatorMultiplyResponse {
pub product: f64,
}
impl fidl::Persistable for CalculatorMultiplyResponse {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct CalculatorPowRequest {
pub base: f64,
pub exponent: f64,
}
impl fidl::Persistable for CalculatorPowRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct CalculatorPowResponse {
pub power: f64,
}
impl fidl::Persistable for CalculatorPowResponse {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct CalculatorSubtractRequest {
pub a: f64,
pub b: f64,
}
impl fidl::Persistable for CalculatorSubtractRequest {}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub struct CalculatorSubtractResponse {
pub difference: f64,
}
impl fidl::Persistable for CalculatorSubtractResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct CalculatorMarker;
impl fidl::endpoints::ProtocolMarker for CalculatorMarker {
type Proxy = CalculatorProxy;
type RequestStream = CalculatorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = CalculatorSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.examples.calculator.Calculator";
}
impl fidl::endpoints::DiscoverableProtocolMarker for CalculatorMarker {}
pub trait CalculatorProxyInterface: Send + Sync {
type AddResponseFut: std::future::Future<Output = Result<f64, fidl::Error>> + Send;
fn r#add(&self, a: f64, b: f64) -> Self::AddResponseFut;
type SubtractResponseFut: std::future::Future<Output = Result<f64, fidl::Error>> + Send;
fn r#subtract(&self, a: f64, b: f64) -> Self::SubtractResponseFut;
type MultiplyResponseFut: std::future::Future<Output = Result<f64, fidl::Error>> + Send;
fn r#multiply(&self, a: f64, b: f64) -> Self::MultiplyResponseFut;
type DivideResponseFut: std::future::Future<Output = Result<f64, fidl::Error>> + Send;
fn r#divide(&self, dividend: f64, divisor: f64) -> Self::DivideResponseFut;
type PowResponseFut: std::future::Future<Output = Result<f64, fidl::Error>> + Send;
fn r#pow(&self, base: f64, exponent: f64) -> Self::PowResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct CalculatorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for CalculatorSynchronousProxy {
type Proxy = CalculatorProxy;
type Protocol = CalculatorMarker;
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 CalculatorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <CalculatorMarker 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<CalculatorEvent, fidl::Error> {
CalculatorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add(
&self,
mut a: f64,
mut b: f64,
___deadline: zx::MonotonicInstant,
) -> Result<f64, fidl::Error> {
let _response = self.client.send_query::<CalculatorAddRequest, CalculatorAddResponse>(
(a, b),
0x5f2286171d9ff91e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.sum)
}
pub fn r#subtract(
&self,
mut a: f64,
mut b: f64,
___deadline: zx::MonotonicInstant,
) -> Result<f64, fidl::Error> {
let _response =
self.client.send_query::<CalculatorSubtractRequest, CalculatorSubtractResponse>(
(a, b),
0x64ce8ff043420d78,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.difference)
}
pub fn r#multiply(
&self,
mut a: f64,
mut b: f64,
___deadline: zx::MonotonicInstant,
) -> Result<f64, fidl::Error> {
let _response =
self.client.send_query::<CalculatorMultiplyRequest, CalculatorMultiplyResponse>(
(a, b),
0x4d6fedd51609fc35,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.product)
}
pub fn r#divide(
&self,
mut dividend: f64,
mut divisor: f64,
___deadline: zx::MonotonicInstant,
) -> Result<f64, fidl::Error> {
let _response =
self.client.send_query::<CalculatorDivideRequest, CalculatorDivideResponse>(
(dividend, divisor),
0x4dc343d7222988ba,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.quotient)
}
pub fn r#pow(
&self,
mut base: f64,
mut exponent: f64,
___deadline: zx::MonotonicInstant,
) -> Result<f64, fidl::Error> {
let _response = self.client.send_query::<CalculatorPowRequest, CalculatorPowResponse>(
(base, exponent),
0x3467780dee7ba196,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.power)
}
}
#[derive(Debug, Clone)]
pub struct CalculatorProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for CalculatorProxy {
type Protocol = CalculatorMarker;
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 CalculatorProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <CalculatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> CalculatorEventStream {
CalculatorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add(
&self,
mut a: f64,
mut b: f64,
) -> fidl::client::QueryResponseFut<f64, fidl::encoding::DefaultFuchsiaResourceDialect> {
CalculatorProxyInterface::r#add(self, a, b)
}
pub fn r#subtract(
&self,
mut a: f64,
mut b: f64,
) -> fidl::client::QueryResponseFut<f64, fidl::encoding::DefaultFuchsiaResourceDialect> {
CalculatorProxyInterface::r#subtract(self, a, b)
}
pub fn r#multiply(
&self,
mut a: f64,
mut b: f64,
) -> fidl::client::QueryResponseFut<f64, fidl::encoding::DefaultFuchsiaResourceDialect> {
CalculatorProxyInterface::r#multiply(self, a, b)
}
pub fn r#divide(
&self,
mut dividend: f64,
mut divisor: f64,
) -> fidl::client::QueryResponseFut<f64, fidl::encoding::DefaultFuchsiaResourceDialect> {
CalculatorProxyInterface::r#divide(self, dividend, divisor)
}
pub fn r#pow(
&self,
mut base: f64,
mut exponent: f64,
) -> fidl::client::QueryResponseFut<f64, fidl::encoding::DefaultFuchsiaResourceDialect> {
CalculatorProxyInterface::r#pow(self, base, exponent)
}
}
impl CalculatorProxyInterface for CalculatorProxy {
type AddResponseFut =
fidl::client::QueryResponseFut<f64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#add(&self, mut a: f64, mut b: f64) -> Self::AddResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<f64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CalculatorAddResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5f2286171d9ff91e,
>(_buf?)?;
Ok(_response.sum)
}
self.client.send_query_and_decode::<CalculatorAddRequest, f64>(
(a, b),
0x5f2286171d9ff91e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SubtractResponseFut =
fidl::client::QueryResponseFut<f64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#subtract(&self, mut a: f64, mut b: f64) -> Self::SubtractResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<f64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CalculatorSubtractResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x64ce8ff043420d78,
>(_buf?)?;
Ok(_response.difference)
}
self.client.send_query_and_decode::<CalculatorSubtractRequest, f64>(
(a, b),
0x64ce8ff043420d78,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type MultiplyResponseFut =
fidl::client::QueryResponseFut<f64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#multiply(&self, mut a: f64, mut b: f64) -> Self::MultiplyResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<f64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CalculatorMultiplyResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4d6fedd51609fc35,
>(_buf?)?;
Ok(_response.product)
}
self.client.send_query_and_decode::<CalculatorMultiplyRequest, f64>(
(a, b),
0x4d6fedd51609fc35,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type DivideResponseFut =
fidl::client::QueryResponseFut<f64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#divide(&self, mut dividend: f64, mut divisor: f64) -> Self::DivideResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<f64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CalculatorDivideResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4dc343d7222988ba,
>(_buf?)?;
Ok(_response.quotient)
}
self.client.send_query_and_decode::<CalculatorDivideRequest, f64>(
(dividend, divisor),
0x4dc343d7222988ba,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type PowResponseFut =
fidl::client::QueryResponseFut<f64, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#pow(&self, mut base: f64, mut exponent: f64) -> Self::PowResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<f64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CalculatorPowResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3467780dee7ba196,
>(_buf?)?;
Ok(_response.power)
}
self.client.send_query_and_decode::<CalculatorPowRequest, f64>(
(base, exponent),
0x3467780dee7ba196,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct CalculatorEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for CalculatorEventStream {}
impl futures::stream::FusedStream for CalculatorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for CalculatorEventStream {
type Item = Result<CalculatorEvent, 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(CalculatorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum CalculatorEvent {}
impl CalculatorEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<CalculatorEvent, 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: <CalculatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct CalculatorRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for CalculatorRequestStream {}
impl futures::stream::FusedStream for CalculatorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for CalculatorRequestStream {
type Protocol = CalculatorMarker;
type ControlHandle = CalculatorControlHandle;
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 {
CalculatorControlHandle { 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 CalculatorRequestStream {
type Item = Result<CalculatorRequest, 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 CalculatorRequestStream 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 {
0x5f2286171d9ff91e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
CalculatorAddRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CalculatorAddRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CalculatorControlHandle { inner: this.inner.clone() };
Ok(CalculatorRequest::Add {
a: req.a,
b: req.b,
responder: CalculatorAddResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x64ce8ff043420d78 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
CalculatorSubtractRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CalculatorSubtractRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CalculatorControlHandle { inner: this.inner.clone() };
Ok(CalculatorRequest::Subtract {
a: req.a,
b: req.b,
responder: CalculatorSubtractResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4d6fedd51609fc35 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
CalculatorMultiplyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CalculatorMultiplyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CalculatorControlHandle { inner: this.inner.clone() };
Ok(CalculatorRequest::Multiply {
a: req.a,
b: req.b,
responder: CalculatorMultiplyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4dc343d7222988ba => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
CalculatorDivideRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CalculatorDivideRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CalculatorControlHandle { inner: this.inner.clone() };
Ok(CalculatorRequest::Divide {
dividend: req.dividend,
divisor: req.divisor,
responder: CalculatorDivideResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3467780dee7ba196 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
CalculatorPowRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CalculatorPowRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CalculatorControlHandle { inner: this.inner.clone() };
Ok(CalculatorRequest::Pow {
base: req.base,
exponent: req.exponent,
responder: CalculatorPowResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<CalculatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum CalculatorRequest {
Add { a: f64, b: f64, responder: CalculatorAddResponder },
Subtract { a: f64, b: f64, responder: CalculatorSubtractResponder },
Multiply { a: f64, b: f64, responder: CalculatorMultiplyResponder },
Divide { dividend: f64, divisor: f64, responder: CalculatorDivideResponder },
Pow { base: f64, exponent: f64, responder: CalculatorPowResponder },
}
impl CalculatorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add(self) -> Option<(f64, f64, CalculatorAddResponder)> {
if let CalculatorRequest::Add { a, b, responder } = self {
Some((a, b, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_subtract(self) -> Option<(f64, f64, CalculatorSubtractResponder)> {
if let CalculatorRequest::Subtract { a, b, responder } = self {
Some((a, b, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_multiply(self) -> Option<(f64, f64, CalculatorMultiplyResponder)> {
if let CalculatorRequest::Multiply { a, b, responder } = self {
Some((a, b, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_divide(self) -> Option<(f64, f64, CalculatorDivideResponder)> {
if let CalculatorRequest::Divide { dividend, divisor, responder } = self {
Some((dividend, divisor, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_pow(self) -> Option<(f64, f64, CalculatorPowResponder)> {
if let CalculatorRequest::Pow { base, exponent, responder } = self {
Some((base, exponent, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
CalculatorRequest::Add { .. } => "add",
CalculatorRequest::Subtract { .. } => "subtract",
CalculatorRequest::Multiply { .. } => "multiply",
CalculatorRequest::Divide { .. } => "divide",
CalculatorRequest::Pow { .. } => "pow",
}
}
}
#[derive(Debug, Clone)]
pub struct CalculatorControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for CalculatorControlHandle {
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 CalculatorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CalculatorAddResponder {
control_handle: std::mem::ManuallyDrop<CalculatorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CalculatorAddResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CalculatorAddResponder {
type ControlHandle = CalculatorControlHandle;
fn control_handle(&self) -> &CalculatorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CalculatorAddResponder {
pub fn send(self, mut sum: f64) -> Result<(), fidl::Error> {
let _result = self.send_raw(sum);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut sum: f64) -> Result<(), fidl::Error> {
let _result = self.send_raw(sum);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut sum: f64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<CalculatorAddResponse>(
(sum,),
self.tx_id,
0x5f2286171d9ff91e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CalculatorSubtractResponder {
control_handle: std::mem::ManuallyDrop<CalculatorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CalculatorSubtractResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CalculatorSubtractResponder {
type ControlHandle = CalculatorControlHandle;
fn control_handle(&self) -> &CalculatorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CalculatorSubtractResponder {
pub fn send(self, mut difference: f64) -> Result<(), fidl::Error> {
let _result = self.send_raw(difference);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut difference: f64) -> Result<(), fidl::Error> {
let _result = self.send_raw(difference);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut difference: f64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<CalculatorSubtractResponse>(
(difference,),
self.tx_id,
0x64ce8ff043420d78,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CalculatorMultiplyResponder {
control_handle: std::mem::ManuallyDrop<CalculatorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CalculatorMultiplyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CalculatorMultiplyResponder {
type ControlHandle = CalculatorControlHandle;
fn control_handle(&self) -> &CalculatorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CalculatorMultiplyResponder {
pub fn send(self, mut product: f64) -> Result<(), fidl::Error> {
let _result = self.send_raw(product);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut product: f64) -> Result<(), fidl::Error> {
let _result = self.send_raw(product);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut product: f64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<CalculatorMultiplyResponse>(
(product,),
self.tx_id,
0x4d6fedd51609fc35,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CalculatorDivideResponder {
control_handle: std::mem::ManuallyDrop<CalculatorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CalculatorDivideResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CalculatorDivideResponder {
type ControlHandle = CalculatorControlHandle;
fn control_handle(&self) -> &CalculatorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CalculatorDivideResponder {
pub fn send(self, mut quotient: f64) -> Result<(), fidl::Error> {
let _result = self.send_raw(quotient);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut quotient: f64) -> Result<(), fidl::Error> {
let _result = self.send_raw(quotient);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut quotient: f64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<CalculatorDivideResponse>(
(quotient,),
self.tx_id,
0x4dc343d7222988ba,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CalculatorPowResponder {
control_handle: std::mem::ManuallyDrop<CalculatorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CalculatorPowResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CalculatorPowResponder {
type ControlHandle = CalculatorControlHandle;
fn control_handle(&self) -> &CalculatorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CalculatorPowResponder {
pub fn send(self, mut power: f64) -> Result<(), fidl::Error> {
let _result = self.send_raw(power);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut power: f64) -> Result<(), fidl::Error> {
let _result = self.send_raw(power);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut power: f64) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<CalculatorPowResponse>(
(power,),
self.tx_id,
0x3467780dee7ba196,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for CalculatorAddRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CalculatorAddRequest {
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<CalculatorAddRequest, D>
for &CalculatorAddRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorAddRequest>(offset);
fidl::encoding::Encode::<CalculatorAddRequest, D>::encode(
(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.a),
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.b),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<f64, D>,
T1: fidl::encoding::Encode<f64, D>,
> fidl::encoding::Encode<CalculatorAddRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorAddRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CalculatorAddRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(f64, D), b: fidl::new_empty!(f64, 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!(f64, D, &mut self.a, decoder, offset + 0, _depth)?;
fidl::decode!(f64, D, &mut self.b, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorAddResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CalculatorAddResponse {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CalculatorAddResponse, D>
for &CalculatorAddResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorAddResponse>(offset);
fidl::encoding::Encode::<CalculatorAddResponse, D>::encode(
(<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.sum),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f64, D>>
fidl::encoding::Encode<CalculatorAddResponse, 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::<CalculatorAddResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CalculatorAddResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { sum: fidl::new_empty!(f64, 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!(f64, D, &mut self.sum, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorDivideRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CalculatorDivideRequest {
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<CalculatorDivideRequest, D> for &CalculatorDivideRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorDivideRequest>(offset);
fidl::encoding::Encode::<CalculatorDivideRequest, D>::encode(
(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dividend),
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.divisor),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<f64, D>,
T1: fidl::encoding::Encode<f64, D>,
> fidl::encoding::Encode<CalculatorDivideRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorDivideRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CalculatorDivideRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { dividend: fidl::new_empty!(f64, D), divisor: fidl::new_empty!(f64, 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!(f64, D, &mut self.dividend, decoder, offset + 0, _depth)?;
fidl::decode!(f64, D, &mut self.divisor, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorDivideResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CalculatorDivideResponse {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<CalculatorDivideResponse, D> for &CalculatorDivideResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorDivideResponse>(offset);
fidl::encoding::Encode::<CalculatorDivideResponse, D>::encode(
(<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.quotient),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f64, D>>
fidl::encoding::Encode<CalculatorDivideResponse, 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::<CalculatorDivideResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CalculatorDivideResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { quotient: fidl::new_empty!(f64, 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!(f64, D, &mut self.quotient, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorMultiplyRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CalculatorMultiplyRequest {
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<CalculatorMultiplyRequest, D> for &CalculatorMultiplyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorMultiplyRequest>(offset);
fidl::encoding::Encode::<CalculatorMultiplyRequest, D>::encode(
(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.a),
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.b),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<f64, D>,
T1: fidl::encoding::Encode<f64, D>,
> fidl::encoding::Encode<CalculatorMultiplyRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorMultiplyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CalculatorMultiplyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(f64, D), b: fidl::new_empty!(f64, 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!(f64, D, &mut self.a, decoder, offset + 0, _depth)?;
fidl::decode!(f64, D, &mut self.b, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorMultiplyResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CalculatorMultiplyResponse {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<CalculatorMultiplyResponse, D> for &CalculatorMultiplyResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorMultiplyResponse>(offset);
fidl::encoding::Encode::<CalculatorMultiplyResponse, D>::encode(
(<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.product),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f64, D>>
fidl::encoding::Encode<CalculatorMultiplyResponse, 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::<CalculatorMultiplyResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CalculatorMultiplyResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { product: fidl::new_empty!(f64, 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!(f64, D, &mut self.product, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorPowRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CalculatorPowRequest {
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<CalculatorPowRequest, D>
for &CalculatorPowRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorPowRequest>(offset);
fidl::encoding::Encode::<CalculatorPowRequest, D>::encode(
(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.base),
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.exponent),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<f64, D>,
T1: fidl::encoding::Encode<f64, D>,
> fidl::encoding::Encode<CalculatorPowRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorPowRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CalculatorPowRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { base: fidl::new_empty!(f64, D), exponent: fidl::new_empty!(f64, 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!(f64, D, &mut self.base, decoder, offset + 0, _depth)?;
fidl::decode!(f64, D, &mut self.exponent, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorPowResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CalculatorPowResponse {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CalculatorPowResponse, D>
for &CalculatorPowResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorPowResponse>(offset);
fidl::encoding::Encode::<CalculatorPowResponse, D>::encode(
(<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.power),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f64, D>>
fidl::encoding::Encode<CalculatorPowResponse, 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::<CalculatorPowResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CalculatorPowResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { power: fidl::new_empty!(f64, 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!(f64, D, &mut self.power, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorSubtractRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CalculatorSubtractRequest {
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<CalculatorSubtractRequest, D> for &CalculatorSubtractRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorSubtractRequest>(offset);
fidl::encoding::Encode::<CalculatorSubtractRequest, D>::encode(
(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.a),
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.b),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<f64, D>,
T1: fidl::encoding::Encode<f64, D>,
> fidl::encoding::Encode<CalculatorSubtractRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorSubtractRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CalculatorSubtractRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(f64, D), b: fidl::new_empty!(f64, 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!(f64, D, &mut self.a, decoder, offset + 0, _depth)?;
fidl::decode!(f64, D, &mut self.b, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorSubtractResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CalculatorSubtractResponse {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<CalculatorSubtractResponse, D> for &CalculatorSubtractResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorSubtractResponse>(offset);
fidl::encoding::Encode::<CalculatorSubtractResponse, D>::encode(
(<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.difference),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f64, D>>
fidl::encoding::Encode<CalculatorSubtractResponse, 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::<CalculatorSubtractResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CalculatorSubtractResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { difference: fidl::new_empty!(f64, 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!(f64, D, &mut self.difference, decoder, offset + 0, _depth)?;
Ok(())
}
}
}