pub struct Rat { /* private fields */ }Implementations§
Source§impl Rat
impl Rat
pub fn new(n: i128, d: i128) -> Rat
pub fn int(v: i64) -> Rat
pub fn from_u64(v: u64) -> Rat
pub fn mul(self, o: Rat) -> Rat
pub fn div(self, o: Rat) -> Rat
pub fn add(self, o: Rat) -> Rat
pub fn sub(self, o: Rat) -> Rat
Sourcepub fn pow10(exp: i64) -> Rat
pub fn pow10(exp: i64) -> Rat
10^exp as an exact rational (|exp| <= 38 fits i128; clamp beyond).
pub fn to_f64(self) -> f64
Trait Implementations§
impl Copy for Rat
impl Eq for Rat
impl StructuralPartialEq for Rat
Auto Trait Implementations§
impl Freeze for Rat
impl RefUnwindSafe for Rat
impl Send for Rat
impl Sync for Rat
impl Unpin for Rat
impl UnsafeUnpin for Rat
impl UnwindSafe for Rat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.