Skip to content

Commit 7cac2c2

Browse files
committed
Fix indexmap support and break multiline support a little more
1 parent 4bbd7ab commit 7cac2c2

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "bf_configparser"
3-
version = "1.1.0"
4-
authors = ["QEDK <qedk.en@gmail.com>"]
3+
version = "1.1.1"
4+
authors = ["finnhartshorn+bfconfigparser@gmail.com"]
55
edition = "2021"
66
description = "A simple library for parsing and writing configuration files based on INI like file formats used in Zoo Tycoon (2001)."
77
homepage = "https://github.com/openztcc/bf-configparser"
@@ -16,7 +16,7 @@ categories = ["config", "encoding", "parser-implementations"]
1616
maintenance = { status = "actively-developed" }
1717

1818
[dependencies]
19-
indexmap = { version = "2.1.0", optional = true }
19+
indexmap = { version = "2.2.6", optional = true }
2020
tokio = { version = "1.35.1", optional = true, features = ["fs"] }
2121

2222
[dev-dependencies]

src/ini.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -835,14 +835,13 @@ impl Ini {
835835

836836
let value = trimmed[delimiter + 1..].trim().to_owned();
837837

838-
match valmap.entry(key) {
839-
Entry::Vacant(e) => { e.insert(Some(vec![value])); }
840-
Entry::Occupied(mut e) => {
841-
match e.get_mut() {
842-
Some(x) => { x.push(value); }
843-
None => { e.insert(Some(vec![value])); }
844-
}
838+
if valmap.contains_key(&key) {
839+
match valmap.get_mut(&key).unwrap() {
840+
Some(x) => { x.push(value); }
841+
None => { valmap.insert(key.clone(), Some(vec![value])); }
845842
}
843+
} else {
844+
valmap.insert(key.clone(), Some(vec![value]));
846845
}
847846
}
848847
}

0 commit comments

Comments
 (0)