This crate makes it easy to transform functions or closures into two objects: one that can be run on a thread pool, and a [Future
] on its result. Contrarily to other existing solution, starting the computation is independent from polling the future. It is entirely independent of both the thread or thread pool used to run the actual computations and the future executor.
The entry-point is [closure_future
].
Examples
Workers can be run on threads:
# use Duration;
# use closure_future;
# use block_on;
let = closure_future;
spawn;
assert_eq!
Workers can also be run using rayon global thread-pool, using a provided helper function:
# use Duration;
# use spawn_rayon;
# use block_on;
let mut futures = Vec new;
for i in 0..10
for in futures.into_iter.enumerate