Debian Codegraph @

examples/schedule.rs

raw symbols SCIP
1 #![allow(unused_imports)]
2 mod commonrust-analyzer cargo notify-rust 4.18.0 common/;
3
4 fn mainrust-analyzer cargo notify-rust 4.18.0 main().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#>> {
5 cfg_ifrust-analyzer cargo cfg-if 1.0.4 crate/::cfg_ifrust-analyzer cargo cfg-if 1.0.4 cfg_if!! {
6 if #[cfg(target_os = "macos")] {
7 if !commonrust-analyzer cargo notify-rust 4.18.0 common/::setuprust-analyzer cargo notify-rust 4.18.0 common/setup().(filerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/file!!()) {
8 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(());
9 }
10 use notify_rustrust-analyzer cargo notify-rust 4.18.0 crate/::Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#;
11
12 let duration = chrono::Duration::milliseconds(4321);
13 let timestamp = (chrono::Utc::now() + duration).timestamp() as f64;
14
15 Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::new()
16 .summary("Oh by the way")
17 .body(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("this was scheduled {:?} ago", duration))
18 .schedule(chrono::Utc::now() + duration)?;
19
20 Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::new()
21 .summary("Oh by the way")
22 .body(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("this was scheduled for timestamp {}", timestamp))
23 .schedule_raw(timestamp)?;
24
25 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
26 } else {
27 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("this is a mac only feature");
28 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
29 }
30 }
31 }