aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Van Haerenborgh <vhdirk@gmail.com>2018-03-23 14:14:36 +0100
committerDirk Van Haerenborgh <vhdirk@gmail.com>2018-03-23 14:14:36 +0100
commitdada4a5f126f79cc0bb7376343ceeb2575a65969 (patch)
treec121d85ed120676ba28978e3182502d7bf854271
parent688a4eb106db42cb50509c61216efc42bf3a4b1f (diff)
downloadmail-dada4a5f126f79cc0bb7376343ceeb2575a65969.tar.gz
lifetime parameters are cool
-rw-r--r--src/database.rs10
-rw-r--r--src/messages.rs2
-rw-r--r--src/query.rs4
-rw-r--r--src/threads.rs4
4 files changed, 10 insertions, 10 deletions
diff --git a/src/database.rs b/src/database.rs
index b0e8b75..c212745 100644
--- a/src/database.rs
+++ b/src/database.rs
@@ -171,7 +171,7 @@ impl Database {
Ok(())
}
- pub fn directory<P: AsRef<path::Path>>(&self, path: &P) -> Result<Option<Directory>> {
+ pub fn directory<'d, P: AsRef<path::Path>>(&self, path: &P) -> Result<Option<Directory<'d>>> {
let path_str = CString::new(path.as_ref().to_str().unwrap()).unwrap();
let mut dir = ptr::null_mut();
@@ -182,12 +182,12 @@ impl Database {
}.as_result());
match dir.is_null() {
- false => Ok(None),
- true => Ok(Some(Directory::new(dir))),
+ true => Ok(None),
+ false => Ok(Some(Directory::new(dir))),
}
}
- pub fn create_query(&self, query_string: &String) -> Result<Query> {
+ pub fn create_query<'d>(&self, query_string: &String) -> Result<Query<'d>> {
let query_str = CString::new(query_string.as_str()).unwrap();
println!("query {:?}", query_str);
let mut query = ptr::null_mut();
@@ -198,7 +198,7 @@ impl Database {
Ok(Query::new(query))
}
- pub fn all_tags(&self) -> Result<Tags> {
+ pub fn all_tags<'d>(&self) -> Result<Tags<'d>> {
let mut tags = ptr::null_mut();
unsafe {
diff --git a/src/messages.rs b/src/messages.rs
index 8466387..9a539c9 100644
--- a/src/messages.rs
+++ b/src/messages.rs
@@ -64,6 +64,6 @@ impl<'q, 'd> iter::Iterator for Messages<'q, 'd> {
ffi::notmuch_messages_get(self.0)
};
- Some(Message::new(cmsg))
+ Some(Self::Item::new(cmsg))
}
}
diff --git a/src/query.rs b/src/query.rs
index bedd758..1fe4e0d 100644
--- a/src/query.rs
+++ b/src/query.rs
@@ -51,7 +51,7 @@ impl<'d> Query<'d> {
/// Filter messages according to the query and return
- pub fn search_messages(self: &Self) -> Result<Messages>
+ pub fn search_messages<'q>(self: &Self) -> Result<Messages<'q, 'd>>
{
let mut msgs = ptr::null_mut();
try!(unsafe {
@@ -75,7 +75,7 @@ impl<'d> Query<'d> {
return Ok(cnt);
}
- pub fn search_threads(self: &Self) -> Result<Threads>
+ pub fn search_threads<'q>(self: &Self) -> Result<Threads<'q, 'd>>
{
let mut thrds = ptr::null_mut();
try!(unsafe {
diff --git a/src/threads.rs b/src/threads.rs
index eb8452e..dadb137 100644
--- a/src/threads.rs
+++ b/src/threads.rs
@@ -42,7 +42,7 @@ impl<'q, 'd> iter::Iterator for Threads<'q, 'd> {
};
if valid == 0{
- return None
+ return None;
}
let cthread = unsafe {
@@ -50,6 +50,6 @@ impl<'q, 'd> iter::Iterator for Threads<'q, 'd> {
ffi::notmuch_threads_get(self.0)
};
- Some(Thread::new(cthread))
+ Some(Self::Item::new(cthread))
}
}