pub struct BitmapIndex { /* private fields */ }Expand description
Bitmap-style inverted index on block_type.
Each entry maps a BlockType to a sorted list of block indices
(positions in Document::blocks). Equivalent to a RoaringBitmap but
using plain Vec<u32> since block counts per document are small.
Best for: WHERE block_type = 'heading'
Complexity: build O(n), lookup O(1) key + O(k) iterate
Implementations§
Source§impl BitmapIndex
impl BitmapIndex
pub fn build(blocks: &[Block]) -> Self
Sourcepub fn get(&self, block_type: &BlockType) -> &[u32]
pub fn get(&self, block_type: &BlockType) -> &[u32]
Returns block indices for a single type. O(1).
Sourcepub fn get_any(&self, types: &[BlockType]) -> Vec<u32>
pub fn get_any(&self, types: &[BlockType]) -> Vec<u32>
Returns block indices matching any of the given types (union). O(k).
Sourcepub fn contains_type(&self, block_type: &BlockType) -> bool
pub fn contains_type(&self, block_type: &BlockType) -> bool
Returns whether any block of the given type exists.
Trait Implementations§
Source§impl Clone for BitmapIndex
impl Clone for BitmapIndex
Source§fn clone(&self) -> BitmapIndex
fn clone(&self) -> BitmapIndex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BitmapIndex
impl Debug for BitmapIndex
Source§impl Default for BitmapIndex
impl Default for BitmapIndex
Source§fn default() -> BitmapIndex
fn default() -> BitmapIndex
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BitmapIndex
impl RefUnwindSafe for BitmapIndex
impl Send for BitmapIndex
impl Sync for BitmapIndex
impl Unpin for BitmapIndex
impl UnsafeUnpin for BitmapIndex
impl UnwindSafe for BitmapIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more