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

margin

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: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

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

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

func String

func String(s string, width uint, margin uint) string

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

Types

type Writer

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

func NewWriter

func NewWriter(width uint, margin uint, marginFunc func(io.Writer)) *Writer

func (*Writer) Bytes

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

Bytes returns the result as a byte slice.

func (*Writer) Close

func (w *Writer) Close() error

Close will finish the margin operation. Always call it before trying to retrieve the final result.

func (*Writer) String

func (w *Writer) String() string

String returns the result as a string.

func (*Writer) Write

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

Jump to

Keyboard shortcuts

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