Open
Description
Feature gate: #![feature(vec_deque_pop_if)]
Similar to #122741, but this time with VecDeque
instead of Vec
.
Public API
impl<T> VecDeque<T> {
pub fn pop_front_if(&mut self, predicate: impl FnOnce(&mut T) -> bool) -> Option<T>;
pub fn pop_back_if(&mut self, predicate: impl FnOnce(&mut T) -> bool) -> Option<T>;
}
Steps / History
- ACP:
pop_if
orEntry
/Peek
-like API forVec
andVecDeque
libs-team#208 - Implementation: Implement
VecDeque::pop_front_if
&VecDeque::pop_back_if
#135890 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
Vec::pop_if
uses an explicit generic parameter for the predicate. But that might change (Tracking Issue forVec::pop_if
#122741 (comment)). If it does not, probably change these methods instead to be consistent.