notmuch_more/
database.rs

1use crate::NotmuchMoreError;
2
3pub struct Database {
4    path: String,
5}
6
7impl Database {
8    pub fn new(path: String) -> Self {
9        Self { path }
10    }
11
12    pub fn open_ro(&self) -> Result<notmuch::Database, NotmuchMoreError> {
13        Ok(notmuch::Database::open(
14            &self.path,
15            notmuch::DatabaseMode::ReadOnly,
16        )?)
17    }
18
19    pub fn open_rw(&self) -> Result<notmuch::Database, NotmuchMoreError> {
20        Ok(notmuch::Database::open(
21            &self.path,
22            notmuch::DatabaseMode::ReadWrite,
23        )?)
24    }
25}