Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CleanupFunc ¶
type CleanupFunc[T any] func(info T)
CleanupFunc is a function that cleans up the state of the machine.
Parameters:
- info: The state machine information.
This is used to apply the necessary cleanup operations that allows to clear memory and other resources.
type MachineStepRunner ¶
type MachineStepRunner[T any] struct { // contains filtered or unexported fields }
func (MachineStepRunner[T]) All ¶
func (msr MachineStepRunner[T]) All(scanner io.RuneScanner) iter.Seq2[StepFunc[T], *rune]
type RunFunc ¶
type RunFunc[T any] func(scanner io.RuneScanner) (T, error)
RunFunc is a function that executes a state machine and returns it.
Parameters:
- scanner: The scanner to process.
Returns:
- T: The state machine information.
- error: The error of the machine.
type StepFunc ¶
type StepFunc[T any] func(info T, char *rune) (SystemState, error)
StepFunc is a function that executes a state machine step.
Parameters:
- info: The state machine information.
- char: The character to process. Nil if the stream is ended.
Returns:
- SystemState: The next state of the machine.
- error: The error of the machine. Only used for when a panic-level of error occurs.
type SystemState ¶
type SystemState int
SystemState is a system state.
const ( // EndSS is the end state of the system. EndSS SystemState = iota - 1 // InitSS is the initial state of the system. InitSS )
Click to show internal directories.
Click to hide internal directories.