strbuilder

package
v0.100.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package strbuilder defines a string builder type that allocates less than the standard library's strings.Builder by using a sync.Pool, so it doesn't matter if the compiler can't prove that the builder doesn't escape into the fmt package, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

func Get

func Get() *Builder

Get returns a new or reused string Builder.

func (*Builder) Grow

func (b *Builder) Grow(n int)

Grow grows the buffer's capacity, if necessary, to guarantee space for another n bytes. After Grow(n), at least n bytes can be written to the buffer without another allocation. If n is negative, Grow will panic. If the buffer can't grow it will panic with ErrTooLarge.

func (*Builder) String

func (b *Builder) String() string

String both returns the Builder's string, and returns the builder to the pool.

func (*Builder) Write

func (b *Builder) Write(p []byte) (int, error)

func (*Builder) WriteByte

func (b *Builder) WriteByte(v byte) error

func (*Builder) WriteInt

func (b *Builder) WriteInt(v int64)

func (*Builder) WriteString

func (b *Builder) WriteString(s string) (int, error)

func (*Builder) WriteUint

func (b *Builder) WriteUint(v uint64)

Jump to

Keyboard shortcuts

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