Update root helpers.rs

This commit is contained in:
Brian Buller 2017-12-01 08:36:38 -06:00
parent 76528c87d9
commit b3860dfb28
1 changed files with 20 additions and 0 deletions

20
helpers.rs Normal file
View File

@ -0,0 +1,20 @@
use std::io;
pub fn read_std_in() -> String {
let mut input = String::new();
let mut done = false;
while !done {
match io::stdin().read_line(&mut input) {
Ok(n) => {
if n == 0 {
done = true;
}
},
Err(error) => {
println!("error: {}", error);
done = true;
},
}
}
return String::from(input.trim());
}