Trait frame_support::traits::DefensiveSaturating
source · pub trait DefensiveSaturating {
fn defensive_saturating_add(self, other: Self) -> Self;
fn defensive_saturating_sub(self, other: Self) -> Self;
fn defensive_saturating_mul(self, other: Self) -> 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
Add self
and other
defensively.
sourcefn defensive_saturating_sub(self, other: Self) -> Self
fn defensive_saturating_sub(self, other: Self) -> Self
Subtract other
from self
defensively.
sourcefn defensive_saturating_mul(self, other: Self) -> Self
fn defensive_saturating_mul(self, other: Self) -> Self
Multiply self
and other
defensively.