pub trait SaturatingSquareAssign {
    // Required method
    fn saturating_square_assign(&mut self);
}
Expand description

Squares a number in place, saturating at the numeric bounds instead of overflowing.

Required Methods§

Implementations on Foreign Types§

source§

impl SaturatingSquareAssign for i8

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingSquareAssign for i16

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingSquareAssign for i32

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingSquareAssign for i64

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingSquareAssign for i128

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingSquareAssign for isize

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingSquareAssign for u8

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingSquareAssign for u16

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingSquareAssign for u32

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingSquareAssign for u64

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingSquareAssign for u128

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl SaturatingSquareAssign for usize

source§

fn saturating_square_assign(&mut self)

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§