From 4c2acefdfbfe588937a2660f49462d80a6cc2bb0 Mon Sep 17 00:00:00 2001 From: szymon Date: Sun, 4 Oct 2026 15:29:03 +0200 Subject: [PATCH] docs: add doctests to context --- src/wrappers/context.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/wrappers/context.rs b/src/wrappers/context.rs index 12c1c65..ec15815 100644 --- a/src/wrappers/context.rs +++ b/src/wrappers/context.rs @@ -15,6 +15,19 @@ impl LibnotifyContext { /// # Error /// Returns an error, if libnotify cannot be initialized or if there already exists a context /// object + /// + /// # Example + /// ``` + /// use libnotify_rs::context::LibnotifyContext; + /// + /// fn main() -> Result<(), Box> { + /// let ctx = LibnotifyContext::new("Coffee addicted reminder")?; + /// + /// // you don't need to uninitialize libnotify, cause context already does that! + /// + /// Ok(()) + /// } + /// ``` pub fn new(app_name: &str) -> Result> { if IS_CONTEXT_CREATED.swap(true, std::sync::atomic::Ordering::SeqCst) { return Err("You can create only one context at a time".into());