Trait opendp::traits::arithmetic::AlertingSub
source · pub trait AlertingSub: Sized {
// Required method
fn alerting_sub(&self, v: &Self) -> Fallible<Self>;
}
Expand description
Fallible subtraction that returns an error if overflowing.
Avoids unrecoverable panics that could leak private information.
use opendp::traits::AlertingSub;
assert!(i8::MIN.alerting_sub(&1).is_err());
Required Methods§
sourcefn alerting_sub(&self, v: &Self) -> Fallible<Self>
fn alerting_sub(&self, v: &Self) -> Fallible<Self>
Proof Definition
For any self
and v
of type Self
,
returns Ok(self - v)
if the result does not overflow, else Err(e)
Object Safety§
This trait is not object safe.