expires/
expires.rs

1use std::time::Duration;
2
3use win32_notif::{
4  notification::{
5    audio::{Audio, Src},
6    visual::Text,
7    ToastDuration,
8  },
9  NotificationBuilder, ToastsNotifier,
10};
11
12fn main() {
13  let notifier = ToastsNotifier::new("Microsoft.Windows.Explorer").unwrap();
14
15  let notif = NotificationBuilder::new()
16    .audio(Audio::new(Src::Reminder, true, false))
17    .visual(Text::create(
18      1,
19      "This will automatically vanish (exp: 10secs)!",
20    ))
21    .with_duration(ToastDuration::Short)
22    .with_expiry(Duration::from_secs(10))
23    .build(0, &notifier, "01", "ahq")
24    .expect("Unable to build notification");
25
26  _ = notif.show();
27}