summaryrefslogtreecommitdiffstats
path: root/src/env.rs
diff options
context:
space:
mode:
authorRyan Leckey <leckey.ryan@gmail.com>2017-01-28 22:07:13 -0800
committerRyan Leckey <leckey.ryan@gmail.com>2017-01-28 22:07:13 -0800
commitc1bcf6ec5537bfd0fb3f1ee8d93a32aa15031cff (patch)
tree05fd0b9a2daae99543a9d5ae3a6e15eebc622055 /src/env.rs
parent7d870758cbd9ad4181471ad40184d1bac1204e1e (diff)
Propagate Cow into Source
Diffstat (limited to 'src/env.rs')
-rw-r--r--src/env.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/env.rs b/src/env.rs
index 612b97d..9743722 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -1,5 +1,6 @@
use std::env;
use std::error::Error;
+use std::borrow::Cow;
use source;
use value::Value;
@@ -26,7 +27,7 @@ impl source::SourceBuilder for Environment {
}
impl source::Source for Environment {
- fn get(&self, key: &str) -> Option<Value> {
+ fn get<'a>(&self, key: &str) -> Option<Cow<'a, Value>> {
let mut env_key = String::new();
// Apply prefix
@@ -38,6 +39,6 @@ impl source::Source for Environment {
env_key.push_str(&key.to_uppercase());
// Attempt to retreive environment variable and coerce into a Value
- env::var(env_key.clone()).ok().map(Value::from)
+ env::var(env_key.clone()).ok().map(Value::from).map(Cow::Owned)
}
}