Reading input from stdin produces a String
, but how do I convert it to an integer?
use std::io;
fn main() {
println!("Type something");
let mut input = String::new();
io::stdin()
.read_line(&mut input)
.expect("Failed to read line");
println!("{}", input);
}