Trait opendp::core::Domain

source ·
pub trait Domain: Clone + PartialEq + Debug {
    type Carrier;

    // Required method
    fn member(&self, val: &Self::Carrier) -> Fallible<bool>;
}
Expand description

A set which constrains the input or output of a Function.

Domains capture the notion of what values are allowed to be the input or output of a Function.

Proof Definition

A type Self implements Domain iff it can represent a set of values that make up a domain.

Required Associated Types§

source

type Carrier

The underlying type that the Domain specializes. This is the type of a member of a domain, where a domain is any data type that implements this trait.

On any type D for which the Domain trait is implemented, the syntax D::Carrier refers to this associated type. For example, consider D to be AllDomain<T>, the domain of all non-null values of type T. The implementation of this trait for AllDomain<T> designates that type Carrier = T. Thus AllDomain<T>::Carrier is T.

Proof Definition

Self::Carrier can represent all values in the set described by Self.

Required Methods§

source

fn member(&self, val: &Self::Carrier) -> Fallible<bool>

Predicate to test an element for membership in the domain. Not all possible values of ::Carrier are a member of the domain.

Proof Definition

For all settings of the input parameters, returns Err(e) if the member check failed, or Ok(out), where out is true if val is a member of self, otherwise false.

Notes

It generally suffices to treat Err(e) as if val is not a member of the domain. It can be useful, however, to see richer debug information via e in the event of a failure.

Implementors§

source§

impl Domain for PolyDomain

§

type Carrier = Box<dyn Any + 'static, Global>

source§

impl Domain for AnyDomain

source§

impl<D0: Domain, D1: Domain> Domain for PairDomain<D0, D1>

§

type Carrier = (<D0 as Domain>::Carrier, <D1 as Domain>::Carrier)

source§

impl<D: Domain> Domain for BoxDomain<D>

§

type Carrier = Box<<D as Domain>::Carrier, Global>

source§

impl<D: Domain> Domain for DataDomain<D>where
D::Carrier: 'static + Any,

§

type Carrier = Box<dyn Any + 'static, Global>

source§

impl<D: Domain> Domain for InherentNullDomain<D>where
D::Carrier: InherentNull,

§

type Carrier = <D as Domain>::Carrier

source§

impl<D: Domain> Domain for OptionNullDomain<D>

§

type Carrier = Option<<D as Domain>::Carrier>

source§

impl<D: Domain> Domain for SizedDomain<D>where
D::Carrier: CollectionSize,

§

type Carrier = <D as Domain>::Carrier

source§

impl<D: Domain> Domain for VectorDomain<D>

§

type Carrier = Vec<<D as Domain>::Carrier, Global>

source§

impl<DK: Domain, DV: Domain> Domain for MapDomain<DK, DV>where
DK::Carrier: Eq + Hash,

source§

impl<T: CheckNull> Domain for AllDomain<T>

§

type Carrier = T

source§

impl<T: Clone + TotalOrd> Domain for BoundedDomain<T>

§

type Carrier = T