io

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package io is Evie's console package: print, println, prompt and readln.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Construct

func Construct() *vm.Package

Construct builds the io package using os.Stdin and os.Stdout.

func ConstructWith

func ConstructWith(in goio.Reader, out goio.Writer) *vm.Package

ConstructWith builds an isolated io package reading from in (or os.Stdin when nil) and writing to out (or os.Stdout when nil).

Types

type LineReader

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

LineReader reads lines from one source for everyone who reads from it: the io package of any number of engines, and the host itself, such as a REPL reading its own input between scripts. Give it to an engine as evie.Options.Stdin and the io package reads through it rather than through a buffer of its own, so no reader takes lines meant for another.

A read that is cancelled leaves its line pending, and the next read gets it, so no line is lost. A Read of the source itself cannot be cancelled: one that never returns keeps its goroutine until the source is closed.

func NewLineReader

func NewLineReader(src goio.Reader) *LineReader

NewLineReader makes a line reader for src

func (*LineReader) Read

func (r *LineReader) Read(p []byte) (int, error)

Read makes a LineReader an io.Reader, so it can be an engine's Stdin; it hands out whole lines, each with a newline

func (*LineReader) ReadLine

func (r *LineReader) ReadLine(ctx context.Context) (line string, eof bool, err error)

ReadLine reads the next line without its line ending; eof says the source has no more. When ctx is done first, the read gives up with ctx's cause.

Jump to

Keyboard shortcuts

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