hyperscan/chimera/mod.rs
1//! Chimera is a software regular expression matching engine that is a hybrid of Hyperscan and PCRE.
2//!
3//! The design goals of Chimera are to fully support PCRE syntax as well as to
4//! take advantage of the high performance nature of Hyperscan.
5//!
6//! # Examples
7//!
8//! ```rust
9//! # use hyperscan::chimera::prelude::*;
10//! let db: Database = "/test/i".parse().unwrap();
11//! let scratch = db.alloc_scratch().unwrap();
12//! let mut matches = vec![];
13//! let mut errors = vec![];
14//!
15//! db.scan("some test data", &scratch, |id, from, to, _flags, captured| {
16//! matches.push((from, to));
17//!
18//! Matching::Continue
19//! }, |error_type, id| {
20//! errors.push((error_type, id));
21//!
22//! Matching::Skip
23//! }).unwrap();
24//!
25//! assert_eq!(matches, vec![(5, 9)]);
26//! assert_eq!(errors, vec![]);
27//! ```
28mod common;
29mod compile;
30mod error;
31mod pattern;
32mod runtime;
33
34#[doc(hidden)]
35pub use crate::ffi::chimera as ffi;
36
37pub use self::common::{version, Database, DatabaseRef};
38pub use self::compile::{compile, Builder, CompileError, Mode};
39pub use self::error::Error;
40pub use self::pattern::{Flags, Pattern, Patterns};
41pub use self::runtime::{
42 Capture, Error as MatchError, ErrorEventHandler, MatchEventHandler, Matching, Scratch, ScratchRef,
43};
44
45pub mod prelude {
46 //! The `chimera` Prelude
47 pub use crate::chimera::{
48 compile, Builder, Capture, Database, DatabaseRef, Error, Matching, Pattern, Patterns, Scratch, ScratchRef,
49 };
50}