fmtfwd

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeFormat

func MakeFormat(s fmt.State, verb rune) (justV bool, format string)

MakeFormat is a helper to aid with the implementation of fmt.Formatter for custom types. It reproduces the format currently active in fmt.State and verb. This is provided because Go's standard fmt.State does not make the original format string available to us.

If the return value justV is true, then the current state was found to be %v exactly; in that case the caller can avoid a full-blown Printf call and use just Print instead to take a shortcut.

func ReproducePrintf

func ReproducePrintf(w io.Writer, s fmt.State, verb rune, arg interface{})

ReproducePrintf formats the value of arg using the current formatting parameters in the provided fmt.State and verb, into the provided io.Writer.

When implementing a Format() method, one can use

ReproducePrintf(s, s, verb, ...)

Where the fmt.State is used both as the source of formatting parameters and the output destination.

Types

This section is empty.

Jump to

Keyboard shortcuts

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