pub struct Notifier { /* private fields */ }Expand description
Sends notifications over the channels they declare.
Implementations§
Source§impl Notifier
impl Notifier
pub fn new(mailer: Mailer) -> Notifier
Sourcepub fn with_client(self, client: Client) -> Notifier
pub fn with_client(self, client: Client) -> Notifier
Use a particular HTTP client for the webhook channel — a faked one in tests, or one with retries configured in production.
pub fn mailer(&self) -> &Mailer
pub fn client(&self) -> &Client
Sourcepub async fn notify<N: Notification + ?Sized>(
&self,
recipient: &Recipient,
notification: &N,
) -> Notified
pub async fn notify<N: Notification + ?Sized>( &self, recipient: &Recipient, notification: &N, ) -> Notified
Deliver a notification to one recipient over every channel it declares.
One channel failing does not stop the others: a webhook endpoint being down is no reason for the recipient not to get their email. Every outcome comes back, and the caller decides what a failure is worth.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Notifier
impl !UnwindSafe for Notifier
impl Freeze for Notifier
impl Send for Notifier
impl Sync for Notifier
impl Unpin for Notifier
impl UnsafeUnpin for Notifier
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