# [−][src]Struct num::rational::Ratio

    pub struct Ratio<T> { /* fields omitted */ }

Represents the ratio between 2 numbers.

## Methods

### `impl<T> Ratio<T> where
T: Clone + Integer,` [src]

#### `pub fn new(numer: T, denom: T) -> Ratio<T>`[src]

Creates a new `Ratio`. Fails if `denom` is zero.

#### `pub fn from_integer(t: T) -> Ratio<T>`[src]

Creates a `Ratio` representing the integer `t`.

#### `pub fn new_raw(numer: T, denom: T) -> Ratio<T>`[src]

Creates a `Ratio` without checking for `denom == 0` or reducing.

#### `pub fn to_integer(&self) -> T`[src]

Converts to an integer, rounding towards zero.

#### `pub fn numer(&'a self) -> &'a T`[src]

Gets an immutable reference to the numerator.

#### `pub fn denom(&'a self) -> &'a T`[src]

Gets an immutable reference to the denominator.

#### `pub fn is_integer(&self) -> bool`[src]

Returns true if the rational number is an integer (denominator is 1).

#### `pub fn reduced(&self) -> Ratio<T>`[src]

Returns a reduced copy of self.

In general, it is not necessary to use this method, as the only method of procuring a non-reduced fraction is through `new_raw`.

#### `pub fn recip(&self) -> Ratio<T>`[src]

Returns the reciprocal.

Fails if the `Ratio` is zero.

#### `pub fn floor(&self) -> Ratio<T>`[src]

Rounds towards minus infinity.

#### `pub fn ceil(&self) -> Ratio<T>`[src]

Rounds towards plus infinity.

#### `pub fn round(&self) -> Ratio<T>`[src]

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

#### `pub fn trunc(&self) -> Ratio<T>`[src]

Rounds towards zero.

#### `pub fn fract(&self) -> Ratio<T>`[src]

Returns the fractional part of a number, with division rounded towards zero.

Satisfies `self == self.trunc() + self.fract()`.

### `impl<T> Ratio<T> where
T: Clone + Integer + PrimInt,` [src]

#### `pub fn pow(&self, expon: i32) -> Ratio<T>`[src]

Raises the `Ratio` to the power of an exponent.

### `impl Ratio<BigInt>`[src]

#### `pub fn from_float<T>(f: T) -> Option<Ratio<BigInt>> where
T: Float,` [src]

Converts a float into a rational number.

### `impl<T> Ratio<T> where
T: Clone + Integer + Bounded + NumCast + Signed,` [src]

#### `pub fn approximate_float<F>(f: F) -> Option<Ratio<T>> where
F: NumCast + Float,` [src]

## Trait Implementations

### `impl<T> CheckedDiv for Ratio<T> where
T: Clone + Integer + CheckedMul,` [src]

#### `fn checked_div(&self, rhs: &Ratio<T>) -> Option<Ratio<T>>`[src]

Divides two numbers, checking for underflow, overflow and division by zero. If any of that happens, `None` is returned. Read more

### `impl<T> SubAssign<Ratio<T>> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn sub_assign(&mut self, other: Ratio<T>)`[src]

Performs the `-=` operation.

### `impl<T> SubAssign<T> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn sub_assign(&mut self, other: T)`[src]

Performs the `-=` operation.

### `impl<'a, T> SubAssign<&'a T> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn sub_assign(&mut self, other: &T)`[src]

Performs the `-=` operation.

### `impl<'a, T> SubAssign<&'a Ratio<T>> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn sub_assign(&mut self, other: &Ratio<T>)`[src]

Performs the `-=` operation.

### `impl<T> Num for Ratio<T> where
T: Clone + Integer,` [src]

#### `type FromStrRadixErr = ParseRatioError`

#### `fn from_str_radix(s: &str, radix: u32) -> Result<Ratio<T>, ParseRatioError>`[src]

Parses `numer/denom` where the numbers are in base `radix`.

### `impl<T> Eq for Ratio<T> where
T: Clone + Integer,` [src]

### `impl<T> Zero for Ratio<T> where
T: Clone + Integer,` [src]

#### `fn zero() -> Ratio<T>`[src]

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

#### `fn is_zero(&self) -> bool`[src]

Returns `true` if `self` is equal to the additive identity.

#### `fn set_zero(&mut self)`[src]

Sets `self` to the additive identity element of `Self`, `0`.

### `impl<T> Display for Ratio<T> where
T: Display + Eq + One,` [src]

#### `fn fmt(&self, f: &mut Formatter) -> Result<(), Error>`[src]

Renders as `numer/denom`. If denom=1, renders as numer.

### `impl<T> Rem<T> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `%` operator.

#### `fn rem(self, rhs: T) -> Ratio<T>`[src]

Performs the `%` operation.

### `impl<'a, T> Rem<Ratio<T>> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: Ratio<T>) -> Ratio<T>`[src]

Performs the `%` operation.

### `impl<'a, 'b, T> Rem<&'b Ratio<T>> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'b Ratio<T>) -> Ratio<T>`[src]

Performs the `%` operation.

### `impl<'a, 'b, T> Rem<&'b T> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &'b T) -> Ratio<T>`[src]

Performs the `%` operation.

### `impl<'a, T> Rem<&'a T> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &T) -> Ratio<T>`[src]

Performs the `%` operation.

### `impl<'a, T> Rem<&'a Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: &Ratio<T>) -> Ratio<T>`[src]

Performs the `%` operation.

### `impl<T> Rem<Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `%` operator.

#### `fn rem(self, rhs: Ratio<T>) -> Ratio<T>`[src]

Performs the `%` operation.

### `impl<'a, T> Rem<T> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `%` operator.

#### `fn rem(self, other: T) -> Ratio<T>`[src]

Performs the `%` operation.

### `impl<T> Into<(T, T)> for Ratio<T>`[src]

#### `fn into(self) -> (T, T)`[src]

Performs the conversion.

### `impl<'a, T> RemAssign<&'a Ratio<T>> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn rem_assign(&mut self, other: &Ratio<T>)`[src]

Performs the `%=` operation.

### `impl<T> RemAssign<T> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn rem_assign(&mut self, other: T)`[src]

Performs the `%=` operation.

### `impl<'a, T> RemAssign<&'a T> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn rem_assign(&mut self, other: &T)`[src]

Performs the `%=` operation.

### `impl<T> RemAssign<Ratio<T>> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn rem_assign(&mut self, other: Ratio<T>)`[src]

Performs the `%=` operation.

### `impl<'a, T> Add<Ratio<T>> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: Ratio<T>) -> Ratio<T>`[src]

Performs the `+` operation.

### `impl<'a, T> Add<&'a Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: &Ratio<T>) -> Ratio<T>`[src]

Performs the `+` operation.

### `impl<'a, T> Add<T> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: T) -> Ratio<T>`[src]

Performs the `+` operation.

### `impl<'a, T> Add<&'a T> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: &T) -> Ratio<T>`[src]

Performs the `+` operation.

### `impl<'a, 'b, T> Add<&'b T> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: &'b T) -> Ratio<T>`[src]

Performs the `+` operation.

### `impl<'a, 'b, T> Add<&'b Ratio<T>> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `+` operator.

#### `fn add(self, other: &'b Ratio<T>) -> Ratio<T>`[src]

Performs the `+` operation.

### `impl<T> Add<T> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `+` operator.

#### `fn add(self, rhs: T) -> Ratio<T>`[src]

Performs the `+` operation.

### `impl<T> Add<Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `+` operator.

#### `fn add(self, rhs: Ratio<T>) -> Ratio<T>`[src]

Performs the `+` operation.

### `impl<T> PartialEq<Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `fn eq(&self, other: &Ratio<T>) -> bool`[src]

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

#### `#[must_use] fn ne(&self, other: &Rhs) -> bool` 1.0.0[src]

This method tests for `!=`.

### `impl<T> Debug for Ratio<T> where
T: Debug,` [src]

#### `fn fmt(&self, f: &mut Formatter) -> Result<(), Error>`[src]

Formats the value using the given formatter. Read more

### `impl<T> Clone for Ratio<T> where
T: Clone,` [src]

#### `fn clone(&self) -> Ratio<T>`[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`1.0.0[src]

Performs copy-assignment from `source`. Read more

### `impl<'a, 'b, T> Sub<&'b T> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: &'b T) -> Ratio<T>`[src]

Performs the `-` operation.

### `impl<'a, T> Sub<&'a T> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: &T) -> Ratio<T>`[src]

Performs the `-` operation.

### `impl<T> Sub<T> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `-` operator.

#### `fn sub(self, rhs: T) -> Ratio<T>`[src]

Performs the `-` operation.

### `impl<T> Sub<Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `-` operator.

#### `fn sub(self, rhs: Ratio<T>) -> Ratio<T>`[src]

Performs the `-` operation.

### `impl<'a, T> Sub<Ratio<T>> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: Ratio<T>) -> Ratio<T>`[src]

Performs the `-` operation.

### `impl<'a, 'b, T> Sub<&'b Ratio<T>> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: &'b Ratio<T>) -> Ratio<T>`[src]

Performs the `-` operation.

### `impl<'a, T> Sub<&'a Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: &Ratio<T>) -> Ratio<T>`[src]

Performs the `-` operation.

### `impl<'a, T> Sub<T> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `-` operator.

#### `fn sub(self, other: T) -> Ratio<T>`[src]

Performs the `-` operation.

### `impl FromPrimitive for Ratio<isize>`[src]

#### `fn from_i64(n: i64) -> Option<Ratio<isize>>`[src]

Convert an `i64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u64(n: u64) -> Option<Ratio<isize>>`[src]

Convert an `u64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f32(n: f32) -> Option<Ratio<isize>>`[src]

Convert a `f32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f64(n: f64) -> Option<Ratio<isize>>`[src]

Convert a `f64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_isize(n: isize) -> Option<Self>`[src]

Convert an `isize` to return an optional value of this type. If the value cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i8(n: i8) -> Option<Self>`[src]

Convert an `i8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i16(n: i16) -> Option<Self>`[src]

Convert an `i16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i32(n: i32) -> Option<Self>`[src]

Convert an `i32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i128(n: i128) -> Option<Self>`[src]

Convert an `i128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_usize(n: usize) -> Option<Self>`[src]

Convert a `usize` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u8(n: u8) -> Option<Self>`[src]

Convert an `u8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u16(n: u16) -> Option<Self>`[src]

Convert an `u16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u32(n: u32) -> Option<Self>`[src]

Convert an `u32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u128(n: u128) -> Option<Self>`[src]

Convert an `u128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

### `impl FromPrimitive for Ratio<u16>`[src]

#### `fn from_i64(n: i64) -> Option<Ratio<u16>>`[src]

Convert an `i64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u64(n: u64) -> Option<Ratio<u16>>`[src]

Convert an `u64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f32(n: f32) -> Option<Ratio<u16>>`[src]

Convert a `f32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f64(n: f64) -> Option<Ratio<u16>>`[src]

Convert a `f64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_isize(n: isize) -> Option<Self>`[src]

Convert an `isize` to return an optional value of this type. If the value cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i8(n: i8) -> Option<Self>`[src]

Convert an `i8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i16(n: i16) -> Option<Self>`[src]

Convert an `i16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i32(n: i32) -> Option<Self>`[src]

Convert an `i32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i128(n: i128) -> Option<Self>`[src]

Convert an `i128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_usize(n: usize) -> Option<Self>`[src]

Convert a `usize` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u8(n: u8) -> Option<Self>`[src]

Convert an `u8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u16(n: u16) -> Option<Self>`[src]

Convert an `u16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u32(n: u32) -> Option<Self>`[src]

Convert an `u32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u128(n: u128) -> Option<Self>`[src]

Convert an `u128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

### `impl FromPrimitive for Ratio<u8>`[src]

#### `fn from_i64(n: i64) -> Option<Ratio<u8>>`[src]

Convert an `i64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u64(n: u64) -> Option<Ratio<u8>>`[src]

Convert an `u64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f32(n: f32) -> Option<Ratio<u8>>`[src]

Convert a `f32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f64(n: f64) -> Option<Ratio<u8>>`[src]

Convert a `f64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_isize(n: isize) -> Option<Self>`[src]

Convert an `isize` to return an optional value of this type. If the value cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i8(n: i8) -> Option<Self>`[src]

Convert an `i8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i16(n: i16) -> Option<Self>`[src]

Convert an `i16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i32(n: i32) -> Option<Self>`[src]

Convert an `i32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i128(n: i128) -> Option<Self>`[src]

Convert an `i128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_usize(n: usize) -> Option<Self>`[src]

Convert a `usize` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u8(n: u8) -> Option<Self>`[src]

Convert an `u8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u16(n: u16) -> Option<Self>`[src]

Convert an `u16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u32(n: u32) -> Option<Self>`[src]

Convert an `u32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u128(n: u128) -> Option<Self>`[src]

Convert an `u128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

### `impl FromPrimitive for Ratio<usize>`[src]

#### `fn from_i64(n: i64) -> Option<Ratio<usize>>`[src]

Convert an `i64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u64(n: u64) -> Option<Ratio<usize>>`[src]

Convert an `u64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f32(n: f32) -> Option<Ratio<usize>>`[src]

Convert a `f32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f64(n: f64) -> Option<Ratio<usize>>`[src]

Convert a `f64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_isize(n: isize) -> Option<Self>`[src]

Convert an `isize` to return an optional value of this type. If the value cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i8(n: i8) -> Option<Self>`[src]

Convert an `i8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i16(n: i16) -> Option<Self>`[src]

Convert an `i16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i32(n: i32) -> Option<Self>`[src]

Convert an `i32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i128(n: i128) -> Option<Self>`[src]

Convert an `i128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_usize(n: usize) -> Option<Self>`[src]

Convert a `usize` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u8(n: u8) -> Option<Self>`[src]

Convert an `u8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u16(n: u16) -> Option<Self>`[src]

Convert an `u16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u32(n: u32) -> Option<Self>`[src]

Convert an `u32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u128(n: u128) -> Option<Self>`[src]

Convert an `u128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

### `impl FromPrimitive for Ratio<i16>`[src]

#### `fn from_i64(n: i64) -> Option<Ratio<i16>>`[src]

Convert an `i64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u64(n: u64) -> Option<Ratio<i16>>`[src]

Convert an `u64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f32(n: f32) -> Option<Ratio<i16>>`[src]

Convert a `f32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f64(n: f64) -> Option<Ratio<i16>>`[src]

Convert a `f64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_isize(n: isize) -> Option<Self>`[src]

Convert an `isize` to return an optional value of this type. If the value cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i8(n: i8) -> Option<Self>`[src]

Convert an `i8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i16(n: i16) -> Option<Self>`[src]

Convert an `i16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i32(n: i32) -> Option<Self>`[src]

Convert an `i32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i128(n: i128) -> Option<Self>`[src]

Convert an `i128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_usize(n: usize) -> Option<Self>`[src]

Convert a `usize` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u8(n: u8) -> Option<Self>`[src]

Convert an `u8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u16(n: u16) -> Option<Self>`[src]

Convert an `u16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u32(n: u32) -> Option<Self>`[src]

Convert an `u32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u128(n: u128) -> Option<Self>`[src]

Convert an `u128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

### `impl FromPrimitive for Ratio<u32>`[src]

#### `fn from_i64(n: i64) -> Option<Ratio<u32>>`[src]

Convert an `i64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u64(n: u64) -> Option<Ratio<u32>>`[src]

Convert an `u64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f32(n: f32) -> Option<Ratio<u32>>`[src]

Convert a `f32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f64(n: f64) -> Option<Ratio<u32>>`[src]

Convert a `f64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_isize(n: isize) -> Option<Self>`[src]

Convert an `isize` to return an optional value of this type. If the value cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i8(n: i8) -> Option<Self>`[src]

Convert an `i8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i16(n: i16) -> Option<Self>`[src]

Convert an `i16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i32(n: i32) -> Option<Self>`[src]

Convert an `i32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i128(n: i128) -> Option<Self>`[src]

Convert an `i128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_usize(n: usize) -> Option<Self>`[src]

Convert a `usize` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u8(n: u8) -> Option<Self>`[src]

Convert an `u8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u16(n: u16) -> Option<Self>`[src]

Convert an `u16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u32(n: u32) -> Option<Self>`[src]

Convert an `u32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u128(n: u128) -> Option<Self>`[src]

Convert an `u128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

### `impl FromPrimitive for Ratio<u64>`[src]

#### `fn from_i64(n: i64) -> Option<Ratio<u64>>`[src]

Convert an `i64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u64(n: u64) -> Option<Ratio<u64>>`[src]

Convert an `u64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f32(n: f32) -> Option<Ratio<u64>>`[src]

Convert a `f32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f64(n: f64) -> Option<Ratio<u64>>`[src]

Convert a `f64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_isize(n: isize) -> Option<Self>`[src]

Convert an `isize` to return an optional value of this type. If the value cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i8(n: i8) -> Option<Self>`[src]

Convert an `i8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i16(n: i16) -> Option<Self>`[src]

Convert an `i16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i32(n: i32) -> Option<Self>`[src]

Convert an `i32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i128(n: i128) -> Option<Self>`[src]

Convert an `i128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_usize(n: usize) -> Option<Self>`[src]

Convert a `usize` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u8(n: u8) -> Option<Self>`[src]

Convert an `u8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u16(n: u16) -> Option<Self>`[src]

Convert an `u16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u32(n: u32) -> Option<Self>`[src]

Convert an `u32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u128(n: u128) -> Option<Self>`[src]

Convert an `u128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

### `impl FromPrimitive for Ratio<BigInt>`[src]

#### `fn from_i64(n: i64) -> Option<Ratio<BigInt>>`[src]

Convert an `i64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u64(n: u64) -> Option<Ratio<BigInt>>`[src]

Convert an `u64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f32(n: f32) -> Option<Ratio<BigInt>>`[src]

Convert a `f32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f64(n: f64) -> Option<Ratio<BigInt>>`[src]

Convert a `f64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_isize(n: isize) -> Option<Self>`[src]

Convert an `isize` to return an optional value of this type. If the value cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i8(n: i8) -> Option<Self>`[src]

Convert an `i8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i16(n: i16) -> Option<Self>`[src]

Convert an `i16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i32(n: i32) -> Option<Self>`[src]

Convert an `i32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i128(n: i128) -> Option<Self>`[src]

Convert an `i128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_usize(n: usize) -> Option<Self>`[src]

Convert a `usize` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u8(n: u8) -> Option<Self>`[src]

Convert an `u8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u16(n: u16) -> Option<Self>`[src]

Convert an `u16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u32(n: u32) -> Option<Self>`[src]

Convert an `u32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u128(n: u128) -> Option<Self>`[src]

Convert an `u128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

### `impl FromPrimitive for Ratio<i64>`[src]

#### `fn from_i64(n: i64) -> Option<Ratio<i64>>`[src]

Convert an `i64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u64(n: u64) -> Option<Ratio<i64>>`[src]

Convert an `u64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f32(n: f32) -> Option<Ratio<i64>>`[src]

Convert a `f32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f64(n: f64) -> Option<Ratio<i64>>`[src]

Convert a `f64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_isize(n: isize) -> Option<Self>`[src]

Convert an `isize` to return an optional value of this type. If the value cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i8(n: i8) -> Option<Self>`[src]

Convert an `i8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i16(n: i16) -> Option<Self>`[src]

Convert an `i16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i32(n: i32) -> Option<Self>`[src]

Convert an `i32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i128(n: i128) -> Option<Self>`[src]

Convert an `i128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_usize(n: usize) -> Option<Self>`[src]

Convert a `usize` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u8(n: u8) -> Option<Self>`[src]

Convert an `u8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u16(n: u16) -> Option<Self>`[src]

Convert an `u16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u32(n: u32) -> Option<Self>`[src]

Convert an `u32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u128(n: u128) -> Option<Self>`[src]

Convert an `u128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

### `impl FromPrimitive for Ratio<i32>`[src]

#### `fn from_i64(n: i64) -> Option<Ratio<i32>>`[src]

Convert an `i64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u64(n: u64) -> Option<Ratio<i32>>`[src]

Convert an `u64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f32(n: f32) -> Option<Ratio<i32>>`[src]

Convert a `f32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f64(n: f64) -> Option<Ratio<i32>>`[src]

Convert a `f64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_isize(n: isize) -> Option<Self>`[src]

Convert an `isize` to return an optional value of this type. If the value cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i8(n: i8) -> Option<Self>`[src]

Convert an `i8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i16(n: i16) -> Option<Self>`[src]

Convert an `i16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i32(n: i32) -> Option<Self>`[src]

Convert an `i32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i128(n: i128) -> Option<Self>`[src]

Convert an `i128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_usize(n: usize) -> Option<Self>`[src]

Convert a `usize` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u8(n: u8) -> Option<Self>`[src]

Convert an `u8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u16(n: u16) -> Option<Self>`[src]

Convert an `u16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u32(n: u32) -> Option<Self>`[src]

Convert an `u32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u128(n: u128) -> Option<Self>`[src]

Convert an `u128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

### `impl FromPrimitive for Ratio<i8>`[src]

#### `fn from_i64(n: i64) -> Option<Ratio<i8>>`[src]

Convert an `i64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u64(n: u64) -> Option<Ratio<i8>>`[src]

Convert an `u64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f32(n: f32) -> Option<Ratio<i8>>`[src]

Convert a `f32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_f64(n: f64) -> Option<Ratio<i8>>`[src]

Convert a `f64` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_isize(n: isize) -> Option<Self>`[src]

Convert an `isize` to return an optional value of this type. If the value cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i8(n: i8) -> Option<Self>`[src]

Convert an `i8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i16(n: i16) -> Option<Self>`[src]

Convert an `i16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i32(n: i32) -> Option<Self>`[src]

Convert an `i32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_i128(n: i128) -> Option<Self>`[src]

Convert an `i128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_usize(n: usize) -> Option<Self>`[src]

Convert a `usize` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u8(n: u8) -> Option<Self>`[src]

Convert an `u8` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u16(n: u16) -> Option<Self>`[src]

Convert an `u16` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u32(n: u32) -> Option<Self>`[src]

Convert an `u32` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

#### `fn from_u128(n: u128) -> Option<Self>`[src]

Convert an `u128` to return an optional value of this type. If the type cannot be represented by this value, then `None` is returned. Read more

### `impl<'a, T> Mul<&'a T> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &T) -> Ratio<T>`[src]

Performs the `*` operation.

### `impl<T> Mul<Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `*` operator.

#### `fn mul(self, rhs: Ratio<T>) -> Ratio<T>`[src]

Performs the `*` operation.

### `impl<'a, T> Mul<T> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: T) -> Ratio<T>`[src]

Performs the `*` operation.

### `impl<'a, 'b, T> Mul<&'b Ratio<T>> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'b Ratio<T>) -> Ratio<T>`[src]

Performs the `*` operation.

### `impl<'a, T> Mul<&'a Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &Ratio<T>) -> Ratio<T>`[src]

Performs the `*` operation.

### `impl<'a, T> Mul<Ratio<T>> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: Ratio<T>) -> Ratio<T>`[src]

Performs the `*` operation.

### `impl<'a, 'b, T> Mul<&'b T> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `*` operator.

#### `fn mul(self, other: &'b T) -> Ratio<T>`[src]

Performs the `*` operation.

### `impl<T> Mul<T> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `*` operator.

#### `fn mul(self, rhs: T) -> Ratio<T>`[src]

Performs the `*` operation.

### `impl<T> PartialOrd<Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `fn partial_cmp(&self, other: &Ratio<T>) -> Option<Ordering>`[src]

This method returns an ordering between `self` and `other` values if one exists. Read more

#### `#[must_use] fn lt(&self, other: &Rhs) -> bool` 1.0.0[src]

This method tests less than (for `self` and `other`) and is used by the `<` operator. Read more

#### `#[must_use] fn le(&self, other: &Rhs) -> bool` 1.0.0[src]

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

#### `#[must_use] fn gt(&self, other: &Rhs) -> bool` 1.0.0[src]

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

#### `#[must_use] fn ge(&self, other: &Rhs) -> bool` 1.0.0[src]

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

### `impl<'a, T> AddAssign<&'a Ratio<T>> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn add_assign(&mut self, other: &Ratio<T>)`[src]

Performs the `+=` operation.

### `impl<'a, T> AddAssign<&'a T> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn add_assign(&mut self, other: &T)`[src]

Performs the `+=` operation.

### `impl<T> AddAssign<T> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn add_assign(&mut self, other: T)`[src]

Performs the `+=` operation.

### `impl<T> AddAssign<Ratio<T>> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn add_assign(&mut self, other: Ratio<T>)`[src]

Performs the `+=` operation.

### `impl<T> Hash for Ratio<T> where
T: Clone + Hash + Integer,` [src]

#### `fn hash<H>(&self, state: &mut H) where
H: Hasher,` [src]

Feeds this value into the given [`Hasher`]. Read more

#### `fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,` 1.3.0[src]

Feeds a slice of this type into the given [`Hasher`]. Read more

### `impl<T> CheckedMul for Ratio<T> where
T: Clone + Integer + CheckedMul,` [src]

#### `fn checked_mul(&self, rhs: &Ratio<T>) -> Option<Ratio<T>>`[src]

Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, `None` is returned. Read more

### `impl<T> Ord for Ratio<T> where
T: Clone + Integer,` [src]

#### `fn cmp(&self, other: &Ratio<T>) -> Ordering`[src]

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

#### `fn max(self, other: Self) -> Self` 1.21.0[src]

Compares and returns the maximum of two values. Read more

#### `fn min(self, other: Self) -> Self` 1.21.0[src]

Compares and returns the minimum of two values. Read more

#### `fn clamp(self, min: Self, max: Self) -> Self`[src]

🔬 This is a nightly-only experimental API. (`clamp`)

Restrict a value to a certain interval. Read more

### `impl<T> From<T> for Ratio<T> where
T: Clone + Integer,` [src]

#### `fn from(x: T) -> Ratio<T>`[src]

Performs the conversion.

### `impl<T> From<(T, T)> for Ratio<T> where
T: Clone + Integer,` [src]

#### `fn from(pair: (T, T)) -> Ratio<T>`[src]

Performs the conversion.

### `impl<'a, T> Neg for &'a Ratio<T> where
T: Clone + Integer + Neg<Output = T>,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `-` operator.

#### `fn neg(self) -> Ratio<T>`[src]

Performs the unary `-` operation.

### `impl<T> Neg for Ratio<T> where
T: Clone + Integer + Neg<Output = T>,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `-` operator.

#### `fn neg(self) -> Ratio<T>`[src]

Performs the unary `-` operation.

### `impl<T> CheckedSub for Ratio<T> where
T: Clone + Integer + CheckedSub + CheckedMul,` [src]

#### `fn checked_sub(&self, rhs: &Ratio<T>) -> Option<Ratio<T>>`[src]

Subtracts two numbers, checking for underflow. If underflow happens, `None` is returned. Read more

### `impl<T> MulAssign<Ratio<T>> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn mul_assign(&mut self, other: Ratio<T>)`[src]

Performs the `*=` operation.

### `impl<'a, T> MulAssign<&'a T> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn mul_assign(&mut self, other: &T)`[src]

Performs the `*=` operation.

### `impl<'a, T> MulAssign<&'a Ratio<T>> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn mul_assign(&mut self, other: &Ratio<T>)`[src]

Performs the `*=` operation.

### `impl<T> MulAssign<T> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn mul_assign(&mut self, other: T)`[src]

Performs the `*=` operation.

### `impl<T> One for Ratio<T> where
T: Clone + Integer,` [src]

#### `fn one() -> Ratio<T>`[src]

Returns the multiplicative identity element of `Self`, `1`. Read more

#### `fn set_one(&mut self)`[src]

Sets `self` to the multiplicative identity element of `Self`, `1`.

#### `fn is_one(&self) -> bool where
Self: PartialEq<Self>,` [src]

Returns `true` if `self` is equal to the multiplicative identity. Read more

### `impl<T> Signed for Ratio<T> where
T: Clone + Integer + Signed,` [src]

#### `fn abs(&self) -> Ratio<T>`[src]

Computes the absolute value. Read more

#### `fn abs_sub(&self, other: &Ratio<T>) -> Ratio<T>`[src]

The positive difference of two numbers. Read more

#### `fn signum(&self) -> Ratio<T>`[src]

Returns the sign of the number. Read more

#### `fn is_positive(&self) -> bool`[src]

Returns true if the number is positive and false if the number is zero or negative.

#### `fn is_negative(&self) -> bool`[src]

Returns true if the number is negative and false if the number is zero or positive.

### `impl<'a, T> DivAssign<&'a T> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn div_assign(&mut self, other: &T)`[src]

Performs the `/=` operation.

### `impl<'a, T> DivAssign<&'a Ratio<T>> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn div_assign(&mut self, other: &Ratio<T>)`[src]

Performs the `/=` operation.

### `impl<T> DivAssign<T> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn div_assign(&mut self, other: T)`[src]

Performs the `/=` operation.

### `impl<T> DivAssign<Ratio<T>> for Ratio<T> where
T: Clone + Integer + NumAssign,` [src]

#### `fn div_assign(&mut self, other: Ratio<T>)`[src]

Performs the `/=` operation.

### `impl<T> CheckedAdd for Ratio<T> where
T: Clone + Integer + CheckedAdd + CheckedMul,` [src]

#### `fn checked_add(&self, rhs: &Ratio<T>) -> Option<Ratio<T>>`[src]

Adds two numbers, checking for overflow. If overflow happens, `None` is returned. Read more

### `impl<'a, 'b, T> Div<&'b T> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'b T) -> Ratio<T>`[src]

Performs the `/` operation.

### `impl<'a, T> Div<Ratio<T>> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: Ratio<T>) -> Ratio<T>`[src]

Performs the `/` operation.

### `impl<'a, T> Div<&'a T> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &T) -> Ratio<T>`[src]

Performs the `/` operation.

### `impl<T> Div<T> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `/` operator.

#### `fn div(self, rhs: T) -> Ratio<T>`[src]

Performs the `/` operation.

### `impl<'a, T> Div<T> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: T) -> Ratio<T>`[src]

Performs the `/` operation.

### `impl<T> Div<Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `/` operator.

#### `fn div(self, rhs: Ratio<T>) -> Ratio<T>`[src]

Performs the `/` operation.

### `impl<'a, T> Div<&'a Ratio<T>> for Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &Ratio<T>) -> Ratio<T>`[src]

Performs the `/` operation.

### `impl<'a, 'b, T> Div<&'b Ratio<T>> for &'a Ratio<T> where
T: Clone + Integer,` [src]

#### `type Output = Ratio<T>`

The resulting type after applying the `/` operator.

#### `fn div(self, other: &'b Ratio<T>) -> Ratio<T>`[src]

Performs the `/` operation.

### `impl<T> Decodable for Ratio<T> where
T: Decodable,` [src]

#### `fn decode<__D>(d: &mut __D) -> Result<Ratio<T>, <__D as Decoder>::Error> where
__D: Decoder,` [src]

Deserialize a value using a `Decoder`.

### `impl<T> Encodable for Ratio<T> where
T: Encodable,` [src]

#### `fn encode<__S>(&self, s: &mut __S) -> Result<(), <__S as Encoder>::Error> where
__S: Encoder,` [src]

Serialize a value using an `Encoder`.

### `impl<T> FromStr for Ratio<T> where
T: Clone + FromStr + Integer,` [src]

#### `type Err = ParseRatioError`

The associated error which can be returned from parsing.

#### `fn from_str(s: &str) -> Result<Ratio<T>, ParseRatioError>`[src]

Parses `numer/denom` or just `numer`.

### `impl<T> Copy for Ratio<T> where
T: Copy,` [src]

## Auto Trait Implementations

### `impl<T> Send for Ratio<T> where
T: Send,`

### `impl<T> Unpin for Ratio<T> where
T: Unpin,`

### `impl<T> Sync for Ratio<T> where
T: Sync,`

### `impl<T> UnwindSafe for Ratio<T> where
T: UnwindSafe,`

### `impl<T> RefUnwindSafe for Ratio<T> where
T: RefUnwindSafe,`

## Blanket Implementations

### `impl<T> ToOwned for T where
T: Clone,` [src]

#### `type Owned = T`

The resulting type after obtaining ownership.

#### `fn to_owned(&self) -> T`[src]

Creates owned data from borrowed data, usually by cloning. Read more

#### `fn clone_into(&self, target: &mut T)`[src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `fn into(self) -> U`[src]

Performs the conversion.

### `impl<T> From<T> for T`[src]

#### `fn from(t: T) -> T`[src]

Performs the conversion.

### `impl<T> ToString for T where
T: Display + ?Sized,` [src]

#### `default fn to_string(&self) -> String`[src]

Converts the given value to a `String`. Read more

### `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.

#### `fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>`[src]

Performs the conversion.

### `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.

#### `fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>`[src]

Performs the conversion.

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `fn borrow_mut(&mut self) -> &mut T`[src]

Mutably borrows from an owned value. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `fn borrow(&self) -> &T`[src]

Immutably borrows from an owned value. Read more

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `fn type_id(&self) -> TypeId`[src]

Gets the `TypeId` of `self`. Read more

### `impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,` [src]

### `impl<T> NumRef for T where
T: Num + NumOps<&'r T, T>,` [src]

### `impl<T, Base> RefNum<Base> for T where
T: NumOps<Base, Base> + NumOps<&'r Base, Base>,` [src]

### `impl<T, Rhs> NumAssignOps<Rhs> for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,` [src]

### `impl<T> NumAssign for T where
T: Num + NumAssignOps<T>,` [src]

### `impl<T> NumAssignRef for T where
T: NumAssign + NumAssignOps<&'r T>,` [src]

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)