pub struct LevelMatcher { /* private fields */ }Expand description
A compiled LevelRule list, ready to classify lines.
Build one with Self::compile. Rules are tried in the order they were
declared and the first match wins, so an operator orders them rather than
discovering which of two overlapping patterns a map happened to hold
first.
Implementations§
Source§impl LevelMatcher
impl LevelMatcher
Sourcepub fn compile(rules: &[LevelRule]) -> Result<Self, LevelRuleError>
pub fn compile(rules: &[LevelRule]) -> Result<Self, LevelRuleError>
Compiles rules in order.
An empty slice compiles to an empty matcher, which classifies nothing. What a caller does with that is its own decision: a client reading an app that declared no rules falls back to its own reading of the line.
§Errors
LevelRuleError::TooManyRulesifrulesis longer than this crate’s ceiling on how many one app may declare, which the error carries aslimit.LevelRuleError::EmptyPatternif a rule’s pattern is empty.LevelRuleError::BadPatternif a pattern does not compile, or compiles to a program over this crate’s 1 MiB bound.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LevelMatcher
impl RefUnwindSafe for LevelMatcher
impl Send for LevelMatcher
impl Sync for LevelMatcher
impl Unpin for LevelMatcher
impl UnsafeUnpin for LevelMatcher
impl UnwindSafe for LevelMatcher
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