formatter

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func If

func If[T any](f Formatter, format string, arg *T) (int, error)

func IfErr

func IfErr[T any](w WithError, format string, arg *T) int

Types

type Formatter

type Formatter struct {
	WriteFn func(w io.Writer, format string, args ...any) (int, error)
	// contains filtered or unexported fields
}

func New

func New(w io.Writer) Formatter

func (Formatter) Format

func (f Formatter) Format(format string, args ...any) (int, error)

func (Formatter) WithError

func (f Formatter) WithError() WithError

func (Formatter) WriteBytes

func (f Formatter) WriteBytes(b []byte) (int, error)

func (Formatter) WriteString

func (f Formatter) WriteString(str string) (int, error)

type WithError

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

func StoreError

func StoreError(f Formatter) WithError

func (WithError) Err

func (w WithError) Err() error

func (*WithError) Format

func (w *WithError) Format(format string, args ...any) int

func (*WithError) WriteBytes

func (w *WithError) WriteBytes(b []byte) int

func (*WithError) WriteString

func (w *WithError) WriteString(str string) int

Jump to

Keyboard shortcuts

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