actionstack

package
v0.0.0-...-e486d47 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: GPL-3.0 Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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