View Source cure_fsm_cure_api (cure v0.7.0)
Cure FSM API Wrapper
This module provides the Cure-level FSM API that matches the design in lib/std/fsm.cure. It wraps the underlying cure_fsm_runtime gen_server to provide:
- start_fsm/1: Start an FSM instance from a module
- fsm_cast/2: Send events asynchronously
- fsm_advertise/2: Register a name for an FSM
- fsm_state/1: Query current state and payload
The FSM definitions in Cure modules are compiled to:
- A record type for the payload
- A list of transitions with handler functions
- An initial state and initial payload
This module bridges the gap between Cure's high-level FSM syntax and the Erlang gen_server runtime.