pub struct SymbolIndex { /* private fields */ }Expand description
Symbol index for fast lookups.
Supports both prefix and fuzzy matching using a trie and inverted index.
Implementations§
Source§impl SymbolIndex
impl SymbolIndex
Sourcepub fn new() -> SymbolIndex
pub fn new() -> SymbolIndex
Create a new empty symbol index.
Sourcepub fn add_symbol(&mut self, symbol: String)
pub fn add_symbol(&mut self, symbol: String)
Add a symbol to the index.
Indexes the symbol for both prefix and fuzzy matching.
Sourcepub fn search_prefix(&self, prefix: &str) -> Vec<String>
pub fn search_prefix(&self, prefix: &str) -> Vec<String>
Search symbols with prefix.
Returns all symbols starting with the given prefix.
Sourcepub fn search_fuzzy(&self, query: &str) -> Vec<String>
pub fn search_fuzzy(&self, query: &str) -> Vec<String>
Fuzzy search symbols.
Returns symbols matching any of the tokenized query words, sorted by relevance.
Trait Implementations§
Source§impl Default for SymbolIndex
impl Default for SymbolIndex
Source§fn default() -> SymbolIndex
fn default() -> SymbolIndex
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SymbolIndex
impl RefUnwindSafe for SymbolIndex
impl Send for SymbolIndex
impl Sync for SymbolIndex
impl Unpin for SymbolIndex
impl UnsafeUnpin for SymbolIndex
impl UnwindSafe for SymbolIndex
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