PatternMatcher

Trait PatternMatcher 

Source
pub trait PatternMatcher: Send + Sync {
    // Required methods
    fn initialize(&mut self, patterns: &[ToolPattern]) -> Result<()>;
    fn find_matches<'a>(&self, text: &'a str) -> Vec<ToolMatch<'a>>;
    fn matcher_type(&self) -> &'static str;
}
Expand description

Trait for pattern matching implementations

Required Methods§

Source

fn initialize(&mut self, patterns: &[ToolPattern]) -> Result<()>

Initialize the matcher with tool patterns

§Errors

Returns an error if the automaton cannot be built from the patterns

Source

fn find_matches<'a>(&self, text: &'a str) -> Vec<ToolMatch<'a>>

Find all tool matches in the given text

Returns matches ordered by position (leftmost-longest)

Source

fn matcher_type(&self) -> &'static str

Get the matcher type identifier

Implementors§