Struct quickdiv::DivisorU64
source · pub struct DivisorU64 { /* private fields */ }
Expand description
Faster divisor for division and modulo operations by 64-bit unsigned integer values.
Implementations§
source§impl DivisorU64
impl DivisorU64
sourcepub const fn new(d: u64) -> DivisorU64
pub const fn new(d: u64) -> DivisorU64
sourcepub const fn get(&self) -> u64
pub const fn get(&self) -> u64
Returns the value that was used to construct this divisor as a primitive type.
Examples
use quickdiv::DivisorU64;
let d = DivisorU64::new(7);
assert_eq!(d.get(), 7);
sourcepub const fn divides(&self, n: u64) -> bool
pub const fn divides(&self, n: u64) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
Examples
use quickdiv::DivisorU64;
let d = DivisorU64::new(17);
assert!(d.divides(34));
Trait Implementations§
source§impl Clone for DivisorU64
impl Clone for DivisorU64
source§fn clone(&self) -> DivisorU64
fn clone(&self) -> DivisorU64
Returns a copy of the value. Read more
1.0.0 · 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 DivisorU64
impl Debug for DivisorU64
source§impl Div<DivisorU64> for u64
impl Div<DivisorU64> for u64
source§impl DivAssign<DivisorU64> for u64
impl DivAssign<DivisorU64> for u64
source§fn div_assign(&mut self, rhs: DivisorU64)
fn div_assign(&mut self, rhs: DivisorU64)
Performs the
/=
operation. Read moresource§impl Hash for DivisorU64
impl Hash for DivisorU64
source§impl PartialEq for DivisorU64
impl PartialEq for DivisorU64
source§fn eq(&self, other: &DivisorU64) -> bool
fn eq(&self, other: &DivisorU64) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Rem<DivisorU64> for u64
impl Rem<DivisorU64> for u64
source§impl RemAssign<DivisorU64> for u64
impl RemAssign<DivisorU64> for u64
source§fn rem_assign(&mut self, rhs: DivisorU64)
fn rem_assign(&mut self, rhs: DivisorU64)
Performs the
%=
operation. Read moreimpl Copy for DivisorU64
impl Eq for DivisorU64
impl StructuralEq for DivisorU64
impl StructuralPartialEq for DivisorU64
Auto Trait Implementations§
impl RefUnwindSafe for DivisorU64
impl Send for DivisorU64
impl Sync for DivisorU64
impl Unpin for DivisorU64
impl UnwindSafe for DivisorU64
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