pub struct Rational { /* private fields */ }
Expand description
A rational number (a fraction of two integers).
Implementations§
source§impl Rational
impl Rational
sourcepub fn new_checked<N, D>(numerator: N, denominator: D) -> Option<Self>where
Self: From<N> + From<D>,
pub fn new_checked<N, D>(numerator: N, denominator: D) -> Option<Self>where Self: From<N> + From<D>,
Construct a new Rational, returning None
if the denominator is 0.
sourcepub fn from_mixed<T>(whole: i128, fract: T) -> Selfwhere
Self: From<T>,
pub fn from_mixed<T>(whole: i128, fract: T) -> Selfwhere Self: From<T>,
Create a Rational
from a mixed fraction.
Example
assert_eq!(Rational::from_mixed(1, (1, 2)), Rational::new(3, 2));
assert_eq!(Rational::from_mixed(-1, (-1, 2)), Rational::new(-3, 2));
sourcepub fn integer(n: i128) -> Self
pub fn integer(n: i128) -> Self
Shorthand for creating an integer Rational
, eg. 5/1.
Example
assert_eq!(Rational::integer(5), Rational::new(5, 1));
assert_eq!(Rational::integer(-100), Rational::new(-100, 1));
sourcepub fn numerator(&self) -> i128
pub fn numerator(&self) -> i128
Get the numerator in this Rational
.
Example
let r = Rational::new(4, 6);
assert_eq!(r.numerator(), 2); // `r` has been reduced to 2/3
sourcepub fn set_numerator(&mut self, numerator: i128)
pub fn set_numerator(&mut self, numerator: i128)
Set the numerator of this Rational
. It is then automatically reduced.
Example
let mut r = Rational::new(4, 5);
r.set_numerator(10);
assert_eq!(r, Rational::new(2, 1)); // 10/5 reduces to 2/1
sourcepub fn denominator(&self) -> i128
pub fn denominator(&self) -> i128
Get the denominator in this Rational
.
Example
let r = Rational::new(4, 6);
assert_eq!(r.denominator(), 3); // `r` has been reduced to 2/3
sourcepub fn set_denominator(&mut self, denominator: i128)
pub fn set_denominator(&mut self, denominator: i128)
sourcepub fn inverse_checked(self) -> Option<Self>
pub fn inverse_checked(self) -> Option<Self>
Returns the inverse of this Rational
, or None
if the denominator of the inverse is 0.
Example
let r = Rational::new(1, 2);
assert_eq!(r.inverse_checked(), Some(Rational::new(2, 1)));
let zero = Rational::new(0, 1);
assert!(zero.inverse_checked().is_none());
sourcepub fn decimal_value(self) -> f64
pub fn decimal_value(self) -> f64
Returns the decimal value of this Rational
.
Equivalent to f64::from(self)
.
sourcepub fn checked_add<T>(self, rhs: T) -> Option<Self>where
Self: From<T>,
pub fn checked_add<T>(self, rhs: T) -> Option<Self>where Self: From<T>,
Checked addition. Computes self + rhs
, returning None
if overflow occurred.
Notes
Keep in mind that there are various operations performed in order to add two rational numbers, which may lead to overflow for rational with very large numerators or denominators, even though the rational number itself may be small.
Example
assert_eq!(Rational::new(1, 2).checked_add(Rational::new(2, 3)), Some(Rational::new(7, 6)));
assert_eq!(Rational::new(1, 2).checked_add(2_i32), Some(Rational::new(5, 2)));
assert!(Rational::new(1, 1).checked_add(i128::MAX).is_none());
sourcepub fn checked_mul<T>(self, rhs: T) -> Option<Self>where
Self: From<T>,
pub fn checked_mul<T>(self, rhs: T) -> Option<Self>where Self: From<T>,
Checked multiplication. Computes self * rhs
, returning None
if overflow occurred.
Notes
Keep in mind that there are various operations performed in order to multiply two rational numbers, which may lead to overflow for rational with very large numerators or denominators, even though the rational number itself may be small.
Example
assert_eq!(Rational::new(1, 2).checked_mul(Rational::new(2, 3)), Some(Rational::new(1, 3)));
assert_eq!(Rational::new(1, 2).checked_mul(2_i32), Some(Rational::new(1, 1)));
assert!(Rational::new(2, 1).checked_mul(i128::MAX).is_none());
sourcepub fn checked_sub<T>(self, rhs: T) -> Option<Self>where
Self: From<T>,
pub fn checked_sub<T>(self, rhs: T) -> Option<Self>where Self: From<T>,
Checked subtraction. Computes self - rhs
, returning None
if overflow occurred.
Notes
Keep in mind that there are various operations performed in order to subtract two rational numbers, which may lead to overflow for rational with very large numerators or denominators, even though the rational number itself may be small.
Example
assert_eq!(Rational::new(1, 2).checked_sub(Rational::new(2, 3)), Some(Rational::new(-1, 6)));
assert_eq!(Rational::new(1, 2).checked_sub(2_i32), Some(Rational::new(-3, 2)));
assert!(Rational::new(-10, 1).checked_sub(i128::MAX).is_none());
sourcepub fn checked_div<T>(self, rhs: T) -> Option<Self>where
Self: From<T>,
pub fn checked_div<T>(self, rhs: T) -> Option<Self>where Self: From<T>,
Checked division. Computes self / rhs
, returning None
if overflow occurred.
Panics
- If
rhs == 0
Notes
Keep in mind that there are various operations performed in order to divide two rational numbers, which may lead to overflow for rational with very large numerators or denominators, even though the rational number itself may be small.
Example
assert_eq!(Rational::new(1, 2).checked_div(Rational::new(2, 3)), Some(Rational::new(3, 4)));
assert_eq!(Rational::new(1, 2).checked_div(2_i32), Some(Rational::new(1, 4)));
assert!(Rational::new(1, i128::MAX).checked_div(i128::MAX).is_none());
sourcepub fn pow(self, exp: i32) -> Rational
pub fn pow(self, exp: i32) -> Rational
Raises self to the power of exp
.
Notes
Unlike the pow
methods in std
, this supports negative exponents, returning the inverse of the result.
The exponent still needs to be an integer, since a rational number raised to the power of another rational number may be irrational.
Panics
- If the numerator is 0 and
exp
is negative (since a negative exponent will result in an inversed fraction).
Example
assert_eq!(Rational::new(2, 3).pow(2), Rational::new(4, 9));
assert_eq!(Rational::new(1, 4).pow(-2), Rational::new(16, 1));
pub fn checked_pow(self, exp: i32) -> Option<Self>
sourcepub fn abs(self) -> Self
pub fn abs(self) -> Self
Computes the absolute value of self
.
Example
assert_eq!(Rational::new(-5, 3).abs(), Rational::new(5, 3));
sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true
if self
is an integer.
This is a shorthand for self.denominator() == 1
.
Example
assert!(Rational::new(2, 1).is_integer());
assert!(!Rational::new(1, 2).is_integer());
sourcepub fn is_positive(&self) -> bool
pub fn is_positive(&self) -> bool
Returns true
if self
is positive and false
if it is zero or negative.
Example
assert!(Rational::new(1, 2).is_positive());
assert!(Rational::new(-1, -2).is_positive());
assert!(!Rational::new(-1, 2).is_positive());
assert!(!Rational::zero().is_positive());
sourcepub fn is_negative(&self) -> bool
pub fn is_negative(&self) -> bool
Returns true
if self
is negative and false
if it is zero or positive.
Example
assert!(Rational::new(-1, 2).is_negative());
assert!(Rational::new(1, -2).is_negative());
assert!(!Rational::zero().is_negative());
sourcepub fn mixed_fraction(self) -> (i128, Self)
pub fn mixed_fraction(self) -> (i128, Self)
Returns a tuple representing self
as a mixed fraction.
Notes
The result is a tuple (whole: i128, fraction: Rational)
, such that whole + fraction == self
.
This means that while you might write -7/2 as a mixed fraction: -3½, the result will be a tuple (-3, -1/2).
Example
assert_eq!(Rational::new(7, 3).mixed_fraction(), (2, Rational::new(1, 3)));
let (mixed, fract) = Rational::new(-7, 2).mixed_fraction();
assert_eq!((mixed, fract), (-3, Rational::new(-1, 2)));
assert_eq!(mixed + fract, Rational::new(-7, 2));
Trait Implementations§
source§impl AddAssign<Rational> for Rational
impl AddAssign<Rational> for Rational
source§fn add_assign(&mut self, rhs: Rational)
fn add_assign(&mut self, rhs: Rational)
+=
operation. Read moresource§impl AddAssign<i128> for Rational
impl AddAssign<i128> for Rational
source§fn add_assign(&mut self, rhs: i128)
fn add_assign(&mut self, rhs: i128)
+=
operation. Read moresource§impl AddAssign<i16> for Rational
impl AddAssign<i16> for Rational
source§fn add_assign(&mut self, rhs: i16)
fn add_assign(&mut self, rhs: i16)
+=
operation. Read moresource§impl AddAssign<i32> for Rational
impl AddAssign<i32> for Rational
source§fn add_assign(&mut self, rhs: i32)
fn add_assign(&mut self, rhs: i32)
+=
operation. Read moresource§impl AddAssign<i64> for Rational
impl AddAssign<i64> for Rational
source§fn add_assign(&mut self, rhs: i64)
fn add_assign(&mut self, rhs: i64)
+=
operation. Read moresource§impl AddAssign<i8> for Rational
impl AddAssign<i8> for Rational
source§fn add_assign(&mut self, rhs: i8)
fn add_assign(&mut self, rhs: i8)
+=
operation. Read moresource§impl AddAssign<u16> for Rational
impl AddAssign<u16> for Rational
source§fn add_assign(&mut self, rhs: u16)
fn add_assign(&mut self, rhs: u16)
+=
operation. Read moresource§impl AddAssign<u32> for Rational
impl AddAssign<u32> for Rational
source§fn add_assign(&mut self, rhs: u32)
fn add_assign(&mut self, rhs: u32)
+=
operation. Read moresource§impl AddAssign<u64> for Rational
impl AddAssign<u64> for Rational
source§fn add_assign(&mut self, rhs: u64)
fn add_assign(&mut self, rhs: u64)
+=
operation. Read moresource§impl AddAssign<u8> for Rational
impl AddAssign<u8> for Rational
source§fn add_assign(&mut self, rhs: u8)
fn add_assign(&mut self, rhs: u8)
+=
operation. Read moresource§impl DivAssign<Rational> for Rational
impl DivAssign<Rational> for Rational
source§fn div_assign(&mut self, rhs: Rational)
fn div_assign(&mut self, rhs: Rational)
/=
operation. Read moresource§impl DivAssign<i128> for Rational
impl DivAssign<i128> for Rational
source§fn div_assign(&mut self, rhs: i128)
fn div_assign(&mut self, rhs: i128)
/=
operation. Read moresource§impl DivAssign<i16> for Rational
impl DivAssign<i16> for Rational
source§fn div_assign(&mut self, rhs: i16)
fn div_assign(&mut self, rhs: i16)
/=
operation. Read moresource§impl DivAssign<i32> for Rational
impl DivAssign<i32> for Rational
source§fn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
/=
operation. Read moresource§impl DivAssign<i64> for Rational
impl DivAssign<i64> for Rational
source§fn div_assign(&mut self, rhs: i64)
fn div_assign(&mut self, rhs: i64)
/=
operation. Read moresource§impl DivAssign<i8> for Rational
impl DivAssign<i8> for Rational
source§fn div_assign(&mut self, rhs: i8)
fn div_assign(&mut self, rhs: i8)
/=
operation. Read moresource§impl DivAssign<u16> for Rational
impl DivAssign<u16> for Rational
source§fn div_assign(&mut self, rhs: u16)
fn div_assign(&mut self, rhs: u16)
/=
operation. Read moresource§impl DivAssign<u32> for Rational
impl DivAssign<u32> for Rational
source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/=
operation. Read moresource§impl DivAssign<u64> for Rational
impl DivAssign<u64> for Rational
source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
/=
operation. Read moresource§impl DivAssign<u8> for Rational
impl DivAssign<u8> for Rational
source§fn div_assign(&mut self, rhs: u8)
fn div_assign(&mut self, rhs: u8)
/=
operation. Read moresource§impl MulAssign<Rational> for Rational
impl MulAssign<Rational> for Rational
source§fn mul_assign(&mut self, rhs: Rational)
fn mul_assign(&mut self, rhs: Rational)
*=
operation. Read moresource§impl MulAssign<i128> for Rational
impl MulAssign<i128> for Rational
source§fn mul_assign(&mut self, rhs: i128)
fn mul_assign(&mut self, rhs: i128)
*=
operation. Read moresource§impl MulAssign<i16> for Rational
impl MulAssign<i16> for Rational
source§fn mul_assign(&mut self, rhs: i16)
fn mul_assign(&mut self, rhs: i16)
*=
operation. Read moresource§impl MulAssign<i32> for Rational
impl MulAssign<i32> for Rational
source§fn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
*=
operation. Read moresource§impl MulAssign<i64> for Rational
impl MulAssign<i64> for Rational
source§fn mul_assign(&mut self, rhs: i64)
fn mul_assign(&mut self, rhs: i64)
*=
operation. Read moresource§impl MulAssign<i8> for Rational
impl MulAssign<i8> for Rational
source§fn mul_assign(&mut self, rhs: i8)
fn mul_assign(&mut self, rhs: i8)
*=
operation. Read moresource§impl MulAssign<u16> for Rational
impl MulAssign<u16> for Rational
source§fn mul_assign(&mut self, rhs: u16)
fn mul_assign(&mut self, rhs: u16)
*=
operation. Read moresource§impl MulAssign<u32> for Rational
impl MulAssign<u32> for Rational
source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*=
operation. Read moresource§impl MulAssign<u64> for Rational
impl MulAssign<u64> for Rational
source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
*=
operation. Read moresource§impl MulAssign<u8> for Rational
impl MulAssign<u8> for Rational
source§fn mul_assign(&mut self, rhs: u8)
fn mul_assign(&mut self, rhs: u8)
*=
operation. Read moresource§impl Ord for Rational
impl Ord for Rational
source§impl PartialEq<Rational> for Rational
impl PartialEq<Rational> for Rational
source§impl PartialEq<Rational> for f32
impl PartialEq<Rational> for f32
source§impl PartialEq<Rational> for f64
impl PartialEq<Rational> for f64
source§impl PartialEq<Rational> for i128
impl PartialEq<Rational> for i128
source§impl PartialEq<Rational> for i16
impl PartialEq<Rational> for i16
source§impl PartialEq<Rational> for i32
impl PartialEq<Rational> for i32
source§impl PartialEq<Rational> for i64
impl PartialEq<Rational> for i64
source§impl PartialEq<Rational> for i8
impl PartialEq<Rational> for i8
source§impl PartialEq<Rational> for u16
impl PartialEq<Rational> for u16
source§impl PartialEq<Rational> for u32
impl PartialEq<Rational> for u32
source§impl PartialEq<Rational> for u64
impl PartialEq<Rational> for u64
source§impl PartialEq<Rational> for u8
impl PartialEq<Rational> for u8
source§impl PartialEq<i128> for Rational
impl PartialEq<i128> for Rational
source§impl PartialOrd<Rational> for Rational
impl PartialOrd<Rational> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for f32
impl PartialOrd<Rational> for f32
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for f64
impl PartialOrd<Rational> for f64
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for i128
impl PartialOrd<Rational> for i128
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for i16
impl PartialOrd<Rational> for i16
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for i32
impl PartialOrd<Rational> for i32
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for i64
impl PartialOrd<Rational> for i64
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for i8
impl PartialOrd<Rational> for i8
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for u16
impl PartialOrd<Rational> for u16
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for u32
impl PartialOrd<Rational> for u32
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for u64
impl PartialOrd<Rational> for u64
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for u8
impl PartialOrd<Rational> for u8
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<f32> for Rational
impl PartialOrd<f32> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<f64> for Rational
impl PartialOrd<f64> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<i128> for Rational
impl PartialOrd<i128> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<i16> for Rational
impl PartialOrd<i16> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<i32> for Rational
impl PartialOrd<i32> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<i64> for Rational
impl PartialOrd<i64> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<i8> for Rational
impl PartialOrd<i8> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<u16> for Rational
impl PartialOrd<u16> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<u32> for Rational
impl PartialOrd<u32> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<u64> for Rational
impl PartialOrd<u64> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<u8> for Rational
impl PartialOrd<u8> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl RemAssign<Rational> for Rational
impl RemAssign<Rational> for Rational
source§fn rem_assign(&mut self, rhs: Rational)
fn rem_assign(&mut self, rhs: Rational)
%=
operation. Read moresource§impl RemAssign<i128> for Rational
impl RemAssign<i128> for Rational
source§fn rem_assign(&mut self, rhs: i128)
fn rem_assign(&mut self, rhs: i128)
%=
operation. Read moresource§impl RemAssign<i16> for Rational
impl RemAssign<i16> for Rational
source§fn rem_assign(&mut self, rhs: i16)
fn rem_assign(&mut self, rhs: i16)
%=
operation. Read moresource§impl RemAssign<i32> for Rational
impl RemAssign<i32> for Rational
source§fn rem_assign(&mut self, rhs: i32)
fn rem_assign(&mut self, rhs: i32)
%=
operation. Read moresource§impl RemAssign<i64> for Rational
impl RemAssign<i64> for Rational
source§fn rem_assign(&mut self, rhs: i64)
fn rem_assign(&mut self, rhs: i64)
%=
operation. Read moresource§impl RemAssign<i8> for Rational
impl RemAssign<i8> for Rational
source§fn rem_assign(&mut self, rhs: i8)
fn rem_assign(&mut self, rhs: i8)
%=
operation. Read moresource§impl RemAssign<u16> for Rational
impl RemAssign<u16> for Rational
source§fn rem_assign(&mut self, rhs: u16)
fn rem_assign(&mut self, rhs: u16)
%=
operation. Read moresource§impl RemAssign<u32> for Rational
impl RemAssign<u32> for Rational
source§fn rem_assign(&mut self, rhs: u32)
fn rem_assign(&mut self, rhs: u32)
%=
operation. Read moresource§impl RemAssign<u64> for Rational
impl RemAssign<u64> for Rational
source§fn rem_assign(&mut self, rhs: u64)
fn rem_assign(&mut self, rhs: u64)
%=
operation. Read moresource§impl RemAssign<u8> for Rational
impl RemAssign<u8> for Rational
source§fn rem_assign(&mut self, rhs: u8)
fn rem_assign(&mut self, rhs: u8)
%=
operation. Read moresource§impl SubAssign<Rational> for Rational
impl SubAssign<Rational> for Rational
source§fn sub_assign(&mut self, rhs: Rational)
fn sub_assign(&mut self, rhs: Rational)
-=
operation. Read moresource§impl SubAssign<i128> for Rational
impl SubAssign<i128> for Rational
source§fn sub_assign(&mut self, rhs: i128)
fn sub_assign(&mut self, rhs: i128)
-=
operation. Read moresource§impl SubAssign<i16> for Rational
impl SubAssign<i16> for Rational
source§fn sub_assign(&mut self, rhs: i16)
fn sub_assign(&mut self, rhs: i16)
-=
operation. Read moresource§impl SubAssign<i32> for Rational
impl SubAssign<i32> for Rational
source§fn sub_assign(&mut self, rhs: i32)
fn sub_assign(&mut self, rhs: i32)
-=
operation. Read moresource§impl SubAssign<i64> for Rational
impl SubAssign<i64> for Rational
source§fn sub_assign(&mut self, rhs: i64)
fn sub_assign(&mut self, rhs: i64)
-=
operation. Read moresource§impl SubAssign<i8> for Rational
impl SubAssign<i8> for Rational
source§fn sub_assign(&mut self, rhs: i8)
fn sub_assign(&mut self, rhs: i8)
-=
operation. Read moresource§impl SubAssign<u16> for Rational
impl SubAssign<u16> for Rational
source§fn sub_assign(&mut self, rhs: u16)
fn sub_assign(&mut self, rhs: u16)
-=
operation. Read moresource§impl SubAssign<u32> for Rational
impl SubAssign<u32> for Rational
source§fn sub_assign(&mut self, rhs: u32)
fn sub_assign(&mut self, rhs: u32)
-=
operation. Read moresource§impl SubAssign<u64> for Rational
impl SubAssign<u64> for Rational
source§fn sub_assign(&mut self, rhs: u64)
fn sub_assign(&mut self, rhs: u64)
-=
operation. Read moresource§impl SubAssign<u8> for Rational
impl SubAssign<u8> for Rational
source§fn sub_assign(&mut self, rhs: u8)
fn sub_assign(&mut self, rhs: u8)
-=
operation. Read more