aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorAndrzej Janik <vosen@vosen.pl>2015-06-06 18:11:48 +0200
committerAndrzej Janik <vosen@vosen.pl>2015-06-06 18:11:48 +0200
commit8487b63c97080296269242c31f36a557a90da0cf (patch)
tree75aef512eeba4074565e6c3eadca129189dec74d /src/lib.rs
parent2fcd829b1d9c70d0981411b4f4adca9124985b54 (diff)
downloadmilf-rs-8487b63c97080296269242c31f36a557a90da0cf.tar.gz
milf-rs-8487b63c97080296269242c31f36a557a90da0cf.zip
Rework fix for table redefinition to avoid breaking AST-compatiblity
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 547c407..0196fbc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -75,24 +75,8 @@ pub enum Value {
/// Type representing a TOML array, payload of the Value::Array variant
pub type Array = Vec<Value>;
-// The bool field flag is used during parsing and construction.
-// Is true if the given table was explicitly defined, false otherwise
-// e.g. in a toml document: `[a.b] foo = "bar"`, Table `a` would be false,
-// where table `b` (contained inside `a`) would be true.
/// Type representing a TOML table, payload of the Value::Table variant
-#[derive(Debug, Clone)]
-pub struct Table (pub BTreeMap<string::String, Value>, bool);
-impl Table {
- /// Creates new TOML table
- pub fn new(map: BTreeMap<string::String, Value>) -> Table {
- Table(map, false)
- }
-}
-impl PartialEq for Table {
- fn eq(&self, other: &Table) -> bool {
- self.0.eq(&other.0)
- }
-}
+pub type Table = BTreeMap<string::String, Value>;
impl Value {
/// Tests whether this and another value have the same type.
@@ -198,7 +182,7 @@ impl Value {
let mut cur_value = self;
for key in path.split('.') {
match cur_value {
- &Value::Table(Table(ref hm, _)) => {
+ &Value::Table(ref hm) => {
match hm.get(key) {
Some(v) => cur_value = v,
None => return None