iou

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrReader

func ErrReader(err error) io.Reader

ErrReader returns an io.Reader that always simply returns the error.

func ErrWriter

func ErrWriter(err error) io.Writer

ErrWriter returns an io.Writer that always simply returns the error.

Types

type CloseFunc

type CloseFunc func() error

CloseFunc makes any func() error a Closer

func (CloseFunc) Close

func (c CloseFunc) Close() error

type DeferredReader

type DeferredReader struct {
	R    io.Reader
	Init func() error
	// contains filtered or unexported fields
}

func (*DeferredReader) Read

func (d *DeferredReader) Read(p []byte) (n int, err error)

type MultiCloser

type MultiCloser []io.Closer

MultiCloser implements Closer by calling lots of Closers

func MultiCloserAppend

func MultiCloserAppend(i io.Closer, cs ...io.Closer) MultiCloser

MultiCloserAppend is a helper method for appending several closers into one closer

func (MultiCloser) Close

func (mc MultiCloser) Close() error

type ReadCloser

type ReadCloser struct {
	io.Reader
	io.Closer
}

ReadCloser implements io.ReadCloser in a struct with embedded types so we can use it above.

type ReaderFunc

type ReaderFunc func(bs []byte) (int, error)

A ReaderFunc is any func that can read into a slice.

func (ReaderFunc) Read

func (f ReaderFunc) Read(bs []byte) (int, error)

Read implements Reader

type WriteCloser

type WriteCloser struct {
	io.Writer
	io.Closer
}

WriteCloser implements io.WriteCloser with the components separated back out. Most useful for doing multiple actions upon Close() in combination with MultiCloser.

type WriterFunc

type WriterFunc func(bs []byte) (int, error)

A WriterFunc is any func that can write a slice into something else.

func (WriterFunc) Write

func (f WriterFunc) Write(bs []byte) (int, error)

Writ implements Writer

Jump to

Keyboard shortcuts

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