OverflowArithmetic

Trait OverflowArithmetic 

Source
pub trait OverflowArithmetic {
    // Required methods
    fn overflow_add(self, other: Self) -> Self;
    fn overflow_sub(self, other: Self) -> Self;
    fn overflow_mul(self, other: Self) -> Self;
    fn overflow_div(self, other: Self) -> Self;
    fn overflow_shl(self, other: Self) -> Self;
    fn overflow_shr(self, other: Self) -> Self;
    fn overflow_neg(self) -> Self;
    fn overflow_rem(self, other: Self) -> Self;
}
Expand description

A type cast trait used to do the integer arithmetic.

Required Methods§

Source

fn overflow_add(self, other: Self) -> Self

Overflow add.

Source

fn overflow_sub(self, other: Self) -> Self

Overflow sub.

Source

fn overflow_mul(self, other: Self) -> Self

Overflow mul.

Source

fn overflow_div(self, other: Self) -> Self

Overflow div.

Source

fn overflow_shl(self, other: Self) -> Self

Overflow shl.

Source

fn overflow_shr(self, other: Self) -> Self

Overflow shr.

Source

fn overflow_neg(self) -> Self

Overflow neg.

Source

fn overflow_rem(self, other: Self) -> Self

Overflow rem.

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 OverflowArithmetic for i8

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Source§

impl OverflowArithmetic for i16

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Source§

impl OverflowArithmetic for i32

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Source§

impl OverflowArithmetic for i64

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Source§

impl OverflowArithmetic for i128

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Source§

impl OverflowArithmetic for isize

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Source§

impl OverflowArithmetic for u8

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Source§

impl OverflowArithmetic for u16

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Source§

impl OverflowArithmetic for u32

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Source§

impl OverflowArithmetic for u64

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Source§

impl OverflowArithmetic for u128

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Source§

impl OverflowArithmetic for usize

Source§

fn overflow_add(self, other: Self) -> Self

Source§

fn overflow_sub(self, other: Self) -> Self

Source§

fn overflow_mul(self, other: Self) -> Self

Source§

fn overflow_div(self, other: Self) -> Self

Source§

fn overflow_shl(self, other: Self) -> Self

Source§

fn overflow_shr(self, other: Self) -> Self

Source§

fn overflow_neg(self) -> Self

Source§

fn overflow_rem(self, other: Self) -> Self

Implementors§