mozilla/rust — pull request #12559 by SiegeLord (2014-02-26 02:01:00+00:00)
Title: Implement Container for some Reader/Writers

It seems useful to have the ability to query the length of some Reader/Writers. I implemented it for Reader/Writers for which it made the most sense to me. E.g. I omitted TeeReader as it's not clear what length would refer to in that case.

Notably missing is the implementation of this for File, but I don't know if it can be done in general, as the stat function can fail. Maybe this isn't the right approach at all and a new trait is required (akin to Iterator's `size_hint`).

My use case, incidentally, is to pass Rust a rust Reader/Writer to a C library custom file interface which, amongst other things, requires me to report the size of the 'file'.