Show desktop notifications on Windows
```rust use std::{thread::sleep, time::Duration as Dur}; use windowstoast::{ActivationType, Crop, Duration, Toast, MSEDGEAPP_ID};
fn main() { let handler = Toast::new(MSEDGEAPPID) .settitle("Hello from Rust! 🦀") .setdescription("It works!") .setaudio("ms-winsoundevent:Notification.Looping.Alarm", true) .setimage("https://rustacean.net/assets/rustacean-flat-happy.png") .seticon( "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", Crop::Circle, ) .addbutton( "Yes!", "https://www.rust-lang.org", ActivationType::Protocol, ) .addbutton( "Certainly!", "https://www.rust-lang.org", ActivationType::Protocol, ) .setduration(Duration::Long) .setprogress("Downloading", "Active", "0.2", "2/10") .setselection(vec!["Rust 1", "Rust 2", "Rust 3"], "selection") .setinput("Message", "msg") .onclick("https://www.rust-lang.org/learn/get-started") .onactivated(Box::new(move |args| { println!("Activated! Args: {:?}", args); })) .ondismissed(Box::new(move |args| { println!("Dismissed! Reason: {:?}", args); })) .on_failed(Box::new(move |args| { println!("Failed! Reason: {:?}", args); })) .show() .unwrap();
let mut i = 0;
while i != 8 {
sleep(Dur::from_secs(1));
i += 2;
handler
.update_progress(
"Downloading",
"Active",
&format!("0.{}", i),
&format!("{}/10", i),
)
.unwrap();
}
sleep(Dur::from_secs(1));
handler
.update_progress("Success", "Done", "1.0", "10/10. Bye!")
.unwrap();
sleep(Dur::from_secs(2));
handler.hide().unwrap();
}
```