id_effect 0.2.0

Effect<A, E, R> (sync + async), context/layers, pipe — interpreter-style, no bundled executor
Documentation
1
2
3
4
5
6
7
8
9
10
//! Ex 070 — `map_par_n` applies a pure map with bounded parallelism.
use id_effect::{Stream, run_blocking, succeed};

fn main() {
  let s = Stream::from_iterable([1_i32, 2, 3, 4]).map_par_n(2, |n| succeed::<i32, (), ()>(n * 10));
  let mut v = run_blocking(s.run_collect(), ()).expect("collect");
  v.sort();
  assert_eq!(v, vec![10, 20, 30, 40]);
  println!("070_stream_map_par_n ok");
}