pub trait CheckedSub<T>: Sized {
type Output;
// Required method
fn checked_sub(&self, rhs: T) -> Option<Self::Output>;
}Expand description
Safe subtraction.
Required Associated Types§
Required Methods§
sourcefn checked_sub(&self, rhs: T) -> Option<Self::Output>
fn checked_sub(&self, rhs: T) -> Option<Self::Output>
Subtracts two items.
- If the subtraction occurs successfully, then
Some<Self>is returned. - If the subtraction would overflow,
Noneis returned.
Object Safety§
This trait is not object safe.