Debian Codegraph @

src/notification.rs

raw symbols SCIP
1 #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
2 use mac_usernotifications::InterruptionLevel;
3
4 #[cfg(all(unix, not(target_os = "macos")))]
5 use craterust-analyzer cargo notify-rust 4.18.0 crate/::{
6 hintsrust-analyzer cargo notify-rust 4.18.0 hints/::{CustomHintTyperust-analyzer cargo notify-rust 4.18.0 hints/CustomHintType#, Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#},
7 urgencyrust-analyzer cargo notify-rust 4.18.0 urgency/::Urgencyrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#,
8 xdgrust-analyzer cargo notify-rust 4.18.0 xdg/,
9 };
10
11 #[cfg(all(unix, not(target_os = "macos"), feature = "images_no_default_features"))]
12 use craterust-analyzer cargo notify-rust 4.18.0 crate/::imagerust-analyzer cargo notify-rust 4.18.0 image/::Imagerust-analyzer cargo notify-rust 4.18.0 image/Image#;
13
14 #[cfg(all(unix, target_os = "macos"))]
15 use craterust-analyzer cargo notify-rust 4.18.0 crate/::macos;
16 #[cfg(target_os = "windows")]
17 use craterust-analyzer cargo notify-rust 4.18.0 crate/::{windows, Urgencyrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#};
18
19 use craterust-analyzer cargo notify-rust 4.18.0 crate/::{errorrust-analyzer cargo notify-rust 4.18.0 error/::*, timeoutrust-analyzer cargo notify-rust 4.18.0 timeout/::Timeoutrust-analyzer cargo notify-rust 4.18.0 timeout/Timeout#};
20
21 #[cfg(all(unix, not(target_os = "macos")))]
22 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#};
23
24 // Returns the name of the current executable, used as a default for `Notification.appname`.
25 fn exe_namerust-analyzer cargo notify-rust 4.18.0 notification/exe_name().() -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
26 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::current_exerust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/current_exe().()
27 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()
28 .file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]file_name().()
29 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
30 .to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_str().()
31 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()
32 .to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()
33 }
34
35 /// Desktop notification.
36 ///
37 /// A desktop notification is configured via builder pattern, before it is launched with `show()`.
38 ///
39 /// # Example
40 /// ``` no_run
41 /// # use notify_rust::*;
42 /// # fn _doc() -> Result<(), Box<dyn std::error::Error>> {
43 /// Notification::new()
44 /// .summary("☝️ A notification")
45 /// .show()?;
46 /// # Ok(())
47 /// # }
48 /// ```
49 #[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:)]
50 #[non_exhaustive]
51 pub struct Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
52 /// Filled by default with the executable name.
53 pub appnamerust-analyzer cargo notify-rust 4.18.0 notification/Notification#appname.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
54
55 /// Single line to summarize the content.
56 pub summaryrust-analyzer cargo notify-rust 4.18.0 notification/Notification#summary.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
57
58 /// Subtitle for macOS.
59 pub subtitlerust-analyzer cargo notify-rust 4.18.0 notification/Notification#subtitle.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
60
61 /// Multiple lines possible, may support simple markup.
62 /// Check out [`get_capabilities()`](crate::get_capabilities) -> `body-markup` and `body-hyperlinks`.
63 pub bodyrust-analyzer cargo notify-rust 4.18.0 notification/Notification#body.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
64
65 /// Use a `file://` URI or a name in an icon theme, must be compliant with freedesktop.org.
66 pub iconrust-analyzer cargo notify-rust 4.18.0 notification/Notification#icon.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
67
68 /// Check out [`Hint`].
69 ///
70 /// # Warning
71 /// This does not hold all hints. [`Hint::Custom`] and [`Hint::CustomInt`] are held elsewhere.
72 // /// please access hints via [`Notification::get_hints`].
73 #[cfg(all(unix, not(target_os = "macos")))]
74 pub hintsrust-analyzer cargo notify-rust 4.18.0 notification/Notification#hints.: HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#>,
75
76 #[cfg(all(unix, not(target_os = "macos")))]
77 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) hints_uniquerust-analyzer cargo notify-rust 4.18.0 notification/Notification#hints_unique.: 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#, CustomHintTyperust-analyzer cargo notify-rust 4.18.0 hints/CustomHintType#), Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#>,
78
79 /// See [`Notification::actions()`] and [`Notification::action()`].
80 pub actionsrust-analyzer cargo notify-rust 4.18.0 notification/Notification#actions.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
81
82 #[cfg(target_os = "macos")]
83 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) sound_name: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
84
85 #[cfg(target_os = "windows")]
86 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) sound_name: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
87
88 #[cfg(any(target_os = "windows", target_os = "macos"))]
89 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) path_to_image: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
90
91 #[cfg(target_os = "windows")]
92 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) app_id: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
93
94 #[cfg(target_os = "windows")]
95 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) urgency: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Urgencyrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#>,
96
97 #[cfg(all(unix, not(target_os = "macos")))]
98 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) busrust-analyzer cargo notify-rust 4.18.0 notification/Notification#bus.: xdgrust-analyzer cargo notify-rust 4.18.0 xdg/::NotificationBusrust-analyzer cargo notify-rust 4.18.0 xdg/bus/NotificationBus#,
99
100 /// Lifetime of the notification in ms. Often not respected by the server.
101 pub timeoutrust-analyzer cargo notify-rust 4.18.0 notification/Notification#timeout.: Timeoutrust-analyzer cargo notify-rust 4.18.0 timeout/Timeout#, // both gnome and galago want allow for -1
102
103 /// Interruption level (macOS only; has effect with the `preview-macos-un` feature).
104 #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
105 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) interruption_level: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<InterruptionLevel>,
106
107 /// Only to be used on the receive end. Use [`NotificationHandle`](crate::NotificationHandle) for updating.
108 #[cfg(not(all(target_os = "macos", feature = "preview-macos-un")))]
109 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) idrust-analyzer cargo notify-rust 4.18.0 notification/Notification#id.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u32>,
110
111 /// Notification identifier for the macOS UN backend.
112 #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
113 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) id: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<craterust-analyzer cargo notify-rust 4.18.0 crate/::notification_idrust-analyzer cargo notify-rust 4.18.0 notification_id/::NotificationIdrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId#>,
114 }
115
116 impl Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
117 /// Constructs a new Notification.
118 ///
119 /// Most fields are empty by default, only `appname` is initialized with the name of the current
120 /// executable.
121 ///
122 /// The `appname` is used by some desktop environments to group notifications.
123 pub fn newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() -> Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
124 Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::defaultrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification][Default]default().()
125 }
126
127 /// This is for testing purposes only and will not work with actual implementations.
128 #[cfg(all(unix, not(target_os = "macos")))]
129 #[doc(hidden)]
130 #[deprecated(note = "this is a test only feature")]
131 pub fn at_busrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]at_bus().(sub_bus: &str) -> Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
132 let bus = xdgrust-analyzer cargo notify-rust 4.18.0 xdg/::NotificationBusrust-analyzer cargo notify-rust 4.18.0 xdg/bus/NotificationBus#::customrust-analyzer cargo notify-rust 4.18.0 xdg/bus/impl#[NotificationBus]custom().(sub_bus)
133 .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().("invalid subpath")
134 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
135 Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
136 busrust-analyzer cargo notify-rust 4.18.0 notification/Notification#bus.,
137 ..Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::defaultrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification][Default]default().()
138 }
139 }
140
141 /// Overwrite the `appname` field used for the notification.
142 ///
143 /// # Platform Support
144 /// This method has no effect on macOS. There you can only set the application via [`set_application()`](fn.set_application.html).
145 pub fn appnamerust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]appname().(&mut self, appname: &str) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
146 appname.clone_intorust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]clone_into().(&mut self.appnamerust-analyzer cargo notify-rust 4.18.0 notification/Notification#appname.);
147 self
148 }
149
150 /// Set the `summary`.
151 ///
152 /// Often acts as the title of the notification. For more elaborate content use the `body` field.
153 pub fn summaryrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]summary().(&mut self, summary: &str) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
154 summary.clone_intorust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]clone_into().(&mut self.summaryrust-analyzer cargo notify-rust 4.18.0 notification/Notification#summary.);
155 self
156 }
157
158 /// Set the `subtitle`.
159 ///
160 /// Only useful on macOS. Not part of the XDG specification.
161 pub fn subtitlerust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]subtitle().(&mut self, subtitle: &str) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
162 self.subtitlerust-analyzer cargo notify-rust 4.18.0 notification/Notification#subtitle. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(subtitle.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().());
163 self
164 }
165
166 /// Manual wrapper for [`Hint::ImageData`].
167 #[cfg(all(feature = "images_no_default_features", unix, not(target_os = "macos")))]
168 pub fn image_datarust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]image_data().(&mut self, image: Imagerust-analyzer cargo notify-rust 4.18.0 image/Image#) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
169 self.hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ImageDatarust-analyzer cargo notify-rust 4.18.0 hints/Hint#ImageData#(image));
170 self
171 }
172
173 /// Sets the image path for the notification.
174 ///
175 /// The path is passed to the platform's native notification API directly — no additional
176 /// dependencies or crate features are required.
177 ///
178 /// Platform behaviour:
179 /// - **Linux/BSD (XDG):** maps to the `image-path` hint in the D-Bus notification spec.
180 /// - **macOS:** maps to `content_image` in `mac-notification-sys`, displayed on the right
181 /// side of the notification banner.
182 /// - **Windows:** passed directly to `winrt-notification` as the notification image.
183 pub fn image_pathrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]image_path().(&mut self, path: &str) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
184 #[cfg(all(unix, not(target_os = "macos")))]
185 {
186 self.hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ImagePathrust-analyzer cargo notify-rust 4.18.0 hints/Hint#ImagePath#(path.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()));
187 }
188 #[cfg(any(target_os = "macos", target_os = "windows"))]
189 {
190 self.path_to_image = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(path.to_string());
191 }
192 self
193 }
194
195 /// Sets the app's `System.AppUserModel.ID`.
196 #[cfg(target_os = "windows")]
197 pub fn app_id(&mut self, app_id: &str) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
198 selfrust-analyzer cargo notify-rust 4.18.0 notification/.app_id = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(app_id.to_string());
199 selfrust-analyzer cargo notify-rust 4.18.0 notification/
200 }
201
202 /// Wrapper for [`Hint::ImageData`].
203 #[cfg(all(feature = "images_no_default_features", unix, not(target_os = "macos")))]
204 pub fn imagerust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]image().<T: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#> + Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>(
205 &mut self,
206 path: T,
207 ) -> Resultrust-analyzer cargo notify-rust 4.18.0 error/Result#<&mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#> {
208 let img = Imagerust-analyzer cargo notify-rust 4.18.0 image/Image#::openrust-analyzer cargo notify-rust 4.18.0 image/impl#[Image]open().(&path)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
209 self.hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ImageDatarust-analyzer cargo notify-rust 4.18.0 hints/Hint#ImageData#(img));
210 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(self)
211 }
212
213 /// Wrapper for [`Hint::SoundName`].
214 #[cfg(all(unix, not(target_os = "macos")))]
215 pub fn sound_namerust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]sound_name().(&mut self, name: &str) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
216 self.hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SoundNamerust-analyzer cargo notify-rust 4.18.0 hints/Hint#SoundName#(name.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()));
217 self
218 }
219
220 /// Set the `sound_name` for the `NSUserNotification`.
221 #[cfg(any(target_os = "macos", target_os = "windows"))]
222 pub fn sound_name(&mut self, name: &str) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
223 selfrust-analyzer cargo notify-rust 4.18.0 notification/.sound_name = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(name.to_owned());
224 selfrust-analyzer cargo notify-rust 4.18.0 notification/
225 }
226
227 /// Set the interruption level (macOS only; has effect with the `preview-macos-un` feature).
228 ///
229 /// Controls whether the notification breaks through Focus modes on macOS 12+.
230 ///
231 /// # Platform support
232 ///
233 /// This method is only available on macOS when the `preview-macos-un` feature is enabled.
234 /// For a more cross-platform alternative, use `.urgency()`, which is automatically converted to the appropriate `InterruptionLevel` on macOS.
235 #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
236 pub fn interruption_level(&mut self, level: InterruptionLevel) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
237 selfrust-analyzer cargo notify-rust 4.18.0 notification/.interruption_level = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(level);
238 selfrust-analyzer cargo notify-rust 4.18.0 notification/
239 }
240
241 /// Set the content of the `body` field.
242 ///
243 /// Multiline textual content of the notification.
244 /// Each line should be treated as a paragraph.
245 /// Simple html markup should be supported, depending on the server implementation.
246 pub fn bodyrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]body().(&mut self, body: &str) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
247 body.clone_intorust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]clone_into().(&mut self.bodyrust-analyzer cargo notify-rust 4.18.0 notification/Notification#body.);
248 self
249 }
250
251 /// Set the `icon` field.
252 ///
253 /// You can use common icon names here, usually those in `/usr/share/icons`
254 /// can all be used.
255 /// You can also use an absolute path to file.
256 ///
257 /// # Platform support
258 /// macOS does not have support manually setting the icon. However you can pretend to be another app using [`set_application()`](fn.set_application.html)
259 pub fn iconrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]icon().(&mut self, icon: &str) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
260 icon.clone_intorust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]clone_into().(&mut self.iconrust-analyzer cargo notify-rust 4.18.0 notification/Notification#icon.);
261 self
262 }
263
264 /// Set the `icon` field automatically.
265 ///
266 /// This looks at your binary's name and uses it to set the icon.
267 ///
268 /// # Platform support
269 /// macOS does not support manually setting the icon. However you can pretend to be another app using [`set_application()`](fn.set_application.html)
270 pub fn auto_iconrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]auto_icon().(&mut self) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
271 self.iconrust-analyzer cargo notify-rust 4.18.0 notification/Notification#icon. = exe_namerust-analyzer cargo notify-rust 4.18.0 notification/exe_name().();
272 self
273 }
274
275 /// Adds a hint.
276 ///
277 /// This method will add a hint to the internal hint [`HashSet`].
278 /// Hints must be of type [`Hint`].
279 ///
280 /// Many of these are wrapped by more convenient functions such as:
281 ///
282 /// * [`sound_name()`](Self::sound_name)
283 /// * [`urgency()`](Self::urgency)
284 /// * [`image(...)`](#method.image) or
285 /// * [`image_data(...)`](#method.image_data)
286 /// * [`image_path(...)`](#method.image_path)
287 ///
288 /// ```no_run
289 /// # use notify_rust::Notification;
290 /// # use notify_rust::Hint;
291 /// Notification::new().summary("Category:email")
292 /// .body("This should not go away until you acknowledge it.")
293 /// .icon("thunderbird")
294 /// .appname("thunderbird")
295 /// .hint(Hint::Category("email".to_owned()))
296 /// .hint(Hint::Resident(true))
297 /// .show();
298 /// ```
299 ///
300 /// # Platform support
301 /// Most of these hints don't even have an effect on the big XDG Desktops, they are completely tossed on macOS.
302 #[cfg(all(unix, not(target_os = "macos")))]
303 pub fn hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(&mut self, hint: Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
304 match hint {
305 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::CustomIntrust-analyzer cargo notify-rust 4.18.0 hints/Hint#CustomInt#(k, v) => {
306 self.hints_uniquerust-analyzer cargo notify-rust 4.18.0 notification/Notification#hints_unique.
307 .insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().((k.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(), CustomHintTyperust-analyzer cargo notify-rust 4.18.0 hints/CustomHintType#::Intrust-analyzer cargo notify-rust 4.18.0 hints/CustomHintType#Int#), Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::CustomIntrust-analyzer cargo notify-rust 4.18.0 hints/Hint#CustomInt#(k, v));
308 }
309 Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Customrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Custom#(k, v) => {
310 self.hints_uniquerust-analyzer cargo notify-rust 4.18.0 notification/Notification#hints_unique.
311 .insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().((k.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone().(), CustomHintTyperust-analyzer cargo notify-rust 4.18.0 hints/CustomHintType#::Stringrust-analyzer cargo notify-rust 4.18.0 hints/CustomHintType#String#), Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Customrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Custom#(k, v));
312 }
313 _ => {
314 self.hintsrust-analyzer cargo notify-rust 4.18.0 notification/Notification#hints..insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(hint);
315 }
316 }
317 self
318 }
319
320 #[cfg(all(unix, not(target_os = "macos")))]
321 pub(craterust-analyzer cargo notify-rust 4.18.0 crate/) fn get_hintsrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]get_hints().(&self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = &Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#> {
322 self.hintsrust-analyzer cargo notify-rust 4.18.0 notification/Notification#hints..iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]iter().().chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(self.hints_uniquerust-analyzer cargo notify-rust 4.18.0 notification/Notification#hints_unique..valuesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]values().())
323 }
324
325 /// Set the `timeout`.
326 ///
327 /// Accepts multiple types that implement `Into<Timeout>`.
328 ///
329 /// ## `i32`
330 ///
331 /// This sets the time (in milliseconds) from the time the notification is displayed until it is
332 /// closed again by the notification server.
333 /// According to [specification](https://developer.gnome.org/notification-spec/)
334 /// -1 will leave the timeout to be set by the server and
335 /// 0 will cause the notification never to expire.
336 /// ## [Duration](`std::time::Duration`)
337 ///
338 /// When passing a [`Duration`](`std::time::Duration`) we will try convert it into milliseconds.
339 ///
340 ///
341 /// ```
342 /// # use std::time::Duration;
343 /// # use notify_rust::Timeout;
344 /// assert_eq!(Timeout::from(Duration::from_millis(2000)), Timeout::Milliseconds(2000));
345 /// ```
346 /// ### Caveats!
347 ///
348 /// 1. If the duration is zero milliseconds then the original behavior will apply and the notification will **Never** timeout.
349 /// 2. Should the number of milliseconds not fit within an [`i32`] then we will fall back to the default timeout.
350 /// ```
351 /// # use std::time::Duration;
352 /// # use notify_rust::Timeout;
353 /// assert_eq!(Timeout::from(Duration::from_millis(0)), Timeout::Never);
354 /// assert_eq!(Timeout::from(Duration::from_millis(u64::MAX)), Timeout::Default);
355 /// ```
356 ///
357 /// # Platform support
358 /// This only works on XDG Desktops, macOS does not support manually setting the timeout.
359 ///
360 /// TODO: this will become available in 5.0 using `mac-usernotifications` using the new `.response()` api
361 pub fn timeoutrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]timeout().<T: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Timeoutrust-analyzer cargo notify-rust 4.18.0 timeout/Timeout#>>(&mut self, timeout: T) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
362 self.timeoutrust-analyzer cargo notify-rust 4.18.0 notification/Notification#timeout. = timeout.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
363 self
364 }
365
366 /// Set the `urgency`.
367 ///
368 /// Pick between Low, Normal, and Critical.
369 ///
370 /// # Platform support
371 ///
372 /// ## Linux/BSD (XDG)
373 /// Urgency is sent as a hint to the notification server. Most desktops are fairly relaxed
374 /// about urgency and may not change behavior significantly. Critical notifications are
375 /// intended to not timeout automatically.
376 ///
377 /// ## Windows
378 /// Urgency is mapped to toast scenarios:
379 /// - `Low` and `Normal` → Default scenario (standard toast behavior)
380 /// - `Critical` → Reminder scenario (stays on screen until user dismisses)
381 ///
382 /// ## macOS
383 /// Mapped to [`InterruptionLevel`](`mac_usernotifications::InterruptionLevel`): `Low` → `Passive`, `Normal` → `Active`,
384 /// `Critical` → `TimeSensitive`. Use `interruption_level`
385 /// directly for finer control (e.g. `Critical` level that bypasses mute).
386 #[cfg(all(unix, not(target_os = "macos")))]
387 pub fn urgencyrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]urgency().(&mut self, urgency: Urgencyrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
388 self.hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Urgencyrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Urgency#(urgency)); // TODO impl as T where T: Into<Urgency>
389 self
390 }
391
392 /// Set the `urgency`.
393 ///
394 /// Pick between Low, Normal, and Critical.
395 ///
396 /// # Platform support
397 ///
398 /// ## Windows
399 /// Urgency is mapped to toast scenarios:
400 /// - `Low` and `Normal` → Default scenario (standard toast behavior)
401 /// - `Critical` → Reminder scenario (stays on screen until user dismisses)
402 ///
403 /// ## Linux/BSD (XDG)
404 /// See the Unix implementation documentation.
405 ///
406 /// ## macOS
407 /// Mapped to [`InterruptionLevel`]: `Low` → `Passive`, `Normal` → `Active`,
408 /// `Critical` → `TimeSensitive`. Use [`interruption_level`](Self::interruption_level)
409 /// directly for finer control (e.g. `Critical` level that bypasses mute).
410 #[cfg(target_os = "windows")]
411 pub fn urgency(&mut self, urgency: Urgencyrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
412 selfrust-analyzer cargo notify-rust 4.18.0 notification/.urgency = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(urgency);
413 selfrust-analyzer cargo notify-rust 4.18.0 notification/
414 }
415
416 /// Set the `urgency` (macOS).
417 ///
418 /// Maps `Urgency` to the platform-native [`InterruptionLevel`]:
419 /// - `Low` → [`Passive`](InterruptionLevel::Passive)
420 /// - `Normal` → [`Active`](InterruptionLevel::Active)
421 /// - `Critical` → [`TimeSensitive`](InterruptionLevel::TimeSensitive)
422 ///
423 /// For finer control (e.g. the `Critical` interruption level that bypasses
424 /// mute and Do Not Disturb) use [`interruption_level`](Self::interruption_level)
425 /// directly.
426 #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
427 pub fn urgency(&mut self, urgency: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<InterruptionLevel>) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
428 selfrust-analyzer cargo notify-rust 4.18.0 notification/.interruption_level.replace(urgency.into());
429 selfrust-analyzer cargo notify-rust 4.18.0 notification/
430 }
431
432 /// Set `actions`.
433 ///
434 /// To quote <http://www.galago-project.org/specs/notification/0.9/x408.html#command-notify>
435 ///
436 /// > Actions are sent over as a list of pairs.
437 /// > Each even element in the list (starting at index 0) represents the identifier for the action.
438 /// > Each odd element in the list is the localized string that will be displayed to the user.y
439 ///
440 /// There is nothing fancy going on here yet.
441 /// **Careful! This replaces the internal list of actions!**
442 #[deprecated(note = "please use .action() only")]
443 pub fn actionsrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]actions().(&mut self, actions: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
444 self.actionsrust-analyzer cargo notify-rust 4.18.0 notification/Notification#actions. = actions;
445 self
446 }
447
448 /// Add an action.
449 ///
450 /// This adds a single action to the internal list of actions.
451 pub fn actionrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]action().(&mut self, identifier: &str, label: &str) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
452 self.actionsrust-analyzer cargo notify-rust 4.18.0 notification/Notification#actions..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(identifier.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().());
453 self.actionsrust-analyzer cargo notify-rust 4.18.0 notification/Notification#actions..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(label.to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().());
454 self
455 }
456
457 /// Set an id ahead of time.
458 ///
459 /// Setting the id ahead of time allows overriding a known other notification.
460 /// If you want to update a notification, it is easier to use the `update()` method of
461 /// the `NotificationHandle` object that `show()` returns.
462 ///
463 /// (XDG, Windows, and legacy macOS)
464 #[cfg(not(all(target_os = "macos", feature = "preview-macos-un")))]
465 pub fn idrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]id().(&mut self, id: u32) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
466 self.idrust-analyzer cargo notify-rust 4.18.0 notification/Notification#id. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(id);
467 self
468 }
469
470 /// Set a notification identifier (macOS `preview-macos-un` path).
471 ///
472 /// Re-posting with the same identifier replaces the existing notification.
473 #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
474 pub fn id(
475 &mut self,
476 id: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<craterust-analyzer cargo notify-rust 4.18.0 crate/::notification_idrust-analyzer cargo notify-rust 4.18.0 notification_id/::NotificationIdrust-analyzer cargo notify-rust 4.18.0 notification_id/NotificationId#>,
477 ) -> &mut Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
478 selfrust-analyzer cargo notify-rust 4.18.0 notification/.id = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(id.into());
479 selfrust-analyzer cargo notify-rust 4.18.0 notification/
480 }
481
482 /// Finalizes a notification.
483 ///
484 /// Part of the builder pattern, returns a complete copy of the built notification.
485 pub fn finalizerust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]finalize().(&self) -> Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
486 self.clonerust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification][Clone]clone().()
487 }
488
489 /// Schedules a notification to be sent at the specified date.
490 #[cfg(all(target_os = "macos", feature = "chrono"))]
491 pub fn schedule<T: chrono::TimeZone>(
492 &self,
493 delivery_date: chrono::DateTime<T>,
494 ) -> Resultrust-analyzer cargo notify-rust 4.18.0 error/Result#<macos::NotificationHandle> {
495 macos::schedule_notification(selfrust-analyzer cargo notify-rust 4.18.0 notification/, delivery_date.timestamp() as f64)
496 }
497
498 /// Schedules a notification to be sent at the specified timestamp.
499 ///
500 /// This is a raw `f64`. If you prefer a typed date, activate the `"chrono"` feature
501 /// and use [`Notification::schedule()`] instead, which accepts a `chrono::DateTime<T>`.
502 #[cfg(target_os = "macos")]
503 pub fn schedule_raw(&self, timestamp: f64) -> Resultrust-analyzer cargo notify-rust 4.18.0 error/Result#<macos::NotificationHandle> {
504 macos::schedule_notification(selfrust-analyzer cargo notify-rust 4.18.0 notification/, timestamp)
505 }
506
507 /// Sends the notification to D-Bus.
508 ///
509 /// Returns a handle to the notification.
510 #[cfg(all(unix, not(target_os = "macos")))]
511 pub fn showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().(&self) -> Resultrust-analyzer cargo notify-rust 4.18.0 error/Result#<xdgrust-analyzer cargo notify-rust 4.18.0 xdg/::NotificationHandlerust-analyzer cargo notify-rust 4.18.0 xdg/NotificationHandle#> {
512 xdgrust-analyzer cargo notify-rust 4.18.0 xdg/::show_notificationrust-analyzer cargo notify-rust 4.18.0 xdg/show_notification().(self)
513 }
514
515 /// Sends the notification to D-Bus asynchronously.
516 ///
517 /// Returns a handle to the notification.
518 #[cfg(all(unix, not(target_os = "macos")))]
519 #[cfg(feature = "zbus")]
520 pub async fn show_asyncrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show_async().(&self) -> Resultrust-analyzer cargo notify-rust 4.18.0 error/Result#<xdgrust-analyzer cargo notify-rust 4.18.0 xdg/::NotificationHandlerust-analyzer cargo notify-rust 4.18.0 xdg/NotificationHandle#> {
521 xdgrust-analyzer cargo notify-rust 4.18.0 xdg/::show_notification_asyncrust-analyzer cargo notify-rust 4.18.0 xdg/show_notification_async().(self).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().
522 }
523
524 /// Sends the notification to D-Bus at the given sub-bus path.
525 ///
526 /// Returns a handle to the notification.
527 #[cfg(all(unix, not(target_os = "macos")))]
528 #[cfg(feature = "zbus")]
529 // #[cfg(test)]
530 pub async fn show_async_at_busrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show_async_at_bus().(&self, sub_bus: &str) -> Resultrust-analyzer cargo notify-rust 4.18.0 error/Result#<xdgrust-analyzer cargo notify-rust 4.18.0 xdg/::NotificationHandlerust-analyzer cargo notify-rust 4.18.0 xdg/NotificationHandle#> {
531 let bus = xdgrust-analyzer cargo notify-rust 4.18.0 xdg/::NotificationBusrust-analyzer cargo notify-rust 4.18.0 xdg/bus/NotificationBus#::customrust-analyzer cargo notify-rust 4.18.0 xdg/bus/impl#[NotificationBus]custom().(sub_bus).ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().("invalid subpath")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
532 xdgrust-analyzer cargo notify-rust 4.18.0 xdg/::show_notification_async_at_busrust-analyzer cargo notify-rust 4.18.0 xdg/show_notification_async_at_bus().(self, bus).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().
533 }
534
535 /// Sends Notification to `NSUserNotificationCenter` (default) or
536 /// `UNUserNotificationCenter` (with `preview-macos-un` feature).
537 #[cfg(target_os = "macos")]
538 pub fn show(&self) -> Resultrust-analyzer cargo notify-rust 4.18.0 error/Result#<macos::NotificationHandle> {
539 macos::show_notification(selfrust-analyzer cargo notify-rust 4.18.0 notification/)
540 }
541
542 /// Sends notification asynchronously via `UNUserNotificationCenter`.
543 ///
544 /// Only available with the `preview-macos-un` feature.
545 #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
546 pub async fn show_async(&self) -> Resultrust-analyzer cargo notify-rust 4.18.0 error/Result#<macos::NotificationHandle> {
547 macos::show_notification_async(selfrust-analyzer cargo notify-rust 4.18.0 notification/).await
548 }
549
550 /// Sends Notification as a toast notification.
551 #[cfg(target_os = "windows")]
552 pub fn show(&self) -> Resultrust-analyzer cargo notify-rust 4.18.0 error/Result#<windows::NotificationHandle> {
553 windows::show_notification(selfrust-analyzer cargo notify-rust 4.18.0 notification/)
554 }
555
556 /// Wraps [`Notification::show()`] but prints the notification to stdout.
557 #[cfg(all(unix, not(target_os = "macos")))]
558 #[deprecated = "this was never meant to be public API"]
559 pub fn show_debugrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show_debug().(&mut self) -> Resultrust-analyzer cargo notify-rust 4.18.0 error/Result#<xdgrust-analyzer cargo notify-rust 4.18.0 xdg/::NotificationHandlerust-analyzer cargo notify-rust 4.18.0 xdg/NotificationHandle#> {
560 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!(
561 "Notification:\n{appname}: ({icon}) {summary:?} {body:?}\nhints: [{hints:?}]\n",
562 appname = self.appnamerust-analyzer cargo notify-rust 4.18.0 notification/Notification#appname.,
563 summary = self.summaryrust-analyzer cargo notify-rust 4.18.0 notification/Notification#summary.,
564 body = self.bodyrust-analyzer cargo notify-rust 4.18.0 notification/Notification#body.,
565 hints = self.hintsrust-analyzer cargo notify-rust 4.18.0 notification/Notification#hints.,
566 icon = self.iconrust-analyzer cargo notify-rust 4.18.0 notification/Notification#icon.,
567 );
568 self.showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()
569 }
570 }
571
572 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
573 #[cfg(all(unix, not(target_os = "macos")))]
574 fn defaultrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification][Default]default().() -> Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
575 Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
576 appnamerust-analyzer cargo notify-rust 4.18.0 notification/Notification#appname.: exe_namerust-analyzer cargo notify-rust 4.18.0 notification/exe_name().(),
577 summaryrust-analyzer cargo notify-rust 4.18.0 notification/Notification#summary.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(),
578 subtitlerust-analyzer cargo notify-rust 4.18.0 notification/Notification#subtitle.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
579 bodyrust-analyzer cargo notify-rust 4.18.0 notification/Notification#body.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(),
580 iconrust-analyzer cargo notify-rust 4.18.0 notification/Notification#icon.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(),
581 hintsrust-analyzer cargo notify-rust 4.18.0 notification/Notification#hints.: HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T>`]new().(),
582 hints_uniquerust-analyzer cargo notify-rust 4.18.0 notification/Notification#hints_unique.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(),
583 actionsrust-analyzer cargo notify-rust 4.18.0 notification/Notification#actions.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(),
584 timeoutrust-analyzer cargo notify-rust 4.18.0 notification/Notification#timeout.: Timeoutrust-analyzer cargo notify-rust 4.18.0 timeout/Timeout#::Defaultrust-analyzer cargo notify-rust 4.18.0 timeout/Timeout#Default#,
585 busrust-analyzer cargo notify-rust 4.18.0 notification/Notification#bus.: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo notify-rust 4.18.0 xdg/bus/impl#[NotificationBus][Default]default().(),
586 idrust-analyzer cargo notify-rust 4.18.0 notification/Notification#id.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
587 }
588 }
589
590 #[cfg(target_os = "macos")]
591 fn default() -> Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
592 Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
593 appname: exe_namerust-analyzer cargo notify-rust 4.18.0 notification/exe_name().(),
594 summary: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::new(),
595 subtitle: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
596 body: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::new(),
597 icon: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::new(),
598 actions: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::new(),
599 timeout: Timeoutrust-analyzer cargo notify-rust 4.18.0 timeout/Timeout#::Defaultrust-analyzer cargo notify-rust 4.18.0 timeout/Timeout#Default#,
600 sound_name: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::default(),
601 path_to_image: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
602 #[cfg(all(target_os = "macos", feature = "preview-macos-un"))]
603 interruption_level: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
604 id: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
605 }
606 }
607
608 #[cfg(target_os = "windows")]
609 fn default() -> Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
610 Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification# {
611 appname: exe_namerust-analyzer cargo notify-rust 4.18.0 notification/exe_name().(),
612 summary: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::new(),
613 subtitle: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
614 body: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::new(),
615 icon: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::new(),
616 actions: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::new(),
617 timeout: Timeoutrust-analyzer cargo notify-rust 4.18.0 timeout/Timeout#::Defaultrust-analyzer cargo notify-rust 4.18.0 timeout/Timeout#Default#,
618 sound_name: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::default(),
619 id: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
620 path_to_image: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
621 app_id: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
622 urgency: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
623 }
624 }
625 }