Tracking Issue for new `VecDeque` methods `prepend`, `extend_front`, `splice`, `extend_from_within` and `prepend_from_within`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Feature gate: #![feature(deque_extend_front)]
This is a tracking issue for 5 new methods on VecDeque similar to ones already on Vec or their counterparts that push to the front instead of back.
ACP: https://github.com/rust-lang/libs-team/issues/658
Public API
// alloc::collections::vec_deque
impl<T> VecDeque<T> {
// Preserves order of elements.
pub fn prepend<I>(&mut self, other: I)
where
I: IntoIterator<Item = T>,
I::Iter: DoubleEndedIterator
{
self.extend_front(other.into_iter().rev())
}
// Reverses order of elements.
pub fn extend_front<I>(&mut self, other: I)
where
I: IntoIterator<Item = T>;
pub fn splice<R, I>(&mut self, range: R, replace_with: I) -> Splice<'_, I::IntoIter, A>
where
R: RangeBounds<usize>,
I: IntoIterator<Item = T>;
}
impl<T: Clone> VecDeque<T> {
pub fn extend_from_within<R>(&mut self, src: R)
where
R: RangeBounds<usize>;
// Preserves order of elements.
pub fn prepend_from_within<R>(&mut self, src: R)
where
R: RangeBounds<usize>;
}
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
- Implementation:
- extend_front, prepend: #146861
- specialization of
deque1.prepend(deque2.drain(range)): #150595 - part of #150597
- specialization of
- extend_from_within, prepend_from_within: #147161
- splice: #147247
- extend_front, prepend: #146861
- Final comment period (FCP)^1
- Stabilization PR
Unresolved Questions
- Exact moving/allocation behavior of
VecDeque::splicein the less optimal conditions (see "This is optimal if:" in the doc), see https://github.com/rust-lang/rust/pull/147247/files#r2507005344
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the public API in alloc::collections::vec_deque and review the implementation and discussion in PR #147247, especially the unresolved moving and allocation behavior for splice. Done means resolving remaining stabilization questions, completing the final comment period, and opening a stabilization PR.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100