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]
S: TryFrom<C> + Copy + Unsigned + Integer + Bounded,
C: From<S> + Copy + Unsigned + Integer + Bounded + HasOverflowingMul,
D: Default + StaticFractionDescription<C>,
fn new_from_stored(stored: S) -> Self
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).
fn new_from_stored_checked(stored: S) -> Option<Self>
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]
S: TryFrom<C> + Copy + Unsigned + Integer + Bounded,
C: From<S> + Copy + Unsigned + Integer + Bounded + HasOverflowingMul,
D: Default + StaticFractionDescription<C>,
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]
S: TryFrom<C> + Copy + Unsigned + Integer + Bounded,
C: From<S> + Copy + Unsigned + Integer + Bounded + HasOverflowingMul,
D: Default + StaticFractionDescription<C>,
D2: Default + StaticFractionDescription<C>,
fn eq(&self, other: &StaticFraction<S, C, D2>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
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]
S: TryFrom<C> + Copy + Unsigned + Integer + Bounded,
C: From<S> + Copy + Unsigned + Integer + Bounded + HasOverflowingMul,
D: Default + StaticFractionDescription<C>,
D2: Default + StaticFractionDescription<C>,
fn partial_cmp(&self, other: &StaticFraction<S, C, D2>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
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]
S: TryFrom<C> + Copy + Unsigned + Integer + Bounded,
C: From<S> + Copy + Unsigned + Integer + Bounded + HasOverflowingMul,
D: Default + StaticFractionDescription<C>,