Generic state machine implementation with compile time checked state transitions.
Convenience functions for unit testing. Note: Do ONLY use in tests!
Defines a state machine’s initial state and its allowed transitions. Optionally, a state machine enum type can be generated. Example:
Wrapper struct for a state S. Use in combination with
Wrapper to safely replace states of state machine which don’t consume their states. Use this wrapper if state transitions are performed on mutable references rather than consumed states. Example:
Wrapper struct to enforce compile time checked state transitions of one state into another.
Marker for creating a new initial state. This trait enforces that only the initial state can be created manually while all others must be created through a proper state transition.
StateTransitiondefines valid transitions from one state into another. Implement
StateTransitionon the given
Statestruct to define a new state transition. Alternatively, use the convenience macro