Macro avalanche::enclose[][src]

macro_rules! enclose {
    ($($x : ident), * ; $y : expr) => { ... };
}
Expand description

Takes a list of identifiers terminated by a semicolon and expression. Each identifier is cloned, and made available to the expression. The macro evaluates to that expression. This is useful for passing things like state and setters to multiple component props.

Example

let message = "Enclose me!".to_owned();
let closure1 = enclose!(message; move || println!("{}", message));
let closure2 = enclose!(message; move || eprintln!("{}", message));