diff options
| author | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-12-17 18:29:55 +0100 |
|---|---|---|
| committer | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-12-17 18:29:55 +0100 |
| commit | d74e6fee5dc34e8015f4d9699b5624d7a60a3c8a (patch) | |
| tree | fefa2c6d2c312385986364eddcab9a02f53d966a /src/thread.rs | |
| parent | 0d510d55c4238ff0a1175985b27ca38c71a3cfc2 (diff) | |
| download | mail-d74e6fee5dc34e8015f4d9699b5624d7a60a3c8a.tar.gz | |
Revert "link lifetime of message to Query"
This reverts commit 0d510d55c4238ff0a1175985b27ca38c71a3cfc2.
Diffstat (limited to 'src/thread.rs')
| -rw-r--r-- | src/thread.rs | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/src/thread.rs b/src/thread.rs index 20280e1..137c936 100644 --- a/src/thread.rs +++ b/src/thread.rs @@ -59,20 +59,14 @@ where unsafe { ffi::notmuch_thread_get_total_files(self.handle.ptr) } } - 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), - ) + pub fn toplevel_messages(self: &Self) -> Messages<'_, Self> { + <Self as ThreadExt<'d, 'q>>::toplevel_messages(self) } /// Get a `Messages` iterator for all messages in 'thread' in /// oldest-first order. - 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 messages(self: &Self) -> Messages<'_, Self> { + <Self as ThreadExt<'d, 'q>>::messages(self) } pub fn tags(&self) -> Tags<'_, Self> { @@ -122,29 +116,29 @@ where ) } - // 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), - // ) - // } + 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), + ) + } } impl<'d, 'q> ThreadExt<'d, 'q> for Thread<'d, 'q> where 'd: 'q {} |
