example/
example.rs

1use func::func;
2
3fn main() {
4    let coeff = 3; // Captured variable
5    let add_mul = func! { [coeff] | a, b | {
6        let result = (a + b) * coeff;
7        println!("Adding {} to {} and multiplying by {} = {}", a, b, coeff, result);
8        result
9    }};
10
11    assert_eq!(add_mul.call(1, 2), 9);
12}