Crates.io | proc-macro-kwargs |
lib.rs | proc-macro-kwargs |
version | 0.2.0 |
source | src |
created_at | 2021-08-08 00:51:48.154508 |
updated_at | 2024-04-12 18:22:53.654703 |
description | Keyword argument parsing for function-like proc-macros |
homepage | |
repository | https://github.com/DuckLogic/proc-macro-kwargs |
max_upload_size | |
id | 432969 |
size | 23,778 |
Keyword argument parsing for function-like procedural macros (Rust).
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