Trait option_operations::sub::OptionWrappingSub [−][src]
pub trait OptionWrappingSub<Rhs = Self, InnerRhs = Rhs> {
type Output;
fn opt_wrapping_sub(self, rhs: Rhs) -> Option<Self::Output>;
}Expand description
Trait for values and Options wrapping substraction.
Implementing this type leads to the following auto-implementations:
OptionWrappingSub<Option<InnerRhs>>forT.OptionWrappingSub<Rhs>forOption<T>.OptionWrappingSub<Option<InnerRhs>>forOption<T>.- … and some variants with references.
Note that since the std library doesn’t define any WrappingSub
trait, users must provide the base implementation for the inner type.
Associated Types
Required methods
fn opt_wrapping_sub(self, rhs: Rhs) -> Option<Self::Output>
fn opt_wrapping_sub(self, rhs: Rhs) -> Option<Self::Output>
Computes the substraction, wrapping around at the numeric bounds instead of overflowing.
Returns None if at least one argument is None.