#[non_exhaustive]pub struct DatabaseMessage {
pub status: ToastKind,
pub title: String,
pub body: Option<String>,
pub url: Option<String>,
pub actions: Vec<ToastAction>,
pub extra: Map<String, Value>,
}Expand description
What a notification stores for the in-app list, in the shape the UI
kit’s notification_bell shows (and pushes as a toast when it arrives):
a status (its icon), a title, a line of text, a link and buttons. Return
it from Notification::to_database with .into(); with adds the
app’s own keys next to them.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.status: ToastKindIts icon and color: success, info, warning or error.
title: StringThe first line.
body: Option<String>A second, lighter line.
url: Option<String>Where opening it goes (it is marked read on the way).
actions: Vec<ToastAction>Links or buttons under the text.
extra: Map<String, Value>The app’s own keys (with), stored next to the others.
Implementations§
Source§impl DatabaseMessage
impl DatabaseMessage
Sourcepub fn new(status: ToastKind, title: impl Into<String>) -> Self
pub fn new(status: ToastKind, title: impl Into<String>) -> Self
A message with status and title.
Sourcepub fn action(self, action: ToastAction) -> Self
pub fn action(self, action: ToastAction) -> Self
Adds a link or button.
Trait Implementations§
Source§impl Clone for DatabaseMessage
impl Clone for DatabaseMessage
Source§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
Source§impl From<DatabaseMessage> for Value
impl From<DatabaseMessage> for Value
Source§fn from(message: DatabaseMessage) -> Self
fn from(message: DatabaseMessage) -> Self
Converts to this type from the input type.
Source§impl PartialEq for DatabaseMessage
impl PartialEq for DatabaseMessage
Source§impl Serialize for DatabaseMessage
impl Serialize for DatabaseMessage
impl StructuralPartialEq for DatabaseMessage
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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