Skip to main content

SaturatingArithmetic

Trait SaturatingArithmetic 

Source
pub trait SaturatingArithmetic: Sealed + Sized {
    // Required methods
    fn saturating_add(self, rhs: Self) -> Self;
    fn saturating_sub(self, rhs: Self) -> Self;
    fn saturating_mul(self, rhs: Self) -> Self;
}
Expand description

Primitive integer types supported by the saturating arithmetic wrappers.

Required Methods§

Source

fn saturating_add(self, rhs: Self) -> Self

Returns the saturating sum of self and rhs.

Source

fn saturating_sub(self, rhs: Self) -> Self

Returns the saturating difference of self and rhs.

Source

fn saturating_mul(self, rhs: Self) -> Self

Returns the saturating product of self and rhs.

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

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Source§

impl SaturatingArithmetic for i16

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Source§

impl SaturatingArithmetic for i32

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Source§

impl SaturatingArithmetic for i64

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Source§

impl SaturatingArithmetic for i128

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Source§

impl SaturatingArithmetic for isize

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Source§

impl SaturatingArithmetic for u8

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Source§

impl SaturatingArithmetic for u16

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Source§

impl SaturatingArithmetic for u32

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Source§

impl SaturatingArithmetic for u64

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Source§

impl SaturatingArithmetic for u128

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Source§

impl SaturatingArithmetic for usize

Source§

fn saturating_add(self, rhs: Self) -> Self

Source§

fn saturating_sub(self, rhs: Self) -> Self

Source§

fn saturating_mul(self, rhs: Self) -> Self

Implementors§