io

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package io provides types that enable easy and more consistent input/output by wrapping the standard types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PanicWriter

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

PanicWriter is a writer that panics if a write operation causes an error.

func NewPanicWriter

func NewPanicWriter(writer io.Writer, indentStepSize uint) *PanicWriter

NewPanicWriter returns a new PanicWriter based on a wrapped io.Writer.

func (*PanicWriter) IndentWrites

func (w *PanicWriter) IndentWrites(writesFunc func(*PanicWriter))

IndentWrites takes a callback where all writes made in the callback are indented by the writer's indentation number. If the current writer is already indented, the number of spaces will be additive to the current number of contextual spaces.

func (*PanicWriter) IndentWritesBy added in v0.1.1

func (w *PanicWriter) IndentWritesBy(spaces uint, writesFunc func(*PanicWriter))

IndentWritesBy takes a number of spaces and a callback where all writes made in the callback are indented by the given space number. If the current writer is already indented, the number of spaces will be additive to the current number of contextual spaces.

func (*PanicWriter) Print added in v0.1.1

func (w *PanicWriter) Print(p ...interface{}) int

Print writes the given args to the writer like fmt.Sprint(), and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) Printf added in v0.1.1

func (w *PanicWriter) Printf(format string, p ...interface{}) int

Printf writes the given args to the writer like fmt.Sprintf(), and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) Println added in v0.1.1

func (w *PanicWriter) Println(p ...interface{}) int

Println writes the given args to the writer like fmt.Sprintln(), and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) Write

func (w *PanicWriter) Write(p []byte) (int, error)

Write satisfies the io.Writer interface.

func (*PanicWriter) WriteBytes added in v0.1.1

func (w *PanicWriter) WriteBytes(p []byte) int

WriteBytes writes a given string to the writer, and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) WriteNewLine

func (w *PanicWriter) WriteNewLine() int

WriteNewLine writes a new-line character to the writer, and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) WritePaddedStringLine added in v0.1.1

func (w *PanicWriter) WritePaddedStringLine(p string, padding uint) int

WritePaddedStringLine writes a given number of blank lines before and after a given string (on its own line) to the writer, and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) WriteString

func (w *PanicWriter) WriteString(p string) int

WriteString writes a given string to the writer, and returns the number of bytes that were written. It'll panic if any error occurs during writing.

func (*PanicWriter) WriteStringLine

func (w *PanicWriter) WriteStringLine(p string) int

WriteStringLine writes a given string to the writer with a new-line character after the given string, and returns the number of bytes that were written. It'll panic if any error occurs during writing.

Directories

Path Synopsis
Package printer provides types and methods to encapsulate consistent printing of structures.
Package printer provides types and methods to encapsulate consistent printing of structures.

Jump to

Keyboard shortcuts

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