From 60026e6fea9003c9dc1f0660a47817a077eccb1c Mon Sep 17 00:00:00 2001 From: szymon Date: Sun, 4 Oct 2026 14:49:37 +0200 Subject: [PATCH] docs: add doctest to notification::clear_actions --- src/api/notification.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/api/notification.rs b/src/api/notification.rs index 53a2ea4..118330c 100644 --- a/src/api/notification.rs +++ b/src/api/notification.rs @@ -188,6 +188,32 @@ impl<'a> Notification { } /// Clears all actions from the notification + /// + /// # Example + /// ``` + /// use libnotify_rs::api::{ + /// functions::{init, uninit}, + /// notification::Notification, + /// }; + /// + /// fn main() -> Result<(), Box> { + /// init("Test app")?; + /// let mut notification = Notification::new("My notification", "Yap yap", None)?; + /// notification.add_action("default", "yap", |action| { + /// // do stuff + /// })?; + /// + /// notification.add_action("click", "yappers", |action| { + /// // do some other stuff + /// })?; + /// + /// notification.clear_actions(); // now there are no callbacks! + /// + /// uninit(); + /// Ok(()) + /// } + /// ``` + /// pub fn clear_actions(&mut self) { unsafe { notify_notification_clear_actions(self.inner) } }