I only skimmed this. But my mind from the start immediately went to
struct CommonData {
// common fields
}
enum VariantData {
Variant1 {
// Variant1 specific fields
},
// same for other variants
}
struct Search {
common: CommonData,
variant: VariantData,
}
but I reached the end and didn't see it.
Isn't this the way that comes to mind first for others too?