Hello, I'm moving from golang (cobra) to rust with clap to build CLI. I've stumbled onto issue that I've some trouble with. I have config file that contains some 'known' fields and any amount of 'unknown' fields. It'll be easier to explain with example config file.
services:
serviceA:
root: ./serviceA
userDefinedField: somestr
anotherUserDefinedField: anotherStr
serviceB:
root: ./serviceB
thereCanBeUnlimitedAmountOfThoseFields: str
What i'd like is to have 'Service' struct such as:
struct Service {
root: String
// there may be more 'common' fields like root
// all 'unknown' fields should be put into hashmap below
fields: HashMap<String, String>
}
Is there any way to express that easily with serde or do I need to write custom Serializer?