【发布时间】:2020-01-17 20:23:26
【问题描述】:
例如:
#[macro_use]
extern crate serde_derive;
extern crate toml;
#[derive(Deserialize)]
struct Entry {
foo: String,
bar: String,
}
let toml_string = r#"
[[entry]]
foo = "a0"
bar = "b0"
[[entry]]
foo = "a1"
bar = "b1"
"#;
let config: toml::value::Table<Entry> = toml::from_str(&toml_string)?;
但是,这不起作用,并引发关于 Table 的意外类型参数的错误。
【问题讨论】: