machine

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 3 Imported by: 0

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
)

Jump to

Keyboard shortcuts

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