[Pre-RFC] Peeking from Peekable with less unwrapping
Rust Internals [Unofficial]
April 13, 2026
There's Peekable::next_if_map which acts similarly, but your API can do a few things it can't (although it isn't very good at doing the "map" part of that API). It reminds me of the difference between the normal map APIs and the entry-based APIs.
Note that if your API offers enough over next_if_map to be worth adding as a stable API, it should probably have a Peeked::get_mut (which allows changing the value in the peek slot): I can't think of any reason not to add it and it would be consistent with the other APIs.
Discussion in the ATmosphere