package
1.5.4
Repository: https://github.com/yiuterran/go-common.git
Documentation: pkg.go.dev

# README

FSM状态机

使用方法:

  1. 定义State, Index表示当前状态,Outcome表示接收到Input时转换到的新状态;
  2. Outcome的Action,表示新状态的回调函数,这个回调可以返回一个新的Input,用于链式触发;
  3. 使用Define来将State串联起来转换成状态机;
  4. 使用Spin来输入值,开始流转状态机;

# Functions

Define an FSM from a list of States.
NoAction is useful for when you need a certain input to just change the state of the FSM without doing anything else.

# Constants

No description provided by the author

# Structs

FSM is the main structure defining a Finite State Machine.
InvalidInputError indicates that an input was passed to an FSM which is not valid for its current state.
An Outcome describes the result of running an FSM.
A State describes one possible state of an FSM.

# Type aliases

An Action describes something an FSM will do.
ClashingStateError indicates that an attempt to define an FSM where two states share the same index was made.
ImpossibleStateError indicates that an FSM is in a state which wasn't part of its definition.
An Input to give to an FSM.