diff options
| author | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-12-20 08:21:03 +0100 |
|---|---|---|
| committer | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-12-20 08:21:03 +0100 |
| commit | bb8a60ddc9fdecc6c1004639514b538578e37532 (patch) | |
| tree | 634968cabab56edec2f8a750903c155800a0f031 /src/directory.rs | |
| parent | 2baa9d13ad4c5c2c6e55b6ca49c92a4d2434fba7 (diff) | |
| download | mail-bb8a60ddc9fdecc6c1004639514b538578e37532.tar.gz | |
remove ptr indirection
Diffstat (limited to 'src/directory.rs')
| -rw-r--r-- | src/directory.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/directory.rs b/src/directory.rs index 1aff32b..8f09ed7 100644 --- a/src/directory.rs +++ b/src/directory.rs @@ -7,23 +7,19 @@ use Filenames; use FilenamesOwner; use utils::{ScopedSupercow, ScopedPhantomcow}; + #[derive(Debug)] -pub(crate) struct DirectoryPtr { - pub ptr: *mut ffi::notmuch_directory_t, +pub struct Directory<'d> { + ptr: *mut ffi::notmuch_directory_t, + marker: ScopedPhantomcow<'d, Database>, } -impl Drop for DirectoryPtr { +impl<'d> Drop for Directory<'d> { fn drop(&mut self) { unsafe { ffi::notmuch_directory_destroy(self.ptr) }; } } -#[derive(Debug)] -pub struct Directory<'d> { - handle: DirectoryPtr, - marker: ScopedPhantomcow<'d, Database>, -} - impl<'d> FilenamesOwner for Directory<'d> {} impl<'d> Directory<'d> { @@ -32,7 +28,7 @@ impl<'d> Directory<'d> { O: Into<ScopedPhantomcow<'d, Database>>, { Directory { - handle: DirectoryPtr { ptr }, + ptr, marker: owner.into(), } } @@ -49,7 +45,7 @@ pub trait DirectoryExt<'d> { { let dir = directory.into(); Filenames::from_ptr( - unsafe { ffi::notmuch_directory_get_child_directories(dir.handle.ptr) }, + unsafe { ffi::notmuch_directory_get_child_directories(dir.ptr) }, Supercow::phantom(dir), ) } |
