Trait hyperscan::MatchEventHandler
source · [−]pub trait MatchEventHandler {
unsafe fn split(&mut self) -> (match_event_handler, *mut c_void);
}
Expand description
Definition of the match event callback function type.
A callback function matching the defined type must be provided by the
application calling the DatabaseRef::scan
or StreamRef::scan
functions
(or other streaming calls which can produce matches).
This callback function will be invoked whenever a match is located in the target data during the execution of a scan. The details of the match are passed in as parameters to the callback function, and the callback function should return a value indicating whether or not matching should continue on the target data. If no callbacks are desired from a scan call, NULL may be provided in order to suppress match production.
This callback function should not attempt to call Hyperscan API functions on the same stream nor should it attempt to reuse the scratch space allocated for the API calls that caused it to be triggered. Making another call to the Hyperscan library with completely independent parameters should work (for example, scanning a different database in a new stream and with new scratch space), but reusing data structures like stream state and/or scratch space will produce undefined behavior.