Open
Description
This is a tracking issue for the Iterator::intersperse
and intersperse_with
methods. It is based on itertools::intersperse
and is the iterator equivalent of Vec::join
.
The feature gate for the issue is #![feature(iter_intersperse)]
.
Public API
// core::iter
pub trait Iterator {
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where
Self: Sized,
Self::Item: Clone;
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where
Self: Sized,
G: FnMut() -> Self::Item;
}
#[derive(Debug, Clone)]
pub struct Intersperse<I: Iterator> where I::Item: Clone {}
impl<I> Iterator for Intersperse<I> where I: Iterator, I::Item: Clone {
type Item = I::Item;
}
pub struct IntersperseWith<I, G> where I: Iterator {}
impl<I, G> Debug for IntersperseWith<I, G> where I: Iterator + Debug, I::Item: Debug, G: Debug {}
impl<I, G> Clone for IntersperseWith<I, G> where I: Iterator + Clone, I::Item: Clone, G: Clone {}
impl<I, G> Iterator for IntersperseWith<I, G> where I: Iterator, G: FnMut() -> I::Item {
type Item = I::Item;
}
Steps / History
- Implement
intersperse
: AddIterator::intersperse
#79479 - Add
intersperse_with
: Add Iterator::intersperse_with #80567 - FCP
- Stabilization PR: Stabilize
Iterator::intersperse()
#88548
(UPDATE: stabilization was reverted because there was a lot of breakage: Stabilizing Iterator::intersperse breaks a large number of crates #88967) - Determine how to avoid breakage and un-revert
- Add
impl<I: FusedIterator> FusedIterator for Intersperse<I>
? (Can be added after stabilization, so not urgent.)
Unresolved Questions
None.
Metadata
Metadata
Assignees
Labels
Area: IteratorsCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs issues that are tracked on the team's project board.Relevant to the library API team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.