pub trait ModularInteger:
Sized
+ PartialEq
+ Add<Self, Output = Self>
+ Sub<Self, Output = Self>
+ Neg<Output = Self>
+ Mul<Self, Output = Self> {
type Base;
// Required methods
fn modulus(&self) -> Self::Base;
fn residue(&self) -> Self::Base;
fn is_zero(&self) -> bool;
fn convert(&self, n: Self::Base) -> Self;
fn double(self) -> Self;
fn square(self) -> Self;
}
Expand description
Represents an number defined in a modulo ring ℤ/nℤ
The operators should panic if the modulus of two number are not the same.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.