I am using toml-rs and serde_derive to deserialize TOML files my app uses to describe data structures.
I have everything working with my first data structure which corresponds to one TOML file definition with obligatory and optional fields.
Now I want to use it to deserialize another data structure that is described in another TOML file, with different fields.
How do I specify to the deserializer (I am using toml::from_str(&contents)
) which structure type I want to deserialize into?
Related question - is it possible to put the type into the file itself, so that deserialization can be more generic, and the deserializer can detect the type to deserialize from the file itself?