diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-06-22 20:21:41 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-06-22 20:21:41 +0800 |
| commit | d7c9ad94113cca2f782666e37a0aa4fb7b8d7d86 (patch) | |
| tree | 323dfc74a274463500ac52c7bb7b83029b771411 /mingling_macros/src/chain.rs | |
| parent | 232f31c6649e6348a5b0b64362f185f7f4db1dc0 (diff) | |
Support qualified type paths in four macros
Diffstat (limited to 'mingling_macros/src/chain.rs')
| -rw-r--r-- | mingling_macros/src/chain.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mingling_macros/src/chain.rs b/mingling_macros/src/chain.rs index fb5999a..eaf43fb 100644 --- a/mingling_macros/src/chain.rs +++ b/mingling_macros/src/chain.rs @@ -377,15 +377,17 @@ pub fn chain_attr(attr: TokenStream, item: TokenStream) -> TokenStream { /// Builds a match arm for chain mapping pub fn build_chain_arm(struct_name: &Ident, previous_type: &TypePath) -> proc_macro2::TokenStream { + let enum_variant = &previous_type.path.segments.last().unwrap().ident; quote! { - #struct_name => #previous_type, + #struct_name => #enum_variant, } } /// Builds a match arm for chain existence check pub fn build_chain_exist_arm(previous_type: &TypePath) -> proc_macro2::TokenStream { + let enum_variant = &previous_type.path.segments.last().unwrap().ident; quote! { - Self::#previous_type => true, + Self::#enum_variant => true, } } |
