pub trait OverflowingAdd: Sized + Add<Output = Self> {
    // Required method
    fn overflowing_add(&self, v: &Self) -> (Self, bool);
}
Expand description

Performs addition with a flag for overflow.

Required Methods§

source

fn overflowing_add(&self, v: &Self) -> (Self, bool)

Returns a tuple of the sum along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl OverflowingAdd for i8

source§

fn overflowing_add(&self, v: &i8) -> (i8, bool)

source§

impl OverflowingAdd for i16

source§

fn overflowing_add(&self, v: &i16) -> (i16, bool)

source§

impl OverflowingAdd for i32

source§

fn overflowing_add(&self, v: &i32) -> (i32, bool)

source§

impl OverflowingAdd for i64

source§

fn overflowing_add(&self, v: &i64) -> (i64, bool)

source§

impl OverflowingAdd for i128

source§

fn overflowing_add(&self, v: &i128) -> (i128, bool)

source§

impl OverflowingAdd for isize

source§

impl OverflowingAdd for u8

source§

fn overflowing_add(&self, v: &u8) -> (u8, bool)

source§

impl OverflowingAdd for u16

source§

fn overflowing_add(&self, v: &u16) -> (u16, bool)

source§

impl OverflowingAdd for u32

source§

fn overflowing_add(&self, v: &u32) -> (u32, bool)

source§

impl OverflowingAdd for u64

source§

fn overflowing_add(&self, v: &u64) -> (u64, bool)

source§

impl OverflowingAdd for u128

source§

fn overflowing_add(&self, v: &u128) -> (u128, bool)

source§

impl OverflowingAdd for usize

Implementors§