buffer

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 defaults to sizes 1K, 4K, 16K, 64K, 256K and 1M elements.

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