clone

Macro clone 

Source
macro_rules! clone {
    ( $( $var:ident ),* => async move $body:block ) => { ... };
    ( $( $var:ident ),* => $body:block ) => { ... };
    ( $( $var:ident ),* => move |$( $arg:ident $(: $ty:ty)? ),*| async move $body:block ) => { ... };
    ( $( $var:ident ),* => |$( $arg:ident $(: $ty:ty)? ),*| async move $body:block ) => { ... };
    ( $( $var:ident ),* => move |$( $arg:ident $(: $ty:ty)? ),*| $body:block ) => { ... };
    ( $( $var:ident ),* => |$( $arg:ident $(: $ty:ty)? ),*| $body:block ) => { ... };
}
Expand description

A helper macro to clone variables into closures or async blocks easily.

This macro supports several usage patterns:

  • Clone variables into an async move block.
  • Clone variables into a regular block.
  • Clone variables into an async move closure with or without explicit move.
  • Clone variables into a regular closure with or without explicit move.