[][src]Struct sp_arithmetic::Fixed64

pub struct Fixed64(_);

An unsigned fixed point number. Can hold any value in the range [-9_223_372_036, 9_223_372_036] with fixed point accuracy of one billion.

Methods

impl Fixed64[src]

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

creates self from a natural number.

Note that this might be lossy.

pub fn accuracy() -> i64[src]

Return the accuracy of the type. Given that this function returns the value X, it means that an instance composed of X parts (Fixed64::from_parts(X)) is equal to 1.

pub fn into_inner(self) -> i64[src]

Consume self and return the inner value.

This should only be used for testing.

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

Raw constructor. Equal to parts / 1_000_000_000.

pub fn from_rational(n: i64, d: u64) -> Self[src]

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

Note that this might be lossy.

pub fn saturated_multiply_accumulate<N>(self, int: N) -> N where
    N: TryFrom<u64> + From<u32> + UniqueSaturatedInto<u32> + Bounded + Clone + Saturating + Rem<N, Output = N> + Div<N, Output = N> + Mul<N, Output = N> + Add<N, Output = N>, 
[src]

Performs a saturated multiply and accumulate by unsigned number.

Returns a saturated int + (self * int).

Trait Implementations

impl Add<Fixed64> for Fixed64[src]

Note that this is a standard, potentially-panicking, implementation. Use Saturating trait for safe addition.

type Output = Self

The resulting type after applying the + operator.

impl CheckedAdd for Fixed64[src]

impl CheckedDiv for Fixed64[src]

impl CheckedSub for Fixed64[src]

impl Clone for Fixed64[src]

impl Copy for Fixed64[src]

impl Debug for Fixed64[src]

impl Decode for Fixed64[src]

impl Default for Fixed64[src]

impl Div<Fixed64> for Fixed64[src]

Note that this is a standard, potentially-panicking, implementation. Use CheckedDiv trait for safe division.

type Output = Self

The resulting type after applying the / operator.

impl Encode for Fixed64[src]

impl EncodeLike<Fixed64> for Fixed64[src]

impl Eq for Fixed64[src]

impl Ord for Fixed64[src]

impl PartialEq<Fixed64> for Fixed64[src]

impl PartialOrd<Fixed64> for Fixed64[src]

impl Saturating for Fixed64[src]

impl StructuralEq for Fixed64[src]

impl StructuralPartialEq for Fixed64[src]

impl Sub<Fixed64> for Fixed64[src]

Note that this is a standard, potentially-panicking, implementation. Use Saturating trait for safe subtraction.

type Output = Self

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for Fixed64

impl Send for Fixed64

impl Sync for Fixed64

impl Unpin for Fixed64

impl UnwindSafe for Fixed64

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<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, 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, U> Into<U> for T where
    U: From<T>, 
[src]

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

impl<T> SaturatedConversion for T[src]

impl<T> Saturating for T where
    T: Bounded + CheckedMul + Saturating
[src]

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<T, S> UniqueSaturatedInto<T> for S where
    S: TryInto<T>,
    T: Bounded
[src]