bytes

package
v2.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package bytes implements performant bytes implementations.

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 wraps a byte slice, providing continence functions.

func (*Buffer) AppendBool

func (b *Buffer) AppendBool(v bool)

AppendBool appends a bool to the underlying Buffer.

func (*Buffer) AppendFloat

func (b *Buffer) AppendFloat(f float64, fmt byte, prec, bitSize int)

AppendFloat appends a float to the underlying Buffer.

func (*Buffer) AppendInt

func (b *Buffer) AppendInt(i int64)

AppendInt appends an integer to the underlying Buffer.

func (*Buffer) AppendTime

func (b *Buffer) AppendTime(t time.Time, layout string)

AppendTime appends a time to the underlying Buffer, in the given layout.

func (*Buffer) AppendUint

func (b *Buffer) AppendUint(i uint64)

AppendUint appends an unsigned integer to the underlying Buffer.

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

Bytes returns a mutable reference to the underlying byte slice.

func (*Buffer) Cap

func (b *Buffer) Cap() int

Cap returns the capacity of the underlying byte slice.

func (*Buffer) Len

func (b *Buffer) Len() int

Len returns the length of the underlying byte slice.

func (*Buffer) Reset

func (b *Buffer) Reset()

Reset resets the underlying byte slice. Subsequent writes re-use the slice's backing array.

func (*Buffer) Write

func (b *Buffer) Write(bs []byte)

Write implements io.Writer.

func (*Buffer) WriteByte

func (b *Buffer) WriteByte(v byte)

WriteByte writes a single byte to the Buffer.

func (*Buffer) WriteString

func (b *Buffer) WriteString(s string)

WriteString writes a string to the Buffer.

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool is a Pool of Buffers.

func NewPool

func NewPool(size int) Pool

NewPool creates a new instance of Pool.

func (Pool) Get

func (p Pool) Get() *Buffer

Get retrieves a Buffer from the Pool, creating one if necessary.

func (Pool) Put

func (p Pool) Put(buf *Buffer)

Put adds a Buffer to the Pool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL