Documentation
¶
Index ¶
- type Registry
- func (receiver *Registry[T]) For(fn func(string, T))
- func (receiver *Registry[T]) Get(name string) (value T, found bool)
- func (receiver *Registry[T]) Len() int
- func (receiver *Registry[T]) Set(name string, value T) (previous T, found bool)
- func (receiver *Registry[T]) Unset(name string) (previous T, found bool)
- func (receiver *Registry[T]) UnsetWhen(name string, whenFunc func(T) bool) (previous T, found bool, when bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry[T any] struct { // contains filtered or unexported fields }
func (*Registry[T]) For ¶
For lets you iterate through all the items in the registry — it calls func 'fn' on each item in the registry.
Note that you should NOT call .Get(), .Set(), .Len(), or .Unset() from the `fn`. It will cause For to lock.
func (*Registry[T]) Set ¶
Set registers an item in the registry under the name 'name', but it also returns the previous item under the name 'name' if it existed.
Click to show internal directories.
Click to hide internal directories.