Implementing the state pattern in Rust