Struct opendp::core::Measurement
source · pub struct Measurement<DI: Domain, TO, MI: Metric, MO: Measure> {
pub input_domain: DI,
pub function: Function<DI::Carrier, TO>,
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
§function: Function<DI::Carrier, TO>
§input_metric: MI
§output_measure: MO
§privacy_map: PrivacyMap<MI, MO>
Implementations§
source§impl<DI: Domain, Q: 'static, A: 'static, MI: Metric, MO: Measure> Measurement<DI, Queryable<Q, A>, MI, MO>
impl<DI: Domain, Q: 'static, A: 'static, MI: Metric, MO: Measure> Measurement<DI, Queryable<Q, A>, MI, MO>
pub fn into_any_Q(self) -> Measurement<DI, Queryable<AnyObject, A>, MI, MO>
source§impl<DI: Domain, Q: 'static, A: 'static, MI: Metric, MO: Measure> Measurement<DI, Queryable<Q, A>, MI, MO>
impl<DI: Domain, Q: 'static, A: 'static, MI: Metric, MO: Measure> Measurement<DI, Queryable<Q, A>, MI, MO>
pub fn into_any_A(self) -> Measurement<DI, Queryable<Q, AnyObject>, MI, MO>
source§impl<DI: 'static + Domain, TO: 'static, MI: 'static + Metric, MO: 'static + Measure> Measurement<DI, TO, MI, MO>
impl<DI: 'static + Domain, TO: 'static, MI: 'static + Metric, MO: 'static + Measure> Measurement<DI, TO, MI, MO>
Turn a Measurement into an AnyMeasurement.
pub fn into_any(self) -> AnyMeasurement
source§impl<TO: 'static> Measurement<AnyDomain, TO, AnyMetric, AnyMeasure>
impl<TO: 'static> Measurement<AnyDomain, TO, AnyMetric, AnyMeasure>
pub fn into_any_out(self) -> AnyMeasurement
source§impl<QI: 'static + TotalOrd + Clone + Send + Sync, QO: 'static + TotalOrd + Clone + Send + Sync> Measurement<AnyDomain, Queryable<Measurement<AnyDomain, AnyObject, TypedMetric<QI>, TypedMeasure<QO>>, AnyObject>, AnyMetric, AnyMeasure>
impl<QI: 'static + TotalOrd + Clone + Send + Sync, QO: 'static + TotalOrd + Clone + Send + Sync> Measurement<AnyDomain, Queryable<Measurement<AnyDomain, AnyObject, TypedMetric<QI>, TypedMeasure<QO>>, AnyObject>, AnyMetric, AnyMeasure>
pub fn into_any_queryable_map( self ) -> Fallible<Measurement<AnyDomain, Queryable<AnyMeasurement, AnyObject>, AnyMetric, AnyMeasure>>
source§impl<DI: Domain, TO, MI: Metric, MO: Measure> Measurement<DI, TO, MI, MO>where
(DI, MI): MetricSpace,
impl<DI: Domain, TO, MI: Metric, MO: Measure> Measurement<DI, TO, MI, MO>where
(DI, MI): MetricSpace,
pub fn new( input_domain: DI, function: Function<DI::Carrier, TO>, input_metric: MI, output_measure: MO, privacy_map: PrivacyMap<MI, MO> ) -> Fallible<Self>
pub(crate) fn with_map<MI2: Metric, MO2: Measure>(
&self,
input_metric: MI2,
output_metric: MO2,
privacy_map: PrivacyMap<MI2, MO2>
) -> Fallible<Measurement<DI, TO, MI2, MO2>>where
(DI, MI2): MetricSpace,
source§impl<DI, TO, MI, MO> Measurement<DI, TO, MI, MO>
impl<DI, TO, MI, MO> Measurement<DI, TO, MI, MO>
sourcepub fn into_poly(self) -> Measurement<DI, Box<dyn Any>, MI, MO>
pub fn into_poly(self) -> Measurement<DI, Box<dyn Any>, MI, MO>
Converts this Measurement into one with polymorphic output. This is useful for composition of heterogeneous Measurements.
source§impl<DI: Domain, TO, MI: Metric, MO: Measure> Measurement<DI, TO, MI, MO>where
(DI, MI): MetricSpace,
impl<DI: Domain, TO, MI: Metric, MO: Measure> Measurement<DI, TO, MI, MO>where
(DI, MI): MetricSpace,
pub fn invoke_wrap( &self, arg: &DI::Carrier, wrapper: impl Fn(PolyQueryable) -> Fallible<PolyQueryable> + 'static ) -> Fallible<TO>
Trait Implementations§
source§impl<DI, TX, TO, MI, MO> Shr<Function<TX, TO>> for Measurement<DI, TX, MI, MO>where
DI: 'static + Domain,
TX: 'static,
TO: 'static,
MI: 'static + Metric,
MO: 'static + Measure,
(DI, MI): MetricSpace,
impl<DI, TX, TO, MI, MO> Shr<Function<TX, TO>> for Measurement<DI, TX, MI, MO>where
DI: 'static + Domain,
TX: 'static,
TO: 'static,
MI: 'static + Metric,
MO: 'static + Measure,
(DI, MI): MetricSpace,
source§impl<DI, DX, TO, MI, MX, MO> Shr<Measurement<DX, TO, MX, MO>> for PartialTransformation<DI, DX, MI, MX>where
DI: 'static + Domain,
DX: 'static + Domain,
TO: 'static,
MI: 'static + Metric,
MX: 'static + Metric,
MO: 'static + Measure,
(DI, MI): MetricSpace,
(DX, MX): MetricSpace,
impl<DI, DX, TO, MI, MX, MO> Shr<Measurement<DX, TO, MX, MO>> for PartialTransformation<DI, DX, MI, MX>where
DI: 'static + Domain,
DX: 'static + Domain,
TO: 'static,
MI: 'static + Metric,
MX: 'static + Metric,
MO: 'static + Measure,
(DI, MI): MetricSpace,
(DX, MX): MetricSpace,
§type Output = PartialMeasurement<DI, TO, MI, MO>
type Output = PartialMeasurement<DI, TO, MI, MO>
The resulting type after applying the
>>
operator.source§impl<DI, DX, TO, MI, MX, MO> Shr<Measurement<DX, TO, MX, MO>> for Fallible<Transformation<DI, DX, MI, MX>>where
DI: 'static + Domain,
DX: 'static + Domain,
TO: 'static,
MI: 'static + Metric,
MX: 'static + Metric,
MO: 'static + Measure,
(DI, MI): MetricSpace,
(DX, MX): MetricSpace,
impl<DI, DX, TO, MI, MX, MO> Shr<Measurement<DX, TO, MX, MO>> for Fallible<Transformation<DI, DX, MI, MX>>where
DI: 'static + Domain,
DX: 'static + Domain,
TO: 'static,
MI: 'static + Metric,
MX: 'static + Metric,
MO: 'static + Measure,
(DI, MI): MetricSpace,
(DX, MX): MetricSpace,
source§impl<DI, DX, TO, MI, MX, MO> Shr<Measurement<DX, TO, MX, MO>> for Transformation<DI, DX, MI, MX>where
DI: 'static + Domain,
DX: 'static + Domain,
TO: 'static,
MI: 'static + Metric,
MX: 'static + Metric,
MO: 'static + Measure,
(DI, MI): MetricSpace,
(DX, MX): MetricSpace,
impl<DI, DX, TO, MI, MX, MO> Shr<Measurement<DX, TO, MX, MO>> for Transformation<DI, DX, MI, MX>where
DI: 'static + Domain,
DX: 'static + Domain,
TO: 'static,
MI: 'static + Metric,
MX: 'static + Metric,
MO: 'static + Measure,
(DI, MI): MetricSpace,
(DX, MX): MetricSpace,
source§impl<DI, DX, DO, MI, MO, MTI, MTO> Shr<Transformation<DX, DO, MTI, MTO>> for Measurement<DI, DX::Carrier, MI, MO>where
DI: 'static + Domain,
DX: 'static + Domain,
DO: 'static + Domain,
MI: 'static + Metric,
MO: 'static + Measure,
MTI: 'static + Metric,
MTO: 'static + Metric,
(DI, MI): MetricSpace,
(DX, MTI): MetricSpace,
(DO, MTO): MetricSpace,
impl<DI, DX, DO, MI, MO, MTI, MTO> Shr<Transformation<DX, DO, MTI, MTO>> for Measurement<DI, DX::Carrier, MI, MO>where
DI: 'static + Domain,
DX: 'static + Domain,
DO: 'static + Domain,
MI: 'static + Metric,
MO: 'static + Measure,
MTI: 'static + Metric,
MTO: 'static + Metric,
(DI, MI): MetricSpace,
(DX, MTI): MetricSpace,
(DO, MTO): MetricSpace,
Auto Trait Implementations§
impl<DI, TO, MI, MO> !RefUnwindSafe for Measurement<DI, TO, MI, MO>
impl<DI, TO, MI, MO> Send for Measurement<DI, TO, MI, MO>
impl<DI, TO, MI, MO> Sync for Measurement<DI, TO, MI, MO>
impl<DI, TO, MI, MO> Unpin for Measurement<DI, TO, MI, MO>
impl<DI, TO, MI, MO> !UnwindSafe for Measurement<DI, TO, 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
§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.