aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread.rs
diff options
context:
space:
mode:
authorDirk Van Haerenborgh <vhdirk@gmail.com>2018-12-17 15:52:59 +0100
committerDirk Van Haerenborgh <vhdirk@gmail.com>2018-12-17 15:52:59 +0100
commit0d510d55c4238ff0a1175985b27ca38c71a3cfc2 (patch)
tree49b38f55d48786cf7e31746c5ae292995f8f502f /src/thread.rs
parent895fee066eed58e18c2633cf7d0fa870a65ac06d (diff)
downloadmail-0d510d55c4238ff0a1175985b27ca38c71a3cfc2.tar.gz
link lifetime of message to Query
Diffstat (limited to 'src/thread.rs')
-rw-r--r--src/thread.rs60
1 files changed, 33 insertions, 27 deletions
diff --git a/src/thread.rs b/src/thread.rs
index 137c936..20280e1 100644
--- a/src/thread.rs
+++ b/src/thread.rs
@@ -59,14 +59,20 @@ where
unsafe { ffi::notmuch_thread_get_total_files(self.handle.ptr) }
}
- pub fn toplevel_messages(self: &Self) -> Messages<'_, Self> {
- <Self as ThreadExt<'d, 'q>>::toplevel_messages(self)
+ pub fn toplevel_messages(self: &mut Self) -> Messages<'d, 'q> {
+ Messages::from_ptr(
+ unsafe { ffi::notmuch_thread_get_toplevel_messages(self.handle.ptr) },
+ ScopedPhantomcow::<'q, Query<'d>>::share(&mut self.marker),
+ )
}
/// Get a `Messages` iterator for all messages in 'thread' in
/// oldest-first order.
- pub fn messages(self: &Self) -> Messages<'_, Self> {
- <Self as ThreadExt<'d, 'q>>::messages(self)
+ pub fn messages(self: &mut Self) -> Messages<'d, 'q> {
+ Messages::from_ptr(
+ unsafe { ffi::notmuch_thread_get_messages(self.handle.ptr) },
+ ScopedPhantomcow::<'q, Query<'d>>::share(&mut self.marker),
+ )
}
pub fn tags(&self) -> Tags<'_, Self> {
@@ -116,29 +122,29 @@ where
)
}
- fn toplevel_messages<'s, S>(thread: S) -> Messages<'s, Thread<'d, 'q>>
- where
- S: Into<ScopedSupercow<'s, Thread<'d, 'q>>>,
- {
- let threadref = thread.into();
- Messages::from_ptr(
- unsafe { ffi::notmuch_thread_get_toplevel_messages(threadref.handle.ptr) },
- ScopedSupercow::phantom(threadref),
- )
- }
-
- /// Get a `Messages` iterator for all messages in 'thread' in
- /// oldest-first order.
- fn messages<'s, S>(thread: S) -> Messages<'s, Thread<'d, 'q>>
- where
- S: Into<ScopedSupercow<'s, Thread<'d, 'q>>>,
- {
- let threadref = thread.into();
- Messages::from_ptr(
- unsafe { ffi::notmuch_thread_get_messages(threadref.handle.ptr) },
- ScopedSupercow::phantom(threadref),
- )
- }
+ // fn toplevel_messages<'s, S>(thread: S) -> Messages<'d, 'q>
+ // where
+ // S: Into<ScopedSupercow<'s, Thread<'d, 'q>>>,
+ // {
+ // let threadref = thread.into();
+ // Messages::from_ptr(
+ // unsafe { ffi::notmuch_thread_get_toplevel_messages(threadref.handle.ptr) },
+ // ScopedPhantomcow::<'q, Query<'d>>::share(&mut self.marker),
+ // )
+ // }
+
+ // /// Get a `Messages` iterator for all messages in 'thread' in
+ // /// oldest-first order.
+ // fn messages<'s, S>(thread: S) -> Messages<'d, 'q>
+ // where
+ // S: Into<ScopedSupercow<'s, Thread<'d, 'q>>>,
+ // {
+ // let threadref = thread.into();
+ // Messages::from_ptr(
+ // unsafe { ffi::notmuch_thread_get_messages(threadref.handle.ptr) },
+ // ScopedPhantomcow::<'q, Query<'d>>::share(&mut self.marker),
+ // )
+ // }
}
impl<'d, 'q> ThreadExt<'d, 'q> for Thread<'d, 'q> where 'd: 'q {}