referrerpolicy=no-referrer-when-downgrade

Trait frame_support::traits::DefensiveSaturating

source ·
pub trait DefensiveSaturating {
    // Required methods
    fn defensive_saturating_add(self, other: Self) -> Self;
    fn defensive_saturating_sub(self, other: Self) -> Self;
    fn defensive_saturating_mul(self, other: Self) -> Self;
    fn defensive_saturating_accrue(&mut self, other: Self);
    fn defensive_saturating_reduce(&mut self, other: Self);
    fn defensive_saturating_inc(&mut self);
    fn defensive_saturating_dec(&mut self);
}
Expand description

A variant of Defensive with the same rationale, for the arithmetic operations where in case an infallible operation fails, it saturates.

Required Methods§

source

fn defensive_saturating_add(self, other: Self) -> Self

Return self plus other defensively.

source

fn defensive_saturating_sub(self, other: Self) -> Self

Return self minus other defensively.

source

fn defensive_saturating_mul(self, other: Self) -> Self

Return the product of self and other defensively.

source

fn defensive_saturating_accrue(&mut self, other: Self)

Increase self by other defensively.

source

fn defensive_saturating_reduce(&mut self, other: Self)

Reduce self by other defensively.

source

fn defensive_saturating_inc(&mut self)

Increment self by one defensively.

source

fn defensive_saturating_dec(&mut self)

Decrement self by one defensively.

Object Safety§

This trait is not object safe.

Implementors§