Documentation ¶
Overview ¶
Package pool provides types and functionality related to object pooling.
Index ¶
Constants ¶
View Source
const Version = "v0.1.1"
Version is the current version of the library.
Variables ¶
View Source
var ErrCorruptPool = errors.New("corrupt pool")
ErrCorruptPool is returned by Pool.Get when the de-pooled object's type is unconvertible to the pool's intended object type.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool[T any] struct { // contains filtered or unexported fields }
Pool is a strongly-typed object pool.
func New ¶
func New[T any](ctor Constructor[T]) *Pool[T]
New creates a new Pool compatible with objects of type T with the given Constructor for T.
func NewWithReleaser ¶
func NewWithReleaser[T any](ctor Constructor[T], release Releaser[T]) *Pool[T]
NewWithReleaser creates a new Pool compatible with objects of type T with the given Constructor and Releaser for T.
Click to show internal directories.
Click to hide internal directories.