Type Alias itertools::structs::Intersperse

source ·
pub type Intersperse<I> = IntersperseWith<I, IntersperseElementSimple<<I as Iterator>::Item>>;
Expand description

An iterator adaptor to insert a particular value between each element of the adapted iterator.

Iterator element type is I::Item

This iterator is fused.

See .intersperse() for more information.

Aliased Type§

struct Intersperse<I> {
    element: IntersperseElementSimple<<I as Iterator>::Item>,
    iter: Fuse<I>,
    peek: Option<Option<<I as Iterator>::Item>>,
}

Fields§

§element: IntersperseElementSimple<<I as Iterator>::Item>§iter: Fuse<I>§peek: Option<Option<<I as Iterator>::Item>>

peek is None while no item have been taken out of iter (at definition). Then peek will alternatively be Some(None) and Some(Some(item)), where None indicates it’s time to generate from element (unless iter is empty).