Struct num::rational::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.

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 fn into_raw(self) -> (T, T)

Deconstructs a Ratio into its numerator and denominator.

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: ConstZero + ConstOne,

source

pub const ZERO: Ratio<T> = _

A constant Ratio 0/1.

source§

impl<T> Ratio<T>
where T: ConstOne,

source

pub const ONE: Ratio<T> = _

A constant Ratio 1/1.

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,

source§

impl<T> Ratio<T>

Trait Implementations§

source§

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

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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.
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> ConstOne for Ratio<T>
where T: Clone + Integer + ConstOne,

source§

const ONE: Ratio<T> = Self::ONE

The multiplicative identity element of Self, 1.
source§

impl<T> ConstZero for Ratio<T>

source§

const ZERO: Ratio<T> = Self::ZERO

The additive identity element of Self, 0.
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> Default for Ratio<T>
where T: Clone + Integer,

source§

fn default() -> Ratio<T>

Returns zero

source§

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

source§

fn deserialize<D>( deserializer: D ) -> Result<Ratio<T>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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.

§

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<'a, T> Inv for &'a Ratio<T>
where T: Clone + Integer,

§

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,

§

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.
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.
source§

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

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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

§

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

§

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.

§

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.
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 + PartialOrd,

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method 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

This method 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

This method 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

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

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

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

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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> Serialize for Ratio<T>

source§

fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. 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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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,

§

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

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

Method which 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.
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.
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> 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,

§

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

§

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

§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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