pub struct DocumentIndices {
pub by_tag: HashMap<String, HashSet<BlockId>>,
pub by_role: HashMap<String, HashSet<BlockId>>,
pub by_content_type: HashMap<String, HashSet<BlockId>>,
pub by_label: HashMap<String, BlockId>,
}Expand description
Secondary indices for fast lookup
Fields§
§by_tag: HashMap<String, HashSet<BlockId>>Blocks by tag
by_role: HashMap<String, HashSet<BlockId>>Blocks by semantic role category
by_content_type: HashMap<String, HashSet<BlockId>>Blocks by content type
by_label: HashMap<String, BlockId>Blocks by label
Implementations§
Source§impl DocumentIndices
impl DocumentIndices
pub fn new() -> Self
Sourcepub fn index_block(&mut self, block: &Block)
pub fn index_block(&mut self, block: &Block)
Index a block
Sourcepub fn remove_block(&mut self, block: &Block)
pub fn remove_block(&mut self, block: &Block)
Remove a block from indices
Sourcepub fn find_by_tag(&self, tag: &str) -> HashSet<BlockId>
pub fn find_by_tag(&self, tag: &str) -> HashSet<BlockId>
Find blocks by tag
Sourcepub fn find_by_type(&self, content_type: &str) -> HashSet<BlockId>
pub fn find_by_type(&self, content_type: &str) -> HashSet<BlockId>
Find blocks by content type
Sourcepub fn find_by_label(&self, label: &str) -> Option<BlockId>
pub fn find_by_label(&self, label: &str) -> Option<BlockId>
Find block by label
Trait Implementations§
Source§impl Clone for DocumentIndices
impl Clone for DocumentIndices
Source§fn clone(&self) -> DocumentIndices
fn clone(&self) -> DocumentIndices
Returns a duplicate of the value. Read more
1.0.0 · 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 DocumentIndices
impl Debug for DocumentIndices
Source§impl Default for DocumentIndices
impl Default for DocumentIndices
Source§fn default() -> DocumentIndices
fn default() -> DocumentIndices
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DocumentIndices
impl RefUnwindSafe for DocumentIndices
impl Send for DocumentIndices
impl Sync for DocumentIndices
impl Unpin for DocumentIndices
impl UnwindSafe for DocumentIndices
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