StandardIn structv0.1.0

Source
Standard input, with the console-versus-redirection question answered at acquisition.
pub struct StandardIn {
    pub pendingCount: uint;
    // private fields
}

On Windows a console delivers UTF-16, which arrives here converted to UTF-8 so a program reads the same bytes whether its input is typed or piped; a redirected stream is read as the bytes it is. The value carries the few bytes of a converted character that did not fit the caller's buffer, and a surrogate half waiting for the other, so no reading pattern can tear a character.

Fields

NameTypeDescription
pendingCountuintHow many of them there are.

Associated functions

Acquire

pub func Acquire() -> StandardIn

The process's standard input. Asks the platform once whether the stream is a console; nothing is opened, and nothing needs closing.

Returns: the stream, which the process owns for its whole life

Source

Implements Reader

StandardIn conforms to Reader.

Read

pub func Read(
    self: &var StandardIn,
    into: var char8[..]
) -> uint ! IoError

Fills what it can of into from standard input.

NameTypeDescription
intovar char8[..]receives the bytes

Returns: how many bytes were read; IsEnd at the end of input

Source