Struct ibig::modular::ModuloRing [−][src]
pub struct ModuloRing(_);
A ring of integers modulo a positive integer.
Examples
let ring = ModuloRing::new(&ubig!(100)); assert_eq!(ring.modulus(), ubig!(100));
Implementations
impl ModuloRing
[src]
impl ModuloRing
[src]pub fn modulus(&self) -> UBig
[src]
The ring modulus.
Example
let ring = ModuloRing::new(&ubig!(100)); assert_eq!(ring.modulus(), ubig!(100));
pub fn from<T: IntoModulo>(&self, x: T) -> Modulo<'_>
[src]
Create an element of the ring from another type.
Examples
let ring = ModuloRing::new(&ubig!(100)); let x = ring.from(-1234); let y = ring.from(ubig!(3366)); assert!(x == y);
impl ModuloRing
[src]
impl ModuloRing
[src]pub fn new(n: &UBig) -> ModuloRing
[src]
Create a new ring of integers modulo n
.
For two Modulo numbers to be compatible,
they must come from the same ModuloRing.
Two different ModuloRings are not compatible even if
they have the same modulus n
.
Examples
let ring = ModuloRing::new(&ubig!(100)); assert_eq!(ring.modulus(), ubig!(100));
Panics
Panics if n
is zero.
Trait Implementations
impl Eq for ModuloRing
[src]
impl Eq for ModuloRing
[src]impl PartialEq<ModuloRing> for ModuloRing
[src]
impl PartialEq<ModuloRing> for ModuloRing
[src]Equality is identity: two rings are not equal even if they have the same modulus.
Auto Trait Implementations
impl RefUnwindSafe for ModuloRing
impl RefUnwindSafe for ModuloRing
impl Send for ModuloRing
impl Send for ModuloRing
impl Sync for ModuloRing
impl Sync for ModuloRing
impl Unpin for ModuloRing
impl Unpin for ModuloRing
impl UnwindSafe for ModuloRing
impl UnwindSafe for ModuloRing