| Crates.io | auto_into |
| lib.rs | auto_into |
| version | 0.1.0 |
| created_at | 2022-12-01 03:14:48.376835+00 |
| updated_at | 2022-12-01 03:14:48.376835+00 |
| description | a rust macro that provides (slight) ergonomics for writing functions |
| homepage | |
| repository | https://github.com/jvcmarcenes/auto_into |
| max_upload_size | |
| id | 727284 |
| size | 6,887 |
this macro was born out of this internals.rust discusssion.
i've come around to thinking that this is an anti-pattern, i don't recommend you actually use this create. but developing it was cool and it works as a proof-of-concept if this discussion is ever brought up again.
here's the code example
use auto_into::auto_into;
#[auto_into]
fn takes_whatever(#[into] _: String) { }
fn main() {
takes_whatever("lorem"); // &str
takes_whatever(std::borrow::Cow::Borrowed("ipsum")); // moo
takes_whatever(format!("{} sit", "dolor")); // String
takes_whatever('a'); // char
}