auto_into

Crates.ioauto_into
lib.rsauto_into
version0.1.0
sourcesrc
created_at2022-12-01 03:14:48.376835
updated_at2022-12-01 03:14:48.376835
descriptiona rust macro that provides (slight) ergonomics for writing functions
homepage
repositoryhttps://github.com/jvcmarcenes/auto_into
max_upload_size
id727284
size6,887
Joao (jvcmarcenes)

documentation

README

auto_into

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.

Usage

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
}
Commit count: 7

cargo fmt