Help us shape the future of Go! Take the 2026 Go Developer Survey

padding

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: MIT Imports: 5 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(b []byte, width uint) []byte

Bytes is shorthand for declaring a new default padding-writer instance, used to immediately pad a byte slice.

func String

func String(s string, width uint) string

String is shorthand for declaring a new default padding-writer instance, used to immediately pad a string.

Types

type PaddingFunc

type PaddingFunc func(w io.Writer)

type Writer

type Writer struct {
	Padding uint
	PadFunc PaddingFunc
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(width uint, paddingFunc PaddingFunc) *Writer

func NewWriterPipe

func NewWriterPipe(forward io.Writer, width uint, paddingFunc PaddingFunc) *Writer

func (*Writer) Bytes

func (w *Writer) Bytes() []byte

Bytes returns the padded result as a byte slice.

func (*Writer) Close

func (w *Writer) Close() (err error)

Close will finish the padding operation.

func (*Writer) Flush added in v0.3.0

func (w *Writer) Flush() (err error)

Flush will finish the padding operation. Always call it before trying to retrieve the final result.

func (*Writer) String

func (w *Writer) String() string

String returns the padded result as a string.

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

Write is used to write content to the padding buffer.

Jump to

Keyboard shortcuts

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