Struct opendp::core::PrivacyMap
source · pub struct PrivacyMap<MI: Metric, MO: Measure>(pub Arc<dyn Fn(&MI::Distance) -> Fallible<MO::Distance> + Send + Sync>);
Expand description
A map evaluating the privacy of a Measurement
.
A PrivacyMap
is implemented as a function that takes an input Metric::Distance
and returns the smallest upper bound on distances between output distributions on neighboring input datasets.
Tuple Fields§
§0: Arc<dyn Fn(&MI::Distance) -> Fallible<MO::Distance> + Send + Sync>
Implementations§
source§impl<MI: Metric, MO: Measure> PrivacyMap<MI, MO>
impl<MI: Metric, MO: Measure> PrivacyMap<MI, MO>
pub fn new( map: impl Fn(&MI::Distance) -> MO::Distance + 'static + Send + Sync ) -> Self
pub fn new_fallible( map: impl Fn(&MI::Distance) -> Fallible<MO::Distance> + 'static + Send + Sync ) -> Self
pub fn new_from_constant(c: MO::Distance) -> Self
pub fn eval(&self, input_distance: &MI::Distance) -> Fallible<MO::Distance>
source§impl<MI: 'static + Metric, MO: 'static + Measure> PrivacyMap<MI, MO>
impl<MI: 'static + Metric, MO: 'static + Measure> PrivacyMap<MI, MO>
pub fn make_chain<MX: 'static + Metric>( map1: &PrivacyMap<MX, MO>, map0: &StabilityMap<MI, MX> ) -> Self
Trait Implementations§
source§impl<MI: Metric, MO: Measure> IntoAnyPrivacyMapExt for PrivacyMap<MI, MO>
impl<MI: Metric, MO: Measure> IntoAnyPrivacyMapExt for PrivacyMap<MI, MO>
fn into_any(self) -> AnyPrivacyMap
Auto Trait Implementations§
impl<MI, MO> Freeze for PrivacyMap<MI, MO>
impl<MI, MO> !RefUnwindSafe for PrivacyMap<MI, MO>
impl<MI, MO> Send for PrivacyMap<MI, MO>
impl<MI, MO> Sync for PrivacyMap<MI, MO>
impl<MI, MO> Unpin for PrivacyMap<MI, MO>
impl<MI, MO> !UnwindSafe for PrivacyMap<MI, MO>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.