use redline::redline;

#[redline(allocs = 0, syscalls = 0)]
fn map_sum(data: &[i32]) -> i32 {
    let mut total = 0;
    for i in 0..10 {
        let doubled = (|x: i32| x * 2)(data.get(i).copied().unwrap_or(0));
        total += doubled;
    }
    total
}

#[redline(latency = "< 1ms")]
fn with_closure() -> u64 {
    let square = |x: u64| x * x;
    let mut sum = 0u64;
    for i in 0..100 {
        sum += square(i);
    }
    sum
}

fn main() {}
