mozilla/rust — pull request #14568 by erickt (2014-05-31 21:48:01+00:00)
Title: Allow an Iterator to update a &mut [T], add IterReader

This PR adds two features to make it possible to transform an `Iterator` into a `Reader`. The first patch adds a method to mutable slices that allows it to be updated with an `Iterator` without paying for the bounds cost. The second adds a Iterator adaptor, `IterReader`, to provide that `Reader` interface.

I had two questions. First, are these named the right things? Second, should `IterReader` instead wrap an `Iterator>`? This would allow you to `IterReader::new(rdr.bytes())`, which could be useful if you want to apply some iterator transformations on a reader while still exporting the Reader interface, but I'd expect there'd be a lot of overhead annotating each byte with an error result.