Uh oh!
There was an error while loading. Please reload this page.
Proposal to add Peekable::peek_mut - #77491
Conversation
rust-highfive
commented
Oct 3, 2020
r? @kennytm (rust_highfive has picked a reviewer for you, use r? to override) |
jyn514
commented
Oct 3, 2020
What's the use case for adding this? |
I've a iterator of |
timvermeulen
commented
Oct 3, 2020
+1, I've been wanting to add this 🙂 |
Dylan-DPC-zz
commented
Oct 23, 2020
@lukaslueg can you open an issue regarding this? once that's done update |
Dylan-DPC-zz
commented
Nov 17, 2020
@rust-lang/libs would like your thoughts on this proposal so we can move forward with this |
dtolnay
commented
Nov 21, 2020
+1, I am on board with this. |
lukaslueg
commented
Nov 22, 2020
Expanded docs, similar to |
jyn514
commented
Nov 22, 2020
I'd add |
bors
commented
Nov 23, 2020
☔ The latest upstream changes (presumably #79319) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels: |
Rebased due to #77697. Note that I went light on adding new tests for |
m-ou-se
commented
Nov 24, 2020
Looks like nobody is against adding this (as unstable). :) @bors r+ rollup |
bors
commented
Nov 24, 2020
📌 Commit 3b01562 has been approved by |
bors
commented
Nov 25, 2020
bors
commented
Nov 25, 2020
☀️ Test successful - checks-actions |
…JohnTitor Stabilize `peekable_peek_mut` Resolvesrust-lang#78302. Also adds some documentation on `std::iter::Iterator::peekable()` regarding the new method. The feature was added in rust-lang#77491 in Nov' 20, which is recently, but the feature seems reasonably small. Never did a stabilization-pr, excuse my ignorance if there is a protocol I'm not aware of.
Stabilize `peekable_peek_mut` Resolvesrust-lang#78302. Also adds some documentation on `std::iter::Iterator::peekable()` regarding the new method. The feature was added in rust-lang#77491 in Nov' 20, which is recently, but the feature seems reasonably small. Never did a stabilization-pr, excuse my ignorance if there is a protocol I'm not aware of.
Stabilize `peekable_peek_mut` Resolvesrust-lang#78302. Also adds some documentation on `std::iter::Iterator::peekable()` regarding the new method. The feature was added in rust-lang#77491 in Nov' 20, which is recently, but the feature seems reasonably small. Never did a stabilization-pr, excuse my ignorance if there is a protocol I'm not aware of.
A "peekable" iterator has a
peek()-method which provides an immutable reference to the next item. We currently do not have a method to modify that item, which we could easily add via apeek_mut(). See the test for a use-case (alike to my original use case), where a "pristine" iterator is passed on after modifying its state viapeek_mut().If there is interest in this, I can expand on the tests and docs.