Trait CheckedEuclid
trait CheckedEuclid: Euclid
Required Methods
fn checked_div_euclid(self: &Self, v: &Self) -> Option<Self>Performs euclid division that returns
Noneinstead of panicking on division by zero and instead of wrapping around on underflow and overflow.fn checked_rem_euclid(self: &Self, v: &Self) -> Option<Self>Finds the euclid remainder of dividing two numbers, checking for underflow, overflow and division by zero. If any of that happens,
Noneis returned.
Provided Methods
fn checked_div_rem_euclid(self: &Self, v: &Self) -> Option<(Self, Self)>Returns both the quotient and remainder from checked Euclidean division.
By default, it internally calls both
CheckedEuclid::checked_div_euclidandCheckedEuclid::checked_rem_euclid, but it can be overridden in order to implement some optimization.Examples
# use CheckedEuclid; let x = 5u8; let y = 3u8; let div = checked_div_euclid; let rem = checked_rem_euclid; assert_eq!;
Implementors
impl CheckedEuclid for isizeimpl CheckedEuclid for i128impl CheckedEuclid for u64impl CheckedEuclid for i64impl CheckedEuclid for u32impl CheckedEuclid for i32impl CheckedEuclid for u16impl CheckedEuclid for i16impl CheckedEuclid for u8impl CheckedEuclid for i8impl CheckedEuclid for usizeimpl CheckedEuclid for u128