blob: bf398ad7c08bc1e7d2e6808414989776327a928a [file]
// 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 {
pub use fidl_next_common_test_aliases::natural::*;
pub type ReferenceMe = ::fidl_next_test_someotherlibrary::natural::ReferenceMe;
pub type Channel = ::fidl_next::fuchsia::zx::Channel;
pub type AliasOfChannel = ::fidl_next::fuchsia::zx::Channel;
#[derive(Debug, PartialEq)]
pub struct ExampleOfUseOfAliases {
pub field_of_u32: u32,
pub field_of_vec_of_strings: ::std::vec::Vec<::std::string::String>,
pub field_of_vec_of_strings_at_most_nine: ::std::vec::Vec<::std::string::String>,
pub field_of_vec_of_strings_at_most_5: ::std::vec::Vec<::std::string::String>,
pub field_of_vec_of_ref_me_at_most_5:
::std::vec::Vec<::fidl_next_test_someotherlibrary::natural::ReferenceMe>,
pub field_of_channel: ::fidl_next::fuchsia::zx::Channel,
pub field_of_client_end: ::fidl_next::fuchsia::zx::Channel,
pub field_of_nullable_client_end: ::core::option::Option<::fidl_next::fuchsia::zx::Channel>,
}
unsafe impl<___E> ::fidl_next::Encode<crate::wire::ExampleOfUseOfAliases<'static>, ___E>
for ExampleOfUseOfAliases
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<crate::wire::ExampleOfUseOfAliases<'static>>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let crate::wire::ExampleOfUseOfAliases {
field_of_u32,
field_of_vec_of_strings,
field_of_vec_of_strings_at_most_nine,
field_of_vec_of_strings_at_most_5,
field_of_vec_of_ref_me_at_most_5,
field_of_channel,
field_of_client_end,
field_of_nullable_client_end,
} = out_;
}
::fidl_next::Encode::encode(self.field_of_u32, encoder_, field_of_u32, ())?;
let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(field_of_u32.as_mut_ptr()) };
::fidl_next::Encode::encode(
self.field_of_vec_of_strings,
encoder_,
field_of_vec_of_strings,
(4294967295, 4294967295),
)?;
let mut _field =
unsafe { ::fidl_next::Slot::new_unchecked(field_of_vec_of_strings.as_mut_ptr()) };
::fidl_next::Constrained::validate(_field, (4294967295, 4294967295))?;
::fidl_next::Encode::encode(
self.field_of_vec_of_strings_at_most_nine,
encoder_,
field_of_vec_of_strings_at_most_nine,
(9, 4294967295),
)?;
let mut _field = unsafe {
::fidl_next::Slot::new_unchecked(field_of_vec_of_strings_at_most_nine.as_mut_ptr())
};
::fidl_next::Constrained::validate(_field, (9, 4294967295))?;
::fidl_next::Encode::encode(
self.field_of_vec_of_strings_at_most_5,
encoder_,
field_of_vec_of_strings_at_most_5,
(5, 4294967295),
)?;
let mut _field = unsafe {
::fidl_next::Slot::new_unchecked(field_of_vec_of_strings_at_most_5.as_mut_ptr())
};
::fidl_next::Constrained::validate(_field, (5, 4294967295))?;
::fidl_next::Encode::encode(
self.field_of_vec_of_ref_me_at_most_5,
encoder_,
field_of_vec_of_ref_me_at_most_5,
(5, ()),
)?;
let mut _field = unsafe {
::fidl_next::Slot::new_unchecked(field_of_vec_of_ref_me_at_most_5.as_mut_ptr())
};
::fidl_next::Constrained::validate(_field, (5, ()))?;
::fidl_next::Encode::encode(self.field_of_channel, encoder_, field_of_channel, ())?;
let mut _field =
unsafe { ::fidl_next::Slot::new_unchecked(field_of_channel.as_mut_ptr()) };
::fidl_next::Encode::encode(
self.field_of_client_end,
encoder_,
field_of_client_end,
(),
)?;
let mut _field =
unsafe { ::fidl_next::Slot::new_unchecked(field_of_client_end.as_mut_ptr()) };
::fidl_next::Encode::encode(
self.field_of_nullable_client_end,
encoder_,
field_of_nullable_client_end,
(),
)?;
let mut _field = unsafe {
::fidl_next::Slot::new_unchecked(field_of_nullable_client_end.as_mut_ptr())
};
Ok(())
}
}
unsafe impl<___E>
::fidl_next::EncodeOption<
::fidl_next::wire::Box<'static, crate::wire::ExampleOfUseOfAliases<'static>>,
___E,
> for ExampleOfUseOfAliases
where
___E: ::fidl_next::Encoder + ?Sized,
ExampleOfUseOfAliases:
::fidl_next::Encode<crate::wire::ExampleOfUseOfAliases<'static>, ___E>,
{
#[inline]
fn encode_option(
this: ::core::option::Option<Self>,
encoder: &mut ___E,
out: &mut ::core::mem::MaybeUninit<
::fidl_next::wire::Box<'static, crate::wire::ExampleOfUseOfAliases<'static>>,
>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
if let Some(inner) = this {
::fidl_next::EncoderExt::encode_next(encoder, inner)?;
::fidl_next::wire::Box::encode_present(out);
} else {
::fidl_next::wire::Box::encode_absent(out);
}
Ok(())
}
}
impl<'de> ::fidl_next::FromWire<crate::wire::ExampleOfUseOfAliases<'de>> for ExampleOfUseOfAliases {
#[inline]
fn from_wire(wire: crate::wire::ExampleOfUseOfAliases<'de>) -> Self {
Self {
field_of_u32: ::fidl_next::FromWire::from_wire(wire.field_of_u32),
field_of_vec_of_strings: ::fidl_next::FromWire::from_wire(
wire.field_of_vec_of_strings,
),
field_of_vec_of_strings_at_most_nine: ::fidl_next::FromWire::from_wire(
wire.field_of_vec_of_strings_at_most_nine,
),
field_of_vec_of_strings_at_most_5: ::fidl_next::FromWire::from_wire(
wire.field_of_vec_of_strings_at_most_5,
),
field_of_vec_of_ref_me_at_most_5: ::fidl_next::FromWire::from_wire(
wire.field_of_vec_of_ref_me_at_most_5,
),
field_of_channel: ::fidl_next::FromWire::from_wire(wire.field_of_channel),
field_of_client_end: ::fidl_next::FromWire::from_wire(wire.field_of_client_end),
field_of_nullable_client_end: ::fidl_next::FromWire::from_wire(
wire.field_of_nullable_client_end,
),
}
}
}
}
pub mod wire {
pub use fidl_next_common_test_aliases::wire::*;
/// The wire type corresponding to [`ReferenceMe`](crate::natural::ReferenceMe).
pub type ReferenceMe = ::fidl_next_test_someotherlibrary::wire::ReferenceMe;
/// The wire type corresponding to [`Channel`](crate::natural::Channel).
pub type Channel = ::fidl_next::wire::fuchsia::Channel;
/// The wire type corresponding to [`AliasOfChannel`](crate::natural::AliasOfChannel).
pub type AliasOfChannel = ::fidl_next::wire::fuchsia::Channel;
/// The wire type corresponding to [`ExampleOfUseOfAliases`].
#[derive(Debug)]
#[repr(C)]
pub struct ExampleOfUseOfAliases<'de> {
pub field_of_u32: ::fidl_next::wire::Uint32,
pub field_of_vec_of_strings: ::fidl_next::wire::Vector<'de, ::fidl_next::wire::String<'de>>,
pub field_of_vec_of_strings_at_most_nine:
::fidl_next::wire::Vector<'de, ::fidl_next::wire::String<'de>>,
pub field_of_vec_of_strings_at_most_5:
::fidl_next::wire::Vector<'de, ::fidl_next::wire::String<'de>>,
pub field_of_vec_of_ref_me_at_most_5:
::fidl_next::wire::Vector<'de, ::fidl_next_test_someotherlibrary::wire::ReferenceMe>,
pub field_of_channel: ::fidl_next::wire::fuchsia::Channel,
pub field_of_client_end: ::fidl_next::wire::fuchsia::Channel,
pub field_of_nullable_client_end: ::fidl_next::wire::fuchsia::OptionalChannel,
}
static_assertions::const_assert_eq!(std::mem::size_of::<ExampleOfUseOfAliases<'_>>(), 88);
static_assertions::const_assert_eq!(std::mem::align_of::<ExampleOfUseOfAliases<'_>>(), 8);
static_assertions::const_assert_eq!(
std::mem::offset_of!(ExampleOfUseOfAliases<'_>, field_of_u32),
0
);
static_assertions::const_assert_eq!(
std::mem::offset_of!(ExampleOfUseOfAliases<'_>, field_of_vec_of_strings),
8
);
static_assertions::const_assert_eq!(
std::mem::offset_of!(ExampleOfUseOfAliases<'_>, field_of_vec_of_strings_at_most_nine),
24
);
static_assertions::const_assert_eq!(
std::mem::offset_of!(ExampleOfUseOfAliases<'_>, field_of_vec_of_strings_at_most_5),
40
);
static_assertions::const_assert_eq!(
std::mem::offset_of!(ExampleOfUseOfAliases<'_>, field_of_vec_of_ref_me_at_most_5),
56
);
static_assertions::const_assert_eq!(
std::mem::offset_of!(ExampleOfUseOfAliases<'_>, field_of_channel),
72
);
static_assertions::const_assert_eq!(
std::mem::offset_of!(ExampleOfUseOfAliases<'_>, field_of_client_end),
76
);
static_assertions::const_assert_eq!(
std::mem::offset_of!(ExampleOfUseOfAliases<'_>, field_of_nullable_client_end),
80
);
impl ::fidl_next::Constrained for ExampleOfUseOfAliases<'_> {
type Constraint = ();
fn validate(
_: ::fidl_next::Slot<'_, Self>,
_: Self::Constraint,
) -> Result<(), ::fidl_next::ValidationError> {
Ok(())
}
}
unsafe impl ::fidl_next::Wire for ExampleOfUseOfAliases<'static> {
type Narrowed<'de> = ExampleOfUseOfAliases<'de>;
#[inline]
fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
::fidl_next::munge! {
let Self {
field_of_u32,
field_of_vec_of_strings,
field_of_vec_of_strings_at_most_nine,
field_of_vec_of_strings_at_most_5,
field_of_vec_of_ref_me_at_most_5,
field_of_channel,
field_of_client_end,
field_of_nullable_client_end,
} = &mut *out_;
}
::fidl_next::Wire::zero_padding(field_of_u32);
::fidl_next::Wire::zero_padding(field_of_vec_of_strings);
::fidl_next::Wire::zero_padding(field_of_vec_of_strings_at_most_nine);
::fidl_next::Wire::zero_padding(field_of_vec_of_strings_at_most_5);
::fidl_next::Wire::zero_padding(field_of_vec_of_ref_me_at_most_5);
::fidl_next::Wire::zero_padding(field_of_channel);
::fidl_next::Wire::zero_padding(field_of_client_end);
::fidl_next::Wire::zero_padding(field_of_nullable_client_end);
unsafe {
out_.as_mut_ptr().cast::<u8>().add(84).write_bytes(0, 4);
}
unsafe {
out_.as_mut_ptr().cast::<u8>().add(4).write_bytes(0, 4);
}
}
}
unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ExampleOfUseOfAliases<'de>
where
___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
___D: ::fidl_next::Decoder<'de>,
___D: ::fidl_next::fuchsia::HandleDecoder,
{
fn decode(
slot_: ::fidl_next::Slot<'_, Self>,
decoder_: &mut ___D,
_: (),
) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
if slot_.as_bytes()[84..88] != [0u8; 4] {
return Err(::fidl_next::DecodeError::InvalidPadding);
}
if slot_.as_bytes()[4..8] != [0u8; 4] {
return Err(::fidl_next::DecodeError::InvalidPadding);
}
::fidl_next::munge! {
let Self {
mut field_of_u32,
mut field_of_vec_of_strings,
mut field_of_vec_of_strings_at_most_nine,
mut field_of_vec_of_strings_at_most_5,
mut field_of_vec_of_ref_me_at_most_5,
mut field_of_channel,
mut field_of_client_end,
mut field_of_nullable_client_end,
} = slot_;
}
let _field = field_of_u32.as_mut();
::fidl_next::Decode::decode(field_of_u32.as_mut(), decoder_, ())?;
let _field = field_of_vec_of_strings.as_mut();
::fidl_next::Constrained::validate(_field, (4294967295, 4294967295))?;
::fidl_next::Decode::decode(
field_of_vec_of_strings.as_mut(),
decoder_,
(4294967295, 4294967295),
)?;
let _field = field_of_vec_of_strings_at_most_nine.as_mut();
::fidl_next::Constrained::validate(_field, (9, 4294967295))?;
::fidl_next::Decode::decode(
field_of_vec_of_strings_at_most_nine.as_mut(),
decoder_,
(9, 4294967295),
)?;
let field_of_vec_of_strings_at_most_nine =
unsafe { field_of_vec_of_strings_at_most_nine.deref_unchecked() };
if field_of_vec_of_strings_at_most_nine.len() > 9 {
return Err(::fidl_next::DecodeError::VectorTooLong {
size: field_of_vec_of_strings_at_most_nine.len() as u64,
limit: 9,
});
}
let _field = field_of_vec_of_strings_at_most_5.as_mut();
::fidl_next::Constrained::validate(_field, (5, 4294967295))?;
::fidl_next::Decode::decode(
field_of_vec_of_strings_at_most_5.as_mut(),
decoder_,
(5, 4294967295),
)?;
let field_of_vec_of_strings_at_most_5 =
unsafe { field_of_vec_of_strings_at_most_5.deref_unchecked() };
if field_of_vec_of_strings_at_most_5.len() > 5 {
return Err(::fidl_next::DecodeError::VectorTooLong {
size: field_of_vec_of_strings_at_most_5.len() as u64,
limit: 5,
});
}
let _field = field_of_vec_of_ref_me_at_most_5.as_mut();
::fidl_next::Constrained::validate(_field, (5, ()))?;
::fidl_next::Decode::decode(
field_of_vec_of_ref_me_at_most_5.as_mut(),
decoder_,
(5, ()),
)?;
let field_of_vec_of_ref_me_at_most_5 =
unsafe { field_of_vec_of_ref_me_at_most_5.deref_unchecked() };
if field_of_vec_of_ref_me_at_most_5.len() > 5 {
return Err(::fidl_next::DecodeError::VectorTooLong {
size: field_of_vec_of_ref_me_at_most_5.len() as u64,
limit: 5,
});
}
let _field = field_of_channel.as_mut();
::fidl_next::Decode::decode(field_of_channel.as_mut(), decoder_, ())?;
let _field = field_of_client_end.as_mut();
::fidl_next::Decode::decode(field_of_client_end.as_mut(), decoder_, ())?;
let _field = field_of_nullable_client_end.as_mut();
::fidl_next::Decode::decode(field_of_nullable_client_end.as_mut(), decoder_, ())?;
Ok(())
}
}
impl<'de> ::fidl_next::IntoNatural for ExampleOfUseOfAliases<'de> {
type Natural = crate::natural::ExampleOfUseOfAliases;
}
}
pub mod wire_optional {
pub use fidl_next_common_test_aliases::wire_optional::*;
}
pub mod generic {
pub use fidl_next_common_test_aliases::generic::*;
/// The generic type corresponding to [`ExampleOfUseOfAliases`].
pub struct ExampleOfUseOfAliases<T0, T1, T2, T3, T4, T5, T6, T7> {
pub field_of_u32: T0,
pub field_of_vec_of_strings: T1,
pub field_of_vec_of_strings_at_most_nine: T2,
pub field_of_vec_of_strings_at_most_5: T3,
pub field_of_vec_of_ref_me_at_most_5: T4,
pub field_of_channel: T5,
pub field_of_client_end: T6,
pub field_of_nullable_client_end: T7,
}
unsafe impl<___E, T0, T1, T2, T3, T4, T5, T6, T7>
::fidl_next::Encode<crate::wire::ExampleOfUseOfAliases<'static>, ___E>
for ExampleOfUseOfAliases<T0, T1, T2, T3, T4, T5, T6, T7>
where
___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
___E: ::fidl_next::Encoder,
___E: ::fidl_next::fuchsia::HandleEncoder,
T0: ::fidl_next::Encode<::fidl_next::wire::Uint32, ___E>,
T1: ::fidl_next::Encode<
::fidl_next::wire::Vector<'static, ::fidl_next::wire::String<'static>>,
___E,
>,
T2: ::fidl_next::Encode<
::fidl_next::wire::Vector<'static, ::fidl_next::wire::String<'static>>,
___E,
>,
T3: ::fidl_next::Encode<
::fidl_next::wire::Vector<'static, ::fidl_next::wire::String<'static>>,
___E,
>,
T4: ::fidl_next::Encode<
::fidl_next::wire::Vector<
'static,
::fidl_next_test_someotherlibrary::wire::ReferenceMe,
>,
___E,
>,
T5: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Channel, ___E>,
T6: ::fidl_next::Encode<::fidl_next::wire::fuchsia::Channel, ___E>,
T7: ::fidl_next::Encode<::fidl_next::wire::fuchsia::OptionalChannel, ___E>,
{
#[inline]
fn encode(
self,
encoder_: &mut ___E,
out_: &mut ::core::mem::MaybeUninit<crate::wire::ExampleOfUseOfAliases<'static>>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge! {
let crate::wire::ExampleOfUseOfAliases {
field_of_u32,
field_of_vec_of_strings,
field_of_vec_of_strings_at_most_nine,
field_of_vec_of_strings_at_most_5,
field_of_vec_of_ref_me_at_most_5,
field_of_channel,
field_of_client_end,
field_of_nullable_client_end,
} = out_;
}
::fidl_next::Encode::encode(self.field_of_u32, encoder_, field_of_u32, ())?;
::fidl_next::Encode::encode(
self.field_of_vec_of_strings,
encoder_,
field_of_vec_of_strings,
(4294967295, 4294967295),
)?;
::fidl_next::Encode::encode(
self.field_of_vec_of_strings_at_most_nine,
encoder_,
field_of_vec_of_strings_at_most_nine,
(9, 4294967295),
)?;
::fidl_next::Encode::encode(
self.field_of_vec_of_strings_at_most_5,
encoder_,
field_of_vec_of_strings_at_most_5,
(5, 4294967295),
)?;
::fidl_next::Encode::encode(
self.field_of_vec_of_ref_me_at_most_5,
encoder_,
field_of_vec_of_ref_me_at_most_5,
(5, ()),
)?;
::fidl_next::Encode::encode(self.field_of_channel, encoder_, field_of_channel, ())?;
::fidl_next::Encode::encode(
self.field_of_client_end,
encoder_,
field_of_client_end,
(),
)?;
::fidl_next::Encode::encode(
self.field_of_nullable_client_end,
encoder_,
field_of_nullable_client_end,
(),
)?;
Ok(())
}
}
}
pub use self::natural::*;
pub use fidl_next_common_test_aliases::*;