diff options
| author | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-03-23 12:20:57 +0100 |
|---|---|---|
| committer | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-03-23 12:20:57 +0100 |
| commit | 688a4eb106db42cb50509c61216efc42bf3a4b1f (patch) | |
| tree | a24e9d4c11b4ae073d2b528daf776cb94843cb35 /src/thread.rs | |
| parent | 7719c3b31f67eded7af6cd63d99b56c0f74c97cd (diff) | |
| download | mail-688a4eb106db42cb50509c61216efc42bf3a4b1f.tar.gz | |
get thread authors and subject
Diffstat (limited to 'src/thread.rs')
| -rw-r--r-- | src/thread.rs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/thread.rs b/src/thread.rs index 87e1f0c..2182d69 100644 --- a/src/thread.rs +++ b/src/thread.rs @@ -32,11 +32,11 @@ impl<'q, 'd> NewFromPtr<*mut ffi::notmuch_thread_t> for Thread<'q, 'd> { impl<'q, 'd> Thread<'q, 'd>{ - pub fn id(self: &Self) -> result::Result<&'q str, str::Utf8Error>{ + pub fn id(self: &Self) -> String{ let tid = unsafe { ffi::notmuch_thread_get_thread_id(self.0) }; - tid.to_str() + tid.to_str().unwrap().to_string() } @@ -74,6 +74,24 @@ impl<'q, 'd> Thread<'q, 'd>{ }) } + pub fn subject(self: &Self) -> String{ + let sub = unsafe { + ffi::notmuch_thread_get_subject(self.0) + }; + + sub.to_str().unwrap().to_string() + } + + pub fn authors(self: &Self) -> Vec<String>{ + let athrs = unsafe { + ffi::notmuch_thread_get_authors(self.0) + }; + + athrs.to_str().unwrap().split(",").map(|s| s.to_string()).collect() + } + + + } |
