From 221812e18dd2c6b609e6e41e00724c5ee64c8c72 Mon Sep 17 00:00:00 2001 From: szymon Date: Sun, 4 Oct 2026 14:37:08 +0200 Subject: [PATCH] docs: add doctest to get_server_info --- src/api/functions.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/api/functions.rs b/src/api/functions.rs index b56ec27..00df23d 100644 --- a/src/api/functions.rs +++ b/src/api/functions.rs @@ -227,6 +227,41 @@ pub struct ServerInfo { /// Queries the server for information. /// Synchronously queries the server for its information, specifically, the name, vendor, server version, and the version of the notifications specification that it is compliant with. +/// +/// # Example +/// ``` +/// +/// use libnotify_rs::api::functions::{self, uninit}; +/// +/// fn main() -> Result<(), Box> { +/// functions::init("Test app")?; +/// +/// if let Some(info) = functions::get_server_info() { +/// println!("=== Server info ==="); +/// if let Some(name) = info.name { +/// println!("Server name: {}", name); +/// } +/// +/// if let Some(vendor) = info.vendor { +/// println!("Server vendor: {}", vendor); +/// } +/// +/// if let Some(version) = info.version { +/// println!("Server version: {}", version); +/// } +/// +/// if let Some(spec_version) = info.spec_version { +/// println!("Server spec version: {}", spec_version); +/// } +/// } else { +/// eprintln!("No server info"); +/// } +/// +/// uninit(); +/// +/// Ok(()) +/// } +/// ``` pub fn get_server_info() -> Option { let mut ret_name = std::ptr::null_mut() as *mut std::os::raw::c_char; let mut ret_vendor = std::ptr::null_mut() as *mut std::os::raw::c_char;