Struct kernel::utilities::math::PowerOfTwo
source · 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§fn eq(&self, other: &PowerOfTwo) -> bool
fn eq(&self, other: &PowerOfTwo) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for PowerOfTwo
impl PartialOrd for PowerOfTwo
source§fn partial_cmp(&self, other: &PowerOfTwo) -> Option<Ordering>
fn partial_cmp(&self, other: &PowerOfTwo) -> Option<Ordering>
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 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)