num_traits::ops::overflowing

Trait OverflowingSub

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

Performs substraction with a flag for overflow.

Required Methods§

Source

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

Returns a tuple of the difference 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 OverflowingSub for i8

Source§

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

Source§

impl OverflowingSub for i16

Source§

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

Source§

impl OverflowingSub for i32

Source§

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

Source§

impl OverflowingSub for i64

Source§

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

Source§

impl OverflowingSub for i128

Source§

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

Source§

impl OverflowingSub for isize

Source§

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

Source§

impl OverflowingSub for u8

Source§

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

Source§

impl OverflowingSub for u16

Source§

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

Source§

impl OverflowingSub for u32

Source§

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

Source§

impl OverflowingSub for u64

Source§

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

Source§

impl OverflowingSub for u128

Source§

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

Source§

impl OverflowingSub for usize

Source§

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

Implementors§