pub trait Saturating {
    fn saturating_add(self, rhs: Self) -> Self;
fn saturating_sub(self, rhs: Self) -> Self;
fn saturating_mul(self, rhs: Self) -> Self;
fn saturating_pow(self, exp: usize) -> Self; fn saturating_inc(&mut self)
    where
        Self: One
, { ... }
fn saturating_dec(&mut self)
    where
        Self: One
, { ... }
fn saturating_accrue(&mut self, amount: Self)
    where
        Self: One
, { ... }
fn saturating_reduce(&mut self, amount: Self)
    where
        Self: One
, { ... } }
Expand description

Saturating arithmetic operations, returning maximum or minimum values instead of overflowing.

Required methods

Saturating addition. Compute self + rhs, saturating at the numeric bounds instead of overflowing.

Saturating subtraction. Compute self - rhs, saturating at the numeric bounds instead of overflowing.

Saturating multiply. Compute self * rhs, saturating at the numeric bounds instead of overflowing.

Saturating exponentiation. Compute self.pow(exp), saturating at the numeric bounds instead of overflowing.

Provided methods

Increment self by one, saturating.

Decrement self by one, saturating at zero.

Increment self by some amount, saturating.

Decrement self by some amount, saturating at zero.

Implementors