mozilla/rust — pull request #12414 by DaGenix (2014-02-20 05:03:59+00:00)
Title: Create an Iterator wrapper over IoResults that fail!()s on Errors

Create IoResultIterator which adds an extension method to Iterators over IoResults to make working with errors easier, especially for simpler programs that don't want to deal with error handling. Also, update the existing IO iterators to produce IoResults instead of suppressing errors. With this change, a simple program that just echos back lines from STDIN looks like:

```rust
use std::io;
use std::io::BufferedReader;
use std::io::util::IoResultIterator;

fn main() {
for line in BufferedReader::new(io::stdin()).lines().fail_on_error() {
print!("received: {}", line);
}
}
```

Fixes #12368