Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

swfsql/loosen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Example

# extern crate loosen;
# use loosen::loose;
#
# pub struct A;
# pub struct B;
# 
#[loose]
fn fa(a: A, b: B) {}

// normal call
fa(A, B);

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

// another usage exaple
(0..10)
    .map(|_| (A, B))
    .map(fa_loose)
    .collect::<Vec<_>>();

Note

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: rust-lang/rfcs#2667

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages