| // 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 EmptyBits: u32 { |
| const _ = !0; |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::EmptyBits, ___E> for EmptyBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::EmptyBits>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::Encode::encode(&self, encoder, out, ()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::EmptyBits, ___E> for &'a EmptyBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::EmptyBits>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::EmptyBits { value } = out); |
| |
| let _ = value.write(::fidl_next::WireU32::from(self.bits())); |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::wire::EmptyBits> for EmptyBits { |
| fn from(wire: crate::wire::EmptyBits) -> Self { |
| Self::from_bits_retain(u32::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<crate::wire::EmptyBits> for EmptyBits { |
| #[inline] |
| fn from_wire(wire: crate::wire::EmptyBits) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::FromWireRef<crate::wire::EmptyBits> for EmptyBits { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::EmptyBits) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| ::fidl_next::bitflags::bitflags! { |
| #[derive( |
| Clone, |
| Copy, |
| Debug, |
| PartialEq, |
| Eq, |
| Hash, |
| )] |
| pub struct FlexibleBits: u64 { |
| const SMALLEST = 1; |
| const BIGGEST = 9223372036854775808; |
| const _ = !0; |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::FlexibleBits, ___E> for FlexibleBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::FlexibleBits>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::Encode::encode(&self, encoder, out, ()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::FlexibleBits, ___E> for &'a FlexibleBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::FlexibleBits>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::FlexibleBits { value } = out); |
| |
| let _ = value.write(::fidl_next::WireU64::from(self.bits())); |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::wire::FlexibleBits> for FlexibleBits { |
| fn from(wire: crate::wire::FlexibleBits) -> Self { |
| Self::from_bits_retain(u64::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<crate::wire::FlexibleBits> for FlexibleBits { |
| #[inline] |
| fn from_wire(wire: crate::wire::FlexibleBits) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::FromWireRef<crate::wire::FlexibleBits> for FlexibleBits { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::FlexibleBits) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| ::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; |
| |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::MyBits, ___E> for MyBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::MyBits>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::Encode::encode(&self, encoder, out, ()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::MyBits, ___E> for &'a MyBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::MyBits>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::MyBits { 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::MyBits> for MyBits { |
| fn from(wire: crate::wire::MyBits) -> Self { |
| Self::from_bits_retain(u32::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<crate::wire::MyBits> for MyBits { |
| #[inline] |
| fn from_wire(wire: crate::wire::MyBits) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::FromWireRef<crate::wire::MyBits> for MyBits { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::MyBits) -> Self { |
| Self::from(*wire) |
| } |
| } |
| |
| ::fidl_next::bitflags::bitflags! { |
| #[derive( |
| Clone, |
| Copy, |
| Debug, |
| PartialEq, |
| Eq, |
| Hash, |
| )] |
| pub struct StrictBits: u64 { |
| const SMALLEST = 1; |
| const BIGGEST = 9223372036854775808; |
| |
| } |
| } |
| |
| unsafe impl<___E> ::fidl_next::Encode<crate::wire::StrictBits, ___E> for StrictBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| encoder: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::StrictBits>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::Encode::encode(&self, encoder, out, ()) |
| } |
| } |
| |
| unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::StrictBits, ___E> for &'a StrictBits |
| where |
| ___E: ?Sized, |
| { |
| #[inline] |
| fn encode( |
| self, |
| _: &mut ___E, |
| out: &mut ::core::mem::MaybeUninit<crate::wire::StrictBits>, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::EncodeError> { |
| ::fidl_next::munge!(let crate::wire::StrictBits { 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<crate::wire::StrictBits> for StrictBits { |
| fn from(wire: crate::wire::StrictBits) -> Self { |
| Self::from_bits_retain(u64::from(wire.value)) |
| } |
| } |
| |
| impl ::fidl_next::FromWire<crate::wire::StrictBits> for StrictBits { |
| #[inline] |
| fn from_wire(wire: crate::wire::StrictBits) -> Self { |
| Self::from(wire) |
| } |
| } |
| |
| impl ::fidl_next::FromWireRef<crate::wire::StrictBits> for StrictBits { |
| #[inline] |
| fn from_wire_ref(wire: &crate::wire::StrictBits) -> Self { |
| Self::from(*wire) |
| } |
| } |
| } |
| |
| pub mod wire { |
| |
| /// The wire type corresponding to [`EmptyBits`](crate::natural::EmptyBits). |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct EmptyBits { |
| pub(crate) value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for EmptyBits { |
| 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 EmptyBits |
| where |
| ___D: ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| _: &mut ___D, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::natural::EmptyBits> for EmptyBits { |
| fn from(natural: crate::natural::EmptyBits) -> Self { |
| Self { value: ::fidl_next::WireU32::from(natural.bits()) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for EmptyBits { |
| type Natural = crate::natural::EmptyBits; |
| } |
| |
| impl ::fidl_next::Unconstrained for EmptyBits {} |
| |
| /// The wire type corresponding to [`FlexibleBits`](crate::natural::FlexibleBits). |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct FlexibleBits { |
| pub(crate) value: ::fidl_next::WireU64, |
| } |
| |
| unsafe impl ::fidl_next::Wire for FlexibleBits { |
| 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 FlexibleBits |
| where |
| ___D: ?Sized, |
| { |
| fn decode( |
| slot: ::fidl_next::Slot<'_, Self>, |
| _: &mut ___D, |
| _: (), |
| ) -> ::core::result::Result<(), ::fidl_next::DecodeError> { |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::natural::FlexibleBits> for FlexibleBits { |
| fn from(natural: crate::natural::FlexibleBits) -> Self { |
| Self { value: ::fidl_next::WireU64::from(natural.bits()) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for FlexibleBits { |
| type Natural = crate::natural::FlexibleBits; |
| } |
| |
| impl ::fidl_next::Unconstrained for FlexibleBits {} |
| |
| /// The wire type corresponding to [`MyBits`](crate::natural::MyBits). |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct MyBits { |
| pub(crate) value: ::fidl_next::WireU32, |
| } |
| |
| unsafe impl ::fidl_next::Wire for MyBits { |
| 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 MyBits |
| 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::MyBits::all().bits() != 0 { |
| return Err(::fidl_next::DecodeError::InvalidBits { |
| expected: crate::natural::MyBits::all().bits() as usize, |
| actual: set as usize, |
| }); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::natural::MyBits> for MyBits { |
| fn from(natural: crate::natural::MyBits) -> Self { |
| Self { value: ::fidl_next::WireU32::from(natural.bits()) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for MyBits { |
| type Natural = crate::natural::MyBits; |
| } |
| |
| impl ::fidl_next::Unconstrained for MyBits {} |
| |
| /// The wire type corresponding to [`StrictBits`](crate::natural::StrictBits). |
| #[derive(Clone, Copy, Debug)] |
| #[repr(transparent)] |
| pub struct StrictBits { |
| pub(crate) value: ::fidl_next::WireU64, |
| } |
| |
| unsafe impl ::fidl_next::Wire for StrictBits { |
| 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 StrictBits |
| 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 & !crate::natural::StrictBits::all().bits() != 0 { |
| return Err(::fidl_next::DecodeError::InvalidBits { |
| expected: crate::natural::StrictBits::all().bits() as usize, |
| actual: set as usize, |
| }); |
| } |
| |
| Ok(()) |
| } |
| } |
| |
| impl ::core::convert::From<crate::natural::StrictBits> for StrictBits { |
| fn from(natural: crate::natural::StrictBits) -> Self { |
| Self { value: ::fidl_next::WireU64::from(natural.bits()) } |
| } |
| } |
| |
| impl ::fidl_next::IntoNatural for StrictBits { |
| type Natural = crate::natural::StrictBits; |
| } |
| |
| impl ::fidl_next::Unconstrained for StrictBits {} |
| } |
| |
| 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::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()) |
| } |
| } |
| } |