Skip to main content

ConstOverflowingAdd

Trait ConstOverflowingAdd 

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

Const-compatible overflowing addition.

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.

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 ConstOverflowingAdd for u8

Source§

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

Source§

impl ConstOverflowingAdd for u16

Source§

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

Source§

impl ConstOverflowingAdd for u32

Source§

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

Source§

impl ConstOverflowingAdd for u64

Source§

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

Source§

impl ConstOverflowingAdd for u128

Source§

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

Implementors§

Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstOverflowingAdd for FixedUInt<T, N>