Versions in this module Expand all Collapse all v3 v3.0.1 Feb 16, 2024 Changes in this version + var ErrInvalidTransition = errors.New("invalid transition") + func WithRules(r Ruleset) func(*Machine) + func WithSubject(s Stater) func(*Machine) + type Guard func(subject Stater, goal State) bool + type Machine struct + Rules *Ruleset + Subject Stater + func New(opts ...func(*Machine)) Machine + func (m Machine) Transition(goal State) error + type Ruleset map[Transition][]Guard + func CreateRuleset(transitions ...Transition) Ruleset + func (r Ruleset) AddRule(t Transition, guards ...Guard) + func (r Ruleset) AddTransition(t Transition) + func (r Ruleset) Permitted(subject Stater, goal State) bool + type State string + type Stater interface + CurrentState func() State + SetState func(State) + type T struct + E State + O State + func (t T) Exit() State + func (t T) Origin() State + type Transition interface + Exit func() State + Origin func() State