| // DO NOT EDIT: This file is machine-generated by fidlgen |
| #![warn(clippy::all)] |
| #![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)] |
| |
| ::fidl_next::bitflags::bitflags! { |
| #[derive( |
| Clone, |
| Copy, |
| Debug, |
| PartialEq, |
| Eq, |
| Hash, |
| )] |
| pub struct EmptyBits: u32 { |
| const _ = !0; |
| } |
| } |
| |
| impl ::fidl_next::Encodable for EmptyBits { |
| type Encoded = WireEmptyBits; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for EmptyBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::EncodeRef::encode_ref(&self, encoder, out) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for EmptyBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireEmptyBits { value } = out); |
| |
| let _ = value.write(::fidl_next::WireU32::from(self.bits())); |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<WireEmptyBits> for EmptyBits { |
| fn from(wire: WireEmptyBits) -> Self { |
| Self::from_bits_retain(u32::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireEmptyBits> for EmptyBits { |
| #[inline] |
| fn from_wire(wire: WireEmptyBits) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireEmptyBits { |
| type Natural = EmptyBits; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireEmptyBits> for EmptyBits { |
| #[inline] |
| fn from_wire_ref(wire: &WireEmptyBits) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| /// The wire type corresponding to [`EmptyBits`]. |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct WireEmptyBits { |
| value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireEmptyBits { |
| 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 WireEmptyBits |
| where |
| ___D: ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| _: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<EmptyBits> for WireEmptyBits { |
| fn from(natural: EmptyBits) -> Self { |
| Self { value: ::fidl_next::WireU32::from(natural.bits()) } |
| } |
| } |
| |
| ::fidl_next::bitflags::bitflags! { |
| #[derive( |
| Clone, |
| Copy, |
| Debug, |
| PartialEq, |
| Eq, |
| Hash, |
| )] |
| pub struct FlexibleBits: u64 { |
| const SMALLEST = 1; |
| const BIGGEST = 9223372036854775808; |
| const _ = !0; |
| } |
| } |
| |
| impl ::fidl_next::Encodable for FlexibleBits { |
| type Encoded = WireFlexibleBits; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for FlexibleBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::EncodeRef::encode_ref(&self, encoder, out) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for FlexibleBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireFlexibleBits { value } = out); |
| |
| let _ = value.write(::fidl_next::WireU64::from(self.bits())); |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<WireFlexibleBits> for FlexibleBits { |
| fn from(wire: WireFlexibleBits) -> Self { |
| Self::from_bits_retain(u64::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireFlexibleBits> for FlexibleBits { |
| #[inline] |
| fn from_wire(wire: WireFlexibleBits) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireFlexibleBits { |
| type Natural = FlexibleBits; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireFlexibleBits> for FlexibleBits { |
| #[inline] |
| fn from_wire_ref(wire: &WireFlexibleBits) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| /// The wire type corresponding to [`FlexibleBits`]. |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct WireFlexibleBits { |
| value: ::fidl_next::WireU64, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireFlexibleBits { |
| 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 WireFlexibleBits |
| where |
| ___D: ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| _: &mut ___D, |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<FlexibleBits> for WireFlexibleBits { |
| fn from(natural: FlexibleBits) -> Self { |
| Self { value: ::fidl_next::WireU64::from(natural.bits()) } |
| } |
| } |
| |
| ::fidl_next::bitflags::bitflags! { |
| #[derive( |
| Clone, |
| Copy, |
| Debug, |
| PartialEq, |
| Eq, |
| Hash, |
| )] |
| pub struct MyBits: u32 { |
| const MY_FIRST_BIT = 1; |
| const MY_OTHER_BIT = 2; |
| const MASK = 4; |
| |
| } |
| } |
| |
| impl ::fidl_next::Encodable for MyBits { |
| type Encoded = WireMyBits; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for MyBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::EncodeRef::encode_ref(&self, encoder, out) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for MyBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireMyBits { 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<WireMyBits> for MyBits { |
| fn from(wire: WireMyBits) -> Self { |
| Self::from_bits_retain(u32::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireMyBits> for MyBits { |
| #[inline] |
| fn from_wire(wire: WireMyBits) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireMyBits { |
| type Natural = MyBits; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireMyBits> for MyBits { |
| #[inline] |
| fn from_wire_ref(wire: &WireMyBits) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| /// The wire type corresponding to [`MyBits`]. |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct WireMyBits { |
| value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireMyBits { |
| 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 WireMyBits |
| 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 & !MyBits::all().bits() != 0 { |
| return Err(::fidl_next::DecodeError::InvalidBits { |
| expected: MyBits::all().bits() as usize, |
| actual: set as usize, |
| }); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<MyBits> for WireMyBits { |
| fn from(natural: MyBits) -> Self { |
| Self { value: ::fidl_next::WireU32::from(natural.bits()) } |
| } |
| } |
| |
| ::fidl_next::bitflags::bitflags! { |
| #[derive( |
| Clone, |
| Copy, |
| Debug, |
| PartialEq, |
| Eq, |
| Hash, |
| )] |
| pub struct StrictBits: u64 { |
| const SMALLEST = 1; |
| const BIGGEST = 9223372036854775808; |
| |
| } |
| } |
| |
| impl ::fidl_next::Encodable for StrictBits { |
| type Encoded = WireStrictBits; |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<___E> for StrictBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::EncodeRef::encode_ref(&self, encoder, out) |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::EncodeRef<___E> for StrictBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode_ref( |
| &self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<Self::Encoded>, |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let WireStrictBits { value } = out); |
| |
| if ::fidl_next::bitflags::Flags::contains_unknown_bits(self) { |
| return Err(::fidl_next::EncodeError::InvalidStrictBits); |
| } |
| |
| let _ = value.write(::fidl_next::WireU64::from(self.bits())); |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<WireStrictBits> for StrictBits { |
| fn from(wire: WireStrictBits) -> Self { |
| Self::from_bits_retain(u64::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<WireStrictBits> for StrictBits { |
| #[inline] |
| fn from_wire(wire: WireStrictBits) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for WireStrictBits { |
| type Natural = StrictBits; |
| } |
| |
| impl ::fidl_next::FromWireRef<WireStrictBits> for StrictBits { |
| #[inline] |
| fn from_wire_ref(wire: &WireStrictBits) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| /// The wire type corresponding to [`StrictBits`]. |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct WireStrictBits { |
| value: ::fidl_next::WireU64, |
| } |
| |
| unsafe impl ::fidl_next::Wire for WireStrictBits { |
| 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 WireStrictBits |
| 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 = u64::from(*value); |
| if set & !StrictBits::all().bits() != 0 { |
| return Err(::fidl_next::DecodeError::InvalidBits { |
| expected: StrictBits::all().bits() as usize, |
| actual: set as usize, |
| }); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<StrictBits> for WireStrictBits { |
| fn from(natural: StrictBits) -> Self { |
| Self { value: ::fidl_next::WireU64::from(natural.bits()) } |
| } |
| } |
| |
| /// Compatibility shims which mimic some API surfaces of the current Rust bindings. |
| pub mod compat { |
| |
| impl ::fidl_next::CompatFrom<crate::EmptyBits> for ::fidl_test_bits::EmptyBits { |
| fn compat_from(value: crate::EmptyBits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_bits::EmptyBits> for crate::EmptyBits { |
| fn compat_from(value: ::fidl_test_bits::EmptyBits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::FlexibleBits> for ::fidl_test_bits::FlexibleBits { |
| fn compat_from(value: crate::FlexibleBits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_bits::FlexibleBits> for crate::FlexibleBits { |
| fn compat_from(value: ::fidl_test_bits::FlexibleBits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::MyBits> for ::fidl_test_bits::MyBits { |
| fn compat_from(value: crate::MyBits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_bits::MyBits> for crate::MyBits { |
| fn compat_from(value: ::fidl_test_bits::MyBits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<crate::StrictBits> for ::fidl_test_bits::StrictBits { |
| fn compat_from(value: crate::StrictBits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| |
| impl ::fidl_next::CompatFrom<::fidl_test_bits::StrictBits> for crate::StrictBits { |
| fn compat_from(value: ::fidl_test_bits::StrictBits) -> Self { |
| Self::from_bits_retain(value.bits()) |
| } |
| } |
| } |