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
Unresolved Questions
Feature gate:
#![feature(vec_deque_pop_if)]Similar to #122741, but this time with
VecDequeinstead ofVec.Public API
Steps / History
pop_iforEntry/Peek-like API forVecandVecDequelibs-team#208VecDeque::pop_front_if&VecDeque::pop_back_if#135890vec_deque_pop_if#145992Unresolved Questions
Vec::pop_ifuses 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.Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩