#[repr(transparent)]pub struct PodBool(pub u8);Expand description
The standard bool is not a Pod, define a replacement that is.
Tuple Fields§
§0: u8Implementations§
Source§impl PodBool
impl PodBool
pub const fn from_bool(b: bool) -> PodBool
Sourcepub const fn is_canonical(&self) -> bool
pub const fn is_canonical(&self) -> bool
Returns true if the underlying byte is a canonical boolean value
(0 or 1).
Non-canonical values (2–255) are accepted by bytemuck deserialization
and convert to true, but two non-canonical PodBool values
representing the same logical boolean may fail PartialEq comparison.
Use this method to validate account data at deserialization boundaries.
Trait Implementations§
impl Copy for PodBool
impl Eq for PodBool
impl Pod for PodBool
impl StructuralPartialEq for PodBool
Auto Trait Implementations§
impl Freeze for PodBool
impl RefUnwindSafe for PodBool
impl Send for PodBool
impl Sync for PodBool
impl Unpin for PodBool
impl UnsafeUnpin for PodBool
impl UnwindSafe for PodBool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§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.Source§fn 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.