pub trait OptionCheckedAdd<Rhs = Self, InnerRhs = Rhs> {
type Output;
// Required method
fn opt_checked_add(self, rhs: Rhs) -> Result<Option<Self::Output>, Error>;
}Expand description
Trait for values and Options checked addition.
Implementing this trait leads to the following auto-implementations:
OptionCheckedAdd<Option<InnerRhs>>forT.OptionCheckedAdd<Rhs>forOption<T>.OptionCheckedAdd<Option<InnerRhs>>forOption<T>.- … and some variants with references.
Note that since the std library doesn’t define any
CheckedAdd trait,
users must provide the base implementation for the inner type.
Required Associated Types§
Required Methods§
Implementations on Foreign Types§
Source§impl OptionCheckedAdd for i8
impl OptionCheckedAdd for i8
Source§impl OptionCheckedAdd for i16
impl OptionCheckedAdd for i16
Source§impl OptionCheckedAdd for i32
impl OptionCheckedAdd for i32
Source§impl OptionCheckedAdd for i64
impl OptionCheckedAdd for i64
Source§impl OptionCheckedAdd for i128
impl OptionCheckedAdd for i128
Source§impl OptionCheckedAdd for u8
impl OptionCheckedAdd for u8
Source§impl OptionCheckedAdd for u16
impl OptionCheckedAdd for u16
Source§impl OptionCheckedAdd for u32
impl OptionCheckedAdd for u32
Source§impl OptionCheckedAdd for u64
impl OptionCheckedAdd for u64
Source§impl OptionCheckedAdd for u128
impl OptionCheckedAdd for u128
Source§impl OptionCheckedAdd for Duration
impl OptionCheckedAdd for Duration
Source§impl OptionCheckedAdd<Duration> for Instant
Available on crate feature std only.
impl OptionCheckedAdd<Duration> for Instant
Available on crate feature
std only.Source§impl OptionCheckedAdd<Duration> for SystemTime
Available on crate feature std only.
impl OptionCheckedAdd<Duration> for SystemTime
Available on crate feature
std only.