tools

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColorWriter

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

func NewErrWriter

func NewErrWriter() *ColorWriter

func (*ColorWriter) Write

func (cw *ColorWriter) Write(p []byte) (n int, err error)

type Hook

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

func NewHook

func NewHook[T any]() *Hook[T]

NewHook creates a new Hook.

func (*Hook[T]) Add

func (h *Hook[T]) Add(fn func(*T)) func()

Add adds the handler to the end of the list

func (*Hook[T]) Clear

func (h *Hook[T]) Clear()

Clear clears the list of handlers

func (*Hook[T]) Connect

func (h *Hook[T]) Connect(other *Hook[T]) func()

Connect connects the hook to another hook

func (*Hook[T]) Fire

func (h *Hook[T]) Fire(event *T, oneOf ...func(*T))

Fire calls all handlers in the list

func (*Hook[T]) Len

func (h *Hook[T]) Len() int

Len returns the number of handlers

func (*Hook[T]) PreAdd

func (h *Hook[T]) PreAdd(fn func(*T)) func()

PreAdd adds the handler to the beginning of the list

Jump to

Keyboard shortcuts

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