Trait gstreamer::prelude::OptionOverflowingAdd

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

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

Trait for values and Options overflowing addition.

Implementing this trait leads to the following auto-implementations:

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

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

Required Associated Types§

type Output

The resulting inner type after applying the addition.

Required Methods§

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

Returns a tuple of the addition 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§

§

impl OptionOverflowingAdd for i8

§

impl OptionOverflowingAdd for i16

§

impl OptionOverflowingAdd for i32

§

impl OptionOverflowingAdd for i64

§

impl OptionOverflowingAdd for i128

§

impl OptionOverflowingAdd for u8

§

impl OptionOverflowingAdd for u16

§

impl OptionOverflowingAdd for u32

§

impl OptionOverflowingAdd for u64

§

impl OptionOverflowingAdd for u128

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

Implementors§