Trait opendp::traits::AlertingAbs
source · pub trait AlertingAbs: Sized {
// Required method
fn alerting_abs(&self) -> Fallible<Self>;
}
Expand description
Fallible absolute value that returns an error if overflowing.
This can return an error when a signed integer is the smallest negative value. Avoids unrecoverable panics that could leak private information.
use opendp::traits::AlertingAbs;
assert!(i8::MIN.alerting_abs().is_err());
Required Methods§
sourcefn alerting_abs(&self) -> Fallible<Self>
fn alerting_abs(&self) -> Fallible<Self>
Proof Definition
For any self
of type Self
, returns Ok(out)
where $out = |self|$ or Err(e)
.
Object Safety§
This trait is not object safe.