tools

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package tools contains helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LazyClose

func LazyClose(p io.Closer)

LazyClose closes an io.Closer and discards the error

Types

type LazyBuffer

type LazyBuffer bytes.Buffer

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.

func (*LazyBuffer) WriteTo

func (buf *LazyBuffer) WriteTo(out io.Writer) (int64, error)

WriteTo implements the standard WriteTo() interface.

Jump to

Keyboard shortcuts

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