Trait Recognizer
pub trait Recognizer {
// Required methods
fn pop_bytes(&mut self, num: usize);
fn collapse(&mut self);
fn trie_finished(&mut self);
fn try_push_byte(&mut self, byte: u8) -> bool;
// Provided methods
fn byte_allowed(&mut self, byte: u8) -> bool { ... }
fn trie_started(&mut self, _dbg_lbl: &str) { ... }
fn get_error(&mut self) -> Option<String> { ... }
fn save_stats(&mut self, _nodes_walked: usize) { ... }
}
Required Methods§
fn collapse(&mut self)
fn collapse(&mut self)
“Collapse” the stack so that it consists only of its former top element. X = stack.top(); stack.empty(); stack.push(X)
fn trie_finished(&mut self)
fn trie_finished(&mut self)
Called when iteration over the trie is finished Stack has exactly one element then, except when iteration started from non-root node. In that case, the stack may have more than one element, and trie_finished() needs to pop the excessive elements.
fn try_push_byte(&mut self, byte: u8) -> bool
fn try_push_byte(&mut self, byte: u8) -> bool
This combines push_byte
and byte_allowed
into one function for performance.
Provided Methods§
fn byte_allowed(&mut self, byte: u8) -> bool
fn byte_allowed(&mut self, byte: u8) -> bool
check if stack.top() transitions via byte to a viable state
fn trie_started(&mut self, _dbg_lbl: &str)
fn trie_started(&mut self, _dbg_lbl: &str)
Called when iteration over the trie is started