diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ffi.rs | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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! { |
