tools

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 7 Imported by: ? modules, 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

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