pub trait Select {
// Required method
fn try_select(&self, rank: usize) -> Option<usize>;
// Provided methods
fn select(&self, rank: usize) -> usize { ... }
unsafe fn select_unchecked(&self, rank: usize) -> usize { ... }
}
Expand description
Trait implemented by the types that support select (one) queries, i.e. can (quickly) find the position of the n-th one in the bitmap.
Required Methods§
Provided Methods§
sourcefn select(&self, rank: usize) -> usize
fn select(&self, rank: usize) -> usize
Returns the position of the rank
-th one (counting from 0) in self
or panics if there are no such many ones in self
.
sourceunsafe fn select_unchecked(&self, rank: usize) -> usize
unsafe fn select_unchecked(&self, rank: usize) -> usize
Returns the position of the rank
-th one (counting from 0) in self
.
The result is undefined if there are no such many ones in self
.