blob: 3d9de6ea1603d55c8aa09335f8137b4cb4adad03 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use std::{
ops,
marker,
};
use utils::{
NewFromPtr,
};
use database;
use ffi;
pub struct Directory<'d>(
*mut ffi::notmuch_directory_t,
marker::PhantomData<&'d mut database::Database>,
);
impl<'d> NewFromPtr<*mut ffi::notmuch_directory_t> for Directory<'d> {
fn new(ptr: *mut ffi::notmuch_directory_t) -> Directory<'d> {
Directory(ptr, marker::PhantomData)
}
}
impl<'d> ops::Drop for Directory<'d> {
fn drop(&mut self) {
unsafe {
ffi::notmuch_directory_destroy(self.0)
};
}
}
|