MCPcopy Create free account
hub / github.com/djherbis/buffer / NewPoolAt

Function NewPoolAt

pool_at.go:26–34  ·  view source on GitHub ↗

NewPoolAt returns a PoolAt(), it's backed by a sync.Pool so its safe for concurrent use. Get() and Put() errors will always be nil. It will not work with gob.

(New func() BufferAt)

Source from the content-addressed store, hash-verified

24// Get() and Put() errors will always be nil.
25// It will not work with gob.
26func NewPoolAt(New func() BufferAt) PoolAt {
27 return &poolAt{
28 poolAt: sync.Pool{
29 New: func() interface{} {
30 return New()
31 },
32 },
33 }
34}
35
36func (p *poolAt) Get() (BufferAt, error) {
37 return p.poolAt.Get().(BufferAt), nil

Callers 3

NewMemPoolAtFunction · 0.85
UnmarshalBinaryMethod · 0.85
TestPoolAtFunction · 0.85

Calls 1

NewFunction · 0.85

Tested by 1

TestPoolAtFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…