pub trait CheckedSub: Sized + Sub<Self> {
// Required method
fn checked_sub(self, v: Self) -> Option<<Self as Sub<Self>>::Output>;
}Expand description
Performs subtraction, returning None if overflow occurred.
Required Methods§
Sourcefn checked_sub(self, v: Self) -> Option<<Self as Sub<Self>>::Output>
fn checked_sub(self, v: Self) -> Option<<Self as Sub<Self>>::Output>
Subtracts two numbers, checking for overflow. If overflow happens,
None is returned.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".