Finite state machines in rust; bendns fork to add types.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -88,13 +88,13 @@ let mut machine: StateMachine<CircuitBreaker> = StateMachine::new(); let _ = machine.consume(&CircuitBreakerInput::Successful); // Consume the `Unsuccesful` input. The machine is moved to the `Open` // state. The output is `SetupTimer`. -let output = machine.consume(&CircuitBreakerInput::Unsuccesful).unwrap(); +let output = machine.consume(&CircuitBreakerInput::Unsuccessful).unwrap(); // Check the output -if output == Some(CircuitBreakerOutput::SetupTimer) { +if let Some(CircuitBreakerOutput::SetupTimer) = output { // Set up the timer... } // Check the state -if machine.state() == &CircuitBreakerState::Open { +if let CircuitBreakerState::Open = machine.state() { // Do something... } ``` |