summaryrefslogtreecommitdiffstats
path: root/src/file/format/toml.rs
diff options
context:
space:
mode:
authorRyan Leckey <ryan@launchbadge.com>2017-06-22 15:57:14 -0700
committerRyan Leckey <ryan@launchbadge.com>2017-06-22 15:57:14 -0700
commit159bb52c595384fed44a2c669198d50f2a758a9a (patch)
tree6553ceed3e172115fe8e682bbfc286bf8fd0f004 /src/file/format/toml.rs
parenta9eecf075cf01f15ef05fea3f1edaa189446d055 (diff)
Remove `namespace` option for File
Diffstat (limited to 'src/file/format/toml.rs')
-rw-r--r--src/file/format/toml.rs25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/file/format/toml.rs b/src/file/format/toml.rs
index 2df1fca..6c835a4 100644
--- a/src/file/format/toml.rs
+++ b/src/file/format/toml.rs
@@ -4,31 +4,10 @@ use std::collections::{HashMap, BTreeMap};
use std::error::Error;
use value::{Value, ValueKind};
-pub fn parse(uri: Option<&String>,
- text: &str,
- namespace: Option<&String>)
- -> Result<HashMap<String, Value>, Box<Error>> {
+pub fn parse(uri: Option<&String>, text: &str) -> Result<HashMap<String, Value>, Box<Error>> {
// Parse a TOML value from the provided text
- let mut root: toml::Value = toml::from_str(text)?;
-
- // Limit to namespace
- if let Some(namespace) = namespace {
- root = toml::Value::Table(match root {
- toml::Value::Table(ref mut table) => {
- if let Some(toml::Value::Table(table)) =
- table.remove(namespace) {
- table
- } else {
- BTreeMap::new()
- }
- }
-
- _ => BTreeMap::new(),
- });
- }
-
// TODO: Have a proper error fire if the root of a file is ever not a Table
- let value = from_toml_value(uri, &root);
+ let value = from_toml_value(uri, &toml::from_str(text)?);
match value.kind {
ValueKind::Table(map) => Ok(map),