aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.rs
diff options
context:
space:
mode:
authorDirk Van Haerenborgh <vhdirk@gmail.com>2019-10-18 14:12:28 +0200
committerDirk Van Haerenborgh <vhdirk@gmail.com>2019-10-18 14:12:28 +0200
commit24936ad1d0a3489c766c819f2f824962c770cce0 (patch)
tree48832280477a85c7fc7392379884a8d7a6a5eb25 /src/index.rs
parentcab95623832c0473228f5ad12272f2438620aa68 (diff)
downloadmail-24936ad1d0a3489c766c819f2f824962c770cce0.tar.gz
implement: database_index_message
Diffstat (limited to 'src/index.rs')
-rw-r--r--src/index.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/index.rs b/src/index.rs
new file mode 100644
index 0000000..41505b6
--- /dev/null
+++ b/src/index.rs
@@ -0,0 +1,46 @@
+use std::ops::Drop;
+use supercow::Supercow;
+
+use error::{Error, Result};
+use ffi;
+use ffi::DecryptionPolicy;
+use Database;
+use Filenames;
+use FilenamesOwner;
+use utils::{ScopedSupercow, ScopedPhantomcow};
+
+
+#[derive(Debug)]
+pub struct IndexOpts<'d> {
+ pub(crate) ptr: *mut ffi::notmuch_indexopts_t,
+ marker: ScopedPhantomcow<'d, Database>,
+}
+
+impl<'d> Drop for IndexOpts<'d> {
+ fn drop(&mut self) {
+ unsafe { ffi::notmuch_indexopts_destroy(self.ptr) };
+ }
+}
+
+impl<'d> IndexOpts<'d> {
+ pub fn from_ptr<O>(ptr: *mut ffi::notmuch_indexopts_t, owner: O) -> IndexOpts<'d>
+ where
+ O: Into<ScopedPhantomcow<'d, Database>>,
+ {
+ IndexOpts {
+ ptr,
+ marker: owner.into(),
+ }
+ }
+
+ pub fn set_decrypt_policy(self: &Self, decrypt_policy: DecryptionPolicy) -> Result<()> {
+ unsafe { ffi::notmuch_indexopts_set_decrypt_policy(self.ptr, decrypt_policy.into()) }.as_result()
+ }
+
+ pub fn get_decrypt_policy(self: &Self) -> DecryptionPolicy {
+ unsafe { ffi::notmuch_indexopts_get_decrypt_policy(self.ptr)}.into()
+ }
+}
+
+unsafe impl<'d> Send for IndexOpts<'d> {}
+unsafe impl<'d> Sync for IndexOpts<'d> {} \ No newline at end of file