pub struct Notification {
pub id: String,
pub level: NotificationLevel,
pub message: String,
pub duration_ms: u64,
pub created_at: Instant,
pub source: Option<String>,
}Expand description
A single notification
Fields§
§id: StringUnique identifier
level: NotificationLevelSeverity level
message: StringMessage content
duration_ms: u64Duration to display in milliseconds
created_at: InstantWhen the notification was created
source: Option<String>Optional source (e.g., “LSP”, “rust-analyzer”)
Implementations§
Source§impl Notification
impl Notification
Sourcepub fn new(level: NotificationLevel, message: impl Into<String>) -> Self
pub fn new(level: NotificationLevel, message: impl Into<String>) -> Self
Create a new notification
Sourcepub const fn with_duration(self, duration_ms: u64) -> Self
pub const fn with_duration(self, duration_ms: u64) -> Self
Set the duration
Sourcepub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
Set the source
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if this notification has expired
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 moreAuto 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