Crate teddy [] [src]

This is a crate for SIMD-accelerated multi-substring matching. You may find it useful if:

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 lazy dog.")
);

Warning

In order to get SIMD acceleration, you need to build this crate with the appropriate CPU features turned on. You also need a nightly rust compiler. Please see the README for more details.

Structs

Match

All the details for the match that Teddy found.

Teddy

A SIMD accelerated multi substring searcher.