diff options
| author | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-03-23 07:28:07 +0100 |
|---|---|---|
| committer | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-03-23 07:28:07 +0100 |
| commit | ba417206ed8bb2341dcad5655d91ad09f6a0f073 (patch) | |
| tree | 6ea86e1fed38de283bfa8893c4dee87bfab3bf32 | |
| parent | be546fe6e4b709d1bb8770fdf0763ce4f494d0d6 (diff) | |
| download | mail-ba417206ed8bb2341dcad5655d91ad09f6a0f073.tar.gz | |
thread: count messages and files
| -rw-r--r-- | src/ffi.rs | 11 | ||||
| -rw-r--r-- | src/thread.rs | 22 |
2 files changed, 27 insertions, 6 deletions
@@ -907,6 +907,17 @@ extern { thread: *mut notmuch_thread_t, ) -> c_int; + /// Get the total number of files in 'thread'. + /// + /// This sums notmuch_message_count_files over all messages in the + /// thread + /// @returns Non-negative integer + /// @since libnotmuch 5.0 (notmuch 0.25) + /// + pub fn notmuch_thread_get_total_files( + thread: *mut notmuch_thread_t, + ) -> c_int; + /// Get a `notmuch_messages_t` iterator for the top-level messages in /// 'thread' in oldest-first order. /// diff --git a/src/thread.rs b/src/thread.rs index cf5440c..2a502b4 100644 --- a/src/thread.rs +++ b/src/thread.rs @@ -25,12 +25,22 @@ impl<'q, 'd> NewFromPtr<*mut ffi::notmuch_thread_t> for Thread<'q, 'd> { } } -// impl<'d> Thread<'d>( -// -// -// -// }; -// +impl<'q, 'd> Thread<'q, 'd>{ + + pub fn total_messages(self: &Self) -> i32{ + unsafe { + ffi::notmuch_thread_get_total_messages(self.0) + } + } + + pub fn total_files(self: &Self) -> i32{ + unsafe { + ffi::notmuch_thread_get_total_files(self.0) + } + } + +} + impl<'q, 'd> ops::Drop for Thread<'q, 'd> { fn drop(&mut self) { |
