diff options
| author | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-11-21 20:42:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-21 20:42:20 +0100 |
| commit | c3d26cd116b51687b2fa43a22d3d0c2856cb093b (patch) | |
| tree | c36707e83bc8ec8fc8e129b9acda006b2c46e97f /src/database.rs | |
| parent | 121856a6ef3be6a8a353f381dc319580efa8d86a (diff) | |
| parent | 4ca963a68258abed7f158ffa5289030026e11720 (diff) | |
| download | mail-c3d26cd116b51687b2fa43a22d3d0c2856cb093b.tar.gz | |
Merge pull request #15 from eaon/replace-status-with-result
Return Result<(), Status::NotmuchError> instead of Status
Diffstat (limited to 'src/database.rs')
| -rw-r--r-- | src/database.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/database.rs b/src/database.rs index 5ed9537..102a7a9 100644 --- a/src/database.rs +++ b/src/database.rs @@ -7,7 +7,7 @@ use supercow::Supercow; use libc; -use error::Result; +use error::{Error, Result}; use ffi; use ffi::Status; use query::QueryPtr; @@ -235,7 +235,7 @@ impl Database { <Self as DatabaseExt>::all_tags(self) } - pub fn remove_message<'d, P>(&'d self, path: &P) -> Status + pub fn remove_message<'d, P>(&'d self, path: &P) -> Result<()> where P: AsRef<Path>, { @@ -288,7 +288,7 @@ pub trait DatabaseExt { } } - fn remove_message<'d, D, P>(database: D, path: &P) -> Status + fn remove_message<'d, D, P>(database: D, path: &P) -> Result<()> where D: Into<Supercow<'d, Database>>, P: AsRef<Path>, @@ -298,11 +298,10 @@ pub trait DatabaseExt { Some(path_str) => { let msg_path = CString::new(path_str).unwrap(); - Status::from(unsafe { - ffi::notmuch_database_remove_message(dbref.handle.ptr, msg_path.as_ptr()) - }) + unsafe { ffi::notmuch_database_remove_message(dbref.handle.ptr, msg_path.as_ptr()) } + .as_result() } - None => Status::FileError, + None => Err(Error::NotmuchError(Status::FileError)), } } } |
