Documentation
¶
Index ¶
- func PutAtoBuffer(buf AtomicBuffers)
- type AtomicBuffers
- type ByteBuffer
- func (b *ByteBuffer) Len() int
- func (b *ByteBuffer) Reset()
- func (b *ByteBuffer) Set(p []byte)
- func (b *ByteBuffer) SetString(s string)
- func (b *ByteBuffer) String() string
- func (b *ByteBuffer) Write(p []byte) (int, error)
- func (b *ByteBuffer) WriteByte(c byte) error
- func (b *ByteBuffer) WriteRune(r rune) (n int, err error)
- func (b *ByteBuffer) WriteString(s string) (int, error)
- type ByteBufferPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PutAtoBuffer ¶
func PutAtoBuffer(buf AtomicBuffers)
PutBuffer returns a atomicBuffer to the pool
Types ¶
type AtomicBuffers ¶
type AtomicBuffers interface {
Bytes() []byte
Cap() int
Grow(int)
Len() int
Next(int) []byte
ReadByte() (byte, error)
ReadBytes(byte) ([]byte, error)
ReadFrom(io.Reader) (int64, error)
ReadRune() (rune, int, error)
ReadString(byte) (string, error)
Reset()
Truncate(int)
UnreadByte() error
UnreadRune() error
WriteByte(byte) error
WriteRune(rune) (int, error)
WriteString(string) (int, error)
WriteTo(io.Writer) (int64, error)
Read([]byte) (int, error)
Write([]byte) (int, error)
String() string
}
func GetAtoBuffer ¶
func GetAtoBuffer() AtomicBuffers
GetBuffer fetches a atomicBuffer from the pool
type ByteBuffer ¶
type ByteBuffer struct {
// B is a byte buffer to use in append-like workloads.
// See example code for details.
B []byte
}
ByteBuffer provides byte buffer, which can be used with fasthttp API in order to minimize memory allocations.
ByteBuffer may be used with functions appending data to the given []byte slice. See example code for details.
Use AcquireByteBuffer for obtaining an empty byte buffer.
func (*ByteBuffer) Len ¶
func (b *ByteBuffer) Len() int
Len returns the number of accumulated bytes; b.Len() == len(b.String()).
func (*ByteBuffer) SetString ¶
func (b *ByteBuffer) SetString(s string)
SetString sets ByteBuffer.B to s
func (*ByteBuffer) String ¶
func (b *ByteBuffer) String() string
String returns the accumulated string.
func (*ByteBuffer) Write ¶
func (b *ByteBuffer) Write(p []byte) (int, error)
Write implements io.Writer - it appends p to ByteBuffer.B
func (*ByteBuffer) WriteByte ¶
func (b *ByteBuffer) WriteByte(c byte) error
func (*ByteBuffer) WriteRune ¶
func (b *ByteBuffer) WriteRune(r rune) (n int, err error)
(r rune) (n int, err error) { WriteString appends s to ByteBuffer.B
func (*ByteBuffer) WriteString ¶
func (b *ByteBuffer) WriteString(s string) (int, error)
WriteString appends s to ByteBuffer.B
type ByteBufferPool ¶
type ByteBufferPool struct {
// contains filtered or unexported fields
}
func (*ByteBufferPool) Acquire ¶
func (p *ByteBufferPool) Acquire() *ByteBuffer
func (*ByteBufferPool) Release ¶
func (p *ByteBufferPool) Release(b *ByteBuffer)