pub enum IntegerDomain {
Range {
min: i64,
max: i64,
},
Discrete {
values: BTreeSet<i64>,
},
}Expand description
Integer domain: either an inclusive numeric range or a finite discrete set.
Variants§
Implementations§
Source§impl IntegerDomain
impl IntegerDomain
Sourcepub fn range(min: i64, max: i64) -> Result<Self>
pub fn range(min: i64, max: i64) -> Result<Self>
Construct an inclusive range. Rejects min > max.
Sourcepub fn discrete(values: BTreeSet<i64>) -> Result<Self>
pub fn discrete(values: BTreeSet<i64>) -> Result<Self>
Construct a discrete domain. Rejects empty sets.
Sourcepub fn contains_native(&self, value: i64) -> bool
pub fn contains_native(&self, value: i64) -> bool
Membership test on the native payload.
Sourcepub fn cardinality(&self) -> Cardinality
pub fn cardinality(&self) -> Cardinality
Count of distinct values. Saturates at u64::MAX if a range’s
width exceeds u64.
Sourcepub fn boundaries_native(&self) -> Vec<i64>
pub fn boundaries_native(&self) -> Vec<i64>
Boundary values (at most two).
Sourcepub fn sample_native<R: Rng + ?Sized>(&self, rng: &mut R) -> i64
pub fn sample_native<R: Rng + ?Sized>(&self, rng: &mut R) -> i64
Uniformly sample a value using the given RNG.
Sourcepub fn iter_native<'a>(&'a self) -> Box<dyn Iterator<Item = i64> + 'a>
pub fn iter_native<'a>(&'a self) -> Box<dyn Iterator<Item = i64> + 'a>
Iterator over every value in the domain.
Trait Implementations§
Source§impl Clone for IntegerDomain
impl Clone for IntegerDomain
Source§fn clone(&self) -> IntegerDomain
fn clone(&self) -> IntegerDomain
Returns a duplicate 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 Debug for IntegerDomain
impl Debug for IntegerDomain
Source§impl<'de> Deserialize<'de> for IntegerDomain
impl<'de> Deserialize<'de> for IntegerDomain
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for IntegerDomain
impl Hash for IntegerDomain
Source§impl PartialEq for IntegerDomain
impl PartialEq for IntegerDomain
Source§impl Serialize for IntegerDomain
impl Serialize for IntegerDomain
impl Eq for IntegerDomain
impl StructuralPartialEq for IntegerDomain
Auto Trait Implementations§
impl Freeze for IntegerDomain
impl RefUnwindSafe for IntegerDomain
impl Send for IntegerDomain
impl Sync for IntegerDomain
impl Unpin for IntegerDomain
impl UnsafeUnpin for IntegerDomain
impl UnwindSafe for IntegerDomain
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.