bpool

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BytePoolCap

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

BytePoolCap implements a leaky pool of []byte in the form of a bounded channel.

func NewBytePoolCap

func NewBytePoolCap(maxSize int, width int, capwidth int) (bp *BytePoolCap)

NewBytePoolCap creates a new BytePool bounded to the given maxSize, with new byte arrays sized based on width.

func (*BytePoolCap) Get

func (bp *BytePoolCap) Get() (b []byte)

Get gets a []byte from the BytePool, or creates a new one if none are available in the pool.

func (*BytePoolCap) Put

func (bp *BytePoolCap) Put(b []byte)

Put returns the given Buffer to the BytePool.

func (*BytePoolCap) Width

func (bp *BytePoolCap) Width() (n int)

Width returns the width of the byte arrays in this pool.

func (*BytePoolCap) WidthCap

func (bp *BytePoolCap) WidthCap() (n int)

WidthCap returns the cap width of the byte arrays in this pool.

Jump to

Keyboard shortcuts

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