Struct staticfraction::StaticFraction [] [src]

pub struct StaticFraction<S, C, D> where
    S: TryFrom<C> + Copy + Unsigned + Integer + Bounded,
    C: From<S> + Copy + Unsigned + Integer + Bounded + HasOverflowingMul,
    D: Default + StaticFractionDescription<C>, 
{ /* fields omitted */ }

Stored numeric datum that is, for all mathematical operations, seen under the transformation described by D.

The valid range for the stored datum depends on D; only numbers x where NUM_OFFSET + x * NUM_FACTOR can be calculated in C without overflowing are admissible.

Methods

impl<S, C, D> StaticFraction<S, C, D> where
    S: TryFrom<C> + Copy + Unsigned + Integer + Bounded,
    C: From<S> + Copy + Unsigned + Integer + Bounded + HasOverflowingMul,
    D: Default + StaticFractionDescription<C>, 
[src]

Create a StaticFraction right from the stored scaled numerator. This is intended for adding semantics to data that already comes along scaled.

The value is only checked for being in the right range if debug assertions are enabled (just like other checks for wrapping behavior).

Variant of new_from_stored that returns out-of-range errors as None options.

Trait Implementations

impl<S: Debug, C: Debug, D: Debug> Debug for StaticFraction<S, C, D> where
    S: TryFrom<C> + Copy + Unsigned + Integer + Bounded,
    C: From<S> + Copy + Unsigned + Integer + Bounded + HasOverflowingMul,
    D: Default + StaticFractionDescription<C>, 
[src]

Formats the value using the given formatter.

impl<S, C, D, D2> PartialEq<StaticFraction<S, C, D2>> for StaticFraction<S, C, D> where
    S: TryFrom<C> + Copy + Unsigned + Integer + Bounded,
    C: From<S> + Copy + Unsigned + Integer + Bounded + HasOverflowingMul,
    D: Default + StaticFractionDescription<C>,
    D2: Default + StaticFractionDescription<C>, 
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<S, C, D, D2> PartialOrd<StaticFraction<S, C, D2>> for StaticFraction<S, C, D> where
    S: TryFrom<C> + Copy + Unsigned + Integer + Bounded,
    C: From<S> + Copy + Unsigned + Integer + Bounded + HasOverflowingMul,
    D: Default + StaticFractionDescription<C>,
    D2: Default + StaticFractionDescription<C>, 
[src]

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<S, C, D> PartialEq<C> for StaticFraction<S, C, D> where
    S: TryFrom<C> + Copy + Unsigned + Integer + Bounded,
    C: From<S> + Copy + Unsigned + Integer + Bounded + HasOverflowingMul,
    D: Default + StaticFractionDescription<C>, 
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.