fsm

package
v0.0.0-...-bb33fa6 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSM

type FSM[Args any] struct {
	// contains filtered or unexported fields
}

func NewFSM

func NewFSM[Args any](states ...*State[Args]) *FSM[Args]

func (*FSM[Args]) AddState

func (fsm *FSM[Args]) AddState(action func()) *State[Args]

func (*FSM[Args]) Execute

func (fsm *FSM[Args]) Execute()

func (*FSM[Args]) Handle

func (fsm *FSM[Args]) Handle(args Args)

func (*FSM[Args]) SetCurrentState

func (fsm *FSM[Args]) SetCurrentState(state *State[Args])

type State

type State[Args any] struct {
	// contains filtered or unexported fields
}

func (*State[Args]) AddTransition

func (state *State[Args]) AddTransition(handler func(Args) *State[Args])

func (*State[Args]) Entry

func (state *State[Args]) Entry()

func (*State[Args]) Execute

func (state *State[Args]) Execute()

func (*State[Args]) Exit

func (state *State[Args]) Exit()

func (*State[Args]) Handle

func (state *State[Args]) Handle(args Args) *State[Args]

type Transition

type Transition[Args any] struct {
	// contains filtered or unexported fields
}

func (*Transition[Args]) Handle

func (t *Transition[Args]) Handle(args Args) *State[Args]

Jump to

Keyboard shortcuts

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