pub trait CheckedDiv: Sized + Div<Output = Self> {
// Required method
fn checked_div(&self, v: &Self) -> Option<Self>;
}
Expand description
Performs division that returns None
instead of panicking on division by zero and instead of
wrapping around on underflow and overflow.
Required Methods§
Sourcefn checked_div(&self, v: &Self) -> Option<Self>
fn checked_div(&self, v: &Self) -> Option<Self>
Divides two numbers, checking for underflow, overflow and division by
zero. If any of that happens, None
is returned.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.