aboutsummaryrefslogtreecommitdiffstats
path: root/src/ffi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ffi.rs')
-rw-r--r--src/ffi.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ffi.rs b/src/ffi.rs
index 9cc6f47..2ee99e0 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -39,6 +39,21 @@ notmuch_enum! {
NOTMUCH_STATUS_LAST_STATUS => LastStatus
}
}
+
+impl notmuch_status_t {
+ pub fn is_ok(&self) -> bool {
+ match *self {
+ notmuch_status_t::NOTMUCH_STATUS_SUCCESS => true,
+ _ => false,
+ }
+ }
+
+ pub fn as_result(self) -> Result<(), Self> {
+ match self.is_ok() {
+ true => Ok(()),
+ false => Err(self),
+ }
+ }
}
notmuch_enum! {