state_machine v0.1.2 StateMachine

StateMachine package implements finite state machine (FSM) abstraction.

What is this?

What makes it different from other solutions?

Main features

Introductory Examples

Core concepts

  • States
  • Events
  • Transitions
  • Guards
  • Callbacks
  • Context

Introspection

Application usage

  • Standalone
  • GenStatem (TODO)
  • Ecto integration (TODO)

Guards

Callbacks

Run order:

  • before(event)
  • before(transition)
  • before_leave(state)
  • before_enter(state) TRANSITION
  • after_leave(state)
  • after_enter(state)
  • after(transition)
  • after(event)

Link to this section Summary

Link to this section Types

Link to this type

t(m)
t(m) :: %StateMachine{
  events: %{optional(atom()) => StateMachine.Event.t(m)},
  field: atom(),
  misc: keyword(),
  state_getter: (StateMachine.Context.t(m) -> atom()),
  state_setter:
    (StateMachine.Context.t(m), atom() -> StateMachine.Context.t(m)),
  states: %{optional(atom()) => StateMachine.State.t(m)}
}