itertools

Function merge

Source
pub fn merge<I, J>(
    i: I,
    j: J,
) -> Merge<<I as IntoIterator>::IntoIter, <J as IntoIterator>::IntoIter>
where I: IntoIterator, J: IntoIterator<Item = I::Item>, I::Item: PartialOrd,
Expand description

Create an iterator that merges elements in i and j.

IntoIterator enabled version of Itertools::merge.

use itertools::merge;

for elt in merge(&[1, 2, 3], &[2, 3, 4]) {
    /* loop body */
}