Macro scan_rules::readln [] [src]

macro_rules! readln {
    ($($rules:tt)*) => { ... };
}

Reads a line of text from standard input, then scans it using the provided rules. The result of the readln! invocation is the type of the rule bodies; just as with match, all bodies must agree on their result type.

Note that this macro automatically flushes standard output. As a result, if you use this macro while you are holding a lock on standard output, your program will deadlock.

If you wish to read from standard input whilst manually locking standard output, you should use scan! directly.

This macro cannot be used to capture slices of the input; all captured values must be owned.

See also: Pattern Syntax, try_readln!.

Panics

Panics if an error is encountered while reading from standard input, or if all rules fail to match.