Trait option_operations::sub::OptionSub

source ·
pub trait OptionSub<Rhs = Self, InnerRhs = Rhs> {
    type Output;

    // Required method
    fn opt_sub(self, rhs: Rhs) -> Option<Self::Output>;
}
Expand description

Trait for values and Options substraction.

Implementing this trait leads to the following auto-implementations:

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

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

Required Associated Types§

source

type Output

The resulting inner type after applying the substraction.

Required Methods§

source

fn opt_sub(self, rhs: Rhs) -> Option<Self::Output>

Computes the substraction.

Returns None if at least one argument is None.

Implementations on Foreign Types§

source§

impl<T, InnerRhs> OptionSub<&Option<InnerRhs>, InnerRhs> for Option<T>
where T: OptionOperations + OptionSub<InnerRhs>, InnerRhs: Copy,

source§

type Output = <T as OptionSub<InnerRhs>>::Output

source§

fn opt_sub(self, rhs: &Option<InnerRhs>) -> Option<Self::Output>

source§

impl<T, InnerRhs> OptionSub<Option<InnerRhs>, InnerRhs> for Option<T>
where T: OptionOperations + OptionSub<InnerRhs>,

source§

type Output = <T as OptionSub<InnerRhs>>::Output

source§

fn opt_sub(self, rhs: Option<InnerRhs>) -> Option<Self::Output>

source§

impl<T, Rhs> OptionSub<Rhs> for Option<T>
where T: OptionOperations + OptionSub<Rhs>,

source§

type Output = <T as OptionSub<Rhs>>::Output

source§

fn opt_sub(self, rhs: Rhs) -> Option<Self::Output>

Implementors§

source§

impl<T, InnerRhs> OptionSub<&Option<InnerRhs>, InnerRhs> for T
where T: OptionOperations + OptionSub<InnerRhs>, InnerRhs: Copy,

source§

type Output = <T as OptionSub<InnerRhs>>::Output

source§

impl<T, InnerRhs> OptionSub<Option<InnerRhs>, InnerRhs> for T
where T: OptionOperations + OptionSub<InnerRhs>,

source§

type Output = <T as OptionSub<InnerRhs>>::Output

source§

impl<T, Rhs> OptionSub<Rhs> for T
where T: OptionOperations + Sub<Rhs>,

source§

type Output = <T as Sub<Rhs>>::Output