pub struct Modulus64 { /* private fields */ }Implementations§
Source§impl Modulus64
impl Modulus64
Sourcepub const fn residue(&self, x: u64) -> Residue64<'_>
pub const fn residue(&self, x: u64) -> Residue64<'_>
Calculates the residue of x modulo self.
§Example
use lib_modulo::Modulus64;
let modulus = Modulus64::new(5);
assert_eq!(modulus.residue(8).get(), 3)Sourcepub const fn can_divide(&self, x: u64) -> bool
pub const fn can_divide(&self, x: u64) -> bool
Checks whether x is multiple of self.
§Example
use lib_modulo::Modulus64;
for n in (1..1 << 10).step_by(2) {
let modulus = Modulus64::new(n);
(0..1 << 10).for_each(|k| assert!(modulus.can_divide(n * k)));
}Trait Implementations§
impl Eq for Modulus64
Auto Trait Implementations§
impl Freeze for Modulus64
impl RefUnwindSafe for Modulus64
impl Send for Modulus64
impl Sync for Modulus64
impl Unpin for Modulus64
impl UnsafeUnpin for Modulus64
impl UnwindSafe for Modulus64
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