pub struct DatabaseMessage {
pub notification_type: String,
pub data: HashMap<String, Value>,
}Expand description
A database message for in-app notifications.
Database notifications are stored in the database and can be displayed in the application’s notification center.
Fields§
§notification_type: StringNotification type identifier.
data: HashMap<String, Value>Notification data as key-value pairs.
Implementations§
Source§impl DatabaseMessage
impl DatabaseMessage
Sourcepub fn new(notification_type: impl Into<String>) -> Self
pub fn new(notification_type: impl Into<String>) -> Self
Create a new database message with a type.
Sourcepub fn data<V: Serialize>(self, key: impl Into<String>, value: V) -> Self
pub fn data<V: Serialize>(self, key: impl Into<String>, value: V) -> Self
Add a data field to the notification.
Trait Implementations§
Source§impl Clone for DatabaseMessage
impl Clone for DatabaseMessage
Source§fn clone(&self) -> DatabaseMessage
fn clone(&self) -> DatabaseMessage
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 DatabaseMessage
impl Debug for DatabaseMessage
Source§impl<'de> Deserialize<'de> for DatabaseMessage
impl<'de> Deserialize<'de> for DatabaseMessage
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 DatabaseMessage
impl RefUnwindSafe for DatabaseMessage
impl Send for DatabaseMessage
impl Sync for DatabaseMessage
impl Unpin for DatabaseMessage
impl UnsafeUnpin for DatabaseMessage
impl UnwindSafe for DatabaseMessage
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