Parail
Parail is easily switch between sequential and parallel.
Usage
Add this to your Cargo.toml:
[]
= { = "0.1", = ["iter", "stream"] }
Examples
Parallel for Iterator
Use rayon as a parallel processing backend.
use *;
Output example:
do something: 4
do something: 6
do something: 7
do something: 1
do something: 0
do something: 5
do something: 3
do something: 2
do something: 8
do something: 9
result: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Parallel for futures::Stream
Use tokio as a parallel processing backend.
use StreamExt;
use *;
async
async
Output example:
do something: 6
do something: 8
do something: 9
do something: 0
do something: 1
do something: 2
do something: 7
do something: 3
do something: 5
do something: 4
result: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Implemented functions
More features will be added as needed.
- for
Iterator- par_map
- par_filter
- par_filter_map
- for
futures::Stream- par_map
- par_map_async
- par_filter
- par_filter_async
- par_filter_map
- par_filter_map_async