Debian Codegraph @

examples/mac_app_id.rs

raw symbols SCIP
1 fn mainrust-analyzer cargo notify-rust 4.18.0 main().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
2 cfg_ifrust-analyzer cargo cfg-if 1.0.4 crate/::cfg_ifrust-analyzer cargo cfg-if 1.0.4 cfg_if!! {
3 if #[cfg(all(target_os = "macos", not(feature = "preview-macos-un")))] {
4 use notify_rustrust-analyzer cargo notify-rust 4.18.0 crate/::{
5 errorrust-analyzer cargo notify-rust 4.18.0 error/::MacOsError, get_bundle_identifier_or_default, set_application, Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#,
6 };
7
8 let safari_id = get_bundle_identifier_or_default("Safari");
9 set_application(&safari_id).map_err(|f| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{f}"))?;
10
11 match set_application(&safari_id) {
12 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(_) => {}
13 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(MacOsError::Application(error)) => printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{error}"),
14 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(MacOsError::Notification(error)) => printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{error}"),
15 }
16
17 Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::new()
18 .summary("Safari Crashed")
19 .body("Just kidding, this is just the notify_rust example.")
20 .appname("Safari")
21 .icon("Safari")
22 .show()
23 .map_err(|f| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{f}"))?;
24
25 } else if #[cfg(all(target_os = "macos", feature = "preview-macos-un"))] {
26 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("macos app-id is a feature that no longer applies to the un-usernotifications api")
27 } else {
28 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("this is a mac only feature");
29 }
30 }
31 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
32 }