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
impl VariableSet
Sourcepub fn new_singleton(index: usize) -> Self
pub fn new_singleton(index: usize) -> Self
Create a new set with a single value from the domain set.
Sourcepub fn set_value(&mut self, index: usize, value: bool)
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.
Sourcepub fn find_first_set(&self) -> Option<usize>
pub fn find_first_set(&self) -> Option<usize>
Finds the index of the first set bit.
If no bits are set, returns None.
Sourcepub fn find_last_set(&self) -> Option<usize>
pub fn find_last_set(&self) -> Option<usize>
Finds the index of the last set bit.
If no bits are set, returns None.
Sourcepub fn drain_next_ascending(&mut self) -> Option<usize>
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.
Sourcepub fn drain_next_descending(&mut self) -> Option<usize>
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.
Sourcepub fn is_superset_of(&self, other: &Self) -> bool
pub fn is_superset_of(&self, other: &Self) -> bool
Checks if the set is a superset of the passed set.
Sourcepub fn is_subset_of(&self, other: &Self) -> bool
pub fn is_subset_of(&self, other: &Self) -> bool
Checks if the set is a subset of the passed set.
Sourcepub fn intersect(self, other: Self) -> Self
pub fn intersect(self, other: Self) -> Self
Compute the set intersection between the two given sets.
Sourcepub fn subtract(self, other: Self) -> Self
pub fn subtract(self, other: Self) -> Self
Compute the set subtraction between the two given sets.
Sourcepub fn difference(self, other: Self) -> Self
pub fn difference(self, other: Self) -> Self
Compute the set difference between the two given sets.
Sourcepub fn complement(self) -> Self
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.
Sourcepub fn keep_single(&mut self, index: usize)
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.
Sourcepub fn keep_range(&mut self, from_index: usize, to_index: usize)
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
impl Clone for VariableSet
Source§fn clone(&self) -> VariableSet
fn clone(&self) -> VariableSet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VariableSet
impl Debug for VariableSet
Source§impl IntoIterator for VariableSet
impl IntoIterator for VariableSet
Source§impl PartialEq for VariableSet
impl PartialEq for VariableSet
impl Copy for VariableSet
impl Eq for VariableSet
impl StructuralPartialEq for VariableSet
Auto Trait Implementations§
impl Freeze for VariableSet
impl RefUnwindSafe for VariableSet
impl Send for VariableSet
impl Sync for VariableSet
impl Unpin for VariableSet
impl UnsafeUnpin for VariableSet
impl UnwindSafe for VariableSet
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
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
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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