pub trait SaturatingAddAssign<RHS = Self> {
    // Required method
    fn saturating_add_assign(&mut self, other: RHS);
}
Expand description

Add a number to another number in place, saturating at the numeric bounds instead of overflowing.

Required Methods§

source

fn saturating_add_assign(&mut self, other: RHS)

Implementations on Foreign Types§

source§

impl SaturatingAddAssign for i8

source§

fn saturating_add_assign(&mut self, other: i8)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingAddAssign for i16

source§

fn saturating_add_assign(&mut self, other: i16)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingAddAssign for i32

source§

fn saturating_add_assign(&mut self, other: i32)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingAddAssign for i64

source§

fn saturating_add_assign(&mut self, other: i64)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingAddAssign for i128

source§

fn saturating_add_assign(&mut self, other: i128)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingAddAssign for isize

source§

fn saturating_add_assign(&mut self, other: isize)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingAddAssign for u8

source§

fn saturating_add_assign(&mut self, other: u8)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingAddAssign for u16

source§

fn saturating_add_assign(&mut self, other: u16)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingAddAssign for u32

source§

fn saturating_add_assign(&mut self, other: u32)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingAddAssign for u64

source§

fn saturating_add_assign(&mut self, other: u64)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingAddAssign for u128

source§

fn saturating_add_assign(&mut self, other: u128)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingAddAssign for usize

source§

fn saturating_add_assign(&mut self, other: usize)

Adds a number to another number, in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x + y & \text{if} \quad m \leq x + y \leq M, \\ M & \text{if} \quad x + y > M, \\ m & \text{if} \quad x + y < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§