Struct Rational
struct Rational { ... }
A rational number.
Fields
num: u64Numerator.
den: u64Denominator.
Implementations
impl Rational
const fn new(num: u64, den: u64) -> SelfCreates a rational number from the given numerator and denominator.
const fn from_reciprocal(reciprocal: Self) -> SelfReturns a rational number that is the reciprocal of the given one.
fn as_f64(self: Self) -> f64Returns the rational number as a floating-point number.
impl Clone for Rational
fn clone(self: &Self) -> Rational
impl Copy for Rational
impl Debug for Rational
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Freeze for Rational
impl RefUnwindSafe for Rational
impl Send for Rational
impl Sync for Rational
impl Unpin for Rational
impl UnsafeUnpin for Rational
impl UnwindSafe for Rational
impl<T> Any for Rational
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Rational
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Rational
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Rational
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Rational
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Rational
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for Rational
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Rational
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Rational
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>