machine

package
v0.0.0-...-d322e89 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: BSD-2-Clause Imports: 0 Imported by: 0

Documentation

Overview

Example
Output:

State 1
State 2
State 3
State 2
State 3
State 2
State 3
Example (NoAllocations)
Output:

State 1
State 2
State 3
State 2
State 3
State 2
State 3

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State func() State

State is used to implement a lightweight state machine. Each state is represented by a closure, that, when run, returns the next state (or nil to stop the machine).

func (*State) Update

func (s *State) Update()

Update runs s (i.e. the current state), and replaces it with the result of that call. It's safe to call Update on a nil target.

Jump to

Keyboard shortcuts

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