pub struct Notification {
pub id: String,
pub user_id: String,
pub notification_type: NotificationType,
pub title: String,
pub body: String,
pub url: Option<String>,
pub read: bool,
pub created_at: u64,
pub metadata: NotificationMetadata,
}Expand description
A notification for a user.
Fields§
§id: StringUnique notification ID.
user_id: StringUser who receives this notification.
notification_type: NotificationTypeNotification type.
title: StringBrief title.
body: StringNotification body/description.
url: Option<String>URL to navigate to when clicked.
read: boolWhether the notification has been read.
created_at: u64When the notification was created (Unix timestamp).
metadata: NotificationMetadataAdditional metadata.
Implementations§
Source§impl Notification
impl Notification
Sourcepub fn new(
user_id: String,
notification_type: NotificationType,
title: String,
body: String,
) -> Self
pub fn new( user_id: String, notification_type: NotificationType, title: String, body: String, ) -> Self
Create a new notification.
Sourcepub fn with_metadata(self, metadata: NotificationMetadata) -> Self
pub fn with_metadata(self, metadata: NotificationMetadata) -> Self
Set metadata.
Trait Implementations§
Source§impl Clone for Notification
impl Clone for Notification
Source§fn clone(&self) -> Notification
fn clone(&self) -> Notification
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Notification
impl Debug for Notification
Source§impl<'de> Deserialize<'de> for Notification
impl<'de> Deserialize<'de> for Notification
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Notification
impl RefUnwindSafe for Notification
impl Send for Notification
impl Sync for Notification
impl Unpin for Notification
impl UnwindSafe for Notification
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