Skip to main content

cfg_join

Macro cfg_join 

Source
macro_rules! cfg_join {
    ($e1: expr, $e2: expr) => { ... };
}
Expand description

Executes two closures. If parallel feature is enabled, the closures are executed in parallel using rayon::join. Otherwise, they are executed sequentially. The result is returned as a tuple.

let (two, five) = cfg_join!(|| { 1 + 1 }, || { 2 + 3 });

The macro can also be nested to join more than two closures:


let (two, (five, seven)) =
    cfg_join!(|| { 1 + 1 }, || cfg_join!(|| { 2 + 3 }, || { 1 + 6 }));