single_line_macro-0.2.1 has been yanked.
single_line_macro
A small procedural macro that lets you define one-line functions and methods using => expr syntax.
Features
- Define methods with
&selfor&mut self, with any number of parameters. - Define associated functions and free functions, with or without the
fnkeyword. - Support for doc comments (
///) — they will appear in generated documentation. - Automatically expands a single-field expression
xintoself.xwithin methods. - Zero-dependency (besides
synandquote). - Support async keyword
Installation
Add this to your crate’s Cargo.toml:
[]
= "0.2.x"
And in your code:
use single_line;
Or rename it:
use single_line as sl;
use single_line;
// Free functions:
single_line!;
single_line!;
more examples in the test folder