Skip to content

oooutlk/bind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A proc macro for binding values into an expression (usually a closure).

Why This Project

Sometimes we are forced to write some boring code like:

let foo2 = foo.clone();
let bar2 = *bar;
let baz2 = baz.to_owned();
let f = move |args| {
    // access to foo2, bar2 and baz2
};

It's quite annoying, messing up the source code and the readers can't focus on business logic. Some crates have been published to dealing with this, and the bind crate is yet another one, inspired by crate enclose, which provides a convenient declarative macro. Since crate bind is a proc_macro, it can do more than macro_rules.

Example

let f = bind!( ( foo,*bar,baz.to_owned() )
    move |args| {
        // access to foo, bar and baz
    }
);

See bind/README.md for more.

License

Under Apache License 2.0 or MIT License, at your will.

About

A proc macro to help bind values into (closure) expressions

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages