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