closure! - A macro for individually capturing variables
This crate provides a macro which lets you write closures that can capture individually either by moving, referencing, mutably referencing of cloning.
Usage
Start by adding an entry to your Cargo.toml
:
[]
= "*"
Then import the crate with macro use enabled:
extern crate closure;
Then you can write closures like so:
let string = String from;
let x = 10;
let mut y = 20;
let rc = new;
let closure = closure!;