blob: 2bf5b9a831bbc0f1f703d4a7086b7fc78b425788 [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 Int32Wrapper {
pub val: i32,
}
impl ::fidl_next::Encodable for Int32Wrapper {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<Self, crate::wire::Int32Wrapper> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <i32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(),
)
};
type Encoded = crate::wire::Int32Wrapper;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for Int32Wrapper
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 {
val,
} = out_;
}
::fidl_next::Encode::encode(self.val, encoder_, val, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Int32Wrapper
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 {
val,
} = out_;
}
::fidl_next::EncodeRef::encode_ref(&self.val, encoder_, val, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
Ok(())
}
}
impl ::fidl_next::EncodableOption for Int32Wrapper {
type EncodedOption = ::fidl_next::WireBox<'static, crate::wire::Int32Wrapper>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Int32Wrapper
where
___E: ::fidl_next::Encoder + ?Sized,
Int32Wrapper: ::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 Int32Wrapper
where
___E: ::fidl_next::Encoder + ?Sized,
Int32Wrapper: ::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::Int32Wrapper> for Int32Wrapper {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<crate::wire::Int32Wrapper, Self> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <i32 as ::fidl_next::FromWire<::fidl_next::WireI32>>::COPY_OPTIMIZATION
.is_enabled(),
)
};
#[inline]
fn from_wire(wire: crate::wire::Int32Wrapper) -> Self {
Self { val: ::fidl_next::FromWire::from_wire(wire.val) }
}
}
impl ::fidl_next::FromWireRef<crate::wire::Int32Wrapper> for Int32Wrapper {
#[inline]
fn from_wire_ref(wire: &crate::wire::Int32Wrapper) -> Self {
Self { val: ::fidl_next::FromWireRef::from_wire_ref(&wire.val) }
}
}
#[derive(PartialEq, Clone, Debug)]
#[repr(C)]
pub struct SimpleProtocolAddRequest {
pub a: i32,
pub b: i32,
}
impl ::fidl_next::Encodable for SimpleProtocolAddRequest {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
Self,
crate::wire::SimpleProtocolAddRequest,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <i32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled()
&& <i32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(),
)
};
type Encoded = crate::wire::SimpleProtocolAddRequest;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for SimpleProtocolAddRequest
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 {
a,
b,
} = out_;
}
::fidl_next::Encode::encode(self.a, encoder_, a, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(a.as_mut_ptr()) };
::fidl_next::Encode::encode(self.b, encoder_, b, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(b.as_mut_ptr()) };
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for SimpleProtocolAddRequest
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 {
a,
b,
} = out_;
}
::fidl_next::EncodeRef::encode_ref(&self.a, encoder_, a, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(a.as_mut_ptr()) };
::fidl_next::EncodeRef::encode_ref(&self.b, encoder_, b, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(b.as_mut_ptr()) };
Ok(())
}
}
impl ::fidl_next::EncodableOption for SimpleProtocolAddRequest {
type EncodedOption = ::fidl_next::WireBox<'static, crate::wire::SimpleProtocolAddRequest>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for SimpleProtocolAddRequest
where
___E: ::fidl_next::Encoder + ?Sized,
SimpleProtocolAddRequest: ::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 SimpleProtocolAddRequest
where
___E: ::fidl_next::Encoder + ?Sized,
SimpleProtocolAddRequest: ::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::SimpleProtocolAddRequest> for SimpleProtocolAddRequest {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
crate::wire::SimpleProtocolAddRequest,
Self,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <i32 as ::fidl_next::FromWire<::fidl_next::WireI32>>::COPY_OPTIMIZATION
.is_enabled()
&& <i32 as ::fidl_next::FromWire<::fidl_next::WireI32>>::COPY_OPTIMIZATION
.is_enabled(),
)
};
#[inline]
fn from_wire(wire: crate::wire::SimpleProtocolAddRequest) -> Self {
Self {
a: ::fidl_next::FromWire::from_wire(wire.a),
b: ::fidl_next::FromWire::from_wire(wire.b),
}
}
}
impl ::fidl_next::FromWireRef<crate::wire::SimpleProtocolAddRequest> for SimpleProtocolAddRequest {
#[inline]
fn from_wire_ref(wire: &crate::wire::SimpleProtocolAddRequest) -> Self {
Self {
a: ::fidl_next::FromWireRef::from_wire_ref(&wire.a),
b: ::fidl_next::FromWireRef::from_wire_ref(&wire.b),
}
}
}
#[derive(PartialEq, Clone, Debug)]
#[repr(C)]
pub struct SimpleProtocolAddResponse {
pub sum: i32,
}
impl ::fidl_next::Encodable for SimpleProtocolAddResponse {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
Self,
crate::wire::SimpleProtocolAddResponse,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <i32 as ::fidl_next::Encodable>::COPY_OPTIMIZATION.is_enabled(),
)
};
type Encoded = crate::wire::SimpleProtocolAddResponse;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for SimpleProtocolAddResponse
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 {
sum,
} = out_;
}
::fidl_next::Encode::encode(self.sum, encoder_, sum, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(sum.as_mut_ptr()) };
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for SimpleProtocolAddResponse
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 {
sum,
} = out_;
}
::fidl_next::EncodeRef::encode_ref(&self.sum, encoder_, sum, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(sum.as_mut_ptr()) };
Ok(())
}
}
impl ::fidl_next::EncodableOption for SimpleProtocolAddResponse {
type EncodedOption = ::fidl_next::WireBox<'static, crate::wire::SimpleProtocolAddResponse>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for SimpleProtocolAddResponse
where
___E: ::fidl_next::Encoder + ?Sized,
SimpleProtocolAddResponse: ::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 SimpleProtocolAddResponse
where
___E: ::fidl_next::Encoder + ?Sized,
SimpleProtocolAddResponse: ::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::SimpleProtocolAddResponse> for SimpleProtocolAddResponse {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
crate::wire::SimpleProtocolAddResponse,
Self,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <i32 as ::fidl_next::FromWire<::fidl_next::WireI32>>::COPY_OPTIMIZATION
.is_enabled(),
)
};
#[inline]
fn from_wire(wire: crate::wire::SimpleProtocolAddResponse) -> Self {
Self { sum: ::fidl_next::FromWire::from_wire(wire.sum) }
}
}
impl ::fidl_next::FromWireRef<crate::wire::SimpleProtocolAddResponse>
for SimpleProtocolAddResponse
{
#[inline]
fn from_wire_ref(wire: &crate::wire::SimpleProtocolAddResponse) -> Self {
Self { sum: ::fidl_next::FromWireRef::from_wire_ref(&wire.sum) }
}
}
#[derive(PartialEq, Clone, Debug)]
pub enum SimpleUnion {
A(i32),
B(f32),
}
impl ::fidl_next::Encodable for SimpleUnion {
type Encoded = crate::wire::SimpleUnion;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for SimpleUnion
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 crate::wire::SimpleUnion { raw, _phantom: _ } = out);
match self {
Self::A(value) => ::fidl_next::RawWireUnion::encode_as_static::<___E, i32>(
value,
1,
encoder,
raw,
(),
)?,
Self::B(value) => ::fidl_next::RawWireUnion::encode_as_static::<___E, f32>(
value,
2,
encoder,
raw,
(),
)?,
}
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for SimpleUnion
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 crate::wire::SimpleUnion { raw, _phantom: _ } = out);
match self {
Self::A(value) => ::fidl_next::RawWireUnion::encode_as_static::<___E, &i32>(
value,
1,
encoder,
raw,
(),
)?,
Self::B(value) => ::fidl_next::RawWireUnion::encode_as_static::<___E, &f32>(
value,
2,
encoder,
raw,
(),
)?,
}
Ok(())
}
}
impl ::fidl_next::EncodableOption for SimpleUnion {
type EncodedOption = crate::wire_optional::SimpleUnion;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for SimpleUnion
where
___E: ?Sized,
SimpleUnion: ::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> {
::fidl_next::munge!(let crate::wire_optional::SimpleUnion { raw, _phantom: _ } = &mut *out);
if let Some(inner) = this {
let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
} else {
::fidl_next::RawWireUnion::encode_absent(raw);
}
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for SimpleUnion
where
___E: ?Sized,
SimpleUnion: ::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> {
::fidl_next::munge!(let crate::wire_optional::SimpleUnion { raw, _phantom: _ } = &mut *out);
if let Some(inner) = this {
let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out, ())?;
} else {
::fidl_next::RawWireUnion::encode_absent(raw);
}
Ok(())
}
}
impl ::fidl_next::FromWire<crate::wire::SimpleUnion> for SimpleUnion {
#[inline]
fn from_wire(wire: crate::wire::SimpleUnion) -> Self {
let wire = ::core::mem::ManuallyDrop::new(wire);
match wire.raw.ordinal() {
1 => Self::A(::fidl_next::FromWire::from_wire(unsafe {
wire.raw.get().read_unchecked::<::fidl_next::WireI32>()
})),
2 => Self::B(::fidl_next::FromWire::from_wire(unsafe {
wire.raw.get().read_unchecked::<::fidl_next::WireF32>()
})),
_ => unsafe { ::core::hint::unreachable_unchecked() },
}
}
}
impl ::fidl_next::FromWireRef<crate::wire::SimpleUnion> for SimpleUnion {
#[inline]
fn from_wire_ref(wire: &crate::wire::SimpleUnion) -> Self {
match wire.raw.ordinal() {
1 => Self::A(::fidl_next::FromWireRef::from_wire_ref(unsafe {
wire.raw.get().deref_unchecked::<::fidl_next::WireI32>()
})),
2 => Self::B(::fidl_next::FromWireRef::from_wire_ref(unsafe {
wire.raw.get().deref_unchecked::<::fidl_next::WireF32>()
})),
_ => unsafe { ::core::hint::unreachable_unchecked() },
}
}
}
impl ::fidl_next::FromWireOption<crate::wire_optional::SimpleUnion> for SimpleUnion {
#[inline]
fn from_wire_option(
wire: crate::wire_optional::SimpleUnion,
) -> ::core::option::Option<Self> {
if let Some(inner) = wire.into_option() {
Some(::fidl_next::FromWire::from_wire(inner))
} else {
None
}
}
}
impl ::fidl_next::FromWireOption<crate::wire_optional::SimpleUnion> for Box<SimpleUnion> {
#[inline]
fn from_wire_option(
wire: crate::wire_optional::SimpleUnion,
) -> ::core::option::Option<Self> {
<
SimpleUnion as ::fidl_next::FromWireOption<crate::wire_optional::SimpleUnion>
>::from_wire_option(wire).map(Box::new)
}
}
impl ::fidl_next::FromWireOptionRef<crate::wire_optional::SimpleUnion> for Box<SimpleUnion> {
#[inline]
fn from_wire_option_ref(
wire: &crate::wire_optional::SimpleUnion,
) -> ::core::option::Option<Self> {
if let Some(inner) = wire.as_ref() {
Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
} else {
None
}
}
}
#[derive(PartialEq, Debug)]
#[repr(C)]
pub struct StructWithNullableHandle {
pub val: ::core::option::Option<::fidl_next::fuchsia::zx::Vmo>,
}
impl ::fidl_next::Encodable for StructWithNullableHandle {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
Self,
crate::wire::StructWithNullableHandle,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true
&& <
::core::option::Option<::fidl_next::fuchsia::zx::Vmo> as ::fidl_next::Encodable
>::COPY_OPTIMIZATION.is_enabled()
)
};
type Encoded = crate::wire::StructWithNullableHandle;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for StructWithNullableHandle
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
___E: ::fidl_next::fuchsia::HandleEncoder,
{
#[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 {
val,
} = out_;
}
::fidl_next::Encode::encode(self.val, encoder_, val, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
Ok(())
}
}
impl ::fidl_next::EncodableOption for StructWithNullableHandle {
type EncodedOption = ::fidl_next::WireBox<'static, crate::wire::StructWithNullableHandle>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StructWithNullableHandle
where
___E: ::fidl_next::Encoder + ?Sized,
StructWithNullableHandle: ::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(())
}
}
impl ::fidl_next::FromWire<crate::wire::StructWithNullableHandle> for StructWithNullableHandle {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
crate::wire::StructWithNullableHandle,
Self,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true
&& <
::core::option::Option<::fidl_next::fuchsia::zx::Vmo> as ::fidl_next::FromWire<::fidl_next::fuchsia::WireOptionalVmo>
>::COPY_OPTIMIZATION.is_enabled()
)
};
#[inline]
fn from_wire(wire: crate::wire::StructWithNullableHandle) -> Self {
Self { val: ::fidl_next::FromWire::from_wire(wire.val) }
}
}
#[derive(PartialEq, Debug)]
#[repr(C)]
pub struct StructWithNullableProtocol {
pub val: ::core::option::Option<
::fidl_next::ClientEnd<crate::SimpleProtocol, ::fidl_next::fuchsia::zx::Channel>,
>,
}
impl ::fidl_next::Encodable for StructWithNullableProtocol {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
Self,
crate::wire::StructWithNullableProtocol,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <::core::option::Option<
::fidl_next::ClientEnd<
crate::SimpleProtocol,
::fidl_next::fuchsia::zx::Channel,
>,
> as ::fidl_next::Encodable>::COPY_OPTIMIZATION
.is_enabled(),
)
};
type Encoded = crate::wire::StructWithNullableProtocol;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for StructWithNullableProtocol
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
___E: ::fidl_next::fuchsia::HandleEncoder,
{
#[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 {
val,
} = out_;
}
::fidl_next::Encode::encode(self.val, encoder_, val, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
Ok(())
}
}
impl ::fidl_next::EncodableOption for StructWithNullableProtocol {
type EncodedOption = ::fidl_next::WireBox<'static, crate::wire::StructWithNullableProtocol>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StructWithNullableProtocol
where
___E: ::fidl_next::Encoder + ?Sized,
StructWithNullableProtocol: ::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(())
}
}
impl ::fidl_next::FromWire<crate::wire::StructWithNullableProtocol> for StructWithNullableProtocol {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
crate::wire::StructWithNullableProtocol,
Self,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <::core::option::Option<
::fidl_next::ClientEnd<
crate::SimpleProtocol,
::fidl_next::fuchsia::zx::Channel,
>,
> as ::fidl_next::FromWire<
::fidl_next::ClientEnd<
crate::SimpleProtocol,
::fidl_next::fuchsia::WireOptionalChannel,
>,
>>::COPY_OPTIMIZATION
.is_enabled(),
)
};
#[inline]
fn from_wire(wire: crate::wire::StructWithNullableProtocol) -> Self {
Self { val: ::fidl_next::FromWire::from_wire(wire.val) }
}
}
#[derive(PartialEq, Debug)]
#[repr(C)]
pub struct StructWithNullableRequest {
pub val: ::core::option::Option<
::fidl_next::ServerEnd<crate::SimpleProtocol, ::fidl_next::fuchsia::zx::Channel>,
>,
}
impl ::fidl_next::Encodable for StructWithNullableRequest {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
Self,
crate::wire::StructWithNullableRequest,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <::core::option::Option<
::fidl_next::ServerEnd<
crate::SimpleProtocol,
::fidl_next::fuchsia::zx::Channel,
>,
> as ::fidl_next::Encodable>::COPY_OPTIMIZATION
.is_enabled(),
)
};
type Encoded = crate::wire::StructWithNullableRequest;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for StructWithNullableRequest
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
___E: ::fidl_next::fuchsia::HandleEncoder,
{
#[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 {
val,
} = out_;
}
::fidl_next::Encode::encode(self.val, encoder_, val, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
Ok(())
}
}
impl ::fidl_next::EncodableOption for StructWithNullableRequest {
type EncodedOption = ::fidl_next::WireBox<'static, crate::wire::StructWithNullableRequest>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StructWithNullableRequest
where
___E: ::fidl_next::Encoder + ?Sized,
StructWithNullableRequest: ::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(())
}
}
impl ::fidl_next::FromWire<crate::wire::StructWithNullableRequest> for StructWithNullableRequest {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
crate::wire::StructWithNullableRequest,
Self,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true && <::core::option::Option<
::fidl_next::ServerEnd<
crate::SimpleProtocol,
::fidl_next::fuchsia::zx::Channel,
>,
> as ::fidl_next::FromWire<
::fidl_next::ServerEnd<
crate::SimpleProtocol,
::fidl_next::fuchsia::WireOptionalChannel,
>,
>>::COPY_OPTIMIZATION
.is_enabled(),
)
};
#[inline]
fn from_wire(wire: crate::wire::StructWithNullableRequest) -> Self {
Self { val: ::fidl_next::FromWire::from_wire(wire.val) }
}
}
#[derive(PartialEq, Clone, Debug)]
pub struct StructWithNullableString {
pub val: ::core::option::Option<::std::string::String>,
}
impl ::fidl_next::Encodable for StructWithNullableString {
type Encoded = crate::wire::StructWithNullableString<'static>;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for StructWithNullableString
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 {
val,
} = out_;
}
::fidl_next::Encode::encode(self.val, encoder_, val, 4294967295)?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
::fidl_next::Constrained::validate(_field, 4294967295)?;
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StructWithNullableString
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 {
val,
} = out_;
}
::fidl_next::EncodeRef::encode_ref(&self.val, encoder_, val, 4294967295)?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
::fidl_next::Constrained::validate(_field, 4294967295)?;
Ok(())
}
}
impl ::fidl_next::EncodableOption for StructWithNullableString {
type EncodedOption =
::fidl_next::WireBox<'static, crate::wire::StructWithNullableString<'static>>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StructWithNullableString
where
___E: ::fidl_next::Encoder + ?Sized,
StructWithNullableString: ::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 StructWithNullableString
where
___E: ::fidl_next::Encoder + ?Sized,
StructWithNullableString: ::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::StructWithNullableString<'de>>
for StructWithNullableString
{
#[inline]
fn from_wire(wire: crate::wire::StructWithNullableString<'de>) -> Self {
Self { val: ::fidl_next::FromWire::from_wire(wire.val) }
}
}
impl<'de> ::fidl_next::FromWireRef<crate::wire::StructWithNullableString<'de>>
for StructWithNullableString
{
#[inline]
fn from_wire_ref(wire: &crate::wire::StructWithNullableString<'de>) -> Self {
Self { val: ::fidl_next::FromWireRef::from_wire_ref(&wire.val) }
}
}
#[derive(PartialEq, Clone, Debug)]
pub struct StructWithNullableStruct {
pub val: ::core::option::Option<::std::boxed::Box<crate::natural::Int32Wrapper>>,
}
impl ::fidl_next::Encodable for StructWithNullableStruct {
type Encoded = crate::wire::StructWithNullableStruct<'static>;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for StructWithNullableStruct
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 {
val,
} = out_;
}
::fidl_next::Encode::encode(self.val, encoder_, val, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StructWithNullableStruct
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 {
val,
} = out_;
}
::fidl_next::EncodeRef::encode_ref(&self.val, encoder_, val, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
Ok(())
}
}
impl ::fidl_next::EncodableOption for StructWithNullableStruct {
type EncodedOption =
::fidl_next::WireBox<'static, crate::wire::StructWithNullableStruct<'static>>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StructWithNullableStruct
where
___E: ::fidl_next::Encoder + ?Sized,
StructWithNullableStruct: ::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 StructWithNullableStruct
where
___E: ::fidl_next::Encoder + ?Sized,
StructWithNullableStruct: ::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::StructWithNullableStruct<'de>>
for StructWithNullableStruct
{
#[inline]
fn from_wire(wire: crate::wire::StructWithNullableStruct<'de>) -> Self {
Self { val: ::fidl_next::FromWire::from_wire(wire.val) }
}
}
impl<'de> ::fidl_next::FromWireRef<crate::wire::StructWithNullableStruct<'de>>
for StructWithNullableStruct
{
#[inline]
fn from_wire_ref(wire: &crate::wire::StructWithNullableStruct<'de>) -> Self {
Self { val: ::fidl_next::FromWireRef::from_wire_ref(&wire.val) }
}
}
#[derive(PartialEq, Clone, Debug)]
#[repr(C)]
pub struct StructWithNullableUnion {
pub val: ::core::option::Option<::std::boxed::Box<crate::natural::SimpleUnion>>,
}
impl ::fidl_next::Encodable for StructWithNullableUnion {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
Self,
crate::wire::StructWithNullableUnion,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true
&& <
::core::option::Option<::std::boxed::Box<crate::natural::SimpleUnion>> as ::fidl_next::Encodable
>::COPY_OPTIMIZATION.is_enabled()
)
};
type Encoded = crate::wire::StructWithNullableUnion;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for StructWithNullableUnion
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 {
val,
} = out_;
}
::fidl_next::Encode::encode(self.val, encoder_, val, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StructWithNullableUnion
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 {
val,
} = out_;
}
::fidl_next::EncodeRef::encode_ref(&self.val, encoder_, val, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
Ok(())
}
}
impl ::fidl_next::EncodableOption for StructWithNullableUnion {
type EncodedOption = ::fidl_next::WireBox<'static, crate::wire::StructWithNullableUnion>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StructWithNullableUnion
where
___E: ::fidl_next::Encoder + ?Sized,
StructWithNullableUnion: ::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 StructWithNullableUnion
where
___E: ::fidl_next::Encoder + ?Sized,
StructWithNullableUnion: ::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::StructWithNullableUnion> for StructWithNullableUnion {
const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
crate::wire::StructWithNullableUnion,
Self,
> = unsafe {
::fidl_next::CopyOptimization::enable_if(
true
&& <
::core::option::Option<::std::boxed::Box<crate::natural::SimpleUnion>> as ::fidl_next::FromWire<crate::wire_optional::SimpleUnion>
>::COPY_OPTIMIZATION.is_enabled()
)
};
#[inline]
fn from_wire(wire: crate::wire::StructWithNullableUnion) -> Self {
Self { val: ::fidl_next::FromWire::from_wire(wire.val) }
}
}
impl ::fidl_next::FromWireRef<crate::wire::StructWithNullableUnion> for StructWithNullableUnion {
#[inline]
fn from_wire_ref(wire: &crate::wire::StructWithNullableUnion) -> Self {
Self { val: ::fidl_next::FromWireRef::from_wire_ref(&wire.val) }
}
}
#[derive(PartialEq, Clone, Debug)]
pub struct StructWithNullableVector {
pub val: ::core::option::Option<::std::vec::Vec<i32>>,
}
impl ::fidl_next::Encodable for StructWithNullableVector {
type Encoded = crate::wire::StructWithNullableVector<'static>;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for StructWithNullableVector
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 {
val,
} = out_;
}
::fidl_next::Encode::encode(self.val, encoder_, val, (4294967295, ()))?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StructWithNullableVector
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 {
val,
} = out_;
}
::fidl_next::EncodeRef::encode_ref(&self.val, encoder_, val, (4294967295, ()))?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(val.as_mut_ptr()) };
::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
Ok(())
}
}
impl ::fidl_next::EncodableOption for StructWithNullableVector {
type EncodedOption =
::fidl_next::WireBox<'static, crate::wire::StructWithNullableVector<'static>>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StructWithNullableVector
where
___E: ::fidl_next::Encoder + ?Sized,
StructWithNullableVector: ::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 StructWithNullableVector
where
___E: ::fidl_next::Encoder + ?Sized,
StructWithNullableVector: ::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::StructWithNullableVector<'de>>
for StructWithNullableVector
{
#[inline]
fn from_wire(wire: crate::wire::StructWithNullableVector<'de>) -> Self {
Self { val: ::fidl_next::FromWire::from_wire(wire.val) }
}
}
impl<'de> ::fidl_next::FromWireRef<crate::wire::StructWithNullableVector<'de>>
for StructWithNullableVector
{
#[inline]
fn from_wire_ref(wire: &crate::wire::StructWithNullableVector<'de>) -> Self {
Self { val: ::fidl_next::FromWireRef::from_wire_ref(&wire.val) }
}
}
}
pub mod wire {
/// The wire type corresponding to [`Int32Wrapper`].
#[derive(Clone, Debug)]
#[repr(C)]
pub struct Int32Wrapper {
pub val: ::fidl_next::WireI32,
}
static_assertions::const_assert_eq!(std::mem::size_of::<Int32Wrapper>(), 4);
static_assertions::const_assert_eq!(std::mem::align_of::<Int32Wrapper>(), 4);
static_assertions::const_assert_eq!(std::mem::offset_of!(Int32Wrapper, val), 0);
unsafe impl ::fidl_next::Wire for Int32Wrapper {
type Decoded<'de> = Int32Wrapper;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
val,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(val);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for Int32Wrapper
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 val,
} = slot_;
}
let _field = val.as_mut();
::fidl_next::Decode::decode(val.as_mut(), decoder_, ())?;
Ok(())
}
}
impl ::fidl_next::IntoNatural for Int32Wrapper {
type Natural = crate::natural::Int32Wrapper;
}
impl ::fidl_next::Unconstrained for Int32Wrapper {}
/// The wire type corresponding to [`SimpleProtocolAddRequest`].
#[derive(Clone, Debug)]
#[repr(C)]
pub struct SimpleProtocolAddRequest {
pub a: ::fidl_next::WireI32,
pub b: ::fidl_next::WireI32,
}
static_assertions::const_assert_eq!(std::mem::size_of::<SimpleProtocolAddRequest>(), 8);
static_assertions::const_assert_eq!(std::mem::align_of::<SimpleProtocolAddRequest>(), 4);
static_assertions::const_assert_eq!(std::mem::offset_of!(SimpleProtocolAddRequest, a), 0);
static_assertions::const_assert_eq!(std::mem::offset_of!(SimpleProtocolAddRequest, b), 4);
unsafe impl ::fidl_next::Wire for SimpleProtocolAddRequest {
type Decoded<'de> = SimpleProtocolAddRequest;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
a,
b,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(a);
::fidl_next::Wire::zero_padding(b);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for SimpleProtocolAddRequest
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 a,
mut b,
} = slot_;
}
let _field = a.as_mut();
::fidl_next::Decode::decode(a.as_mut(), decoder_, ())?;
let _field = b.as_mut();
::fidl_next::Decode::decode(b.as_mut(), decoder_, ())?;
Ok(())
}
}
impl ::fidl_next::IntoNatural for SimpleProtocolAddRequest {
type Natural = crate::natural::SimpleProtocolAddRequest;
}
impl ::fidl_next::Unconstrained for SimpleProtocolAddRequest {}
/// The wire type corresponding to [`SimpleProtocolAddResponse`].
#[derive(Clone, Debug)]
#[repr(C)]
pub struct SimpleProtocolAddResponse {
pub sum: ::fidl_next::WireI32,
}
static_assertions::const_assert_eq!(std::mem::size_of::<SimpleProtocolAddResponse>(), 4);
static_assertions::const_assert_eq!(std::mem::align_of::<SimpleProtocolAddResponse>(), 4);
static_assertions::const_assert_eq!(std::mem::offset_of!(SimpleProtocolAddResponse, sum), 0);
unsafe impl ::fidl_next::Wire for SimpleProtocolAddResponse {
type Decoded<'de> = SimpleProtocolAddResponse;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
sum,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(sum);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for SimpleProtocolAddResponse
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 sum,
} = slot_;
}
let _field = sum.as_mut();
::fidl_next::Decode::decode(sum.as_mut(), decoder_, ())?;
Ok(())
}
}
impl ::fidl_next::IntoNatural for SimpleProtocolAddResponse {
type Natural = crate::natural::SimpleProtocolAddResponse;
}
impl ::fidl_next::Unconstrained for SimpleProtocolAddResponse {}
/// The wire type corresponding to [`SimpleUnion`].
#[repr(transparent)]
pub struct SimpleUnion {
pub(crate) raw: ::fidl_next::RawWireUnion,
pub(crate) _phantom: ::core::marker::PhantomData<()>,
}
impl Drop for SimpleUnion {
fn drop(&mut self) {
match self.raw.ordinal() {
1 => {
let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireI32>() };
}
2 => {
let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::WireF32>() };
}
_ => unsafe { ::core::hint::unreachable_unchecked() },
}
}
}
unsafe impl ::fidl_next::Wire for SimpleUnion {
type Decoded<'de> = SimpleUnion;
#[inline]
fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
::fidl_next::RawWireUnion::zero_padding(raw);
}
}
pub mod simple_union {
pub enum Ref<'de> {
A(&'de ::fidl_next::WireI32),
B(&'de ::fidl_next::WireF32),
}
}
impl SimpleUnion {
pub fn as_ref(&self) -> crate::wire::simple_union::Ref<'_> {
match self.raw.ordinal() {
1 => crate::wire::simple_union::Ref::A(unsafe {
self.raw.get().deref_unchecked::<::fidl_next::WireI32>()
}),
2 => crate::wire::simple_union::Ref::B(unsafe {
self.raw.get().deref_unchecked::<::fidl_next::WireF32>()
}),
_ => unsafe { ::core::hint::unreachable_unchecked() },
}
}
}
impl Clone for SimpleUnion {
fn clone(&self) -> Self {
match self.raw.ordinal() {
1 => Self {
raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireI32>() },
_phantom: ::core::marker::PhantomData,
},
2 => Self {
raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireF32>() },
_phantom: ::core::marker::PhantomData,
},
_ => unsafe { ::core::hint::unreachable_unchecked() },
}
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for SimpleUnion
where
___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
{
fn decode(
mut slot: ::fidl_next::Slot<'_, Self>,
decoder: &mut ___D,
_: (),
) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
1 => ::fidl_next::RawWireUnion::decode_as_static::<___D, ::fidl_next::WireI32>(
raw,
decoder,
(),
)?,
2 => ::fidl_next::RawWireUnion::decode_as_static::<___D, ::fidl_next::WireF32>(
raw,
decoder,
(),
)?,
ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)),
}
Ok(())
}
}
impl ::core::fmt::Debug for SimpleUnion {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
match self.raw.ordinal() {
1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireI32>().fmt(f) },
2 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::WireF32>().fmt(f) },
_ => unsafe { ::core::hint::unreachable_unchecked() },
}
}
}
impl ::fidl_next::IntoNatural for SimpleUnion {
type Natural = crate::natural::SimpleUnion;
}
impl ::fidl_next::Unconstrained for SimpleUnion {}
/// The wire type corresponding to [`StructWithNullableHandle`].
#[derive(Debug)]
#[repr(C)]
pub struct StructWithNullableHandle {
pub val: ::fidl_next::fuchsia::WireOptionalVmo,
}
static_assertions::const_assert_eq!(std::mem::size_of::<StructWithNullableHandle>(), 4);
static_assertions::const_assert_eq!(std::mem::align_of::<StructWithNullableHandle>(), 4);
static_assertions::const_assert_eq!(std::mem::offset_of!(StructWithNullableHandle, val), 0);
unsafe impl ::fidl_next::Wire for StructWithNullableHandle {
type Decoded<'de> = StructWithNullableHandle;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
val,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(val);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for StructWithNullableHandle
where
___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
___D: ::fidl_next::fuchsia::HandleDecoder,
{
fn decode(
slot_: ::fidl_next::Slot<'_, Self>,
decoder_: &mut ___D,
_: (),
) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
::fidl_next::munge! {
let Self {
mut val,
} = slot_;
}
let _field = val.as_mut();
::fidl_next::Decode::decode(val.as_mut(), decoder_, ())?;
Ok(())
}
}
impl ::fidl_next::IntoNatural for StructWithNullableHandle {
type Natural = crate::natural::StructWithNullableHandle;
}
impl ::fidl_next::Unconstrained for StructWithNullableHandle {}
/// The wire type corresponding to [`StructWithNullableProtocol`].
#[derive(Debug)]
#[repr(C)]
pub struct StructWithNullableProtocol {
pub val: ::fidl_next::ClientEnd<
crate::SimpleProtocol,
::fidl_next::fuchsia::WireOptionalChannel,
>,
}
static_assertions::const_assert_eq!(std::mem::size_of::<StructWithNullableProtocol>(), 4);
static_assertions::const_assert_eq!(std::mem::align_of::<StructWithNullableProtocol>(), 4);
static_assertions::const_assert_eq!(std::mem::offset_of!(StructWithNullableProtocol, val), 0);
unsafe impl ::fidl_next::Wire for StructWithNullableProtocol {
type Decoded<'de> = StructWithNullableProtocol;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
val,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(val);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for StructWithNullableProtocol
where
___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
___D: ::fidl_next::fuchsia::HandleDecoder,
{
fn decode(
slot_: ::fidl_next::Slot<'_, Self>,
decoder_: &mut ___D,
_: (),
) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
::fidl_next::munge! {
let Self {
mut val,
} = slot_;
}
let _field = val.as_mut();
::fidl_next::Decode::decode(val.as_mut(), decoder_, ())?;
Ok(())
}
}
impl ::fidl_next::IntoNatural for StructWithNullableProtocol {
type Natural = crate::natural::StructWithNullableProtocol;
}
impl ::fidl_next::Unconstrained for StructWithNullableProtocol {}
/// The wire type corresponding to [`StructWithNullableRequest`].
#[derive(Debug)]
#[repr(C)]
pub struct StructWithNullableRequest {
pub val: ::fidl_next::ServerEnd<
crate::SimpleProtocol,
::fidl_next::fuchsia::WireOptionalChannel,
>,
}
static_assertions::const_assert_eq!(std::mem::size_of::<StructWithNullableRequest>(), 4);
static_assertions::const_assert_eq!(std::mem::align_of::<StructWithNullableRequest>(), 4);
static_assertions::const_assert_eq!(std::mem::offset_of!(StructWithNullableRequest, val), 0);
unsafe impl ::fidl_next::Wire for StructWithNullableRequest {
type Decoded<'de> = StructWithNullableRequest;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
val,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(val);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for StructWithNullableRequest
where
___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
___D: ::fidl_next::fuchsia::HandleDecoder,
{
fn decode(
slot_: ::fidl_next::Slot<'_, Self>,
decoder_: &mut ___D,
_: (),
) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
::fidl_next::munge! {
let Self {
mut val,
} = slot_;
}
let _field = val.as_mut();
::fidl_next::Decode::decode(val.as_mut(), decoder_, ())?;
Ok(())
}
}
impl ::fidl_next::IntoNatural for StructWithNullableRequest {
type Natural = crate::natural::StructWithNullableRequest;
}
impl ::fidl_next::Unconstrained for StructWithNullableRequest {}
/// The wire type corresponding to [`StructWithNullableString`].
#[derive(Debug)]
#[repr(C)]
pub struct StructWithNullableString<'de> {
pub val: ::fidl_next::WireOptionalString<'de>,
}
static_assertions::const_assert_eq!(std::mem::size_of::<StructWithNullableString<'_>>(), 16);
static_assertions::const_assert_eq!(std::mem::align_of::<StructWithNullableString<'_>>(), 8);
static_assertions::const_assert_eq!(std::mem::offset_of!(StructWithNullableString<'_>, val), 0);
unsafe impl ::fidl_next::Wire for StructWithNullableString<'static> {
type Decoded<'de> = StructWithNullableString<'de>;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
val,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(val);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for StructWithNullableString<'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 val,
} = slot_;
}
let _field = val.as_mut();
::fidl_next::Constrained::validate(_field, 4294967295)?;
::fidl_next::Decode::decode(val.as_mut(), decoder_, 4294967295)?;
Ok(())
}
}
impl<'de> ::fidl_next::IntoNatural for StructWithNullableString<'de> {
type Natural = crate::natural::StructWithNullableString;
}
impl ::fidl_next::Unconstrained for StructWithNullableString<'static> {}
/// The wire type corresponding to [`StructWithNullableStruct`].
#[derive(Debug)]
#[repr(C)]
pub struct StructWithNullableStruct<'de> {
pub val: ::fidl_next::WireBox<'de, crate::wire::Int32Wrapper>,
}
static_assertions::const_assert_eq!(std::mem::size_of::<StructWithNullableStruct<'_>>(), 8);
static_assertions::const_assert_eq!(std::mem::align_of::<StructWithNullableStruct<'_>>(), 8);
static_assertions::const_assert_eq!(std::mem::offset_of!(StructWithNullableStruct<'_>, val), 0);
unsafe impl ::fidl_next::Wire for StructWithNullableStruct<'static> {
type Decoded<'de> = StructWithNullableStruct<'de>;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
val,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(val);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for StructWithNullableStruct<'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 val,
} = slot_;
}
let _field = val.as_mut();
::fidl_next::Decode::decode(val.as_mut(), decoder_, ())?;
Ok(())
}
}
impl<'de> ::fidl_next::IntoNatural for StructWithNullableStruct<'de> {
type Natural = crate::natural::StructWithNullableStruct;
}
impl ::fidl_next::Unconstrained for StructWithNullableStruct<'static> {}
/// The wire type corresponding to [`StructWithNullableUnion`].
#[derive(Clone, Debug)]
#[repr(C)]
pub struct StructWithNullableUnion {
pub val: crate::wire_optional::SimpleUnion,
}
static_assertions::const_assert_eq!(std::mem::size_of::<StructWithNullableUnion>(), 16);
static_assertions::const_assert_eq!(std::mem::align_of::<StructWithNullableUnion>(), 8);
static_assertions::const_assert_eq!(std::mem::offset_of!(StructWithNullableUnion, val), 0);
unsafe impl ::fidl_next::Wire for StructWithNullableUnion {
type Decoded<'de> = StructWithNullableUnion;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
val,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(val);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for StructWithNullableUnion
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 val,
} = slot_;
}
let _field = val.as_mut();
::fidl_next::Decode::decode(val.as_mut(), decoder_, ())?;
Ok(())
}
}
impl ::fidl_next::IntoNatural for StructWithNullableUnion {
type Natural = crate::natural::StructWithNullableUnion;
}
impl ::fidl_next::Unconstrained for StructWithNullableUnion {}
/// The wire type corresponding to [`StructWithNullableVector`].
#[derive(Debug)]
#[repr(C)]
pub struct StructWithNullableVector<'de> {
pub val: ::fidl_next::WireOptionalVector<'de, ::fidl_next::WireI32>,
}
static_assertions::const_assert_eq!(std::mem::size_of::<StructWithNullableVector<'_>>(), 16);
static_assertions::const_assert_eq!(std::mem::align_of::<StructWithNullableVector<'_>>(), 8);
static_assertions::const_assert_eq!(std::mem::offset_of!(StructWithNullableVector<'_>, val), 0);
unsafe impl ::fidl_next::Wire for StructWithNullableVector<'static> {
type Decoded<'de> = StructWithNullableVector<'de>;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
val,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(val);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for StructWithNullableVector<'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 val,
} = slot_;
}
let _field = val.as_mut();
::fidl_next::Constrained::validate(_field, (4294967295, ()))?;
::fidl_next::Decode::decode(val.as_mut(), decoder_, (4294967295, ()))?;
Ok(())
}
}
impl<'de> ::fidl_next::IntoNatural for StructWithNullableVector<'de> {
type Natural = crate::natural::StructWithNullableVector;
}
impl ::fidl_next::Unconstrained for StructWithNullableVector<'static> {}
}
pub mod wire_optional {
#[repr(transparent)]
pub struct SimpleUnion {
pub(crate) raw: ::fidl_next::RawWireUnion,
pub(crate) _phantom: ::core::marker::PhantomData<()>,
}
unsafe impl ::fidl_next::Wire for SimpleUnion {
type Decoded<'de> = SimpleUnion;
#[inline]
fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
::fidl_next::RawWireUnion::zero_padding(raw);
}
}
impl SimpleUnion {
pub fn is_some(&self) -> bool {
self.raw.is_some()
}
pub fn is_none(&self) -> bool {
self.raw.is_none()
}
pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::SimpleUnion> {
if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
}
pub fn into_option(self) -> ::core::option::Option<crate::wire::SimpleUnion> {
if self.is_some() {
Some(crate::wire::SimpleUnion {
raw: self.raw,
_phantom: ::core::marker::PhantomData,
})
} else {
None
}
}
}
impl Clone for SimpleUnion {
fn clone(&self) -> Self {
if self.is_none() {
return SimpleUnion {
raw: ::fidl_next::RawWireUnion::absent(),
_phantom: ::core::marker::PhantomData,
};
}
match self.raw.ordinal() {
1 => Self {
raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireI32>() },
_phantom: ::core::marker::PhantomData,
},
2 => Self {
raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::WireF32>() },
_phantom: ::core::marker::PhantomData,
},
_ => unsafe { ::core::hint::unreachable_unchecked() },
}
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for SimpleUnion
where
___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
{
fn decode(
mut slot: ::fidl_next::Slot<'_, Self>,
decoder: &mut ___D,
_: (),
) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
1 => ::fidl_next::RawWireUnion::decode_as_static::<___D, ::fidl_next::WireI32>(
raw,
decoder,
(),
)?,
2 => ::fidl_next::RawWireUnion::decode_as_static::<___D, ::fidl_next::WireF32>(
raw,
decoder,
(),
)?,
0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
_ => ::fidl_next::RawWireUnion::decode_unknown_static(raw, decoder)?,
}
Ok(())
}
}
impl ::core::fmt::Debug for SimpleUnion {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
self.as_ref().fmt(f)
}
}
impl ::fidl_next::IntoNatural for SimpleUnion {
type Natural = ::core::option::Option<crate::natural::SimpleUnion>;
}
impl ::fidl_next::Unconstrained for SimpleUnion {}
}
pub use self::natural::*;
/// The type corresponding to the SimpleProtocol protocol.
#[derive(PartialEq, Debug)]
pub struct SimpleProtocol;
pub mod simple_protocol {
pub mod prelude {
pub use crate::{
SimpleProtocol, SimpleProtocolClientHandler, SimpleProtocolServerHandler,
simple_protocol,
};
pub use crate::natural::SimpleProtocolAddRequest;
pub use crate::natural::SimpleProtocolAddResponse;
}
pub struct Add;
impl ::fidl_next::Method for Add {
const ORDINAL: u64 = 9142761280038437494;
type Protocol = crate::SimpleProtocol;
type Request = crate::wire::SimpleProtocolAddRequest;
type Response = crate::wire::SimpleProtocolAddResponse;
}
mod ___detail {
pub struct Add<T0, T1> {
a: T0,
b: T1,
}
impl<T0, T1> ::fidl_next::Encodable for Add<T0, T1>
where
T0: ::fidl_next::Encodable<Encoded = ::fidl_next::WireI32>,
T1: ::fidl_next::Encodable<Encoded = ::fidl_next::WireI32>,
{
type Encoded = crate::wire::SimpleProtocolAddRequest;
}
unsafe impl<___E, T0, T1> ::fidl_next::Encode<___E> for Add<T0, T1>
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
T0: ::fidl_next::Encode<___E, Encoded = ::fidl_next::WireI32>,
T1: ::fidl_next::Encode<___E, Encoded = ::fidl_next::WireI32>,
{
#[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 {
a,
b,
} = out_;
}
::fidl_next::Encode::encode(self.a, encoder_, a, ())?;
::fidl_next::Encode::encode(self.b, encoder_, b, ())?;
Ok(())
}
}
unsafe impl<___T> ::fidl_next::Protocol<___T> for crate::SimpleProtocol
where
___T: ::fidl_next::Transport,
{
type Client = SimpleProtocolClient<___T>;
type Server = SimpleProtocolServer<___T>;
}
/// The client for the `SimpleProtocol` protocol.
#[repr(transparent)]
pub struct SimpleProtocolClient<___T: ::fidl_next::Transport> {
#[allow(dead_code)]
client: ::fidl_next::protocol::Client<___T>,
}
impl<___T> SimpleProtocolClient<___T>
where
___T: ::fidl_next::Transport,
{
pub fn add(
&self,
a: impl ::fidl_next::Encode<
<___T as ::fidl_next::Transport>::SendBuffer,
Encoded = ::fidl_next::WireI32,
>,
b: impl ::fidl_next::Encode<
<___T as ::fidl_next::Transport>::SendBuffer,
Encoded = ::fidl_next::WireI32,
>,
) -> ::fidl_next::TwoWayFuture<'_, super::Add, ___T>
where
<___T as ::fidl_next::Transport>::SendBuffer:
::fidl_next::encoder::InternalHandleEncoder,
{
self.add_with(Add { a, b })
}
pub fn add_with<___R>(
&self,
request: ___R,
) -> ::fidl_next::TwoWayFuture<'_, super::Add, ___T>
where
___R: ::fidl_next::Encode<
<___T as ::fidl_next::Transport>::SendBuffer,
Encoded = crate::wire::SimpleProtocolAddRequest,
>,
{
::fidl_next::TwoWayFuture::from_untyped(
self.client.send_two_way(9142761280038437494, request),
)
}
}
/// The server for the `SimpleProtocol` protocol.
#[repr(transparent)]
pub struct SimpleProtocolServer<___T: ::fidl_next::Transport> {
server: ::fidl_next::protocol::Server<___T>,
}
impl<___T> SimpleProtocolServer<___T> where ___T: ::fidl_next::Transport {}
}
}
/// A client handler for the SimpleProtocol protocol.
///
/// See [`SimpleProtocol`] for more details.
pub trait SimpleProtocolClientHandler<
#[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport,
#[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
>
{
}
impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for SimpleProtocol
where
___H: SimpleProtocolClientHandler<___T> + ::core::marker::Send,
___T: ::fidl_next::Transport,
<simple_protocol::Add as ::fidl_next::Method>::Response:
::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
{
async fn on_event(
handler: &mut ___H,
ordinal: u64,
buffer: ___T::RecvBuffer,
) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
match ordinal {
ordinal => Err(::fidl_next::ProtocolError::InvalidOrdinal(ordinal)),
}
}
}
/// A server handler for the SimpleProtocol protocol.
///
/// See [`SimpleProtocol`] for more details.
pub trait SimpleProtocolServerHandler<
#[cfg(not(feature = "fuchsia"))] ___T: ::fidl_next::Transport,
#[cfg(feature = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
>
{
fn add(
&mut self,
request: ::fidl_next::Request<simple_protocol::Add, ___T>,
responder: ::fidl_next::Responder<simple_protocol::Add, ___T>,
) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
}
impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for SimpleProtocol
where
___H: SimpleProtocolServerHandler<___T> + ::core::marker::Send,
___T: ::fidl_next::Transport,
<simple_protocol::Add as ::fidl_next::Method>::Request:
::fidl_next::Decode<<___T as ::fidl_next::Transport>::RecvBuffer>,
{
async fn on_one_way(
handler: &mut ___H,
ordinal: u64,
buffer: ___T::RecvBuffer,
) -> ::core::result::Result<
(),
::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
> {
match ordinal {
ordinal => Err(::fidl_next::ProtocolError::InvalidOrdinal(ordinal)),
}
}
async fn on_two_way(
handler: &mut ___H,
ordinal: u64,
buffer: ___T::RecvBuffer,
responder: ::fidl_next::protocol::Responder<___T>,
) -> ::core::result::Result<
(),
::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
> {
match ordinal {
9142761280038437494 => {
let responder = ::fidl_next::Responder::from_untyped(responder);
match ::fidl_next::DecoderExt::decode(buffer) {
Ok(decoded) => {
handler.add(decoded, responder).await;
Ok(())
}
Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
ordinal: 9142761280038437494,
error,
}),
}
}
ordinal => Err(::fidl_next::ProtocolError::InvalidOrdinal(ordinal)),
}
}
}
/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
pub mod compat {
impl ::fidl_next::CompatFrom<crate::Int32Wrapper> for ::fidl_test_nullable::Int32Wrapper {
#[inline]
fn compat_from(value: crate::Int32Wrapper) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::Int32Wrapper> for crate::Int32Wrapper {
#[inline]
fn compat_from(value: ::fidl_test_nullable::Int32Wrapper) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<crate::SimpleProtocolAddRequest>
for ::fidl_test_nullable::SimpleProtocolAddRequest
{
#[inline]
fn compat_from(value: crate::SimpleProtocolAddRequest) -> Self {
Self {
a: ::fidl_next::CompatFrom::compat_from(value.a),
b: ::fidl_next::CompatFrom::compat_from(value.b),
}
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::SimpleProtocolAddRequest>
for crate::SimpleProtocolAddRequest
{
#[inline]
fn compat_from(value: ::fidl_test_nullable::SimpleProtocolAddRequest) -> Self {
Self {
a: ::fidl_next::CompatFrom::compat_from(value.a),
b: ::fidl_next::CompatFrom::compat_from(value.b),
}
}
}
impl ::fidl_next::CompatFrom<crate::SimpleProtocolAddResponse>
for ::fidl_test_nullable::SimpleProtocolAddResponse
{
#[inline]
fn compat_from(value: crate::SimpleProtocolAddResponse) -> Self {
Self { sum: ::fidl_next::CompatFrom::compat_from(value.sum) }
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::SimpleProtocolAddResponse>
for crate::SimpleProtocolAddResponse
{
#[inline]
fn compat_from(value: ::fidl_test_nullable::SimpleProtocolAddResponse) -> Self {
Self { sum: ::fidl_next::CompatFrom::compat_from(value.sum) }
}
}
#[cfg(target_os = "fuchsia")]
/// An alias for a client over `zx::Channel` for the `SimpleProtocol`
/// protocol.
pub type SimpleProtocolProxy = ::fidl_next::Client<crate::SimpleProtocol>;
impl ::fidl_next::CompatFrom<crate::SimpleProtocol> for ::fidl_test_nullable::SimpleProtocolMarker {
fn compat_from(_: crate::SimpleProtocol) -> Self {
Self
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::SimpleProtocolMarker> for crate::SimpleProtocol {
fn compat_from(_: ::fidl_test_nullable::SimpleProtocolMarker) -> Self {
Self
}
}
#[cfg(target_os = "fuchsia")]
impl ::fidl_next::ClientCompatFrom<::fidl_test_nullable::SimpleProtocolProxy>
for crate::SimpleProtocol
{
fn client_compat_from(
proxy: ::fidl_test_nullable::SimpleProtocolProxy,
) -> ::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)
}
}
impl ::fidl_next::CompatFrom<crate::SimpleUnion> for ::fidl_test_nullable::SimpleUnion {
fn compat_from(value: crate::SimpleUnion) -> Self {
match value {
crate::SimpleUnion::A(value) => {
Self::A(::fidl_next::CompatFrom::compat_from(value))
}
crate::SimpleUnion::B(value) => {
Self::B(::fidl_next::CompatFrom::compat_from(value))
}
}
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::SimpleUnion> for crate::SimpleUnion {
fn compat_from(value: ::fidl_test_nullable::SimpleUnion) -> Self {
match value {
::fidl_test_nullable::SimpleUnion::A(value) => {
Self::A(::fidl_next::CompatFrom::compat_from(value))
}
::fidl_test_nullable::SimpleUnion::B(value) => {
Self::B(::fidl_next::CompatFrom::compat_from(value))
}
}
}
}
impl ::fidl_next::CompatFrom<crate::StructWithNullableHandle>
for ::fidl_test_nullable::StructWithNullableHandle
{
#[inline]
fn compat_from(value: crate::StructWithNullableHandle) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::StructWithNullableHandle>
for crate::StructWithNullableHandle
{
#[inline]
fn compat_from(value: ::fidl_test_nullable::StructWithNullableHandle) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<crate::StructWithNullableProtocol>
for ::fidl_test_nullable::StructWithNullableProtocol
{
#[inline]
fn compat_from(value: crate::StructWithNullableProtocol) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::StructWithNullableProtocol>
for crate::StructWithNullableProtocol
{
#[inline]
fn compat_from(value: ::fidl_test_nullable::StructWithNullableProtocol) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<crate::StructWithNullableRequest>
for ::fidl_test_nullable::StructWithNullableRequest
{
#[inline]
fn compat_from(value: crate::StructWithNullableRequest) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::StructWithNullableRequest>
for crate::StructWithNullableRequest
{
#[inline]
fn compat_from(value: ::fidl_test_nullable::StructWithNullableRequest) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<crate::StructWithNullableString>
for ::fidl_test_nullable::StructWithNullableString
{
#[inline]
fn compat_from(value: crate::StructWithNullableString) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::StructWithNullableString>
for crate::StructWithNullableString
{
#[inline]
fn compat_from(value: ::fidl_test_nullable::StructWithNullableString) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<crate::StructWithNullableStruct>
for ::fidl_test_nullable::StructWithNullableStruct
{
#[inline]
fn compat_from(value: crate::StructWithNullableStruct) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::StructWithNullableStruct>
for crate::StructWithNullableStruct
{
#[inline]
fn compat_from(value: ::fidl_test_nullable::StructWithNullableStruct) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<crate::StructWithNullableUnion>
for ::fidl_test_nullable::StructWithNullableUnion
{
#[inline]
fn compat_from(value: crate::StructWithNullableUnion) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::StructWithNullableUnion>
for crate::StructWithNullableUnion
{
#[inline]
fn compat_from(value: ::fidl_test_nullable::StructWithNullableUnion) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<crate::StructWithNullableVector>
for ::fidl_test_nullable::StructWithNullableVector
{
#[inline]
fn compat_from(value: crate::StructWithNullableVector) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
impl ::fidl_next::CompatFrom<::fidl_test_nullable::StructWithNullableVector>
for crate::StructWithNullableVector
{
#[inline]
fn compat_from(value: ::fidl_test_nullable::StructWithNullableVector) -> Self {
Self { val: ::fidl_next::CompatFrom::compat_from(value.val) }
}
}
}