pub struct Notification {
pub id: u32,
pub app_name: String,
pub summary: String,
pub body: String,
pub expire_timeout: Option<Duration>,
pub urgency: Urgency,
pub is_read: bool,
pub timestamp: u64,
}
Expand description
Representation of a notification.
Fields§
§id: u32
The optional notification ID.
app_name: String
Name of the application that sends the notification.
summary: String
Summary text.
body: String
Body.
expire_timeout: Option<Duration>
The timeout time in milliseconds.
urgency: Urgency
Urgency.
is_read: bool
Whether if the notification is read.
timestamp: u64
Timestamp that the notification is created.
Implementations§
Source§impl Notification
impl Notification
Sourcepub fn into_context(
&self,
urgency_text: String,
unread_count: usize,
) -> Result<TeraContext>
pub fn into_context( &self, urgency_text: String, unread_count: usize, ) -> Result<TeraContext>
Converts Notification
into TeraContext
.
Sourcepub fn render_message(
&self,
template: &Tera,
urgency_text: Option<String>,
unread_count: usize,
) -> Result<String>
pub fn render_message( &self, template: &Tera, urgency_text: Option<String>, unread_count: usize, ) -> Result<String>
Renders the notification message using the given template.
Sourcepub fn matches_filter(&self, filter: &NotificationFilter) -> bool
pub fn matches_filter(&self, filter: &NotificationFilter) -> bool
Returns true if the given filter matches the notification message.
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 Default for Notification
impl Default for Notification
Source§fn default() -> Notification
fn default() -> Notification
Returns the “default value” for a type. 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