Expand description
Hyperscan is a high-performance regular expression matching library.
§Usage
This crate is on crates.io and can be used by adding hyperscan
to your dependencies in your project’s Cargo.toml.
[dependencies]
hyperscan = "0.3"
§Examples
#[macro_use]
extern crate hyperscan;
use hyperscan::prelude::*;
fn main() {
let pattern = pattern! {"test"; CASELESS | SOM_LEFTMOST};
let db: BlockDatabase = pattern.build().unwrap();
let scratch = db.alloc_scratch().unwrap();
db.scan("some test data", &scratch, |id, from, to, _flags| {
assert_eq!(id, 0);
assert_eq!(from, 5);
assert_eq!(to, 9);
println!("found pattern {} : {} @ [{}, {})", id, pattern.expression, from, to);
Matching::Continue
}).unwrap();
}
Modules§
- chimera
- Chimera is a software regular expression matching engine that is a hybrid of Hyperscan and PCRE.
- prelude
- The
hyperscan
Prelude - regex
- Regex compatible interface
Macros§
- literal
- Define
Literal
with flags - literals
- Define multi
Literal
with flags and ID - pattern
- Define
Pattern
with flags - patterns
- Define multi
Pattern
with flags and ID
Structs§
- Compile
Error - Providing details of the compile error condition.
- CpuFeatures
- CPU feature support flags
- Database
- A compiled pattern database that can then be used to scan data.
- Database
Ref - A borrowed reference to a
Database
. - ExprExt
- A structure containing additional parameters related to an expression.
- Expr
Info - A type containing information related to an expression
- Literal
- The pattern with pure literal expression.
- Literal
Flags - Literal flags
- Literals
- Vec of
Literal
- Pattern
- The pattern with basic regular expression.
- Pattern
Flags - Pattern flags
- Patterns
- Vec of
Pattern
- Platform
- A type containing information on the target platform which may optionally be provided to the compile calls
- Platform
Ref - A borrowed reference to a
Platform
. - Scratch
- A large enough region of scratch space to support a given database.
- Scratch
Ref - A borrowed reference to a
Scratch
. - Stream
- A pattern matching state can be maintained across multiple blocks of target data
- Stream
Ref - A borrowed reference to a
Stream
.
Enums§
- Block
Mode - Block scan (non-streaming) database.
- Error
- Hyperscan Error
- HsError
- Hyperscan Error Codes
- Matching
- Indicating whether or not matching should continue on the target data.
- SomHorizon
- Defines the precision to track start of match offsets in stream state.
- Streaming
Mode - Streaming database.
- Tune
- Tuning Parameter
- Vectored
Mode - Vectored scanning database.
Traits§
- Builder
- The regular expression pattern database builder.
- Database
Builder - The regular expression pattern database builder.
- Match
Event Handler - Definition of the match event callback function type.
- Mode
- Compile mode
- Serialized
Database - A serialized database
Functions§
- compile
- Compile an expression into a Hyperscan database.
- version
- The current Hyperscan version information.
- version_
str - Utility function for identifying this release version.
Type Aliases§
- Block
Database - Block scan (non-streaming) database.
- Result
- The type returned by hyperscan methods.
- Streaming
Database - Streaming database.
- Vectored
Database - Vectored scanning database.