Debian Codegraph @

examples/countdown.rs

raw symbols SCIP
1 #![allow(unused_imports, dead_code)]
2 use notify_rust::Notification;
3 use std::time::Duration;
4
5 #[cfg(any(target_os = "windows", target_os = "macos"))]
6 fn main() {
7 println!("this is a xdg only feature")
8 }
9
10 #[cfg(all(unix, not(target_os = "macos")))]
11 fn main() {
12 let mut notification = Notification::new()
13 .summary("Rocket launch in ...")
14 .body("count down")
15 .icon("clock")
16 .timeout(0)
17 .show()
18 .unwrap();
19
20 for i in 0..11 {
21 std::thread::sleep(Duration::from_millis(1_000));
22 notification
23 .body(&format!("T-minus {}", 10 - i))
24 .appname(&format!("countdown_{}", 10 - i));
25 notification.update().unwrap();
26 println!("{}", 10 - i);
27 }
28 notification
29 .body("TAKE OFF")
30 .appname("countdown_takeoff")
31 .show()
32 .unwrap();
33 }