Crate nefsm

source ·
Expand description

A simple state machine library for Rust, using enums for states and events.

This library provides a simple, flexible way to define state machines in Rust. The states and events are defined using Rust enums, and the state machine itself is a generic struct that can be instantiated with any specific set of enums.

The core traits used in this library are FsmEnum, and Stateful.

  • FsmEnum is a trait that defines how to create a new state machine state based on a given enum value. This is used to instantiate new state machine states when a state transition occurs.

  • Stateful is a trait that defines how a state should handle state transition events.

  • StateMachine is the main struct that represents a state machine instance. It tracks the current state, and provides methods to initialize the state machine, process events, and get the current state.

This library is designed to be easy to use and flexible enough to handle a wide variety of state machine designs.

Modules