about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-03-21 14:28:18 +0000
committerbors <bors@rust-lang.org>2019-03-21 14:28:18 +0000
commit89573b3c8b629507130b1ec8beeaf550fdc0e046 (patch)
tree1ba57102396b918c7e59e7a73ddf69ddc1ae8856 /src/libstd/sys/unix/stack_overflow.rs
parent48e354d224ff38ccde3936479a7f514b6492e910 (diff)
parentf95219fa580a514b5ca6c1425335afadbe394b57 (diff)
downloadrust-89573b3c8b629507130b1ec8beeaf550fdc0e046.tar.gz
rust-89573b3c8b629507130b1ec8beeaf550fdc0e046.zip
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.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions