Macro transfer

Source
macro_rules! transfer {
    (|| $block:block) => { ... };
    (|$($param:ident: $ty:ty),*| $block:block) => { ... };
}
Expand description

On WASM, JsValues cannot be shared between scopes but instead can be “transferred”. Rust however is not aware of transferables and therefore cannot capture these values. This macro wraps a closure and returns a TransferClosure on WASM platforms which will capture these special values, or a normal FnOnce on other platforms. Note that the parameter names must match available variables/bindings from the outer scope.