pub trait IsState<State>: StateMachine { // Required method fn is_state(&self) -> bool; }
An implementation of this trait will be generated for every state. This is can be used to test if the state machine is in a desired state.
The method must be called with the turbo fish syntax as otherwise Rust cannot figure out which implementation to call. To check if the state machine is in a given state call:
let is_in_state: bool = IsState::<State>::is_state(&sfsm);