aboutsummaryrefslogtreecommitdiffstats
path: root/src/query.rs
blob: 24a2a1b878ad07606b18c38c7d9d37460e5b5c4f (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
use std::{
    ops,
};

use error::Result;

use ffi;

use database::Database;

#[derive(Debug)]
pub struct Query(pub(crate) *mut ffi::notmuch_query_t);

impl Query {
    pub fn create(db: &Database, query_string: &String) -> Result<Self> {
        db.create_query(query_string)
    }
}


impl ops::Drop for Query {
    fn drop(&mut self) {
        unsafe {
            ffi::notmuch_query_destroy(self.0)
        };
    }
}