pub struct PatternManager { /* private fields */ }Expand description
Manager for before/after patterns.
Before patterns are checked before every expect operation. After patterns are checked after each expect operation completes.
Implementations§
Source§impl PatternManager
impl PatternManager
Sourcepub fn add_before(&mut self, pattern: PersistentPattern) -> String
pub fn add_before(&mut self, pattern: PersistentPattern) -> String
Add a before pattern and return its ID.
Sourcepub fn add_after(&mut self, pattern: PersistentPattern) -> String
pub fn add_after(&mut self, pattern: PersistentPattern) -> String
Add an after pattern and return its ID.
Sourcepub fn remove_before(&mut self, id: &str) -> Option<PersistentPattern>
pub fn remove_before(&mut self, id: &str) -> Option<PersistentPattern>
Remove a before pattern by ID.
Sourcepub fn remove_after(&mut self, id: &str) -> Option<PersistentPattern>
pub fn remove_after(&mut self, id: &str) -> Option<PersistentPattern>
Remove an after pattern by ID.
Sourcepub fn get_before(&self, id: &str) -> Option<&PersistentPattern>
pub fn get_before(&self, id: &str) -> Option<&PersistentPattern>
Get a before pattern by ID.
Sourcepub fn get_before_mut(&mut self, id: &str) -> Option<&mut PersistentPattern>
pub fn get_before_mut(&mut self, id: &str) -> Option<&mut PersistentPattern>
Get a mutable before pattern by ID.
Sourcepub fn get_after(&self, id: &str) -> Option<&PersistentPattern>
pub fn get_after(&self, id: &str) -> Option<&PersistentPattern>
Get an after pattern by ID.
Sourcepub fn get_after_mut(&mut self, id: &str) -> Option<&mut PersistentPattern>
pub fn get_after_mut(&mut self, id: &str) -> Option<&mut PersistentPattern>
Get a mutable after pattern by ID.
Sourcepub fn check_before(&self, buffer: &str) -> Option<(String, HandlerAction)>
pub fn check_before(&self, buffer: &str) -> Option<(String, HandlerAction)>
Check before patterns against the buffer.
Returns the first matching handler action, or None if no patterns match.
Sourcepub fn check_after(&self, buffer: &str) -> Option<(String, HandlerAction)>
pub fn check_after(&self, buffer: &str) -> Option<(String, HandlerAction)>
Check after patterns against the buffer.
Returns the first matching handler action, or None if no patterns match.
Sourcepub fn before_pattern_set(&self) -> PatternSet
pub fn before_pattern_set(&self) -> PatternSet
Get all before patterns as a PatternSet for matching.
Sourcepub fn after_pattern_set(&self) -> PatternSet
pub fn after_pattern_set(&self) -> PatternSet
Get all after patterns as a PatternSet for matching.
Sourcepub fn clear_before(&mut self)
pub fn clear_before(&mut self)
Clear all before patterns.
Sourcepub fn clear_after(&mut self)
pub fn clear_after(&mut self)
Clear all after patterns.
Sourcepub fn before_count(&self) -> usize
pub fn before_count(&self) -> usize
Get the number of before patterns.
Sourcepub fn after_count(&self) -> usize
pub fn after_count(&self) -> usize
Get the number of after patterns.