Documentation
¶
Overview ¶
see https://github.com/mailru/easyjson/blob/master/buffer/pool.go
I need Reset() method to test, bu private functions prevents to embed Buffer
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(cfg PoolConfig)
Init sets up a non-default pooling and allocation strategy. Should be run before serialization is done.
Types ¶
type EJBuffer ¶
type EJBuffer struct {
// Buf is the current chunk that can be used for serialization.
Buf []byte
// contains filtered or unexported fields
}
Buffer is a buffer optimized for serialization without extra copying.
func (*EJBuffer) EnsureSpace ¶
EnsureSpace makes sure that the current chunk contains at least s free bytes, possibly creating a new chunk.
func (*EJBuffer) WriteString ¶
AppendBytes appends a string to buffer.
type PoolConfig ¶
type PoolConfig struct {
StartSize int // Minimum chunk size that is allocated.
PooledSize int // Minimum chunk size that is reused, reusing chunks too small will result in overhead.
MaxSize int // Maximum chunk size that will be allocated.
}
PoolConfig contains configuration for the allocation and reuse strategy.
Click to show internal directories.
Click to hide internal directories.