actionstack

package
v0.0.0-...-365054f Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAlreadyRun error is throwed with panic on Push or Run invocation
	// after Run was invoked at least once
	ErrAlreadyRun = errors.New("actions already fired")
)

Functions

This section is empty.

Types

type Action

type Action func()

Action represents stackable action.

type ActionStack

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

ActionStack is a stack of actions which are executed in reverse order they were added

func NewActionStack

func NewActionStack() *ActionStack

NewActionStack creates empty ActionStack

func (*ActionStack) Push

func (a *ActionStack) Push(elems ...Action)

Push adds new action on top of stack. Last added action will be executed by Run() first.

func (*ActionStack) Run

func (a *ActionStack) Run()

Run executes pushed actions in reverse order (FILO)

Jump to

Keyboard shortcuts

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