use std::ffi::CStr; use std::iter::Iterator; use std::ops::Drop; use std::path::PathBuf; use supercow::Phantomcow; use ffi; pub trait FilenamesOwner {} #[derive(Debug)] pub(crate) struct FilenamesPtr { pub ptr: *mut ffi::notmuch_filenames_t, } impl Drop for FilenamesPtr { fn drop(self: &mut Self) { let valid = unsafe { ffi::notmuch_filenames_valid(self.ptr) }; if valid != 0 { unsafe { ffi::notmuch_filenames_destroy(self.ptr) }; } } } #[derive(Debug)] pub struct Filenames<'o, O> where O: FilenamesOwner + 'o, { pub(crate) handle: FilenamesPtr, pub(crate) marker: Phantomcow<'o, O>, } impl<'o, O> Filenames<'o, O> where O: FilenamesOwner + 'o, { pub fn from_ptr
(ptr: *mut ffi::notmuch_filenames_t, owner: P) -> Filenames<'o, O>
where
P: Into