diff options
author | Ryan Leckey <leckey.ryan@gmail.com> | 2017-01-25 18:07:12 -0800 |
---|---|---|
committer | Ryan Leckey <leckey.ryan@gmail.com> | 2017-01-25 18:07:12 -0800 |
commit | 91f72c5c2a20c5a9b6b17b5d9ee626645783e5db (patch) | |
tree | c420add20f11d7cee3a1dadee060b4e1cd3fe017 /src/lib.rs | |
parent | 286703d802a433b78ebb334f864136b942f86b5c (diff) |
Big cleanup of the Value API
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -1,5 +1,5 @@ -#![feature(try_from)] #![feature(drop_types_in_const)] +#![allow(unknown_lints)] extern crate toml; @@ -8,13 +8,13 @@ mod source; mod config; use std::error::Error; -use std::convert::TryFrom; +use std::borrow::Cow; use std::sync::{Once, ONCE_INIT}; pub use source::Source; pub use source::File; -use value::Value; +pub use value::Value; pub use config::Config; @@ -55,14 +55,11 @@ pub fn set<T>(key: &str, value: T) global().set(key, value) } -pub fn get<'a, T>(key: &str) -> Option<T> - where T: TryFrom<&'a mut Value>, - T: Default -{ +pub fn get<'a>(key: &str) -> Option<&'a Value> { global().get(key) } -pub fn get_str<'a>(key: &str) -> Option<&'a str> { +pub fn get_str<'a>(key: &str) -> Option<Cow<'a, str>> { global().get_str(key) } |