pub struct PersistentPattern {
pub pattern: Pattern,
pub handler: PatternHandler,
pub enabled: bool,
pub priority: i32,
}Expand description
A persistent pattern with its handler.
Fields§
§pattern: PatternThe pattern to match.
handler: PatternHandlerThe handler to execute on match.
enabled: boolWhether this pattern is currently enabled.
priority: i32Priority (lower = higher priority).
Implementations§
Source§impl PersistentPattern
impl PersistentPattern
Sourcepub fn new(pattern: Pattern, handler: PatternHandler) -> Self
pub fn new(pattern: Pattern, handler: PatternHandler) -> Self
Create a new persistent pattern.
Sourcepub fn with_response(pattern: Pattern, response: impl Into<String>) -> Self
pub fn with_response(pattern: Pattern, response: impl Into<String>) -> Self
Create a pattern with a simple response.
Sourcepub fn with_abort(pattern: Pattern, message: impl Into<String>) -> Self
pub fn with_abort(pattern: Pattern, message: impl Into<String>) -> Self
Create a pattern that aborts on match.
Sourcepub const fn with_priority(self, priority: i32) -> Self
pub const fn with_priority(self, priority: i32) -> Self
Set the priority for this pattern.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PersistentPattern
impl !RefUnwindSafe for PersistentPattern
impl Send for PersistentPattern
impl Sync for PersistentPattern
impl Unpin for PersistentPattern
impl !UnwindSafe for PersistentPattern
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