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]

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]

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 Binary for ModuloRing[src]

impl Debug for ModuloRing[src]

impl Display for ModuloRing[src]

impl Eq for ModuloRing[src]

impl LowerHex for ModuloRing[src]

impl Octal for ModuloRing[src]

impl PartialEq<ModuloRing> for ModuloRing[src]

Equality is identity: two rings are not equal even if they have the same modulus.

impl UpperHex for ModuloRing[src]

Auto Trait Implementations

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> 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.

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