state Machine
fun <S, E : StateEvent> stateMachine(builder: StateMachineBuilder<S, E>.() -> Unit): StateMachine<S, E>
Creates a new state machine with the given configuration.
This is the main entry point for creating state machines with a declarative DSL. The resulting state machine supports event-driven transitions, guards, side effects, and observer notifications. All operations are coroutine-friendly and thread-safe.
Return
A new StateMachine instance
Parameters
S
The type of states in the state machine
E
The type of events that can trigger transitions
builder
The configuration block for building the state machine