8 releases

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

#385 in Procedural macros

Download history 5/week @ 2024-01-08 8/week @ 2024-01-15 4/week @ 2024-02-05 5/week @ 2024-02-12 10/week @ 2024-02-19 82/week @ 2024-02-26 19/week @ 2024-03-04 22/week @ 2024-03-11 20/week @ 2024-03-18 24/week @ 2024-03-25 37/week @ 2024-04-01 80/week @ 2024-04-08 23/week @ 2024-04-15

165 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