rust/library
Yuki Okushi 4463b08652
Rollup merge of #86037 - soerenmeier:cursor_remaining, r=yaahc
Add `io::Cursor::{remaining, remaining_slice, is_empty}`

Tracking issue: #86369

I came across an inconvenience when answering the following [Stack Overflow](https://stackoverflow.com/questions/67831170) question.
To get the remaining slice you have to call `buff.fill_buf().unwrap()`. Which in my opinion doesn't really tell you what is returned (in the context of Cursor). To improve readability and convenience when using Cursor i propose adding the method `remaining`.

The next thing i found inconvenient (unnecessary long) was detecting if the cursor reached the end. There are a few ways this can be achieved right now:
- `buff.fill_buf().unwrap().is_empty()`
- `buff.position() >= buff.get_ref().len()`
- `buff.bytes().next().is_none()`

Which all seem a bit unintuitive, hidden in trait documentations or just a bit long for such a simple task.
Therefor i propose another method called `is_empty`, maybe with another name, since this one may leave room for interpretation on what really is empty (the underlying slice, the remaining slice or maybe the position).

Since it seemed easier to create this PR instead of an RFC i did that, if an RFC is wanted, i can close this PR and write an RFC first.
2021-06-22 07:37:46 +09:00
..
alloc Auto merge of #85980 - ssomers:btree_cleanup_LeafRange, r=Mark-Simulacrum 2021-06-20 22:52:49 +00:00
backtrace@221483ebaf Update backtrace to 0.3.57 2021-04-25 13:48:03 -07:00
core Rollup merge of #86452 - the8472:fix-zip-drop-safety, r=m-ou-se 2021-06-21 09:42:17 +09:00
panic_abort rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
panic_unwind rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
proc_macro Improve documentation 2021-06-20 22:19:47 +02:00
profiler_builtins Update cc 2021-05-24 23:34:12 +01:00
rtstartup Bump bootstrap compiler to 1.50 beta 2020-12-30 09:27:19 -05:00
rustc-std-workspace-alloc
rustc-std-workspace-core Fix rustc-std-workspace-core documentation 2020-12-20 15:23:21 +08:00
rustc-std-workspace-std
std Rollup merge of #86037 - soerenmeier:cursor_remaining, r=yaahc 2021-06-22 07:37:46 +09:00
stdarch@3001c75a1d Update stdarch submodule to stabilize simd_x86_bittest feature 2021-06-13 02:29:17 +09:00
term rustdoc: link to stable/beta docs consistently in documentation 2021-06-04 14:18:21 -04:00
test Use as_secs_f64 in JunitFormatter 2021-06-17 03:23:17 +08:00
unwind Support Android ndk versions r23-beta3 and up 2021-06-01 21:37:50 +02:00