[−][src]Struct pow_of_2::PowOf2
Unsigned integer powers of 2.
Internally just an exponent. Consequentially takes
advantage of bit-manipulation. Runtime-checked to be
valid values of T
.
Methods
impl<T: UInt> PowOf2<T>
[src]
pub fn try_from_exp(exp: u8) -> Option<Self>
[src]
Fails if above T
s domains.
pub fn from_exp(exp: u8) -> Self
[src]
Panics if above T
s domains.
pub fn try_pow(self, p: u8) -> Option<Self>
[src]
Raise self to a power.
Fails if above T
's domain.
pub fn pow(self, p: u8) -> Self
[src]
Raise self to a power.
Panics if above T
's domain.
pub fn pow_neg(self, p: u8) -> Self
[src]
Raise self to a negative power.
Should not panic, simply bottoms out at zero.
pub fn to_uint(self) -> T
[src]
Represent as non-exponent.
Should not fail at this point (would fail earlier).
pub fn exp(self) -> u8
[src]
Get exponent.
impl PowOf2<u8>
[src]
pub const _1: Self
[src]
pub const _2: Self
[src]
pub const _4: Self
[src]
pub const _8: Self
[src]
pub const _16: Self
[src]
pub const _32: Self
[src]
pub const _64: Self
[src]
pub const _128: Self
[src]
impl PowOf2<u16>
[src]
pub const _1: Self
[src]
pub const _2: Self
[src]
pub const _4: Self
[src]
pub const _8: Self
[src]
pub const _16: Self
[src]
pub const _32: Self
[src]
pub const _64: Self
[src]
pub const _128: Self
[src]
pub const _256: Self
[src]
pub const _512: Self
[src]
pub const KIBI: Self
[src]
impl PowOf2<u32>
[src]
pub const _1: Self
[src]
pub const _2: Self
[src]
pub const _4: Self
[src]
pub const _8: Self
[src]
pub const _16: Self
[src]
pub const _32: Self
[src]
pub const _64: Self
[src]
pub const _128: Self
[src]
pub const _256: Self
[src]
pub const _512: Self
[src]
pub const KIBI: Self
[src]
pub const MEBI: Self
[src]
pub const GIBI: Self
[src]
impl PowOf2<u64>
[src]
pub const _1: Self
[src]
pub const _2: Self
[src]
pub const _4: Self
[src]
pub const _8: Self
[src]
pub const _16: Self
[src]
pub const _32: Self
[src]
pub const _64: Self
[src]
pub const _128: Self
[src]
pub const _256: Self
[src]
pub const _512: Self
[src]
pub const KIBI: Self
[src]
pub const MEBI: Self
[src]
pub const GIBI: Self
[src]
pub const TEBI: Self
[src]
pub const PEBI: Self
[src]
pub const EXBI: Self
[src]
impl PowOf2<usize>
[src]
pub const _1: Self
[src]
pub const _2: Self
[src]
pub const _4: Self
[src]
pub const _8: Self
[src]
pub const _16: Self
[src]
pub const _32: Self
[src]
pub const _64: Self
[src]
pub const _128: Self
[src]
pub const _256: Self
[src]
pub const _512: Self
[src]
pub const KIBI: Self
[src]
pub const MEBI: Self
[src]
pub const GIBI: Self
[src]
pub const TEBI: Self
[src]
pub const PEBI: Self
[src]
pub const EXBI: Self
[src]
impl PowOf2<u128>
[src]
pub const _1: Self
[src]
pub const _2: Self
[src]
pub const _4: Self
[src]
pub const _8: Self
[src]
pub const _16: Self
[src]
pub const _32: Self
[src]
pub const _64: Self
[src]
pub const _128: Self
[src]
pub const _256: Self
[src]
pub const _512: Self
[src]
pub const KIBI: Self
[src]
pub const MEBI: Self
[src]
pub const GIBI: Self
[src]
pub const TEBI: Self
[src]
pub const PEBI: Self
[src]
pub const EXBI: Self
[src]
pub const ZEBI: Self
[src]
pub const YOBI: Self
[src]
pub const _2E90: Self
[src]
pub const _2E100: Self
[src]
pub const _2E110: Self
[src]
pub const _2E120: Self
[src]
Trait Implementations
impl<T: Clone + UInt> Clone for PowOf2<T>
[src]
fn clone(&self) -> PowOf2<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Copy + UInt> Copy for PowOf2<T>
[src]
impl<T: UInt> Debug for PowOf2<T>
[src]
impl<T: UInt> Display for PowOf2<T>
[src]
impl<T: UInt> Div<PowOf2<T>> for PowOf2<T>
[src]
type Output = PowOf2<T>
The resulting type after applying the /
operator.
fn div(self, rhs: PowOf2<T>) -> PowOf2<T>
[src]
impl<T: UInt> Div<Two> for PowOf2<T>
[src]
type Output = PowOf2<T>
The resulting type after applying the /
operator.
fn div(self, Two: Two) -> PowOf2<T>
[src]
impl<T: UInt> DivAssign<PowOf2<T>> for PowOf2<T>
[src]
fn div_assign(&mut self, rhs: PowOf2<T>)
[src]
impl<T: UInt> DivAssign<Two> for PowOf2<T>
[src]
fn div_assign(&mut self, Two: Two)
[src]
impl<T: Eq + UInt> Eq for PowOf2<T>
[src]
impl<T: Hash + UInt> Hash for PowOf2<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: UInt> Mul<PowOf2<T>> for PowOf2<T>
[src]
type Output = PowOf2<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: PowOf2<T>) -> PowOf2<T>
[src]
impl<T: UInt> Mul<Two> for PowOf2<T>
[src]
type Output = PowOf2<T>
The resulting type after applying the *
operator.
fn mul(self, Two: Two) -> PowOf2<T>
[src]
impl<T: UInt> MulAssign<PowOf2<T>> for PowOf2<T>
[src]
fn mul_assign(&mut self, rhs: PowOf2<T>)
[src]
impl<T: UInt> MulAssign<Two> for PowOf2<T>
[src]
fn mul_assign(&mut self, Two: Two)
[src]
impl<T: Ord + UInt> Ord for PowOf2<T>
[src]
fn cmp(&self, other: &PowOf2<T>) -> Ordering
[src]
#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: PartialEq + UInt> PartialEq<PowOf2<T>> for PowOf2<T>
[src]
impl<T: PartialOrd + UInt> PartialOrd<PowOf2<T>> for PowOf2<T>
[src]
fn partial_cmp(&self, other: &PowOf2<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &PowOf2<T>) -> bool
[src]
fn le(&self, other: &PowOf2<T>) -> bool
[src]
fn gt(&self, other: &PowOf2<T>) -> bool
[src]
fn ge(&self, other: &PowOf2<T>) -> bool
[src]
impl<T: UInt> StructuralEq for PowOf2<T>
[src]
impl<T: UInt> StructuralPartialEq for PowOf2<T>
[src]
Auto Trait Implementations
impl<T> Send for PowOf2<T> where
T: Send,
T: Send,
impl<T> Sync for PowOf2<T> where
T: Sync,
T: Sync,
impl<T> Unpin for PowOf2<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,