Crate io_read_line_prototype[][src]

Expand description

Prototype for io::read_line.

This serves as a counterpart to io::read_to_string and is inspired by proposals such as std::io::input.

This method makes it easier to read a line from a reader into a string, and leaves more advances input proposals for later. For example C++’s text parsing proposal provides a coherent text parsing counterpart using format!-like syntax, and would be interesting to explore porting to Rust.


// Before
let mut line = String::new();
io::stdin().read_line(&mut line)?;

// After
let line = read_line(io::stdin())?;


Read a line from a reader into a new String.