pub struct NotificationDispatcher { /* private fields */ }Expand description
Dispatcher that sends notifications to console and optional webhook/chat sinks.
Implementations§
Source§impl NotificationDispatcher
impl NotificationDispatcher
pub fn new() -> Self
Sourcepub fn with_webhook(self, url: impl Into<String>) -> Result<Self>
pub fn with_webhook(self, url: impl Into<String>) -> Result<Self>
Add a webhook endpoint. Returns an error if the URL is invalid, uses a non-http(s) scheme, or targets a private/loopback IP address.
Sourcepub async fn notify(&self, notification: &Notification)
pub async fn notify(&self, notification: &Notification)
Send a notification to all configured sinks.
Sourcepub async fn info(&self, title: impl Into<String>, body: impl Into<String>)
pub async fn info(&self, title: impl Into<String>, body: impl Into<String>)
Convenience: send an info notification.
Trait Implementations§
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