pub struct PowerOfTwo32 { /* private fields */ }Expand description
Represents a power of two, as a 32-bit value, which includes zero.
Implementations§
Source§impl PowerOfTwo32
impl PowerOfTwo32
Sourcepub const ZERO: Self
pub const ZERO: Self
Represents PowerOfTwo32 zero.
Sourcepub const unsafe fn new_unchecked(value: u32) -> Self
pub const unsafe fn new_unchecked(value: u32) -> Self
Creates a new PowerOfTwo32 from a 32-bit value.
§Safety
This function does not validate value. It is up to the
caller to ensure that its value is a power of two.
Sourcepub const fn new(value: u32) -> Result<Self, PowerOfTwoError>
pub const fn new(value: u32) -> Result<Self, PowerOfTwoError>
Creates a new PowerOfTwo32 from a 32-bit value.
§Errors
Returns PowerOfTwoError::NotAPowerOfTwo if value is not a power of two.
Sourcepub const fn value(self) -> u32
pub const fn value(self) -> u32
Returns the underlying value of the PowerOfTwo32.
Trait Implementations§
Source§impl Clone for PowerOfTwo32
impl Clone for PowerOfTwo32
Source§fn clone(&self) -> PowerOfTwo32
fn clone(&self) -> PowerOfTwo32
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PowerOfTwo32
impl Debug for PowerOfTwo32
Source§impl Display for PowerOfTwo32
impl Display for PowerOfTwo32
Source§impl Hash for PowerOfTwo32
impl Hash for PowerOfTwo32
Source§impl PartialEq for PowerOfTwo32
impl PartialEq for PowerOfTwo32
Source§impl ReprC for PowerOfTwo32
impl ReprC for PowerOfTwo32
impl Copy for PowerOfTwo32
impl Eq for PowerOfTwo32
impl StructuralPartialEq for PowerOfTwo32
Auto Trait Implementations§
impl Freeze for PowerOfTwo32
impl RefUnwindSafe for PowerOfTwo32
impl Send for PowerOfTwo32
impl Sync for PowerOfTwo32
impl Unpin for PowerOfTwo32
impl UnsafeUnpin for PowerOfTwo32
impl UnwindSafe for PowerOfTwo32
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