risingwave_common::types

Trait CheckedAdd

source
pub trait CheckedAdd<Rhs = Self> {
    type Output;

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

A more general version of num_traits::CheckedAdd that allows Rhs and Output to be different.

Its signature follows std::ops::Add to take self and Rhs rather than references used in num_traits::CheckedAdd. If we need to implement ops on references, it can be impl CheckedAdd<&Bar> for &Foo.

Required Associated Types§

Required Methods§

source

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

Implementors§

source§

impl CheckedAdd<Interval> for Timestamp

source§

impl<T: CheckedAdd> CheckedAdd for T

Types already impl num_traits::CheckedAdd automatically impl this extended trait. Note that this only covers T + T but not T + &T, &T + T or &T + &T, which is used less frequently for Copy types.