Function itertools::intersperse
source · [−]pub fn intersperse<I>(iterable: I, element: I::Item) -> Intersperse<I::IntoIter> where
I: IntoIterator,
<I as IntoIterator>::Item: Clone,
Expand description
Iterate iterable
with a particular value inserted between each element.
IntoIterator
enabled version of Iterator::intersperse
.
use itertools::intersperse;
itertools::assert_equal(intersperse((0..3), 8), vec![0, 8, 1, 8, 2]);