Struct sp_runtime::FixedU128
source · [−]pub struct FixedU128(_);
Expand description
Re-export top-level arithmetic stuff. A fixed point number representation in the range. Fixed Point 128 bits unsigned, range = [0.000000000000000000, 340282366920938463463.374607431768211455]
Implementations
Re-export top-level arithmetic stuff.
Trait Implementations
pub fn deserialize<D>(
deserializer: D
) -> Result<FixedU128, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
pub fn deserialize<D>(
deserializer: D
) -> Result<FixedU128, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Precision of this fixed point implementation. It should be a power of 10
.
Builds this type from an integer number.
Consumes self
and returns the inner raw value.
Creates self from an integer number int
. Read more
Creates self
from an integer number int
. Read more
fn saturating_from_rational<N, D>(n: N, d: D) -> Self where
N: FixedPointOperand,
D: FixedPointOperand,
fn saturating_from_rational<N, D>(n: N, d: D) -> Self where
N: FixedPointOperand,
D: FixedPointOperand,
Creates self
from a rational number. Equal to n / d
. Read more
fn checked_from_rational<N, D>(n: N, d: D) -> Option<Self> where
N: FixedPointOperand,
D: FixedPointOperand,
fn checked_from_rational<N, D>(n: N, d: D) -> Option<Self> where
N: FixedPointOperand,
D: FixedPointOperand,
Creates self
from a rational number. Equal to n / d
. Read more
Checked multiplication for integer type N
. Equal to self * n
. Read more
Saturating multiplication for integer type N
. Equal to self * n
. Read more
Checked division for integer type N
. Equal to self / d
. Read more
Saturating division for integer type N
. Equal to self / d
. Read more
Saturating multiplication for integer type N
, adding the result back.
Equal to self * n + n
. Read more
Saturating absolute value. Read more
Takes the reciprocal (inverse). Equal to 1 / self
. Read more
Returns true
if self
is positive and false
if the number is zero or negative.
Returns true
if self
is negative and false
if the number is zero or positive.
Returns the smallest integer greater than or equal to a number. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Saturating addition. Compute self + rhs
, saturating at the numeric bounds instead of
overflowing. Read more
Saturating subtraction. Compute self - rhs
, saturating at the numeric bounds instead of
overflowing. Read more
Saturating multiply. Compute self * rhs
, saturating at the numeric bounds instead of
overflowing. Read more
Saturating exponentiation. Compute self.pow(exp)
, saturating at the numeric bounds
instead of overflowing. Read more
Increment self by one, saturating.
Decrement self by one, saturating at zero.
Increment self by some amount
, saturating.
Decrement self by some amount
, saturating at zero.
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for FixedU128
impl UnwindSafe for FixedU128
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘimpl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘimpl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
impl<T> HasCompact for T where
T: 'static,
Compact<T>: for<'a> EncodeAsRef<'a, T>,
Compact<T>: Decode,
Compact<T>: From<T>,
Compact<T>: Into<T>,
impl<T> HasCompact for T where
T: 'static,
Compact<T>: for<'a> EncodeAsRef<'a, T>,
Compact<T>: Decode,
Compact<T>: From<T>,
Compact<T>: Into<T>,
impl<T> ThresholdOrd<T> for T where
T: Ord + PartialOrd<T> + Copy + Clone + Zero + Saturating,
impl<T> ThresholdOrd<T> for T where
T: Ord + PartialOrd<T> + Copy + Clone + Zero + Saturating,
The counterpart to unchecked_from
.
Convert from a value of T
into an equivalent instance of Self
.
Consume self to return an equivalent value of T
.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more