pub struct TokenTrie { /* private fields */ }Expand description
Fast token lookup trie. All token types for a language are inserted into one trie.
Debug prints only the process mask (the full trie is too large to dump).
Implementations§
Source§impl TokenTrie
impl TokenTrie
pub fn new() -> Self
pub fn insert(&mut self, pattern: &[u8], token_match: TokenMatch)
Sourcepub fn match_at(&self, content: &[u8], pos: usize) -> Option<TokenMatch>
pub fn match_at(&self, content: &[u8], pos: usize) -> Option<TokenMatch>
Try to match a token at position pos. Returns longest match (greedy).
pub fn process_mask(&self) -> u8
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TokenTrie
impl RefUnwindSafe for TokenTrie
impl Send for TokenTrie
impl Sync for TokenTrie
impl Unpin for TokenTrie
impl UnsafeUnpin for TokenTrie
impl UnwindSafe for TokenTrie
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