pub struct BitsetDomain { /* private fields */ }Expand description
A domain backed by a 128-bit bitmask.
Values must be non-negative integers in the range 0..128.
All operations are O(1) via bitwise arithmetic and popcount.
Isomorphic to the Python BitsetDomain.
Implementations§
Source§impl BitsetDomain
impl BitsetDomain
Sourcepub fn new(values: impl IntoIterator<Item = u32>) -> Self
pub fn new(values: impl IntoIterator<Item = u32>) -> Self
Create a new bitset domain from an iterator of values.
Sourcepub fn union_with(&mut self, other: &Self)
pub fn union_with(&mut self, other: &Self)
Union with another bitset domain.
Sourcepub fn intersect_with(&mut self, other: &Self)
pub fn intersect_with(&mut self, other: &Self)
Intersection with another bitset domain.
Sourcepub fn difference_with(&mut self, other: &Self)
pub fn difference_with(&mut self, other: &Self)
Difference: remove all values present in other.
Sourcepub fn iter(&self) -> BitsetIter ⓘ
pub fn iter(&self) -> BitsetIter ⓘ
Iterate over set bits, yielding each value.
Trait Implementations§
Source§impl Clone for BitsetDomain
impl Clone for BitsetDomain
Source§fn clone(&self) -> BitsetDomain
fn clone(&self) -> BitsetDomain
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 Debug for BitsetDomain
impl Debug for BitsetDomain
Source§impl Domain for BitsetDomain
impl Domain for BitsetDomain
Source§fn remove(&mut self, val: &u32) -> bool
fn remove(&mut self, val: &u32) -> bool
Remove a value from the domain. Returns
true if the value was present.Source§fn iter(&self) -> impl Iterator<Item = u32>
fn iter(&self) -> impl Iterator<Item = u32>
Iterate over current values without allocating. Read more
Source§fn singleton_value(&self) -> Option<u32>
fn singleton_value(&self) -> Option<u32>
If the domain is a singleton, return its sole value.
Source§fn is_singleton(&self) -> bool
fn is_singleton(&self) -> bool
Whether the domain contains exactly one value.
Source§impl PartialEq for BitsetDomain
impl PartialEq for BitsetDomain
Source§fn eq(&self, other: &BitsetDomain) -> bool
fn eq(&self, other: &BitsetDomain) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for BitsetDomain
Auto Trait Implementations§
impl Freeze for BitsetDomain
impl RefUnwindSafe for BitsetDomain
impl Send for BitsetDomain
impl Sync for BitsetDomain
impl Unpin for BitsetDomain
impl UnsafeUnpin for BitsetDomain
impl UnwindSafe for BitsetDomain
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