[][src]Struct open_vaf::data_structures::BitSet

pub struct BitSet<I: Idx + From<usize>> { /* fields omitted */ }

Implementations

impl<I: Idx + From<usize>> BitSet<I>[src]

pub fn new_empty(end_index: I) -> Self[src]

Create a new empty BitSet which can hold elements x < end_index

pub fn new_filled(end_index: I) -> Self[src]

Create a new empty BitSet which can hold elements x < end_index

pub fn with_capacity_and_blocks<Iter: IntoIterator<Item = u32>>(
    bits: I,
    blocks: Iter
) -> Self
[src]

Create a new BitSet with a specific number of bits, initialized from provided blocks.

If the blocks are not the exact size needed for the capacity they will be padded with zeros (if shorter) or truncated to the capacity (if longer).

pub fn grow(&mut self, len_idx: I)[src]

Grow capacity to bits, all new bits initialized to zero

pub fn len(&self) -> usize[src]

Return the length of the FixedBitSet in bits.

pub fn len_idx(&self) -> I[src]

Return the length of the FixedBitSet in bits.

pub fn max(&self) -> I[src]

Return the length of the FixedBitSet in bits.

pub fn contains(&self, bit: I) -> bool[src]

Return true if the bit is enabled in the FixedBitSet, false otherwise.

Note: bits outside the capacity are always disabled.

Note: Also available with index syntax: bitset[bit].

pub fn clear(&mut self)[src]

Clear all bits.

pub fn insert(&mut self, bit: I)[src]

Enable bit.

Panics if bit is out of bounds.

pub fn remove(&mut self, bit: I) -> bool[src]

Disable bit.

Panics if bit is out of bounds.

pub fn put(&mut self, bit: I) -> bool[src]

Enable bit, and return its previous value.

Panics if bit is out of bounds.

pub fn toggle(&mut self, bit: I)[src]

Toggle bit (inverting its state).

Panics if bit is out of bounds

pub fn set(&mut self, bit: I, enabled: bool)[src]

Panics if bit is out of bounds.

pub fn copy_bit(&mut self, from: I, to: I)[src]

Copies boolean value from specified bit to the specified bit.

Panics if to is out of bounds.

pub fn count_ones<T: IndexRange<I>>(&self, range: T) -> usize[src]

Count the number of set bits in the given bit range.

Use .. to count the whole content of the bitset.

Panics if the range extends past the end of the bitset.

pub fn set_range<T: IndexRange<I>>(&mut self, range: T, enabled: bool)[src]

Sets every bit in the given range to the given state (enabled)

Use .. to set the whole bitset.

Panics if the range extends past the end of the bitset.

pub fn insert_range<T: IndexRange<I>>(&mut self, range: T)[src]

Enables every bit in the given range.

Use .. to make the whole bitset ones.

Panics if the range extends past the end of the bitset.

pub fn enable_all(&mut self)[src]

Equivalent to insert_range(..) but significantly faster

pub fn toggle_range<T: IndexRange<I>>(&mut self, range: T)[src]

Toggles (inverts) every bit in the given range.

Use .. to toggle the whole bitset.

Panics if the range extends past the end of the bitset.

pub fn as_slice(&self) -> &[u32][src]

View the bitset as a slice of u32 blocks

pub fn as_mut_slice(&mut self) -> &mut [u32][src]

View the bitset as a mutable slice of u32 blocks. Writing past the bitlength in the last will cause contains to return potentially incorrect results for bits past the bitlength.

pub fn is_empty(&self) -> bool[src]

pub fn ones(&self) -> Ones<I>[src]

Iterates over all enabled bits.

Iterator element is the index of the 1 bit, type usize.

pub fn intersection<'a>(&'a self, other: &'a Self) -> Intersection<'a, I>[src]

Returns a lazy iterator over the intersection of two FixedBitSets

pub fn union<'a>(&'a self, other: &'a Self) -> Union<'a, I>[src]

Returns a lazy iterator over the union of two FixedBitSets.

pub fn difference<'a>(&'a self, other: &'a Self) -> Difference<'a, I>[src]

Returns a lazy iterator over the difference of two FixedBitSets. The difference of a and b is the elements of a which are not in b.

pub fn symmetric_difference<'a>(
    &'a self,
    other: &'a Self
) -> SymmetricDifference<'a, I>
[src]

Returns a lazy iterator over the symmetric difference of two FixedBitSets. The symmetric difference of a and b is the elements of one, but not both, sets.

pub fn union_with(&mut self, other: &Self)[src]

In-place union of two FixedBitSets.

On calling this method, self's capacity may be increased to match other's.

pub fn intersect_with(&mut self, other: &Self)[src]

In-place intersection of two FixedBitSets.

On calling this method, self's capacity will remain the same as before.

pub fn difference_with(&mut self, other: &Self)[src]

In-place difference of two FixedBitSets.

On calling this method, self's capacity will remain the same as before.

pub fn symmetric_difference_with(&mut self, other: &Self)[src]

In-place symmetric difference of two FixedBitSets.

On calling this method, self's capacity may be increased to match other's.

pub fn is_disjoint(&self, other: &Self) -> bool[src]

Returns true if self has no elements in common with other. This is equivalent to checking for an empty intersection.

pub fn is_subset(&self, other: &Self) -> bool[src]

Returns true if the set is a subset of another, i.e. other contains at least all the values in self.

pub fn is_superset(&self, other: &Self) -> bool[src]

Returns true if the set is a superset of another, i.e. self contains at least all the values in other.

Trait Implementations

impl<I: Idx + From<usize>> Binary for BitSet<I>[src]

impl<'a, I: Idx + From<usize>> BitAnd<&'a BitSet<I>> for &'a BitSet<I>[src]

type Output = BitSet<I>

The resulting type after applying the & operator.

impl<'a, I: Idx + From<usize>> BitAndAssign<BitSet<I>> for BitSet<I>[src]

impl<'a, I: Idx + From<usize>> BitOr<&'a BitSet<I>> for &'a BitSet<I>[src]

type Output = BitSet<I>

The resulting type after applying the | operator.

impl<'a, I: Idx + From<usize>> BitOrAssign<BitSet<I>> for BitSet<I>[src]

impl<'a, I: Idx + From<usize>> BitXor<&'a BitSet<I>> for &'a BitSet<I>[src]

type Output = BitSet<I>

The resulting type after applying the ^ operator.

impl<'a, I: Idx + From<usize>> BitXorAssign<BitSet<I>> for BitSet<I>[src]

impl<I: Idx + From<usize>> Clone for BitSet<I>[src]

impl<I: Debug + Idx + From<usize>> Debug for BitSet<I>[src]

impl<I: Default + Idx + From<usize>> Default for BitSet<I>[src]

impl<I: Idx + From<usize> + Display> Display for BitSet<I>[src]

impl<I: Eq + Idx + From<usize>> Eq for BitSet<I>[src]

impl<I: Idx + From<usize>> Extend<I> for BitSet<I>[src]

Sets the bit at index i to true for each item i in the input src.

impl<I: Idx + From<usize>> From<BitSet<I>> for WorkQueue<I>[src]

impl<I: Idx + From<usize>> FromIterator<I> for BitSet<I>[src]

Return a FixedBitSet containing bits set to true for every bit index in the iterator, other bits are set to false.

impl<I: Hash + Idx + From<usize>> Hash for BitSet<I>[src]

impl<I: Idx + From<usize>> Index<I> for BitSet<I>[src]

Return true if the bit is enabled in the bitset, or false otherwise.

Note: bits outside the capacity are always disabled, and thus indexing a FixedBitSet will not panic.

type Output = bool

The returned type after indexing.

impl<I: Ord + Idx + From<usize>> Ord for BitSet<I>[src]

impl<I: PartialEq + Idx + From<usize>> PartialEq<BitSet<I>> for BitSet<I>[src]

impl<I: PartialOrd + Idx + From<usize>> PartialOrd<BitSet<I>> for BitSet<I>[src]

impl<I: Idx + From<usize>> StructuralEq for BitSet<I>[src]

impl<I: Idx + From<usize>> StructuralPartialEq for BitSet<I>[src]

Auto Trait Implementations

impl<I> RefUnwindSafe for BitSet<I>

impl<I> Send for BitSet<I>

impl<I> Sync for BitSet<I>

impl<I> Unpin for BitSet<I>

impl<I> UnwindSafe for BitSet<I>

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<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?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> ToString for T where
    T: Display + ?Sized
[src]

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.