Trait option_operations::div::OptionDiv

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

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

Trait for values and Options division.

Implementing this trait leads to the following auto-implementations:

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

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

Required Associated Types§

source

type Output

The resulting inner type after applying the division.

Required Methods§

source

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

Computes the division.

Returns None if at least one argument is None.

§Panics

Most implementations will panic if rhs is zero.

Implementations on Foreign Types§

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

Implementors§

source§

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

source§

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

source§

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

source§

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

source§

impl<T, Rhs> OptionDiv<Rhs> for T
where T: OptionOperations + Div<Rhs>,

source§

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