Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBytes ¶
GetBytes returns *[]byte from SlicePool
Example ¶
str := "hello, world"
// Obtain a buffer from the pool.
bufPtr := GetBytes(len(str))
defer PutBytes(bufPtr)
buf := *bufPtr
copy(buf, []byte(str))
if string(buf) != str {
panic("wrong slice buffer content!!")
}
func GetBytesBuffer ¶
GetBytesBuffer returns bytes.Buffer from pool
Types ¶
type New ¶
type New func() PoolObject
type ObjectPool ¶
type ObjectPool struct {
New New
// contains filtered or unexported fields
}
Pool is bytes.Buffer Pool
func NewObjectPool ¶
func NewObjectPool(n New) *ObjectPool
Click to show internal directories.
Click to hide internal directories.