Macro perspective_client::clone
source · macro_rules! clone { (impl @bind $i:tt { $($orig:tt)* } { }) => { ... }; (impl @bind $i:tt { $($orig:tt)* } { $binder:tt }) => { ... }; (impl @expand { $($orig:tt)* } { $($binder:tt)* } $i:tt) => { ... }; (impl @expand { $($orig:tt)* } { $($binder:tt)* } $i:tt ()) => { ... }; (impl @expand { $($orig:tt)* } { $($binder:tt)* } $i:tt . 0) => { ... }; (impl @expand { $($orig:tt)* } { $($binder:tt)* } $i:tt . 1) => { ... }; (impl @expand { $($orig:tt)* } { $($binder:tt)* } $i:tt . 2) => { ... }; (impl @expand { $($orig:tt)* } { $($binder:tt)* } $i:tt . 3) => { ... }; (impl @expand { $($orig:tt)* } { $($binder:tt)* } $i:tt = $($tail:tt)+) => { ... }; (impl @expand { $($orig:tt)* } { $($binder:tt)* } $i:tt $($tail:tt)+) => { ... }; (impl @context { $($orig:tt)* } $tail:tt) => { ... }; (impl @context { $($orig:tt)* } , $($tail:tt)+) => { ... }; (impl @context { $($orig:tt)* } $i:tt $($tail:tt)+) => { ... }; ($($tail:tt)+) => { ... }; }
Expand description
A helper to for the pattern let x2 = x; necessary to clone structs
destined for an async or 'static closure stack. This is like move || { .. } or move async { .. }, but for clone semantics. clone!() works
with symbols as well as properties and methods, using the last symbol name
in the method chain, or an alias via x = ... syntax.
§Examples
clone!(my_struct.option_method(), alias = my_struct.prop1.my_rc);
println!("These bindings exist: {:?} {:?}", option_method, alias);