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

    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§

The resulting inner type after applying the division.

Required Methods§

Computes the division.

Returns None if at least one argument is None.


Most implementations will panic if rhs is zero.

Implementations on Foreign Types§