io

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: MPL-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package io provides context-aware I/O operations.

Index

Constants

This section is empty.

Variables

View Source
var ErrClosedPipe = stdio.ErrClosedPipe

Functions

func CopyContext

func CopyContext(ctx context.Context, dst DeadlineWriter, src DeadlineReader) (written int64, err error)

CopyContext is equivalent to `io.Copy` but with context cancellation support (for deadline reader/writers).

func Pipe

func Pipe() (*PipeReader, *PipeWriter)

Pipe is equivalent to `io.Pipe` but with deadline support.

func SetNonblock added in v0.4.2

func SetNonblock(f *os.File) error

Types

type DeadlineReadCloser

type DeadlineReadCloser interface {
	DeadlineReader
	stdio.Closer
}

type DeadlineReader

type DeadlineReader interface {
	stdio.Reader
	SetReadDeadline(t time.Time) error
}

Reader types.

func NopDeadlineReader

func NopDeadlineReader(r stdio.Reader) DeadlineReader

type DeadlineWriteCloser

type DeadlineWriteCloser interface {
	DeadlineWriter
	stdio.Closer
}

type DeadlineWriter

type DeadlineWriter interface {
	stdio.Writer
	SetWriteDeadline(t time.Time) error
}

Writer types.

func NopDeadlineWriter

func NopDeadlineWriter(w stdio.Writer) DeadlineWriter

type PipeReader

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

A PipeReader is the read half of a pipe.

func (*PipeReader) Close

func (r *PipeReader) Close() error

func (*PipeReader) Read

func (r *PipeReader) Read(data []byte) (n int, err error)

func (*PipeReader) SetReadDeadline

func (r *PipeReader) SetReadDeadline(t time.Time) error

type PipeWriter

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

A PipeWriter is the write half of a pipe.

func (*PipeWriter) Close

func (w *PipeWriter) Close() error

func (*PipeWriter) SetWriteDeadline

func (w *PipeWriter) SetWriteDeadline(t time.Time) error

func (*PipeWriter) Write

func (w *PipeWriter) Write(data []byte) (n int, err error)

Jump to

Keyboard shortcuts

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