package pbytes
Import Path
github.com/gobwas/pool/pbytes (on go.dev)
Dependency Relation
imports one package, and imported by one package
Involved Source Files
Package pbytes contains tools for pooling byte pool.
Note that by default it reuse slices with capacity from 128 to 65536 bytes.
pool.go
Package-Level Type Names (only one)
Pool contains logic of reusing byte slices of various size.
Get returns probably reused slice of bytes with at least capacity of c and
exactly len of n.
GetCap returns probably reused slice of bytes with at least capacity of n.
GetLen returns probably reused slice of bytes with at least capacity of n
and exactly len of n.
Put returns given slice to reuse pool.
It does not reuse bytes whose size is not power of two or is out of pool
min/max range.
func Custom(opts ...pool.Option) *Pool
func New(min, max int) *Pool
var DefaultPool *Pool
Package-Level Functions (total 6)
New creates new Pool with given options.
Get returns probably reused slice of bytes with at least capacity of c and
exactly len of n.
Get is a wrapper around DefaultPool.Get().
GetCap returns probably reused slice of bytes with at least capacity of n.
GetCap is a wrapper around DefaultPool.GetCap().
GetLen returns probably reused slice of bytes with at least capacity of n
and exactly len of n.
GetLen is a wrapper around DefaultPool.GetLen().
New creates new Pool that reuses slices which size is in logarithmic range
[min, max].
Note that it is a shortcut for Custom() constructor with Options provided by
pool.WithLogSizeMapping() and pool.WithLogSizeRange(min, max) calls.
Put returns given slice to reuse pool.
Put is a wrapper around DefaultPool.Put().
Package-Level Variables (only one)
DefaultPool is used by pacakge level functions.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |