pub struct NotificationQueue { /* private fields */ }Expand description
Notification queue manager.
Manages multiple toast notifications with priority ordering, deduplication,
and automatic expiry. Use push to add notifications and tick to process
expiry in your event loop.
Implementations§
Source§impl NotificationQueue
impl NotificationQueue
Sourcepub fn new(config: QueueConfig) -> Self
pub fn new(config: QueueConfig) -> Self
Create a new notification queue with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a new queue with default configuration.
Sourcepub fn push(&mut self, toast: Toast, priority: NotificationPriority) -> bool
pub fn push(&mut self, toast: Toast, priority: NotificationPriority) -> bool
Push a notification to the queue.
Returns true if the notification was accepted, false if it was
rejected due to deduplication or queue overflow.
Sourcepub fn dismiss_all(&mut self)
pub fn dismiss_all(&mut self)
Dismiss all notifications.
Sourcepub fn tick(&mut self, _delta: Duration) -> Vec<QueueAction>
pub fn tick(&mut self, _delta: Duration) -> Vec<QueueAction>
Process a time tick, handling expiry and promotion.
Call this regularly in your event loop (e.g., every frame or every 16ms). Returns a list of actions to perform.
Sourcepub fn visible_mut(&mut self) -> &mut [Toast]
pub fn visible_mut(&mut self) -> &mut [Toast]
Get mutable access to visible toasts.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get the number of notifications waiting in the queue.
Sourcepub fn visible_count(&self) -> usize
pub fn visible_count(&self) -> usize
Get the number of visible toasts.
Sourcepub fn total_count(&self) -> usize
pub fn total_count(&self) -> usize
Get the total count (visible + pending).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check if the queue is empty (no visible or pending notifications).
Sourcepub fn stats(&self) -> &QueueStats
pub fn stats(&self) -> &QueueStats
Get queue statistics.
Sourcepub fn config(&self) -> &QueueConfig
pub fn config(&self) -> &QueueConfig
Get the configuration.