Crate unroll_range
source ·Expand description
Repeats a block of code for each number in the specified range.
Arguments
$range
- A range (inclusive or exclusive) over which to repeat the block.$block
- A closure that takes a single parameteri
and contains the code to execute.
Examples
unroll_range::unroll_range!(1..=3, |i| {
println!("Number: {}", i);
});
// This will print:
// Number: 1
// Number: 2
// Number: 3
unroll_range::unroll_range!(1..3, |i| {
println!("Number: {}", i);
});
// This will print:
// Number: 1
// Number: 2