21 lines
439 B
Rust
21 lines
439 B
Rust
|
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;
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
input
|
||
|
}
|