[−][src]Struct ketos::integer::Ratio
Arbitrary precision signed integer ratio
Methods
impl Ratio
[src]
pub fn new(numer: Integer, denom: Integer) -> Ratio
[src]
pub fn from_f32(f: f32) -> Option<Ratio>
[src]
Creates a Ratio
with the value of the given f32
.
Returns None
if the value cannot be converted.
pub fn from_f64(f: f64) -> Option<Ratio>
[src]
Creates a Ratio
with the value of the given f64
.
Returns None
if the value cannot be converted.
pub fn from_integer(i: Integer) -> Ratio
[src]
Creates a Ratio
from an Integer
value.
pub fn to_f32(&self) -> Option<f32>
[src]
Returns the Ratio
as an f32
value.
pub fn to_f64(&self) -> Option<f64>
[src]
Returns the Ratio
as an f64
value.
pub fn to_integer(&self) -> Integer
[src]
Truncates a Ratio
and returns the whole portion as an Integer
.
pub fn is_integer(&self) -> bool
[src]
Returns whether the Ratio
is an integer; i.e. its denominator is 1
.
pub fn abs(&self) -> Ratio
[src]
Returns the absolute value of the Ratio
.
pub fn ceil(&self) -> Ratio
[src]
Returns the Ratio
rounded towards positive infinity.
pub fn floor(&self) -> Ratio
[src]
Returns the Ratio
rounded towards negative infinity.
pub fn fract(&self) -> Ratio
[src]
Returns the fractional portion of a Ratio
.
pub fn round(&self) -> Ratio
[src]
Returns the Ratio
rounded to the nearest integer.
Rounds half-way cases away from zero.
pub fn trunc(&self) -> Ratio
[src]
Returns the Ratio
rounded towards zero.
pub fn recip(&self) -> Ratio
[src]
pub fn numer(&self) -> &Integer
[src]
Returns the Ratio
's numerator.
pub fn denom(&self) -> &Integer
[src]
Returns the Ratio
's denominator.
pub fn is_zero(&self) -> bool
[src]
Returns whether the Ratio
is equal to zero.
pub fn is_negative(&self) -> bool
[src]
Returns whether the Ratio
is less than zero.
pub fn is_positive(&self) -> bool
[src]
Returns whether the Ratio
is greater than zero.
pub fn zero() -> Ratio
[src]
Returns a Ratio
of value zero.
pub fn one() -> Ratio
[src]
Returns a Ratio
of value one.
Trait Implementations
impl<'a> Add<&'a Ratio> for Ratio
[src]
type Output = Ratio
The resulting type after applying the +
operator.
fn add(self, rhs: &Ratio) -> Ratio
[src]
impl<'a, 'b> Add<&'b Ratio> for &'a Ratio
[src]
type Output = Ratio
The resulting type after applying the +
operator.
fn add(self, rhs: &Ratio) -> Ratio
[src]
impl Add<Ratio> for Ratio
[src]
type Output = Ratio
The resulting type after applying the +
operator.
fn add(self, rhs: Ratio) -> Ratio
[src]
impl<'a> Add<Ratio> for &'a Ratio
[src]
type Output = Ratio
The resulting type after applying the +
operator.
fn add(self, rhs: Ratio) -> Ratio
[src]
impl<'a> AddAssign<&'a Ratio> for Ratio
[src]
fn add_assign(&mut self, rhs: &Ratio)
[src]
impl AddAssign<Ratio> for Ratio
[src]
fn add_assign(&mut self, rhs: Ratio)
[src]
impl Clone for Ratio
[src]
impl Debug for Ratio
[src]
impl Display for Ratio
[src]
impl<'a> Div<&'a Ratio> for Ratio
[src]
type Output = Ratio
The resulting type after applying the /
operator.
fn div(self, rhs: &Ratio) -> Ratio
[src]
impl<'a, 'b> Div<&'b Ratio> for &'a Ratio
[src]
type Output = Ratio
The resulting type after applying the /
operator.
fn div(self, rhs: &Ratio) -> Ratio
[src]
impl Div<Ratio> for Ratio
[src]
type Output = Ratio
The resulting type after applying the /
operator.
fn div(self, rhs: Ratio) -> Ratio
[src]
impl<'a> Div<Ratio> for &'a Ratio
[src]
type Output = Ratio
The resulting type after applying the /
operator.
fn div(self, rhs: Ratio) -> Ratio
[src]
impl<'a> DivAssign<&'a Ratio> for Ratio
[src]
fn div_assign(&mut self, rhs: &Ratio)
[src]
impl DivAssign<Ratio> for Ratio
[src]
fn div_assign(&mut self, rhs: Ratio)
[src]
impl Eq for Ratio
[src]
impl From<Ratio> for Value
[src]
impl FromStr for Ratio
[src]
type Err = FromStrRatioError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Ratio, FromStrRatioError>
[src]
impl FromValue for Ratio
[src]
impl<'a> FromValueRef<'a> for &'a Ratio
[src]
impl<'a> Mul<&'a Ratio> for Ratio
[src]
type Output = Ratio
The resulting type after applying the *
operator.
fn mul(self, rhs: &Ratio) -> Ratio
[src]
impl<'a, 'b> Mul<&'b Ratio> for &'a Ratio
[src]
type Output = Ratio
The resulting type after applying the *
operator.
fn mul(self, rhs: &Ratio) -> Ratio
[src]
impl Mul<Ratio> for Ratio
[src]
type Output = Ratio
The resulting type after applying the *
operator.
fn mul(self, rhs: Ratio) -> Ratio
[src]
impl<'a> Mul<Ratio> for &'a Ratio
[src]
type Output = Ratio
The resulting type after applying the *
operator.
fn mul(self, rhs: Ratio) -> Ratio
[src]
impl<'a> MulAssign<&'a Ratio> for Ratio
[src]
fn mul_assign(&mut self, rhs: &Ratio)
[src]
impl MulAssign<Ratio> for Ratio
[src]
fn mul_assign(&mut self, rhs: Ratio)
[src]
impl Neg for Ratio
[src]
impl<'a> Neg for &'a Ratio
[src]
impl Ord for Ratio
[src]
fn cmp(&self, other: &Ratio) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Integer> for Ratio
[src]
impl PartialEq<Ratio> for Ratio
[src]
impl PartialEq<Ratio> for Integer
[src]
impl PartialOrd<Ratio> for Ratio
[src]
fn partial_cmp(&self, other: &Ratio) -> Option<Ordering>
[src]
fn lt(&self, other: &Ratio) -> bool
[src]
fn le(&self, other: &Ratio) -> bool
[src]
fn gt(&self, other: &Ratio) -> bool
[src]
fn ge(&self, other: &Ratio) -> bool
[src]
impl<'a> Rem<&'a Ratio> for Ratio
[src]
type Output = Ratio
The resulting type after applying the %
operator.
fn rem(self, rhs: &Ratio) -> Ratio
[src]
impl<'a, 'b> Rem<&'b Ratio> for &'a Ratio
[src]
type Output = Ratio
The resulting type after applying the %
operator.
fn rem(self, rhs: &Ratio) -> Ratio
[src]
impl Rem<Ratio> for Ratio
[src]
type Output = Ratio
The resulting type after applying the %
operator.
fn rem(self, rhs: Ratio) -> Ratio
[src]
impl<'a> Rem<Ratio> for &'a Ratio
[src]
type Output = Ratio
The resulting type after applying the %
operator.
fn rem(self, rhs: Ratio) -> Ratio
[src]
impl<'a> RemAssign<&'a Ratio> for Ratio
[src]
fn rem_assign(&mut self, rhs: &Ratio)
[src]
impl RemAssign<Ratio> for Ratio
[src]
fn rem_assign(&mut self, rhs: Ratio)
[src]
impl StructuralEq for Ratio
[src]
impl StructuralPartialEq for Ratio
[src]
impl<'a> Sub<&'a Ratio> for Ratio
[src]
type Output = Ratio
The resulting type after applying the -
operator.
fn sub(self, rhs: &Ratio) -> Ratio
[src]
impl<'a, 'b> Sub<&'b Ratio> for &'a Ratio
[src]
type Output = Ratio
The resulting type after applying the -
operator.
fn sub(self, rhs: &Ratio) -> Ratio
[src]
impl Sub<Ratio> for Ratio
[src]
type Output = Ratio
The resulting type after applying the -
operator.
fn sub(self, rhs: Ratio) -> Ratio
[src]
impl<'a> Sub<Ratio> for &'a Ratio
[src]
type Output = Ratio
The resulting type after applying the -
operator.
fn sub(self, rhs: Ratio) -> Ratio
[src]
impl<'a> SubAssign<&'a Ratio> for Ratio
[src]
fn sub_assign(&mut self, rhs: &Ratio)
[src]
impl SubAssign<Ratio> for Ratio
[src]
fn sub_assign(&mut self, rhs: Ratio)
[src]
impl Zero for Ratio
[src]
Auto Trait Implementations
impl RefUnwindSafe for Ratio
impl Send for Ratio
impl Sync for Ratio
impl Unpin for Ratio
impl UnwindSafe for Ratio
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, Rhs> NumAssignOps<Rhs> for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
[src]
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
[src]
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
impl<T, Base> RefNum<Base> for T where
T: NumOps<Base, Base> + NumOps<&'r Base, Base>,
[src]
T: NumOps<Base, Base> + NumOps<&'r Base, Base>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,