Struct opendp::domains::OptionDomain
source · pub struct OptionDomain<D: Domain> {
pub element_domain: D,
}
Expand description
A domain that represents nullity via the Option type.
§Proof Definition
OptionDomain(element_domain, D)
is the domain of all values of element_domain
(of type D
, a domain)
wrapped in Some
, as well as None
.
§Notes
This is used to represent nullity for data types like integers or strings, for which all values they take on are non-null.
§Example
use opendp::domains::{OptionDomain, AtomDomain};
let null_domain = OptionDomain::new(AtomDomain::default());
use opendp::core::Domain;
assert!(null_domain.member(&Some(1))?);
assert!(null_domain.member(&None)?);
Fields§
§element_domain: D
Implementations§
Trait Implementations§
source§impl<D: Clone + Domain> Clone for OptionDomain<D>
impl<D: Clone + Domain> Clone for OptionDomain<D>
source§fn clone(&self) -> OptionDomain<D>
fn clone(&self) -> OptionDomain<D>
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<D: Domain> Debug for OptionDomain<D>
impl<D: Domain> Debug for OptionDomain<D>
source§impl<D: Domain> Domain for OptionDomain<D>
impl<D: Domain> Domain for OptionDomain<D>
source§impl<T: CheckAtom + Clone> DropNullDomain for OptionDomain<AtomDomain<T>>
impl<T: CheckAtom + Clone> DropNullDomain for OptionDomain<AtomDomain<T>>
how to standardize into an option, when null represented as Option<T>
source§impl<T: CheckAtom> ImputeConstantDomain for OptionDomain<AtomDomain<T>>
impl<T: CheckAtom> ImputeConstantDomain for OptionDomain<AtomDomain<T>>
source§impl<D: PartialEq + Domain> PartialEq for OptionDomain<D>
impl<D: PartialEq + Domain> PartialEq for OptionDomain<D>
source§fn eq(&self, other: &OptionDomain<D>) -> bool
fn eq(&self, other: &OptionDomain<D>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<D: Domain> StructuralPartialEq for OptionDomain<D>
Auto Trait Implementations§
impl<D> Freeze for OptionDomain<D>
impl<D> RefUnwindSafe for OptionDomain<D>
impl<D> Send for OptionDomain<D>
impl<D> Sync for OptionDomain<D>
impl<D> Unpin for OptionDomain<D>
impl<D> UnwindSafe for OptionDomain<D>
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
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§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 moresource§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).source§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.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.