Module std::io

Standard I/O operations.

Read from stdin and write to stdout or stderr.

Examples

import std::io;

fn main() {
    io.write("enter your name: ");
    let name = io.read_line();
    io.write("hello, ");
    io.write(name);
    io.write("\n");
}

Contents

Functions

Function read_line

pub fn read_line() -> string

Read a single line from standard input.

Strips the trailing newline. Returns an empty string on EOF or error.

Function write

pub fn write(s: string)

Write a string to standard output without a trailing newline.

Function write_err

pub fn write_err(s: string)

Write a string to standard error without a trailing newline.

Function read_all

pub fn read_all() -> string

Read all available data from standard input.

Returns an empty string on error.