Struct ark_api_ffi::PodBool
source · [−]#[repr(C)]pub struct PodBool(_);Expand description
A version of bool that has the same layout as bool but is bytemuck::Pod.
In Rust, bool has a defined representation of being one byte with false being 0 and true being 1.
However, it is not Pod because it is invalid to interpret a byte that contains any value other
than 0 or 1 as a bool – doing so is undefined behavior.
Use this type to get around that limitation, as PodBool is valid for any value of u8, and its value is
checked to be valid as a bool upon calling as_bool
Implementations
sourceimpl PodBool
impl PodBool
pub fn as_bool(&self) -> bool
pub fn try_as_bool(&self) -> Result<bool, InvalidPodBool>
Trait Implementations
impl Copy for PodBool
impl Eq for PodBool
impl Pod for PodBool
impl StructuralEq for PodBool
impl StructuralPartialEq for PodBool
Auto Trait Implementations
impl RefUnwindSafe for PodBool
impl Send for PodBool
impl Sync for PodBool
impl Unpin for PodBool
impl UnwindSafe for PodBool
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedBitPattern for T where
T: AnyBitPattern,
impl<T> CheckedBitPattern for T where
T: AnyBitPattern,
type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during is_valid_bit_pattern. Read more
sourcefn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret bits as &Self.