pub struct NotificationDispatcher {
pub rules: Vec<NotificationRule>,
pub sent: Vec<(u64, String)>,
}Expand description
Accumulates rules and records dispatched notifications.
Fields§
§rules: Vec<NotificationRule>Registered rules.
sent: Vec<(u64, String)>Audit log: (timestamp_ms, rendered_message).
Implementations§
Source§impl NotificationDispatcher
impl NotificationDispatcher
Sourcepub fn add_rule(&mut self, r: NotificationRule)
pub fn add_rule(&mut self, r: NotificationRule)
Register a rule.
Sourcepub fn dispatch(
&mut self,
trigger: &str,
severity: NotificationSeverity,
vars: &[(String, String)],
now_ms: u64,
) -> usize
pub fn dispatch( &mut self, trigger: &str, severity: NotificationSeverity, vars: &[(String, String)], now_ms: u64, ) -> usize
Evaluate all rules for trigger + severity.
For every matching rule every channel is “dispatched” (recorded in the audit log). Returns the total number of channel dispatches performed.
Sourcepub fn total_sent(&self) -> usize
pub fn total_sent(&self) -> usize
Total number of channel dispatches recorded since creation.
Trait Implementations§
Source§impl Debug for NotificationDispatcher
impl Debug for NotificationDispatcher
Source§impl Default for NotificationDispatcher
impl Default for NotificationDispatcher
Source§fn default() -> NotificationDispatcher
fn default() -> NotificationDispatcher
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for NotificationDispatcher
impl RefUnwindSafe for NotificationDispatcher
impl Send for NotificationDispatcher
impl Sync for NotificationDispatcher
impl Unpin for NotificationDispatcher
impl UnsafeUnpin for NotificationDispatcher
impl UnwindSafe for NotificationDispatcher
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