Documentation ¶
Overview ¶
Package tools contains helpers
Index ¶
- func LazyClose(p io.Closer)
- type LazyBuffer
- func (buf *LazyBuffer) Bytes() []byte
- func (buf *LazyBuffer) Len() int
- func (buf *LazyBuffer) Print(a ...any) error
- func (buf *LazyBuffer) Printf(format string, a ...any) error
- func (buf *LazyBuffer) Println(a ...any) error
- func (buf *LazyBuffer) String() string
- func (buf *LazyBuffer) Sys() *bytes.Buffer
- func (buf *LazyBuffer) Write(b []byte) (int, error)
- func (buf *LazyBuffer) WriteBytes(s ...[]byte)
- func (buf *LazyBuffer) WriteRunes(runes ...rune)
- func (buf *LazyBuffer) WriteStrings(strings ...string)
- func (buf *LazyBuffer) WriteTo(out io.Writer) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LazyBuffer ¶
LazyBuffer is a bytes.Buffer that minimizes counting and error checks.
func (*LazyBuffer) Bytes ¶
func (buf *LazyBuffer) Bytes() []byte
Bytes returns the stored data as a bytes slice.
func (*LazyBuffer) Len ¶
func (buf *LazyBuffer) Len() int
Len tells the size in bytes of the currently stored data.
func (*LazyBuffer) Print ¶
func (buf *LazyBuffer) Print(a ...any) error
Print appends the fmt.Print equivalent to the buffer.
func (*LazyBuffer) Printf ¶
func (buf *LazyBuffer) Printf(format string, a ...any) error
Printf appends the fmt.Printf equivalent to the buffer.
func (*LazyBuffer) Println ¶
func (buf *LazyBuffer) Println(a ...any) error
Println appends the fmt.Println equivalent to the buffer.
func (*LazyBuffer) String ¶
func (buf *LazyBuffer) String() string
String returns the stored data as string.
func (*LazyBuffer) Sys ¶
func (buf *LazyBuffer) Sys() *bytes.Buffer
Sys returns the underlying bytes.Buffer.
func (*LazyBuffer) Write ¶
func (buf *LazyBuffer) Write(b []byte) (int, error)
Write implements the standard io.Writer interface.
func (*LazyBuffer) WriteBytes ¶
func (buf *LazyBuffer) WriteBytes(s ...[]byte)
WriteBytes writes the given byte arrays to the buffer.
func (*LazyBuffer) WriteRunes ¶
func (buf *LazyBuffer) WriteRunes(runes ...rune)
WriteRunes appends the given runes as UTF-8 characters to the buffer.
func (*LazyBuffer) WriteStrings ¶
func (buf *LazyBuffer) WriteStrings(strings ...string)
WriteStrings writes the given strings as UTF-8 to the buffer.