1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use read;
use std::io::{self, BufReader, Stdin};
pub struct FromStdin(BufReader<Stdin>);
impl FromStdin {
pub fn new() -> FromStdin {
FromStdin(BufReader::new(io::stdin()))
}
pub fn all(&mut self) -> String {
read::whole_stream(&mut self.0)
}
}
impl Default for FromStdin {
fn default() -> FromStdin {
FromStdin::new()
}
}
impl Iterator for FromStdin {
type Item = String;
fn next(&mut self) -> Option<Self::Item> {
read::next_line(&mut self.0)
}
}