Tracking Issue for Iterator::intersperse
· Issue #79524 · rust-lang/rust (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
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 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 Iterator for Intersperse 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
: Add Iterator::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.