pub struct RuleSet {
pub category: RuleCategory,
pub patterns: Vec<String>,
pub compiled: Option<CompiledRules>,
pub source_files: Vec<PathBuf>,
}Expand description
A rule set that can be split into multiple chunks to avoid regex size limits
Fields§
§category: RuleCategory§patterns: Vec<String>§compiled: Option<CompiledRules>§source_files: Vec<PathBuf>Implementations§
Source§impl RuleSet
impl RuleSet
pub fn new(category: RuleCategory) -> Self
Sourcepub fn compile(&mut self) -> Result<(), RuleError>
pub fn compile(&mut self) -> Result<(), RuleError>
Compile patterns into RegexSet(s), automatically chunking if size limit is exceeded
Sourcefn compile_chunked(&mut self) -> Result<(), RuleError>
fn compile_chunked(&mut self) -> Result<(), RuleError>
Compile patterns into multiple chunks using adaptive sizing
Sourcefn find_optimal_chunk_size(&self) -> Result<usize, RuleError>
fn find_optimal_chunk_size(&self) -> Result<usize, RuleError>
Find optimal chunk size using binary search Returns the largest chunk size that compiles successfully
Sourcepub fn matches(&self, message: &str) -> bool
pub fn matches(&self, message: &str) -> bool
Check if message matches any pattern in this rule set
pub fn add_pattern(&mut self, pattern: String) -> Result<(), RuleError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RuleSet
impl RefUnwindSafe for RuleSet
impl Send for RuleSet
impl Sync for RuleSet
impl Unpin for RuleSet
impl UnwindSafe for RuleSet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more