rust/src/libstd/io
bors 89573b3c8b Auto merge of #58422 - LukasKalbertodt:seek-convenience, r=alexcrichton
Add provided methods `Seek::{stream_len, stream_position}`

This adds two new, provided methods to the `io::Seek` trait:
- `fn stream_len(&mut self) -> Result<u64>`
- `fn stream_position(&mut self) -> Result<u64>`

Both are added for convenience and to improve readability in user code. Reading `file.stream_len()` is much better than to manually seek two or three times. Similarly, `file.stream_position()` is much more clear than `file.seek(SeekFrom::Current(0))`.

You can find prior discussions [in this internals thread](https://internals.rust-lang.org/t/pre-rfc-idea-extend-io-seek-with-convenience-methods-with-e-g-stream-len/9262). I think I addressed all concerns in that thread.

I already wrote three RFCs to add a small new API to libstd but I noticed that many public changes to libstd happen without an RFC. So I figured I can try opening a PR directly without going through RFCs first. After all, we do have rfcbot here too. If you think this change is too big to merge without an RFC, I can still close this PR and write an RFC.
2019-03-21 14:28:18 +00:00
..
buffered.rs Auto merge of #58913 - Milack27:patch_buf_reader, r=joshtriplett 2019-03-21 05:41:13 +00:00
cursor.rs Overwrite Cursor's Seek::stream_{len, position} for performance 2019-03-14 13:43:19 +01:00
error.rs libstd: implement Error::source for io::Error 2019-03-05 19:54:15 -08:00
impls.rs Use the correct stderr when testing libstd 2019-02-28 19:09:17 -08:00
lazy.rs libstd => 2018 2019-02-28 04:06:15 +09:00
mod.rs Auto merge of #58422 - LukasKalbertodt:seek-convenience, r=alexcrichton 2019-03-21 14:28:18 +00:00
prelude.rs Remove licenses 2018-12-25 21:08:33 -07:00
stdio.rs expand unused doc comment diagnostic 2019-03-08 12:39:50 -05:00
util.rs libstd => 2018 2019-02-28 04:06:15 +09:00