There was an article posted here a while back on how to implement a state machine in Rust, purely using its type system to facilitate state transitions. It's a neat concept, even if it's a bit more verbose than what you'll find in other languages.
https://hoverbear.org/2016/10/12/rust-state-machine-pattern/