From 7aa48def4c365188af3f755a76425756be0c44f3 Mon Sep 17 00:00:00 2001 From: szymon Date: Sun, 4 Oct 2026 15:08:47 +0200 Subject: [PATCH] docs: add doctest to notification::set_timeout --- src/api/notification.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/api/notification.rs b/src/api/notification.rs index a3557e1..d014058 100644 --- a/src/api/notification.rs +++ b/src/api/notification.rs @@ -394,6 +394,26 @@ impl<'a> Notification { /// Sets the timeout of the notification. /// /// Note that the timeout may be ignored by the server. + /// + /// # Example + /// ``` + /// use libnotify_rs::api::{ + /// functions::{init, uninit}, + /// notification::{self, Notification}, + /// }; + /// + /// fn main() -> Result<(), Box> { + /// init("I love coffee")?; + /// let mut notify = Notification::new( + /// "Remember to drink coffe!", + /// "Coffee is very important for your mental health!", + /// None, + /// )?; + /// + /// notify.set_timeout(notification::Timeout::Custom(1000 * 10)); // 10 secs + /// Ok(()) + /// } + /// ``` pub fn set_timeout(&mut self, timeout: Timeout) { let timeout_c = match timeout { Timeout::Default => NOTIFY_EXPIRES_DEFAULT,