[−][src]Crate par_stream
Asynchronous parallel streams analogous to rayon.
The ParStreamExt and TryParStreamExt traits extends existing Streams with parallel stream combinators.
The followings are common combinators.
stream.par_then(limit, map_fut)
processes stream items to parallel futures.stream.par_map(limit, map_fn)
processes stream items to parallel closures.stream.par_then_unordered(limit, map_fut)
is unordered version ofstream.par_then
.stream.par_then_init(limit, init_fut, map_fut)
accepts an extra in-local thread initializer.stream.try_par_then(limit, map_fut)
is the fallible version ofstream.par_then
.
The limit
parameter configures the worker pool size. It accepts the following values.
None
: The worker pool size scales to the number of system CPUs, and double size of input buffer.10
or non-zero integers: Scales the worker pool size to absolute 10, and double size of input buffer.2.3
or non-zero floating points: Scale the number of workers to 2.3 times the number of system CPUs, and double size of input buffer.(10, 15)
: Scales to absolute 10 workers, and sets the input buffer size to 15.
Structs
Enums
ParStreamConfig | Parallel stream configuration. |
Traits
IntoParStreamConfig | A helper trait that converts types to parallel stream configuration. |
ParFuture | An extension trait for Future that provides combinator functions for parallelism. |
ParStreamExt | An extension trait for Stream that provides parallel combinator functions. |
TryParStreamExt | An extension trait for TryStream that provides parallel combinator functions. |
Functions
par_gather | Collect multiple streams into single stream. |