Trait num_traits::ops::checked::CheckedAdd [−][src]
pub trait CheckedAdd: Sized + Add<Self, Output = Self> { fn checked_add(&self, v: &Self) -> Option<Self>; }
Performs addition that returns None
instead of wrapping around on
overflow.
Required Methods
fn checked_add(&self, v: &Self) -> Option<Self>
Adds two numbers, checking for overflow. If overflow happens, None
is
returned.
Implementors
impl CheckedAdd for u8
impl CheckedAdd for u16
impl CheckedAdd for u32
impl CheckedAdd for u64
impl CheckedAdd for usize
impl CheckedAdd for u128
impl CheckedAdd for i8
impl CheckedAdd for i16
impl CheckedAdd for i32
impl CheckedAdd for i64
impl CheckedAdd for isize
impl CheckedAdd for i128