pub struct FixedI128(/* private fields */);Expand description
A fixed point number representation in the range.
Fixed Point 128 bits signed, range = [-170141183460469231731.687303715884105728, 170141183460469231731.687303715884105727]
Implementations§
Source§impl FixedI128
impl FixedI128
Sourcepub const fn from_inner(inner: i128) -> Self
pub const fn from_inner(inner: i128) -> Self
const version of FixedPointNumber::from_inner.
pub fn from_fraction(x: f64) -> Self
pub fn to_fraction(self) -> f64
Trait Implementations§
Source§impl CheckedAdd for FixedI128
impl CheckedAdd for FixedI128
Source§fn checked_add(&self, rhs: &Self) -> Option<Self>
fn checked_add(&self, rhs: &Self) -> Option<Self>
Adds two numbers, checking for overflow. If overflow happens,
None is
returned.Source§impl CheckedDiv for FixedI128
impl CheckedDiv for FixedI128
Source§fn checked_div(&self, other: &Self) -> Option<Self>
fn checked_div(&self, other: &Self) -> Option<Self>
Divides two numbers, checking for underflow, overflow and division by
zero. If any of that happens,
None is returned.Source§impl CheckedMul for FixedI128
impl CheckedMul for FixedI128
Source§fn checked_mul(&self, other: &Self) -> Option<Self>
fn checked_mul(&self, other: &Self) -> Option<Self>
Multiplies two numbers, checking for underflow or overflow. If underflow
or overflow happens,
None is returned.Source§impl CheckedSub for FixedI128
impl CheckedSub for FixedI128
Source§fn checked_sub(&self, rhs: &Self) -> Option<Self>
fn checked_sub(&self, rhs: &Self) -> Option<Self>
Subtracts two numbers, checking for underflow. If underflow happens,
None is returned.Source§impl Decode for FixedI128
impl Decode for FixedI128
Source§impl<'de> Deserialize<'de> for FixedI128
impl<'de> Deserialize<'de> for FixedI128
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Encode for FixedI128
impl Encode for FixedI128
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
Source§fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl FixedPointNumber for FixedI128
impl FixedPointNumber for FixedI128
Source§const DIV: Self::Inner = {transmute(0x00000000000000000de0b6b3a7640000): <fixed_point::FixedI128 as fixed_point::FixedPointNumber>::Inner}
const DIV: Self::Inner = {transmute(0x00000000000000000de0b6b3a7640000): <fixed_point::FixedI128 as fixed_point::FixedPointNumber>::Inner}
Precision of this fixed point implementation. It should be a power of
10.Source§fn from_inner(inner: Self::Inner) -> Self
fn from_inner(inner: Self::Inner) -> Self
Builds this type from an integer number.
Source§fn into_inner(self) -> Self::Inner
fn into_inner(self) -> Self::Inner
Consumes
self and returns the inner raw value.Source§fn saturating_from_integer<N: FixedPointOperand>(int: N) -> Self
fn saturating_from_integer<N: FixedPointOperand>(int: N) -> Self
Creates self from an integer number
int. Read moreSource§fn checked_from_integer(int: Self::Inner) -> Option<Self>
fn checked_from_integer(int: Self::Inner) -> Option<Self>
Source§fn saturating_from_rational<N: FixedPointOperand, D: FixedPointOperand>(
n: N,
d: D,
) -> Self
fn saturating_from_rational<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D, ) -> Self
Source§fn checked_from_rational<N: FixedPointOperand, D: FixedPointOperand>(
n: N,
d: D,
) -> Option<Self>
fn checked_from_rational<N: FixedPointOperand, D: FixedPointOperand>( n: N, d: D, ) -> Option<Self>
Source§fn checked_mul_int<N: FixedPointOperand>(self, n: N) -> Option<N>
fn checked_mul_int<N: FixedPointOperand>(self, n: N) -> Option<N>
Source§fn saturating_mul_int<N: FixedPointOperand>(self, n: N) -> N
fn saturating_mul_int<N: FixedPointOperand>(self, n: N) -> N
Source§fn checked_div_int<N: FixedPointOperand>(self, d: N) -> Option<N>
fn checked_div_int<N: FixedPointOperand>(self, d: N) -> Option<N>
Source§fn saturating_div_int<N: FixedPointOperand>(self, d: N) -> N
fn saturating_div_int<N: FixedPointOperand>(self, d: N) -> N
Source§fn saturating_mul_acc_int<N: FixedPointOperand>(self, n: N) -> N
fn saturating_mul_acc_int<N: FixedPointOperand>(self, n: N) -> N
Saturating multiplication for integer type
N, adding the result back.
Equal to self * n + n. Read moreSource§fn saturating_abs(self) -> Self
fn saturating_abs(self) -> Self
Saturating absolute value. Read more
Source§fn reciprocal(self) -> Option<Self>
fn reciprocal(self) -> Option<Self>
Takes the reciprocal (inverse). Equal to
1 / self. Read moreSource§fn is_positive(self) -> bool
fn is_positive(self) -> bool
Returns
true if self is positive and false if the number is zero or negative.Source§fn is_negative(self) -> bool
fn is_negative(self) -> bool
Returns
true if self is negative and false if the number is zero or positive.Source§impl<N: FixedPointOperand, D: FixedPointOperand> From<(N, D)> for FixedI128
impl<N: FixedPointOperand, D: FixedPointOperand> From<(N, D)> for FixedI128
Source§impl Ord for FixedI128
impl Ord for FixedI128
Source§impl PartialOrd for FixedI128
impl PartialOrd for FixedI128
Source§impl Saturating for FixedI128
impl Saturating for FixedI128
Source§fn saturating_add(self, rhs: Self) -> Self
fn saturating_add(self, rhs: Self) -> Self
Saturating addition. Compute
self + rhs, saturating at the numeric bounds instead of
overflowing.Source§fn saturating_sub(self, rhs: Self) -> Self
fn saturating_sub(self, rhs: Self) -> Self
Saturating subtraction. Compute
self - rhs, saturating at the numeric bounds instead of
overflowing.Source§fn saturating_mul(self, rhs: Self) -> Self
fn saturating_mul(self, rhs: Self) -> Self
Saturating multiply. Compute
self * rhs, saturating at the numeric bounds instead of
overflowing.Source§fn saturating_pow(self, exp: usize) -> Self
fn saturating_pow(self, exp: usize) -> Self
Saturating exponentiation. Compute
self.pow(exp), saturating at the numeric bounds
instead of overflowing.impl Copy for FixedI128
impl EncodeLike for FixedI128
impl Eq for FixedI128
impl StructuralPartialEq for FixedI128
Auto Trait Implementations§
impl Freeze for FixedI128
impl RefUnwindSafe for FixedI128
impl Send for FixedI128
impl Sync for FixedI128
impl Unpin for FixedI128
impl UnwindSafe for FixedI128
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<T> LowerBounded for Twhere
T: Bounded,
impl<T> LowerBounded for Twhere
T: Bounded,
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T. Read moreSource§impl<T, S> UniqueSaturatedFrom<T> for S
impl<T, S> UniqueSaturatedFrom<T> for S
Source§fn unique_saturated_from(t: T) -> S
fn unique_saturated_from(t: T) -> S
Convert from a value of
T into an equivalent instance of Self.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T.