pub struct NotificationRule {
pub trigger: String,
pub channels: Vec<DispatchChannel>,
pub template: NotificationTemplate,
pub min_severity: NotificationSeverity,
}Expand description
A rule that maps a trigger + minimum severity to one or more channels.
Fields§
§trigger: StringEvent name that activates this rule.
channels: Vec<DispatchChannel>Channels to dispatch on when matched.
template: NotificationTemplateTemplate to render for this rule.
min_severity: NotificationSeverityMinimum severity level required to dispatch.
Implementations§
Source§impl NotificationRule
impl NotificationRule
Sourcepub fn new(
trigger: impl Into<String>,
channels: Vec<DispatchChannel>,
template: NotificationTemplate,
min_severity: NotificationSeverity,
) -> Self
pub fn new( trigger: impl Into<String>, channels: Vec<DispatchChannel>, template: NotificationTemplate, min_severity: NotificationSeverity, ) -> Self
Create a new rule.
Sourcepub fn matches(&self, trigger: &str, severity: NotificationSeverity) -> bool
pub fn matches(&self, trigger: &str, severity: NotificationSeverity) -> bool
Returns true when trigger matches and severity >= min_severity.
Trait Implementations§
Source§impl Clone for NotificationRule
impl Clone for NotificationRule
Source§fn clone(&self) -> NotificationRule
fn clone(&self) -> NotificationRule
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NotificationRule
impl RefUnwindSafe for NotificationRule
impl Send for NotificationRule
impl Sync for NotificationRule
impl Unpin for NotificationRule
impl UnsafeUnpin for NotificationRule
impl UnwindSafe for NotificationRule
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