blob: 3084c56c7908105ed7e460843c31a9c759a76cf7 [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)]
#[derive(PartialEq, Clone, Debug)]
pub struct Int16Int8 {
pub a: i16,
pub b: i8,
}
impl ::fidl_next::Encodable for Int16Int8 {
type Encoded = WireInt16Int8;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for Int16Int8
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)?;
::fidl_next::Encode::encode(self.b, encoder_, b)?;
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Int16Int8
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)?;
::fidl_next::EncodeRef::encode_ref(&self.b, encoder_, b)?;
Ok(())
}
}
impl ::fidl_next::EncodableOption for Int16Int8 {
type EncodedOption = ::fidl_next::WireBox<'static, WireInt16Int8>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Int16Int8
where
___E: ::fidl_next::Encoder + ?Sized,
Int16Int8: ::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 Int16Int8
where
___E: ::fidl_next::Encoder + ?Sized,
Int16Int8: ::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<WireInt16Int8> for Int16Int8 {
#[inline]
fn from_wire(wire: WireInt16Int8) -> Self {
Self {
a: ::fidl_next::FromWire::from_wire(wire.a),
b: ::fidl_next::FromWire::from_wire(wire.b),
}
}
}
impl ::fidl_next::IntoNatural for WireInt16Int8 {
type Natural = Int16Int8;
}
impl ::fidl_next::FromWireRef<WireInt16Int8> for Int16Int8 {
#[inline]
fn from_wire_ref(wire: &WireInt16Int8) -> Self {
Self {
a: ::fidl_next::FromWireRef::from_wire_ref(&wire.a),
b: ::fidl_next::FromWireRef::from_wire_ref(&wire.b),
}
}
}
/// The wire type corresponding to [`Int16Int8`].
#[derive(Clone, Debug)]
#[repr(C)]
pub struct WireInt16Int8 {
pub a: ::fidl_next::WireI16,
pub b: i8,
}
static_assertions::const_assert_eq!(std::mem::size_of::<WireInt16Int8>(), 4);
static_assertions::const_assert_eq!(std::mem::align_of::<WireInt16Int8>(), 2);
static_assertions::const_assert_eq!(std::mem::offset_of!(WireInt16Int8, a), 0);
static_assertions::const_assert_eq!(std::mem::offset_of!(WireInt16Int8, b), 2);
unsafe impl ::fidl_next::Wire for WireInt16Int8 {
type Decoded<'de> = WireInt16Int8;
#[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 {
out_.as_mut_ptr().cast::<u8>().add(3).write_bytes(0, 1);
}
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for WireInt16Int8
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_;
}
::fidl_next::Decode::decode(a.as_mut(), decoder_)?;
::fidl_next::Decode::decode(b.as_mut(), decoder_)?;
Ok(())
}
}
#[derive(PartialEq, Clone, Debug)]
pub struct ArrayInt16Int8 {
pub arr: [crate::Int16Int8; 3],
}
impl ::fidl_next::Encodable for ArrayInt16Int8 {
type Encoded = WireArrayInt16Int8;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for ArrayInt16Int8
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 {
arr,
} = out_;
}
::fidl_next::Encode::encode(self.arr, encoder_, arr)?;
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for ArrayInt16Int8
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 {
arr,
} = out_;
}
::fidl_next::EncodeRef::encode_ref(&self.arr, encoder_, arr)?;
Ok(())
}
}
impl ::fidl_next::EncodableOption for ArrayInt16Int8 {
type EncodedOption = ::fidl_next::WireBox<'static, WireArrayInt16Int8>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for ArrayInt16Int8
where
___E: ::fidl_next::Encoder + ?Sized,
ArrayInt16Int8: ::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 ArrayInt16Int8
where
___E: ::fidl_next::Encoder + ?Sized,
ArrayInt16Int8: ::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<WireArrayInt16Int8> for ArrayInt16Int8 {
#[inline]
fn from_wire(wire: WireArrayInt16Int8) -> Self {
Self { arr: ::fidl_next::FromWire::from_wire(wire.arr) }
}
}
impl ::fidl_next::IntoNatural for WireArrayInt16Int8 {
type Natural = ArrayInt16Int8;
}
impl ::fidl_next::FromWireRef<WireArrayInt16Int8> for ArrayInt16Int8 {
#[inline]
fn from_wire_ref(wire: &WireArrayInt16Int8) -> Self {
Self { arr: ::fidl_next::FromWireRef::from_wire_ref(&wire.arr) }
}
}
/// The wire type corresponding to [`ArrayInt16Int8`].
#[derive(Clone, Debug)]
#[repr(C)]
pub struct WireArrayInt16Int8 {
pub arr: [crate::WireInt16Int8; 3],
}
static_assertions::const_assert_eq!(std::mem::size_of::<WireArrayInt16Int8>(), 12);
static_assertions::const_assert_eq!(std::mem::align_of::<WireArrayInt16Int8>(), 2);
static_assertions::const_assert_eq!(std::mem::offset_of!(WireArrayInt16Int8, arr), 0);
unsafe impl ::fidl_next::Wire for WireArrayInt16Int8 {
type Decoded<'de> = WireArrayInt16Int8;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
arr,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(arr);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for WireArrayInt16Int8
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 arr,
} = slot_;
}
::fidl_next::Decode::decode(arr.as_mut(), decoder_)?;
Ok(())
}
}
#[derive(PartialEq, Clone, Debug)]
pub struct Int8Int32 {
pub a: i8,
pub b: i32,
}
impl ::fidl_next::Encodable for Int8Int32 {
type Encoded = WireInt8Int32;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for Int8Int32
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)?;
::fidl_next::Encode::encode(self.b, encoder_, b)?;
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Int8Int32
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)?;
::fidl_next::EncodeRef::encode_ref(&self.b, encoder_, b)?;
Ok(())
}
}
impl ::fidl_next::EncodableOption for Int8Int32 {
type EncodedOption = ::fidl_next::WireBox<'static, WireInt8Int32>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for Int8Int32
where
___E: ::fidl_next::Encoder + ?Sized,
Int8Int32: ::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 Int8Int32
where
___E: ::fidl_next::Encoder + ?Sized,
Int8Int32: ::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<WireInt8Int32> for Int8Int32 {
#[inline]
fn from_wire(wire: WireInt8Int32) -> Self {
Self {
a: ::fidl_next::FromWire::from_wire(wire.a),
b: ::fidl_next::FromWire::from_wire(wire.b),
}
}
}
impl ::fidl_next::IntoNatural for WireInt8Int32 {
type Natural = Int8Int32;
}
impl ::fidl_next::FromWireRef<WireInt8Int32> for Int8Int32 {
#[inline]
fn from_wire_ref(wire: &WireInt8Int32) -> Self {
Self {
a: ::fidl_next::FromWireRef::from_wire_ref(&wire.a),
b: ::fidl_next::FromWireRef::from_wire_ref(&wire.b),
}
}
}
/// The wire type corresponding to [`Int8Int32`].
#[derive(Clone, Debug)]
#[repr(C)]
pub struct WireInt8Int32 {
pub a: i8,
pub b: ::fidl_next::WireI32,
}
static_assertions::const_assert_eq!(std::mem::size_of::<WireInt8Int32>(), 8);
static_assertions::const_assert_eq!(std::mem::align_of::<WireInt8Int32>(), 4);
static_assertions::const_assert_eq!(std::mem::offset_of!(WireInt8Int32, a), 0);
static_assertions::const_assert_eq!(std::mem::offset_of!(WireInt8Int32, b), 4);
unsafe impl ::fidl_next::Wire for WireInt8Int32 {
type Decoded<'de> = WireInt8Int32;
#[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 {
out_.as_mut_ptr().cast::<u8>().add(1).write_bytes(0, 3);
}
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for WireInt8Int32
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_;
}
::fidl_next::Decode::decode(a.as_mut(), decoder_)?;
::fidl_next::Decode::decode(b.as_mut(), decoder_)?;
Ok(())
}
}
#[derive(PartialEq, Debug)]
pub struct NonInlineStructTestStruct {
pub element: ::core::option::Option<::std::boxed::Box<crate::Int16Int8>>,
pub h: ::fidl_next::fuchsia::zx::Handle,
}
impl ::fidl_next::Encodable for NonInlineStructTestStruct {
type Encoded = WireNonInlineStructTestStruct<'static>;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for NonInlineStructTestStruct
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
___E: ::fidl_next::Encoder,
___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 {
element,
h,
} = out_;
}
::fidl_next::Encode::encode(self.element, encoder_, element)?;
::fidl_next::Encode::encode(self.h, encoder_, h)?;
Ok(())
}
}
impl ::fidl_next::EncodableOption for NonInlineStructTestStruct {
type EncodedOption = ::fidl_next::WireBox<'static, WireNonInlineStructTestStruct<'static>>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for NonInlineStructTestStruct
where
___E: ::fidl_next::Encoder + ?Sized,
NonInlineStructTestStruct: ::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<'de> ::fidl_next::FromWire<WireNonInlineStructTestStruct<'de>> for NonInlineStructTestStruct {
#[inline]
fn from_wire(wire: WireNonInlineStructTestStruct<'de>) -> Self {
Self {
element: ::fidl_next::FromWire::from_wire(wire.element),
h: ::fidl_next::FromWire::from_wire(wire.h),
}
}
}
impl<'de> ::fidl_next::IntoNatural for WireNonInlineStructTestStruct<'de> {
type Natural = NonInlineStructTestStruct;
}
/// The wire type corresponding to [`NonInlineStructTestStruct`].
#[derive(Debug)]
#[repr(C)]
pub struct WireNonInlineStructTestStruct<'de> {
pub element: ::fidl_next::WireBox<'de, crate::WireInt16Int8>,
pub h: ::fidl_next::fuchsia::WireHandle,
}
static_assertions::const_assert_eq!(std::mem::size_of::<WireNonInlineStructTestStruct<'_>>(), 16);
static_assertions::const_assert_eq!(std::mem::align_of::<WireNonInlineStructTestStruct<'_>>(), 8);
static_assertions::const_assert_eq!(
std::mem::offset_of!(WireNonInlineStructTestStruct<'_>, element),
0
);
static_assertions::const_assert_eq!(std::mem::offset_of!(WireNonInlineStructTestStruct<'_>, h), 8);
unsafe impl ::fidl_next::Wire for WireNonInlineStructTestStruct<'static> {
type Decoded<'de> = WireNonInlineStructTestStruct<'de>;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
element,
h,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(element);
::fidl_next::Wire::zero_padding(h);
unsafe {
out_.as_mut_ptr().cast::<u8>().add(12).write_bytes(0, 4);
}
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for WireNonInlineStructTestStruct<'static>
where
___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
___D: ::fidl_next::Decoder,
___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 element,
mut h,
} = slot_;
}
::fidl_next::Decode::decode(element.as_mut(), decoder_)?;
::fidl_next::Decode::decode(h.as_mut(), decoder_)?;
Ok(())
}
}
#[derive(PartialEq, Clone, Debug)]
pub struct StructPaddingTestStruct {
pub trailing: crate::Int16Int8,
pub inner: crate::Int8Int32,
pub array: crate::ArrayInt16Int8,
}
impl ::fidl_next::Encodable for StructPaddingTestStruct {
type Encoded = WireStructPaddingTestStruct;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for StructPaddingTestStruct
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 {
trailing,
inner,
array,
} = out_;
}
::fidl_next::Encode::encode(self.trailing, encoder_, trailing)?;
::fidl_next::Encode::encode(self.inner, encoder_, inner)?;
::fidl_next::Encode::encode(self.array, encoder_, array)?;
Ok(())
}
}
unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StructPaddingTestStruct
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 {
trailing,
inner,
array,
} = out_;
}
::fidl_next::EncodeRef::encode_ref(&self.trailing, encoder_, trailing)?;
::fidl_next::EncodeRef::encode_ref(&self.inner, encoder_, inner)?;
::fidl_next::EncodeRef::encode_ref(&self.array, encoder_, array)?;
Ok(())
}
}
impl ::fidl_next::EncodableOption for StructPaddingTestStruct {
type EncodedOption = ::fidl_next::WireBox<'static, WireStructPaddingTestStruct>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for StructPaddingTestStruct
where
___E: ::fidl_next::Encoder + ?Sized,
StructPaddingTestStruct: ::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 StructPaddingTestStruct
where
___E: ::fidl_next::Encoder + ?Sized,
StructPaddingTestStruct: ::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<WireStructPaddingTestStruct> for StructPaddingTestStruct {
#[inline]
fn from_wire(wire: WireStructPaddingTestStruct) -> Self {
Self {
trailing: ::fidl_next::FromWire::from_wire(wire.trailing),
inner: ::fidl_next::FromWire::from_wire(wire.inner),
array: ::fidl_next::FromWire::from_wire(wire.array),
}
}
}
impl ::fidl_next::IntoNatural for WireStructPaddingTestStruct {
type Natural = StructPaddingTestStruct;
}
impl ::fidl_next::FromWireRef<WireStructPaddingTestStruct> for StructPaddingTestStruct {
#[inline]
fn from_wire_ref(wire: &WireStructPaddingTestStruct) -> Self {
Self {
trailing: ::fidl_next::FromWireRef::from_wire_ref(&wire.trailing),
inner: ::fidl_next::FromWireRef::from_wire_ref(&wire.inner),
array: ::fidl_next::FromWireRef::from_wire_ref(&wire.array),
}
}
}
/// The wire type corresponding to [`StructPaddingTestStruct`].
#[derive(Clone, Debug)]
#[repr(C)]
pub struct WireStructPaddingTestStruct {
pub trailing: crate::WireInt16Int8,
pub inner: crate::WireInt8Int32,
pub array: crate::WireArrayInt16Int8,
}
static_assertions::const_assert_eq!(std::mem::size_of::<WireStructPaddingTestStruct>(), 24);
static_assertions::const_assert_eq!(std::mem::align_of::<WireStructPaddingTestStruct>(), 4);
static_assertions::const_assert_eq!(std::mem::offset_of!(WireStructPaddingTestStruct, trailing), 0);
static_assertions::const_assert_eq!(std::mem::offset_of!(WireStructPaddingTestStruct, inner), 4);
static_assertions::const_assert_eq!(std::mem::offset_of!(WireStructPaddingTestStruct, array), 12);
unsafe impl ::fidl_next::Wire for WireStructPaddingTestStruct {
type Decoded<'de> = WireStructPaddingTestStruct;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
trailing,
inner,
array,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(trailing);
::fidl_next::Wire::zero_padding(inner);
::fidl_next::Wire::zero_padding(array);
}
}
unsafe impl<___D> ::fidl_next::Decode<___D> for WireStructPaddingTestStruct
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 trailing,
mut inner,
mut array,
} = slot_;
}
::fidl_next::Decode::decode(trailing.as_mut(), decoder_)?;
::fidl_next::Decode::decode(inner.as_mut(), decoder_)?;
::fidl_next::Decode::decode(array.as_mut(), decoder_)?;
Ok(())
}
}
#[derive(PartialEq, Debug)]
pub struct TopLevelStruct {
pub a: crate::StructPaddingTestStruct,
pub b: crate::NonInlineStructTestStruct,
}
impl ::fidl_next::Encodable for TopLevelStruct {
type Encoded = WireTopLevelStruct<'static>;
}
unsafe impl<___E> ::fidl_next::Encode<___E> for TopLevelStruct
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
___E: ::fidl_next::Encoder,
___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 {
a,
b,
} = out_;
}
::fidl_next::Encode::encode(self.a, encoder_, a)?;
::fidl_next::Encode::encode(self.b, encoder_, b)?;
Ok(())
}
}
impl ::fidl_next::EncodableOption for TopLevelStruct {
type EncodedOption = ::fidl_next::WireBox<'static, WireTopLevelStruct<'static>>;
}
unsafe impl<___E> ::fidl_next::EncodeOption<___E> for TopLevelStruct
where
___E: ::fidl_next::Encoder + ?Sized,
TopLevelStruct: ::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<'de> ::fidl_next::FromWire<WireTopLevelStruct<'de>> for TopLevelStruct {
#[inline]
fn from_wire(wire: WireTopLevelStruct<'de>) -> Self {
Self {
a: ::fidl_next::FromWire::from_wire(wire.a),
b: ::fidl_next::FromWire::from_wire(wire.b),
}
}
}
impl<'de> ::fidl_next::IntoNatural for WireTopLevelStruct<'de> {
type Natural = TopLevelStruct;
}
/// The wire type corresponding to [`TopLevelStruct`].
#[derive(Debug)]
#[repr(C)]
pub struct WireTopLevelStruct<'de> {
pub a: crate::WireStructPaddingTestStruct,
pub b: crate::WireNonInlineStructTestStruct<'de>,
}
static_assertions::const_assert_eq!(std::mem::size_of::<WireTopLevelStruct<'_>>(), 40);
static_assertions::const_assert_eq!(std::mem::align_of::<WireTopLevelStruct<'_>>(), 8);
static_assertions::const_assert_eq!(std::mem::offset_of!(WireTopLevelStruct<'_>, a), 0);
static_assertions::const_assert_eq!(std::mem::offset_of!(WireTopLevelStruct<'_>, b), 24);
unsafe impl ::fidl_next::Wire for WireTopLevelStruct<'static> {
type Decoded<'de> = WireTopLevelStruct<'de>;
#[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 WireTopLevelStruct<'static>
where
___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
___D: ::fidl_next::Decoder,
___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 a,
mut b,
} = slot_;
}
::fidl_next::Decode::decode(a.as_mut(), decoder_)?;
::fidl_next::Decode::decode(b.as_mut(), decoder_)?;
Ok(())
}
}
/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
pub mod compat {
impl ::fidl_next::CompatFrom<crate::Int16Int8> for ::fidl_test_encapsulatedstructs::Int16Int8 {
#[inline]
fn compat_from(value: crate::Int16Int8) -> Self {
Self {
a: ::fidl_next::CompatFrom::compat_from(value.a),
b: ::fidl_next::CompatFrom::compat_from(value.b),
}
}
}
impl ::fidl_next::CompatFrom<::fidl_test_encapsulatedstructs::Int16Int8> for crate::Int16Int8 {
#[inline]
fn compat_from(value: ::fidl_test_encapsulatedstructs::Int16Int8) -> Self {
Self {
a: ::fidl_next::CompatFrom::compat_from(value.a),
b: ::fidl_next::CompatFrom::compat_from(value.b),
}
}
}
impl ::fidl_next::CompatFrom<crate::ArrayInt16Int8>
for ::fidl_test_encapsulatedstructs::ArrayInt16Int8
{
#[inline]
fn compat_from(value: crate::ArrayInt16Int8) -> Self {
Self { arr: ::fidl_next::CompatFrom::compat_from(value.arr) }
}
}
impl ::fidl_next::CompatFrom<::fidl_test_encapsulatedstructs::ArrayInt16Int8>
for crate::ArrayInt16Int8
{
#[inline]
fn compat_from(value: ::fidl_test_encapsulatedstructs::ArrayInt16Int8) -> Self {
Self { arr: ::fidl_next::CompatFrom::compat_from(value.arr) }
}
}
impl ::fidl_next::CompatFrom<crate::Int8Int32> for ::fidl_test_encapsulatedstructs::Int8Int32 {
#[inline]
fn compat_from(value: crate::Int8Int32) -> Self {
Self {
a: ::fidl_next::CompatFrom::compat_from(value.a),
b: ::fidl_next::CompatFrom::compat_from(value.b),
}
}
}
impl ::fidl_next::CompatFrom<::fidl_test_encapsulatedstructs::Int8Int32> for crate::Int8Int32 {
#[inline]
fn compat_from(value: ::fidl_test_encapsulatedstructs::Int8Int32) -> Self {
Self {
a: ::fidl_next::CompatFrom::compat_from(value.a),
b: ::fidl_next::CompatFrom::compat_from(value.b),
}
}
}
impl ::fidl_next::CompatFrom<crate::NonInlineStructTestStruct>
for ::fidl_test_encapsulatedstructs::NonInlineStructTestStruct
{
#[inline]
fn compat_from(value: crate::NonInlineStructTestStruct) -> Self {
Self {
element: ::fidl_next::CompatFrom::compat_from(value.element),
h: ::fidl_next::CompatFrom::compat_from(value.h),
}
}
}
impl ::fidl_next::CompatFrom<::fidl_test_encapsulatedstructs::NonInlineStructTestStruct>
for crate::NonInlineStructTestStruct
{
#[inline]
fn compat_from(value: ::fidl_test_encapsulatedstructs::NonInlineStructTestStruct) -> Self {
Self {
element: ::fidl_next::CompatFrom::compat_from(value.element),
h: ::fidl_next::CompatFrom::compat_from(value.h),
}
}
}
impl ::fidl_next::CompatFrom<crate::StructPaddingTestStruct>
for ::fidl_test_encapsulatedstructs::StructPaddingTestStruct
{
#[inline]
fn compat_from(value: crate::StructPaddingTestStruct) -> Self {
Self {
trailing: ::fidl_next::CompatFrom::compat_from(value.trailing),
inner: ::fidl_next::CompatFrom::compat_from(value.inner),
array: ::fidl_next::CompatFrom::compat_from(value.array),
}
}
}
impl ::fidl_next::CompatFrom<::fidl_test_encapsulatedstructs::StructPaddingTestStruct>
for crate::StructPaddingTestStruct
{
#[inline]
fn compat_from(value: ::fidl_test_encapsulatedstructs::StructPaddingTestStruct) -> Self {
Self {
trailing: ::fidl_next::CompatFrom::compat_from(value.trailing),
inner: ::fidl_next::CompatFrom::compat_from(value.inner),
array: ::fidl_next::CompatFrom::compat_from(value.array),
}
}
}
impl ::fidl_next::CompatFrom<crate::TopLevelStruct>
for ::fidl_test_encapsulatedstructs::TopLevelStruct
{
#[inline]
fn compat_from(value: crate::TopLevelStruct) -> Self {
Self {
a: ::fidl_next::CompatFrom::compat_from(value.a),
b: ::fidl_next::CompatFrom::compat_from(value.b),
}
}
}
impl ::fidl_next::CompatFrom<::fidl_test_encapsulatedstructs::TopLevelStruct>
for crate::TopLevelStruct
{
#[inline]
fn compat_from(value: ::fidl_test_encapsulatedstructs::TopLevelStruct) -> Self {
Self {
a: ::fidl_next::CompatFrom::compat_from(value.a),
b: ::fidl_next::CompatFrom::compat_from(value.b),
}
}
}
}