pub struct CompiledFilter { /* private fields */ }Expand description
A compiled filter ready for evaluation.
This struct contains the bytecode and all pre-compiled resources needed for fast evaluation. Create one at startup and reuse it for all payload evaluations.
Implementations§
Source§impl CompiledFilter
impl CompiledFilter
Sourcepub fn new(
bytecode: Vec<u8>,
strings: Vec<Vec<u8>>,
regexes: Vec<Regex>,
string_sets: Vec<Vec<u16>>,
delimiter: Vec<u8>,
source: String,
) -> Self
pub fn new( bytecode: Vec<u8>, strings: Vec<Vec<u8>>, regexes: Vec<Regex>, string_sets: Vec<Vec<u16>>, delimiter: Vec<u8>, source: String, ) -> Self
Create a new compiled filter from components.
This is typically called by the compiler, not directly.
Sourcepub fn evaluate(&self, payload: Bytes) -> bool
pub fn evaluate(&self, payload: Bytes) -> bool
Evaluate the filter against a record.
§Arguments
payload- The record payload to evaluate
§Returns
true if the filter matches, false otherwise.
§Performance
- Zero allocations during evaluation
- SIMD-accelerated string matching
- Fixed-size stack (no heap)
§Panics
In debug builds only, panics if the bytecode is malformed (invalid opcode
or stack overflow). In release builds, returns false for invalid bytecode.
Sourcepub fn bytecode_len(&self) -> usize
pub fn bytecode_len(&self) -> usize
Get the bytecode length.
Sourcepub fn string_count(&self) -> usize
pub fn string_count(&self) -> usize
Get the number of string literals.
Sourcepub fn regex_count(&self) -> usize
pub fn regex_count(&self) -> usize
Get the number of regex patterns.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CompiledFilter
impl RefUnwindSafe for CompiledFilter
impl Send for CompiledFilter
impl Sync for CompiledFilter
impl Unpin for CompiledFilter
impl UnsafeUnpin for CompiledFilter
impl UnwindSafe for CompiledFilter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more