Tracking Issue for Iterator::intersperse · Issue #79524 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@camelid

Description

@camelid

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

Unresolved Questions

None.