Debian Codegraph @

src/hints/message.rs

raw symbols SCIP
1 //! `Hints` allow you to pass extra information to the server.
2 //!
3 //! Many of these are standardized by either:
4 //!
5 //! [galago-project spec](http://www.galago-project.org/specs/notification/0.9/x344.html) or
6 //! [gnome notification-spec](https://developer.gnome.org/notification-spec/#hints)
7 //!
8 //! Which of these are actually implemented depends strongly on the Notification server you talk to.
9 //! Usually the `get_capabilities()` gives some clues, but the standards usually mention much more
10 //! than is actually available.
11 #![cfg_attr(rustfmt, rustfmt_skip)]
12 #![allow(dead_code, unused_imports)]
13
14
15 use superrust-analyzer cargo notify-rust 4.18.0 hints/::{Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#, constantsrust-analyzer cargo notify-rust 4.18.0 hints/constants/::*};
16 use craterust-analyzer cargo notify-rust 4.18.0 crate/ ::Urgencyrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#;
17
18 #[cfg(all(feature = "images_no_default_features", unix, not(target_os = "macos")))]
19 use craterust-analyzer cargo notify-rust 4.18.0 crate/::imagerust-analyzer cargo notify-rust 4.18.0 image/::*;
20
21 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::{HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#, HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#};
22 #[cfg(feature = "dbus")]
23 use dbusrust-analyzer cargo dbus 0.9.12 crate/::argrust-analyzer cargo dbus 0.9.12 arg/::{messageitemrust-analyzer cargo dbus 0.9.12 arg/messageitem/::MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#, RefArgrust-analyzer cargo dbus 0.9.12 arg/msgarg/RefArg#};
24
25 /// All currently implemented `Hints` that can be sent.
26 ///
27 /// as found on <https://developer.gnome.org/notification-spec/>
28 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
29 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) struct HintMessagerust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage#(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#);
30
31 #[cfg(feature = "dbus")]
32 impl HintMessagerust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage# {
33 pub fn wrap_hintrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage]wrap_hint().(hint: Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#) -> (MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#, MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#) {
34 Selfrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage]::fromrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage][`From<Hint>`]from().(hint).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
35 }
36 }
37
38 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#> for HintMessagerust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage# {
39 fn fromrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage][`From<Hint>`]from().(hint: Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#) -> Selfrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage][`From<Hint>`] {
40 HintMessagerust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage#(hint)
41 }
42 }
43
44 impl stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for HintMessagerust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage# {
45 type Targetrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage][Deref]Target# = Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#;
46
47 fn derefrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage][Deref]deref().(&self) -> &Selfrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage][Deref]::Targetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#Target# {
48 &self.0rust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage#0.
49 }
50 }
51
52 #[cfg(feature = "dbus")]
53 impl<'a, A: RefArgrust-analyzer cargo dbus 0.9.12 arg/msgarg/RefArg#> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<(&'a Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, &'a A)> for HintMessagerust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage# {
54 fn fromrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage][`From<(&'a String, &'a A)>`]from().(pair: (&Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, &A)) -> Selfrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage][`From<(&'a String, &'a A)>`] {
55
56 let (key, variant) = pair;
57 match (key.as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AsRef<str>`]as_ref().(), variant.as_u64rust-analyzer cargo dbus 0.9.12 arg/msgarg/RefArg#as_u64().(), variant.as_i64rust-analyzer cargo dbus 0.9.12 arg/msgarg/RefArg#as_i64().(), variant.as_strrust-analyzer cargo dbus 0.9.12 arg/msgarg/RefArg#as_str().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().)) {
58
59 (ACTION_ICONSrust-analyzer cargo notify-rust 4.18.0 hints/constants/ACTION_ICONS., Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1), _, _ ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ActionIconsrust-analyzer cargo notify-rust 4.18.0 hints/Hint#ActionIcons#(true),
60 (ACTION_ICONSrust-analyzer cargo notify-rust 4.18.0 hints/constants/ACTION_ICONS., _, _, _ ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ActionIconsrust-analyzer cargo notify-rust 4.18.0 hints/Hint#ActionIcons#(false),
61 (URGENCYrust-analyzer cargo notify-rust 4.18.0 hints/constants/URGENCY., level, _, _ ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Urgencyrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Urgency#(level.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()),
62 (CATEGORYrust-analyzer cargo notify-rust 4.18.0 hints/constants/CATEGORY., _, _, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(name) ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Categoryrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Category#(name),
63
64 (DESKTOP_ENTRYrust-analyzer cargo notify-rust 4.18.0 hints/constants/DESKTOP_ENTRY., _, _, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(entry)) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::DesktopEntryrust-analyzer cargo notify-rust 4.18.0 hints/Hint#DesktopEntry#(entry),
65 (IMAGE_PATHrust-analyzer cargo notify-rust 4.18.0 hints/constants/IMAGE_PATH., _, _, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(path) ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ImagePathrust-analyzer cargo notify-rust 4.18.0 hints/Hint#ImagePath#(path),
66 (RESIDENTrust-analyzer cargo notify-rust 4.18.0 hints/constants/RESIDENT., Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1), _, _ ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Residentrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Resident#(true),
67 (RESIDENTrust-analyzer cargo notify-rust 4.18.0 hints/constants/RESIDENT., _, _, _ ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Residentrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Resident#(false),
68
69 (SOUND_FILErust-analyzer cargo notify-rust 4.18.0 hints/constants/SOUND_FILE., _, _, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(path) ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SoundFilerust-analyzer cargo notify-rust 4.18.0 hints/Hint#SoundFile#(path),
70 (SOUND_NAMErust-analyzer cargo notify-rust 4.18.0 hints/constants/SOUND_NAME., _, _, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(name) ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SoundNamerust-analyzer cargo notify-rust 4.18.0 hints/Hint#SoundName#(name),
71 (SUPPRESS_SOUNDrust-analyzer cargo notify-rust 4.18.0 hints/constants/SUPPRESS_SOUND., Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1), _, _ ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SuppressSoundrust-analyzer cargo notify-rust 4.18.0 hints/Hint#SuppressSound#(true),
72 (SUPPRESS_SOUNDrust-analyzer cargo notify-rust 4.18.0 hints/constants/SUPPRESS_SOUND., _, _, _ ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SuppressSoundrust-analyzer cargo notify-rust 4.18.0 hints/Hint#SuppressSound#(false),
73 (TRANSIENTrust-analyzer cargo notify-rust 4.18.0 hints/constants/TRANSIENT., Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1), _, _ ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Transientrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Transient#(true),
74 (TRANSIENTrust-analyzer cargo notify-rust 4.18.0 hints/constants/TRANSIENT., _, _, _ ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Transientrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Transient#(false),
75 (Xrust-analyzer cargo notify-rust 4.18.0 hints/constants/X., _, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x), _ ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Xrust-analyzer cargo notify-rust 4.18.0 hints/Hint#X#(x as i32),
76 (Yrust-analyzer cargo notify-rust 4.18.0 hints/constants/Y., _, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(y), _ ) => Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Yrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Y#(y as i32),
77
78 other => {
79 eprintlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/eprintln!!("Invalid Hint{:#?} ", other);
80 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Invalidrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Invalid#
81 }
82 }.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
83 }
84 }
85
86 #[cfg(feature = "dbus")]
87 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<HintMessagerust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage#> for (MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#, MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#) {
88 fn fromrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[`(MessageItem, MessageItem)`][`From<HintMessage>`]from().(hint: HintMessagerust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage#) -> Selfrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[`(MessageItem, MessageItem)`][`From<HintMessage>`] {
89
90 let (key, value): (Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#) = match hint.0rust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage#0. {
91 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ActionIconsrust-analyzer cargo notify-rust 4.18.0 hints/Hint#ActionIcons#(value) => (ACTION_ICONSrust-analyzer cargo notify-rust 4.18.0 hints/constants/ACTION_ICONS. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Boolrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Bool#(value)), // bool
92 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Categoryrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Category#(ref value) => (CATEGORYrust-analyzer cargo notify-rust 4.18.0 hints/constants/CATEGORY. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Strrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Str#(value.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().())),
93 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::DesktopEntryrust-analyzer cargo notify-rust 4.18.0 hints/Hint#DesktopEntry#(ref value) => (DESKTOP_ENTRYrust-analyzer cargo notify-rust 4.18.0 hints/constants/DESKTOP_ENTRY. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Strrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Str#(value.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().())),
94 #[cfg(all(feature = "images_no_default_features", unix, not(target_os ="macos")))]
95 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ImageDatarust-analyzer cargo notify-rust 4.18.0 hints/Hint#ImageData#(image) => (image_specrust-analyzer cargo notify-rust 4.18.0 image/image_spec().(*rust-analyzer cargo notify-rust 4.18.0 impl#[SPEC_VERSION][Deref]deref().craterust-analyzer cargo notify-rust 4.18.0 crate/::SPEC_VERSIONrust-analyzer cargo notify-rust 4.18.0 SPEC_VERSION.), ImageMessagerust-analyzer cargo notify-rust 4.18.0 image/ImageMessage#::fromrust-analyzer cargo notify-rust 4.18.0 image/impl#[ImageMessage][`From<Image>`]from().(image).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()),
96 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ImagePathrust-analyzer cargo notify-rust 4.18.0 hints/Hint#ImagePath#(ref value) => (IMAGE_PATHrust-analyzer cargo notify-rust 4.18.0 hints/constants/IMAGE_PATH. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Strrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Str#(value.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().())),
97 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Residentrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Resident#(value) => (RESIDENTrust-analyzer cargo notify-rust 4.18.0 hints/constants/RESIDENT. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Boolrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Bool#(value)), // bool
98 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SoundFilerust-analyzer cargo notify-rust 4.18.0 hints/Hint#SoundFile#(ref value) => (SOUND_FILErust-analyzer cargo notify-rust 4.18.0 hints/constants/SOUND_FILE. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Strrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Str#(value.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().())),
99 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SoundNamerust-analyzer cargo notify-rust 4.18.0 hints/Hint#SoundName#(ref value) => (SOUND_NAMErust-analyzer cargo notify-rust 4.18.0 hints/constants/SOUND_NAME. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Strrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Str#(value.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().())),
100 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SuppressSoundrust-analyzer cargo notify-rust 4.18.0 hints/Hint#SuppressSound#(value) => (SUPPRESS_SOUNDrust-analyzer cargo notify-rust 4.18.0 hints/constants/SUPPRESS_SOUND. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Boolrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Bool#(value)),
101 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Transientrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Transient#(value) => (TRANSIENTrust-analyzer cargo notify-rust 4.18.0 hints/constants/TRANSIENT. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Boolrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Bool#(value)),
102 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Xrust-analyzer cargo notify-rust 4.18.0 hints/Hint#X#(value) => (Xrust-analyzer cargo notify-rust 4.18.0 hints/constants/X. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Int32rust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Int32#(value)),
103 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Yrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Y#(value) => (Yrust-analyzer cargo notify-rust 4.18.0 hints/constants/Y. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Int32rust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Int32#(value)),
104 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Urgencyrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Urgency#(value) => (URGENCYrust-analyzer cargo notify-rust 4.18.0 hints/constants/URGENCY. .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Byterust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Byte#(value as u8)),
105 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Customrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Custom#(ref key, ref val) => (key .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[T][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Strrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Str#(val.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[T][ToOwned]to_owned(). ())),
106 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::CustomIntrust-analyzer cargo notify-rust 4.18.0 hints/Hint#CustomInt#(ref key, val) => (key .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[T][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Int32rust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Int32#(val)),
107 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Invalidrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Invalid# => ("invalid" .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Strrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Str#("Invalid".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()))
108 };
109
110 (MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Strrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Str#(key), MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Variantrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Variant#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(value)))
111 }
112 }
113
114
115 // TODO: deprecated, Prefer the DBus Arg and RefArg APIs
116 #[cfg(feature = "dbus")]
117 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<(&MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#, &MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#)> for HintMessagerust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage# {
118 fn fromrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage][`From<(&MessageItem, &MessageItem)>`]from(). ((key, mut value): (&MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#, &MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#)) -> Selfrust-analyzer cargo notify-rust 4.18.0 hints/message/impl#[HintMessage][`From<(&MessageItem, &MessageItem)>`] {
119 use Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint# as Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#;
120
121 // If this is a variant, consider the thing inside it
122 // If it's a nested variant, keep drilling down until we get a real value
123 while let MessageItemrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#::Variantrust-analyzer cargo dbus 0.9.12 arg/messageitem/MessageItem#Variant#(inner) = value {
124 value = inner;
125 }
126
127 let is_stringy = value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().::<&str>().is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().();
128
129 match key.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().::<&str>() {
130 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(CATEGORYrust-analyzer cargo notify-rust 4.18.0 hints/constants/CATEGORY.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().::<&str>().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Categoryrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Category#),
131 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ACTION_ICONSrust-analyzer cargo notify-rust 4.18.0 hints/constants/ACTION_ICONS.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ActionIconsrust-analyzer cargo notify-rust 4.18.0 hints/Hint#ActionIcons#),
132 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(DESKTOP_ENTRYrust-analyzer cargo notify-rust 4.18.0 hints/constants/DESKTOP_ENTRY.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().::<&str>().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::DesktopEntryrust-analyzer cargo notify-rust 4.18.0 hints/Hint#DesktopEntry#),
133 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(IMAGE_PATHrust-analyzer cargo notify-rust 4.18.0 hints/constants/IMAGE_PATH.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().::<&str>().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ImagePathrust-analyzer cargo notify-rust 4.18.0 hints/Hint#ImagePath#),
134 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(RESIDENTrust-analyzer cargo notify-rust 4.18.0 hints/constants/RESIDENT.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Residentrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Resident#),
135 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SOUND_FILErust-analyzer cargo notify-rust 4.18.0 hints/constants/SOUND_FILE.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().::<&str>().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SoundFilerust-analyzer cargo notify-rust 4.18.0 hints/Hint#SoundFile#),
136 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SOUND_NAMErust-analyzer cargo notify-rust 4.18.0 hints/constants/SOUND_NAME.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().::<&str>().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SoundNamerust-analyzer cargo notify-rust 4.18.0 hints/Hint#SoundName#),
137 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(SUPPRESS_SOUNDrust-analyzer cargo notify-rust 4.18.0 hints/constants/SUPPRESS_SOUND.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SuppressSoundrust-analyzer cargo notify-rust 4.18.0 hints/Hint#SuppressSound#),
138 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(TRANSIENTrust-analyzer cargo notify-rust 4.18.0 hints/constants/TRANSIENT.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Transientrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Transient#),
139 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Xrust-analyzer cargo notify-rust 4.18.0 hints/constants/X.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Xrust-analyzer cargo notify-rust 4.18.0 hints/Hint#X#),
140 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Yrust-analyzer cargo notify-rust 4.18.0 hints/constants/Y.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Yrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Y#),
141 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(URGENCYrust-analyzer cargo notify-rust 4.18.0 hints/constants/URGENCY.) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|i| match i {
142 0 => Urgencyrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#::Lowrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#Low#,
143 2 => Urgencyrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#::Criticalrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#Critical#,
144 _ => Urgencyrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#::Normalrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#Normal#
145 }).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Urgencyrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Urgency#),
146 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(k) if is_stringy => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().::<&str>().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|v| Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Customrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Custom#(k.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), v.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())),
147 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(k) => value.innerrust-analyzer cargo dbus 0.9.12 arg/messageitem/impl#[MessageItem]inner().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|v| Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::CustomIntrust-analyzer cargo notify-rust 4.18.0 hints/Hint#CustomInt#(k.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), v)),
148 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(()),
149 }.unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Invalidrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Invalid#)
150 .intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
151 }
152 }
153
154
155 #[allow(missing_docs)]
156 #[cfg(feature = "dbus")]
157 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) fn hints_from_variantsrust-analyzer cargo notify-rust 4.18.0 hints/message/hints_from_variants().<A: RefArgrust-analyzer cargo dbus 0.9.12 arg/msgarg/RefArg#>(hints: &HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, A>) -> HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<HintMessagerust-analyzer cargo notify-rust 4.18.0 hints/message/HintMessage#> {
158 hints.iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
159 }