#[repr(transparent)]
pub struct Database(_);
Expand description

A compiled pattern database that can then be used to scan data.

Methods from Deref<Target = DatabaseRef>

Returns the size of the given database.

Utility function providing information about a database.

Allocate a scratch space for use by Chimera.

This is required for runtime use, and one scratch space per thread, or concurrent caller, is required.

Reallocate a scratch space for use by Chimera.

The block regular expression scanner.

Handling Matches

scan will call a user-supplied callback when a match is found.

This closure has the following signature:

fn on_match_event(id: u32, from: u64, to: u64, flags: u32, captured: Option<&[Capture]>) -> Matching {
    Matching::Continue
}
Parameters
  • id: The ID number of the expression that matched.
  • from: The offset of the first byte that matches the expression.
  • to: The offset after the last byte that matches the expression.
  • flags: This is provided for future use and is unused at present.
  • captured: An array of Capture structures that contain the start and end offsets of entire pattern match and each captured subexpression.
Return

The callback can return Matching::Terminate to stop matching. Otherwise, a return value of Matching::Continue will continue, with the current pattern if configured to produce multiple matches per pattern, while a return value of Matching::Skip will cease matching this pattern but continue matching the next pattern.

Handling Runtime Errors

scan will call a user-supplied callback when a runtime error occurs in libpcre.

This closure has the following signature:

fn on_error_event(error_type: Error, id: u32) -> Matching {
    Matching::Continue
}

The id argument will be set to the identifier for the matching expression provided at compile time.

The match callback has the capability to either halt scanning or continue scanning for the next pattern.

Return

The callback can return Matching::Skip to cease matching this pattern but continue matching the next pattern. Otherwise, we stop matching for all patterns with Matching::Terminate.

Trait Implementations

Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
Executes the destructor for this type. Read more
The raw C type.
The type representing a reference to this type.
Constructs an instance of this type from its raw type. Read more
Returns a raw pointer to the wrapped value.
Consumes the wrapper and returns the raw pointer.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.