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

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

Trait for values and Options overflowing multiplication.

Implementing this trait leads to the following auto-implementations:

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

Note that since the std library doesn’t define any OverflowingMul trait, users must provide the base implementation for the inner type.

Required Associated Types§

source

type Output

The resulting inner type after applying the multiplication.

Required Methods§

source

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

Returns a tuple of the multiplication along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then self is returned.

Returns None if at least one argument is None.

Implementations on Foreign Types§

source§

impl OptionOverflowingMul for i8

source§

impl OptionOverflowingMul for i16

source§

impl OptionOverflowingMul for i32

source§

impl OptionOverflowingMul for i64

source§

impl OptionOverflowingMul for i128

source§

impl OptionOverflowingMul for u8

source§

impl OptionOverflowingMul for u16

source§

impl OptionOverflowingMul for u32

source§

impl OptionOverflowingMul for u64

source§

impl OptionOverflowingMul for u128

source§

impl OptionOverflowingMul<Buffers> for u64

source§

impl OptionOverflowingMul<Bytes> for u64

source§

impl OptionOverflowingMul<ClockTime> for u64

source§

impl OptionOverflowingMul<Default> for u64

source§

impl OptionOverflowingMul<Other> for u64

source§

impl OptionOverflowingMul<Percent> for u32

source§

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

§

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

source§

fn opt_overflowing_mul( self, rhs: &Option<InnerRhs> ) -> Option<(<Option<T> as OptionOverflowingMul<&Option<InnerRhs>, InnerRhs>>::Output, bool)>

source§

impl<T, InnerRhs> OptionOverflowingMul<Option<InnerRhs>, InnerRhs> for Option<T>

§

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

source§

fn opt_overflowing_mul( self, rhs: Option<InnerRhs> ) -> Option<(<Option<T> as OptionOverflowingMul<Option<InnerRhs>, InnerRhs>>::Output, bool)>

source§

impl<T, Rhs> OptionOverflowingMul<Rhs> for Option<T>

§

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

source§

fn opt_overflowing_mul( self, rhs: Rhs ) -> Option<(<Option<T> as OptionOverflowingMul<Rhs>>::Output, bool)>

Implementors§