pool

package
v0.0.0-...-791c77c Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDoNotRepool = errors.New("do not repool")

Functions

func GetBufioReader

func GetBufioReader() interfaces.Pool[bufio.Reader, *bufio.Reader]

func GetBufioWriter

func GetBufioWriter() interfaces.Pool[bufio.Writer, *bufio.Writer]

func IsDoNotRepool

func IsDoNotRepool(err error) bool

func MakeFakePool

func MakeFakePool[T any, TPtr interfaces.Ptr[T]]() *fakePool[T, TPtr]

func MakePool

func MakePool[T any, TPtr interfaces.Ptr[T]](
	New func() TPtr,
	Reset func(TPtr),
) *pool[T, TPtr]

func MakePoolWithReset

func MakePoolWithReset[T any, TPtr interfaces.Resetable[T]]() *poolWithReset[T, TPtr]

func MakePooledChain

func MakePooledChain[T interfaces.Poolable[T], TPtr interfaces.PoolablePtr[T]](
	p interfaces.Pool[T, TPtr],
	wfs ...interfaces.FuncIter[TPtr],
) interfaces.FuncIter[TPtr]

func MakeValue

func MakeValue[T any](
	construct func() T,
	reset func(T),
) poolValue[T]

func MakeWriterDoNotRepool

func MakeWriterDoNotRepool[T any]() interfaces.FuncIter[*T]

Types

type Bespoke

type Bespoke[T any] struct {
	FuncGet func() T
	FuncPut func(T)
}

func (Bespoke[T]) Get

func (ip Bespoke[T]) Get() T

func (Bespoke[T]) Put

func (ip Bespoke[T]) Put(i T) (err error)

type BespokeResetter

type BespokeResetter[T any] struct {
	FuncReset     func(T)
	FuncResetWith func(T, T)
}

func (BespokeResetter[T]) Reset

func (br BespokeResetter[T]) Reset(e T)

func (BespokeResetter[T]) ResetWith

func (br BespokeResetter[T]) ResetWith(dst, src T)

Jump to

Keyboard shortcuts

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