pub struct PowerOfTwo(/* private fields */);Expand description
Represents an integral power-of-two as an exponent.
Implementations§
Source§impl PowerOfTwo
 
impl PowerOfTwo
Sourcepub fn floor<F: Into<u32>>(f: F) -> PowerOfTwo
 
pub fn floor<F: Into<u32>>(f: F) -> PowerOfTwo
Converts a number two the nearest PowerOfTwo less-than-or-equal to it.
Sourcepub fn ceiling<F: Into<u32>>(f: F) -> PowerOfTwo
 
pub fn ceiling<F: Into<u32>>(f: F) -> PowerOfTwo
Converts a number two the nearest PowerOfTwo greater-than-or-equal to
it.
Sourcepub fn zero() -> PowerOfTwo
 
pub fn zero() -> PowerOfTwo
Creates a new PowerOfTwo representing the number zero.
Sourcepub fn as_num<F: From<u32>>(self) -> F
 
pub fn as_num<F: From<u32>>(self) -> F
Converts a PowerOfTwo to a number.
Trait Implementations§
Source§impl Clone for PowerOfTwo
 
impl Clone for PowerOfTwo
Source§fn clone(&self) -> PowerOfTwo
 
fn clone(&self) -> PowerOfTwo
Returns a copy 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 PowerOfTwo
 
impl Debug for PowerOfTwo
Source§impl Ord for PowerOfTwo
 
impl Ord for PowerOfTwo
Source§fn cmp(&self, other: &PowerOfTwo) -> Ordering
 
fn cmp(&self, other: &PowerOfTwo) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
    Self: Sized,
 
fn max(self, other: Self) -> Selfwhere
    Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PowerOfTwo
 
impl PartialEq for PowerOfTwo
Source§impl PartialOrd for PowerOfTwo
 
impl PartialOrd for PowerOfTwo
impl Copy for PowerOfTwo
impl Eq for PowerOfTwo
impl StructuralPartialEq for PowerOfTwo
Auto Trait Implementations§
impl Freeze for PowerOfTwo
impl RefUnwindSafe for PowerOfTwo
impl Send for PowerOfTwo
impl Sync for PowerOfTwo
impl Unpin for PowerOfTwo
impl UnwindSafe for PowerOfTwo
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