Skip to main content

BitSet

Struct BitSet 

Source
pub struct BitSet<const W: usize>(/* private fields */);
Expand description

A domain of 64 * W values, for variables with more values than a u128 holds.

§Examples

use constraint_search::{BitSet, Domain};

let mut slots = BitSet::<4>::range(200);
slots.remove(150);
assert_eq!(slots.len(), 199);
assert!(!slots.contains(150));

Trait Implementations§

Source§

impl<const W: usize> Clone for BitSet<W>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const W: usize> Copy for BitSet<W>

Source§

impl<const W: usize> Debug for BitSet<W>

Source§

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

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

impl<const W: usize> Domain for BitSet<W>

Source§

const CAPACITY: u32

The number of values the domain can hold; every value is below it.
Source§

fn empty() -> Self

The domain without any value.
Source§

fn range(n: u32) -> Self

The domain of the values 0..n. Read more
Source§

fn singleton(value: u32) -> Self

The domain holding only value. Read more
Source§

fn contains(&self, value: u32) -> bool

Returns true if value is in the domain. Values at or above the capacity never are.
Source§

fn insert(&mut self, value: u32)

Puts value into the domain. Read more
Source§

fn remove(&mut self, value: u32)

Takes value out of the domain. Removing an absent value does nothing.
Source§

fn len(&self) -> u32

The number of values in the domain.
Source§

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

The values in self, in other or in both.
Source§

fn intersection(self, other: Self) -> Self

The values in both self and other.
Source§

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

The values in self but not in other.
Source§

fn first(&self) -> Option<u32>

The smallest value, or None for the empty domain.
Source§

fn is_empty(&self) -> bool

Returns true if the domain holds no value.
Source§

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

Returns true if every value of self is also in other.
Source§

fn value(&self) -> Option<u32>

The only value, if the domain holds exactly one.
Source§

fn values(&self) -> Values<Self> ⓘ

The values in ascending order.
Source§

impl<const W: usize> Eq for BitSet<W>

Source§

impl<const W: usize> Hash for BitSet<W>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<const W: usize> PartialEq for BitSet<W>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<const W: usize> StructuralPartialEq for BitSet<W>

Auto Trait Implementations§

§

impl<const W: usize> Forget for BitSet<W>

§

impl<const W: usize> Freeze for BitSet<W>
where [u64; W]: Freeze,

§

impl<const W: usize> Move for BitSet<W>

§

impl<const W: usize> RefUnwindSafe for BitSet<W>
where [u64; W]: RefUnwindSafe,

§

impl<const W: usize> Send for BitSet<W>
where [u64; W]: Send,

§

impl<const W: usize> Sync for BitSet<W>
where [u64; W]: Sync,

§

impl<const W: usize> Unpin for BitSet<W>
where [u64; W]: Unpin,

§

impl<const W: usize> UnsafeUnpin for BitSet<W>
where [u64; W]: UnsafeUnpin,

§

impl<const W: usize> UnwindSafe for BitSet<W>
where [u64; W]: UnwindSafe,

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<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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.