5 releases

0.2.0 Apr 12, 2024
0.2.0-alpha.1 Jan 15, 2024
0.1.5 Aug 9, 2021
0.1.4 Aug 9, 2021
0.1.0 Aug 8, 2021

#94 in #optional

Download history 21/week @ 2024-01-12 2/week @ 2024-02-02 7/week @ 2024-02-09 13/week @ 2024-02-16 48/week @ 2024-02-23 33/week @ 2024-03-01 27/week @ 2024-03-08 22/week @ 2024-03-15 26/week @ 2024-03-22 43/week @ 2024-03-29 17/week @ 2024-04-05 96/week @ 2024-04-12 21/week @ 2024-04-19 19/week @ 2024-04-26

162 downloads per month
Used in 4 crates (via proc-macro-kwargs)

MIT license

15KB
300 lines

proc-macro-kwargs

Keyword argument parsing for function-like procedural macros (Rust).

Example

example_macro!(
    name => bar,
    foo => i32
);

And here is the corresponding code in the proc macro:

#[derive(MacroKeywordArgs)]
struct MacroArgs {
    name: Ident,
    #[kwarg(optional)]
    optional: Option<syn::Expr>,
    #[kwarg(rename = "foo")
    tp: Type
}

See the tests for more detailed examples

Dependencies

~335–790KB
~19K SLoC