Trait opendp::traits::SaturatingMul
source · pub trait SaturatingMul: Sized {
// Required method
fn saturating_mul(&self, v: &Self) -> Self;
}
Expand description
Multiplication that saturates at the numeric bounds instead of overflowing.
Avoids unrecoverable panics that could leak private information.
use opendp::traits::SaturatingMul;
assert_eq!(i8::MAX.saturating_mul(2), i8::MAX);
Required Methods§
sourcefn saturating_mul(&self, v: &Self) -> Self
fn saturating_mul(&self, v: &Self) -> Self
§Proof Definition
For any self
and v
of type Self
,
returns self * v
, saturating at the relevant high or low boundary of the type.
Object Safety§
This trait is not object safe.