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
Trying to use the component macro on a component that takes in a props struct with a generic type argument doesn't work as I might expect:
It's possible I'm missing something, but when I remove the macro, the resulting function correctly correlates the type definition to the struct in its arguments.
The text was updated successfully, but these errors were encountered:
Thanks for the report. You're not missing anything. This just isn't a use-case I had considered. It is one I'd like to support though.
It's actually possible with the current release to define generic components without using the #[component] macro, and the element! macro supports generic type parameters just fine.
Adding/fixing support for type and const parameters with the #[component] macro is easy enough: #33
I've just merged that and assuming I don't find any issues it'll go out with the next release. Until then, you can try it via:
There is a caveat: Whether using the #[component] macro or not, the type parameters must be 'static. So you'll need to declare your function like fn ListBox<T: 'static>. I don't see any obvious way around that unfortunately. I'd be interested to hear if that gets in the way of your or anyone else's use-case.
Trying to use the component macro on a component that takes in a props struct with a generic type argument doesn't work as I might expect:
It's possible I'm missing something, but when I remove the macro, the resulting function correctly correlates the type definition to the struct in its arguments.
The text was updated successfully, but these errors were encountered: