# Trait sp_arithmetic::traits::Saturating [−][src]

pub trait Saturating { fn saturating_add(self, rhs: Self) -> Self; fn saturating_sub(self, rhs: Self) -> Self; fn saturating_mul(self, rhs: Self) -> Self; fn saturating_pow(self, exp: usize) -> Self; fn saturating_inc(&mut self)

where

Self: One, { ... } fn saturating_dec(&mut self)

where

Self: One, { ... } fn saturating_accrue(&mut self, amount: Self)

where

Self: One, { ... } fn saturating_reduce(&mut self, amount: Self)

where

Self: One, { ... } }

Saturating arithmetic operations, returning maximum or minimum values instead of overflowing.

## Required methods

`fn saturating_add(self, rhs: Self) -> Self`

[src]

Saturating addition. Compute `self + rhs`

, saturating at the numeric bounds instead of
overflowing.

`fn saturating_sub(self, rhs: Self) -> Self`

[src]

Saturating subtraction. Compute `self - rhs`

, saturating at the numeric bounds instead of
overflowing.

`fn saturating_mul(self, rhs: Self) -> Self`

[src]

Saturating multiply. Compute `self * rhs`

, saturating at the numeric bounds instead of
overflowing.

`fn saturating_pow(self, exp: usize) -> Self`

[src]

Saturating exponentiation. Compute `self.pow(exp)`

, saturating at the numeric bounds
instead of overflowing.

## Provided methods

`fn saturating_inc(&mut self) where`

Self: One,

[src]

Self: One,

Increment self by one, saturating.

`fn saturating_dec(&mut self) where`

Self: One,

[src]

Self: One,

Decrement self by one, saturating at zero.

`fn saturating_accrue(&mut self, amount: Self) where`

Self: One,

[src]

Self: One,

Increment self by some `amount`

, saturating.

`fn saturating_reduce(&mut self, amount: Self) where`

Self: One,

[src]

Self: One,

Decrement self by some `amount`

, saturating at zero.

## Implementors

`impl Saturating for FixedI64`

[src]

`fn saturating_add(self, rhs: Self) -> Self`

[src]

`fn saturating_sub(self, rhs: Self) -> Self`

[src]

`fn saturating_mul(self, rhs: Self) -> Self`

[src]

`fn saturating_pow(self, exp: usize) -> Self`

[src]

`impl Saturating for FixedI128`

[src]

`fn saturating_add(self, rhs: Self) -> Self`

[src]

`fn saturating_sub(self, rhs: Self) -> Self`

[src]

`fn saturating_mul(self, rhs: Self) -> Self`

[src]

`fn saturating_pow(self, exp: usize) -> Self`

[src]

`impl Saturating for FixedU128`

[src]

`fn saturating_add(self, rhs: Self) -> Self`

[src]

`fn saturating_sub(self, rhs: Self) -> Self`

[src]

`fn saturating_mul(self, rhs: Self) -> Self`

[src]

`fn saturating_pow(self, exp: usize) -> Self`

[src]

`impl Saturating for PerU16`

[src]

`fn saturating_add(self, rhs: Self) -> Self`

[src]

Saturating addition. Compute `self + rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossless if it does not saturate.

`fn saturating_sub(self, rhs: Self) -> Self`

[src]

Saturating subtraction. Compute `self - rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossless if it does not saturate.

`fn saturating_mul(self, rhs: Self) -> Self`

[src]

Saturating multiply. Compute `self * rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossy.

`fn saturating_pow(self, exp: usize) -> Self`

[src]

Saturating exponentiation. Computes `self.pow(exp)`

, saturating at the numeric
bounds instead of overflowing. This operation is lossy.

`impl Saturating for Perbill`

[src]

`fn saturating_add(self, rhs: Self) -> Self`

[src]

Saturating addition. Compute `self + rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossless if it does not saturate.

`fn saturating_sub(self, rhs: Self) -> Self`

[src]

Saturating subtraction. Compute `self - rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossless if it does not saturate.

`fn saturating_mul(self, rhs: Self) -> Self`

[src]

Saturating multiply. Compute `self * rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossy.

`fn saturating_pow(self, exp: usize) -> Self`

[src]

Saturating exponentiation. Computes `self.pow(exp)`

, saturating at the numeric
bounds instead of overflowing. This operation is lossy.

`impl Saturating for Percent`

[src]

`fn saturating_add(self, rhs: Self) -> Self`

[src]

Saturating addition. Compute `self + rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossless if it does not saturate.

`fn saturating_sub(self, rhs: Self) -> Self`

[src]

Saturating subtraction. Compute `self - rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossless if it does not saturate.

`fn saturating_mul(self, rhs: Self) -> Self`

[src]

Saturating multiply. Compute `self * rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossy.

`fn saturating_pow(self, exp: usize) -> Self`

[src]

Saturating exponentiation. Computes `self.pow(exp)`

, saturating at the numeric
bounds instead of overflowing. This operation is lossy.

`impl Saturating for Permill`

[src]

`fn saturating_add(self, rhs: Self) -> Self`

[src]

`self + rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossless if it does not saturate.

`fn saturating_sub(self, rhs: Self) -> Self`

[src]

`self - rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossless if it does not saturate.

`fn saturating_mul(self, rhs: Self) -> Self`

[src]

`self * rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossy.

`fn saturating_pow(self, exp: usize) -> Self`

[src]

`self.pow(exp)`

, saturating at the numeric
bounds instead of overflowing. This operation is lossy.

`impl Saturating for Perquintill`

[src]

`fn saturating_add(self, rhs: Self) -> Self`

[src]

`self + rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossless if it does not saturate.

`fn saturating_sub(self, rhs: Self) -> Self`

[src]

`self - rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossless if it does not saturate.

`fn saturating_mul(self, rhs: Self) -> Self`

[src]

`self * rhs`

, saturating at the numeric bounds instead of
overflowing. This operation is lossy.

`fn saturating_pow(self, exp: usize) -> Self`

[src]

`self.pow(exp)`

, saturating at the numeric
bounds instead of overflowing. This operation is lossy.