diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-03-26 21:29:40 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-03-26 21:29:40 +0100 |
commit | ee61d079bdbf7713fad00289807d8be045624d29 (patch) | |
tree | 29f133dcc548c36e8a1b9421a8033524e2e4861d /libimagrt | |
parent | e7a0eed1c12ea0ce36f45aa4bd06ee45f2caf40f (diff) | |
parent | 1bcc05a855b5ce2036c02182696b84745996a4ff (diff) |
Merge pull request #295 from matthiasbeyer/libimagrt/config-for-everyone
Libimagrt/config for everyone
Diffstat (limited to 'libimagrt')
-rw-r--r-- | libimagrt/src/configuration.rs | 10 | ||||
-rw-r--r-- | libimagrt/src/runtime.rs | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/libimagrt/src/configuration.rs b/libimagrt/src/configuration.rs index 6b4319f1..53e2f659 100644 --- a/libimagrt/src/configuration.rs +++ b/libimagrt/src/configuration.rs @@ -1,5 +1,6 @@ use std::path::PathBuf; use std::result::Result as RResult; +use std::ops::Deref; use toml::{Parser, Value}; @@ -169,6 +170,15 @@ impl Configuration { } +impl Deref for Configuration { + type Target = Value; + + fn deref(&self) -> &Value { + &self.config + } + +} + fn get_verbosity(v: &Value) -> bool { match v { &Value::Table(ref t) => t.get("verbose") diff --git a/libimagrt/src/runtime.rs b/libimagrt/src/runtime.rs index ecc5c227..3ff43d76 100644 --- a/libimagrt/src/runtime.rs +++ b/libimagrt/src/runtime.rs @@ -239,6 +239,13 @@ impl<'a> Runtime<'a> { } /** + * Get the configuration object + */ + pub fn config(&self) -> Option<&Configuration> { + self.configuration.as_ref() + } + + /** * Get the store object */ pub fn store(&self) -> &Store { |