Struct amplify_num::u24
source · [−]pub struct u24(_);Expand description
24-bit unsigned integer in the range 0..16_777_216
Implementations
sourceimpl u24
impl u24
sourceimpl u24
impl u24
sourcepub fn checked_add<T>(self, rhs: T) -> Option<Self> where
T: Into<u32>,
pub fn checked_add<T>(self, rhs: T) -> Option<Self> where
T: Into<u32>,
Checked integer addition. Computes self + rhs, returning None if
overflow occurred.
sourcepub fn saturating_add<T>(self, rhs: T) -> Self where
T: Into<u32>,
pub fn saturating_add<T>(self, rhs: T) -> Self where
T: Into<u32>,
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<u32>,
pub fn overflowing_add<T>(self, rhs: T) -> (Self, bool) where
T: Into<u32>,
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<u32>,
pub fn wrapping_add<T>(self, rhs: T) -> Self where
T: Into<u32>,
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<u32>,
pub fn checked_sub<T>(self, rhs: T) -> Option<Self> where
T: Into<u32>,
Checked integer subtraction. Computes self - rhs, returning None if
overflow occurred.
sourcepub fn saturating_sub<T>(self, rhs: T) -> Self where
T: Into<u32>,
pub fn saturating_sub<T>(self, rhs: T) -> Self where
T: Into<u32>,
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<u32>,
pub fn overflowing_sub<T>(self, rhs: T) -> (Self, bool) where
T: Into<u32>,
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<u32>,
pub fn wrapping_sub<T>(self, rhs: T) -> Self where
T: Into<u32>,
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<u32>,
pub fn checked_mul<T>(self, rhs: T) -> Option<Self> where
T: Into<u32>,
Checked integer multiplication. Computes self * rhs, returning None if
overflow occurred.
sourcepub fn saturating_mul<T>(self, rhs: T) -> Self where
T: Into<u32>,
pub fn saturating_mul<T>(self, rhs: T) -> Self where
T: Into<u32>,
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<u32>,
pub fn overflowing_mul<T>(self, rhs: T) -> (Self, bool) where
T: Into<u32>,
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<u32>,
pub fn wrapping_mul<T>(self, rhs: T) -> Self where
T: Into<u32>,
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>
sourceimpl u24
impl u24
sourcepub fn from_le_bytes(bytes: [u8; 3]) -> u24
pub fn from_le_bytes(bytes: [u8; 3]) -> u24
Create a native endian integer value from its representation as a byte array in little endian.
sourcepub fn to_le_bytes(self) -> [u8; 3]
pub fn to_le_bytes(self) -> [u8; 3]
Return the memory representation of this integer as a byte array in little-endian byte order.
sourcepub fn from_be_bytes(bytes: [u8; 3]) -> u24
pub fn from_be_bytes(bytes: [u8; 3]) -> u24
Create a native endian integer value from its representation as a byte array in big endian.
sourcepub fn to_be_bytes(self) -> [u8; 3]
pub fn to_be_bytes(self) -> [u8; 3]
Return the memory representation of this integer as a byte array in big-endian byte order.
sourcepub fn into_isize(self) -> isize
pub fn into_isize(self) -> isize
Converts into isize type.
sourcepub fn into_usize(self) -> usize
pub fn into_usize(self) -> usize
Converts into usize type.
Trait Implementations
sourceimpl<T> AddAssign<T> for u24 where
T: Into<u32>,
impl<T> AddAssign<T> for u24 where
T: Into<u32>,
sourcefn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the += operation. Read more
sourceimpl<T> BitAndAssign<T> for u24 where
T: Into<u32>,
impl<T> BitAndAssign<T> for u24 where
T: Into<u32>,
sourcefn bitand_assign(&mut self, rhs: T)
fn bitand_assign(&mut self, rhs: T)
Performs the &= operation. Read more
sourceimpl<T> BitOrAssign<T> for u24 where
T: Into<u32>,
impl<T> BitOrAssign<T> for u24 where
T: Into<u32>,
sourcefn bitor_assign(&mut self, rhs: T)
fn bitor_assign(&mut self, rhs: T)
Performs the |= operation. Read more
sourceimpl<T> BitXorAssign<T> for u24 where
T: Into<u32>,
impl<T> BitXorAssign<T> for u24 where
T: Into<u32>,
sourcefn bitxor_assign(&mut self, rhs: T)
fn bitxor_assign(&mut self, rhs: T)
Performs the ^= operation. Read more
sourceimpl<T> DivAssign<T> for u24 where
T: Into<u32>,
impl<T> DivAssign<T> for u24 where
T: Into<u32>,
sourcefn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the /= operation. Read more
sourceimpl<T> MulAssign<T> for u24 where
T: Into<u32>,
impl<T> MulAssign<T> for u24 where
T: Into<u32>,
sourcefn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the *= operation. Read more
sourceimpl Ord for u24
impl Ord for u24
sourceimpl PartialOrd<u24> for u24
impl PartialOrd<u24> for u24
sourcefn partial_cmp(&self, other: &u24) -> Option<Ordering>
fn partial_cmp(&self, other: &u24) -> 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 u24 where
T: Into<u32>,
impl<T> RemAssign<T> for u24 where
T: Into<u32>,
sourcefn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
Performs the %= operation. Read more
sourceimpl<T> ShlAssign<T> for u24 where
T: Into<u32>,
impl<T> ShlAssign<T> for u24 where
T: Into<u32>,
sourcefn shl_assign(&mut self, rhs: T)
fn shl_assign(&mut self, rhs: T)
Performs the <<= operation. Read more
sourceimpl<T> ShrAssign<T> for u24 where
T: Into<u32>,
impl<T> ShrAssign<T> for u24 where
T: Into<u32>,
sourcefn shr_assign(&mut self, rhs: T)
fn shr_assign(&mut self, rhs: T)
Performs the >>= operation. Read more
sourceimpl<T> SubAssign<T> for u24 where
T: Into<u32>,
impl<T> SubAssign<T> for u24 where
T: Into<u32>,
sourcefn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the -= operation. Read more
impl Copy for u24
impl Eq for u24
impl StructuralEq for u24
impl StructuralPartialEq for u24
Auto Trait Implementations
impl RefUnwindSafe for u24
impl Send for u24
impl Sync for u24
impl Unpin for u24
impl UnwindSafe for u24
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