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

Create a empty bitvector with nbits initial elements.

Create a bitvector containing all 0 .. nbits elements.

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 ^ B

inverse 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

Count the number of elements existing in this bitvector.

return true if contains at least 1 element

return true if contains self.capacity elements

return true if set is empty

return true if set is empty. totally the same with self.none()

only compare the first bits instead of the whole bitvector.

require self and other are both no shorter than bits.

Trait Implementations

The resulting type after applying the & operator.

Performs the & operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Numeric cast from self to T.

Performs the conversion.

Numeric cast from T to Self.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.