diff options
| -rw-r--r-- | src/db.rs | 3 | ||||
| -rw-r--r-- | src/main.rs | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/db.rs b/src/db.rs new file mode 100644 index 0000000..b324e90 --- /dev/null +++ b/src/db.rs @@ -0,0 +1,3 @@ +pub fn open(mode: notmuch::DatabaseMode) -> Result<notmuch::Database, notmuch::Error> { + notmuch::Database::open(&"/home/gustav/.mail", mode) +} diff --git a/src/main.rs b/src/main.rs index 49e76ac..a518534 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +mod db; mod state; use crate::state::State; @@ -18,7 +19,7 @@ fn main() { let mut threads = { // open database - let db = notmuch::Database::open(&"/home/gustav/.mail", notmuch::DatabaseMode::ReadOnly).unwrap(); + let db = crate::db::open(notmuch::DatabaseMode::ReadOnly).unwrap(); // get threads let query = db.create_query("tag:inbox").unwrap(); |
