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§
sourcefn defensive_saturating_add(self, other: Self) -> Self
fn defensive_saturating_add(self, other: Self) -> Self
Return self
plus other
defensively.
sourcefn defensive_saturating_sub(self, other: Self) -> Self
fn defensive_saturating_sub(self, other: Self) -> Self
Return self
minus other
defensively.
sourcefn defensive_saturating_mul(self, other: Self) -> Self
fn defensive_saturating_mul(self, other: Self) -> Self
Return the product of self
and other
defensively.
sourcefn defensive_saturating_accrue(&mut self, other: Self)
fn defensive_saturating_accrue(&mut self, other: Self)
Increase self
by other
defensively.
sourcefn defensive_saturating_reduce(&mut self, other: Self)
fn defensive_saturating_reduce(&mut self, other: Self)
Reduce self
by other
defensively.
sourcefn defensive_saturating_inc(&mut self)
fn defensive_saturating_inc(&mut self)
Increment self
by one defensively.
sourcefn defensive_saturating_dec(&mut self)
fn defensive_saturating_dec(&mut self)
Decrement self
by one defensively.