[][src]Crate loosen


Declares a derive-like function attr macro which creates another wrap-like function with single tuple-loosened argument, retrieved from the former function.

Upon call, the loosened function propagates the call with the flattened input tuple as arguments to the original function.


fn fa(a: A, b: B) {}

// normal call
fa(A, B);

// loose call
let args = (A, B);
// ie. instead of two arguments,
// there is only a single tuple argument

// another usage exaple
    .map(|_| (A, B))


This is a draft and is my first try on proc-macros. I suggested this as an rfc before realising a proc macro would suffice: https://github.com/rust-lang/rfcs/issues/2667

Attribute Macros


For a function fa(A, B), derives fa_loose((A, B,)) which calls fa(A, B).