Documentation
¶
Overview ¶
Package buffer provides a thin wrapper around a byte slice as well as portion of the strconv package's zero-allocation formatters.
It is a simplification of the zap package's internal implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a thin wrapper around a byte slice.
A Buffer is intended to be constructed via a sync.Pool using Get.
func Get ¶
func Get() *Buffer
Get retrieves a Buffer from a sync.Pool, constructing one if necessary.
The caller must call Buffer.Free on the returned Buffer after using it to ensure that it's returned to the sync.Pool.
func (*Buffer) AppendByte ¶
AppendByte writes a single byte to the Buffer.
func (*Buffer) AppendString ¶
AppendString writes a string to the Buffer.
func (*Buffer) Free ¶
func (b *Buffer) Free()
Free returns the Buffer to a sync.Pool.
Callers must not retain references to the Buffer after calling Free.