with_clone

Macro with_clone 

Source
macro_rules! with_clone {
    ([$ ($var:ident), *],$body:expr) => { ... };
}
Expand description

Clone variables for closure.

Convenience macro for cloning variables, especially intended to be used in closures. For example, the following:

use appy::with_clone;
let a=1;
let b=2;
with_clone!([a,b],||{
  // ..
});

Will expand to:

use appy::with_clone;
let a=1;
let b=2;
{
  let a=a.clone();
  let b=b.clone();
  ||{
    // ..
  }
};