Struct Ratio

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

Represents the ratio between two numbers.

Implementations

impl Ratio<BigInt>

fn from_float<T: FloatCore>(f: T) -> Option<BigRational>

Converts a float into a rational number.

impl<T> Ratio<T>

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.

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

Deconstructs a Ratio into its numerator and denominator.

const fn numer(&self) -> &T

Gets an immutable reference to the numerator.

const fn denom(&self) -> &T

Gets an immutable reference to the denominator.

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

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

Creates a new Ratio.

Panics if denom is zero.

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

Creates a Ratio representing the integer t.

fn to_integer(&self) -> T

Converts to an integer, rounding towards zero.

fn is_integer(&self) -> bool

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

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.

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

Returns the reciprocal.

Panics if the Ratio is zero.

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

Rounds towards minus infinity.

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

Rounds towards plus infinity.

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

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

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

Rounds towards zero.

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

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

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

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.

impl<T: ConstOne> Ratio<T>

const ONE: Self = _;

A constant Ratio 1/1.

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

const ZERO: Self = _;

A constant Ratio 0/1.

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

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

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

fn approximate_float_unsigned<F: FloatCore + NumCast>(f: F) -> Option<Ratio<T>>

Trait Implementations

impl FromPrimitive for Ratio<BigInt>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<i128>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<i16>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<i32>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<i64>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<i8>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<isize>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<u128>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<u16>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<u32>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<u64>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<u8>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

impl FromPrimitive for Ratio<usize>

fn from_i64(n: i64) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
fn from_f32(n: f32) -> Option<Self>
fn from_f64(n: f64) -> Option<Self>

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

type Output = Ratio<T>;
fn add(self, other: &Ratio<T>) -> Ratio<T>

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

type Output = Ratio<T>;
fn add(self, other: &T) -> Ratio<T>

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

type Output = Ratio<T>;
fn div(self, other: &Ratio<T>) -> Ratio<T>

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

type Output = Ratio<T>;
fn div(self, other: &T) -> Ratio<T>

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

type Output = Ratio<T>;
fn mul(self, other: &Ratio<T>) -> Ratio<T>

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

type Output = Ratio<T>;
fn mul(self, other: &T) -> Ratio<T>

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

type Output = Ratio<T>;
fn rem(self, other: &Ratio<T>) -> Ratio<T>

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

type Output = Ratio<T>;
fn rem(self, other: &T) -> Ratio<T>

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

type Output = Ratio<T>;
fn sub(self, other: &Ratio<T>) -> Ratio<T>

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

type Output = Ratio<T>;
fn sub(self, other: &T) -> Ratio<T>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

type Output = Ratio<T>;
fn div(self, rhs: Ratio<T>) -> Ratio<T>

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

type Output = Ratio<T>;
fn div(self, rhs: T) -> Ratio<T>

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

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

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

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

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

type Output = Ratio<T>;
fn inv(self) -> Ratio<T>

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

type Output = Ratio<T>;
fn mul(self, rhs: Ratio<T>) -> Ratio<T>

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

type Output = Ratio<T>;
fn mul(self, rhs: T) -> Ratio<T>

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

type Output = Ratio<T>;
fn neg(self) -> Ratio<T>

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

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

impl<T: Clone + Integer + CheckedMul + CheckedAdd> CheckedAdd for Ratio<T>

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

impl<T: Clone + Integer + CheckedMul + CheckedSub> CheckedSub for Ratio<T>

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

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

const ONE: Self = Self::ONE;

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

const ZERO: Self = Self::ZERO;

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

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

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

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

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

fn add_assign(&mut self, other: T)

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

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

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

fn div_assign(&mut self, other: T)

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

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

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

fn mul_assign(&mut self, other: T)

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

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

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

fn rem_assign(&mut self, other: T)

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

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

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

fn sub_assign(&mut self, other: T)

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

type Output = Ratio<T>;
fn pow(self, expon: i128) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: u128) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: i16) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: u16) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: i32) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: u32) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: i64) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: u64) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: i8) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: u8) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: isize) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: usize) -> Ratio<T>

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

fn abs(&self) -> Ratio<T>
fn abs_sub(&self, other: &Ratio<T>) -> Ratio<T>
fn signum(&self) -> Ratio<T>
fn is_positive(&self) -> bool
fn is_negative(&self) -> bool

impl<T: Clone + Integer + ToPrimitive + ToBigInt> ToPrimitive for Ratio<T>

fn to_i64(&self) -> Option<i64>
fn to_i128(&self) -> Option<i128>
fn to_u64(&self) -> Option<u64>
fn to_u128(&self) -> Option<u128>
fn to_f64(&self) -> Option<f64>

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

type Output = Ratio<T>;
fn pow(self, expon: BigInt) -> Ratio<T>

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

type Output = Ratio<T>;
fn pow(self, expon: BigUint) -> Ratio<T>

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

type Output = Ratio<T>;
fn add(self, rhs: Ratio<T>) -> Ratio<T>

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

type Output = Ratio<T>;
fn add(self, rhs: T) -> Ratio<T>

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

fn default() -> Self

Returns zero

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

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

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

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

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

fn one() -> Ratio<T>
fn is_one(&self) -> bool
fn set_one(&mut self)

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

fn cmp(&self, other: &Self) -> Ordering

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

fn eq(&self, other: &Self) -> bool

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

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

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

type Output = Ratio<T>;
fn rem(self, rhs: Ratio<T>) -> Ratio<T>

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

type Output = Ratio<T>;
fn rem(self, rhs: T) -> Ratio<T>

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

type Output = Ratio<T>;
fn sub(self, rhs: Ratio<T>) -> Ratio<T>

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

type Output = Ratio<T>;
fn sub(self, rhs: T) -> Ratio<T>

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

fn zero() -> Ratio<T>
fn is_zero(&self) -> bool
fn set_zero(&mut self)

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

fn clone(&self) -> Self

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

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

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

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

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

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

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

Parses numer/denom or just numer.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Auto Trait Implementations

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

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

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

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

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

impl<T> UnsafeUnpin for Ratio<T> where T: UnsafeUnpin + UnsafeUnpin,

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

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Ratio<T>

fn from(t: T) -> T

Returns the argument unchanged.

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

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

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

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

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

fn to_string(&self) -> String

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

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

impl<T, Rhs, Output> NumOps<Rhs, Output> for Ratio<T> where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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