pub trait SaturatingSubMul<Y = Self, Z = Self> {
    type Output;

    // Required method
    fn saturating_sub_mul(self, y: Y, z: Z) -> Self::Output;
}
Expand description

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

Required Associated Types§

Required Methods§

source

fn saturating_sub_mul(self, y: Y, z: Z) -> Self::Output

Implementations on Foreign Types§

source§

impl SaturatingSubMul for i8

source§

fn saturating_sub_mul(self, y: i8, z: i8) -> i8

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = i8

source§

impl SaturatingSubMul for i16

source§

fn saturating_sub_mul(self, y: i16, z: i16) -> i16

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = i16

source§

impl SaturatingSubMul for i32

source§

fn saturating_sub_mul(self, y: i32, z: i32) -> i32

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = i32

source§

impl SaturatingSubMul for i64

source§

fn saturating_sub_mul(self, y: i64, z: i64) -> i64

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = i64

source§

impl SaturatingSubMul for i128

source§

fn saturating_sub_mul(self, y: i128, z: i128) -> i128

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = i128

source§

impl SaturatingSubMul for isize

source§

fn saturating_sub_mul(self, y: isize, z: isize) -> isize

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = isize

source§

impl SaturatingSubMul for u8

source§

fn saturating_sub_mul(self, y: u8, z: u8) -> u8

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = u8

source§

impl SaturatingSubMul for u16

source§

fn saturating_sub_mul(self, y: u16, z: u16) -> u16

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = u16

source§

impl SaturatingSubMul for u32

source§

fn saturating_sub_mul(self, y: u32, z: u32) -> u32

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = u32

source§

impl SaturatingSubMul for u64

source§

fn saturating_sub_mul(self, y: u64, z: u64) -> u64

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = u64

source§

impl SaturatingSubMul for u128

source§

fn saturating_sub_mul(self, y: u128, z: u128) -> u128

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = u128

source§

impl SaturatingSubMul for usize

source§

fn saturating_sub_mul(self, y: usize, z: usize) -> usize

Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.

$$ f(x, y, z) = \begin{cases} x - yz & \text{if} \quad m \leq x - yz \leq M, \\ M & \text{if} \quad x - yz > M, \\ m & \text{if} \quad x - yz < m, \end{cases} $$ where $m$ is Self::MIN and $M$ is Self::MAX.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

§

type Output = usize

Implementors§