pub trait OptionAdd<Rhs = Self, InnerRhs = Rhs> {
    type Output;

    fn opt_add(self, rhs: Rhs) -> Option<Self::Output>;
Expand description

Trait for values and Options addition.

Implementing this trait leads to the following auto-implementations:

  • OptionAdd<Option<InnerRhs>> for T.
  • OptionAdd<Rhs> for Option<T>.
  • OptionAdd<Option<InnerRhs>> for Option<T>.
  • … and some variants with references.

This trait is auto-implemented for OptionOperations types implementing Add<Rhs>.

Required Associated Types§

The resulting inner type after applying the addition.

Required Methods§

Computes the addition.

Returns None if at least one argument is None.

Implementations on Foreign Types§