From ba947a35f8393ae2e08b307ffcccedbd81e301ed Mon Sep 17 00:00:00 2001 From: Mika Attila Date: Tue, 3 Nov 2015 00:52:13 +0100 Subject: [PATCH] Rename InitFailure to InitError and add documentation --- src/lib.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c8eb8c0f..cdf0a871 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,9 +31,10 @@ use gtypes::{TRUE, FALSE}; /// Error that can happen on context creation #[derive(Debug)] pub enum ContextCreationError { - /// Context already exists + /// Context already exists. AlreadyExists, - InitFailure, + /// Failed to initialize libnotify. + InitError, NulError, } @@ -42,7 +43,7 @@ impl fmt::Display for ContextCreationError { use ContextCreationError::*; match *self { AlreadyExists => write!(f, "A Libnotify context already exists."), - InitFailure => write!(f, "Failed to initialize libnotify."), + InitError => write!(f, "Failed to initialize libnotify."), NulError => write!(f, "Argument contains a nul character."), } } @@ -85,7 +86,7 @@ impl Context { Err(_) => return Err(ContextCreationError::NulError), }; if sys::notify_init(app_name.as_ptr()) == FALSE { - return Err(ContextCreationError::InitFailure); + return Err(ContextCreationError::InitError); } } Ok(Context)