genericregistry

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry[KEY comparable, ITEM any] interface {
	// Register adds the given item to the registry.
	// It overwrites any existing item associated with the same key.
	Register(key KEY, item ITEM)
	// Get returns the item associated with the given key.
	// If no such key exists, it returns an error.
	Get(key KEY) (ITEM, error)
	// Range calls f for each item in the registry.
	Range(f func(key KEY, item ITEM) bool)
}

Registry is a generic registry that stores items indexed by keys.

func New

func New[KEY comparable, ITEM any]() Registry[KEY, ITEM]

New creates a new Registry.

Jump to

Keyboard shortcuts

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