4 releases

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

#84 in #optional

Download history 10/week @ 2023-11-20 6/week @ 2023-11-27 2/week @ 2023-12-11 8/week @ 2023-12-18 5/week @ 2023-12-25 9/week @ 2024-01-08 16/week @ 2024-01-15 5/week @ 2024-02-05 8/week @ 2024-02-12 11/week @ 2024-02-19 67/week @ 2024-02-26 23/week @ 2024-03-04

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

MIT license

15KB
314 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

~0.4–0.8MB
~20K SLoC