Struct ketos::integer::Ratio [] [src]

pub struct Ratio(_);

Arbitrary precision signed integer ratio

Methods

impl Ratio
[src]

Constructs a Ratio from numerator and denominator.

Panics

Panics if denom is zero.

Creates a Ratio with the value of the given f32. Returns None if the value cannot be converted.

Creates a Ratio with the value of the given f64. Returns None if the value cannot be converted.

Creates a Ratio from an Integer value.

Returns the Ratio as an f32 value.

Returns the Ratio as an f64 value.

Truncates a Ratio and returns the whole portion as an Integer.

Returns whether the Ratio is an integer; i.e. its denominator is 1.

Returns the absolute value of the Ratio.

Returns the Ratio rounded towards positive infinity.

Returns the Ratio rounded towards negative infinity.

Returns the fractional portion of a Ratio.

Returns the Ratio rounded to the nearest integer. Rounds half-way cases away from zero.

Returns the Ratio rounded towards zero.

Returns the reciprocal of a Ratio.

Panics

Panics if the numerator is zero.

Returns the Ratio's numerator.

Returns the Ratio's denominator.

Returns whether the Ratio is equal to zero.

Returns whether the Ratio is less than zero.

Returns whether the Ratio is greater than zero.

Returns a Ratio of value zero.

Returns a Ratio of value one.

Trait Implementations

impl Clone for Ratio
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Ratio
[src]

Formats the value using the given formatter.

impl Eq for Ratio
[src]

impl PartialEq for Ratio
[src]

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

This method tests for !=.

impl Ord for Ratio
[src]

This method returns an Ordering between self and other. Read more

impl PartialOrd for Ratio
[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 PartialEq<Integer> for Ratio
[src]

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

This method tests for !=.

impl Add<Ratio> for Ratio
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a> Add<&'a Ratio> for Ratio
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a> Add<Ratio> for &'a Ratio
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b> Add<&'a Ratio> for &'b Ratio
[src]

The resulting type after applying the + operator

The method for the + operator

impl Sub<Ratio> for Ratio
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a> Sub<&'a Ratio> for Ratio
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a> Sub<Ratio> for &'a Ratio
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b> Sub<&'a Ratio> for &'b Ratio
[src]

The resulting type after applying the - operator

The method for the - operator

impl Mul<Ratio> for Ratio
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a> Mul<&'a Ratio> for Ratio
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a> Mul<Ratio> for &'a Ratio
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b> Mul<&'a Ratio> for &'b Ratio
[src]

The resulting type after applying the * operator

The method for the * operator

impl Div<Ratio> for Ratio
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a> Div<&'a Ratio> for Ratio
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a> Div<Ratio> for &'a Ratio
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, 'b> Div<&'a Ratio> for &'b Ratio
[src]

The resulting type after applying the / operator

The method for the / operator

impl Rem<Ratio> for Ratio
[src]

The resulting type after applying the % operator

The method for the % operator

impl<'a> Rem<&'a Ratio> for Ratio
[src]

The resulting type after applying the % operator

The method for the % operator

impl<'a> Rem<Ratio> for &'a Ratio
[src]

The resulting type after applying the % operator

The method for the % operator

impl<'a, 'b> Rem<&'a Ratio> for &'b Ratio
[src]

The resulting type after applying the % operator

The method for the % operator

impl Neg for Ratio
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<'a> Neg for &'a Ratio
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl Zero for Ratio
[src]

Returns true if self is equal to the additive identity.

Returns the additive identity element of Self, 0. Read more

impl Display for Ratio
[src]

Formats the value using the given formatter. Read more

impl FromStr for Ratio
[src]

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

impl<'a> FromValueRef<'a> for &'a Ratio
[src]

Returns the borrowed value

impl FromValue for Ratio
[src]

Consumes the Value and returns a Rust value