aboutsummaryrefslogtreecommitdiffstats
path: root/src/ffi.rs
diff options
context:
space:
mode:
authoreaon <eaon@mit.edu>2018-11-21 20:06:21 +0100
committereaon <eaon@mit.edu>2018-11-21 20:06:21 +0100
commit4ca963a68258abed7f158ffa5289030026e11720 (patch)
treec36707e83bc8ec8fc8e129b9acda006b2c46e97f /src/ffi.rs
parent121856a6ef3be6a8a353f381dc319580efa8d86a (diff)
downloadmail-4ca963a68258abed7f158ffa5289030026e11720.tar.gz
Return Result<(), Status::NotmuchError> instead of Status
Diffstat (limited to 'src/ffi.rs')
-rw-r--r--src/ffi.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ffi.rs b/src/ffi.rs
index 16f9db3..3874ae5 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -4,6 +4,7 @@
use libc::{c_char, c_double, c_int, c_uint, c_ulong, c_void, time_t};
+use error::{Error, Result};
use std::{error, fmt, str};
use utils::ToStr;
@@ -43,17 +44,17 @@ impl notmuch_status_t {
!self.is_ok()
}
- pub fn as_result(self) -> Result<(), Self> {
+ pub fn as_result(self) -> Result<()> {
if self.is_ok() {
Ok(())
} else {
- Err(self)
+ Err(Error::NotmuchError(Status::from(self)))
}
}
}
impl ToStr for Status {
- fn to_str<'a>(&self) -> Result<&'a str, str::Utf8Error> {
+ fn to_str<'a>(&self) -> std::result::Result<&'a str, str::Utf8Error> {
unsafe { notmuch_status_to_string((*self).into()) }.to_str()
}
}