blob: 7b00d708a04374092613cbfdccd6b11af4888ccf (
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
32
|
use std::{
ops,
marker,
};
use utils::{
NewFromPtr,
};
use Database;
use ffi;
#[derive(Debug)]
pub struct Directory<'d>(
*mut ffi::notmuch_directory_t,
marker::PhantomData<&'d mut 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)
};
}
}
|