Struct opendp::core::Transformation

source ·
pub struct Transformation<DI: Domain, DO: Domain, MI: Metric, MO: Metric> {
    pub input_domain: DI,
    pub output_domain: DO,
    pub function: Function<DI, DO>,
    pub input_metric: MI,
    pub output_metric: MO,
    pub stability_map: StabilityMap<MI, MO>,
}
Expand description

A data transformation with certain stability characteristics.

The trait bounds provided by the Rust type system guarantee that:

  • input_domain and output_domain are valid domains
  • input_metric and output_metric are valid metrics

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

  • metrics are compatible with domains
  • function is a mapping from the input domain to the output domain
  • stability_map is a mapping from the input metric to the output metric

Fields§

§input_domain: DI§output_domain: DO§function: Function<DI, DO>§input_metric: MI§output_metric: MO§stability_map: StabilityMap<MI, MO>

Implementations§

source§

impl<DI: Domain, DO: Domain, MI: Metric, MO: Metric> Transformation<DI, DO, MI, MO>

source

pub fn new(
input_domain: DI,
output_domain: DO,
function: Function<DI, DO>,
input_metric: MI,
output_metric: MO,
stability_map: StabilityMap<MI, MO>
) -> Self

source

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

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, DO, MI, MO> Transformation<DI, DO, MI, MO>where
DI: 'static + Domain,
DI::Carrier: 'static,
DO: 'static + Domain,
DO::Carrier: 'static,
MI: 'static + Metric,
MO: 'static + Metric,

source

pub fn into_poly(self) -> Transformation<DI, PolyDomain, MI, MO>

Converts this Transformation into one with polymorphic output. It’s not clear if we’ll need this, but it’s provided for symmetry with Measurement.

Trait Implementations§

source§

impl<DI: Clone + Domain, DO: Clone + Domain, MI: Clone + Metric, MO: Clone + Metric> Clone for Transformation<DI, DO, MI, MO>

source§

fn clone(&self) -> Transformation<DI, DO, MI, MO>

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, DO: 'static + Domain, MI: 'static + Metric, MO: 'static + Metric> IntoAnyTransformationExt for Transformation<DI, DO, MI, MO>where
DI::Carrier: 'static,
DO::Carrier: 'static,
MI::Distance: 'static,
MO::Distance: 'static,

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,

§

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

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

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

Performs the >> operation. Read more
source§

impl<DI, DX, DO, MMI, MMO, MTI, MTO> Shr<Transformation<DX, DO, MTI, MTO>> for Fallible<Measurement<DI, DX, MMI, MMO>>where
DI: 'static + Domain,
DX: 'static + Domain,
DO: 'static + Domain,
MMI: 'static + Metric,
MMO: 'static + Measure,
MTI: 'static + Metric,
MTO: 'static + Metric,

§

type Output = Result<Measurement<DI, DO, MMI, MMO>, 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
source§

impl<DI, DX, DO, MMI, MMO, MTI, MTO> Shr<Transformation<DX, DO, MTI, MTO>> for Measurement<DI, DX, MMI, MMO>where
DI: 'static + Domain,
DX: 'static + Domain,
DO: 'static + Domain,
MMI: 'static + Metric,
MMO: 'static + Measure,
MTI: 'static + Metric,
MTO: 'static + Metric,

§

type Output = Result<Measurement<DI, DO, MMI, MMO>, 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
source§

impl<DI, DX, DO, MI, MX, MO> Shr<Transformation<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 + Metric,

§

type Output = Result<Transformation<DI, DO, MI, MO>, Error>

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

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

Performs the >> operation. Read more
source§

impl<DI, DX, DO, MI, MX, MO> Shr<Transformation<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 + Metric,

§

type Output = Result<Transformation<DI, DO, MI, MO>, Error>

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

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

Performs the >> operation. Read more

Auto Trait Implementations§

§

impl<DI, DO, MI, MO> !RefUnwindSafe for Transformation<DI, DO, MI, MO>

§

impl<DI, DO, MI, MO> !Send for Transformation<DI, DO, MI, MO>

§

impl<DI, DO, MI, MO> !Sync for Transformation<DI, DO, MI, MO>

§

impl<DI, DO, MI, MO> Unpin for Transformation<DI, DO, MI, MO>where
DI: Unpin,
DO: Unpin,
MI: Unpin,
MO: Unpin,

§

impl<DI, DO, MI, MO> !UnwindSafe for Transformation<DI, DO, 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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · 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

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.
const: unstable · 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.
const: unstable · 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.