pub trait Fraction<T>: Sized {
    // Required methods
    fn numerator(&self) -> T;
    fn denominator(&self) -> T;
    fn inv(&self) -> Option<Self>;
}
Expand description

A fraction p/q with integers p and q.

p is called the numerator and q is called the denominator.

Required Methods§

source

fn numerator(&self) -> T

Returns the numerator p

source

fn denominator(&self) -> T

Returns the denominator q

source

fn inv(&self) -> Option<Self>

Returns the multiplicative inverse q/p for fraction p/q.

If p is zero, None is returned.

Implementations on Foreign Types§

source§

impl<T: Copy + From<u8> + PartialEq> Fraction<T> for (T, T)

source§

fn numerator(&self) -> T

source§

fn denominator(&self) -> T

source§

fn inv(&self) -> Option<Self>

Implementors§