diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-04-15 12:43:32 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-04-15 12:43:32 +0800 |
| commit | f029a51c1dd308ff8271c2be37d0fdc053552310 (patch) | |
| tree | 30704c833fe8ade5ea3bb1c0f71d286d37f013d8 /mingling_macros/src/lib.rs | |
| parent | 5a60cb2edf9d9c6db19f74d27033febbd5abfbd9 (diff) | |
Add register_type macro and use it in chain and renderer macros
Diffstat (limited to 'mingling_macros/src/lib.rs')
| -rw-r--r-- | mingling_macros/src/lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mingling_macros/src/lib.rs b/mingling_macros/src/lib.rs index da431d5..ffcf7e9 100644 --- a/mingling_macros/src/lib.rs +++ b/mingling_macros/src/lib.rs @@ -167,6 +167,19 @@ pub fn program_gen_completion(input: TokenStream) -> TokenStream { TokenStream::from(comp_dispatcher) } +/// Internal macro for registering types. +/// +/// This macro is used internally by the `#[chain]` and `#[renderer]` attribute macros +#[proc_macro] +pub fn register_type(input: TokenStream) -> TokenStream { + let type_entry = parse_macro_input!(input as syn::LitStr); + let entry_str = type_entry.value(); + + PACKED_TYPES.lock().unwrap().insert(entry_str); + + TokenStream::new() +} + #[proc_macro] pub fn program_final_gen(input: TokenStream) -> TokenStream { let name = read_name(&input); |
