Upgrade toml

This commit is contained in:
Zhaofeng Li 2023-03-05 11:05:11 -07:00
parent 97285de54f
commit c3c7c10c05
4 changed files with 59 additions and 6 deletions

58
Cargo.lock generated
View file

@ -223,7 +223,7 @@ dependencies = [
"serde",
"serde_json",
"tokio",
"toml",
"toml 0.7.2",
"tracing",
"tracing-subscriber",
"xdg",
@ -271,7 +271,7 @@ dependencies = [
"tokio",
"tokio-test",
"tokio-util",
"toml",
"toml 0.7.2",
"tower-http 0.3.5",
"tracing",
"tracing-error",
@ -2804,7 +2804,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
dependencies = [
"toml",
"toml 0.5.11",
]
[[package]]
@ -3486,6 +3486,15 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"
dependencies = [
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@ -4039,6 +4048,40 @@ dependencies = [
"serde",
]
[[package]]
name = "toml"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7afcae9e3f0fe2c370fd4657108972cbb2fa9db1b9f84849cefd80741b01cb6"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.19.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "tonic"
version = "0.8.3"
@ -4637,6 +4680,15 @@ version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "winnow"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c95fb4ff192527911dd18eb138ac30908e7165b8944e528b6af93aa4c842d345"
dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.10.1"

View file

@ -29,7 +29,7 @@ regex = "1.7.1"
reqwest = { version = "0.11.14", default-features = false, features = ["json", "rustls-tls", "rustls-tls-native-roots", "stream"] }
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"
toml = "0.5.11"
toml = "0.7.2"
tracing = "0.1.37"
tracing-subscriber = "0.3.16"
xdg = "2.4.1"

View file

@ -118,7 +118,8 @@ impl ConfigData {
if let Some(path) = path {
if path.exists() {
let contents = fs::read(path)?;
let data = toml::from_slice(&contents)?;
let s = std::str::from_utf8(&contents)?;
let data = toml::from_str(&s)?;
return Ok(data);
}
}

View file

@ -52,7 +52,7 @@ serde = "1.0.152"
serde_json = "1.0.93"
serde_with = "2.2.0"
tokio-util = { version = "0.7.7", features = [ "io" ] }
toml = "0.5.11"
toml = "0.7.2"
tower-http = { version = "0.3.5", features = [ "catch-panic", "trace" ] }
tracing = "0.1.37"
tracing-error = "0.2.0"