pool

package
v0.4.13 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Pool of reuseable data structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FixedPoolFilterFunc

func FixedPoolFilterFunc[T any](filterFunc func(t T) (dropped bool)) func(*FixedPool[T])

Types

type ByteBufPool

type ByteBufPool struct {
	MaxCap int // default max cap is 4096 bytes.
	// contains filtered or unexported fields
}

func NewByteBufferPool

func NewByteBufferPool(initCap int) *ByteBufPool

func (*ByteBufPool) Get

func (b *ByteBufPool) Get() *bytes.Buffer

func (*ByteBufPool) Put

func (b *ByteBufPool) Put(buf *bytes.Buffer)

type EphPool

type EphPool[T any] struct {
	// contains filtered or unexported fields
}

func NewEphPool

func NewEphPool[T any](filterFunc func(t T) (dropped bool)) *EphPool[T]

func (*EphPool[T]) Pop

func (p *EphPool[T]) Pop() (T, bool)

func (*EphPool[T]) Push

func (p *EphPool[T]) Push(t T)

type FixedPool

type FixedPool[T any] struct {
	// contains filtered or unexported fields
}

func NewFixedPool

func NewFixedPool[T any](cap int, options ...func(*FixedPool[T])) *FixedPool[T]

func (*FixedPool[T]) Pop

func (r *FixedPool[T]) Pop() (T, bool)

func (*FixedPool[T]) Push

func (r *FixedPool[T]) Push(t T)

func (*FixedPool[T]) TryPop

func (r *FixedPool[T]) TryPop() (T, bool)

func (*FixedPool[T]) TryPush

func (r *FixedPool[T]) TryPush(t T) bool

Jump to

Keyboard shortcuts

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