Trait gstreamer::prelude::OptionCheckedAdd

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

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

Trait for values and Options checked addition.

Implementing this trait leads to the following auto-implementations:

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

Note that since the std library doesn’t define any CheckedAdd 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_checked_add(self, rhs: Rhs) -> Result<Option<Self::Output>, Error>

Computes the checked addition.

  • Returns Ok(Some(result)) if result could be computed.
  • Returns Ok(None) if at least one argument is None.
  • Returns Err(Error::Overflow) if an overflow occured.

Implementations on Foreign Types§

§

impl OptionCheckedAdd for i8

§

type Output = i8

§

fn opt_checked_add( self, rhs: i8, ) -> Result<Option<<i8 as OptionCheckedAdd>::Output>, Error>

§

impl OptionCheckedAdd for i16

§

type Output = i16

§

fn opt_checked_add( self, rhs: i16, ) -> Result<Option<<i16 as OptionCheckedAdd>::Output>, Error>

§

impl OptionCheckedAdd for i32

§

type Output = i32

§

fn opt_checked_add( self, rhs: i32, ) -> Result<Option<<i32 as OptionCheckedAdd>::Output>, Error>

§

impl OptionCheckedAdd for i64

§

type Output = i64

§

fn opt_checked_add( self, rhs: i64, ) -> Result<Option<<i64 as OptionCheckedAdd>::Output>, Error>

§

impl OptionCheckedAdd for i128

§

type Output = i128

§

fn opt_checked_add( self, rhs: i128, ) -> Result<Option<<i128 as OptionCheckedAdd>::Output>, Error>

§

impl OptionCheckedAdd for u8

§

type Output = u8

§

fn opt_checked_add( self, rhs: u8, ) -> Result<Option<<u8 as OptionCheckedAdd>::Output>, Error>

§

impl OptionCheckedAdd for u16

§

type Output = u16

§

fn opt_checked_add( self, rhs: u16, ) -> Result<Option<<u16 as OptionCheckedAdd>::Output>, Error>

§

impl OptionCheckedAdd for u32

§

type Output = u32

§

fn opt_checked_add( self, rhs: u32, ) -> Result<Option<<u32 as OptionCheckedAdd>::Output>, Error>

§

impl OptionCheckedAdd for u64

§

type Output = u64

§

fn opt_checked_add( self, rhs: u64, ) -> Result<Option<<u64 as OptionCheckedAdd>::Output>, Error>

§

impl OptionCheckedAdd for u128

§

type Output = u128

§

fn opt_checked_add( self, rhs: u128, ) -> Result<Option<<u128 as OptionCheckedAdd>::Output>, Error>

§

impl OptionCheckedAdd for Duration

source§

impl OptionCheckedAdd<Signed<u32>> for u32

§

type Output = Signed<u32>

source§

fn opt_checked_add( self, rhs: Signed<u32>, ) -> Result<Option<Self::Output>, Error>

source§

impl OptionCheckedAdd<Signed<u64>> for u64

§

type Output = Signed<u64>

source§

fn opt_checked_add( self, rhs: Signed<u64>, ) -> Result<Option<Self::Output>, Error>

source§

impl OptionCheckedAdd<Signed<usize>> for usize

§

type Output = Signed<usize>

source§

fn opt_checked_add( self, rhs: Signed<usize>, ) -> Result<Option<Self::Output>, Error>

§

impl OptionCheckedAdd<Duration> for Instant

§

impl OptionCheckedAdd<Duration> for SystemTime

§

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

§

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

§

fn opt_checked_add( self, rhs: &Option<InnerRhs>, ) -> Result<Option<<Option<T> as OptionCheckedAdd<&Option<InnerRhs>, InnerRhs>>::Output>, Error>

§

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

§

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

§

fn opt_checked_add( self, rhs: Option<InnerRhs>, ) -> Result<Option<<Option<T> as OptionCheckedAdd<Option<InnerRhs>, InnerRhs>>::Output>, Error>

§

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

§

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

§

fn opt_checked_add( self, rhs: Rhs, ) -> Result<Option<<Option<T> as OptionCheckedAdd<Rhs>>::Output>, Error>

Implementors§

source§

impl OptionCheckedAdd for Signed<u32>

source§

impl OptionCheckedAdd for Signed<u64>

source§

impl OptionCheckedAdd for Signed<usize>

source§

impl OptionCheckedAdd for Signed<Buffers>

source§

impl OptionCheckedAdd for Signed<Bytes>

source§

impl OptionCheckedAdd for Signed<ClockTime>

source§

impl OptionCheckedAdd for Signed<Default>

source§

impl OptionCheckedAdd for Signed<Other>

source§

impl OptionCheckedAdd for Signed<Percent>

source§

impl OptionCheckedAdd for Buffers

source§

impl OptionCheckedAdd for Bytes

source§

impl OptionCheckedAdd for ClockTime

source§

impl OptionCheckedAdd for Default

source§

impl OptionCheckedAdd for Other

source§

impl OptionCheckedAdd for Percent

source§

impl OptionCheckedAdd<Signed<Buffers>> for Buffers

source§

impl OptionCheckedAdd<Signed<Bytes>> for Bytes

source§

impl OptionCheckedAdd<Signed<ClockTime>> for ClockTime

source§

impl OptionCheckedAdd<Signed<Default>> for Default

source§

impl OptionCheckedAdd<Signed<Other>> for Other

source§

impl OptionCheckedAdd<Signed<Percent>> for Percent

source§

impl OptionCheckedAdd<u32> for Signed<u32>

source§

impl OptionCheckedAdd<u64> for Signed<u64>

source§

impl OptionCheckedAdd<usize> for Signed<usize>

source§

impl OptionCheckedAdd<Buffers> for Signed<Buffers>

source§

impl OptionCheckedAdd<Bytes> for Signed<Bytes>

source§

impl OptionCheckedAdd<ClockTime> for Signed<ClockTime>

source§

impl OptionCheckedAdd<Default> for Signed<Default>

source§

impl OptionCheckedAdd<Other> for Signed<Other>

source§

impl OptionCheckedAdd<Percent> for Signed<Percent>

§

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

§

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

§

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

§

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