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 is a software regular expression matching engine that is a hybrid of Hyperscan and PCRE.
The hyperscan Prelude
Regex compatible interface

Macros

Define Literal with flags
Define multi Literal with flags and ID
Define Pattern with flags
Define multi Pattern with flags and ID

Structs

Providing details of the compile error condition.
CPU feature support flags
A compiled pattern database that can then be used to scan data.
A borrowed reference to a Database.
A structure containing additional parameters related to an expression.
A type containing information related to an expression
The pattern with pure literal expression.
Literal flags
Vec of Literal
The pattern with basic regular expression.
Pattern flags
Vec of Pattern
A type containing information on the target platform which may optionally be provided to the compile calls
A borrowed reference to a Platform.
A large enough region of scratch space to support a given database.
A borrowed reference to a Scratch.
A pattern matching state can be maintained across multiple blocks of target data
A borrowed reference to a Stream.

Enums

Block scan (non-streaming) database.
Hyperscan Error
Hyperscan Error Codes
Indicating whether or not matching should continue on the target data.
Defines the precision to track start of match offsets in stream state.
Streaming database.
Tuning Parameter
Vectored scanning database.

Traits

The regular expression pattern database builder.
The regular expression pattern database builder.
Definition of the match event callback function type.
Compile mode
A serialized database

Functions

Compile an expression into a Hyperscan database.
The current Hyperscan version information.
Utility function for identifying this release version.

Type Definitions

Block scan (non-streaming) database.
The type returned by hyperscan methods.
Streaming database.
Vectored scanning database.