Struct ibig::modular::ModuloRing [−][src]
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
impl RefUnwindSafe for ModuloRing
impl Send for ModuloRing
impl Sync for ModuloRing
impl Unpin for ModuloRing
impl UnwindSafe for ModuloRing
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,