Trait gstreamer::prelude::OptionCheckedAdd

source ·
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§

source

type Output

The resulting inner type after applying the addition.

Required Methods§

source

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§

source§

impl OptionCheckedAdd for i8

source§

impl OptionCheckedAdd for i16

source§

impl OptionCheckedAdd for i32

source§

impl OptionCheckedAdd for i64

source§

impl OptionCheckedAdd for i128

source§

impl OptionCheckedAdd for u8

source§

impl OptionCheckedAdd for u16

source§

impl OptionCheckedAdd for u32

source§

impl OptionCheckedAdd for u64

source§

impl OptionCheckedAdd for u128

source§

impl OptionCheckedAdd for Duration

source§

impl OptionCheckedAdd<Signed<u32>> for u32

source§

impl OptionCheckedAdd<Signed<u64>> for u64

source§

impl OptionCheckedAdd<Signed<usize>> for usize

source§

impl OptionCheckedAdd<Duration> for Instant

source§

impl OptionCheckedAdd<Duration> for SystemTime

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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<ClockTime>

source§

impl OptionCheckedAdd for Signed<Other>

source§

impl OptionCheckedAdd for Signed<Buffers>

source§

impl OptionCheckedAdd for Signed<Bytes>

source§

impl OptionCheckedAdd for Signed<Default>

source§

impl OptionCheckedAdd for Signed<Percent>

source§

impl OptionCheckedAdd for ClockTime

source§

impl OptionCheckedAdd for Other

source§

impl OptionCheckedAdd for Buffers

source§

impl OptionCheckedAdd for Bytes

source§

impl OptionCheckedAdd for Default

source§

impl OptionCheckedAdd for Percent

source§

impl OptionCheckedAdd<Signed<ClockTime>> for ClockTime

source§

impl OptionCheckedAdd<Signed<Other>> for Other

source§

impl OptionCheckedAdd<Signed<Buffers>> for Buffers

source§

impl OptionCheckedAdd<Signed<Bytes>> for Bytes

source§

impl OptionCheckedAdd<Signed<Default>> for Default

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<ClockTime> for Signed<ClockTime>

source§

impl OptionCheckedAdd<Other> for Signed<Other>

source§

impl OptionCheckedAdd<Buffers> for Signed<Buffers>

source§

impl OptionCheckedAdd<Bytes> for Signed<Bytes>

source§

impl OptionCheckedAdd<Default> for Signed<Default>

source§

impl OptionCheckedAdd<Percent> for Signed<Percent>

source§

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

source§

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

source§

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

source§

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