I’d like to store a few different varieties in a hashmap, and a map of enums seemed like a brilliant idiomatic Rust-y solution.
However, when I started using it, I discovered that I can’t manipulate the enum values very easily because matching on the entry value either moves or locks the entry so I can’t update it.
I made a small failing example:
My goal around line 44 is, “If the entry value is a Choice::A, then replace the entry with a Choice::B”. I’d have similar cases for the other choices.
I feel like there a way this could be extremely elegant in Rust. Even the nested match statements suggest that I’m way off on something. But I can’t tell if it’s my code, the fact that I’m putting enums in a map, or something unrelated. Hints much welcome!