# README
state_machine
import "github.com/ccheers/xpkg/state_machine"
Index
Variables
var ErrChangeState = errors.New("change state error")
type ErrorHandler
type ErrorHandler func(from, to *StateNode) error
type Option
type Option func(*StateMachine)
func WithErrorHandler
func WithErrorHandler(handler ErrorHandler) Option
type StateMachine
StateMachine 无限状态机
type StateMachine struct {
// contains filtered or unexported fields
}
func NewStateMachine
func NewStateMachine(options ...Option) *StateMachine
func (*StateMachine) ChangeState
func (x *StateMachine) ChangeState(from, to uint) error
func (*StateMachine) Register
func (x *StateMachine) Register(from, to *StateNode) error
type StateNode
type StateNode struct {
// contains filtered or unexported fields
}
func NewStateNode
func NewStateNode(state uint, desc string) *StateNode
func (*StateNode) String
func (s *StateNode) String() string
Generated by gomarkdoc
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author