blob: 17d0b8aa05054739ce900b19a1f4b16d3563585e [file] [log] [blame]
// DO NOT EDIT: This file is machine-generated by fidlgen
#![warn(clippy::all)]
#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
pub mod natural {
#[derive(PartialEq, Clone, Debug)]
pub struct ExampleUseOfErrorSyntaxCallWhichMayFailRequest {
pub s: ::std::string::String,
}
impl ::fidl_next::Encodable for ExampleUseOfErrorSyntaxCallWhichMayFailRequest {
type Encoded = crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'static>;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for ExampleUseOfErrorSyntaxCallWhichMayFailRequest
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
___E: ::fidl_next::Encoder,
{
#[inline]
fn encode(
self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let Self::Encoded {
s,
} = out_;
}
::fidl_next::Encode::encode(self.s, encoder_, s, 4294967295)?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(s.as_mut_ptr()) };
::fidl_next::Constrained::validate(_field, 4294967295)?;
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExampleUseOfErrorSyntaxCallWhichMayFailRequest
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
___E: ::fidl_next::Encoder,
{
#[inline]
fn encode_ref(
&self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let Self::Encoded {
s,
} = out_;
}
::fidl_next::EncodeRef::encode_ref(&self.s, encoder_, s, 4294967295)?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(s.as_mut_ptr()) };
::fidl_next::Constrained::validate(_field, 4294967295)?;
Ok(())
}
}
impl ::fidl_next::EncodableOption for ExampleUseOfErrorSyntaxCallWhichMayFailRequest {
type EncodedOption = ::fidl_next::WireBox<
'static,
crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'static>,
>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ExampleUseOfErrorSyntaxCallWhichMayFailRequest
where
___E: ::fidl_next::Encoder + ?Sized,
ExampleUseOfErrorSyntaxCallWhichMayFailRequest: ::fidl_next::Encode<___E>,
{
#[inline]
fn encode_option(
this: ::core::option::Option<Self>,
encoder: &mut ___E,
out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
if let Some(inner) = this {
::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
::fidl_next::WireBox::encode_present(out);
} else {
::fidl_next::WireBox::encode_absent(out);
}
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E>
for ExampleUseOfErrorSyntaxCallWhichMayFailRequest
where
___E: ::fidl_next::Encoder + ?Sized,
ExampleUseOfErrorSyntaxCallWhichMayFailRequest: ::fidl_next::EncodeRef<___E>,
{
#[inline]
fn encode_option_ref(
this: ::core::option::Option<&Self>,
encoder: &mut ___E,
out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
if let Some(inner) = this {
::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
::fidl_next::WireBox::encode_present(out);
} else {
::fidl_next::WireBox::encode_absent(out);
}
Ok(())
}
}
impl<'de>
::fidl_next::FromWire<crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'de>>
for ExampleUseOfErrorSyntaxCallWhichMayFailRequest
{
#[inline]
fn from_wire(
wire: crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'de>,
) -> Self {
Self { s: ::fidl_next::FromWire::from_wire(wire.s) }
}
}
impl<'de>
::fidl_next::FromWireRef<crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'de>>
for ExampleUseOfErrorSyntaxCallWhichMayFailRequest
{
#[inline]
fn from_wire_ref(
wire: &crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'de>,
) -> Self {
Self { s: ::fidl_next::FromWireRef::from_wire_ref(&wire.s) }
}
}
#[derive(PartialEq, Clone, Debug)]
#[repr(C)]
pub struct ExampleUseOfErrorSyntaxCallWhichMayFailResponse {
pub value: i64,
}
impl ::fidl_next::Encodable for ExampleUseOfErrorSyntaxCallWhichMayFailResponse {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
Self,
crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <i64 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(),
)
};
type Encoded = crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for ExampleUseOfErrorSyntaxCallWhichMayFailResponse
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
{
#[inline]
fn encode(
self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let Self::Encoded {
value,
} = out_;
}
::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ExampleUseOfErrorSyntaxCallWhichMayFailResponse
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
{
#[inline]
fn encode_ref(
&self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let Self::Encoded {
value,
} = out_;
}
::fidl_next::EncodeRef::encode_ref(&self.value, encoder_, value, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
Ok(())
}
}
impl ::fidl_next::EncodableOption for ExampleUseOfErrorSyntaxCallWhichMayFailResponse {
type EncodedOption = ::fidl_next::WireBox<
'static,
crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse,
>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E>
for ExampleUseOfErrorSyntaxCallWhichMayFailResponse
where
___E: ::fidl_next::Encoder + ?Sized,
ExampleUseOfErrorSyntaxCallWhichMayFailResponse: ::fidl_next::Encode<___E>,
{
#[inline]
fn encode_option(
this: ::core::option::Option<Self>,
encoder: &mut ___E,
out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
if let Some(inner) = this {
::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
::fidl_next::WireBox::encode_present(out);
} else {
::fidl_next::WireBox::encode_absent(out);
}
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E>
for ExampleUseOfErrorSyntaxCallWhichMayFailResponse
where
___E: ::fidl_next::Encoder + ?Sized,
ExampleUseOfErrorSyntaxCallWhichMayFailResponse: ::fidl_next::EncodeRef<___E>,
{
#[inline]
fn encode_option_ref(
this: ::core::option::Option<&Self>,
encoder: &mut ___E,
out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
if let Some(inner) = this {
::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
::fidl_next::WireBox::encode_present(out);
} else {
::fidl_next::WireBox::encode_absent(out);
}
Ok(())
}
}
impl ::fidl_next::FromWire<crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse>
for ExampleUseOfErrorSyntaxCallWhichMayFailResponse
{
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse,
Self,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <i64 as ::fidl_next::FromWire<::fidl_next::WireI64>>::COPY_OPTIMIZATION
.is_enabled(),
)
};
#[inline]
fn from_wire(wire: crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse) -> Self {
Self { value: ::fidl_next::FromWire::from_wire(wire.value) }
}
}
impl ::fidl_next::FromWireRef<crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse>
for ExampleUseOfErrorSyntaxCallWhichMayFailResponse
{
#[inline]
fn from_wire_ref(
wire: &crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse,
) -> Self {
Self { value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value) }
}
}
}
pub mod wire {
/// The wire type corresponding to [`ExampleUseOfErrorSyntaxCallWhichMayFailRequest`].
#[derive(Debug)]
#[repr(C)]
pub struct ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'de> {
pub s: ::fidl_next::WireString<'de>,
}
static_assertions::const_assert_eq!(
std::mem::size_of::<ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'_>>(),
16
);
static_assertions::const_assert_eq!(
std::mem::align_of::<ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'_>>(),
8
);
static_assertions::const_assert_eq!(
std::mem::offset_of!(ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'_>, s),
0
);
unsafe impl ::fidl_next::Wire for ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'static> {
type Decoded<'de> = ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'de>;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
s,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(s);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D>
for ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'static>
where
___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
___D: ::fidl_next::Decoder,
{
fn decode(
slot_: ::fidl_next::Slot<'_, Self>,
decoder_: &mut ___D,
_: (),
) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
::fidl_next::munge! {
let Self {
mut s,
} = slot_;
}
let _field = s.as_mut();
::fidl_next::Constrained::validate(_field, 4294967295)?;
::fidl_next::Decode::decode(s.as_mut(), decoder_, 4294967295)?;
Ok(())
}
}
impl<'de> ::fidl_next::IntoNatural for ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'de> {
type Natural = crate::natural::ExampleUseOfErrorSyntaxCallWhichMayFailRequest;
}
impl ::fidl_next::Unconstrained for ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'static> {}
/// The wire type corresponding to [`ExampleUseOfErrorSyntaxCallWhichMayFailResponse`].
#[derive(Clone, Debug)]
#[repr(C)]
pub struct ExampleUseOfErrorSyntaxCallWhichMayFailResponse {
pub value: ::fidl_next::WireI64,
}
static_assertions::const_assert_eq!(
std::mem::size_of::<ExampleUseOfErrorSyntaxCallWhichMayFailResponse>(),
8
);
static_assertions::const_assert_eq!(
std::mem::align_of::<ExampleUseOfErrorSyntaxCallWhichMayFailResponse>(),
8
);
static_assertions::const_assert_eq!(
std::mem::offset_of!(ExampleUseOfErrorSyntaxCallWhichMayFailResponse, value),
0
);
unsafe impl ::fidl_next::Wire for ExampleUseOfErrorSyntaxCallWhichMayFailResponse {
type Decoded<'de> = ExampleUseOfErrorSyntaxCallWhichMayFailResponse;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
value,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(value);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for ExampleUseOfErrorSyntaxCallWhichMayFailResponse
where
___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
{
fn decode(
slot_: ::fidl_next::Slot<'_, Self>,
decoder_: &mut ___D,
_: (),
) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
::fidl_next::munge! {
let Self {
mut value,
} = slot_;
}
let _field = value.as_mut();
::fidl_next::Decode::decode(value.as_mut(), decoder_, ())?;
Ok(())
}
}
impl ::fidl_next::IntoNatural for ExampleUseOfErrorSyntaxCallWhichMayFailResponse {
type Natural = crate::natural::ExampleUseOfErrorSyntaxCallWhichMayFailResponse;
}
impl ::fidl_next::Unconstrained for ExampleUseOfErrorSyntaxCallWhichMayFailResponse {}
}
pub mod wire_optional {}
pub mod generic {
pub struct ExampleUseOfErrorSyntaxCallWhichMayFailRequest<T0> {
pub s: T0,
}
impl<T0> ::fidl_next::Encodable for ExampleUseOfErrorSyntaxCallWhichMayFailRequest<T0>
where
T0: ::fidl_next::Encodable<Encoded = ::fidl_next::WireString<'static>>,
{
type Encoded = crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'static>;
}
unsafe impl<___E, T0> ::fidl_next::Encode<___E>
for ExampleUseOfErrorSyntaxCallWhichMayFailRequest<T0>
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
___E: ::fidl_next::Encoder,
T0: ::fidl_next::Encode<___E, Encoded = ::fidl_next::WireString<'static>>,
{
#[inline]
fn encode(
self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let Self::Encoded {
s,
} = out_;
}
::fidl_next::Encode::encode(self.s, encoder_, s, 4294967295)?;
Ok(())
}
}
pub struct ExampleUseOfErrorSyntaxCallWhichMayFailResponse<T0> {
pub value: T0,
}
impl<T0> ::fidl_next::Encodable for ExampleUseOfErrorSyntaxCallWhichMayFailResponse<T0>
where
T0: ::fidl_next::Encodable<Encoded = ::fidl_next::WireI64>,
{
type Encoded = crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse;
}
unsafe impl<___E, T0> ::fidl_next::Encode<___E>
for ExampleUseOfErrorSyntaxCallWhichMayFailResponse<T0>
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
T0: ::fidl_next::Encode<___E, Encoded = ::fidl_next::WireI64>,
{
#[inline]
fn encode(
self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let Self::Encoded {
value,
} = out_;
}
::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
Ok(())
}
}
}
pub use self::natural::*;
/// The type corresponding to the ExampleUseOfErrorSyntax protocol.
#[derive(PartialEq, Debug)]
pub struct ExampleUseOfErrorSyntax;
#[cfg(target_os = "fuchsia")]
impl ::fidl_next::HasTransport for ExampleUseOfErrorSyntax {
type Transport = ::fidl_next::fuchsia::zx::Channel;
}
pub mod example_use_of_error_syntax {
pub mod prelude {
pub use crate::{
ExampleUseOfErrorSyntax, ExampleUseOfErrorSyntaxClientHandler,
ExampleUseOfErrorSyntaxServerHandler, example_use_of_error_syntax,
};
pub use ::fidl_next_test_errorsyntax_parent::natural::ParentUsesErrorSyntaxComposedCallWhichMayFailRequest;
pub use ::fidl_next_test_errorsyntax_parent::natural::ParentUsesErrorSyntaxComposedCallWhichMayFailResponse;
pub use crate::natural::ExampleUseOfErrorSyntaxCallWhichMayFailRequest;
pub use crate::natural::ExampleUseOfErrorSyntaxCallWhichMayFailResponse;
}
pub struct ComposedCallWhichMayFail;
impl ::fidl_next::Method for ComposedCallWhichMayFail {
const ORDINAL: u64 = 3565108794310607393;
const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
::fidl_next::protocol::Flexibility::Strict;
type Protocol = crate::ExampleUseOfErrorSyntax;
type Request = ::fidl_next_test_errorsyntax_parent::wire::ParentUsesErrorSyntaxComposedCallWhichMayFailRequest<'static>;
type Response =
::fidl_next::WireResult
<
'static,
::fidl_next_test_errorsyntax_parent::wire::ParentUsesErrorSyntaxComposedCallWhichMayFailResponse,
::fidl_next::WireU32,
>
;
}
impl<___R> ::fidl_next::Respond<___R> for ComposedCallWhichMayFail {
type Output =
::core::result::Result
<
::fidl_next_test_errorsyntax_parent::generic::ParentUsesErrorSyntaxComposedCallWhichMayFailResponse<___R>,
::fidl_next::util::EncodableNever<
::fidl_next::WireU32,
>,
>;
fn respond(response: ___R) -> Self::Output {
::core::result::Result::Ok
(::fidl_next_test_errorsyntax_parent::generic::ParentUsesErrorSyntaxComposedCallWhichMayFailResponse {
value: response,
})
}
}
impl<___R> ::fidl_next::RespondErr<___R> for ComposedCallWhichMayFail {
type Output =
::core::result::Result
<
::fidl_next::util::EncodableNever<
::fidl_next_test_errorsyntax_parent::wire::ParentUsesErrorSyntaxComposedCallWhichMayFailResponse,
>,
___R,
>;
fn respond_err(response: ___R) -> Self::Output {
::core::result::Result::Err(response)
}
}
pub struct CallWhichMayFail;
impl ::fidl_next::Method for CallWhichMayFail {
const ORDINAL: u64 = 3757408930698888354;
const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
::fidl_next::protocol::Flexibility::Strict;
type Protocol = crate::ExampleUseOfErrorSyntax;
type Request = crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest<'static>;
type Response = ::fidl_next::WireResult<
'static,
crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse,
::fidl_next::WireU32,
>;
}
impl<___R> ::fidl_next::Respond<___R> for CallWhichMayFail {
type Output = ::core::result::Result<
crate::generic::ExampleUseOfErrorSyntaxCallWhichMayFailResponse<___R>,
::fidl_next::util::EncodableNever<::fidl_next::WireU32>,
>;
fn respond(response: ___R) -> Self::Output {
::core::result::Result::Ok(
crate::generic::ExampleUseOfErrorSyntaxCallWhichMayFailResponse { value: response },
)
}
}
impl<___R> ::fidl_next::RespondErr<___R> for CallWhichMayFail {
type Output = ::core::result::Result<
::fidl_next::util::EncodableNever<
crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailResponse,
>,
___R,
>;
fn respond_err(response: ___R) -> Self::Output {
::core::result::Result::Err(response)
}
}
mod ___detail {
unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ExampleUseOfErrorSyntax
where
___T: ::fidl_next::Transport,
{
type Client = ExampleUseOfErrorSyntaxClient<___T>;
type Server = ExampleUseOfErrorSyntaxServer<___T>;
}
/// The client for the `ExampleUseOfErrorSyntax` protocol.
#[repr(transparent)]
pub struct ExampleUseOfErrorSyntaxClient<___T: ::fidl_next::Transport> {
#[allow(dead_code)]
client: ::fidl_next::protocol::Client<___T>,
}
impl<___T> ExampleUseOfErrorSyntaxClient<___T>
where
___T: ::fidl_next::Transport,
{
pub fn composed_call_which_may_fail(
&self,
s: impl ::fidl_next::Encode<
<___T as ::fidl_next::Transport>::SendBuffer,
Encoded = ::fidl_next::WireString<'static>,
>,
) -> ::fidl_next::TwoWayFuture<'_, super::ComposedCallWhichMayFail, ___T>
where
<___T as ::fidl_next::Transport>::SendBuffer:
::fidl_next::encoder::InternalHandleEncoder,
<___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
{
self.composed_call_which_may_fail_with(::fidl_next_test_errorsyntax_parent::generic::ParentUsesErrorSyntaxComposedCallWhichMayFailRequest {
s,
})
}
pub fn composed_call_which_may_fail_with<___R>(
&self,
request: ___R,
) -> ::fidl_next::TwoWayFuture<'_, super::ComposedCallWhichMayFail, ___T>
where
___R: ::fidl_next::Encode<
<___T as ::fidl_next::Transport>::SendBuffer,
Encoded = ::fidl_next_test_errorsyntax_parent::wire::ParentUsesErrorSyntaxComposedCallWhichMayFailRequest<'static>,
>,
{
::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3565108794310607393,
<super::ComposedCallWhichMayFail as ::fidl_next::Method>::FLEXIBILITY,
request,
))
}
pub fn call_which_may_fail(
&self,
s: impl ::fidl_next::Encode<
<___T as ::fidl_next::Transport>::SendBuffer,
Encoded = ::fidl_next::WireString<'static>,
>,
) -> ::fidl_next::TwoWayFuture<'_, super::CallWhichMayFail, ___T>
where
<___T as ::fidl_next::Transport>::SendBuffer:
::fidl_next::encoder::InternalHandleEncoder,
<___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
{
self.call_which_may_fail_with(
crate::generic::ExampleUseOfErrorSyntaxCallWhichMayFailRequest { s },
)
}
pub fn call_which_may_fail_with<___R>(
&self,
request: ___R,
) -> ::fidl_next::TwoWayFuture<'_, super::CallWhichMayFail, ___T>
where
___R: ::fidl_next::Encode<
<___T as ::fidl_next::Transport>::SendBuffer,
Encoded = crate::wire::ExampleUseOfErrorSyntaxCallWhichMayFailRequest<
'static,
>,
>,
{
::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
3757408930698888354,
<super::CallWhichMayFail as ::fidl_next::Method>::FLEXIBILITY,
request,
))
}
}
/// The server for the `ExampleUseOfErrorSyntax` protocol.
#[repr(transparent)]
pub struct ExampleUseOfErrorSyntaxServer<___T: ::fidl_next::Transport> {
server: ::fidl_next::protocol::Server<___T>,
}
impl<___T> ExampleUseOfErrorSyntaxServer<___T> where ___T: ::fidl_next::Transport {}
}
}
/// A client handler for the ExampleUseOfErrorSyntax protocol.
///
/// See [`ExampleUseOfErrorSyntax`] for more details.
pub trait ExampleUseOfErrorSyntaxClientHandler<
#[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
#[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
>
{
}
impl<___T> ExampleUseOfErrorSyntaxClientHandler<___T> for ::fidl_next::IgnoreEvents where
___T: ::fidl_next::Transport
{
}
impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ExampleUseOfErrorSyntax
where
___H: ExampleUseOfErrorSyntaxClientHandler<___T> + ::core::marker::Send,
___T: ::fidl_next::Transport,
<example_use_of_error_syntax::ComposedCallWhichMayFail as ::fidl_next::Method>::Response:
::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
<example_use_of_error_syntax::CallWhichMayFail as ::fidl_next::Method>::Response:
::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
{
async fn on_event(
handler: &mut ___H,
ordinal: u64,
flexibility: ::fidl_next::protocol::Flexibility,
buffer: ___T::RecvBuffer,
) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
match ordinal {
ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
}
}
}
/// A server handler for the ExampleUseOfErrorSyntax protocol.
///
/// See [`ExampleUseOfErrorSyntax`] for more details.
pub trait ExampleUseOfErrorSyntaxServerHandler<
#[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
#[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
>
{
fn composed_call_which_may_fail(
&mut self,
request: ::fidl_next::Request<example_use_of_error_syntax::ComposedCallWhichMayFail, ___T>,
responder: ::fidl_next::Responder<
example_use_of_error_syntax::ComposedCallWhichMayFail,
___T,
>,
) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
fn call_which_may_fail(
&mut self,
request: ::fidl_next::Request<example_use_of_error_syntax::CallWhichMayFail, ___T>,
responder: ::fidl_next::Responder<example_use_of_error_syntax::CallWhichMayFail, ___T>,
) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
}
impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ExampleUseOfErrorSyntax
where
___H: ExampleUseOfErrorSyntaxServerHandler<___T> + ::core::marker::Send,
___T: ::fidl_next::Transport,
<example_use_of_error_syntax::ComposedCallWhichMayFail as ::fidl_next::Method>::Request:
::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
<example_use_of_error_syntax::CallWhichMayFail as ::fidl_next::Method>::Request:
::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
{
async fn on_one_way(
handler: &mut ___H,
ordinal: u64,
flexibility: ::fidl_next::protocol::Flexibility,
buffer: ___T::RecvBuffer,
) -> ::core::result::Result<
(),
::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
> {
match ordinal {
ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
}
}
async fn on_two_way(
handler: &mut ___H,
ordinal: u64,
flexibility: ::fidl_next::protocol::Flexibility,
buffer: ___T::RecvBuffer,
responder: ::fidl_next::protocol::Responder<___T>,
) -> ::core::result::Result<
(),
::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
> {
match ordinal {
3565108794310607393 => {
let responder = ::fidl_next::Responder::from_untyped(responder);
match ::fidl_next::DecoderExt::decode(buffer) {
Ok(decoded) => {
handler.composed_call_which_may_fail(decoded, responder).await;
Ok(())
}
Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
ordinal: 3565108794310607393,
error,
}),
}
}
3757408930698888354 => {
let responder = ::fidl_next::Responder::from_untyped(responder);
match ::fidl_next::DecoderExt::decode(buffer) {
Ok(decoded) => {
handler.call_which_may_fail(decoded, responder).await;
Ok(())
}
Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
ordinal: 3757408930698888354,
error,
}),
}
}
ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
}
}
}
/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
pub mod compat {
impl ::fidl_next::CompatFrom<crate::ExampleUseOfErrorSyntaxCallWhichMayFailRequest>
for ::fidl_test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest
{
#[inline]
fn compat_from(value: crate::ExampleUseOfErrorSyntaxCallWhichMayFailRequest) -> Self {
Self { s: ::fidl_next::CompatFrom::compat_from(value.s) }
}
}
impl
::fidl_next::CompatFrom<
::fidl_test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest,
> for crate::ExampleUseOfErrorSyntaxCallWhichMayFailRequest
{
#[inline]
fn compat_from(
value: ::fidl_test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailRequest,
) -> Self {
Self { s: ::fidl_next::CompatFrom::compat_from(value.s) }
}
}
impl ::fidl_next::CompatFrom<crate::ExampleUseOfErrorSyntaxCallWhichMayFailResponse>
for ::fidl_test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse
{
#[inline]
fn compat_from(value: crate::ExampleUseOfErrorSyntaxCallWhichMayFailResponse) -> Self {
Self { value: ::fidl_next::CompatFrom::compat_from(value.value) }
}
}
impl
::fidl_next::CompatFrom<
::fidl_test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse,
> for crate::ExampleUseOfErrorSyntaxCallWhichMayFailResponse
{
#[inline]
fn compat_from(
value: ::fidl_test_errorsyntax::ExampleUseOfErrorSyntaxCallWhichMayFailResponse,
) -> Self {
Self { value: ::fidl_next::CompatFrom::compat_from(value.value) }
}
}
#[cfg(target_os = "fuchsia")]
/// An alias for a client over `zx::Channel` for the `ExampleUseOfErrorSyntax`
/// protocol.
pub type ExampleUseOfErrorSyntaxProxy = ::fidl_next::Client<crate::ExampleUseOfErrorSyntax>;
impl ::fidl_next::CompatFrom<crate::ExampleUseOfErrorSyntax>
for ::fidl_test_errorsyntax::ExampleUseOfErrorSyntaxMarker
{
fn compat_from(_: crate::ExampleUseOfErrorSyntax) -> Self {
Self
}
}
impl ::fidl_next::CompatFrom<::fidl_test_errorsyntax::ExampleUseOfErrorSyntaxMarker>
for crate::ExampleUseOfErrorSyntax
{
fn compat_from(_: ::fidl_test_errorsyntax::ExampleUseOfErrorSyntaxMarker) -> Self {
Self
}
}
#[cfg(target_os = "fuchsia")]
impl ::fidl_next::ClientCompatFrom<::fidl_test_errorsyntax::ExampleUseOfErrorSyntaxProxy>
for crate::ExampleUseOfErrorSyntax
{
fn client_compat_from(
proxy: ::fidl_test_errorsyntax::ExampleUseOfErrorSyntaxProxy,
) -> ::fidl_next::ClientDispatcher<Self, ::fidl_next::fuchsia::zx::Channel> {
let channel = ::fidl::endpoints::Proxy::into_channel(proxy).unwrap().into_zx_channel();
let client_end = ::fidl_next::ClientEnd::from_untyped(channel);
::fidl_next::ClientDispatcher::new(client_end)
}
}
}