Crate teddy [−] [src]
This crate contains two types: Teddy
is the main one. You create one by passing in a set of
patterns. It does some preprocessing, and then you can use it to quickly search for those
patterns in some text. Searching returns a Match
, which will tell you which of the patterns
matched and where.
use teddy::{Match, Teddy}; let patterns = vec![b"cat", b"dog", b"fox"]; let ted = Teddy::new(patterns.iter().map(|s| &s[..])).unwrap(); assert_eq!( Some(Match { pat: 2, start: 16, end: 19 }), ted.find(b"The quick brown fox jumped over the laxy dog.") );
Structs
Match |
Match reports match information. |
Teddy |