From 4b0aaab7090d62e387086c5691a0ebca56f5dba3 Mon Sep 17 00:00:00 2001 From: Mika Attila Date: Tue, 3 Nov 2015 00:50:27 +0100 Subject: [PATCH] Update doc example --- src/lib.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c1025cad..f0f0f302 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,20 +1,18 @@ //! Rustic bindings to [libnotify](https://developer.gnome.org/libnotify/) //! //! ```rust -//! extern crate libnotify; +//!extern crate libnotify; +//! +//!fn main() { +//! let notify = libnotify::Context::new("hello").unwrap_or_else(|e| { +//! panic!("{}", e); +//! }); +//! let body_text = Some("This is the optional body text."); +//! let n = notify.new_notification("This is the summary.", body_text, None) +//! .unwrap_or_else(|e| panic!("{}", e)); +//! n.show().unwrap_or_else(|e| panic!("{}", e)); +//!} //! -//! fn main() { -//! let notify = libnotify::Context::new("hello").unwrap_or_else(|e| { -//! panic!("{}", e); -//! }); -//! let body_text = Some("This is the optional body text."); -//! let n = notify.new_notification("This is the summary.", -//! body_text, -//! None).unwrap_or_else(|e| { -//! panic!("{}", e); -//! }); -//! n.show().ok().expect("Failed to show notification"); -//! } //! ``` extern crate libnotify_sys as sys;