determa-state 0.0.5

Determa State — Rust implementation of the Determa statechart engine (implements Determa State spec v0.0.5)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# The smallest useful Determa State machine: one guarded transition.
# A turnstile unlocks only when the inserted coin covers the fare.
id: turnstile
events:
  coin: { payload: { amount: { type: int, required: true } } }
  push: {}
top:                                   # the outermost state (PSiCC "top")
  esvs:
    fare: { type: int, init: 50 }      # extended-state variable, declared in the state
  initial: { transition_to: locked }   # the initial transition
  states:
    locked:
      on_events:
        coin: { transition_to: unlocked, guard: "event.payload.amount >= fare" }
    unlocked:
      on_events:
        push: { transition_to: locked }