pub struct IndexedBits<T: Deref<Target = [u8]>> { /* private fields */ }
Expand description

Bits stored with extra index data for fast rank and select.

Implementations

Build the index for a sequence of bits.

This is an expensive operation which will examine all of the data input.

Discard the index and get the original bit sequence storage back.

Count the set bits (fast O(1)).

Count the unset bits (fast O(1)).

Count the set bits before a position in the bits (O(1)).

Returns None it the index is out of bounds.

Count the unset bits before a position in the bits (O(1)).

Returns None it the index is out of bounds.

Find the position of a set bit by its rank (O(log n)).

Returns None if no suitable bit is found. It is always the case otherwise that rank_ones(result) == Some(target_rank) and get(result) == Some(true).

Find the position of an unset bit by its rank (O(log n)).

Returns None if no suitable bit is found. It is always the case otherwise that rank_zeros(result) == Some(target_rank) and get(result) == Some(false).

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. 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.