Struct packed_char::U22
source · pub struct U22(/* private fields */);Expand description
A 22-bit unsigned integer.
Implementations§
source§impl U22
impl U22
sourcepub const fn from_u32(n: u32) -> Result<Self, U22FromU32Error>
pub const fn from_u32(n: u32) -> Result<Self, U22FromU32Error>
Creates a new 22-bit integer from the given 32-bit integer if it is small enough to fit.
§Examples
assert_eq!(U22::from_u32(42).map(U22::as_u32), Ok(42));
assert_eq!(U22::from_u32(U22::MAX).map(U22::as_u32), Ok(U22::MAX));
assert_eq!(U22::from_u32(U22::MAX + 1), Err(U22FromU32Error(U22::MAX + 1)));sourcepub const unsafe fn from_u32_unchecked(n: u32) -> Self
pub const unsafe fn from_u32_unchecked(n: u32) -> Self
Methods from Deref<Target = u32>§
pub const MIN: u32 = 0u32
pub const MAX: u32 = 4_294_967_295u32
pub const BITS: u32 = 32u32
Trait Implementations§
source§impl From<U22> for PackedChar
impl From<U22> for PackedChar
source§impl Ord for U22
impl Ord for U22
source§impl PartialOrd for U22
impl PartialOrd for U22
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for U22
impl Eq for U22
impl StructuralPartialEq for U22
Auto Trait Implementations§
impl Freeze for U22
impl RefUnwindSafe for U22
impl Send for U22
impl Sync for U22
impl Unpin for U22
impl UnwindSafe for U22
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