gpool

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package gpool provides a generic sync.Pool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool[T any] sync.Pool

Pool is a generic sync.Pool.

func New

func New[T any](newFunc func() T) Pool[T]

New returns an initialized generic sync.Pool.

func (*Pool[T]) Get

func (p *Pool[T]) Get() (val T)

Get retrieves a resource from the pool. Returns the zero value of T if no resource is available and no New func is specified.

func (*Pool[T]) Put

func (p *Pool[T]) Put(val T)

Put puts the resource into the pool.

Jump to

Keyboard shortcuts

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