[][src]Crate parallel_stream

Parallel async rust iterators

Examples

use parallel_stream::prelude::*;

#[async_std::main]
async fn main() {
    let v = vec![1, 2, 3, 4];
    let mut stream = v.into_par_stream().map(|n| async move { n * n });

    let mut out = vec![];
    while let Some(n) = stream.next().await {
        out.push(n);
    }
    out.sort();

    assert_eq!(out, vec![1usize, 4, 9, 16]);
}

Modules

prelude

The parallel stream prelude.

vec

Parallel types for Vec.

Structs

ForEach

Call a closure on each element of the stream.

FromStream

A parallel stream that was created from sequential stream.

Map

A parallel stream that maps value of another stream with a function.

Take

A stream that yields the first n items of another stream.

Traits

IntoParallelStream

Conversion into a ParallelStream.

ParallelStream

Parallel version of the standard Stream trait.

Functions

from_stream

Converts a stream into a parallel stream.