Trait gstreamer::prelude::OptionCheckedDiv

source ·
pub trait OptionCheckedDiv<Rhs = Self, InnerRhs = Rhs> {
    type Output;

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

Trait for values and Options checked division.

Implementing this trait leads to the following auto-implementations:

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

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

Required Associated Types§

source

type Output

The resulting inner type after applying the division.

Required Methods§

source

fn opt_checked_div(self, rhs: Rhs) -> Result<Option<Self::Output>, Error>

Computes the checked division.

  • 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.
  • Returns Err(Error::DivisionByZero) if rhs is zero.

Implementations on Foreign Types§

source§

impl OptionCheckedDiv for i8

source§

impl OptionCheckedDiv for i16

source§

impl OptionCheckedDiv for i32

source§

impl OptionCheckedDiv for i64

source§

impl OptionCheckedDiv for i128

source§

impl OptionCheckedDiv for u8

source§

impl OptionCheckedDiv for u16

source§

impl OptionCheckedDiv for u32

source§

impl OptionCheckedDiv for u64

source§

impl OptionCheckedDiv for u128

source§

impl OptionCheckedDiv<u32> for Duration

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

Implementors§

source§

impl OptionCheckedDiv for Signed<u32>

source§

impl OptionCheckedDiv for Signed<u64>

source§

impl OptionCheckedDiv for Signed<usize>

source§

impl OptionCheckedDiv for Signed<ClockTime>

source§

impl OptionCheckedDiv for Signed<Other>

source§

impl OptionCheckedDiv for Signed<Buffers>

source§

impl OptionCheckedDiv for Signed<Bytes>

source§

impl OptionCheckedDiv for Signed<Default>

source§

impl OptionCheckedDiv for Signed<Percent>

source§

impl OptionCheckedDiv for ClockTime

source§

impl OptionCheckedDiv for Other

source§

impl OptionCheckedDiv for Buffers

source§

impl OptionCheckedDiv for Bytes

source§

impl OptionCheckedDiv for Default

source§

impl OptionCheckedDiv for Percent

source§

impl OptionCheckedDiv<i32> for Signed<u32>

source§

impl OptionCheckedDiv<i32> for Signed<Percent>

source§

impl OptionCheckedDiv<i64> for Signed<u64>

source§

impl OptionCheckedDiv<i64> for Signed<ClockTime>

source§

impl OptionCheckedDiv<i64> for Signed<Other>

source§

impl OptionCheckedDiv<i64> for Signed<Buffers>

source§

impl OptionCheckedDiv<i64> for Signed<Bytes>

source§

impl OptionCheckedDiv<i64> for Signed<Default>

source§

impl OptionCheckedDiv<isize> for Signed<usize>

source§

impl OptionCheckedDiv<u32> for Signed<u32>

source§

impl OptionCheckedDiv<u32> for Signed<Percent>

source§

impl OptionCheckedDiv<u32> for Percent

source§

impl OptionCheckedDiv<u64> for Signed<u64>

source§

impl OptionCheckedDiv<u64> for Signed<ClockTime>

source§

impl OptionCheckedDiv<u64> for Signed<Other>

source§

impl OptionCheckedDiv<u64> for Signed<Buffers>

source§

impl OptionCheckedDiv<u64> for Signed<Bytes>

source§

impl OptionCheckedDiv<u64> for Signed<Default>

source§

impl OptionCheckedDiv<u64> for ClockTime

source§

impl OptionCheckedDiv<u64> for Other

source§

impl OptionCheckedDiv<u64> for Buffers

source§

impl OptionCheckedDiv<u64> for Bytes

source§

impl OptionCheckedDiv<u64> for Default

source§

impl OptionCheckedDiv<usize> for Signed<usize>

source§

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

source§

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

source§

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

source§

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