bytex

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Put

func Put[T Bytes | BytesBuffer](buf T)

Put puts the buffer(either Bytes or BytesBuffer) back to the pool.

func WithBuffer

func WithBuffer(fn func(BytesBuffer) error, size ...uint64) error

WithBuffer relies on GetBuffer to get a buffer, calls the function with the buffer, finally, puts it back to the pool after the function returns.

func WithBytes

func WithBytes(fn func(Bytes) error, size ...uint64) error

WithBytes relies on GetBytes to get a buffer, calls the function with the buffer, finally, puts it back to the pool after the function returns.

Types

type Bytes

type Bytes = []byte

func GetBytes

func GetBytes(size ...uint64) Bytes

GetBytes gets a bytes buffer from the pool, which can specify with a size, default is 32k.

type BytesBuffer

type BytesBuffer = *bytes.Buffer

func GetBuffer

func GetBuffer(size ...uint64) BytesBuffer

GetBuffer is similar to GetBytes, but it returns the bytes buffer wrapped by bytes.Buffer.

Jump to

Keyboard shortcuts

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