Struct bitvector_simd::BitVector [−][src]
pub struct BitVector { /* fields omitted */ }Expand description
Representation of a BitVector
see the module’s document for examples and details.
Implementations
max number of elements that this bitvector can have
To get the number of elements, use count
Shrink the vector to length. All elements between [length .. self.capacity()] will be removed.
Panic if given length larger than current length.
Remove or add index to the set.
If index > self.capacity, the bitvector will be expanded to index.
Check if index exists in current set.
If exists, return Some(true)
If index < current.capacity and element doesn’t exist, return Some(false).
If index >= current.capacity, return None.
Directly return a bool instead of an Option
If exists, return true
If doesn’t exist or index >= current.capacity, retun false
equals to self.get(index).unwrap_or(false)
difference operation
A.difference(B) calculates A\B, e.g.
A = [1,2,3], B = [2,4,5]
A\B = [1,3]also notice that
A.difference(B) & B.difference(A) == A ^ Binverse every bits in the vector.
If your bitvector have capacity 1_000 and contains [1,5],
after inverse it will contains 0, 2..=4, 6..=999
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for BitVector
impl UnwindSafe for BitVector
Blanket Implementations
Mutably borrows from an owned value. Read more