Files
adler32
ansi_term
atty
backtrace
backtrace_sys
bitflags
byteorder
cfg_if
clap
color_quant
crossbeam_deque
crossbeam_epoch
crossbeam_queue
crossbeam_utils
deflate
either
event_loop
failure
failure_derive
float
fnv
gif
gl
graphics
image
inflate
input
interpolation
jpeg_decoder
lazy_static
libc
lzw
memoffset
num
num_cpus
num_derive
num_integer
num_iter
num_rational
num_traits
opengl_graphics
piston
png
rand
rayon
rayon_core
read_color
rustc_demangle
scoped_threadpool
scopeguard
sdl2
sdl2_sys
sdl2_window
serde
serde_derive
shader_version
shaders_graphics2d
colored
textured
sorting_visualization
strsim
synstructure
texture
textwrap
tiff
unicode_width
vec_map
vecmath
viewport
window
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use super::plumbing::*;
use super::*;

/// `Flatten` turns each element to an iterator, then flattens these iterators
/// together. This struct is created by the [`flatten()`] method on
/// [`ParallelIterator`].
///
/// [`flatten()`]: trait.ParallelIterator.html#method.flatten
/// [`ParallelIterator`]: trait.ParallelIterator.html
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[derive(Debug, Clone)]
pub struct Flatten<I: ParallelIterator> {
    base: I,
}

impl<I, PI> Flatten<I>
where
    I: ParallelIterator<Item = PI>,
    PI: IntoParallelIterator + Send,
{
    /// Create a new `Flatten` iterator.
    pub(super) fn new(base: I) -> Self {
        Flatten { base }
    }
}

impl<I, PI> ParallelIterator for Flatten<I>
where
    I: ParallelIterator<Item = PI>,
    PI: IntoParallelIterator + Send,
{
    type Item = PI::Item;

    fn drive_unindexed<C>(self, consumer: C) -> C::Result
    where
        C: UnindexedConsumer<Self::Item>,
    {
        fn id<T>(x: T) -> T {
            x
        }

        self.base.flat_map(id).drive_unindexed(consumer)
    }
}