[][src]Struct orml_utilities::fixed_u128::FixedU128

pub struct FixedU128(_);

An unsigned fixed point number. Can hold any value in the range [0, 340_282_366_920_938_463_464] with fixed point accuracy of 10 ** 18.

Implementations

impl FixedU128[src]

pub fn from_natural(int: u128) -> Self[src]

Create self from a natural number.

Note that this might be lossy.

pub const fn accuracy() -> u128[src]

Accuracy of FixedU128.

pub fn from_parts(parts: u128) -> Self[src]

Raw constructor. Equal to parts / DIV.

pub fn from_rational<N: UniqueSaturatedInto<u128>>(n: N, d: N) -> Self[src]

Creates self from a rational number. Equal to n/d.

Note that this might be lossy.

pub fn deconstruct(self) -> u128[src]

Consume self and return the inner raw u128 value.

Note this is a low level function, as the returned value is represented with accuracy.

pub fn recip(&self) -> Option<Self>[src]

Takes the reciprocal(inverse) of FixedU128, 1/x

pub fn checked_add(&self, rhs: &Self) -> Option<Self>[src]

Checked add. Same semantic to num_traits::CheckedAdd.

pub fn checked_sub(&self, rhs: &Self) -> Option<Self>[src]

Checked sub. Same semantic to num_traits::CheckedSub.

pub fn checked_mul(&self, rhs: &Self) -> Option<Self>[src]

Checked mul. Same semantic to num_traits::CheckedMul.

pub fn checked_div(&self, rhs: &Self) -> Option<Self>[src]

Checked div. Same semantic to num_traits::CheckedDiv.

pub fn checked_mul_int<N>(&self, other: &N) -> Option<N> where
    N: Copy + TryFrom<u128> + TryInto<u128>, 
[src]

Checked mul for int type N.

pub fn saturating_mul_int<N>(&self, other: &N) -> N where
    N: Copy + TryFrom<u128> + TryInto<u128> + Bounded
[src]

Checked mul for int type N.

pub fn checked_div_int<N>(&self, other: &N) -> Option<N> where
    N: Copy + TryFrom<u128> + TryInto<u128>, 
[src]

Checked div for int type N.

pub fn zero() -> Self[src]

pub fn is_zero(&self) -> bool[src]

Trait Implementations

impl Bounded for FixedU128[src]

impl Clone for FixedU128[src]

impl CompactAs for FixedU128[src]

type As = u128

A compact-encodable type that should be used as the encoding.

impl Copy for FixedU128[src]

impl Debug for FixedU128[src]

impl Decode for FixedU128[src]

impl Default for FixedU128[src]

impl<'de> Deserialize<'de> for FixedU128[src]

impl Encode for FixedU128[src]

impl EncodeLike<FixedU128> for FixedU128[src]

impl Eq for FixedU128[src]

impl From<Compact<FixedU128>> for FixedU128[src]

impl From<Perbill> for FixedU128[src]

impl From<Percent> for FixedU128[src]

impl From<Permill> for FixedU128[src]

impl From<Perquintill> for FixedU128[src]

impl Ord for FixedU128[src]

impl PartialEq<FixedU128> for FixedU128[src]

impl PartialOrd<FixedU128> for FixedU128[src]

impl Saturating for FixedU128[src]

impl Serialize for FixedU128[src]

impl StructuralEq for FixedU128[src]

impl StructuralPartialEq for FixedU128[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<T> Clear for T where
    T: InitializableFromZeroed + ?Sized

impl<T> Clear for T where
    T: PartialEq<T> + Eq + Default
[src]

impl<S> Codec for S where
    S: Encode + Decode
[src]

impl<T, X> Decode for X where
    T: Decode + Into<X>,
    X: WrapperTypeDecode<Wrapped = T>, 
[src]

impl<T> DecodeAll for T where
    T: Decode
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T, X> Encode for X where
    T: Encode + ?Sized,
    X: WrapperTypeEncode<Target = T>, 
[src]

impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ mut T> for T where
    T: Encode
[src]

impl<T> EncodeLike<Arc<T>> for T where
    T: Encode
[src]

impl<T> EncodeLike<Box<T>> for T where
    T: Encode
[src]

impl<'a, T> EncodeLike<Cow<'a, T>> for T where
    T: Encode + ToOwned
[src]

impl<T> EncodeLike<Rc<T>> for T where
    T: Encode
[src]

impl<T> From<T> for T[src]

impl<S> FullCodec for S where
    S: Decode + FullEncode
[src]

impl<S> FullEncode for S where
    S: Encode + EncodeLike<S>, 
[src]

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>,
    Compact<T>: Clone,
    Compact<T>: PartialEq<Compact<T>>,
    Compact<T>: Eq,
    Compact<T>: MaybeDebugSerde, 
[src]

type Type = Compact<T>

The compact type; this can be

impl<T> Hashable for T where
    T: Codec
[src]

impl<T> InitializableFromZeroed for T where
    T: Default

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    Outer: AsRef<T> + AsMut<T> + From<T>,
    T: From<Outer>, 
[src]

fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> KeyedVec for T where
    T: Codec
[src]

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

impl<T> MaybeSerialize for T where
    T: Serialize
[src]

impl<T> MaybeSerializeDeserialize for T where
    T: DeserializeOwned + Serialize
[src]

impl<T> Member for T where
    T: 'static + Clone + PartialEq<T> + Eq + Send + Sync + Debug
[src]

impl<T> Parameter for T where
    T: Codec + EncodeLike<T> + Clone + Eq + Debug
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

impl<T> Saturating for T where
    T: Clone + Bounded + One + CheckedMul + Saturating

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedFrom<T> for S where
    S: TryFrom<T> + Bounded

impl<T, S> UniqueSaturatedInto<T> for S where
    S: TryInto<T>,
    T: Bounded

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,