buffer

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool = PoolG[byte]

type PoolG

type PoolG[T any] interface {
	Get(required int) []T
	Put(buffer []T)
	Stats() (gets, puts, hits, creates int64, hitRate float64)
}

func NewPool

func NewPool[T any](sizes ...int) PoolG[T]

NewPool creates a new generic buffer pool instance

type PooledBuffer

type PooledBuffer = PooledBufferG[byte]

type PooledBufferG

type PooledBufferG[T any] interface {
	io.Closer
	io.Seeker
	Write(p []T) (int, error)
	Read(p []T) (int, error)
	Reset()
	ResetRead()
	Available() int
	Len() int
	Cap() int
	Closed() bool
	Data() []T
}

func NewPooledBuffer

func NewPooledBuffer[T any](size int, pool PoolG[T]) PooledBufferG[T]

Jump to

Keyboard shortcuts

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