Struct dice::Ratio [] [src]

pub struct Ratio { /* fields omitted */ }

A ratio between two integers.

Methods

impl Ratio
[src]

Returns a Ratio with the value 0.

Constructs a new Ratio.

Panics

  • denominator is zero

Returns the numerator part of this ratio.

Returns the denominator part of this ratio.

Returns a string representing this ratio as a percentage.

Returns a string representing this ratio as a real number.

Returns the sum of this ratio and the supplied ratio unless overflow occurs.

Returns the quotient of this ratio and the supplied ratio unless overflow occurs.

Returns the product of this ratio and the supplied ratio unless overflow occurs.

Returns the difference of this ratio and the supplied ratio unless overflow occurs.

Trait Implementations

impl Copy for Ratio
[src]

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 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 Eq for Ratio
[src]

impl Display for Ratio
[src]

Formats the value using the given formatter. 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 Ord for Ratio
[src]

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

impl Add for Ratio
[src]

The resulting type after applying the + operator

The method for the + operator

impl AddAssign for Ratio
[src]

The method for the += operator

impl Sub for Ratio
[src]

The resulting type after applying the - operator

The method for the - operator

impl SubAssign for Ratio
[src]

The method for the -= operator

impl Mul for Ratio
[src]

The resulting type after applying the * operator

The method for the * operator

impl MulAssign for Ratio
[src]

The method for the *= operator

impl Div for Ratio
[src]

The resulting type after applying the / operator

The method for the / operator

impl DivAssign for Ratio
[src]

The method for the /= operator