Skip to content

jakubadamw/rayon-join-macro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rayon-join-macro

Build status crates.io docs.rs Code coverage License: MIT

A wrapper around rayon::join that accepts more than 2 and up to 8 closures to be run in parallel.

Documentation

use rayon_join_macro::join;

fn main() {
    fn factorial(n: usize) -> usize {
        if n == 0 { 1 } else { n * factorial(n - 1) }
    }

    let (a, b, c): (u16, String, usize) = join!(
        || (1..=50).sum(),
        || "abc".repeat(3),
        || factorial(8)
    );

    assert_eq!(a, 1275);
    assert_eq!(b, "abcabcabc");
    assert_eq!(c, 40320);
}

About

A convenience n-ary macro around `rayon::join()`

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages