Trait SaturatingSquareAssign

Source
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§