package
1.2.4
Repository: https://github.com/ccheers/xpkg.git
Documentation: pkg.go.dev

# 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

# Structs

StateMachine 无限状态机.
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author