Skip to main content

MailNotification

Trait MailNotification 

Source
pub trait MailNotification: Send + Sync {
    type Mail: Mailable + Send + 'static;

    // Required method
    fn to_mail(&self) -> Self::Mail;
}
Expand description

A notification that also knows how to render itself as mail - Laravel’s Notification::toMail(), as a real trait method rather than a runtime-dispatched one (see this crate’s own module doc comment for why). Mail: Send + 'static isn’t this trait being stricter than Mailable itself needs - it’s what lets PendingNotification::mail box the delivery future as dyn Future <...> + Send regardless of what a specific Mailable impl happens to capture.

Required Associated Types§

Source

type Mail: Mailable + Send + 'static

Required Methods§

Source

fn to_mail(&self) -> Self::Mail

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§