Feels similar to Kotlin's sealed classes
For example, in Kotlin, if a method on state A returns state B, there's no way to invalidate all existing references to state A. Normally this invariant would be enforced on the caller's side, or perhaps by throwing an IllegalStateException if state A is called after producing state B.
1. Type erasure
2. Using sealed classes requires instantiation, while the Rust version is zero overhead.
There is no need to access type information at runtime here.