Remove "Header" extension for Value type

This commit is contained in:
Matthias Beyer 2018-06-08 01:59:39 +02:00
parent f6a7345b4a
commit aff6ff105d
2 changed files with 1 additions and 20 deletions

View file

@ -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 {

View file

@ -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)]