Skip to main content

Saturating

Trait Saturating 

Source
pub trait Saturating {
    // Required methods
    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;
}
Expand description

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

Required Methods§

Source

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

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

Source

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

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

Source

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

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

Source

fn saturating_pow(self, exp: usize) -> Self

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§