iox

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 3 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	In  io.Reader    `json:"-"`
	Out bytes.Buffer `json:"-"`
	Err bytes.Buffer `json:"-"`
}

Buffer is useful for testing.

func (*Buffer) IO

func (oi *Buffer) IO() IO

type IO

type IO struct {
	In  io.Reader `json:"-"` // standard input
	Out io.Writer `json:"-"` // standard output
	Err io.Writer `json:"-"` // standard error
}

IO represents the standard input, output, and error stream.

func Discard

func Discard() IO

Discard returns an IO that discards Stderr and Stdout.

func (IO) Stderr

func (oi IO) Stderr() io.Writer

Stderr returns IO.Err. Defaults to os.Stderr.

func (IO) Stdin

func (oi IO) Stdin() io.Reader

Stdin returns IO.In. Defaults to os.Stdin.

func (IO) Stdout

func (oi IO) Stdout() io.Writer

Stdout returns IO.In. Defaults to os.Stdout.

type IOSetable

type IOSetable interface {
	SetStdio(oi IO) error
}

IOSetable can be implemented to receive an IO.

type IOable

type IOable interface {
	Stdio() IO
}

IOable can be implemented to return an IO.

type Stderrer

type Stderrer interface {
	Stderr() io.Writer
}

type Stdiner

type Stdiner interface {
	Stdin() io.Reader
}

type Stdioer

type Stdioer interface {
	Stderrer
	Stdiner
	Stdouter
}

type Stdouter

type Stdouter interface {
	Stdout() io.Writer
}

Jump to

Keyboard shortcuts

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