Debian Codegraph @

examples/interruption_level.rs

raw symbols SCIP
1 //! Demonstrates setting an interruption level on a macOS notification.
2 //!
3 //! Interruption levels control whether a notification breaks through
4 //! Focus modes. Requires macOS 12+.
5 //!
6 //! Run with:
7 //! ```text
8 //! cargo run --example interruption_level --features preview-macos-un
9 //! ```
10
11 #![allow(unused_imports)]
12 mod commonrust-analyzer cargo notify-rust 4.18.0 common/;
13
14 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#>> {
15 cfg_ifrust-analyzer cargo cfg-if 1.0.4 crate/::cfg_ifrust-analyzer cargo cfg-if 1.0.4 cfg_if!! {
16 if #[cfg(all(target_os = "macos", feature = "preview-macos-un"))] {
17 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!!()) {
18 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(());
19 }
20 notify_rustrust-analyzer cargo notify-rust 4.18.0 crate/::check_bundle()?;
21
22 notify_rustrust-analyzer cargo notify-rust 4.18.0 crate/::Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::new()
23 .summary("Time Sensitive")
24 .body("This notification bypasses Focus settings.")
25 .urgency(notify_rustrust-analyzer cargo notify-rust 4.18.0 crate/::InterruptionLevel::TimeSensitive)
26 .show()?;
27
28 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Notification sent.");
29 // TODO: add run_bundled script
30 // add oslog dev-dep
31 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
32 } else {
33 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("this example requires --features preview-macos-un on macOS");
34 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
35 }
36 }
37 }