diff options
Diffstat (limited to 'src/runtime.rs')
-rw-r--r-- | src/runtime.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/runtime.rs b/src/runtime.rs new file mode 100644 index 0000000..e6f0819 --- /dev/null +++ b/src/runtime.rs @@ -0,0 +1,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 + } + }) + } +} + |