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