#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
#[derive(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::Time) -> 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::Time) -> 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::Time,
) -> 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::Time,
) -> 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::Time,
) -> 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::Time,
) -> 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,
}
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> {
CalculatorProxyInterface::r#add(self, a, b)
}
pub fn r#subtract(&self, mut a: f64, mut b: f64) -> fidl::client::QueryResponseFut<f64> {
CalculatorProxyInterface::r#subtract(self, a, b)
}
pub fn r#multiply(&self, mut a: f64, mut b: f64) -> fidl::client::QueryResponseFut<f64> {
CalculatorProxyInterface::r#multiply(self, a, b)
}
pub fn r#divide(
&self,
mut dividend: f64,
mut divisor: f64,
) -> fidl::client::QueryResponseFut<f64> {
CalculatorProxyInterface::r#divide(self, dividend, divisor)
}
pub fn r#pow(&self, mut base: f64, mut exponent: f64) -> fidl::client::QueryResponseFut<f64> {
CalculatorProxyInterface::r#pow(self, base, exponent)
}
}
impl CalculatorProxyInterface for CalculatorProxy {
type AddResponseFut = fidl::client::QueryResponseFut<f64>;
fn r#add(&self, mut a: f64, mut b: f64) -> Self::AddResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<f64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CalculatorAddResponse,
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>;
fn r#subtract(&self, mut a: f64, mut b: f64) -> Self::SubtractResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<f64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CalculatorSubtractResponse,
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>;
fn r#multiply(&self, mut a: f64, mut b: f64) -> Self::MultiplyResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<f64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CalculatorMultiplyResponse,
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>;
fn r#divide(&self, mut dividend: f64, mut divisor: f64) -> Self::DivideResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<f64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CalculatorDivideResponse,
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>;
fn r#pow(&self, mut base: f64, mut exponent: f64) -> Self::PowResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<f64, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
CalculatorPowResponse,
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,
}
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::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>,
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>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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(|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(e))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x5f2286171d9ff91e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(CalculatorAddRequest);
fidl::encoding::Decoder::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::Decoder::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::Decoder::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::Decoder::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::Decoder::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>,
}
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()
}
}
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::*;
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
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorAddRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CalculatorAddRequest> for &CalculatorAddRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorAddRequest>(offset);
fidl::encoding::Encode::<CalculatorAddRequest>::encode(
(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.a),
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.b),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<f64>, T1: fidl::encoding::Encode<f64>>
fidl::encoding::Encode<CalculatorAddRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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 fidl::encoding::Decode<Self> for CalculatorAddRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(f64), b: fidl::new_empty!(f64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f64, &mut self.a, decoder, offset + 0, _depth)?;
fidl::decode!(f64, &mut self.b, decoder, offset + 8, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorAddResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CalculatorAddResponse> for &CalculatorAddResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorAddResponse>(offset);
fidl::encoding::Encode::<CalculatorAddResponse>::encode(
(<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.sum),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<f64>> fidl::encoding::Encode<CalculatorAddResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorAddResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CalculatorAddResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { sum: fidl::new_empty!(f64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f64, &mut self.sum, decoder, offset + 0, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorDivideRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CalculatorDivideRequest> for &CalculatorDivideRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorDivideRequest>(offset);
fidl::encoding::Encode::<CalculatorDivideRequest>::encode(
(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dividend),
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.divisor),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<f64>, T1: fidl::encoding::Encode<f64>>
fidl::encoding::Encode<CalculatorDivideRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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 fidl::encoding::Decode<Self> for CalculatorDivideRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { dividend: fidl::new_empty!(f64), divisor: fidl::new_empty!(f64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f64, &mut self.dividend, decoder, offset + 0, _depth)?;
fidl::decode!(f64, &mut self.divisor, decoder, offset + 8, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorDivideResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CalculatorDivideResponse> for &CalculatorDivideResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorDivideResponse>(offset);
fidl::encoding::Encode::<CalculatorDivideResponse>::encode(
(<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.quotient),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<f64>> fidl::encoding::Encode<CalculatorDivideResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorDivideResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CalculatorDivideResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { quotient: fidl::new_empty!(f64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f64, &mut self.quotient, decoder, offset + 0, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorMultiplyRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CalculatorMultiplyRequest> for &CalculatorMultiplyRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorMultiplyRequest>(offset);
fidl::encoding::Encode::<CalculatorMultiplyRequest>::encode(
(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.a),
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.b),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<f64>, T1: fidl::encoding::Encode<f64>>
fidl::encoding::Encode<CalculatorMultiplyRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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 fidl::encoding::Decode<Self> for CalculatorMultiplyRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(f64), b: fidl::new_empty!(f64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f64, &mut self.a, decoder, offset + 0, _depth)?;
fidl::decode!(f64, &mut self.b, decoder, offset + 8, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorMultiplyResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CalculatorMultiplyResponse> for &CalculatorMultiplyResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorMultiplyResponse>(offset);
fidl::encoding::Encode::<CalculatorMultiplyResponse>::encode(
(<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.product),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<f64>> fidl::encoding::Encode<CalculatorMultiplyResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorMultiplyResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CalculatorMultiplyResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { product: fidl::new_empty!(f64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f64, &mut self.product, decoder, offset + 0, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorPowRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CalculatorPowRequest> for &CalculatorPowRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorPowRequest>(offset);
fidl::encoding::Encode::<CalculatorPowRequest>::encode(
(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.base),
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.exponent),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<f64>, T1: fidl::encoding::Encode<f64>>
fidl::encoding::Encode<CalculatorPowRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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 fidl::encoding::Decode<Self> for CalculatorPowRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { base: fidl::new_empty!(f64), exponent: fidl::new_empty!(f64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f64, &mut self.base, decoder, offset + 0, _depth)?;
fidl::decode!(f64, &mut self.exponent, decoder, offset + 8, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorPowResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CalculatorPowResponse> for &CalculatorPowResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorPowResponse>(offset);
fidl::encoding::Encode::<CalculatorPowResponse>::encode(
(<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.power),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<f64>> fidl::encoding::Encode<CalculatorPowResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorPowResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CalculatorPowResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { power: fidl::new_empty!(f64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f64, &mut self.power, decoder, offset + 0, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorSubtractRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CalculatorSubtractRequest> for &CalculatorSubtractRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorSubtractRequest>(offset);
fidl::encoding::Encode::<CalculatorSubtractRequest>::encode(
(
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.a),
<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.b),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<f64>, T1: fidl::encoding::Encode<f64>>
fidl::encoding::Encode<CalculatorSubtractRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
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 fidl::encoding::Decode<Self> for CalculatorSubtractRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { a: fidl::new_empty!(f64), b: fidl::new_empty!(f64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f64, &mut self.a, decoder, offset + 0, _depth)?;
fidl::decode!(f64, &mut self.b, decoder, offset + 8, _depth)?;
Ok(())
}
}
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
}
}
impl fidl::encoding::ValueTypeMarker for CalculatorSubtractResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<CalculatorSubtractResponse> for &CalculatorSubtractResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorSubtractResponse>(offset);
fidl::encoding::Encode::<CalculatorSubtractResponse>::encode(
(<f64 as fidl::encoding::ValueTypeMarker>::borrow(&self.difference),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<f64>> fidl::encoding::Encode<CalculatorSubtractResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CalculatorSubtractResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for CalculatorSubtractResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { difference: fidl::new_empty!(f64) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(f64, &mut self.difference, decoder, offset + 0, _depth)?;
Ok(())
}
}
}