Create a macro "closure"
This built-in macro takes another macro and an arbitrarty number or arguments as parameters and returns a reference to a macro that has these arguments appended on every invocation.
Example
use std::macros::bind;
macro print_prefixed($prefix, $arg) {
println!("{}{}", $prefix, $arg);
}
macro foreach($f, $arg...) {
$f!($arg)$...;
}
// prefix1
// prefix2
// prefix3
foreach!(
bind!(print_prefixed, "prefix"),
1,
2,
3
);
Run this example