[][src]Struct competitive_hpp::modulo::mod_int::ModInt

pub struct ModInt<T> {
    pub value: T,
    pub modulo: T,
}

Example

use competitive_hpp::prelude::*;
const MOD: usize = 7;

let mi0 = ModInt::new_with(0, MOD);
let mi1 = ModInt::new_with(1, MOD);
let mi2 = ModInt::new_with(2, MOD);
let mi11 = ModInt::new_with(11, MOD);
assert_eq!(4, ModInt::new(4));
assert_eq!(mi0 + mi11, ModInt::new_with(4, 7));
assert_eq!(mi1 + mi2, ModInt::new_with(3, 7));

Fields

value: Tmodulo: T

Trait Implementations

impl<T> Add<ModInt<T>> for ModInt<T> where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

impl<T> Add<ModInt<T>> for i8 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

impl<T> Add<ModInt<T>> for usize where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

impl<T> Add<ModInt<T>> for i16 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

impl<T> Add<ModInt<T>> for i32 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

impl<T> Add<ModInt<T>> for i64 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

impl<T> Add<ModInt<T>> for u8 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

impl<T> Add<ModInt<T>> for u16 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

impl<T> Add<ModInt<T>> for u32 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

impl<T> Add<ModInt<T>> for u64 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

impl<T> Add<ModInt<T>> for isize where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

impl<T> Add<T> for ModInt<T> where
    T: NumOps + PartialOrd + Copy
[src]

type Output = ModInt<T>

The resulting type after applying the + operator.

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

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

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

impl<T> Display for ModInt<T> where
    T: Display
[src]

impl<T> Div<ModInt<T>> for ModInt<T> where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T> Div<ModInt<T>> for i8 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T> Div<ModInt<T>> for usize where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T> Div<ModInt<T>> for i16 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T> Div<ModInt<T>> for i32 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T> Div<ModInt<T>> for i64 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T> Div<ModInt<T>> for u8 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T> Div<ModInt<T>> for u16 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T> Div<ModInt<T>> for u32 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T> Div<ModInt<T>> for u64 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T> Div<ModInt<T>> for isize where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T> Div<T> for ModInt<T> where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the / operator.

impl<T: Eq> Eq for ModInt<T>[src]

impl<T> ModIntTrait<T> for ModInt<T> where
    T: PrimInt
[src]

impl<T> Mul<ModInt<T>> for ModInt<T> where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> Mul<ModInt<T>> for i8 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> Mul<ModInt<T>> for usize where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> Mul<ModInt<T>> for i16 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> Mul<ModInt<T>> for i32 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> Mul<ModInt<T>> for i64 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> Mul<ModInt<T>> for u8 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> Mul<ModInt<T>> for u16 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> Mul<ModInt<T>> for u32 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> Mul<ModInt<T>> for u64 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> Mul<ModInt<T>> for isize where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> Mul<T> for ModInt<T> where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the * operator.

impl<T> One for ModInt<T> where
    T: PrimInt
[src]

impl<T: Ord> Ord for ModInt<T>[src]

impl<T: PartialEq> PartialEq<ModInt<T>> for ModInt<T>[src]

impl<T> PartialEq<ModInt<T>> for i8 where
    T: PrimInt
[src]

impl<T> PartialEq<ModInt<T>> for usize where
    T: PrimInt
[src]

impl<T> PartialEq<ModInt<T>> for i16 where
    T: PrimInt
[src]

impl<T> PartialEq<ModInt<T>> for i32 where
    T: PrimInt
[src]

impl<T> PartialEq<ModInt<T>> for i64 where
    T: PrimInt
[src]

impl<T> PartialEq<ModInt<T>> for u8 where
    T: PrimInt
[src]

impl<T> PartialEq<ModInt<T>> for u16 where
    T: PrimInt
[src]

impl<T> PartialEq<ModInt<T>> for u32 where
    T: PrimInt
[src]

impl<T> PartialEq<ModInt<T>> for u64 where
    T: PrimInt
[src]

impl<T> PartialEq<ModInt<T>> for isize where
    T: PrimInt
[src]

impl<T> PartialEq<T> for ModInt<T> where
    T: PrimInt
[src]

impl<T: PartialOrd> PartialOrd<ModInt<T>> for ModInt<T>[src]

impl<T> PartialOrd<ModInt<T>> for i8 where
    T: PrimInt
[src]

impl<T> PartialOrd<ModInt<T>> for usize where
    T: PrimInt
[src]

impl<T> PartialOrd<ModInt<T>> for i16 where
    T: PrimInt
[src]

impl<T> PartialOrd<ModInt<T>> for i32 where
    T: PrimInt
[src]

impl<T> PartialOrd<ModInt<T>> for i64 where
    T: PrimInt
[src]

impl<T> PartialOrd<ModInt<T>> for u8 where
    T: PrimInt
[src]

impl<T> PartialOrd<ModInt<T>> for u16 where
    T: PrimInt
[src]

impl<T> PartialOrd<ModInt<T>> for u32 where
    T: PrimInt
[src]

impl<T> PartialOrd<ModInt<T>> for u64 where
    T: PrimInt
[src]

impl<T> PartialOrd<ModInt<T>> for isize where
    T: PrimInt
[src]

impl<T> PartialOrd<T> for ModInt<T> where
    T: PrimInt
[src]

impl<T> StructuralEq for ModInt<T>[src]

impl<T> StructuralPartialEq for ModInt<T>[src]

impl<T> Sub<ModInt<T>> for ModInt<T> where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> Sub<ModInt<T>> for i8 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> Sub<ModInt<T>> for usize where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> Sub<ModInt<T>> for i16 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> Sub<ModInt<T>> for i32 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> Sub<ModInt<T>> for i64 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> Sub<ModInt<T>> for u8 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> Sub<ModInt<T>> for u16 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> Sub<ModInt<T>> for u32 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> Sub<ModInt<T>> for u64 where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> Sub<ModInt<T>> for isize where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> Sub<T> for ModInt<T> where
    T: PrimInt
[src]

type Output = ModInt<T>

The resulting type after applying the - operator.

impl<T> ToPrimitive for ModInt<T> where
    T: PrimInt
[src]

impl<T> Zero for ModInt<T> where
    T: PrimInt
[src]

Auto Trait Implementations

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

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

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

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

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

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<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

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

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.