Skip to main content

Notification

Trait Notification 

Source
pub trait Notification:
    Serialize
    + Send
    + Sync {
    const NOTIFICATION_TYPE: &'static str;
}
Expand description

A durable fact worth recording against a notifiable - Laravel’s Notification class, narrowed to just its database-channel shape. Serializing Self is the stored data payload; there’s no separate render step the way [Notification::to_database] would imply if it existed. NOTIFICATION_TYPE is the same explicit, stable, app-chosen tag convention larust_queue::Job::JOB_TYPE already establishes - deliberately not std::any::type_name::<Self>(), since that string isn’t stable across a rename and an already-stored row would silently stop being attributable to its type.

No DeserializeOwned bound (unlike Job): nothing in this crate ever reconstructs a concrete Self from a stored row - notifications_for reads heterogeneous rows back across many different notification types at once and can only sensibly return the type tag plus raw JSON, matching Laravel’s own type/data column split.

Required Associated Constants§

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§