Enum FractionEnum

Source
pub enum FractionEnum {
    Exact(BigFraction),
    Approx(f64),
    CannotCombineExactAndApprox,
}

Variants§

§

Exact(BigFraction)

§

Approx(f64)

§

CannotCombineExactAndApprox

Implementations§

Source§

impl FractionEnum

Source

pub fn sqrt_abs(&self, decimal_places: u32) -> FractionEnum

Source

pub fn is_sign_negative(&self) -> bool

Source

pub fn is_sign_positive(&self) -> bool

Source

pub fn is_infinite(&self) -> bool

Returns true if the value is Infinity (does not matter positive or negative)

Source

pub fn is_nan(&self) -> bool

Source

pub fn infinity() -> Self

Source

pub fn neg_infinity() -> Self

Source

pub fn nan() -> Self

Source

pub fn sign(&self) -> Option<Sign>

Source

pub fn recip(&self) -> Self

1/self

Source

pub fn one_minus(self) -> Self

Source

pub fn two() -> FractionEnum

Trait Implementations§

Source§

impl Add<&FractionEnum> for &FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &FractionEnum) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<i128> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i128) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<i16> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i16) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<i32> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i32) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<i64> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i64) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<i8> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i8) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<u128> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u128) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<u16> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u16) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<u32> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u32) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<u64> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u64) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<u8> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u8) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a> Add<usize> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: usize) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the + operator.
Source§

fn add(self, rhs: FractionEnum) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign<&Arc<FractionEnum>> for FractionEnum

Source§

fn add_assign(&mut self, rhs: &Arc<FractionEnum>)

Performs the += operation. Read more
Source§

impl<T> AddAssign<T> for FractionEnum
where T: Borrow<FractionEnum>,

Source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
Source§

impl AddAssign<i128> for FractionEnum

Source§

fn add_assign(&mut self, rhs: i128)

Performs the += operation. Read more
Source§

impl AddAssign<i16> for FractionEnum

Source§

fn add_assign(&mut self, rhs: i16)

Performs the += operation. Read more
Source§

impl AddAssign<i32> for FractionEnum

Source§

fn add_assign(&mut self, rhs: i32)

Performs the += operation. Read more
Source§

impl AddAssign<i64> for FractionEnum

Source§

fn add_assign(&mut self, rhs: i64)

Performs the += operation. Read more
Source§

impl AddAssign<i8> for FractionEnum

Source§

fn add_assign(&mut self, rhs: i8)

Performs the += operation. Read more
Source§

impl AddAssign<u128> for FractionEnum

Source§

fn add_assign(&mut self, rhs: u128)

Performs the += operation. Read more
Source§

impl AddAssign<u16> for FractionEnum

Source§

fn add_assign(&mut self, rhs: u16)

Performs the += operation. Read more
Source§

impl AddAssign<u32> for FractionEnum

Source§

fn add_assign(&mut self, rhs: u32)

Performs the += operation. Read more
Source§

impl AddAssign<u64> for FractionEnum

Source§

fn add_assign(&mut self, rhs: u64)

Performs the += operation. Read more
Source§

impl AddAssign<u8> for FractionEnum

Source§

fn add_assign(&mut self, rhs: u8)

Performs the += operation. Read more
Source§

impl AddAssign<usize> for FractionEnum

Source§

fn add_assign(&mut self, rhs: usize)

Performs the += operation. Read more
Source§

impl ChooseRandomly for FractionEnum

Source§

type Cache = FractionRandomCacheEnum

Source§

fn choose_randomly(fractions: &Vec<FractionEnum>) -> Result<usize>

Return a random index from 0 (inclusive) to the length of the list (exclusive). The likelihood of each index to be returned is proportional to the value of the fraction at that index. Read more
Source§

fn choose_randomly_create_cache<'a>( fractions: impl Iterator<Item = &'a Self>, ) -> Result<FractionRandomCache>
where Self: Sized + 'a,

Source§

fn choose_randomly_cached(cache: &FractionRandomCache) -> usize
where Self: Sized,

Source§

impl Clone for FractionEnum

Source§

fn clone(&self) -> FractionEnum

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FractionEnum

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FractionEnum

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div<&FractionEnum> for &FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &FractionEnum) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<i128> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i128) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<i16> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i16) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<i32> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i32) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<i64> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i64) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<i8> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i8) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<u128> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u128) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<u16> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u16) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<u32> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u32) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<u64> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u64) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<u8> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u8) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a> Div<usize> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the / operator.
Source§

fn div(self, rhs: usize) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> DivAssign<T> for FractionEnum
where T: Borrow<FractionEnum>,

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl DivAssign<i128> for FractionEnum

Source§

fn div_assign(&mut self, rhs: i128)

Performs the /= operation. Read more
Source§

impl DivAssign<i16> for FractionEnum

Source§

fn div_assign(&mut self, rhs: i16)

Performs the /= operation. Read more
Source§

impl DivAssign<i32> for FractionEnum

Source§

fn div_assign(&mut self, rhs: i32)

Performs the /= operation. Read more
Source§

impl DivAssign<i64> for FractionEnum

Source§

fn div_assign(&mut self, rhs: i64)

Performs the /= operation. Read more
Source§

impl DivAssign<i8> for FractionEnum

Source§

fn div_assign(&mut self, rhs: i8)

Performs the /= operation. Read more
Source§

impl DivAssign<u128> for FractionEnum

Source§

fn div_assign(&mut self, rhs: u128)

Performs the /= operation. Read more
Source§

impl DivAssign<u16> for FractionEnum

Source§

fn div_assign(&mut self, rhs: u16)

Performs the /= operation. Read more
Source§

impl DivAssign<u32> for FractionEnum

Source§

fn div_assign(&mut self, rhs: u32)

Performs the /= operation. Read more
Source§

impl DivAssign<u64> for FractionEnum

Source§

fn div_assign(&mut self, rhs: u64)

Performs the /= operation. Read more
Source§

impl DivAssign<u8> for FractionEnum

Source§

fn div_assign(&mut self, rhs: u8)

Performs the /= operation. Read more
Source§

impl DivAssign<usize> for FractionEnum

Source§

fn div_assign(&mut self, rhs: usize)

Performs the /= operation. Read more
Source§

impl From<&Arc<FractionEnum>> for FractionEnum

Source§

fn from(value: &Arc<FractionEnum>) -> Self

Converts to this type from the input type.
Source§

impl From<&FractionEnum> for FractionEnum

Source§

fn from(value: &FractionEnum) -> Self

Converts to this type from the input type.
Source§

impl From<(i128, i16)> for FractionEnum

Source§

fn from(value: (i128, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i128, i32)> for FractionEnum

Source§

fn from(value: (i128, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i128, i64)> for FractionEnum

Source§

fn from(value: (i128, i64)) -> Self

Converts to this type from the input type.
Source§

impl From<(i128, i8)> for FractionEnum

Source§

fn from(value: (i128, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(i128, u128)> for FractionEnum

Source§

fn from(value: (i128, u128)) -> Self

Converts to this type from the input type.
Source§

impl From<(i128, u16)> for FractionEnum

Source§

fn from(value: (i128, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i128, u32)> for FractionEnum

Source§

fn from(value: (i128, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i128, u64)> for FractionEnum

Source§

fn from(value: (i128, u64)) -> Self

Converts to this type from the input type.
Source§

impl From<(i128, u8)> for FractionEnum

Source§

fn from(value: (i128, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(i128, usize)> for FractionEnum

Source§

fn from(value: (i128, usize)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, i16)> for FractionEnum

Source§

fn from(value: (i16, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, i32)> for FractionEnum

Source§

fn from(value: (i16, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, i64)> for FractionEnum

Source§

fn from(value: (i16, i64)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, i8)> for FractionEnum

Source§

fn from(value: (i16, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, u128)> for FractionEnum

Source§

fn from(value: (i16, u128)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, u16)> for FractionEnum

Source§

fn from(value: (i16, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, u32)> for FractionEnum

Source§

fn from(value: (i16, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, u64)> for FractionEnum

Source§

fn from(value: (i16, u64)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, u8)> for FractionEnum

Source§

fn from(value: (i16, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(i16, usize)> for FractionEnum

Source§

fn from(value: (i16, usize)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, i16)> for FractionEnum

Source§

fn from(value: (i32, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, i32)> for FractionEnum

Source§

fn from(value: (i32, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, i64)> for FractionEnum

Source§

fn from(value: (i32, i64)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, i8)> for FractionEnum

Source§

fn from(value: (i32, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, u128)> for FractionEnum

Source§

fn from(value: (i32, u128)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, u16)> for FractionEnum

Source§

fn from(value: (i32, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, u32)> for FractionEnum

Source§

fn from(value: (i32, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, u64)> for FractionEnum

Source§

fn from(value: (i32, u64)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, u8)> for FractionEnum

Source§

fn from(value: (i32, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(i32, usize)> for FractionEnum

Source§

fn from(value: (i32, usize)) -> Self

Converts to this type from the input type.
Source§

impl From<(i64, i16)> for FractionEnum

Source§

fn from(value: (i64, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i64, i32)> for FractionEnum

Source§

fn from(value: (i64, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i64, i64)> for FractionEnum

Source§

fn from(value: (i64, i64)) -> Self

Converts to this type from the input type.
Source§

impl From<(i64, i8)> for FractionEnum

Source§

fn from(value: (i64, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(i64, u128)> for FractionEnum

Source§

fn from(value: (i64, u128)) -> Self

Converts to this type from the input type.
Source§

impl From<(i64, u16)> for FractionEnum

Source§

fn from(value: (i64, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i64, u32)> for FractionEnum

Source§

fn from(value: (i64, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i64, u64)> for FractionEnum

Source§

fn from(value: (i64, u64)) -> Self

Converts to this type from the input type.
Source§

impl From<(i64, u8)> for FractionEnum

Source§

fn from(value: (i64, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(i64, usize)> for FractionEnum

Source§

fn from(value: (i64, usize)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, i16)> for FractionEnum

Source§

fn from(value: (i8, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, i32)> for FractionEnum

Source§

fn from(value: (i8, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, i64)> for FractionEnum

Source§

fn from(value: (i8, i64)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, i8)> for FractionEnum

Source§

fn from(value: (i8, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, u128)> for FractionEnum

Source§

fn from(value: (i8, u128)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, u16)> for FractionEnum

Source§

fn from(value: (i8, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, u32)> for FractionEnum

Source§

fn from(value: (i8, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, u64)> for FractionEnum

Source§

fn from(value: (i8, u64)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, u8)> for FractionEnum

Source§

fn from(value: (i8, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, usize)> for FractionEnum

Source§

fn from(value: (i8, usize)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, i128)> for FractionEnum

Source§

fn from(value: (u128, i128)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, i16)> for FractionEnum

Source§

fn from(value: (u128, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, i32)> for FractionEnum

Source§

fn from(value: (u128, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, i64)> for FractionEnum

Source§

fn from(value: (u128, i64)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, i8)> for FractionEnum

Source§

fn from(value: (u128, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, u128)> for FractionEnum

Source§

fn from(value: (u128, u128)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, u16)> for FractionEnum

Source§

fn from(value: (u128, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, u32)> for FractionEnum

Source§

fn from(value: (u128, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, u64)> for FractionEnum

Source§

fn from(value: (u128, u64)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, u8)> for FractionEnum

Source§

fn from(value: (u128, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u128, usize)> for FractionEnum

Source§

fn from(value: (u128, usize)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, i128)> for FractionEnum

Source§

fn from(value: (u16, i128)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, i16)> for FractionEnum

Source§

fn from(value: (u16, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, i32)> for FractionEnum

Source§

fn from(value: (u16, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, i64)> for FractionEnum

Source§

fn from(value: (u16, i64)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, i8)> for FractionEnum

Source§

fn from(value: (u16, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, u128)> for FractionEnum

Source§

fn from(value: (u16, u128)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, u16)> for FractionEnum

Source§

fn from(value: (u16, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, u32)> for FractionEnum

Source§

fn from(value: (u16, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, u64)> for FractionEnum

Source§

fn from(value: (u16, u64)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, u8)> for FractionEnum

Source§

fn from(value: (u16, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u16, usize)> for FractionEnum

Source§

fn from(value: (u16, usize)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, i128)> for FractionEnum

Source§

fn from(value: (u32, i128)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, i16)> for FractionEnum

Source§

fn from(value: (u32, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, i32)> for FractionEnum

Source§

fn from(value: (u32, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, i64)> for FractionEnum

Source§

fn from(value: (u32, i64)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, i8)> for FractionEnum

Source§

fn from(value: (u32, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, u128)> for FractionEnum

Source§

fn from(value: (u32, u128)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, u16)> for FractionEnum

Source§

fn from(value: (u32, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, u32)> for FractionEnum

Source§

fn from(value: (u32, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, u64)> for FractionEnum

Source§

fn from(value: (u32, u64)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, u8)> for FractionEnum

Source§

fn from(value: (u32, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, usize)> for FractionEnum

Source§

fn from(value: (u32, usize)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, i128)> for FractionEnum

Source§

fn from(value: (u64, i128)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, i16)> for FractionEnum

Source§

fn from(value: (u64, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, i32)> for FractionEnum

Source§

fn from(value: (u64, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, i64)> for FractionEnum

Source§

fn from(value: (u64, i64)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, i8)> for FractionEnum

Source§

fn from(value: (u64, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, u128)> for FractionEnum

Source§

fn from(value: (u64, u128)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, u16)> for FractionEnum

Source§

fn from(value: (u64, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, u32)> for FractionEnum

Source§

fn from(value: (u64, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, u64)> for FractionEnum

Source§

fn from(value: (u64, u64)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, u8)> for FractionEnum

Source§

fn from(value: (u64, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u64, usize)> for FractionEnum

Source§

fn from(value: (u64, usize)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, i128)> for FractionEnum

Source§

fn from(value: (u8, i128)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, i16)> for FractionEnum

Source§

fn from(value: (u8, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, i32)> for FractionEnum

Source§

fn from(value: (u8, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, i64)> for FractionEnum

Source§

fn from(value: (u8, i64)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, i8)> for FractionEnum

Source§

fn from(value: (u8, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, u128)> for FractionEnum

Source§

fn from(value: (u8, u128)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, u16)> for FractionEnum

Source§

fn from(value: (u8, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, u32)> for FractionEnum

Source§

fn from(value: (u8, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, u64)> for FractionEnum

Source§

fn from(value: (u8, u64)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, u8)> for FractionEnum

Source§

fn from(value: (u8, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(u8, usize)> for FractionEnum

Source§

fn from(value: (u8, usize)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, i128)> for FractionEnum

Source§

fn from(value: (usize, i128)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, i16)> for FractionEnum

Source§

fn from(value: (usize, i16)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, i32)> for FractionEnum

Source§

fn from(value: (usize, i32)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, i64)> for FractionEnum

Source§

fn from(value: (usize, i64)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, i8)> for FractionEnum

Source§

fn from(value: (usize, i8)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, u128)> for FractionEnum

Source§

fn from(value: (usize, u128)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, u16)> for FractionEnum

Source§

fn from(value: (usize, u16)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, u32)> for FractionEnum

Source§

fn from(value: (usize, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, u64)> for FractionEnum

Source§

fn from(value: (usize, u64)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, u8)> for FractionEnum

Source§

fn from(value: (usize, u8)) -> Self

Converts to this type from the input type.
Source§

impl From<(usize, usize)> for FractionEnum

Source§

fn from(value: (usize, usize)) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<FractionEnum>> for FractionEnum

Source§

fn from(value: Arc<FractionEnum>) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for FractionEnum

Source§

fn from(value: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for FractionEnum

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for FractionEnum

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for FractionEnum

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for FractionEnum

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for FractionEnum

Source§

fn from(value: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for FractionEnum

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for FractionEnum

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for FractionEnum

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for FractionEnum

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for FractionEnum

Source§

fn from(value: usize) -> Self

Converts to this type from the input type.
Source§

impl FromStr for FractionEnum

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for FractionEnum

Source§

fn hash<H: Hasher>(&self, state: &mut H)

For good reasons, Rust does not support hashing of doubles. However, we need it to store distributions in a hashmap. Approximate arithmetic is discouraged

1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Infinite for FractionEnum

Source§

fn is_infinite(&self) -> bool

Returns true if this value is positive infinity or negative infinity, and false otherwise.
Source§

fn is_finite(&self) -> bool

Returns false if this value is positive infinity or negative infinity, and true otherwise.
Source§

fn is_positive_infinite(&self) -> bool

Source§

fn is_negative_infinite(&self) -> bool

Source§

impl MaybeExact for FractionEnum

Source§

type Approximate = f64

Source§

type Exact = GenericFraction<BigUint>

Source§

fn is_exact(&self) -> bool

Source§

fn extract_approx(&self) -> Result<f64>

This is a low-level function to extract an f64. Will only succeed if the fraction is approximate.
Source§

fn extract_exact(&self) -> Result<&GenericFraction<BigUint>>

This is a low-level function to extract an exact value. Will only succeed if the fraction is exact.
Source§

impl Mul<&FractionEnum> for &FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &FractionEnum) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<i128> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i128) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<i16> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i16) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<i32> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i32) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<i64> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i64) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<i8> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i8) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<u128> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u128) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<u16> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u16) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<u32> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u32) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<u64> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u64) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<u8> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u8) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<usize> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: usize) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> MulAssign<T> for FractionEnum
where T: Borrow<FractionEnum>,

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl MulAssign<i128> for FractionEnum

Source§

fn mul_assign(&mut self, rhs: i128)

Performs the *= operation. Read more
Source§

impl MulAssign<i16> for FractionEnum

Source§

fn mul_assign(&mut self, rhs: i16)

Performs the *= operation. Read more
Source§

impl MulAssign<i32> for FractionEnum

Source§

fn mul_assign(&mut self, rhs: i32)

Performs the *= operation. Read more
Source§

impl MulAssign<i64> for FractionEnum

Source§

fn mul_assign(&mut self, rhs: i64)

Performs the *= operation. Read more
Source§

impl MulAssign<i8> for FractionEnum

Source§

fn mul_assign(&mut self, rhs: i8)

Performs the *= operation. Read more
Source§

impl MulAssign<u128> for FractionEnum

Source§

fn mul_assign(&mut self, rhs: u128)

Performs the *= operation. Read more
Source§

impl MulAssign<u16> for FractionEnum

Source§

fn mul_assign(&mut self, rhs: u16)

Performs the *= operation. Read more
Source§

impl MulAssign<u32> for FractionEnum

Source§

fn mul_assign(&mut self, rhs: u32)

Performs the *= operation. Read more
Source§

impl MulAssign<u64> for FractionEnum

Source§

fn mul_assign(&mut self, rhs: u64)

Performs the *= operation. Read more
Source§

impl MulAssign<u8> for FractionEnum

Source§

fn mul_assign(&mut self, rhs: u8)

Performs the *= operation. Read more
Source§

impl MulAssign<usize> for FractionEnum

Source§

fn mul_assign(&mut self, rhs: usize)

Performs the *= operation. Read more
Source§

impl<'a> Neg for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Neg for FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl One for FractionEnum

Source§

fn one() -> Self

Source§

fn is_one(&self) -> bool

Source§

fn set_one(&mut self)

Source§

impl Ord for FractionEnum

Source§

fn cmp(&self, other: &Self) -> Ordering

Note that exact and approximate should not be compared.

1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for FractionEnum

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for FractionEnum

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

Note that exact and approximate should not be compared.

1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Signed for FractionEnum

Source§

fn abs(&self) -> Self

Source§

fn is_positive(&self) -> bool

Returns true if the number is positive and false if the number is zero or negative.
Source§

fn is_negative(&self) -> bool

Returns true if the number is negative and false if the number is zero or positive.
Source§

fn is_not_negative(&self) -> bool

For exact arithmetic: Returns true if the number is positive or zero. For approximate arithmetic: returns true if the number is larger than -epsilon
Source§

fn is_not_positive(&self) -> bool

For exact arithmetic: Returns true if the number is negative or zero. For approximate arithmetic: returns true if the number is smaller than epsilon
Source§

impl Sub<&FractionEnum> for &FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &FractionEnum) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<i128> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i128) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<i16> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i16) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<i32> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i32) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<i64> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i64) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<i8> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i8) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<u128> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u128) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<u16> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u16) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<u32> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u32) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<u64> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u64) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<u8> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u8) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<usize> for &'a FractionEnum

Source§

type Output = FractionEnum

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: usize) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> SubAssign<T> for FractionEnum
where T: Borrow<FractionEnum>,

Source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
Source§

impl SubAssign<i128> for FractionEnum

Source§

fn sub_assign(&mut self, rhs: i128)

Performs the -= operation. Read more
Source§

impl SubAssign<i16> for FractionEnum

Source§

fn sub_assign(&mut self, rhs: i16)

Performs the -= operation. Read more
Source§

impl SubAssign<i32> for FractionEnum

Source§

fn sub_assign(&mut self, rhs: i32)

Performs the -= operation. Read more
Source§

impl SubAssign<i64> for FractionEnum

Source§

fn sub_assign(&mut self, rhs: i64)

Performs the -= operation. Read more
Source§

impl SubAssign<i8> for FractionEnum

Source§

fn sub_assign(&mut self, rhs: i8)

Performs the -= operation. Read more
Source§

impl SubAssign<u128> for FractionEnum

Source§

fn sub_assign(&mut self, rhs: u128)

Performs the -= operation. Read more
Source§

impl SubAssign<u16> for FractionEnum

Source§

fn sub_assign(&mut self, rhs: u16)

Performs the -= operation. Read more
Source§

impl SubAssign<u32> for FractionEnum

Source§

fn sub_assign(&mut self, rhs: u32)

Performs the -= operation. Read more
Source§

impl SubAssign<u64> for FractionEnum

Source§

fn sub_assign(&mut self, rhs: u64)

Performs the -= operation. Read more
Source§

impl SubAssign<u8> for FractionEnum

Source§

fn sub_assign(&mut self, rhs: u8)

Performs the -= operation. Read more
Source§

impl SubAssign<usize> for FractionEnum

Source§

fn sub_assign(&mut self, rhs: usize)

Performs the -= operation. Read more
Source§

impl<'a> Sum<&'a FractionEnum> for FractionEnum

Source§

fn sum<I: Iterator<Item = &'a FractionEnum>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Sum for FractionEnum

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl TryFrom<&BigUint> for FractionEnum

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: &BigUint) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&FractionNotParsedYet> for FractionEnum

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: &FractionNotParsedYet) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<(BigUint, BigUint)> for FractionEnum

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: (BigUint, BigUint)) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<BigInt> for FractionEnum

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: BigInt) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<BigUint> for FractionEnum

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: BigUint) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Zero for FractionEnum

Source§

fn zero() -> Self

Source§

fn is_zero(&self) -> bool

Source§

fn set_zero(&mut self)

Source§

impl Eq for FractionEnum

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V