Function itertools::flatten [] [src]

Important traits for Flatten<I, J>
pub fn flatten<I, J>(iterable: I) -> Flatten<I::IntoIter, J> where
    I: IntoIterator,
    I::Item: IntoIterator<IntoIter = J, Item = J::Item>,
    J: Iterator

Flatten an iterable of iterables into a single combined sequence of all the elements in the iterables.

This is more or less equivalent to .flat_map with an identity function.

This is an IntoIterator-enabled version of the .flatten() adaptor.

use itertools::flatten;

let data = vec![vec![1, 2, 3], vec![4, 5, 6]];

itertools::assert_equal(flatten(&data),
                        &[1, 2, 3, 4, 5, 6]);