Debian Codegraph @

src/notification_id.rs

raw symbols SCIP
1 /// A platform-independent notification identifier.
2 ///
3 /// On XDG (Linux/BSD) notifications are identified by a server-assigned `u32`.
4 /// On macOS (`preview-macos-un`) they use a caller-supplied `String`.
5 ///
6 /// Both variants implement `From`, so you can pass either type directly to
7 /// [`Notification::id`](crate::Notification::id):
8 ///
9 /// ```no_run
10 /// # use notify_rust::Notification;
11 /// // XDG — pass a u32
12 /// # #[cfg(all(unix, not(target_os = "macos")))]
13 /// Notification::new().id(42u32).show().unwrap();
14 ///
15 /// // macOS — pass a &str or String
16 /// # #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
17 /// Notification::new().id("my-app.status").show().unwrap();
18 /// ```
19 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
20 pub enum NotificationIdrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId# {
21 /// XDG / D-Bus numeric identifier (Linux, BSD).
22 Xdgrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId#Xdg#(u32),
23
24 /// macOS `UNNotificationRequest` string identifier.
25 Macrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId#Mac#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
26 }
27
28 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<u32> for NotificationIdrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId# {
29 fn fromrust-analyzer cargo notify-rust 4.18.0 notification_id/impl#[NotificationId][`From<u32>`]from().(value: u32) -> Selfrust-analyzer cargo notify-rust 4.18.0 notification_id/impl#[NotificationId][`From<u32>`] {
30 NotificationIdrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId#::Xdgrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId#Xdg#(value)
31 }
32 }
33
34 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> for NotificationIdrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId# {
35 fn fromrust-analyzer cargo notify-rust 4.18.0 notification_id/impl#[NotificationId][`From<String>`]from().(value: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Selfrust-analyzer cargo notify-rust 4.18.0 notification_id/impl#[NotificationId][`From<String>`] {
36 NotificationIdrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId#::Macrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId#Mac#(value)
37 }
38 }
39
40 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&str> for NotificationIdrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId# {
41 fn fromrust-analyzer cargo notify-rust 4.18.0 notification_id/impl#[NotificationId][`From<&str>`]from().(value: &str) -> Selfrust-analyzer cargo notify-rust 4.18.0 notification_id/impl#[NotificationId][`From<&str>`] {
42 NotificationIdrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId#::Macrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId#Mac#(value.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())
43 }
44 }