Skip to main content

Rational8

Type Alias Rational8 

Source
pub type Rational8 = Ratio<Sign, u8, u8>;
Expand description

A signed ratio between two small integers.

Aliased Type§

pub struct Rational8 { /* private fields */ }

Implementations§

Source§

impl Rational8

Source

pub fn new(numerator: i8, denominator: u8) -> Option<Self>

A ratio in lowest terms, or None when the denominator is zero.

§Range

The magnitude of this type is stored unsigned, while this constructor takes a signed numerator of the same width. A Rational8 therefore represents every value from -255 to 255, but this constructor only reaches -128 to 127; the values in between are reached by FromStr, by FromPrimitive from a wider primitive, and by arithmetic. They are representable but not convertible back: to_i8 returns None for them, because an i8 is what doesn’t fit, not the ratio.

Source

pub fn new_signed<T: Into<Sign>>( sign: T, numerator: u8, denominator: u8, ) -> Option<Self>

A ratio in lowest terms from a sign and a magnitude.

§Return value

None when the arguments describe no number: the denominator has to be nonzero, and the sign has to be [Sign::Zero] exactly when the numerator is zero. These invariants used to be checked with debug_assert! only, which let a release build construct a ratio with a zero denominator; Big::new_signed returns an Option for the same reason.

Trait Implementations§

Source§

impl<N> Absorb<&N> for Rational8
where Rational8: Absorb<N>,

A provider that hands out references to what it stores is read through them.

Source§

fn from_narrow(narrow: &&N) -> Self

The narrow value in the wide type.
Source§

fn add_narrow(&mut self, narrow: &&N)

Add a narrow value to this one.
Source§

fn sub_narrow(&mut self, narrow: &&N)

Subtract a narrow value from this one.
Source§

fn mul_narrow(&self, narrow: &&N) -> Self

Multiply this value by a narrow one.
Source§

fn add_mul_narrow(&mut self, narrow: &&N, other: &Self)

Add the product of a narrow value and a wide one to this value. Read more
Source§

impl Absorb<Binary> for Rational8

Source§

fn from_narrow(narrow: &Binary) -> Self

The narrow value in the wide type.
Source§

fn add_narrow(&mut self, narrow: &Binary)

Add a narrow value to this one.
Source§

fn sub_narrow(&mut self, narrow: &Binary)

Subtract a narrow value from this one.
Source§

fn mul_narrow(&self, narrow: &Binary) -> Self

Multiply this value by a narrow one.
Source§

fn add_mul_narrow(&mut self, narrow: &Binary, other: &Self)

Add the product of a narrow value and a wide one to this value. Read more
Source§

impl Absorb<One> for Rational8

Source§

fn from_narrow(_: &One) -> Self

The narrow value in the wide type.
Source§

fn add_narrow(&mut self, _: &One)

Add a narrow value to this one.
Source§

fn sub_narrow(&mut self, _: &One)

Subtract a narrow value from this one.
Source§

fn mul_narrow(&self, _: &One) -> Self

Multiply this value by a narrow one.
Source§

fn add_mul_narrow(&mut self, _: &One, other: &Self)

Add the product of a narrow value and a wide one to this value. Read more
Source§

impl<N> Absorb<Option<N>> for Rational8
where Rational8: Absorb<N>,

An absent value is zero, so it contributes nothing.

Source§

fn from_narrow(narrow: &Option<N>) -> Self

The narrow value in the wide type.
Source§

fn add_narrow(&mut self, narrow: &Option<N>)

Add a narrow value to this one.
Source§

fn sub_narrow(&mut self, narrow: &Option<N>)

Subtract a narrow value from this one.
Source§

fn mul_narrow(&self, narrow: &Option<N>) -> Self

Multiply this value by a narrow one.
Source§

fn add_mul_narrow(&mut self, narrow: &Option<N>, other: &Self)

Add the product of a narrow value and a wide one to this value. Read more
Source§

impl Absorb<SignedOne> for Rational8

Source§

fn from_narrow(narrow: &SignedOne) -> Self

The narrow value in the wide type.
Source§

fn add_narrow(&mut self, narrow: &SignedOne)

Add a narrow value to this one.
Source§

fn sub_narrow(&mut self, narrow: &SignedOne)

Subtract a narrow value from this one.
Source§

fn mul_narrow(&self, narrow: &SignedOne) -> Self

Multiply this value by a narrow one.
Source§

fn add_mul_narrow(&mut self, narrow: &SignedOne, other: &Self)

Add the product of a narrow value and a wide one to this value. Read more
Source§

impl Absorb<Zero> for Rational8

Source§

fn from_narrow(_: &Zero) -> Self

The narrow value in the wide type.
Source§

fn add_narrow(&mut self, _: &Zero)

Add a narrow value to this one.
Source§

fn sub_narrow(&mut self, _: &Zero)

Subtract a narrow value from this one.
Source§

fn mul_narrow(&self, _: &Zero) -> Self

Multiply this value by a narrow one.
Source§

fn add_mul_narrow(&mut self, _: &Zero, _: &Self)

Add the product of a narrow value and a wide one to this value. Read more
Source§

impl Absorb<i8> for Rational8

Source§

fn from_narrow(narrow: &i8) -> Self

The narrow value in the wide type.
Source§

fn add_narrow(&mut self, narrow: &i8)

Add a narrow value to this one.
Source§

fn sub_narrow(&mut self, narrow: &i8)

Subtract a narrow value from this one.
Source§

fn mul_narrow(&self, narrow: &i8) -> Self

Multiply this value by a narrow one.
Source§

fn add_mul_narrow(&mut self, narrow: &i8, other: &Self)

Add the product of a narrow value and a wide one to this value. Read more
Source§

impl Absorb<u8> for Rational8

Source§

fn from_narrow(narrow: &u8) -> Self

The narrow value in the wide type.
Source§

fn add_narrow(&mut self, narrow: &u8)

Add a narrow value to this one.
Source§

fn sub_narrow(&mut self, narrow: &u8)

Subtract a narrow value from this one.
Source§

fn mul_narrow(&self, narrow: &u8) -> Self

Multiply this value by a narrow one.
Source§

fn add_mul_narrow(&mut self, narrow: &u8, other: &Self)

Add the product of a narrow value and a wide one to this value. Read more
Source§

impl<'a> Add for &'a Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<&NonZero<i8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<&NonZero<i8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<&NonZero<u8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<&NonZero<u8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<&One> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

fn add(self, _: &One) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<&Zero> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

fn add(self, _: &Zero) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<&i8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<&i8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<&u8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<&u8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<NonZero<i8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<NonZero<i8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<NonZero<u8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<NonZero<u8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<One> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

fn add(self, _: One) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<Zero> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

fn add(self, _: Zero) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<i8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<i8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<u8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<u8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl AddAssign for Rational8

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl AddAssign<&NonZero<i8>> for Rational8

Source§

fn add_assign(&mut self, rhs: &NonZeroI8)

Performs the += operation. Read more
Source§

impl AddAssign<&NonZero<u8>> for Rational8

Source§

fn add_assign(&mut self, rhs: &NonZeroU8)

Performs the += operation. Read more
Source§

impl AddAssign<&One> for Rational8

Source§

fn add_assign(&mut self, _: &One)

Performs the += operation. Read more
Source§

impl AddAssign<&Zero> for Rational8

Source§

fn add_assign(&mut self, _: &Zero)

Performs the += operation. Read more
Source§

impl AddAssign<&i8> for Rational8

Source§

fn add_assign(&mut self, rhs: &i8)

Performs the += operation. Read more
Source§

impl AddAssign<&u8> for Rational8

Source§

fn add_assign(&mut self, rhs: &u8)

Performs the += operation. Read more
Source§

impl AddAssign<NonZero<i8>> for Rational8

Source§

fn add_assign(&mut self, rhs: NonZeroI8)

Performs the += operation. Read more
Source§

impl AddAssign<NonZero<u8>> for Rational8

Source§

fn add_assign(&mut self, rhs: NonZeroU8)

Performs the += operation. Read more
Source§

impl AddAssign<One> for Rational8

Source§

fn add_assign(&mut self, _: One)

Performs the += operation. Read more
Source§

impl AddAssign<Zero> for Rational8

Source§

fn add_assign(&mut self, _: Zero)

Performs the += operation. Read more
Source§

impl AddAssign<i8> for Rational8

Source§

fn add_assign(&mut self, rhs: i8)

Performs the += operation. Read more
Source§

impl AddAssign<u8> for Rational8

Source§

fn add_assign(&mut self, rhs: u8)

Performs the += operation. Read more
Source§

impl Debug for Rational8

Renders exactly like Display, so the output parses back.

Source§

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

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

impl Default for Rational8

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Rational8

Source§

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

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

impl Div for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<'a> Div for &'a Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<&NonZero<i8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<&NonZero<i8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<&NonZero<u8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<&NonZero<u8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<&One> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

fn div(self, _: &One) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<&One> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

fn div(self, _: &One) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<&i8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<&i8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<&u8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<&u8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<NonZero<i8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<NonZero<i8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<NonZero<u8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<NonZero<u8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<One> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

fn div(self, _: One) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<One> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

fn div(self, _: One) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<i8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<i8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<u8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<u8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl DivAssign for Rational8

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl DivAssign<&NonZero<i8>> for Rational8

Source§

fn div_assign(&mut self, rhs: &NonZeroI8)

Performs the /= operation. Read more
Source§

impl DivAssign<&NonZero<u8>> for Rational8

Source§

fn div_assign(&mut self, rhs: &NonZeroU8)

Performs the /= operation. Read more
Source§

impl DivAssign<&One> for Rational8

Source§

fn div_assign(&mut self, _: &One)

Performs the /= operation. Read more
Source§

impl DivAssign<&i8> for Rational8

Source§

fn div_assign(&mut self, rhs: &i8)

Performs the /= operation. Read more
Source§

impl DivAssign<&u8> for Rational8

Source§

fn div_assign(&mut self, rhs: &u8)

Performs the /= operation. Read more
Source§

impl DivAssign<NonZero<i8>> for Rational8

Source§

fn div_assign(&mut self, rhs: NonZeroI8)

Performs the /= operation. Read more
Source§

impl DivAssign<NonZero<u8>> for Rational8

Source§

fn div_assign(&mut self, rhs: NonZeroU8)

Performs the /= operation. Read more
Source§

impl DivAssign<One> for Rational8

Source§

fn div_assign(&mut self, _: One)

Performs the /= operation. Read more
Source§

impl DivAssign<i8> for Rational8

Source§

fn div_assign(&mut self, rhs: i8)

Performs the /= operation. Read more
Source§

impl DivAssign<u8> for Rational8

Source§

fn div_assign(&mut self, rhs: u8)

Performs the /= operation. Read more
Source§

impl EncodingSize for Rational8

Source§

fn numerator_bits(&self) -> u32

Bits in the numerator. Read more
Source§

fn denominator_bits(&self) -> u32

Bits in the denominator. Read more
Source§

fn encoding_bits(&self) -> u64

What it costs to store this value.
Source§

impl Eq for Rational8

Source§

impl From<&One> for Rational8

Source§

fn from(_: &One) -> Self

Converts to this type from the input type.
Source§

impl From<&Zero> for Rational8

Source§

fn from(_: &Zero) -> Self

Converts to this type from the input type.
Source§

impl From<&i8> for Rational8

Source§

fn from(other: &i8) -> Self

Converts to this type from the input type.
Source§

impl From<&u8> for Rational8

Source§

fn from(other: &u8) -> Self

Converts to this type from the input type.
Source§

impl From<(i8, i8)> for Rational8

Source§

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

Converts to this type from the input type.
Source§

impl From<(u8, u8)> for Rational8

Source§

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

Converts to this type from the input type.
Source§

impl From<One> for Rational8

Source§

fn from(_: One) -> Self

Converts to this type from the input type.
Source§

impl From<Zero> for Rational8

Source§

fn from(_: Zero) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Rational8

Source§

fn from(other: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Rational8

Source§

fn from(other: u8) -> Self

Converts to this type from the input type.
Source§

impl FromPrimitive for Rational8

Source§

fn from_i128(n: i128) -> Option<Self>

The default implementation goes through from_i64, which discards every value that only a wider magnitude type can hold.

Source§

fn from_u128(n: u128) -> Option<Self>

The default implementation goes through from_u64, which discards every value that only a wider magnitude type can hold.

Source§

fn from_i64(n: i64) -> Option<Self>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u64(n: u64) -> Option<Self>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f32(n: f32) -> Option<Self>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Self>

Converts a f64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Source§

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl FromStr for Rational8

Source§

type Err = &'static str

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

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

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

impl Gcd for Rational8

Source§

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

The greatest common divisor of two numbers. Read more
Source§

impl<'a> Mul for &'a Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<&NonZero<i8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<&NonZero<i8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<&NonZero<u8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<&NonZero<u8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<&One> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

fn mul(self, _: &One) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&One> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

fn mul(self, _: &One) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&Zero> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

fn mul(self, _: &Zero) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&Zero> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

fn mul(self, _: &Zero) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&i8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<&i8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<&u8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<&u8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<NonZero<i8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<NonZero<i8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<NonZero<u8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<NonZero<u8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<One> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

fn mul(self, _: One) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<One> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

fn mul(self, _: One) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Zero> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

fn mul(self, _: Zero) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Zero> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

fn mul(self, _: Zero) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<i8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<i8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<u8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<u8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl MulAssign for Rational8

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl MulAssign<&NonZero<i8>> for Rational8

Source§

fn mul_assign(&mut self, rhs: &NonZeroI8)

Performs the *= operation. Read more
Source§

impl MulAssign<&NonZero<u8>> for Rational8

Source§

fn mul_assign(&mut self, rhs: &NonZeroU8)

Performs the *= operation. Read more
Source§

impl MulAssign<&One> for Rational8

Source§

fn mul_assign(&mut self, _: &One)

Performs the *= operation. Read more
Source§

impl MulAssign<&Zero> for Rational8

Source§

fn mul_assign(&mut self, _: &Zero)

Performs the *= operation. Read more
Source§

impl MulAssign<&i8> for Rational8

Source§

fn mul_assign(&mut self, rhs: &i8)

Performs the *= operation. Read more
Source§

impl MulAssign<&u8> for Rational8

Source§

fn mul_assign(&mut self, rhs: &u8)

Performs the *= operation. Read more
Source§

impl MulAssign<NonZero<i8>> for Rational8

Source§

fn mul_assign(&mut self, rhs: NonZeroI8)

Performs the *= operation. Read more
Source§

impl MulAssign<NonZero<u8>> for Rational8

Source§

fn mul_assign(&mut self, rhs: NonZeroU8)

Performs the *= operation. Read more
Source§

impl MulAssign<One> for Rational8

Source§

fn mul_assign(&mut self, _: One)

Performs the *= operation. Read more
Source§

impl MulAssign<Zero> for Rational8

Source§

fn mul_assign(&mut self, _: Zero)

Performs the *= operation. Read more
Source§

impl MulAssign<i8> for Rational8

Source§

fn mul_assign(&mut self, rhs: i8)

Performs the *= operation. Read more
Source§

impl MulAssign<u8> for Rational8

Source§

fn mul_assign(&mut self, rhs: u8)

Performs the *= operation. Read more
Source§

impl Neg for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Neg for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl One for Rational8

Source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> bool

Returns true if self is equal to the multiplicative identity. Read more
Source§

impl Ord for Rational8

Source§

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

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

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

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

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Rational8

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialEq<NonZero<i8>> for Rational8

Source§

fn eq(&self, rhs: &NonZeroI8) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialEq<NonZero<u8>> for Rational8

Source§

fn eq(&self, rhs: &NonZeroU8) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialEq<i8> for Rational8

Source§

fn eq(&self, rhs: &i8) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialEq<u8> for Rational8

Source§

fn eq(&self, rhs: &u8) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for Rational8

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 Sub for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'a> Sub for &'a Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<&NonZero<i8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<&NonZero<i8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<&NonZero<u8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<&NonZero<u8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<&One> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

fn sub(self, _: &One) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<&Zero> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

fn sub(self, _: &Zero) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<&i8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<&i8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<&u8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<&u8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<NonZero<i8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<NonZero<i8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<NonZero<u8>> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<NonZero<u8>> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<One> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

fn sub(self, _: One) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<Zero> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

fn sub(self, _: Zero) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<i8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<i8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<u8> for Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<u8> for &Rational8

Source§

type Output = Ratio<Sign, u8, u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl SubAssign for Rational8

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl SubAssign<&NonZero<i8>> for Rational8

Source§

fn sub_assign(&mut self, rhs: &NonZeroI8)

Performs the -= operation. Read more
Source§

impl SubAssign<&NonZero<u8>> for Rational8

Source§

fn sub_assign(&mut self, rhs: &NonZeroU8)

Performs the -= operation. Read more
Source§

impl SubAssign<&One> for Rational8

Source§

fn sub_assign(&mut self, _: &One)

Performs the -= operation. Read more
Source§

impl SubAssign<&i8> for Rational8

Source§

fn sub_assign(&mut self, rhs: &i8)

Performs the -= operation. Read more
Source§

impl SubAssign<&u8> for Rational8

Source§

fn sub_assign(&mut self, rhs: &u8)

Performs the -= operation. Read more
Source§

impl SubAssign<NonZero<i8>> for Rational8

Source§

fn sub_assign(&mut self, rhs: NonZeroI8)

Performs the -= operation. Read more
Source§

impl SubAssign<NonZero<u8>> for Rational8

Source§

fn sub_assign(&mut self, rhs: NonZeroU8)

Performs the -= operation. Read more
Source§

impl SubAssign<One> for Rational8

Source§

fn sub_assign(&mut self, _: One)

Performs the -= operation. Read more
Source§

impl SubAssign<Zero> for Rational8

Source§

fn sub_assign(&mut self, _: Zero)

Performs the -= operation. Read more
Source§

impl SubAssign<i8> for Rational8

Source§

fn sub_assign(&mut self, rhs: i8)

Performs the -= operation. Read more
Source§

impl SubAssign<u8> for Rational8

Source§

fn sub_assign(&mut self, rhs: u8)

Performs the -= operation. Read more
Source§

impl Sum for Rational8

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 ToPrimitive for Rational8

Source§

fn to_isize(&self) -> Option<isize>

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned.
Source§

fn to_i8(&self) -> Option<i8>

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned.
Source§

fn to_i16(&self) -> Option<i16>

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned.
Source§

fn to_i32(&self) -> Option<i32>

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned.
Source§

fn to_i64(&self) -> Option<i64>

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned.
Source§

fn to_i128(&self) -> Option<i128>

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more
Source§

fn to_usize(&self) -> Option<usize>

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned.
Source§

fn to_u8(&self) -> Option<u8>

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned.
Source§

fn to_u16(&self) -> Option<u16>

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned.
Source§

fn to_u32(&self) -> Option<u32>

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned.
Source§

fn to_u64(&self) -> Option<u64>

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned.
Source§

fn to_u128(&self) -> Option<u128>

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more
Source§

fn to_f32(&self) -> Option<f32>

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32.
Source§

fn to_f64(&self) -> Option<f64>

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more
Source§

impl Zero for Rational8

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.