[][src]Struct ddo::core::common::VarSet

pub struct VarSet(pub BitSet);

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]

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.

impl PartialEq<VarSet> for VarSet[src]

impl PartialOrd<VarSet> for VarSet[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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.