[][src]Struct modular::Modulo

pub struct Modulo { /* fields omitted */ }

Holds the modulo representation of a number

In mathematics, the % operation returns the remainder obtained when an integer a is divided by another n. For instance 32 % 6 = 2: in this example, 32 can be written in terms of its reminder after being divided by the specified dividend as 2 mod 6. This is the modulo representation of the number 32, with modulus 6.

Methods

impl Modulo[src]

pub fn remainder(self) -> i32[src]

Returns the 'remainder' part of a modulo number

pub fn modulus(self) -> u32[src]

Returns the modulus of a modulo number

This is sometimes referred to as the 'dividend' as well

Trait Implementations

impl Clone for Modulo[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Modulo[src]

impl PartialEq<Modulo> for Modulo[src]

impl Add<Modulo> for Modulo[src]

type Output = Self

The resulting type after applying the + operator.

fn add(self, rhs: Self) -> Self[src]

Adds two Modulo numbers

Panics

Panics if the two numbers have different modulus values

impl Sub<Modulo> for Modulo[src]

type Output = Self

The resulting type after applying the - operator.

fn sub(self, rhs: Self) -> Self[src]

Subtracts two Modulo numbers

Panics

Panics if the two numbers have different modulus values

impl Mul<Modulo> for Modulo[src]

type Output = Self

The resulting type after applying the * operator.

fn mul(self, rhs: Self) -> Self[src]

Multiplies two Modulo numbers

Panics

Panics if the two numbers have different modulus values

impl Debug for Modulo[src]

impl Display for Modulo[src]

Auto Trait Implementations

impl Send for Modulo

impl Sync for Modulo

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]