Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Tank ¶
type Tank struct {
// contains filtered or unexported fields
}
Tank implements a sync.Pool for bytes.Buffer
func (Tank) Put ¶
Put empties the buffer and returns it back to the pool.
bp := New(320) buf := bp.Get() defer bp.Put(buf) // your code return buf.String()
If you use Bytes() function to return bytes make sure you copy the data away otherwise your returned byte slice will be empty. For using String() no copying is required.
Click to show internal directories.
Click to hide internal directories.