pub fn compile<S: Builder, T: Mode>(
    expression: S
) -> Result<Database<T>, S::Err>
Expand description

Compile an expression into a Hyperscan database.

Examples

let db: BlockDatabase = compile(r"/foo(bar)?/i").unwrap();
let mut s = db.alloc_scratch().unwrap();

let mut matches = vec![];
db.scan("hello foobar!", &mut s, |_, from, to, _| {
    matches.push(from..to);
    Matching::Continue
}).unwrap();

assert_eq!(matches, vec![0..9, 0..12]);