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 and output_domain are valid domains
  • input_metric is a valid metric
  • output_measure is a valid measure

It is, however, left to constructor functions to prove that:

  • input_metric is compatible with input_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<Q: 'static, A: 'static> Measurement<AnyDomain, Queryable<Q, A>, AnyMetric, AnyMeasure>

source§

impl<DI: Domain, TO, MI: Metric, MO: Measure> Measurement<DI, TO, MI, MO>where (DI, MI): MetricSpace,

source

pub fn new( input_domain: DI, function: Function<DI::Carrier, TO>, input_metric: MI, output_measure: MO, privacy_map: PrivacyMap<MI, MO> ) -> Fallible<Self>

source

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: Domain, TO, MI: Metric, MO: Measure> Measurement<DI, TO, MI, MO>

source

pub fn invoke(&self, arg: &DI::Carrier) -> Fallible<TO>

source

pub fn map(&self, d_in: &MI::Distance) -> Fallible<MO::Distance>

source

pub fn check(&self, d_in: &MI::Distance, d_out: &MO::Distance) -> Fallible<bool>where MO::Distance: TotalOrd,

source§

impl<DI, TO, MI, MO> Measurement<DI, TO, MI, MO>where DI: 'static + Domain, DI::Carrier: 'static, TO: 'static, MI: 'static + Metric, MO: 'static + Measure, (DI, MI): MetricSpace,

source

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,

source

pub fn invoke_wrap( &self, arg: &DI::Carrier, wrapper: impl Fn(PolyQueryable) -> Fallible<PolyQueryable> + 'static ) -> Fallible<TO>

Trait Implementations§

source§

impl<DI: Domain, TO, MI: Metric, MO: Measure> Clone for Measurement<DI, TO, MI, MO>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<DI: 'static + Domain, TO: 'static, MI: 'static + Metric, MO: 'static + Measure> IntoAnyMeasurementExt for Measurement<DI, TO, MI, MO>where DI::Carrier: 'static, MI::Distance: 'static, MO::Distance: 'static, (DI, MI): MetricSpace,

Turn a Measurement into an AnyMeasurement.

source§

impl<TO: 'static> IntoAnyMeasurementOutExt for Measurement<AnyDomain, TO, AnyMetric, AnyMeasure>

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,

§

type Output = Result<Measurement<DI, TO, MI, MO>, Error>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: Function<TX, TO>) -> Self::Output

Performs the >> operation. Read more
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,

§

type Output = Result<Measurement<DI, TO, MI, MO>, Error>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: Measurement<DX, TO, MX, MO>) -> Self::Output

Performs the >> operation. Read more
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,

§

type Output = PartialMeasurement<DI, TO, MI, MO>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: Measurement<DX, TO, MX, MO>) -> Self::Output

Performs the >> operation. Read more
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,

§

type Output = Result<Measurement<DI, TO, MI, MO>, Error>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: Measurement<DX, TO, MX, MO>) -> Self::Output

Performs the >> operation. Read more
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,

§

type Output = Result<Measurement<DI, <DO as Domain>::Carrier, MI, MO>, Error>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: Transformation<DX, DO, MTI, MTO>) -> Self::Output

Performs the >> operation. Read more

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>where DI: Unpin, MI: Unpin, MO: Unpin,

§

impl<DI, TO, MI, MO> !UnwindSafe for Measurement<DI, TO, MI, MO>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dstwhere T: Cast<Dst>,

Casts the value.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dstwhere Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

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>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> OverflowingAs for T

source§

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>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

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

Checks if self is actually part of its subset T (and can be converted to it).
§

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

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.