Here's my WIP for rewriting it into something more reasonable. Which also taught me that an even worse sin of that official front-page tutorial example is that it uses a bunch of overly verbose ways to do things that can be done now in a fraction of the code with their newer helpers.
All in all, it's reduced from the original 371 lines to the current 155 lines. The hierarchical state machine structure is front and center.
https://gist.github.com/pervognsen/1cae9c0f27b7568cc4008c13a1038968
@annanannanse In that example, another option would be
enum Edit {
Key { key: String },
Value { key: String, value: String },
}
but that leads to clumsier, less uniform code and has the sort of issues mentioned in your link.