pub struct Matcher { /* private fields */ }Expand description
The pattern matching engine.
Implementations§
Source§impl Matcher
impl Matcher
Sourcepub fn with_cache(buffer_size: usize, cache: Arc<RegexCache>) -> Self
pub fn with_cache(buffer_size: usize, cache: Arc<RegexCache>) -> Self
Create a new matcher with shared regex cache.
Sourcepub const fn set_default_timeout(&mut self, timeout: Duration)
pub const fn set_default_timeout(&mut self, timeout: Duration)
Set the default timeout.
Sourcepub const fn set_search_window(&mut self, size: Option<usize>)
pub const fn set_search_window(&mut self, size: Option<usize>)
Set the search window size.
When set, pattern matching will only search the last N bytes of the buffer, improving performance for large buffers.
Sourcepub const fn buffer(&self) -> &RingBuffer ⓘ
pub const fn buffer(&self) -> &RingBuffer ⓘ
Get the current buffer.
Sourcepub fn buffer_str(&mut self) -> String
pub fn buffer_str(&mut self) -> String
Get the current buffer contents as a string.
Sourcepub fn try_match(&mut self, pattern: &Pattern) -> Option<MatchResult>
pub fn try_match(&mut self, pattern: &Pattern) -> Option<MatchResult>
Try to match a single pattern against the buffer.
Sourcepub fn try_match_any(&mut self, patterns: &PatternSet) -> Option<MatchResult>
pub fn try_match_any(&mut self, patterns: &PatternSet) -> Option<MatchResult>
Try to match any pattern from a set against the buffer.
Sourcepub fn consume_match(&mut self, result: &MatchResult) -> Match
pub fn consume_match(&mut self, result: &MatchResult) -> Match
Consume matched content from the buffer and return a Match.
Sourcepub fn get_timeout(&self, patterns: &PatternSet) -> Duration
pub fn get_timeout(&self, patterns: &PatternSet) -> Duration
Get the timeout for a pattern set.
Sourcepub const fn cache(&self) -> &Arc<RegexCache>
pub const fn cache(&self) -> &Arc<RegexCache>
Get the regex cache.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Matcher
impl RefUnwindSafe for Matcher
impl Send for Matcher
impl Sync for Matcher
impl Unpin for Matcher
impl UnwindSafe for Matcher
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