Note: I tried to search for something similar, but did not find anything. There is a string matching for a single pattern.
I was thinking of writing a string multi-matching based Aho-Corasick’s string matching algorithm. While Knuth-Morris-Pratt matches a single pattern against a text, Aho-Corasick is able to match a set of patterns against a text.
The interface could look something like this:
// some trait impl for &str
fn match_patterns(&self, patterns: &[&str]) -> Matches;
Where Matches would be an iterator over all positions each pattern match, if any.
Would this be something desirable? Is this suitable to be inside a library, if not std then some utility lib?