pub struct FiniteDomain<T: Clone + PartialEq + Debug> { /* private fields */ }Expand description
A generic finite domain holding arbitrary values.
Uses Vec<T> internally. Operations are O(n) where n is the domain size.
Suitable for domains with non-integer values or when bitset representation
is not appropriate.
Implementations§
Trait Implementations§
Source§impl<T: Clone + Clone + PartialEq + Debug> Clone for FiniteDomain<T>
impl<T: Clone + Clone + PartialEq + Debug> Clone for FiniteDomain<T>
Source§fn clone(&self) -> FiniteDomain<T>
fn clone(&self) -> FiniteDomain<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Clone + PartialEq + Debug> Domain for FiniteDomain<T>
impl<T: Clone + PartialEq + Debug> Domain for FiniteDomain<T>
Source§fn remove(&mut self, val: &T) -> bool
fn remove(&mut self, val: &T) -> bool
Remove a value from the domain. Returns
true if the value was present.Source§fn iter(&self) -> impl Iterator<Item = T>
fn iter(&self) -> impl Iterator<Item = T>
Iterate over current values without allocating. Read more
Source§fn is_singleton(&self) -> bool
fn is_singleton(&self) -> bool
Whether the domain contains exactly one value.
Source§fn singleton_value(&self) -> Option<Self::Value>
fn singleton_value(&self) -> Option<Self::Value>
If the domain is a singleton, return its sole value.
Source§impl<T: PartialEq + Clone + PartialEq + Debug> PartialEq for FiniteDomain<T>
impl<T: PartialEq + Clone + PartialEq + Debug> PartialEq for FiniteDomain<T>
Source§fn eq(&self, other: &FiniteDomain<T>) -> bool
fn eq(&self, other: &FiniteDomain<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<T: Clone + PartialEq + Debug> StructuralPartialEq for FiniteDomain<T>
Auto Trait Implementations§
impl<T> Freeze for FiniteDomain<T>
impl<T> RefUnwindSafe for FiniteDomain<T>where
T: RefUnwindSafe,
impl<T> Send for FiniteDomain<T>where
T: Send,
impl<T> Sync for FiniteDomain<T>where
T: Sync,
impl<T> Unpin for FiniteDomain<T>where
T: Unpin,
impl<T> UnsafeUnpin for FiniteDomain<T>
impl<T> UnwindSafe for FiniteDomain<T>where
T: UnwindSafe,
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