num::rational

Struct Ratio

Source
pub struct Ratio<T> { /* private fields */ }
Expand description

Represents the ratio between two numbers.

Implementations§

Source§

impl<T> Ratio<T>

These method are const for Rust 1.31 and later.

Source

pub const fn new_raw(numer: T, denom: T) -> Ratio<T>

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

There are several methods that will panic if used on a Ratio with denom == 0.

Source

pub const fn numer(&self) -> &T

Gets an immutable reference to the numerator.

Source

pub const fn denom(&self) -> &T

Gets an immutable reference to the denominator.

Source§

impl<T> Ratio<T>
where T: Clone + Integer,

Source

pub fn new(numer: T, denom: T) -> Ratio<T>

Creates a new Ratio.

Panics if denom is zero.

Source

pub fn from_integer(t: T) -> Ratio<T>

Creates a Ratio representing the integer t.

Source

pub fn to_integer(&self) -> T

Converts to an integer, rounding towards zero.

Source

pub fn is_integer(&self) -> bool

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

Source

pub fn reduced(&self) -> Ratio<T>

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.

Panics if denom is zero.

Source

pub fn recip(&self) -> Ratio<T>

Returns the reciprocal.

Panics if the Ratio is zero.

Source

pub fn floor(&self) -> Ratio<T>

Rounds towards minus infinity.

Source

pub fn ceil(&self) -> Ratio<T>

Rounds towards plus infinity.

Source

pub fn round(&self) -> Ratio<T>

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

Source

pub fn trunc(&self) -> Ratio<T>

Rounds towards zero.

Source

pub fn fract(&self) -> Ratio<T>

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

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

Source

pub fn pow(&self, expon: i32) -> Ratio<T>
where &'a T: for<'a> Pow<u32, Output = T>,

Raises the Ratio to the power of an exponent.

Source§

impl Ratio<BigInt>

Source

pub fn from_float<T>(f: T) -> Option<Ratio<BigInt>>
where T: FloatCore,

Converts a float into a rational number.

Source§

impl<T> Ratio<T>
where T: Integer + Signed + Bounded + NumCast + Clone,

Source

pub fn approximate_float<F>(f: F) -> Option<Ratio<T>>
where F: FloatCore + NumCast,

Trait Implementations§

Source§

impl<'a, 'b, T> Add<&'b Ratio<T>> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: &'b Ratio<T>) -> Ratio<T>

Performs the + operation. Read more
Source§

impl<'a, T> Add<&'a Ratio<T>> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: &Ratio<T>) -> Ratio<T>

Performs the + operation. Read more
Source§

impl<'a, 'b, T> Add<&'b T> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: &'b T) -> Ratio<T>

Performs the + operation. Read more
Source§

impl<'a, T> Add<&'a T> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: &T) -> Ratio<T>

Performs the + operation. Read more
Source§

impl<'a, T> Add<Ratio<T>> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: Ratio<T>) -> Ratio<T>

Performs the + operation. Read more
Source§

impl<'a, T> Add<T> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: T) -> Ratio<T>

Performs the + operation. Read more
Source§

impl<T> Add<T> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Ratio<T>

Performs the + operation. Read more
Source§

impl<T> Add for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Ratio<T>) -> Ratio<T>

Performs the + operation. Read more
Source§

impl<'a, T> AddAssign<&'a Ratio<T>> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn add_assign(&mut self, other: &Ratio<T>)

Performs the += operation. Read more
Source§

impl<'a, T> AddAssign<&'a T> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn add_assign(&mut self, other: &T)

Performs the += operation. Read more
Source§

impl<T> AddAssign<T> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn add_assign(&mut self, other: T)

Performs the += operation. Read more
Source§

impl<T> AddAssign for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn add_assign(&mut self, other: Ratio<T>)

Performs the += operation. Read more
Source§

impl<T> Binary for Ratio<T>
where T: Binary + Clone + Integer,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> CheckedAdd for Ratio<T>

Source§

fn checked_add(&self, rhs: &Ratio<T>) -> Option<Ratio<T>>

Adds two numbers, checking for overflow. If overflow happens, None is returned.
Source§

impl<T> CheckedDiv for Ratio<T>
where T: Clone + Integer + CheckedMul,

Source§

fn checked_div(&self, rhs: &Ratio<T>) -> Option<Ratio<T>>

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

impl<T> CheckedMul for Ratio<T>
where T: Clone + Integer + CheckedMul,

Source§

fn checked_mul(&self, rhs: &Ratio<T>) -> Option<Ratio<T>>

Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None is returned.
Source§

impl<T> CheckedSub for Ratio<T>

Source§

fn checked_sub(&self, rhs: &Ratio<T>) -> Option<Ratio<T>>

Subtracts two numbers, checking for underflow. If underflow happens, None is returned.
Source§

impl<T> Clone for Ratio<T>
where T: Clone,

Source§

fn clone(&self) -> Ratio<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Ratio<T>
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> Display for Ratio<T>
where T: Display + Clone + Integer,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a, 'b, T> Div<&'b Ratio<T>> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: &'b Ratio<T>) -> Ratio<T>

Performs the / operation. Read more
Source§

impl<'a, T> Div<&'a Ratio<T>> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: &Ratio<T>) -> Ratio<T>

Performs the / operation. Read more
Source§

impl<'a, 'b, T> Div<&'b T> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: &'b T) -> Ratio<T>

Performs the / operation. Read more
Source§

impl<'a, T> Div<&'a T> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: &T) -> Ratio<T>

Performs the / operation. Read more
Source§

impl<'a, T> Div<Ratio<T>> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: Ratio<T>) -> Ratio<T>

Performs the / operation. Read more
Source§

impl<'a, T> Div<T> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: T) -> Ratio<T>

Performs the / operation. Read more
Source§

impl<T> Div<T> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Ratio<T>

Performs the / operation. Read more
Source§

impl<T> Div for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Ratio<T>) -> Ratio<T>

Performs the / operation. Read more
Source§

impl<'a, T> DivAssign<&'a Ratio<T>> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn div_assign(&mut self, other: &Ratio<T>)

Performs the /= operation. Read more
Source§

impl<'a, T> DivAssign<&'a T> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn div_assign(&mut self, other: &T)

Performs the /= operation. Read more
Source§

impl<T> DivAssign<T> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn div_assign(&mut self, other: T)

Performs the /= operation. Read more
Source§

impl<T> DivAssign for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn div_assign(&mut self, other: Ratio<T>)

Performs the /= operation. Read more
Source§

impl<T> From<(T, T)> for Ratio<T>
where T: Clone + Integer,

Source§

fn from(pair: (T, T)) -> Ratio<T>

Converts to this type from the input type.
Source§

impl<T> From<T> for Ratio<T>
where T: Clone + Integer,

Source§

fn from(x: T) -> Ratio<T>

Converts to this type from the input type.
Source§

impl FromPrimitive for Ratio<BigInt>

Source§

fn from_i64(n: i64) -> Option<Ratio<BigInt>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<BigInt>>

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

fn from_u64(n: u64) -> Option<Ratio<BigInt>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<BigInt>>

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

fn from_f32(n: f32) -> Option<Ratio<BigInt>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<BigInt>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<i128>

Source§

fn from_i64(n: i64) -> Option<Ratio<i128>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<i128>>

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

fn from_u64(n: u64) -> Option<Ratio<i128>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<i128>>

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

fn from_f32(n: f32) -> Option<Ratio<i128>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<i128>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<i16>

Source§

fn from_i64(n: i64) -> Option<Ratio<i16>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<i16>>

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

fn from_u64(n: u64) -> Option<Ratio<i16>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<i16>>

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

fn from_f32(n: f32) -> Option<Ratio<i16>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<i16>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<i32>

Source§

fn from_i64(n: i64) -> Option<Ratio<i32>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<i32>>

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

fn from_u64(n: u64) -> Option<Ratio<i32>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<i32>>

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

fn from_f32(n: f32) -> Option<Ratio<i32>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<i32>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<i64>

Source§

fn from_i64(n: i64) -> Option<Ratio<i64>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<i64>>

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

fn from_u64(n: u64) -> Option<Ratio<i64>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<i64>>

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

fn from_f32(n: f32) -> Option<Ratio<i64>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<i64>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<i8>

Source§

fn from_i64(n: i64) -> Option<Ratio<i8>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<i8>>

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

fn from_u64(n: u64) -> Option<Ratio<i8>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<i8>>

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

fn from_f32(n: f32) -> Option<Ratio<i8>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<i8>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<isize>

Source§

fn from_i64(n: i64) -> Option<Ratio<isize>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<isize>>

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

fn from_u64(n: u64) -> Option<Ratio<isize>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<isize>>

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

fn from_f32(n: f32) -> Option<Ratio<isize>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<isize>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<u128>

Source§

fn from_i64(n: i64) -> Option<Ratio<u128>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<u128>>

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

fn from_u64(n: u64) -> Option<Ratio<u128>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<u128>>

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

fn from_f32(n: f32) -> Option<Ratio<u128>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<u128>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<u16>

Source§

fn from_i64(n: i64) -> Option<Ratio<u16>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<u16>>

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

fn from_u64(n: u64) -> Option<Ratio<u16>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<u16>>

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

fn from_f32(n: f32) -> Option<Ratio<u16>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<u16>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<u32>

Source§

fn from_i64(n: i64) -> Option<Ratio<u32>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<u32>>

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

fn from_u64(n: u64) -> Option<Ratio<u32>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<u32>>

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

fn from_f32(n: f32) -> Option<Ratio<u32>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<u32>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<u64>

Source§

fn from_i64(n: i64) -> Option<Ratio<u64>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<u64>>

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

fn from_u64(n: u64) -> Option<Ratio<u64>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<u64>>

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

fn from_f32(n: f32) -> Option<Ratio<u64>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<u64>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<u8>

Source§

fn from_i64(n: i64) -> Option<Ratio<u8>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<u8>>

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

fn from_u64(n: u64) -> Option<Ratio<u8>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<u8>>

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

fn from_f32(n: f32) -> Option<Ratio<u8>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<u8>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromPrimitive for Ratio<usize>

Source§

fn from_i64(n: i64) -> Option<Ratio<usize>>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Ratio<usize>>

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

fn from_u64(n: u64) -> Option<Ratio<usize>>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Ratio<usize>>

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

fn from_f32(n: f32) -> Option<Ratio<usize>>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Ratio<usize>>

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

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl<T> FromStr for Ratio<T>
where T: FromStr + Clone + Integer,

Source§

fn from_str(s: &str) -> Result<Ratio<T>, ParseRatioError>

Parses numer/denom or just numer.

Source§

type Err = ParseRatioError

The associated error which can be returned from parsing.
Source§

impl<T> Hash for Ratio<T>
where T: Clone + Integer + Hash,

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> Into<(T, T)> for Ratio<T>

Source§

fn into(self) -> (T, T)

Converts this type into the (usually inferred) input type.
Source§

impl<'a, T> Inv for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn inv(self) -> Ratio<T>

Returns the multiplicative inverse of self. Read more
Source§

impl<T> Inv for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn inv(self) -> Ratio<T>

Returns the multiplicative inverse of self. Read more
Source§

impl<T> LowerExp for Ratio<T>
where T: LowerExp + Clone + Integer,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> LowerHex for Ratio<T>
where T: LowerHex + Clone + Integer,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a, 'b, T> Mul<&'b Ratio<T>> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &'b Ratio<T>) -> Ratio<T>

Performs the * operation. Read more
Source§

impl<'a, T> Mul<&'a Ratio<T>> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Ratio<T>) -> Ratio<T>

Performs the * operation. Read more
Source§

impl<'a, 'b, T> Mul<&'b T> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &'b T) -> Ratio<T>

Performs the * operation. Read more
Source§

impl<'a, T> Mul<&'a T> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &T) -> Ratio<T>

Performs the * operation. Read more
Source§

impl<'a, T> Mul<Ratio<T>> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Ratio<T>) -> Ratio<T>

Performs the * operation. Read more
Source§

impl<'a, T> Mul<T> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> Ratio<T>

Performs the * operation. Read more
Source§

impl<T> Mul<T> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Ratio<T>

Performs the * operation. Read more
Source§

impl<T> Mul for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Ratio<T>) -> Ratio<T>

Performs the * operation. Read more
Source§

impl<'a, T> MulAssign<&'a Ratio<T>> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn mul_assign(&mut self, other: &Ratio<T>)

Performs the *= operation. Read more
Source§

impl<'a, T> MulAssign<&'a T> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn mul_assign(&mut self, other: &T)

Performs the *= operation. Read more
Source§

impl<T> MulAssign<T> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn mul_assign(&mut self, other: T)

Performs the *= operation. Read more
Source§

impl<T> MulAssign for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn mul_assign(&mut self, other: Ratio<T>)

Performs the *= operation. Read more
Source§

impl<'a, T> Neg for &'a Ratio<T>
where T: Clone + Integer + Neg<Output = T>,

Source§

type Output = Ratio<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Ratio<T>

Performs the unary - operation. Read more
Source§

impl<T> Neg for Ratio<T>
where T: Clone + Integer + Neg<Output = T>,

Source§

type Output = Ratio<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Ratio<T>

Performs the unary - operation. Read more
Source§

impl<T> Num for Ratio<T>
where T: Clone + Integer,

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Ratio<T>, ParseRatioError>

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

Source§

type FromStrRadixErr = ParseRatioError

Source§

impl<T> Octal for Ratio<T>
where T: Octal + Clone + Integer,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> One for Ratio<T>
where T: Clone + Integer,

Source§

fn one() -> Ratio<T>

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

fn is_one(&self) -> bool

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

fn set_one(&mut self)

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

impl<T> Ord for Ratio<T>
where T: Clone + Integer,

Source§

fn cmp(&self, other: &Ratio<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T> PartialEq for Ratio<T>
where T: Clone + Integer,

Source§

fn eq(&self, other: &Ratio<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> PartialOrd for Ratio<T>
where T: Clone + Integer,

Source§

fn partial_cmp(&self, other: &Ratio<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, 'b, T> Pow<&'b BigInt> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<&'b BigUint, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b BigInt) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b BigInt> for Ratio<T>
where T: Clone + Integer + Pow<&'b BigUint, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b BigInt) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b BigUint> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<&'b BigUint, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b BigUint) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b BigUint> for Ratio<T>
where T: Clone + Integer + Pow<&'b BigUint, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b BigUint) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b i128> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u128, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b i128) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b i128> for Ratio<T>
where T: Clone + Integer + Pow<u128, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b i128) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b i16> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u16, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b i16) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b i16> for Ratio<T>
where T: Clone + Integer + Pow<u16, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b i16) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b i32> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u32, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b i32) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b i32> for Ratio<T>
where T: Clone + Integer + Pow<u32, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b i32) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b i64> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u64, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b i64) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b i64> for Ratio<T>
where T: Clone + Integer + Pow<u64, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b i64) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b i8> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u8, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b i8) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b i8> for Ratio<T>
where T: Clone + Integer + Pow<u8, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b i8) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b isize> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<usize, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b isize) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b isize> for Ratio<T>
where T: Clone + Integer + Pow<usize, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b isize) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b u128> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u128, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b u128) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b u128> for Ratio<T>
where T: Clone + Integer + Pow<u128, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b u128) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b u16> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u16, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b u16) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b u16> for Ratio<T>
where T: Clone + Integer + Pow<u16, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b u16) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b u32> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u32, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b u32) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b u32> for Ratio<T>
where T: Clone + Integer + Pow<u32, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b u32) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b u64> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u64, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b u64) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b u64> for Ratio<T>
where T: Clone + Integer + Pow<u64, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b u64) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b u8> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u8, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b u8) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b u8> for Ratio<T>
where T: Clone + Integer + Pow<u8, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b u8) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, 'b, T> Pow<&'b usize> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<usize, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b usize) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'b, T> Pow<&'b usize> for Ratio<T>
where T: Clone + Integer + Pow<usize, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: &'b usize) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<BigInt> for &'a Ratio<T>
where T: Clone + Integer, &'a T: for<'b> Pow<&'b BigUint, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: BigInt) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<BigInt> for Ratio<T>
where T: Clone + Integer + for<'b> Pow<&'b BigUint, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: BigInt) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<BigUint> for &'a Ratio<T>
where T: Clone + Integer, &'a T: for<'b> Pow<&'b BigUint, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: BigUint) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<BigUint> for Ratio<T>
where T: Clone + Integer + for<'b> Pow<&'b BigUint, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: BigUint) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<i128> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u128, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: i128) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<i128> for Ratio<T>
where T: Clone + Integer + Pow<u128, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: i128) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<i16> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u16, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: i16) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<i16> for Ratio<T>
where T: Clone + Integer + Pow<u16, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: i16) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<i32> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u32, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: i32) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<i32> for Ratio<T>
where T: Clone + Integer + Pow<u32, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: i32) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<i64> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u64, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: i64) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<i64> for Ratio<T>
where T: Clone + Integer + Pow<u64, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: i64) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<i8> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u8, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: i8) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<i8> for Ratio<T>
where T: Clone + Integer + Pow<u8, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: i8) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<isize> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<usize, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: isize) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<isize> for Ratio<T>
where T: Clone + Integer + Pow<usize, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: isize) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<u128> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u128, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: u128) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<u128> for Ratio<T>
where T: Clone + Integer + Pow<u128, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: u128) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<u16> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u16, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: u16) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<u16> for Ratio<T>
where T: Clone + Integer + Pow<u16, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: u16) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<u32> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u32, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: u32) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<u32> for Ratio<T>
where T: Clone + Integer + Pow<u32, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: u32) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<u64> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u64, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: u64) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<u64> for Ratio<T>
where T: Clone + Integer + Pow<u64, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: u64) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<u8> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<u8, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: u8) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<u8> for Ratio<T>
where T: Clone + Integer + Pow<u8, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: u8) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Pow<usize> for &'a Ratio<T>
where T: Clone + Integer, &'a T: Pow<usize, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: usize) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<T> Pow<usize> for Ratio<T>
where T: Clone + Integer + Pow<usize, Output = T>,

Source§

type Output = Ratio<T>

The result after applying the operator.
Source§

fn pow(self, expon: usize) -> Ratio<T>

Returns self to the power rhs. Read more
Source§

impl<'a, T> Product<&'a Ratio<T>> for Ratio<T>
where T: Integer + Clone,

Source§

fn product<I>(iter: I) -> Ratio<T>
where I: Iterator<Item = &'a Ratio<T>>,

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<T> Product for Ratio<T>
where T: Integer + Clone,

Source§

fn product<I>(iter: I) -> Ratio<T>
where I: Iterator<Item = Ratio<T>>,

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<'a, 'b, T> Rem<&'b Ratio<T>> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the % operator.
Source§

fn rem(self, other: &'b Ratio<T>) -> Ratio<T>

Performs the % operation. Read more
Source§

impl<'a, T> Rem<&'a Ratio<T>> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the % operator.
Source§

fn rem(self, other: &Ratio<T>) -> Ratio<T>

Performs the % operation. Read more
Source§

impl<'a, 'b, T> Rem<&'b T> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the % operator.
Source§

fn rem(self, other: &'b T) -> Ratio<T>

Performs the % operation. Read more
Source§

impl<'a, T> Rem<&'a T> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the % operator.
Source§

fn rem(self, other: &T) -> Ratio<T>

Performs the % operation. Read more
Source§

impl<'a, T> Rem<Ratio<T>> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the % operator.
Source§

fn rem(self, other: Ratio<T>) -> Ratio<T>

Performs the % operation. Read more
Source§

impl<'a, T> Rem<T> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the % operator.
Source§

fn rem(self, other: T) -> Ratio<T>

Performs the % operation. Read more
Source§

impl<T> Rem<T> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: T) -> Ratio<T>

Performs the % operation. Read more
Source§

impl<T> Rem for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Ratio<T>) -> Ratio<T>

Performs the % operation. Read more
Source§

impl<'a, T> RemAssign<&'a Ratio<T>> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn rem_assign(&mut self, other: &Ratio<T>)

Performs the %= operation. Read more
Source§

impl<'a, T> RemAssign<&'a T> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn rem_assign(&mut self, other: &T)

Performs the %= operation. Read more
Source§

impl<T> RemAssign<T> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn rem_assign(&mut self, other: T)

Performs the %= operation. Read more
Source§

impl<T> RemAssign for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn rem_assign(&mut self, other: Ratio<T>)

Performs the %= operation. Read more
Source§

impl<T> Signed for Ratio<T>
where T: Clone + Integer + Signed,

Source§

fn abs(&self) -> Ratio<T>

Computes the absolute value. Read more
Source§

fn abs_sub(&self, other: &Ratio<T>) -> Ratio<T>

The positive difference of two numbers. Read more
Source§

fn signum(&self) -> Ratio<T>

Returns the sign of the number. Read more
Source§

fn is_positive(&self) -> bool

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

fn is_negative(&self) -> bool

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

impl<'a, 'b, T> Sub<&'b Ratio<T>> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'b Ratio<T>) -> Ratio<T>

Performs the - operation. Read more
Source§

impl<'a, T> Sub<&'a Ratio<T>> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &Ratio<T>) -> Ratio<T>

Performs the - operation. Read more
Source§

impl<'a, 'b, T> Sub<&'b T> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'b T) -> Ratio<T>

Performs the - operation. Read more
Source§

impl<'a, T> Sub<&'a T> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &T) -> Ratio<T>

Performs the - operation. Read more
Source§

impl<'a, T> Sub<Ratio<T>> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Ratio<T>) -> Ratio<T>

Performs the - operation. Read more
Source§

impl<'a, T> Sub<T> for &'a Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: T) -> Ratio<T>

Performs the - operation. Read more
Source§

impl<T> Sub<T> for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Ratio<T>

Performs the - operation. Read more
Source§

impl<T> Sub for Ratio<T>
where T: Clone + Integer,

Source§

type Output = Ratio<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Ratio<T>) -> Ratio<T>

Performs the - operation. Read more
Source§

impl<'a, T> SubAssign<&'a Ratio<T>> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn sub_assign(&mut self, other: &Ratio<T>)

Performs the -= operation. Read more
Source§

impl<'a, T> SubAssign<&'a T> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn sub_assign(&mut self, other: &T)

Performs the -= operation. Read more
Source§

impl<T> SubAssign<T> for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn sub_assign(&mut self, other: T)

Performs the -= operation. Read more
Source§

impl<T> SubAssign for Ratio<T>
where T: Clone + Integer + NumAssign,

Source§

fn sub_assign(&mut self, other: Ratio<T>)

Performs the -= operation. Read more
Source§

impl<'a, T> Sum<&'a Ratio<T>> for Ratio<T>
where T: Integer + Clone,

Source§

fn sum<I>(iter: I) -> Ratio<T>
where I: Iterator<Item = &'a Ratio<T>>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<T> Sum for Ratio<T>
where T: Integer + Clone,

Source§

fn sum<I>(iter: I) -> Ratio<T>
where I: Iterator<Item = Ratio<T>>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<T> ToPrimitive for Ratio<T>

Source§

fn to_i64(&self) -> Option<i64>

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned.
Source§

fn to_i128(&self) -> Option<i128>

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more
Source§

fn to_u64(&self) -> Option<u64>

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned.
Source§

fn to_u128(&self) -> Option<u128>

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more
Source§

fn to_f64(&self) -> Option<f64>

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more
Source§

fn to_isize(&self) -> Option<isize>

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned.
Source§

fn to_i8(&self) -> Option<i8>

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned.
Source§

fn to_i16(&self) -> Option<i16>

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned.
Source§

fn to_i32(&self) -> Option<i32>

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned.
Source§

fn to_usize(&self) -> Option<usize>

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned.
Source§

fn to_u8(&self) -> Option<u8>

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned.
Source§

fn to_u16(&self) -> Option<u16>

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned.
Source§

fn to_u32(&self) -> Option<u32>

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned.
Source§

fn to_f32(&self) -> Option<f32>

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32.
Source§

impl<T> UpperExp for Ratio<T>
where T: UpperExp + Clone + Integer,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> UpperHex for Ratio<T>
where T: UpperHex + Clone + Integer,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T> Zero for Ratio<T>
where T: Clone + Integer,

Source§

fn zero() -> Ratio<T>

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

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

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

impl<T> Copy for Ratio<T>
where T: Copy,

Source§

impl<T> Eq for Ratio<T>
where T: Clone + Integer,

Auto Trait Implementations§

§

impl<T> Freeze for Ratio<T>
where T: Freeze,

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> NumAssign for T
where T: Num + NumAssignOps,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T> NumAssignRef for T
where T: NumAssign + for<'r> NumAssignOps<&'r T>,

Source§

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>,

Source§

impl<T> NumRef for T
where T: Num + for<'r> NumOps<&'r T>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,