fn parallel<'a,T, F>(v: &mut [T], ref f: F)
                  where T: Send + Sync + 'a,
                        F: Fn(usize, &mut [T]) + Sync + 'a {
    // FIXME: pick a more appropriate parallel factor
    // FIXME: replace with thread::scoped when it exists again
    let parallelism = 4;
    let size = v.len() / parallelism + 1;
    v.chunks_mut(size).enumerate().map(|(i, chunk)| {
        f(i * size, chunk)
    }).collect::<Vec<_>>();
}
// Executes a closure in parallel over the given mutable slice. The closure `f`
// is run in parallel and yielded the starting index within `v` as well as a
// sub-slice of `v`.
Executes a closure in parallel over the given mutable slice.
Executes a closure in parallel over the given mutable slice .
fn parallel<'a,T, F>(v: &mut [T], ref f: F)
                  where T: Send + Sync + 'a,
                        F: Fn(usize, &mut [T]) + Sync + 'a {
    // FIXME: pick a more appropriate parallel factor
    // FIXME: replace with thread::scoped when it exists again
    let parallelism = 4;
    let size = v.len() / parallelism + 1;
    v.chunks_mut(size).enumerate().map(|(i, chunk)| {
        f(i * size, chunk)
    }).collect::<Vec<_>>();
}
fn parallel < ' a , T , F > ( v : & mut [ T ] , ref f : F ) where T : Send + Sync + ' a , F : Fn ( usize , & mut [ T ] ) + Sync + ' a { // FIXME: pick a more appropriate parallel factor // FIXME: replace with thread::scoped when it exists again let parallelism = 4 ; let size = v . len ( ) / parallelism + 1 ; v . chunks_mut ( size ) . enumerate ( ) . map ( | ( i , chunk ) | { f ( i * size , chunk ) } ) . collect :: < Vec < _ > > ( ) ; }
Executes a closure in parallel over the given mutable slice.
Executes a closure in parallel over the given mutable slice .
v
F