| Crates.io | bind |
| lib.rs | bind |
| version | 0.1.1 |
| created_at | 2024-01-08 16:45:54.086212+00 |
| updated_at | 2024-01-10 11:43:43.476253+00 |
| description | Proc macro for binding values into an expression (usually a closure) |
| homepage | |
| repository | https://github.com/oooutlk/bind |
| max_upload_size | |
| id | 1092787 |
| size | 18,155 |
This crate provides a proc macro to generate "let bindings" automatically,
usually cloning values into an expression(usually a closure). Inspired by
crate enclose.
bind!( ( comma_separated_list_of_var_bindings ) the_expr_that_uses_the_vars )
comma_separated_list_of_var_bindings is in the form of
var_binding, another var_binding, ....
var_binding is in the form of:
id, generating let id = id.clone();
mut id, generating let mut id = id.clone();
new_id = id, generating let new_id = id.clone();
mut new_id = id, generating let mut new_id = id.clone();
id = expr, generating let id = expr;
mut id = expr, generating let mut id = expr;
expr, generating let the_only_id_in_the_expr = expr;,
e.g. bind!( (s.to_owned()) .. ) generates let s = s.to_owned().
mut expr, generating let mut the_only_id_in_the_expr = expr;
e.g. bind!( (mut s.to_owned()) .. ) generates let mut s = s.to_owned().