| // 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 { |
| |
| ::fidl_next::bitflags::bitflags! { |
| #[derive( |
| Clone, |
| Copy, |
| Debug, |
| PartialEq, |
| Eq, |
| Hash, |
| )] |
| pub struct Bits: u32 { |
| const B = 8; |
| |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::Bits, ___E> for Bits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::Bits>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::Encode::encode(&self, encoder, out, ()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Bits, ___E> for &'a Bits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::Bits>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::Bits { value } = out); |
| |
| if ::fidl_next::bitflags::Flags::contains_unknown_bits(self) { |
| return Err(::fidl_next::EncodeError::InvalidStrictBits); |
| } |
| |
| let _ = value.write(::fidl_next::WireU32::from(self.bits())); |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::wire::Bits> for Bits { |
| fn from(wire: crate::wire::Bits) -> Self { |
| Self::from_bits_retain(u32::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<crate::wire::Bits> for Bits { |
| #[inline] |
| fn from_wire(wire: crate::wire::Bits) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::FromWireRef<crate::wire::Bits> for Bits { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::Bits) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| ::fidl_next::bitflags::bitflags! { |
| #[derive( |
| Clone, |
| Copy, |
| Debug, |
| PartialEq, |
| Eq, |
| Hash, |
| )] |
| pub struct BitsType: u32 { |
| const VALUE = 1; |
| const SECOND_VALUE = 4; |
| const THIRD_VALUE = 2; |
| |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::BitsType, ___E> for BitsType |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::BitsType>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::Encode::encode(&self, encoder, out, ()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::BitsType, ___E> for &'a BitsType |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::BitsType>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::BitsType { value } = out); |
| |
| if ::fidl_next::bitflags::Flags::contains_unknown_bits(self) { |
| return Err(::fidl_next::EncodeError::InvalidStrictBits); |
| } |
| |
| let _ = value.write(::fidl_next::WireU32::from(self.bits())); |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::wire::BitsType> for BitsType { |
| fn from(wire: crate::wire::BitsType) -> Self { |
| Self::from_bits_retain(u32::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<crate::wire::BitsType> for BitsType { |
| #[inline] |
| fn from_wire(wire: crate::wire::BitsType) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::FromWireRef<crate::wire::BitsType> for BitsType { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::BitsType) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| #[repr(u32)] |
| pub enum Enum { |
| E = 170, |
| } |
| impl ::core::convert::TryFrom<u32> for Enum { |
| type Error = ::fidl_next::UnknownStrictEnumMemberError; |
| fn try_from( |
| value: u32, |
| ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> { |
| match value { |
| 170 => Ok(Self::E), |
| |
| _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())), |
| } |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::Enum, ___E> for Enum |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::Enum>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::Encode::encode(&self, encoder, out, ()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Enum, ___E> for &'a Enum |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::Enum>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::Enum { value } = out); |
| let _ = value.write(::fidl_next::WireU32::from(match *self { |
| Enum::E => 170, |
| })); |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::wire::Enum> for Enum { |
| fn from(wire: crate::wire::Enum) -> Self { |
| match u32::from(wire.value) { |
| 170 => Self::E, |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl ::fidl_next::FromWire<crate::wire::Enum> for Enum { |
| #[inline] |
| fn from_wire(wire: crate::wire::Enum) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::FromWireRef<crate::wire::Enum> for Enum { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::Enum) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| #[repr(i32)] |
| pub enum EnumType { |
| Value = 3, |
| SecondValue = 4, |
| } |
| impl ::core::convert::TryFrom<i32> for EnumType { |
| type Error = ::fidl_next::UnknownStrictEnumMemberError; |
| fn try_from( |
| value: i32, |
| ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> { |
| match value { |
| 3 => Ok(Self::Value), |
| 4 => Ok(Self::SecondValue), |
| |
| _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())), |
| } |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::EnumType, ___E> for EnumType |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::EnumType>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::Encode::encode(&self, encoder, out, ()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::EnumType, ___E> for &'a EnumType |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::EnumType>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::EnumType { value } = out); |
| let _ = value.write(::fidl_next::WireI32::from(match *self { |
| EnumType::Value => 3, |
| |
| EnumType::SecondValue => 4, |
| })); |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::wire::EnumType> for EnumType { |
| fn from(wire: crate::wire::EnumType) -> Self { |
| match i32::from(wire.value) { |
| 3 => Self::Value, |
| |
| 4 => Self::SecondValue, |
| |
| _ => unsafe { ::core::hint::unreachable_unchecked() }, |
| } |
| } |
| } |
| |
| impl ::fidl_next::FromWire<crate::wire::EnumType> for EnumType { |
| #[inline] |
| fn from_wire(wire: crate::wire::EnumType) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::FromWireRef<crate::wire::EnumType> for EnumType { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::EnumType) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| #[derive(PartialEq, Clone, Debug)] |
| pub struct Struct { |
| pub int64_with_default: i64, |
| |
| pub string_with_default: ::std::string::String, |
| |
| pub bool_with_default: bool, |
| |
| pub enum_with_default: crate::natural::Enum, |
| |
| pub bits_with_default: crate::natural::Bits, |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::Struct<'static>, ___E> for Struct |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<crate::wire::Struct<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let crate::wire::Struct { |
| int64_with_default, |
| string_with_default, |
| bool_with_default, |
| enum_with_default, |
| bits_with_default, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.int64_with_default, encoder_, int64_with_default, ())?; |
| |
| let mut _field = |
| unsafe { ::fidl_next::Slot::new_unchecked(int64_with_default.as_mut_ptr()) }; |
| |
| ::fidl_next::Encode::encode( |
| self.string_with_default, |
| encoder_, |
| string_with_default, |
| 4294967295, |
| )?; |
| |
| let mut _field = |
| unsafe { ::fidl_next::Slot::new_unchecked(string_with_default.as_mut_ptr()) }; |
| ::fidl_next::Constrained::validate(_field, 4294967295)?; |
| |
| ::fidl_next::Encode::encode(self.bool_with_default, encoder_, bool_with_default, ())?; |
| |
| let mut _field = |
| unsafe { ::fidl_next::Slot::new_unchecked(bool_with_default.as_mut_ptr()) }; |
| |
| ::fidl_next::Encode::encode(self.enum_with_default, encoder_, enum_with_default, ())?; |
| |
| let mut _field = |
| unsafe { ::fidl_next::Slot::new_unchecked(enum_with_default.as_mut_ptr()) }; |
| |
| ::fidl_next::Encode::encode(self.bits_with_default, encoder_, bits_with_default, ())?; |
| |
| let mut _field = |
| unsafe { ::fidl_next::Slot::new_unchecked(bits_with_default.as_mut_ptr()) }; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Struct<'static>, ___E> for &'a Struct |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<crate::wire::Struct<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let crate::wire::Struct { |
| |
| int64_with_default, |
| string_with_default, |
| bool_with_default, |
| enum_with_default, |
| bits_with_default, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode( |
| &self.int64_with_default, |
| encoder_, |
| int64_with_default, |
| (), |
| )?; |
| |
| let mut _field = |
| unsafe { ::fidl_next::Slot::new_unchecked(int64_with_default.as_mut_ptr()) }; |
| |
| ::fidl_next::Encode::encode( |
| &self.string_with_default, |
| encoder_, |
| string_with_default, |
| 4294967295, |
| )?; |
| |
| let mut _field = |
| unsafe { ::fidl_next::Slot::new_unchecked(string_with_default.as_mut_ptr()) }; |
| ::fidl_next::Constrained::validate(_field, 4294967295)?; |
| |
| ::fidl_next::Encode::encode(&self.bool_with_default, encoder_, bool_with_default, ())?; |
| |
| let mut _field = |
| unsafe { ::fidl_next::Slot::new_unchecked(bool_with_default.as_mut_ptr()) }; |
| |
| ::fidl_next::Encode::encode(&self.enum_with_default, encoder_, enum_with_default, ())?; |
| |
| let mut _field = |
| unsafe { ::fidl_next::Slot::new_unchecked(enum_with_default.as_mut_ptr()) }; |
| |
| ::fidl_next::Encode::encode(&self.bits_with_default, encoder_, bits_with_default, ())?; |
| |
| let mut _field = |
| unsafe { ::fidl_next::Slot::new_unchecked(bits_with_default.as_mut_ptr()) }; |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<___E> |
| ::fidl_next::EncodeOption<::fidl_next::WireBox<'static, crate::wire::Struct<'static>>, ___E> |
| for Struct |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| Struct: ::fidl_next::Encode<crate::wire::Struct<'static>, ___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit< |
| ::fidl_next::WireBox<'static, crate::wire::Struct<'static>>, |
| >, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| if let Some(inner) = this { |
| ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?; |
| ::fidl_next::WireBox::encode_present(out); |
| } else { |
| ::fidl_next::WireBox::encode_absent(out); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> |
| ::fidl_next::EncodeOption<::fidl_next::WireBox<'static, crate::wire::Struct<'static>>, ___E> |
| for &'a Struct |
| where |
| ___E: ::fidl_next::Encoder + ?Sized, |
| &'a Struct: ::fidl_next::Encode<crate::wire::Struct<'static>, ___E>, |
| { |
| #[inline] |
| fn encode_option( |
| this: ::core::option::Option<Self>, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit< |
| ::fidl_next::WireBox<'static, crate::wire::Struct<'static>>, |
| >, |
| _: (), |
| ) -> ::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::Struct<'de>> for Struct { |
| #[inline] |
| fn from_wire(wire: crate::wire::Struct<'de>) -> Self { |
| Self { |
| int64_with_default: ::fidl_next::FromWire::from_wire(wire.int64_with_default), |
| |
| string_with_default: ::fidl_next::FromWire::from_wire(wire.string_with_default), |
| |
| bool_with_default: ::fidl_next::FromWire::from_wire(wire.bool_with_default), |
| |
| enum_with_default: ::fidl_next::FromWire::from_wire(wire.enum_with_default), |
| |
| bits_with_default: ::fidl_next::FromWire::from_wire(wire.bits_with_default), |
| } |
| } |
| } |
| |
| impl<'de> ::fidl_next::FromWireRef<crate::wire::Struct<'de>> for Struct { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::Struct<'de>) -> Self { |
| Self { |
| int64_with_default: ::fidl_next::FromWireRef::from_wire_ref( |
| &wire.int64_with_default, |
| ), |
| |
| string_with_default: ::fidl_next::FromWireRef::from_wire_ref( |
| &wire.string_with_default, |
| ), |
| |
| bool_with_default: ::fidl_next::FromWireRef::from_wire_ref(&wire.bool_with_default), |
| |
| enum_with_default: ::fidl_next::FromWireRef::from_wire_ref(&wire.enum_with_default), |
| |
| bits_with_default: ::fidl_next::FromWireRef::from_wire_ref(&wire.bits_with_default), |
| } |
| } |
| } |
| } |
| |
| pub mod wire { |
| |
| /// The wire type corresponding to [`Bits`](crate::natural::Bits). |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct Bits { |
| pub(crate) value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for Bits { |
| type Decoded<'de> = Self; |
| |
| #[inline] |
| fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) { |
| // Wire bits have no padding |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for Bits |
| 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); |
| let set = u32::from(*value); |
| if set & !crate::natural::Bits::all().bits() != 0 { |
| return Err(::fidl_next::DecodeError::InvalidBits { |
| expected: crate::natural::Bits::all().bits() as usize, |
| actual: set as usize, |
| }); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::natural::Bits> for Bits { |
| fn from(natural: crate::natural::Bits) -> Self { |
| Self { value: ::fidl_next::WireU32::from(natural.bits()) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for Bits { |
| type Natural = crate::natural::Bits; |
| } |
| |
| impl ::fidl_next::Unconstrained for Bits {} |
| |
| /// The wire type corresponding to [`BitsType`](crate::natural::BitsType). |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct BitsType { |
| pub(crate) value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for BitsType { |
| type Decoded<'de> = Self; |
| |
| #[inline] |
| fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) { |
| // Wire bits have no padding |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for BitsType |
| 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); |
| let set = u32::from(*value); |
| if set & !crate::natural::BitsType::all().bits() != 0 { |
| return Err(::fidl_next::DecodeError::InvalidBits { |
| expected: crate::natural::BitsType::all().bits() as usize, |
| actual: set as usize, |
| }); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::natural::BitsType> for BitsType { |
| fn from(natural: crate::natural::BitsType) -> Self { |
| Self { value: ::fidl_next::WireU32::from(natural.bits()) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for BitsType { |
| type Natural = crate::natural::BitsType; |
| } |
| |
| impl ::fidl_next::Unconstrained for BitsType {} |
| |
| /// The wire type corresponding to [`Enum`]. |
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| #[repr(transparent)] |
| pub struct Enum { |
| pub(crate) value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for Enum { |
| type Decoded<'de> = Self; |
| |
| #[inline] |
| fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) { |
| // Wire enums have no padding |
| } |
| } |
| |
| impl Enum { |
| pub const E: Enum = Enum { value: ::fidl_next::WireU32(170) }; |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for Enum |
| 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) { |
| 170 => (), |
| unknown => { |
| return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::natural::Enum> for Enum { |
| fn from(natural: crate::natural::Enum) -> Self { |
| match natural { |
| crate::natural::Enum::E => Enum::E, |
| } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for Enum { |
| type Natural = crate::natural::Enum; |
| } |
| |
| impl ::fidl_next::Unconstrained for Enum {} |
| |
| /// The wire type corresponding to [`EnumType`]. |
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| #[repr(transparent)] |
| pub struct EnumType { |
| pub(crate) value: ::fidl_next::WireI32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for EnumType { |
| type Decoded<'de> = Self; |
| |
| #[inline] |
| fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) { |
| // Wire enums have no padding |
| } |
| } |
| |
| impl EnumType { |
| pub const VALUE: EnumType = EnumType { value: ::fidl_next::WireI32(3) }; |
| |
| pub const SECOND_VALUE: EnumType = EnumType { value: ::fidl_next::WireI32(4) }; |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for EnumType |
| 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 i32::from(*value) { |
| 3 | 4 => (), |
| unknown => { |
| return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128)); |
| } |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::natural::EnumType> for EnumType { |
| fn from(natural: crate::natural::EnumType) -> Self { |
| match natural { |
| crate::natural::EnumType::Value => EnumType::VALUE, |
| |
| crate::natural::EnumType::SecondValue => EnumType::SECOND_VALUE, |
| } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for EnumType { |
| type Natural = crate::natural::EnumType; |
| } |
| |
| impl ::fidl_next::Unconstrained for EnumType {} |
| |
| /// The wire type corresponding to [`Struct`]. |
| #[derive(Debug)] |
| #[repr(C)] |
| pub struct Struct<'de> { |
| pub int64_with_default: ::fidl_next::WireI64, |
| |
| pub string_with_default: ::fidl_next::WireString<'de>, |
| |
| pub bool_with_default: bool, |
| |
| pub enum_with_default: crate::wire::Enum, |
| |
| pub bits_with_default: crate::wire::Bits, |
| } |
| |
| static_assertions::const_assert_eq!(std::mem::size_of::<Struct<'_>>(), 40); |
| static_assertions::const_assert_eq!(std::mem::align_of::<Struct<'_>>(), 8); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(Struct<'_>, int64_with_default), 0); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(Struct<'_>, string_with_default), 8); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(Struct<'_>, bool_with_default), 24); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(Struct<'_>, enum_with_default), 28); |
| |
| static_assertions::const_assert_eq!(std::mem::offset_of!(Struct<'_>, bits_with_default), 32); |
| |
| unsafe impl ::fidl_next::Wire for Struct<'static> { |
| type Decoded<'de> = Struct<'de>; |
| |
| #[inline] |
| fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) { |
| ::fidl_next::munge! { |
| let Self { |
| |
| int64_with_default, |
| string_with_default, |
| bool_with_default, |
| enum_with_default, |
| bits_with_default, |
| |
| } = &mut *out_; |
| } |
| |
| ::fidl_next::Wire::zero_padding(int64_with_default); |
| |
| ::fidl_next::Wire::zero_padding(string_with_default); |
| |
| ::fidl_next::Wire::zero_padding(bool_with_default); |
| |
| ::fidl_next::Wire::zero_padding(enum_with_default); |
| |
| ::fidl_next::Wire::zero_padding(bits_with_default); |
| |
| unsafe { |
| out_.as_mut_ptr().cast::<u8>().add(36).write_bytes(0, 4); |
| } |
| |
| unsafe { |
| out_.as_mut_ptr().cast::<u8>().add(25).write_bytes(0, 3); |
| } |
| } |
| } |
| |
| unsafe impl<___D> ::fidl_next::Decode<___D> for Struct<'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> { |
| if slot_.as_bytes()[36..40] != [0u8; 4] { |
| return Err(::fidl_next::DecodeError::InvalidPadding); |
| } |
| |
| if slot_.as_bytes()[25..28] != [0u8; 3] { |
| return Err(::fidl_next::DecodeError::InvalidPadding); |
| } |
| |
| ::fidl_next::munge! { |
| let Self { |
| |
| mut int64_with_default, |
| mut string_with_default, |
| mut bool_with_default, |
| mut enum_with_default, |
| mut bits_with_default, |
| |
| } = slot_; |
| } |
| |
| let _field = int64_with_default.as_mut(); |
| |
| ::fidl_next::Decode::decode(int64_with_default.as_mut(), decoder_, ())?; |
| |
| let _field = string_with_default.as_mut(); |
| ::fidl_next::Constrained::validate(_field, 4294967295)?; |
| ::fidl_next::Decode::decode(string_with_default.as_mut(), decoder_, 4294967295)?; |
| |
| let _field = bool_with_default.as_mut(); |
| |
| ::fidl_next::Decode::decode(bool_with_default.as_mut(), decoder_, ())?; |
| |
| let _field = enum_with_default.as_mut(); |
| |
| ::fidl_next::Decode::decode(enum_with_default.as_mut(), decoder_, ())?; |
| |
| let _field = bits_with_default.as_mut(); |
| |
| ::fidl_next::Decode::decode(bits_with_default.as_mut(), decoder_, ())?; |
| |
| Ok(()) |
| } |
| } |
| |
| impl<'de> ::fidl_next::IntoNatural for Struct<'de> { |
| type Natural = crate::natural::Struct; |
| } |
| |
| impl ::fidl_next::Unconstrained for Struct<'static> {} |
| } |
| |
| pub mod wire_optional {} |
| |
| pub mod generic { |
| |
| pub struct Struct<T0, T1, T2, T3, T4> { |
| pub int64_with_default: T0, |
| |
| pub string_with_default: T1, |
| |
| pub bool_with_default: T2, |
| |
| pub enum_with_default: T3, |
| |
| pub bits_with_default: T4, |
| } |
| |
| unsafe impl<___E, T0, T1, T2, T3, T4> ::fidl_next::Encode<crate::wire::Struct<'static>, ___E> |
| for Struct<T0, T1, T2, T3, T4> |
| where |
| ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized, |
| ___E: ::fidl_next::Encoder, |
| T0: ::fidl_next::Encode<::fidl_next::WireI64, ___E>, |
| T1: ::fidl_next::Encode<::fidl_next::WireString<'static>, ___E>, |
| T2: ::fidl_next::Encode<bool, ___E>, |
| T3: ::fidl_next::Encode<crate::wire::Enum, ___E>, |
| T4: ::fidl_next::Encode<crate::wire::Bits, ___E>, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder_: &mut ___E, |
| out_: &mut ::core::mem::MaybeUninit<crate::wire::Struct<'static>>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge! { |
| let crate::wire::Struct { |
| |
| int64_with_default, |
| string_with_default, |
| bool_with_default, |
| enum_with_default, |
| bits_with_default, |
| |
| } = out_; |
| } |
| |
| ::fidl_next::Encode::encode(self.int64_with_default, encoder_, int64_with_default, ())?; |
| |
| ::fidl_next::Encode::encode( |
| self.string_with_default, |
| encoder_, |
| string_with_default, |
| 4294967295, |
| )?; |
| |
| ::fidl_next::Encode::encode(self.bool_with_default, encoder_, bool_with_default, ())?; |
| |
| ::fidl_next::Encode::encode(self.enum_with_default, encoder_, enum_with_default, ())?; |
| |
| ::fidl_next::Encode::encode(self.bits_with_default, encoder_, bits_with_default, ())?; |
| |
| Ok(()) |
| } |
| } |
| } |
| |
| pub use self::natural::*; |
| |
| pub const BOOL: bool = true as bool; |
| |
| pub const UINT32: u32 = 4 as u32; |
| |
| pub const FLOAT32: f32 = 3.14159 as f32; |
| |
| pub const FLOAT64: f64 = 3.14159 as f64; |
| |
| pub const INT16: i16 = 4 as i16; |
| |
| pub const INT32: i32 = 4 as i32; |
| |
| pub const INT64: i64 = 4 as i64; |
| |
| pub const INT8: i8 = 4 as i8; |
| |
| pub const STRING: &str = "string"; |
| |
| pub const UINT16: u16 = 4 as u16; |
| |
| pub const UINT64: u64 = 4 as u64; |
| |
| pub const UINT8: u8 = 4 as u8; |
| |
| pub const BITS_PRIMITIVE_VAL: u32 = 1 as u32; |
| |
| pub const BITS_VAL: crate::natural::BitsType = crate::natural::BitsType::VALUE; |
| |
| pub const ENUM_PRIMITIVE_VAL: i32 = 3 as i32; |
| |
| pub const ENUM_VAL: crate::natural::EnumType = crate::natural::EnumType::Value; |
| |
| pub const OR_RESULT: crate::natural::BitsType = crate::natural::BitsType::from_bits_retain(7); |
| |
| pub const OR_RESULT_PRIMITIVE_VAL: u32 = 5 as u32; |
| |
| /// Compatibility shims which mimic some API surfaces of the current Rust bindings. |
| pub mod compat { |
| |
| impl ::fidl_next::CompatFrom<crate::Bits> for ::fidl_test_constants::Bits { |
| fn compat_from(value: crate::Bits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_constants::Bits> for crate::Bits { |
| fn compat_from(value: ::fidl_test_constants::Bits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::BitsType> for ::fidl_test_constants::BitsType { |
| fn compat_from(value: crate::BitsType) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_constants::BitsType> for crate::BitsType { |
| fn compat_from(value: ::fidl_test_constants::BitsType) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::Enum> for ::fidl_test_constants::Enum { |
| fn compat_from(value: crate::Enum) -> Self { |
| match value { |
| crate::Enum::E => Self::E, |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_constants::Enum> for crate::Enum { |
| fn compat_from(value: ::fidl_test_constants::Enum) -> Self { |
| match value { |
| ::fidl_test_constants::Enum::E => Self::E, |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::EnumType> for ::fidl_test_constants::EnumType { |
| fn compat_from(value: crate::EnumType) -> Self { |
| match value { |
| crate::EnumType::Value => Self::Value, |
| |
| crate::EnumType::SecondValue => Self::SecondValue, |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_constants::EnumType> for crate::EnumType { |
| fn compat_from(value: ::fidl_test_constants::EnumType) -> Self { |
| match value { |
| ::fidl_test_constants::EnumType::Value => Self::Value, |
| |
| ::fidl_test_constants::EnumType::SecondValue => Self::SecondValue, |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::Struct> for ::fidl_test_constants::Struct { |
| #[inline] |
| fn compat_from(value: crate::Struct) -> Self { |
| Self { |
| int64_with_default: ::fidl_next::CompatFrom::compat_from(value.int64_with_default), |
| |
| string_with_default: ::fidl_next::CompatFrom::compat_from( |
| value.string_with_default, |
| ), |
| |
| bool_with_default: ::fidl_next::CompatFrom::compat_from(value.bool_with_default), |
| |
| enum_with_default: ::fidl_next::CompatFrom::compat_from(value.enum_with_default), |
| |
| bits_with_default: ::fidl_next::CompatFrom::compat_from(value.bits_with_default), |
| } |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_constants::Struct> for crate::Struct { |
| #[inline] |
| fn compat_from(value: ::fidl_test_constants::Struct) -> Self { |
| Self { |
| int64_with_default: ::fidl_next::CompatFrom::compat_from(value.int64_with_default), |
| |
| string_with_default: ::fidl_next::CompatFrom::compat_from( |
| value.string_with_default, |
| ), |
| |
| bool_with_default: ::fidl_next::CompatFrom::compat_from(value.bool_with_default), |
| |
| enum_with_default: ::fidl_next::CompatFrom::compat_from(value.enum_with_default), |
| |
| bits_with_default: ::fidl_next::CompatFrom::compat_from(value.bits_with_default), |
| } |
| } |
| } |
| } |