summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-06-08 01:59:39 +0200
committerMatthias Beyer <mail@beyermatthias.de>2018-07-19 20:58:27 +0200
commitaff6ff105d18e1eea14fe89e9c629efa76fd020f (patch)
treec0ba3980a0f02cbfff72d35b07884bf69b10ae93
parentf6a7345b4a481109b0226471925f4266a7691f92 (diff)
downloadimag-aff6ff105d18e1eea14fe89e9c629efa76fd020f.zip
imag-aff6ff105d18e1eea14fe89e9c629efa76fd020f.tar.gz
Remove "Header" extension for Value type
-rw-r--r--lib/core/libimagstore/src/store.rs18
-rw-r--r--lib/core/libimagstore/src/util.rs3
2 files changed, 1 insertions, 20 deletions
diff --git a/lib/core/libimagstore/src/store.rs b/lib/core/libimagstore/src/store.rs
index 55e6804..8b19994 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 61b232a..6d7d478 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)]