proc-macro-kwargs

Crates.ioproc-macro-kwargs
lib.rsproc-macro-kwargs
version0.2.0
sourcesrc
created_at2021-08-08 00:51:48.154508
updated_at2024-04-12 18:22:53.654703
descriptionKeyword argument parsing for function-like proc-macros
homepage
repositoryhttps://github.com/DuckLogic/proc-macro-kwargs
max_upload_size
id432969
size23,778
(Techcable)

documentation

README

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

Commit count: 22

cargo fmt