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§

source

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.

Implementations on Foreign Types§

source§

impl AlertingAbs for f32

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for f64

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for i8

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for i16

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for i32

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for i64

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for i128

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for isize

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for u8

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for u16

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for u32

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for u64

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for u128

source§

fn alerting_abs(&self) -> Fallible<Self>

source§

impl AlertingAbs for usize

source§

fn alerting_abs(&self) -> Fallible<Self>

Implementors§