iotool

package
v0.0.0-...-b359386 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeoutErr = fmt.Errorf("writer closed due to timeout")

Functions

This section is empty.

Types

type SafeWriter

type SafeWriter struct {
	W io.Writer
	// contains filtered or unexported fields
}

SafeWriter provides a thread-safe io.Writer

func (*SafeWriter) SetWriter

func (s *SafeWriter) SetWriter(w io.Writer)

func (*SafeWriter) Write

func (s *SafeWriter) Write(p []byte) (int, error)

type TimeoutWriter

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

TimeoutWriter accepts input until expiration, then returns errors.

An error will be written to the wrapped writer unless `Finished` is called before the timeout.

func NewTimeoutWriter

func NewTimeoutWriter(w io.Writer, patience time.Duration) *TimeoutWriter

func NewTimeoutWriterFromChan

func NewTimeoutWriterFromChan(w io.Writer, done <-chan time.Time) *TimeoutWriter

func (*TimeoutWriter) Finished

func (w *TimeoutWriter) Finished()

func (*TimeoutWriter) Write

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

Jump to

Keyboard shortcuts

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