Documentation ¶
Overview ¶
Package buffer implements compile.CodeBuffer and compile.DataBuffer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrSizeLimit = sizeError("buffer size limit exceeded") ErrStaticSize = sizeError("static buffer capacity exceeded") )
Errors implementing interface{ BufferSizeLimit() string }.
Functions ¶
This section is empty.
Types ¶
type Dynamic ¶ added in v0.8.0
type Dynamic struct {
// contains filtered or unexported fields
}
Dynamic is a variable-capacity buffer. The default value is a valid buffer.
func NewDynamic ¶ added in v0.8.0
NewDynamic buffer. The slice must be empty.
func NewDynamicHint ¶ added in v0.8.0
NewDynamicHint avoids making excessive allocations if the maximum buffer size can be estimated in advance. The slice must be empty.
func (*Dynamic) ResizeBytes ¶ added in v0.8.0
ResizeBytes doesn't panic unless out of memory.
type Limited ¶ added in v0.8.0
type Limited struct {
// contains filtered or unexported fields
}
Limited is a dynamic buffer with a maximum size. The default value is an empty buffer that cannot grow.
func NewLimited ¶ added in v0.8.0
NewLimited buffer with a maximum size. The slice must be empty.
func (*Limited) Extend ¶ added in v0.8.0
Extend panics with ErrSizeLimit if n bytes cannot be appended to the buffer.
func (*Limited) PutByte ¶ added in v0.8.0
PutByte panics with ErrSizeLimit if the buffer is already full.
func (*Limited) PutUint32 ¶ added in v0.11.0
Extend panics with ErrSizeLimit if 4 bytes cannot be appended to the buffer.
func (*Limited) ResizeBytes ¶ added in v0.8.0
ResizeBytes panics with ErrSizeLimit if n is larger than maximum buffer size.
type Static ¶ added in v0.8.0
type Static struct {
// contains filtered or unexported fields
}
Static is a fixed-capacity buffer, for wrapping a memory-mapped region. The default value is a zero-capacity buffer.
func MakeStatic ¶ added in v0.8.0
MakeStatic buffer. The slice must be empty, but it must be able to support the specified capacity.
This function can be used in field initializer expressions. The initialized field must not be copied.
func NewStatic ¶ added in v0.8.0
NewStatic buffer. The slice must be empty, but it must be able to support the specified capacity.
func (*Static) Extend ¶ added in v0.8.0
Extend panics with ErrStaticSize if n bytes cannot be appended to the buffer.
func (*Static) PutByte ¶ added in v0.8.0
PutByte panics with ErrStaticSize if the buffer is already full.
func (*Static) PutUint32 ¶ added in v0.11.0
Extend panics with ErrStaticSize if 4 bytes cannot be appended to the buffer.
func (*Static) ResizeBytes ¶ added in v0.8.0
ResizeBytes panics with ErrStaticSize if n is larger than maximum buffer size.