Debian Codegraph @

examples/progress.rs

raw symbols SCIP
1 #[cfg(any(target_os = "windows", target_os = "macos"))]
2 fn main() {
3 println!("this is an xdg only feature")
4 }
5
6 #[cfg(all(unix, not(target_os = "macos")))]
7 fn main() -> Result<(), Box<dyn std::error::Error>> {
8 let mut notification = notify_rust::Notification::new()
9 .summary("progress")
10 .show()?;
11 for i in 0..=10 {
12 let value = i * 10;
13 notification
14 .body(&format!("progress {}%", value))
15 .hint(notify_rust::Hint::CustomInt("value".to_string(), value));
16 std::thread::sleep(std::time::Duration::from_secs(1));
17 notification.update().unwrap();
18 }
19 Ok(())
20 }