Skip to main content

Notification

Trait Notification 

Source
pub trait Notification<Recipient> {
    // Required methods
    fn via(
        &self,
        recipient: &Recipient,
    ) -> Result<Vec<Channel>, NotificationError>;
    fn to_mail(
        &self,
        recipient: &Recipient,
    ) -> Result<MailMessage, NotificationError>;
}
Expand description

Application-owned notification content and channel selection.

Required Methods§

Source

fn via(&self, recipient: &Recipient) -> Result<Vec<Channel>, NotificationError>

Select channels separately for each recipient.

Source

fn to_mail( &self, recipient: &Recipient, ) -> Result<MailMessage, NotificationError>

Compose the application-rendered mail for this recipient.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§