I have a Rust structure that I can deserialize:
pub struct ProcessReference {
pub alias: Name,
pub source: String,
#[serde(rename = "input")]
pub initializations: Option<HashMap<String, JsonValue>>,
}
where input
is optional. This accepts TOML formats:
[[process]]
alias = "other"
source = "other.toml"
or
[[process]]
alias = "other"
source = "other.toml"
input.input1 = 1
I would like to have the input
be extendable with a second value, not just the JsonValue
, so that this could also be deserialized:
[[process]]
alias = "other"
source = "other.toml"
input.input1 = {1, true}
similar to that used by Cargo for dependencies:
[dependencies]
flowrlib = { path = "../flowrlib", version = "~0.7.0" }
yaml-rust = "~0.3.5"
How can I express that in Serde?