byteslice

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(size int) []byte

Get returns a byte slice with given length from the built-in pool.

func Put

func Put(buf []byte)

Put returns the byte slice to the built-in pool.

Types

type Pool

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

Pool consists of 32 sync.Pool, representing byte slices of length from 0 to 32 in powers of 2.

func (*Pool) Get

func (p *Pool) Get(size int) (buf []byte)

Get retrieves a byte slice of the length requested by the caller from pool or allocates a new one.

func (*Pool) Put

func (p *Pool) Put(buf []byte)

Put returns the byte slice to the pool.

Jump to

Keyboard shortcuts

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