Skip to main content

VariableSet

Struct VariableSet 

Source
pub struct VariableSet { /* private fields */ }
Expand description

Re-export of VariableSet. A fixed size bitset for up to 128 variables. The set is represented as a 128-bit integer where each bit represents the presence of the corresponding element in the set.

Implementations§

Source§

impl VariableSet

Source

pub const fn new_empty() -> Self

Create a new empty set.

Source

pub const fn new_full() -> Self

Create a new set with every value of the domain set.

Source

pub fn new_singleton(index: usize) -> Self

Create a new set with a single value from the domain set.

Source

pub fn is_empty(&self) -> bool

Check if the set is empty.

Source

pub fn count(&self) -> usize

Count the number of elements in the set.

Source

pub fn set(&mut self, index: usize)

Set the given value in the set.

Source

pub fn unset(&mut self, index: usize)

Remove the given value from the set.

Source

pub fn set_value(&mut self, index: usize, value: bool)

Sets or removes the given element into or from the set depending on the passed value.

Source

pub fn set_all(&mut self)

Include every value in the domain in the set.

Source

pub fn unset_all(&mut self)

Remove all values from the set.

Source

pub fn is_set(&self, index: usize) -> bool

Check if the given value is in the set.

Source

pub fn find_first_set(&self) -> Option<usize>

Finds the index of the first set bit. If no bits are set, returns None.

Source

pub fn find_last_set(&self) -> Option<usize>

Finds the index of the last set bit. If no bits are set, returns None.

Source

pub fn drain_next_ascending(&mut self) -> Option<usize>

Returns the index of the next set bit in the bit set, in ascending order, while unseting it.

Source

pub fn drain_next_descending(&mut self) -> Option<usize>

Returns the index of the next set bit in the bit set, in descending order, while unseting it.

Source

pub fn is_superset_of(&self, other: &Self) -> bool

Checks if the set is a superset of the passed set.

Source

pub fn is_subset_of(&self, other: &Self) -> bool

Checks if the set is a subset of the passed set.

Source

pub fn intersect(self, other: Self) -> Self

Compute the set intersection between the two given sets.

Source

pub fn union(self, other: Self) -> Self

Compute the set union between the two given sets.

Source

pub fn subtract(self, other: Self) -> Self

Compute the set subtraction between the two given sets.

Source

pub fn difference(self, other: Self) -> Self

Compute the set difference between the two given sets.

Source

pub fn complement(self) -> Self

Compute a set complement, removing every element that was in the set and inserting every element from the domain that wasn’t in the set.

Source

pub fn keep_single(&mut self, index: usize)

Remove all elements from the set except the one passed. Equal to an intersection with a set containing only the passed element.

Source

pub fn keep_range(&mut self, from_index: usize, to_index: usize)

Similar to keep_single, except that only values in the specified range are kept. Both range ends are inclusive.

Trait Implementations§

Source§

impl Clone for VariableSet

Source§

fn clone(&self) -> VariableSet

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VariableSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl IntoIterator for VariableSet

Source§

type Item = usize

The type of the elements being iterated over.
Source§

type IntoIter = VariableSetIterator

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for VariableSet

Source§

fn eq(&self, other: &VariableSet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for VariableSet

Source§

impl Eq for VariableSet

Source§

impl StructuralPartialEq for VariableSet

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<I> Spread for I
where I: IntoIterator,

Source§

type Item = <I as IntoIterator>::Item

The type of each yielded value.
Source§

type Iter = I

The iterator type returned by spread.
Source§

fn spread(self) -> (<I as Spread>::Iter, TribleSet)

Decomposes the value into an iterator of items and extra facts to merge.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V