Expand description

Generic state machine implementation with compile time checked state transitions.

Modules§

  • Convenience functions for unit testing. Note: Do ONLY use in tests!

Macros§

  • Defines a state machine’s initial state and its allowed transitions. Optionally, a state machine enum type can be generated. Example:

Structs§

  • Wrapper struct for a state S. Use in combination with StateTransition.
  • 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.

Traits§

  • 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.
  • A StateTransition defines valid transitions from one state into another. Implement StateTransition on the given State struct to define a new state transition. Alternatively, use the convenience macro statemachine!.