diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-05-16 22:31:52 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-05-16 22:31:52 +0800 |
| commit | 60b91db3df168532f9143f0cafb7b5166e1dc78b (patch) | |
| tree | ddb10f909a46033af16d725ab0dae8385227b985 /mingling_macros/src/program_setup.rs | |
| parent | 05d07bbc627b59fd07a8764a972b4aac63a46f53 (diff) | |
Accept paths for program name parameters in macros
All proc macros (`pack!`, `dispatcher!`, `#[chain]`, `#[program_setup]`,
`#[dispatcher_clap]`, `#[derive(Groupped)]`) now parse program names as
`syn::Path` instead of bare `Ident`, allowing use of paths like
`crate::MyProgram` or `my_crate::MyProgram`.
The default program name `ThisProgram` is no longer re-exported or
required
as an import — generated code references `crate::ThisProgram` directly.
Diffstat (limited to 'mingling_macros/src/program_setup.rs')
| -rw-r--r-- | mingling_macros/src/program_setup.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mingling_macros/src/program_setup.rs b/mingling_macros/src/program_setup.rs index dd32581..383d632 100644 --- a/mingling_macros/src/program_setup.rs +++ b/mingling_macros/src/program_setup.rs @@ -53,8 +53,8 @@ pub fn setup_attr(attr: TokenStream, item: TokenStream) -> TokenStream { let (program_name, use_crate_prefix) = if attr.is_empty() { (crate::default_program_path(), true) } else { - let ident: Ident = parse_macro_input!(attr as Ident); - (quote! { #ident }, false) + let path: syn::Path = parse_macro_input!(attr as syn::Path); + (quote! { #path }, false) }; // Parse the function item |
