Struct opendp::core::Measurement
source · pub struct Measurement<DI: Domain, DO: Domain, MI: Metric, MO: Measure> {
pub input_domain: DI,
pub output_domain: DO,
pub function: Function<DI, DO>,
pub input_metric: MI,
pub output_measure: MO,
pub privacy_map: PrivacyMap<MI, MO>,
}
Expand description
A randomized mechanism with certain privacy characteristics.
The trait bounds provided by the Rust type system guarantee that:
input_domain
andoutput_domain
are valid domainsinput_metric
is a valid metricoutput_measure
is a valid measure
It is, however, left to constructor functions to prove that:
input_metric
is compatible withinput_domain
privacy_map
is a mapping from the input metric to the output measure
Fields§
§input_domain: DI
§output_domain: DO
§function: Function<DI, DO>
§input_metric: MI
§output_measure: MO
§privacy_map: PrivacyMap<MI, MO>
Implementations§
source§impl<DI: Domain, DO: Domain, MI: Metric, MO: Measure> Measurement<DI, DO, MI, MO>
impl<DI: Domain, DO: Domain, MI: Metric, MO: Measure> Measurement<DI, DO, MI, MO>
pub fn new(
input_domain: DI,
output_domain: DO,
function: Function<DI, DO>,
input_metric: MI,
output_measure: MO,
privacy_map: PrivacyMap<MI, MO>
) -> Self
pub fn invoke(&self, arg: &DI::Carrier) -> Fallible<DO::Carrier>
pub fn map(&self, d_in: &MI::Distance) -> Fallible<MO::Distance>
pub fn check(&self, d_in: &MI::Distance, d_out: &MO::Distance) -> Fallible<bool>where
MO::Distance: TotalOrd,
source§impl<DI, DO, MI, MO> Measurement<DI, DO, MI, MO>where
DI: 'static + Domain,
DI::Carrier: 'static,
DO: 'static + Domain,
DO::Carrier: 'static,
MI: 'static + Metric,
MO: 'static + Measure,
impl<DI, DO, MI, MO> Measurement<DI, DO, MI, MO>where
DI: 'static + Domain,
DI::Carrier: 'static,
DO: 'static + Domain,
DO::Carrier: 'static,
MI: 'static + Metric,
MO: 'static + Measure,
sourcepub fn into_poly(self) -> Measurement<DI, PolyDomain, MI, MO>
pub fn into_poly(self) -> Measurement<DI, PolyDomain, MI, MO>
Converts this Measurement into one with polymorphic output. This is useful for composition of heterogeneous Measurements.
Trait Implementations§
source§impl<DI: Clone + Domain, DO: Clone + Domain, MI: Clone + Metric, MO: Clone + Measure> Clone for Measurement<DI, DO, MI, MO>
impl<DI: Clone + Domain, DO: Clone + Domain, MI: Clone + Metric, MO: Clone + Measure> Clone for Measurement<DI, DO, MI, MO>
source§fn clone(&self) -> Measurement<DI, DO, MI, MO>
fn clone(&self) -> Measurement<DI, DO, MI, MO>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<DI: 'static + Domain, DO: 'static + Domain, MI: 'static + Metric, MO: 'static + Measure> IntoAnyMeasurementExt for Measurement<DI, DO, MI, MO>where
DI::Carrier: 'static,
DO::Carrier: 'static,
MI::Distance: 'static,
MO::Distance: 'static,
impl<DI: 'static + Domain, DO: 'static + Domain, MI: 'static + Metric, MO: 'static + Measure> IntoAnyMeasurementExt for Measurement<DI, DO, MI, MO>where
DI::Carrier: 'static,
DO::Carrier: 'static,
MI::Distance: 'static,
MO::Distance: 'static,
fn into_any(self) -> Measurement<AnyDomain, AnyDomain, AnyMetric, AnyMeasure>
source§impl<DO: 'static + Domain> IntoAnyMeasurementOutExt for Measurement<AnyDomain, DO, AnyMetric, AnyMeasure>where
DO::Carrier: 'static,
impl<DO: 'static + Domain> IntoAnyMeasurementOutExt for Measurement<AnyDomain, DO, AnyMetric, AnyMeasure>where
DO::Carrier: 'static,
fn into_any_out(
self
) -> Measurement<AnyDomain, AnyDomain, AnyMetric, AnyMeasure>
source§impl<DI, DX, DO, MI, MX, MO> Shr<Measurement<DX, DO, MX, MO>> for Fallible<Transformation<DI, DX, MI, MX>>where
DI: 'static + Domain,
DX: 'static + Domain,
DO: 'static + Domain,
MI: 'static + Metric,
MX: 'static + Metric,
MO: 'static + Measure,
impl<DI, DX, DO, MI, MX, MO> Shr<Measurement<DX, DO, MX, MO>> for Fallible<Transformation<DI, DX, MI, MX>>where
DI: 'static + Domain,
DX: 'static + Domain,
DO: 'static + Domain,
MI: 'static + Metric,
MX: 'static + Metric,
MO: 'static + Measure,
source§impl<DI, DX, DO, MI, MX, MO> Shr<Measurement<DX, DO, MX, MO>> for Transformation<DI, DX, MI, MX>where
DI: 'static + Domain,
DX: 'static + Domain,
DO: 'static + Domain,
MI: 'static + Metric,
MX: 'static + Metric,
MO: 'static + Measure,
impl<DI, DX, DO, MI, MX, MO> Shr<Measurement<DX, DO, MX, MO>> for Transformation<DI, DX, MI, MX>where
DI: 'static + Domain,
DX: 'static + Domain,
DO: 'static + Domain,
MI: 'static + Metric,
MX: 'static + Metric,
MO: 'static + Measure,
Auto Trait Implementations§
impl<DI, DO, MI, MO> !RefUnwindSafe for Measurement<DI, DO, MI, MO>
impl<DI, DO, MI, MO> !Send for Measurement<DI, DO, MI, MO>
impl<DI, DO, MI, MO> !Sync for Measurement<DI, DO, MI, MO>
impl<DI, DO, MI, MO> Unpin for Measurement<DI, DO, MI, MO>where
DI: Unpin,
DO: Unpin,
MI: Unpin,
MO: Unpin,
impl<DI, DO, MI, MO> !UnwindSafe for Measurement<DI, DO, MI, MO>
Blanket Implementations§
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§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 more§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).§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.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.