pool

package
v0.0.0-...-afdc2d8 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MarshalerPool easyproto.MarshalerPool

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	Data []byte
}

Buffer contains a byte slice.

type BufferPool

type BufferPool struct {
	// contains filtered or unexported fields
}

BufferPool manages a pool of Buffers.

func NewBufferPool

func NewBufferPool(poolSliceSize uint32) BufferPool

NewBufferPool creates a BufferPool with a specified size.

func (BufferPool) Get

func (pool BufferPool) Get(size uint32) *Buffer

Get retrieves a Buffer from the pool or creates a new one if necessary. It ensures the buffer's capacity is at least the specified size.

func (BufferPool) PoolSliceSize

func (pool BufferPool) PoolSliceSize() uint32

PoolSliceSize returns the size for buffer slices in the pool.

func (BufferPool) Put

func (pool BufferPool) Put(buf *Buffer)

Put returns a Buffer to the pool if its capacity does not exceed poolSliceSize.

Jump to

Keyboard shortcuts

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