Function io_prompt_prototype::read_line[][src]

pub fn read_line() -> Result<String>
Expand description

Reads a line of input from stdin.

This is a shorthand for calling Stdin::read_line and reading it into a new string.

Examples

use io_prompt_prototype::read_line;

print!("What's your favorite number? >");
let num: u16 = read_line()?.parse()?;
println!("Oh, cool: {}!", num);