referrerpolicy=no-referrer-when-downgrade

CheckedAdd

Trait CheckedAdd 

Source
pub trait CheckedAdd: Sized + Add<Output = Self> {
    // Required method
    fn checked_add(&self, v: &Self) -> Option<Self>;
}
Expand description

Performs addition that returns None instead of wrapping around on overflow.

Required Methods§

Source

fn checked_add(&self, v: &Self) -> Option<Self>

Adds two numbers, checking for overflow. If overflow happens, None is returned.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CheckedAdd for i8

Source§

fn checked_add(&self, v: &i8) -> Option<i8>

Source§

impl CheckedAdd for i16

Source§

fn checked_add(&self, v: &i16) -> Option<i16>

Source§

impl CheckedAdd for i32

Source§

fn checked_add(&self, v: &i32) -> Option<i32>

Source§

impl CheckedAdd for i64

Source§

fn checked_add(&self, v: &i64) -> Option<i64>

Source§

impl CheckedAdd for i128

Source§

fn checked_add(&self, v: &i128) -> Option<i128>

Source§

impl CheckedAdd for isize

Source§

impl CheckedAdd for u8

Source§

fn checked_add(&self, v: &u8) -> Option<u8>

Source§

impl CheckedAdd for u16

Source§

fn checked_add(&self, v: &u16) -> Option<u16>

Source§

impl CheckedAdd for u32

Source§

fn checked_add(&self, v: &u32) -> Option<u32>

Source§

impl CheckedAdd for u64

Source§

fn checked_add(&self, v: &u64) -> Option<u64>

Source§

impl CheckedAdd for u128

Source§

fn checked_add(&self, v: &u128) -> Option<u128>

Source§

impl CheckedAdd for usize

Source§

impl CheckedAdd for BigInt

Source§

impl CheckedAdd for BigUint

§

impl CheckedAdd for FixedI64

§

fn checked_add(&self, rhs: &FixedI64) -> Option<FixedI64>

§

impl CheckedAdd for FixedI128

§

fn checked_add(&self, rhs: &FixedI128) -> Option<FixedI128>

§

impl CheckedAdd for FixedU64

§

fn checked_add(&self, rhs: &FixedU64) -> Option<FixedU64>

§

impl CheckedAdd for FixedU128

§

fn checked_add(&self, rhs: &FixedU128) -> Option<FixedU128>

§

impl CheckedAdd for PerU16

§

fn checked_add(&self, rhs: &PerU16) -> Option<PerU16>

§

impl CheckedAdd for Perbill

§

fn checked_add(&self, rhs: &Perbill) -> Option<Perbill>

§

impl CheckedAdd for Percent

§

fn checked_add(&self, rhs: &Percent) -> Option<Percent>

§

impl CheckedAdd for Permill

§

fn checked_add(&self, rhs: &Permill) -> Option<Permill>

§

impl CheckedAdd for Perquintill

§

fn checked_add(&self, rhs: &Perquintill) -> Option<Perquintill>

§

impl CheckedAdd for U128

§

fn checked_add(&self, v: &U128) -> Option<U128>

§

impl CheckedAdd for U256

§

fn checked_add(&self, v: &U256) -> Option<U256>

§

impl CheckedAdd for U512

§

fn checked_add(&self, v: &U512) -> Option<U512>

§

impl<T, D> CheckedAdd for TypeWithDefault<T, D>
where T: CheckedAdd, D: Get<T>,

§

fn checked_add( &self, rhs: &TypeWithDefault<T, D>, ) -> Option<TypeWithDefault<T, D>>

Implementors§