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

#92 in #optional

Download history 1/week @ 2024-02-01 6/week @ 2024-02-08 11/week @ 2024-02-15 48/week @ 2024-02-22 34/week @ 2024-02-29 24/week @ 2024-03-07 25/week @ 2024-03-14 23/week @ 2024-03-21 40/week @ 2024-03-28 22/week @ 2024-04-04 95/week @ 2024-04-11 23/week @ 2024-04-18 26/week @ 2024-04-25 19/week @ 2024-05-02 22/week @ 2024-05-09 13/week @ 2024-05-16

85 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

~0.4–0.8MB
~20K SLoC