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