You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you need to generate C++ code for a generic, documentation needs more information on how to obtain correct code, or serde-generate needs to generate valid code for C++ generics when using recommended procedure
To reproduce
Extended from the example in serde-name, recommended in serde-reflection docs.
Hi @johnperry-math, Thanks for the report. You were almost there! What's missing is applying some form of name mangling on top of std::any::type_name::<Self>() in both places. Perhaps an existing crate like mangling would do it?
Explanation: The code of serde-generate currently assumes that the names in the registry look like typical Rust identifiers (without special characters). I think that's fair because support for generics is highly experimental. If there is enough interest, we could enforce this invariant and provide examples of work-around.
I'm sorry it's taken me a while to reply. I think I found a workaround at the time, and I didn't worry about it when you replied, and then it fell off my radar, and then when I did remember, I didn't quite follow what you're saying, and... well, here we are.
I took a look at the mangling crate, and I'm not sure how that's supposed to help. Am I supposed to:
...use a serde rename to indicate:
the desired C++ type? (template <typename T> Foo<T>) or
the compiler-mangled type? (not sure and 😨 to find out)
...write a custom macro to tell serde-reflection what to do?
🐛 Bug
If you need to generate C++ code for a generic, documentation needs more information on how to obtain correct code, or serde-generate needs to generate valid code for C++ generics when using recommended procedure
To reproduce
Extended from the example in serde-name, recommended in serde-reflection docs.
Generated C++ code
😢
Expected C++ code
System information
Please complete the following information:
Additional context
I've also tried this at least with
trace_type
.The text was updated successfully, but these errors were encountered: