diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2018-06-08 01:59:39 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2018-07-19 20:58:27 +0200 |
commit | aff6ff105d18e1eea14fe89e9c629efa76fd020f (patch) | |
tree | c0ba3980a0f02cbfff72d35b07884bf69b10ae93 /lib | |
parent | f6a7345b4a481109b0226471925f4266a7691f92 (diff) |
Remove "Header" extension for Value type
Diffstat (limited to 'lib')
-rw-r--r-- | lib/core/libimagstore/src/store.rs | 18 | ||||
-rw-r--r-- | lib/core/libimagstore/src/util.rs | 3 |
2 files changed, 1 insertions, 20 deletions
diff --git a/lib/core/libimagstore/src/store.rs b/lib/core/libimagstore/src/store.rs index 55e68047..8b199946 100644 --- a/lib/core/libimagstore/src/store.rs +++ b/lib/core/libimagstore/src/store.rs @@ -888,24 +888,6 @@ impl PartialEq for Entry { } -/// Extension trait for top-level toml::Value::Table, will only yield correct results on the -/// top-level Value::Table, but not on intermediate tables. -pub trait Header { - fn parse(s: &str) -> Result<Value>; -} - -impl Header for Value { - - fn parse(s: &str) -> Result<Value> { - use toml::de::from_str; - - from_str(s) - .map_err(From::from) - .and_then(|h: Value| h.verify().map(|_| h)) - } - -} - fn has_only_tables(t: &Value) -> Result<bool> { debug!("Verifying that table has only tables"); match *t { diff --git a/lib/core/libimagstore/src/util.rs b/lib/core/libimagstore/src/util.rs index 61b232a3..6d7d4786 100644 --- a/lib/core/libimagstore/src/util.rs +++ b/lib/core/libimagstore/src/util.rs @@ -22,7 +22,6 @@ use std::fmt::Write; use toml::Value; use store::Result; -use store::Header; #[cfg(feature = "early-panic")] #[macro_export] @@ -61,7 +60,7 @@ pub fn entry_buffer_to_header_content(buf: &str) -> Result<(Value, String)> { } } - Ok((Value::parse(&header)?, content)) + ::toml::de::from_str(&header).map_err(From::from).map(|h| (h, content)) } #[cfg(test)] |