package cancelreader

Import Path
	github.com/muesli/cancelreader (on go.dev)

Dependency Relation
	imports 7 packages, and imported by one package


Package-Level Type Names (total 5, in which 2 are exported)
/* sort exporteds by: | */
CancelReader is a io.Reader whose Read() calls can be canceled without data being consumed. The cancelReader has to be closed. Cancel cancels ongoing and future reads an returns true if it succeeded. ( CancelReader) Close() error ( CancelReader) Read(p []byte) (n int, err error) CancelReader : io.Closer CancelReader : io.ReadCloser CancelReader : io.Reader func NewReader(reader io.Reader) (CancelReader, error) func github.com/charmbracelet/ultraviolet.NewCancelReader(r io.Reader) (CancelReader, error)
File represents an input/output resource with a file descriptor. ( File) Close() error Fd returns its file descriptor Name returns its file name. ( File) Read(p []byte) (n int, err error) ( File) Write([]byte) (int, error) github.com/charmbracelet/ultraviolet.File (interface) *os.File File : github.com/charmbracelet/ultraviolet.File File : github.com/charmbracelet/x/term.File File : internal/bisect.Writer File : io.Closer File : io.ReadCloser File : io.Reader File : io.ReadWriteCloser File : io.ReadWriter File : io.WriteCloser File : io.Writer
Package-Level Functions (total 2, in which 1 is exported)
NewReader returns a reader and a cancel function. If the input reader is a File, the cancel function can be used to interrupt a blocking read call. In this case, the cancel function returns true if the call was canceled successfully. If the input reader is not a File, the cancel function does nothing and always returns false. The Linux implementation is based on the epoll mechanism.
Package-Level Variables (only one, which is exported)
ErrCanceled gets returned when trying to read from a canceled reader.