blob: 6573793ad69df1cdd8740cab5f91a06e5f95e58d [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)]
#[repr(C)]
pub struct Payload {
pub value: u32,
}
unsafe impl<___E> ::fidl_next::Encode<crate::wire::Payload, ___E> for Payload
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
{
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, crate::wire::Payload> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <u32 as ::fidl_next::Encode<::fidl_next::WireU32, ___E>>::COPY_OPTIMIZATION
.is_enabled(),
)
};
#[inline]
fn encode(
self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<crate::wire::Payload>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let crate::wire::Payload {
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<'a, ___E> ::fidl_next::Encode<crate::wire::Payload, ___E> for &'a Payload
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
{
#[inline]
fn encode(
self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<crate::wire::Payload>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let crate::wire::Payload {
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::EncodeOption<::fidl_next::WireBox<'static, crate::wire::Payload>, ___E>
for Payload
where
___E: ::fidl_next::Encoder + ?Sized,
Payload: ::fidl_next::Encode<crate::wire::Payload, ___E>,
{
#[inline]
fn encode_option(
this: ::core::option::Option<Self>,
encoder: &mut ___E,
out: &mut ::core::mem::MaybeUninit<::fidl_next::WireBox<'static, crate::wire::Payload>>,
_: (),
) -> ::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<'a, ___E>
::fidl_next::EncodeOption<::fidl_next::WireBox<'static, crate::wire::Payload>, ___E>
for &'a Payload
where
___E: ::fidl_next::Encoder + ?Sized,
&'a Payload: ::fidl_next::Encode<crate::wire::Payload, ___E>,
{
#[inline]
fn encode_option(
this: ::core::option::Option<Self>,
encoder: &mut ___E,
out: &mut ::core::mem::MaybeUninit<::fidl_next::WireBox<'static, crate::wire::Payload>>,
_: (),
) -> ::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::Payload> for Payload {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<crate::wire::Payload, Self> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <u32 as ::fidl_next::FromWire<::fidl_next::WireU32>>::COPY_OPTIMIZATION
.is_enabled(),
)
};
#[inline]
fn from_wire(wire: crate::wire::Payload) -> Self {
Self { value: ::fidl_next::FromWire::from_wire(wire.value) }
}
}
impl ::fidl_next::FromWireRef<crate::wire::Payload> for Payload {
#[inline]
fn from_wire_ref(wire: &crate::wire::Payload) -> Self {
Self { value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value) }
}
}
#[derive(PartialEq, Clone, Debug)]
#[repr(C)]
pub struct OneWaySendRequest {
pub payload: crate::natural::Payload,
}
unsafe impl<___E> ::fidl_next::Encode<crate::wire::OneWaySendRequest, ___E> for OneWaySendRequest
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
{
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
Self,
crate::wire::OneWaySendRequest,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <crate::natural::Payload as ::fidl_next::Encode<
crate::wire::Payload,
___E,
>>::COPY_OPTIMIZATION
.is_enabled(),
)
};
#[inline]
fn encode(
self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<crate::wire::OneWaySendRequest>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let crate::wire::OneWaySendRequest {
payload,
} = out_;
}
::fidl_next::Encode::encode(self.payload, encoder_, payload, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(payload.as_mut_ptr()) };
Ok(())
}
}
unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::OneWaySendRequest, ___E>
for &'a OneWaySendRequest
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
{
#[inline]
fn encode(
self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<crate::wire::OneWaySendRequest>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let crate::wire::OneWaySendRequest {
payload,
} = out_;
}
::fidl_next::Encode::encode(&self.payload, encoder_, payload, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(payload.as_mut_ptr()) };
Ok(())
}
}
unsafe impl<___E>
::fidl_next::EncodeOption<
::fidl_next::WireBox<'static, crate::wire::OneWaySendRequest>,
___E,
> for OneWaySendRequest
where
___E: ::fidl_next::Encoder + ?Sized,
OneWaySendRequest: ::fidl_next::Encode<crate::wire::OneWaySendRequest, ___E>,
{
#[inline]
fn encode_option(
this: ::core::option::Option<Self>,
encoder: &mut ___E,
out: &mut ::core::mem::MaybeUninit<
::fidl_next::WireBox<'static, crate::wire::OneWaySendRequest>,
>,
_: (),
) -> ::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<'a, ___E>
::fidl_next::EncodeOption<
::fidl_next::WireBox<'static, crate::wire::OneWaySendRequest>,
___E,
> for &'a OneWaySendRequest
where
___E: ::fidl_next::Encoder + ?Sized,
&'a OneWaySendRequest: ::fidl_next::Encode<crate::wire::OneWaySendRequest, ___E>,
{
#[inline]
fn encode_option(
this: ::core::option::Option<Self>,
encoder: &mut ___E,
out: &mut ::core::mem::MaybeUninit<
::fidl_next::WireBox<'static, crate::wire::OneWaySendRequest>,
>,
_: (),
) -> ::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::OneWaySendRequest> for OneWaySendRequest {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
crate::wire::OneWaySendRequest,
Self,
> =
unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <crate::natural::Payload as ::fidl_next::FromWire<
crate::wire::Payload,
>>::COPY_OPTIMIZATION
.is_enabled(),
)
};
#[inline]
fn from_wire(wire: crate::wire::OneWaySendRequest) -> Self {
Self { payload: ::fidl_next::FromWire::from_wire(wire.payload) }
}
}
impl ::fidl_next::FromWireRef<crate::wire::OneWaySendRequest> for OneWaySendRequest {
#[inline]
fn from_wire_ref(wire: &crate::wire::OneWaySendRequest) -> Self {
Self { payload: ::fidl_next::FromWireRef::from_wire_ref(&wire.payload) }
}
}
}
pub mod wire {
/// The wire type corresponding to [`Payload`].
#[derive(Clone, Debug)]
#[repr(C)]
pub struct Payload {
pub value: ::fidl_next::WireU32,
}
static_assertions::const_assert_eq!(std::mem::size_of::<Payload>(), 4);
static_assertions::const_assert_eq!(std::mem::align_of::<Payload>(), 4);
static_assertions::const_assert_eq!(std::mem::offset_of!(Payload, value), 0);
unsafe impl ::fidl_next::Wire for Payload {
type Owned<'de> = Payload;
#[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 Payload
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 Payload {
type Natural = crate::natural::Payload;
}
impl ::fidl_next::Unconstrained for Payload {}
/// The wire type corresponding to [`OneWaySendRequest`].
#[derive(Clone, Debug)]
#[repr(C)]
pub struct OneWaySendRequest {
pub payload: crate::wire::Payload,
}
static_assertions::const_assert_eq!(std::mem::size_of::<OneWaySendRequest>(), 4);
static_assertions::const_assert_eq!(std::mem::align_of::<OneWaySendRequest>(), 4);
static_assertions::const_assert_eq!(std::mem::offset_of!(OneWaySendRequest, payload), 0);
unsafe impl ::fidl_next::Wire for OneWaySendRequest {
type Owned<'de> = OneWaySendRequest;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
payload,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(payload);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for OneWaySendRequest
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 payload,
} = slot_;
}
let _field = payload.as_mut();
::fidl_next::Decode::decode(payload.as_mut(), decoder_, ())?;
Ok(())
}
}
impl ::fidl_next::IntoNatural for OneWaySendRequest {
type Natural = crate::natural::OneWaySendRequest;
}
impl ::fidl_next::Unconstrained for OneWaySendRequest {}
}
pub mod wire_optional {}
pub mod generic {
pub struct Payload<T0> {
pub value: T0,
}
unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::Payload, ___E> for Payload<T0>
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
T0: ::fidl_next::Encode<::fidl_next::WireU32, ___E>,
{
#[inline]
fn encode(
self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<crate::wire::Payload>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let crate::wire::Payload {
value,
} = out_;
}
::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
Ok(())
}
}
pub struct OneWaySendRequest<T0> {
pub payload: T0,
}
unsafe impl<___E, T0> ::fidl_next::Encode<crate::wire::OneWaySendRequest, ___E>
for OneWaySendRequest<T0>
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
T0: ::fidl_next::Encode<crate::wire::Payload, ___E>,
{
#[inline]
fn encode(
self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<crate::wire::OneWaySendRequest>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let crate::wire::OneWaySendRequest {
payload,
} = out_;
}
::fidl_next::Encode::encode(self.payload, encoder_, payload, ())?;
Ok(())
}
}
}
pub use self::natural::*;
/// The type corresponding to the OneWay protocol.
#[derive(PartialEq, Debug)]
pub struct OneWay;
#[cfg(feature = "driver")]
impl ::fidl_next::HasTransport for OneWay {
type Transport = ::fdf_fidl::DriverChannel;
}
pub mod one_way {
pub mod prelude {
pub use crate::{OneWay, OneWayClientHandler, OneWayServerHandler, one_way};
pub use crate::natural::OneWaySendRequest;
}
pub struct Send;
impl ::fidl_next::Method for Send {
const ORDINAL: u64 = 7942965975761529343;
const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
::fidl_next::protocol::Flexibility::Strict;
type Protocol = crate::OneWay;
type Request = crate::wire::OneWaySendRequest;
}
mod ___detail {
unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::OneWay
where
___T: ::fidl_next::Transport,
{
type Client = OneWayClient<___T>;
type Server = OneWayServer<___T>;
}
/// The client for the `OneWay` protocol.
#[repr(transparent)]
pub struct OneWayClient<___T: ::fidl_next::Transport> {
#[allow(dead_code)]
client: ::fidl_next::protocol::Client<___T>,
}
impl<___T> OneWayClient<___T>
where
___T: ::fidl_next::Transport,
{
pub fn send(
&self,
payload: impl ::fidl_next::Encode<
crate::wire::Payload,
<___T as ::fidl_next::Transport>::SendBuffer,
>,
) -> ::fidl_next::SendFuture<'_, ___T>
where
<___T as ::fidl_next::Transport>::SendBuffer:
::fidl_next::encoder::InternalHandleEncoder,
{
self.send_with(crate::generic::OneWaySendRequest { payload })
}
pub fn send_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
where
___R: ::fidl_next::Encode<
crate::wire::OneWaySendRequest,
<___T as ::fidl_next::Transport>::SendBuffer,
>,
{
::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7942965975761529343,
<super::Send as ::fidl_next::Method>::FLEXIBILITY,
request,
))
}
}
/// The server for the `OneWay` protocol.
#[repr(transparent)]
pub struct OneWayServer<___T: ::fidl_next::Transport> {
server: ::fidl_next::protocol::Server<___T>,
}
impl<___T> OneWayServer<___T> where ___T: ::fidl_next::Transport {}
}
}
/// A client handler for the OneWay protocol.
///
/// See [`OneWay`] for more details.
pub trait OneWayClientHandler<
#[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
#[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
>
{
}
impl<___T> OneWayClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport
{}
impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for OneWay
where
___H: OneWayClientHandler<___T> + ::core::marker::Send,
___T: ::fidl_next::Transport,
{
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 OneWay protocol.
///
/// See [`OneWay`] for more details.
pub trait OneWayServerHandler<
#[cfg(feature = "driver")] ___T: ::fidl_next::Transport = ::fdf_fidl::DriverChannel,
#[cfg(not(feature = "driver"))] ___T: ::fidl_next::Transport,
>
{
fn send(
&mut self,
request: ::fidl_next::Request<one_way::Send, ___T>,
) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
}
impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for OneWay
where
___H: OneWayServerHandler<___T> + ::core::marker::Send,
___T: ::fidl_next::Transport,
<one_way::Send 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 {
7942965975761529343 => match ::fidl_next::DecoderExt::decode(buffer) {
Ok(decoded) => {
handler.send(::fidl_next::Request::from_decoded(decoded)).await;
Ok(())
}
Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
ordinal: 7942965975761529343,
error,
}),
},
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 {
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::Payload> for ::fidl_test_driveroneway::Payload {
#[inline]
fn compat_from(value: crate::Payload) -> Self {
Self { value: ::fidl_next::CompatFrom::compat_from(value.value) }
}
}
impl ::fidl_next::CompatFrom<::fidl_test_driveroneway::Payload> for crate::Payload {
#[inline]
fn compat_from(value: ::fidl_test_driveroneway::Payload) -> Self {
Self { value: ::fidl_next::CompatFrom::compat_from(value.value) }
}
}
#[cfg(feature = "driver")]
impl ::fidl_next::CompatFrom<crate::OneWaySendRequest>
for ::fidl_test_driveroneway::OneWaySendRequest
{
#[inline]
fn compat_from(value: crate::OneWaySendRequest) -> Self {
Self { payload: ::fidl_next::CompatFrom::compat_from(value.payload) }
}
}
#[cfg(feature = "driver")]
impl ::fidl_next::CompatFrom<::fidl_test_driveroneway::OneWaySendRequest>
for crate::OneWaySendRequest
{
#[inline]
fn compat_from(value: ::fidl_test_driveroneway::OneWaySendRequest) -> Self {
Self { payload: ::fidl_next::CompatFrom::compat_from(value.payload) }
}
}
#[cfg(target_os = "fuchsia")]
/// An alias for a client over `zx::Channel` for the `OneWay`
/// protocol.
pub type OneWayProxy = ::fidl_next::Client<crate::OneWay>;
#[cfg(feature = "driver")]
impl ::fidl_next::CompatFrom<crate::OneWay> for ::fidl_test_driveroneway::OneWayMarker {
fn compat_from(_: crate::OneWay) -> Self {
Self
}
}
#[cfg(feature = "driver")]
impl ::fidl_next::CompatFrom<::fidl_test_driveroneway::OneWayMarker> for crate::OneWay {
fn compat_from(_: ::fidl_test_driveroneway::OneWayMarker) -> Self {
Self
}
}
}