Is it possible to deserialize it in such a way that if a value is not provided for an entry, it would look up the value from a different "default" entry?
I want to deserialize a config like the one below, where it would load the values defined in entries, and if missing, look up in "defaults", and fail if it's not in either.
You might be able to create something like that with DeserializeSeed (or maybe serde_state).
If it is for a configuration system, maybe a specialized crate which has a concept of layers which get merged might be more useful. A quick search revealed config and twelf.
Thanks, DeserializeSeed looks like the building block I'm looking for.
What I'm trying to do is not so much to merge configs, as to de-duplicate repetitive entries. Basically, a #[serde(default = ...)] where I don't hard-code the default. My config can have a large number of user-defined entries, and I want to have a global section that can be used to set the defaults that would apply to each entry that doesn't have those value explicitly set.