I would like to deserialize directly from a HashMap<string, string>
(provided by an external library that I have no control over).
Having read the docs of Serde, I believe I would need to either:
a) write my own deserializer to do this
or
b) transcode through another medium.
Unless I have misunderstood something, a) seems to lead to a lot of boilerplate code writing internal Serde implementations, while b) just seems wasteful.
I feel like the Serde ecosystem is so fully-featured that I may just be missing a really simple way to do this.
An example of my expectation:
struct MyStruct {
name: String,
#[serde(deserialize_with = "deserialize_idea")]
idea: String,
}
fn deser(input: HashMap<String, String>): Result<Serde::Deserialize::Error> {
input.deserialize()
// Or I suppose we would need to have something like, aping serde_json::from_str
serde_stringy_hashmap::from_hashmap(input)
}