pub struct Number128(_);
Expand description
A fixed-point decimal number 128 bits wide
Implementations§
source§impl Number128
impl Number128
pub const ONE: Self = _
pub const ZERO: Self = _
pub const MAX: Self = _
pub const MIN: Self = _
pub const BITS: u32 = 128u32
sourcepub fn as_u64(&self, exponent: impl Into<i32>) -> u64
pub fn as_u64(&self, exponent: impl Into<i32>) -> u64
Convert this number to fit in a u64
The precision of the number in the u64 is based on the exponent provided.
sourcepub fn from_decimal(value: impl Into<i128>, exponent: impl Into<i32>) -> Self
pub fn from_decimal(value: impl Into<i128>, exponent: impl Into<i32>) -> Self
Convert another integer
sourcepub fn into_bits(self) -> [u8; 16]
pub fn into_bits(self) -> [u8; 16]
Get the underlying 128-bit representation in bytes. Uses the target endianness of the caller
Trait Implementations§
source§impl AddAssign<Number128> for Number128
impl AddAssign<Number128> for Number128
source§fn add_assign(&mut self, rhs: Number128)
fn add_assign(&mut self, rhs: Number128)
Performs the
+=
operation. Read moresource§impl DivAssign<Number128> for Number128
impl DivAssign<Number128> for Number128
source§fn div_assign(&mut self, rhs: Number128)
fn div_assign(&mut self, rhs: Number128)
Performs the
/=
operation. Read moresource§impl MulAssign<Number128> for Number128
impl MulAssign<Number128> for Number128
source§fn mul_assign(&mut self, rhs: Number128)
fn mul_assign(&mut self, rhs: Number128)
Performs the
*=
operation. Read moresource§impl Ord for Number128
impl Ord for Number128
source§impl PartialEq<Number128> for Number128
impl PartialEq<Number128> for Number128
source§impl PartialOrd<Number128> for Number128
impl PartialOrd<Number128> for Number128
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 moresource§impl SubAssign<Number128> for Number128
impl SubAssign<Number128> for Number128
source§fn sub_assign(&mut self, rhs: Number128)
fn sub_assign(&mut self, rhs: Number128)
Performs the
-=
operation. Read moreimpl Copy for Number128
impl Eq for Number128
impl Pod for Number128
impl StructuralEq for Number128
impl StructuralPartialEq for Number128
Auto Trait Implementations§
impl RefUnwindSafe for Number128
impl Send for Number128
impl Sync for Number128
impl Unpin for Number128
impl UnwindSafe for Number128
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.