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