state_machine

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrChangeState = errors.New("change state error")

Functions

This section is empty.

Types

type ErrorHandler added in v0.0.5

type ErrorHandler func(from, to *StateNode) error

type Option added in v0.0.5

type Option func(*StateMachine)

func WithErrorHandler added in v0.0.5

func WithErrorHandler(handler ErrorHandler) Option

type StateMachine

type StateMachine struct {
	// contains filtered or unexported fields
}

StateMachine 无限状态机

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 added in v0.0.6

func (s *StateNode) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL