mirror of
https://github.com/szymon-jozef/libnotify-rs.git
synced 2026-10-27 19:20:43 +01:00
docs: add doctest to get_app_name
This commit is contained in:
@@ -97,6 +97,20 @@ pub fn is_initted() -> bool {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/// Gets the application name registered.
|
/// Gets the application name registered.
|
||||||
|
///
|
||||||
|
/// # Example
|
||||||
|
/// ```
|
||||||
|
/// use libnotify_rs::api::functions::{get_app_name, init};
|
||||||
|
///
|
||||||
|
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
/// let app_name = "Test app";
|
||||||
|
/// init(app_name)?;
|
||||||
|
/// let app_name_gotten: String = get_app_name().ok_or::<String>("No name gotten".into())?;
|
||||||
|
/// assert_eq!(app_name, app_name_gotten);
|
||||||
|
/// Ok(())
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
pub fn get_app_name() -> Option<String> {
|
pub fn get_app_name() -> Option<String> {
|
||||||
let app_name_c: *const std::os::raw::c_char = unsafe { notify_get_app_name() };
|
let app_name_c: *const std::os::raw::c_char = unsafe { notify_get_app_name() };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user