par-array-init
The par-array-init
crate allows you to initialize arrays with an initializer closure that will be called in parallel to fill the array.
This crate mirrors the api of crate array-init with the caveat that initialization is performed in parallel.
An important departure from array-init
, initialization order is not deterministic and should not be relied on.
Parallelization is achieved using rayon and it's ParallelIterator
api.
Examples:
extern crate par_array_init;
extern crate rayon;
use ;
// Initialize an array of length 10 containing successive squares
let arr: = par_array_init;
// Initialize an array from an iterator producing an array of 34 repeated
let mut iter = repeat.take;
let arr: = from_par_iter;