unroll_range 0.2.0

Repeats a block of code for each number in a specified range.
Documentation
//! 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 parameter `i` 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
//! ```
#[macro_export]
macro_rules! unroll_range {
    ($range:expr, $block:expr) => {
        for i in $range {
            {
                $block(i);
            }
        }
    };
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn it_works() {
        unroll_range!(1..=5, |i| {
            println!("The value of i is {}", i);
        });
    }
}