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.

Object Safety§

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§