Skip to main content

WrappingAbsAssign

Trait WrappingAbsAssign 

Source
pub trait WrappingAbsAssign {
    // Required method
    fn wrapping_abs_assign(&mut self);
}
Expand description

Replaces a number with its absolute value, wrapping around at the boundary of the type.

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl WrappingAbsAssign for i8

Source§

fn wrapping_abs_assign(&mut self)

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl WrappingAbsAssign for i16

Source§

fn wrapping_abs_assign(&mut self)

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl WrappingAbsAssign for i32

Source§

fn wrapping_abs_assign(&mut self)

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl WrappingAbsAssign for i64

Source§

fn wrapping_abs_assign(&mut self)

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl WrappingAbsAssign for i128

Source§

fn wrapping_abs_assign(&mut self)

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl WrappingAbsAssign for isize

Source§

fn wrapping_abs_assign(&mut self)

Replaces a number with its absolute value, wrapping around at the boundary of the type.

$$ x \gets \begin{cases} |x| & \text{if} \quad x > -2^{W-1}, \\ -2^{W-1} & \text{if} \quad x = -2^{W-1}, \end{cases} $$ where $W$ is Self::WIDTH.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§