Struct num_rational::Ratio

source ·
pub struct Ratio<T> {
    pub(crate) numer: T,
    pub(crate) denom: T,
}
Expand description

Represents the ratio between two numbers.

Fields§

§numer: T

Numerator.

§denom: T

Denominator.

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: Clone + Integer> Ratio<T>

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(crate) fn reduce(&mut self)

Puts self into lowest terms, with denom > 0.

Panics if denom is zero.

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(crate) fn into_recip(self) -> Ratio<T>

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 for<'a> &'a T: Pow<u32, Output = T>,

Raises the Ratio to the power of an exponent.

source§

impl<T: ConstZero + ConstOne> Ratio<T>

source

pub const ZERO: Self = _

A constant Ratio 0/1.

source§

impl<T: ConstOne> Ratio<T>

source

pub const ONE: Self = _

A constant Ratio 1/1.

source§

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

source§

impl<T: Integer + Unsigned + Bounded + NumCast + Clone> Ratio<T>

Trait Implementations§

source§

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

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: Clone + Integer> Add<&'b T> for &'a Ratio<T>

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: Clone + Integer> Add<T> for Ratio<T>

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: Clone + Integer> Add for Ratio<T>

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: Clone + Integer + NumAssign> AddAssign<&'a Ratio<T>> for Ratio<T>

source§

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

Performs the += operation. Read more
source§

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

source§

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

Performs the += operation. Read more
source§

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

source§

fn add_assign(&mut self, other: T)

Performs the += operation. Read more
source§

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

source§

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

Performs the += operation. Read more
source§

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

source§

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

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

impl<T: Clone + Integer + CheckedMul + CheckedAdd> 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: Clone + Integer + CheckedMul + CheckedSub> 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> Clone for Ratio<T>

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

source§

const ONE: Self = Self::ONE

The multiplicative identity element of Self, 1.
source§

impl<T: Clone + Integer + ConstZero + ConstOne> ConstZero for Ratio<T>

source§

const ZERO: Self = Self::ZERO

The additive identity element of Self, 0.
source§

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

source§

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

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

impl<T: Clone + Integer> Default for Ratio<T>

source§

fn default() -> Self

Returns zero

source§

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

source§

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

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

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

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: Clone + Integer> Div<&'b T> for &'a Ratio<T>

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: Clone + Integer + NumAssign> DivAssign<&'a Ratio<T>> for Ratio<T>

source§

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

Performs the /= operation. Read more
source§

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

source§

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

Performs the /= operation. Read more
source§

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

source§

fn div_assign(&mut self, other: T)

Performs the /= operation. Read more
source§

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

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<Ratio<T>> for (T, T)

source§

fn from(val: Ratio<T>) -> Self

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

source§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 + Clone + Integer> FromStr for Ratio<T>

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: Clone + Integer + Hash> Hash for Ratio<T>

source§

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

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,

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 + Clone + Integer> LowerExp for Ratio<T>

source§

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

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

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

source§

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

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

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

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: Clone + Integer> Mul<&'b T> for &'a Ratio<T>

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: Clone + Integer + NumAssign> MulAssign<&'a Ratio<T>> for Ratio<T>

source§

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

Performs the *= operation. Read more
source§

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

source§

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

Performs the *= operation. Read more
source§

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

source§

fn mul_assign(&mut self, other: T)

Performs the *= operation. Read more
source§

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

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: Clone + Integer> Num for Ratio<T>

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 + Clone + Integer> Octal for Ratio<T>

source§

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

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

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

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: Clone + Integer> Ord for Ratio<T>

source§

fn cmp(&self, other: &Self) -> 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: Clone + Integer> PartialEq for Ratio<T>

source§

fn eq(&self, other: &Self) -> 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: Clone + Integer> PartialOrd for Ratio<T>

source§

fn partial_cmp(&self, other: &Self) -> 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: Clone + Integer> Pow<&'b i128> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u128, Output = T>> Pow<&'b i128> for Ratio<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: Clone + Integer> Pow<&'b i16> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u16, Output = T>> Pow<&'b i16> for Ratio<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: Clone + Integer> Pow<&'b i32> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u32, Output = T>> Pow<&'b i32> for Ratio<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: Clone + Integer> Pow<&'b i64> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u64, Output = T>> Pow<&'b i64> for Ratio<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: Clone + Integer> Pow<&'b i8> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u8, Output = T>> Pow<&'b i8> for Ratio<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: Clone + Integer> Pow<&'b isize> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<usize, Output = T>> Pow<&'b isize> for Ratio<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: Clone + Integer> Pow<&'b u128> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u128, Output = T>> Pow<&'b u128> for Ratio<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: Clone + Integer> Pow<&'b u16> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u16, Output = T>> Pow<&'b u16> for Ratio<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: Clone + Integer> Pow<&'b u32> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u32, Output = T>> Pow<&'b u32> for Ratio<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: Clone + Integer> Pow<&'b u64> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u64, Output = T>> Pow<&'b u64> for Ratio<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: Clone + Integer> Pow<&'b u8> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u8, Output = T>> Pow<&'b u8> for Ratio<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: Clone + Integer> Pow<&'b usize> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<usize, Output = T>> Pow<&'b usize> for Ratio<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: Clone + Integer> Pow<i128> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u128, Output = T>> Pow<i128> for Ratio<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: Clone + Integer> Pow<i16> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u16, Output = T>> Pow<i16> for Ratio<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: Clone + Integer> Pow<i32> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u32, Output = T>> Pow<i32> for Ratio<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: Clone + Integer> Pow<i64> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u64, Output = T>> Pow<i64> for Ratio<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: Clone + Integer> Pow<i8> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u8, Output = T>> Pow<i8> for Ratio<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: Clone + Integer> Pow<isize> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<usize, Output = T>> Pow<isize> for Ratio<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: Clone + Integer> Pow<u128> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u128, Output = T>> Pow<u128> for Ratio<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: Clone + Integer> Pow<u16> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u16, Output = T>> Pow<u16> for Ratio<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: Clone + Integer> Pow<u32> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u32, Output = T>> Pow<u32> for Ratio<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: Clone + Integer> Pow<u64> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u64, Output = T>> Pow<u64> for Ratio<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: Clone + Integer> Pow<u8> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<u8, Output = T>> Pow<u8> for Ratio<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: Clone + Integer> Pow<usize> for &'a Ratio<T>
where &'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: Clone + Integer + Pow<usize, Output = T>> Pow<usize> for Ratio<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: Integer + Clone> Product<&'a Ratio<T>> for Ratio<T>

source§

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

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

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

source§

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

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

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

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: Clone + Integer> Rem<&'b T> for &'a Ratio<T>

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: Clone + Integer> Rem<T> for Ratio<T>

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: Clone + Integer> Rem for Ratio<T>

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: Clone + Integer + NumAssign> RemAssign<&'a Ratio<T>> for Ratio<T>

source§

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

Performs the %= operation. Read more
source§

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

source§

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

Performs the %= operation. Read more
source§

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

source§

fn rem_assign(&mut self, other: T)

Performs the %= operation. Read more
source§

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

source§

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

Performs the %= operation. Read more
source§

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

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: Clone + Integer> Sub<&'b Ratio<T>> for &'a Ratio<T>

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: Clone + Integer> Sub<&'b T> for &'a Ratio<T>

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: Clone + Integer> Sub<T> for Ratio<T>

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: Clone + Integer> Sub for Ratio<T>

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: Clone + Integer + NumAssign> SubAssign<&'a Ratio<T>> for Ratio<T>

source§

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

Performs the -= operation. Read more
source§

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

source§

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

Performs the -= operation. Read more
source§

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

source§

fn sub_assign(&mut self, other: T)

Performs the -= operation. Read more
source§

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

source§

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

Performs the -= operation. Read more
source§

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

source§

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

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

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

source§

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

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

impl ToPrimitive for Ratio<i16>

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 ToPrimitive for Ratio<i32>

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 ToPrimitive for Ratio<i64>

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 ToPrimitive for Ratio<i8>

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 ToPrimitive for Ratio<isize>

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 ToPrimitive for Ratio<u16>

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 ToPrimitive for Ratio<u32>

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 ToPrimitive for Ratio<u64>

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 ToPrimitive for Ratio<u8>

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 ToPrimitive for Ratio<usize>

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 + Clone + Integer> UpperExp for Ratio<T>

source§

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

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

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

source§

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

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

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

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

source§

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

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