[][src]Struct arithmetic_eval::arith::ModularArithmetic

pub struct ModularArithmetic<T> { /* fields omitted */ }

Modular arithmetic on integers.

As an example, ModularArithmetic<T> implements Arithmetic<T> if T is one of unsigned built-in integer types (u8, u16, u32, u64; u128 is excluded because it cannot be extended to double width).

Implementations

impl<T> ModularArithmetic<T> where
    T: Clone + PartialEq + NumOps + Unsigned + Zero + One
[src]

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

Creates a new arithmetic with the specified modulus.

Panics

  • Panics if modulus is 0 or 1.

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

Returns the modulus for this arithmetic.

Trait Implementations

impl Arithmetic<BigUint> for ModularArithmetic<BigUint>[src]

impl<T> Arithmetic<T> for ModularArithmetic<T> where
    T: Copy + PartialEq + NumOps + Zero + One + DoubleWidth,
    usize: TryFrom<T>, 
[src]

impl<T: Clone> Clone for ModularArithmetic<T>[src]

impl<T: Copy> Copy for ModularArithmetic<T>[src]

impl<T: Debug> Debug for ModularArithmetic<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for ModularArithmetic<T> where
    T: RefUnwindSafe

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

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

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

impl<T> UnwindSafe for ModularArithmetic<T> where
    T: UnwindSafe

Blanket Implementations

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

impl<T, A> ArithmeticExt<T> for A where
    A: Arithmetic<T>, 
[src]

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

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

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

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

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

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

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.

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