Struct safe_modular_arithmetic::Modular[][src]

pub struct Modular<T: Clone + Eq + Rem<Output = T>> { /* fields omitted */ }

Represents an integer with an associated modulus.

Implementations

impl<T: Clone + Eq + Rem<Output = T>> Modular<T>[src]

pub fn new(value: T, modulus: T) -> Self[src]

Constructs a new modular arithmetic integer.

pub fn value(&self) -> &T[src]

Gets the value of the integer.

pub fn modulus(&self) -> &T[src]

Gets the modulus of the integer.

pub fn into_parts(self) -> (T, T)[src]

Splits the integer into its value and modulus.

Trait Implementations

impl<T: CheckedAdd + Clone + Eq + Rem<Output = T> + Shr<Output = T> + BitAnd<Output = T> + One> Add<Modular<T>> for Modular<T>[src]

type Output = Modular<<T as Add>::Output>

The resulting type after applying the + operator.

impl<T: Clone + Eq + Rem<Output = T>> Clone for Modular<T>[src]

impl<T: Copy + Clone + Eq + Rem<Output = T>> Copy for Modular<T>[src]

impl<T: Eq + Clone + Rem<Output = T>> Eq for Modular<T>[src]

impl<T: Clone + Eq + Rem<Output = T> + Sub<Output = T> + One> Neg for Modular<T>[src]

type Output = Self

The resulting type after applying the - operator.

impl<T: PartialEq + Clone + Eq + Rem<Output = T>> PartialEq<Modular<T>> for Modular<T>[src]

impl<T: Clone + Eq + Rem<Output = T>> StructuralEq for Modular<T>[src]

impl<T: Clone + Eq + Rem<Output = T>> StructuralPartialEq for Modular<T>[src]

impl<T: CheckedAdd + Clone + Eq + Rem<Output = T> + Sub<Output = T> + Shr<Output = T> + BitAnd<Output = T> + One> Sub<Modular<T>> for Modular<T>[src]

type Output = Modular<<T as Add>::Output>

The resulting type after applying the - operator.

Auto Trait Implementations

impl<T> Send for Modular<T> where
    T: Send

impl<T> Sync for Modular<T> where
    T: Sync

impl<T> Unpin for Modular<T> where
    T: Unpin

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.