txt

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 3 Imported by: 0

README

Text Format

A utility packge for writing text files. For cases where you want to avoid fmt.FprintX, offers some speed advantage.

Simple benchmark provided presents a 69(nice)% runtime improvement.

goos: windows
goarch: amd64
pkg: github.com/EliCDavis/polyform/formats/txt
cpu: 13th Gen Intel(R) Core(TM) i7-13800H
BenchmarkFormat_Fprintf-20               	 2945271	       405.8 ns/op	     119 B/op	       0 allocs/op
BenchmarkFormat_TextWriter-20            	 9266608	       124.3 ns/op	      81 B/op	       0 allocs/op

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

func NewWriter

func NewWriter(out io.Writer) *Writer

func (*Writer) Append added in v0.16.0

func (w *Writer) Append(p []byte)

func (Writer) Error

func (w Writer) Error() error

func (*Writer) FinishEntry added in v0.16.0

func (w *Writer) FinishEntry() (int, error)

func (*Writer) Float64

func (w *Writer) Float64(f float64)

func (*Writer) Float64MaxFigs

func (w *Writer) Float64MaxFigs(f float64, figs int)

func (*Writer) Int

func (w *Writer) Int(i int)

func (*Writer) NewLine

func (w *Writer) NewLine()

func (*Writer) Space

func (w *Writer) Space()

func (*Writer) StartEntry added in v0.16.0

func (w *Writer) StartEntry()

func (*Writer) String

func (w *Writer) String(s string)

func (*Writer) Tab

func (w *Writer) Tab()

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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