pub fn div_mod<T>(e: T, d: T) -> (T, T)where
T: Copy + Div<Output = T> + Rem<Output = T>,Expand description
Combined Division/Remainder.
Perform division and remainder operations in one go, returning both results as a tuple.
Nothing fancy happens here. This is just more convenient than performing each operation individually.
Examples
// Using the div_mod one-liner.
assert_eq!(
dactyl::div_mod(10_u32, 3_u32),
(3_u32, 1_u32),
);
// Or the same thing, done manually.
assert_eq!(
(10_u32 / 3_u32, 10_u32 % 3_u32),
(3_u32, 1_u32),
);Panics
This will panic if the denominator is set to zero or if the result of
either operation would overflow, like i8::MIN / -1_i8.