[−][src]Struct ddo::core::common::VarSet
This type denotes a set of variable. It encodes them compactly as a fixed
size bitset. A VarSet
can be efficiently iterated upon.
Methods
impl VarSet
[src]
This is the implementation of the core features of a VarSet
(set of variables).
Example
let vs = VarSet::all(3); assert!(vs.contains(Variable(0))); assert!(vs.contains(Variable(1))); assert!(vs.contains(Variable(2)));
pub fn all(n: usize) -> VarSet
[src]
Returns a VarSet
where all the possible n
variables are present.
pub fn empty() -> VarSet
[src]
Creates an empty var set
pub fn add(&mut self, v: Variable)
[src]
Adds the given variable v
to the set if it is not already present.
pub fn remove(&mut self, v: Variable)
[src]
Removes the variable v
from the set if it was present.
pub fn contains(&self, v: Variable) -> bool
[src]
Returns true iff the set contains the variable v
.
pub fn len(&self) -> usize
[src]
Returns the count of variables that are present in the set.
pub fn is_empty(&self) -> bool
[src]
Returns true iff no variables are preset in the set.
pub fn iter(&self) -> VarSetIter
[src]
Returns an iterator in this set of variables.
Trait Implementations
impl Clone for VarSet
[src]
impl Debug for VarSet
[src]
impl Eq for VarSet
[src]
impl<'a> From<&'a VarSet> for Domain<'a>
[src]
Implements the conversion from a varset to a domain
impl Hash for VarSet
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for VarSet
[src]
Any two sets of variables can be compared with a lexicographical ordering
on the id of the variables present in the sets. Hence, VarSet
implements
the standard traits Ord
and PartialOrd
.
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<VarSet> for VarSet
[src]
impl PartialOrd<VarSet> for VarSet
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for VarSet
[src]
impl StructuralPartialEq for VarSet
[src]
Auto Trait Implementations
impl RefUnwindSafe for VarSet
impl Send for VarSet
impl Sync for VarSet
impl Unpin for VarSet
impl UnwindSafe for VarSet
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,