aboutsummaryrefslogtreecommitdiffstats
path: root/src/query.rs
diff options
context:
space:
mode:
authorDirk Van Haerenborgh <vhdirk@gmail.com>2018-03-22 19:54:36 +0100
committerDirk Van Haerenborgh <vhdirk@gmail.com>2018-03-22 19:54:36 +0100
commit95053bfc0010cb0bc00154a12f154063b6134375 (patch)
tree17165499882d3f08ca36294d1a31e85698a6ec8d /src/query.rs
parent0e532a6f2d4f6e85d2ce48ea3770fafa5706d275 (diff)
downloadmail-95053bfc0010cb0bc00154a12f154063b6134375.tar.gz
test messages return value
Diffstat (limited to 'src/query.rs')
-rw-r--r--src/query.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/query.rs b/src/query.rs
index 8e8514c..2fbe031 100644
--- a/src/query.rs
+++ b/src/query.rs
@@ -1,3 +1,4 @@
+use std;
use std::{
ops,
marker,
@@ -27,14 +28,18 @@ impl<'d> Query<'d> {
}
/// Filter messages according to the query and return
- pub fn search_messages(self: &Self) -> Result<Messages>
+ pub fn search_messages(self: &Self) -> std::result::Result<Messages, ()>
{
let mut msgs = ptr::null_mut();
unsafe {
msgs = ffi::notmuch_query_search_messages(self.0);
}
+ if !msgs.is_null() {
+ return Ok(Messages::new(msgs));
+ }else{
+ return Err(());
+ }
- Ok(Messages::new(msgs))
}
}