diff options
| author | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-03-23 04:02:26 +0100 |
|---|---|---|
| committer | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-03-23 04:02:26 +0100 |
| commit | 4513eafb2017b93850153fa978497335df9845be (patch) | |
| tree | 039da7d9b8d4232b7f578bead971f65e1646d3bd /src/thread.rs | |
| parent | bc968e0da07e8e80e19eec1e8efbdb347746d6e2 (diff) | |
| download | mail-4513eafb2017b93850153fa978497335df9845be.tar.gz | |
message and thread iterators
Diffstat (limited to 'src/thread.rs')
| -rw-r--r-- | src/thread.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/thread.rs b/src/thread.rs index e69de29..980ff39 100644 --- a/src/thread.rs +++ b/src/thread.rs @@ -0,0 +1,34 @@ +use std; +use std::{ + ops, + marker, + ptr, +}; + +use error::Result; + +use ffi; +use utils::{ + NewFromPtr, +}; +use Database; + +#[derive(Debug)] +pub struct Thread<'d>( + pub(crate) *mut ffi::notmuch_thread_t, + marker::PhantomData<&'d mut Database>, +); + +impl<'d> NewFromPtr<*mut ffi::notmuch_thread_t> for Thread<'d> { + fn new(ptr: *mut ffi::notmuch_thread_t) -> Thread<'d> { + Thread(ptr, marker::PhantomData) + } +} + +impl<'d> ops::Drop for Thread<'d> { + fn drop(&mut self) { + unsafe { + ffi::notmuch_thread_destroy(self.0) + }; + } +} |
