pub struct u48(/* private fields */);
Expand description
48-bit unsigned integer in the range 0..2^48
Implementations§
Source§impl u48
impl u48
Source§impl u48
impl u48
Sourcepub fn checked_add<T>(self, rhs: T) -> Option<u48>
pub fn checked_add<T>(self, rhs: T) -> Option<u48>
Checked integer addition. Computes self + rhs
, returning None
if
overflow occurred.
Sourcepub fn saturating_add<T>(self, rhs: T) -> u48
pub fn saturating_add<T>(self, rhs: T) -> u48
Saturating integer addition. Computes self + rhs
, saturating at the
numeric bounds instead of overflowing.
Sourcepub fn overflowing_add<T>(self, rhs: T) -> (u48, bool)
pub fn overflowing_add<T>(self, rhs: T) -> (u48, bool)
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) -> u48
pub fn wrapping_add<T>(self, rhs: T) -> u48
Wrapping (modular) addition. Computes self + rhs
, wrapping around at
the boundary of the type.
Sourcepub fn checked_sub<T>(self, rhs: T) -> Option<u48>
pub fn checked_sub<T>(self, rhs: T) -> Option<u48>
Checked integer subtraction. Computes self - rhs
, returning None
if
overflow occurred.
Sourcepub fn saturating_sub<T>(self, rhs: T) -> u48
pub fn saturating_sub<T>(self, rhs: T) -> u48
Saturating integer subtraction. Computes self - rhs
, saturating at the
numeric bounds instead of overflowing.
Sourcepub fn overflowing_sub<T>(self, rhs: T) -> (u48, bool)
pub fn overflowing_sub<T>(self, rhs: T) -> (u48, bool)
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) -> u48
pub fn wrapping_sub<T>(self, rhs: T) -> u48
Wrapping (modular) subtraction. Computes self - rhs
, wrapping around at
the boundary of the type.
Sourcepub fn checked_mul<T>(self, rhs: T) -> Option<u48>
pub fn checked_mul<T>(self, rhs: T) -> Option<u48>
Checked integer multiplication. Computes self * rhs
, returning None
if
overflow occurred.
Sourcepub fn saturating_mul<T>(self, rhs: T) -> u48
pub fn saturating_mul<T>(self, rhs: T) -> u48
Saturating integer multiplication. Computes self * rhs
, saturating at the
numeric bounds instead of overflowing.
Sourcepub fn overflowing_mul<T>(self, rhs: T) -> (u48, bool)
pub fn overflowing_mul<T>(self, rhs: T) -> (u48, bool)
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) -> u48
pub fn wrapping_mul<T>(self, rhs: T) -> u48
Wrapping (modular) multiplication. Computes self * rhs
, wrapping around at
the boundary of the type.
pub fn div_rem(self, other: u48) -> Result<(u48, u48), DivError>
Source§impl u48
impl u48
Sourcepub fn from_le_bytes(bytes: [u8; 6]) -> u48
pub fn from_le_bytes(bytes: [u8; 6]) -> u48
Create a native endian integer value from its representation as a byte array in little endian.
Sourcepub fn to_le_bytes(self) -> [u8; 6]
pub fn to_le_bytes(self) -> [u8; 6]
Return the memory representation of this integer as a byte array in little-endian byte order.
Sourcepub fn from_be_bytes(bytes: [u8; 6]) -> u48
pub fn from_be_bytes(bytes: [u8; 6]) -> u48
Create a native endian integer value from its representation as a byte array in big endian.
Sourcepub fn to_be_bytes(self) -> [u8; 6]
pub fn to_be_bytes(self) -> [u8; 6]
Return the memory representation of this integer as a byte array in big-endian byte order.
Sourcepub const fn into_isize(self) -> isize
pub const fn into_isize(self) -> isize
Converts into isize
type.
Sourcepub const fn into_usize(self) -> usize
pub const fn into_usize(self) -> usize
Converts into usize
type.
Trait Implementations§
Source§impl<T> AddAssign<T> for u48
impl<T> AddAssign<T> for u48
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+=
operation. Read moreSource§impl<T> BitAndAssign<T> for u48
impl<T> BitAndAssign<T> for u48
Source§fn bitand_assign(&mut self, rhs: T)
fn bitand_assign(&mut self, rhs: T)
&=
operation. Read moreSource§impl<T> BitOrAssign<T> for u48
impl<T> BitOrAssign<T> for u48
Source§fn bitor_assign(&mut self, rhs: T)
fn bitor_assign(&mut self, rhs: T)
|=
operation. Read moreSource§impl<T> BitXorAssign<T> for u48
impl<T> BitXorAssign<T> for u48
Source§fn bitxor_assign(&mut self, rhs: T)
fn bitxor_assign(&mut self, rhs: T)
^=
operation. Read moreSource§impl<T> DivAssign<T> for u48
impl<T> DivAssign<T> for u48
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/=
operation. Read moreSource§impl<T> MulAssign<T> for u48
impl<T> MulAssign<T> for u48
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*=
operation. Read moreSource§impl Ord for u48
impl Ord for u48
Source§impl PartialOrd for u48
impl PartialOrd for u48
Source§impl<T> RemAssign<T> for u48
impl<T> RemAssign<T> for u48
Source§fn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
%=
operation. Read moreSource§impl<T> ShlAssign<T> for u48
impl<T> ShlAssign<T> for u48
Source§fn shl_assign(&mut self, rhs: T)
fn shl_assign(&mut self, rhs: T)
<<=
operation. Read moreSource§impl<T> ShrAssign<T> for u48
impl<T> ShrAssign<T> for u48
Source§fn shr_assign(&mut self, rhs: T)
fn shr_assign(&mut self, rhs: T)
>>=
operation. Read moreSource§impl<T> SubAssign<T> for u48
impl<T> SubAssign<T> for u48
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
-=
operation. Read moreimpl Copy for u48
impl Eq for u48
impl StructuralPartialEq for u48
Auto Trait Implementations§
impl Freeze for u48
impl RefUnwindSafe for u48
impl Send for u48
impl Sync for u48
impl Unpin for u48
impl UnwindSafe for u48
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes