pub struct LogosModular(pub Modular);Expand description
An element of the ring ℤ/nℤ — the AOT mirror of the interpreter’s Modular.
modular(value, modulus) compiles to LogosModular::new(..); + − × wrap in the ring,
pow is fast modular exponentiation, and ÷ multiplies by the modular inverse. NOT ordered.
Tuple Fields§
§0: ModularImplementations§
Source§impl LogosModular
impl LogosModular
Sourcepub fn new(value: i64, modulus: i64) -> Self
pub fn new(value: i64, modulus: i64) -> Self
value mod modulus. Panics on a non-positive modulus (a LOGOS runtime error).
pub fn add(&self, other: &LogosModular) -> LogosModular
pub fn sub(&self, other: &LogosModular) -> LogosModular
pub fn mul(&self, other: &LogosModular) -> LogosModular
Sourcepub fn div_exact(&self, other: &LogosModular) -> LogosModular
pub fn div_exact(&self, other: &LogosModular) -> LogosModular
Division by the modular inverse. Panics if the divisor is not coprime to the modulus.
Sourcepub fn pow(&self, exp: u64) -> LogosModular
pub fn pow(&self, exp: u64) -> LogosModular
Fast modular exponentiation self^exp.
Trait Implementations§
Source§impl Clone for LogosModular
impl Clone for LogosModular
Source§fn clone(&self) -> LogosModular
fn clone(&self) -> LogosModular
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LogosModular
impl Debug for LogosModular
Source§impl Display for LogosModular
impl Display for LogosModular
Source§impl Hash for LogosModular
impl Hash for LogosModular
Source§impl PartialEq for LogosModular
impl PartialEq for LogosModular
Source§fn eq(&self, other: &LogosModular) -> bool
fn eq(&self, other: &LogosModular) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for LogosModular
impl StructuralPartialEq for LogosModular
Auto Trait Implementations§
impl Freeze for LogosModular
impl RefUnwindSafe for LogosModular
impl Send for LogosModular
impl Sync for LogosModular
impl Unpin for LogosModular
impl UnsafeUnpin for LogosModular
impl UnwindSafe for LogosModular
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.