summaryrefslogtreecommitdiffstats
path: root/src/runtime.rs
blob: e6f08193c39119cb1ce9a112558714d718118fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use anyhow::Result;

use crate::configuration::Configuration;

#[derive(getset::Getters, Debug)]
pub struct Runtime {
    #[getset(get = "pub")]
    config: Configuration,

    #[getset(get = "pub")]
    database: notmuch::Database,
}

impl Runtime {
    pub fn new(config: Configuration) -> Result<Self> {
        Ok({
            Runtime {
                database: notmuch::Database::open(config.notmuch_database_path(), notmuch::DatabaseMode::ReadOnly)?,
                config
            }
        })
    }
}