Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMinCap
deprecated
func GetMinCap[PoolT any, Cap constraints.Integer](pool *Pool[PoolT], minCap Cap) *[]PoolT
Gets a slice with at least minCap capacity, allocating one if the pool has none suitable.
Deprecated: Use Pool.GetMinCap (requires Go 1.27).
Types ¶
type Pool ¶
type Pool[T any] struct { // contains filtered or unexported fields }
func (*Pool[T]) Get ¶
func (me *Pool[T]) Get() (ret *[]T)
Get one of whatever is available. If there's no indication of required cap, then presumably pushing an item later will help raise the caps present in the pool.
func (*Pool[T]) GetMinCap ¶ added in v2.13.0
func (me *Pool[T]) GetMinCap[Cap constraints.Integer](minCap Cap) *[]T
Gets a slice with at least minCap capacity, allocating one if the pool has none suitable.