Skip to main content

clone_captures

Macro clone_captures 

Source
macro_rules! clone_captures {
    ($($alias:ident $(= $value:expr)?),+ $(,)?; $body:expr) => { ... };
    (@clone $alias:ident = $value:expr) => { ... };
    (@clone $alias:ident) => { ... };
}
Expand description

Clones values into new bindings and evaluates a body with those bindings in scope, which saves writing out the clones before a move closure. Each alias before the semicolon is either a name, which clones the variable of that name, or name = expression, which clones the value of the expression. The body follows the semicolon.