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>) -> DatabaseMessage
pub fn new(notification_type: impl Into<String>) -> DatabaseMessage
Create a new database message with a type.
Sourcepub fn data<V>(self, key: impl Into<String>, value: V) -> DatabaseMessagewhere
V: Serialize,
pub fn data<V>(self, key: impl Into<String>, value: V) -> DatabaseMessagewhere
V: Serialize,
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<DatabaseMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DatabaseMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for DatabaseMessage
impl Serialize for DatabaseMessage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more