rust/library/std/src
Mara 60138110d7
Rollup merge of #81136 - Xavientois:io_reader_size_hint, r=cramertj
Improved IO Bytes Size Hint

After trying to implement better `size_hint()` return values for `File` in [this PR](https://github.com/rust-lang/rust/pull/81044) and changing to implementing it for `BufReader` in [this PR](https://github.com/rust-lang/rust/pull/81052), I have arrived at this implementation that provides tighter bounds for the `Bytes` iterator of various readers including `BufReader`, `Empty`, and `Chain`.

Unfortunately, for `BufReader`, the size_hint only improves after calling `fill_buffer` due to it using the contents of the buffer for the hint. Nevertheless, the the tighter bounds  should result in better pre-allocation of space to handle the contents of the `Bytes` iterator.

Closes #81052
2021-03-05 10:57:17 +01:00
..
backtrace Add Frames iterator for Backtrace 2021-01-23 11:56:33 -06:00
collections Fix std tests 2021-03-03 11:22:51 +01:00
env std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
error std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
f32 std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
f64 std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
ffi Convert primitives to use intra-doc links 2021-02-25 20:31:53 -05:00
fs std: Fix test got_symlink_permission on Windows 2020-11-16 21:09:26 +03:00
io Rollup merge of #81136 - Xavientois:io_reader_size_hint, r=cramertj 2021-03-05 10:57:17 +01:00
lazy Upgrade wasm32 image to Ubuntu 20.04 2021-02-06 13:05:56 +01:00
memchr std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
net add #[inline] to all the public IpAddr functions 2021-02-03 10:53:25 -05:00
num rustc_expand: Mark inner #![test] attributes as soft-unstable 2020-11-20 19:35:03 +03:00
os Rollup merge of #82712 - CDirkx:cfg-target_os, r=dtolnay 2021-03-03 16:27:47 +09:00
panic review: fix nits and move panic safety tests to the correct place 2020-09-25 23:10:24 +02:00
path Refactor parse_prefix on Windows 2020-11-07 16:15:48 +01:00
prelude expand/resolve: Turn #[derive] into a regular macro attribute 2021-02-07 20:08:45 +03:00
process std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
sync Rollup merge of #82578 - camsteffen:diag-items, r=oli-obk 2021-03-01 11:25:07 -05:00
sys Auto merge of #82718 - JohnTitor:rollup-vpfx3j2, r=JohnTitor 2021-03-03 08:36:46 +00:00
sys_common library: Normalize safety-for-unsafe-block comments 2021-02-24 06:13:42 +01:00
thread Rollup merge of #79849 - Digital-Chaos:sleep-zero, r=m-ou-se 2021-02-10 12:24:18 +09:00
time Duration::zero() -> Duration::ZERO 2020-10-21 20:44:03 -07:00
alloc.rs Fix safety comment 2021-01-07 09:13:21 +01:00
ascii.rs Convert many files to intra-doc links 2020-09-02 17:37:40 -04:00
backtrace.rs Add Frames iterator for Backtrace 2021-01-23 11:56:33 -06:00
env.rs Document security implications of std::env::temp_dir 2021-01-20 11:24:47 -08:00
error.rs Add impl Error for Arc 2021-02-22 12:49:42 +00:00
f32.rs doc: cube root, not cubic root 2021-02-26 19:03:44 +01:00
f64.rs doc: cube root, not cubic root 2021-02-26 19:03:44 +01:00
fs.rs Add doc aliases for "delete" 2021-01-31 11:07:37 +01:00
keyword_docs.rs Convert primitives to use intra-doc links 2021-02-25 20:31:53 -05:00
lazy.rs Clarify that SyncOnceCell::set blocks. 2021-02-28 12:57:38 -08:00
lib.rs Rollup merge of #80189 - jyn514:convert-primitives, r=poliorcetics 2021-03-02 21:23:12 +09:00
macros.rs Use #[doc = include_str!()] in std 2021-02-23 15:54:55 +01:00
memchr.rs std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
num.rs std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
panic.rs Fixed minor typo in catch_unwind docs 2021-02-13 16:59:06 +01:00
panicking.rs fix another comment, and make __rust_start_panic code a bit more semantically clear 2020-12-25 23:37:27 +01:00
path.rs Rollup merge of #82128 - anall:feature/add_diagnostic_items, r=davidtwco 2021-02-23 02:51:51 +01:00
primitive_docs.rs Convert primitives to use intra-doc links 2021-02-25 20:31:53 -05:00
process.rs Seal the CommandExt, OsStrExt and OsStringExt traits 2021-02-10 21:30:30 +00:00
rt.rs Prevent __rust_begin_short_backtrace frames from being tail-call optimised away 2020-08-07 19:31:25 +01:00
time.rs Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00