Trait option_operations::rem::OptionCheckedRem
source · pub trait OptionCheckedRem<Rhs = Self, InnerRhs = Rhs> {
type Output;
// Required method
fn opt_checked_rem(self, rhs: Rhs) -> Result<Option<Self::Output>, Error>;
}
Expand description
Trait for values and Option
s checked remainder.
Implementing this trait leads to the following auto-implementations:
OptionCheckedRem<Option<InnerRhs>>
forT
.OptionCheckedRem<Rhs>
forOption<T>
.OptionCheckedRem<Option<InnerRhs>>
forOption<T>
.- … and some variants with references.
Note that since the std
library doesn’t define any
CheckedRem
trait,
users must provide the base implementation for the inner type.
Required Associated Types§
Required Methods§
sourcefn opt_checked_rem(self, rhs: Rhs) -> Result<Option<Self::Output>, Error>
fn opt_checked_rem(self, rhs: Rhs) -> Result<Option<Self::Output>, Error>
Computes the checked remainder.
- Returns
Ok(Some(result))
ifresult
could be computed. - Returns
Ok(None)
if at least one argument isNone
. - Returns
Err(Error::Overflow)
if an overflow occured. - Returns
Err(Error::DivisionByZero)
ifrhs
is zero.