diff --git a/src/helpers/config.rs b/src/helpers/config.rs index 1dd685c..2a4f5da 100644 --- a/src/helpers/config.rs +++ b/src/helpers/config.rs @@ -1,11 +1,18 @@ +use toml; use toml::value::Table; pub trait Config { fn get_string (&self, key: &str) -> Option<&str>; + fn get_vec (&self, key: &str) -> Option>; } impl Config for Table { fn get_string (&self, key: &str) -> Option<&str> { self.get(key).and_then(|value| value.as_str()) } + + fn get_vec (&self, key: &str) -> Option> { + self.get(key).and_then(|value| value.as_array()) + .map(|value| value.to_vec()) + } }