Struct amplify_num::u4
source · [−]pub struct u4(_);Expand description
4-bit unsigned integer in the range 0..16
Implementations
sourceimpl u4
impl u4
sourceimpl u4
impl u4
sourcepub fn checked_add<T>(self, rhs: T) -> Option<Self> where
T: Into<u8>,
pub fn checked_add<T>(self, rhs: T) -> Option<Self> where
T: Into<u8>,
Checked integer addition. Computes self + rhs, returning None if
overflow occurred.
sourcepub fn saturating_add<T>(self, rhs: T) -> Self where
T: Into<u8>,
pub fn saturating_add<T>(self, rhs: T) -> Self where
T: Into<u8>,
Saturating integer addition. Computes self + rhs, saturating at the
numeric bounds instead of overflowing.
sourcepub fn overflowing_add<T>(self, rhs: T) -> (Self, bool) where
T: Into<u8>,
pub fn overflowing_add<T>(self, rhs: T) -> (Self, bool) where
T: Into<u8>,
Calculates self + rhs
Returns a tuple of the addition along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
sourcepub fn wrapping_add<T>(self, rhs: T) -> Self where
T: Into<u8>,
pub fn wrapping_add<T>(self, rhs: T) -> Self where
T: Into<u8>,
Wrapping (modular) addition. Computes self + rhs, wrapping around at
the boundary of the type.
sourcepub fn checked_sub<T>(self, rhs: T) -> Option<Self> where
T: Into<u8>,
pub fn checked_sub<T>(self, rhs: T) -> Option<Self> where
T: Into<u8>,
Checked integer subtraction. Computes self - rhs, returning None if
overflow occurred.
sourcepub fn saturating_sub<T>(self, rhs: T) -> Self where
T: Into<u8>,
pub fn saturating_sub<T>(self, rhs: T) -> Self where
T: Into<u8>,
Saturating integer subtraction. Computes self - rhs, saturating at the
numeric bounds instead of overflowing.
sourcepub fn overflowing_sub<T>(self, rhs: T) -> (Self, bool) where
T: Into<u8>,
pub fn overflowing_sub<T>(self, rhs: T) -> (Self, bool) where
T: Into<u8>,
Calculates self - rhs
Returns a tuple of the subtraction along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
sourcepub fn wrapping_sub<T>(self, rhs: T) -> Self where
T: Into<u8>,
pub fn wrapping_sub<T>(self, rhs: T) -> Self where
T: Into<u8>,
Wrapping (modular) subtraction. Computes self - rhs, wrapping around at
the boundary of the type.
sourcepub fn checked_mul<T>(self, rhs: T) -> Option<Self> where
T: Into<u8>,
pub fn checked_mul<T>(self, rhs: T) -> Option<Self> where
T: Into<u8>,
Checked integer multiplication. Computes self * rhs, returning None if
overflow occurred.
sourcepub fn saturating_mul<T>(self, rhs: T) -> Self where
T: Into<u8>,
pub fn saturating_mul<T>(self, rhs: T) -> Self where
T: Into<u8>,
Saturating integer multiplication. Computes self * rhs, saturating at the
numeric bounds instead of overflowing.
sourcepub fn overflowing_mul<T>(self, rhs: T) -> (Self, bool) where
T: Into<u8>,
pub fn overflowing_mul<T>(self, rhs: T) -> (Self, bool) where
T: Into<u8>,
Calculates self * rhs
Returns a tuple of the multiplication along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
sourcepub fn wrapping_mul<T>(self, rhs: T) -> Self where
T: Into<u8>,
pub fn wrapping_mul<T>(self, rhs: T) -> Self where
T: Into<u8>,
Wrapping (modular) multiplication. Computes self * rhs, wrapping around at
the boundary of the type.
pub fn div_rem(self, other: Self) -> Result<(Self, Self), DivError>
Trait Implementations
sourceimpl<T> AddAssign<T> for u4 where
T: Into<u8>,
impl<T> AddAssign<T> for u4 where
T: Into<u8>,
sourcefn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the += operation. Read more
sourceimpl<T> BitAndAssign<T> for u4 where
T: Into<u8>,
impl<T> BitAndAssign<T> for u4 where
T: Into<u8>,
sourcefn bitand_assign(&mut self, rhs: T)
fn bitand_assign(&mut self, rhs: T)
Performs the &= operation. Read more
sourceimpl<T> BitOrAssign<T> for u4 where
T: Into<u8>,
impl<T> BitOrAssign<T> for u4 where
T: Into<u8>,
sourcefn bitor_assign(&mut self, rhs: T)
fn bitor_assign(&mut self, rhs: T)
Performs the |= operation. Read more
sourceimpl<T> BitXorAssign<T> for u4 where
T: Into<u8>,
impl<T> BitXorAssign<T> for u4 where
T: Into<u8>,
sourcefn bitxor_assign(&mut self, rhs: T)
fn bitxor_assign(&mut self, rhs: T)
Performs the ^= operation. Read more
sourceimpl<T> DivAssign<T> for u4 where
T: Into<u8>,
impl<T> DivAssign<T> for u4 where
T: Into<u8>,
sourcefn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the /= operation. Read more
sourceimpl<T> MulAssign<T> for u4 where
T: Into<u8>,
impl<T> MulAssign<T> for u4 where
T: Into<u8>,
sourcefn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the *= operation. Read more
sourceimpl Ord for u4
impl Ord for u4
sourceimpl PartialOrd<u4> for u4
impl PartialOrd<u4> for u4
sourcefn partial_cmp(&self, other: &u4) -> Option<Ordering>
fn partial_cmp(&self, other: &u4) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl<T> RemAssign<T> for u4 where
T: Into<u8>,
impl<T> RemAssign<T> for u4 where
T: Into<u8>,
sourcefn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
Performs the %= operation. Read more
sourceimpl<T> ShlAssign<T> for u4 where
T: Into<u8>,
impl<T> ShlAssign<T> for u4 where
T: Into<u8>,
sourcefn shl_assign(&mut self, rhs: T)
fn shl_assign(&mut self, rhs: T)
Performs the <<= operation. Read more
sourceimpl<T> ShrAssign<T> for u4 where
T: Into<u8>,
impl<T> ShrAssign<T> for u4 where
T: Into<u8>,
sourcefn shr_assign(&mut self, rhs: T)
fn shr_assign(&mut self, rhs: T)
Performs the >>= operation. Read more
sourceimpl<T> SubAssign<T> for u4 where
T: Into<u8>,
impl<T> SubAssign<T> for u4 where
T: Into<u8>,
sourcefn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the -= operation. Read more
impl Copy for u4
impl Eq for u4
impl StructuralEq for u4
impl StructuralPartialEq for u4
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more