aboutsummaryrefslogtreecommitdiffstats
path: root/src/threads.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/threads.rs')
-rw-r--r--src/threads.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/threads.rs b/src/threads.rs
new file mode 100644
index 0000000..75f4549
--- /dev/null
+++ b/src/threads.rs
@@ -0,0 +1,32 @@
+use std::{
+ ops,
+ marker,
+};
+
+use utils::{
+ NewFromPtr,
+};
+
+use database;
+
+use ffi;
+
+#[derive(Debug)]
+pub struct Threads<'d>(
+ *mut ffi::notmuch_threads_t,
+ marker::PhantomData<&'d mut database::Database>,
+);
+
+impl<'d> NewFromPtr<*mut ffi::notmuch_threads_t> for Threads<'d> {
+ fn new(ptr: *mut ffi::notmuch_threads_t) -> Threads<'d> {
+ Threads(ptr, marker::PhantomData)
+ }
+}
+
+impl<'d> ops::Drop for Threads<'d> {
+ fn drop(&mut self) {
+ unsafe {
+ ffi::notmuch_threads_destroy(self.0)
+ };
+ }
+}