rust/src/libstd
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
..
collections Rollup merge of #59082 - alexreg:cosmetic-2-doc-comments, r=Centril 2019-03-16 22:39:56 +08:00
ffi Use lifetime contravariance to elide more lifetimes in core+alloc+std 2019-03-09 19:10:28 -08:00
io Auto merge of #58422 - LukasKalbertodt:seek-convenience, r=alexcrichton 2019-03-21 14:28:18 +00:00
net std: Delete a by-definition spuriously failing test 2019-03-08 07:41:19 -08:00
os SGX target: Expose thread id function in os module 2019-03-05 13:35:57 -08:00
prelude libstd => 2018 2019-02-28 04:06:15 +09:00
sync Resolved nits raised in review. 2019-03-11 15:54:57 +00:00
sys Rollup merge of #59082 - alexreg:cosmetic-2-doc-comments, r=Centril 2019-03-16 22:39:56 +08:00
sys_common Use lifetime contravariance to elide more lifetimes in core+alloc+std 2019-03-09 19:10:28 -08:00
tests libstd => 2018 2019-02-28 04:06:15 +09:00
thread race condition in thread local storage example 2019-03-03 20:53:50 +01:00
alloc.rs libstd => 2018 2019-02-28 04:06:15 +09:00
ascii.rs Remove licenses 2018-12-25 21:08:33 -07:00
build.rs libstd => 2018 2019-02-28 04:06:15 +09:00
Cargo.toml libstd => 2018 2019-02-28 04:06:15 +09:00
env.rs libstd => 2018 2019-02-28 04:06:15 +09:00
error.rs Use lifetime contravariance to elide more lifetimes in core+alloc+std 2019-03-09 19:10:28 -08:00
f32.rs Rollup merge of #58812 - jonhoo:floor_v_trunc, r=alexcrichton 2019-03-19 15:16:50 +01:00
f64.rs Rollup merge of #58812 - jonhoo:floor_v_trunc, r=alexcrichton 2019-03-19 15:16:50 +01:00
fs.rs Rollup merge of #59082 - alexreg:cosmetic-2-doc-comments, r=Centril 2019-03-16 22:39:56 +08:00
future.rs Update the future/task API 2019-02-03 13:46:53 -08:00
keyword_docs.rs libs: doc comments 2019-02-10 23:57:25 +00:00
lib.rs Add todo!() macro 2019-03-18 19:27:31 +03:00
macros.rs Rollup merge of #57847 - clarcharr:dbg_no_params, r=Centril 2019-03-19 15:16:46 +01:00
memchr.rs libstd => 2018 2019-02-28 04:06:15 +09:00
num.rs libstd => 2018 2019-02-28 04:06:15 +09:00
panic.rs libstd => 2018 2019-02-28 04:06:15 +09:00
panicking.rs Use the correct stderr when testing libstd 2019-02-28 19:09:17 -08:00
path.rs Use lifetime contravariance to elide more lifetimes in core+alloc+std 2019-03-09 19:10:28 -08:00
primitive_docs.rs libs: doc comments 2019-02-10 23:57:25 +00:00
process.rs Don't run test launching echo since that doesn't exist on Windows 2019-03-14 05:53:44 +01:00
rt.rs libstd => 2018 2019-02-28 04:06:15 +09:00
time.rs Make std time tests more robust for platform differences 2019-03-12 17:51:39 -07:00