bind!() { /* proc-macro */ }Expand description
Binds some arguments of a function to a closure.
The arguments to be bound are denoted by _ (underscore) in the function signature.
ยงExample:
fn foo(a: i32, b: i32, c: i32, d: i32) { a + b + c + d }
let bar = bind(foo(1, _, 3, _));
assert_eq!(bar(2, 4), foo(1, 2, 3, 4));
let baz = bind(foo(_, 2, _, 4));
assert_eq!(baz(1, 3), foo(1, 2, 3, 4));