blob: 6390c51f3543df2fcdd8f6cd8a67e094b2f7aca4 [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 {
pub type U32 = u32;
pub type VecOfStrings = ::std::vec::Vec<::std::string::String>;
pub type VecOfStringsAtMost5 = ::std::vec::Vec<::std::string::String>;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u32)]
pub enum ObjType {
None = 0,
Channel = 4,
}
impl ::core::convert::TryFrom<u32> for ObjType {
type Error = ::fidl_next::UnknownStrictEnumMemberError;
fn try_from(
value: u32,
) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
match value {
0 => Ok(Self::None),
4 => Ok(Self::Channel),
_ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
}
}
}
unsafe impl<___E> ::fidl_next::Encode<crate::wire::ObjType, ___E> for ObjType
where
___E: ?Sized,
{
#[inline]
fn encode(
self,
encoder: &mut ___E,
out: &mut ::core::mem::MaybeUninit<crate::wire::ObjType>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::Encode::encode(&self, encoder, out, ())
}
}
unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ObjType, ___E> for &'a ObjType
where
___E: ?Sized,
{
#[inline]
fn encode(
self,
encoder: &mut ___E,
out: &mut ::core::mem::MaybeUninit<crate::wire::ObjType>,
_: (),
) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
::fidl_next::munge!(let crate::wire::ObjType { value } = out);
let _ = value.write(::fidl_next::WireU32::from(match *self {
ObjType::None => 0,
ObjType::Channel => 4,
}));
Ok(())
}
}
impl ::core::convert::From<crate::wire::ObjType> for ObjType {
fn from(wire: crate::wire::ObjType) -> Self {
match u32::from(wire.value) {
0 => Self::None,
4 => Self::Channel,
_ => unsafe { ::core::hint::unreachable_unchecked() },
}
}
}
impl ::fidl_next::FromWire<crate::wire::ObjType> for ObjType {
#[inline]
fn from_wire(wire: crate::wire::ObjType) -> Self {
Self::from(wire)
}
}
impl ::fidl_next::FromWireRef<crate::wire::ObjType> for ObjType {
#[inline]
fn from_wire_ref(wire: &crate::wire::ObjType) -> Self {
Self::from(*wire)
}
}
}
pub mod wire {
/// The wire type corresponding to [`U32`](crate::natural::U32).
pub type U32 = ::fidl_next::WireU32;
/// The wire type corresponding to [`VecOfStrings`](crate::natural::VecOfStrings).
pub type VecOfStrings<'de> = ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>;
/// The wire type corresponding to [`VecOfStringsAtMost5`](crate::natural::VecOfStringsAtMost5).
pub type VecOfStringsAtMost5<'de> = ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>;
/// The wire type corresponding to [`ObjType`].
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(transparent)]
pub struct ObjType {
pub(crate) value: ::fidl_next::WireU32,
}
unsafe impl ::fidl_next::Wire for ObjType {
type Owned<'de> = Self;
#[inline]
fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
// Wire enums have no padding
}
}
impl ObjType {
pub const NONE: ObjType = ObjType { value: ::fidl_next::WireU32(0) };
pub const CHANNEL: ObjType = ObjType { value: ::fidl_next::WireU32(4) };
}
unsafe impl<___D> ::fidl_next::Decode<___D> for ObjType
where
___D: ?Sized,
{
fn decode(
slot: ::fidl_next::Slot<'_, Self>,
_: &mut ___D,
_: (),
) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
::fidl_next::munge!(let Self { value } = slot);
match u32::from(*value) {
0 | 4 => (),
unknown => {
return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
}
}
Ok(())
}
}
impl ::core::convert::From<crate::natural::ObjType> for ObjType {
fn from(natural: crate::natural::ObjType) -> Self {
match natural {
crate::natural::ObjType::None => ObjType::NONE,
crate::natural::ObjType::Channel => ObjType::CHANNEL,
}
}
}
impl ::fidl_next::IntoNatural for ObjType {
type Natural = crate::natural::ObjType;
}
impl ::fidl_next::Unconstrained for ObjType {}
}
pub mod wire_optional {}
pub mod generic {}
pub use self::natural::*;
/// Compatibility shims which mimic some API surfaces of the current Rust bindings.
pub mod compat {
impl ::fidl_next::CompatFrom<crate::ObjType> for ::fidl_test_aliases::ObjType {
fn compat_from(value: crate::ObjType) -> Self {
match value {
crate::ObjType::None => Self::None,
crate::ObjType::Channel => Self::Channel,
}
}
}
impl ::fidl_next::CompatFrom<::fidl_test_aliases::ObjType> for crate::ObjType {
fn compat_from(value: ::fidl_test_aliases::ObjType) -> Self {
match value {
::fidl_test_aliases::ObjType::None => Self::None,
::fidl_test_aliases::ObjType::Channel => Self::Channel,
}
}
}
}