coll

package
v6.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStackEmpty = errors.New("stack empty")
View Source
var NullState = nullState{}

Functions

func ConsoleLogger

func ConsoleLogger(e Event)

func ErrIndexOutOfBounds

func ErrIndexOutOfBounds(i int) error

func ErrNotEnoughArgs

func ErrNotEnoughArgs(have int, want int) error

func TestLogger

func TestLogger(t *testing.T) func(Event)

Types

type Dispatcher

type Dispatcher struct {
	Listener Listener
}

func (*Dispatcher) Emit

func (d *Dispatcher) Emit(t string)

func (*Dispatcher) Emitf

func (d *Dispatcher) Emitf(t string, format string, args ...any)

type Event

type Event struct {
	Type    string
	Message string
}

func NewEvent

func NewEvent(t string, format string, args ...any) Event

func (Event) String

func (e Event) String() string

type Listener

type Listener func(Event)

type Pool

type Pool[T any] struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool[T any](n int) *Pool[T]

func (*Pool[T]) New

func (p *Pool[T]) New() *T

func (*Pool[T]) Recycle

func (p *Pool[T]) Recycle(vs ...*T)

type Stack

type Stack[T any] struct {
	Dispatcher
	// contains filtered or unexported fields
}

func (*Stack[T]) Clear

func (s *Stack[T]) Clear()

func (*Stack[T]) Clone

func (s *Stack[T]) Clone() Stack[T]

func (*Stack[T]) Debug

func (s *Stack[T]) Debug(on bool)

func (*Stack[T]) Drop

func (s *Stack[T]) Drop()

func (*Stack[T]) Get

func (s *Stack[T]) Get(i int) T

func (*Stack[T]) Items

func (s *Stack[T]) Items() []T

func (*Stack[T]) Len

func (s *Stack[T]) Len() int

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

func (*Stack[T]) Push

func (s *Stack[T]) Push(vals ...T)

func (*Stack[T]) Rotate

func (s *Stack[T]) Rotate()

func (*Stack[T]) Set

func (s *Stack[T]) Set(i int, v T)

func (*Stack[T]) SetItems

func (s *Stack[T]) SetItems(items []T)

func (*Stack[T]) String

func (s *Stack[T]) String() string

func (*Stack[T]) Top

func (s *Stack[T]) Top() T

type State

type State interface {
	Var(string) (any, bool)
	NewVar(string, any)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳