8 releases

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

#421 in Procedural macros

Download history 1/week @ 2024-02-01 4/week @ 2024-02-08 9/week @ 2024-02-15 60/week @ 2024-02-22 34/week @ 2024-02-29 20/week @ 2024-03-07 24/week @ 2024-03-14 21/week @ 2024-03-21 35/week @ 2024-03-28 17/week @ 2024-04-04 89/week @ 2024-04-11 21/week @ 2024-04-18 24/week @ 2024-04-25 17/week @ 2024-05-02 18/week @ 2024-05-09 13/week @ 2024-05-16

77 downloads per month
Used in 3 crates (via luao3-macros)

MIT license

22KB
465 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


lib.rs:

Keyword argument parsing for function-like procedural macros.

Dependencies

~1–1.7MB
~33K SLoC