8 releases
0.2.0 | Apr 12, 2024 |
---|---|
0.2.0-alpha.1 | Jan 15, 2024 |
0.1.5 | Aug 9, 2021 |
#459 in Procedural macros
Used in 3 crates
(via luao3-macros)
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.6MB
~32K SLoC