iter_maybe_parallel

Macro iter_maybe_parallel 

Source
macro_rules! iter_maybe_parallel {
    ($expr:expr) => { ... };
}
Expand description

Macro for conditionally parallel iteration over ranges.

When the parallel feature is enabled, uses into_par_iter(). Otherwise, uses into_iter() for sequential execution.

§Examples

use crate::iter_maybe_parallel;

// Range iteration
let results: Vec<_> = iter_maybe_parallel!((0..100))
    .map(|i| i * 2)
    .collect();

// Vec iteration (consuming)
let vec = vec![1, 2, 3];
let results: Vec<_> = iter_maybe_parallel!(vec)
    .map(|x| x * 2)
    .collect();