Toaster::shown: the titles and severities on show, for owners and tests

This commit is contained in:
ZacharyZhang-NY committed 2026-10-09 10:50:01 -04:00
1 parent b0dbfd429c
commit f834f55c16
2 files changed
+18

No files matched your search

+6
View File
@@ -125,6 +125,12 @@ impl Toaster {
id
}
/// The titles and severities on show, oldest first.
pub fn shown(&self) -> Vec<(SharedString, Option<Severity>)> {
let staying = self.live.iter().filter(|live| !live.leaving);
staying.map(|live| (live.toast.title.clone(), live.toast.severity)).collect()
}
/// Sends a toast away: it fades and folds, then leaves the stack.
pub fn dismiss(&mut self, id: u64, cx: &mut Context<Self>) {
let Some(live) = self