pub struct DoubleArrayTrie { /* private fields */ }Expand description
Double-array trie backed by a pre-built i32 array.
Implementations§
Source§impl DoubleArrayTrie
impl DoubleArrayTrie
Sourcepub fn from_bytes(data: &[u8], offset: usize) -> (Self, usize)
pub fn from_bytes(data: &[u8], offset: usize) -> (Self, usize)
Read a trie from raw bytes at the given offset.
Sourcepub fn common_prefix_search(
&self,
key: &[u8],
offset: usize,
limit: usize,
) -> Vec<TrieMatch>
pub fn common_prefix_search( &self, key: &[u8], offset: usize, limit: usize, ) -> Vec<TrieMatch>
Common prefix search: find all keys that are prefixes of the input. This is the core operation for lattice-based tokenization.
Sourcepub fn exact_match_search(
&self,
key: &[u8],
offset: usize,
length: usize,
) -> i32
pub fn exact_match_search( &self, key: &[u8], offset: usize, length: usize, ) -> i32
Exact match search: look up a single key.
Sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Total number of units in the trie.
Auto Trait Implementations§
impl Freeze for DoubleArrayTrie
impl RefUnwindSafe for DoubleArrayTrie
impl Send for DoubleArrayTrie
impl Sync for DoubleArrayTrie
impl Unpin for DoubleArrayTrie
impl UnsafeUnpin for DoubleArrayTrie
impl UnwindSafe for DoubleArrayTrie
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