This repository has been archived by the owner on Aug 6, 2023. It is now read-only.
Is it good idea that rendering a widget consumes it? #523
JerzySpendel
started this conversation in
General
Replies: 2 comments
-
Agreed on this point. It does seem unnecessary. One could implement Widget for |
Beta Was this translation helpful? Give feedback.
0 replies
-
@JerzySpendel Is a way or workaround to make your second snippets work? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'll copy the trait definition so that we know what we're talking about:
From some other issues I get that you wanted to keep Widgets simple, but why does that have to imply that render method must consume itself? If the trait is defined like that it makes it impossible to have for example vector of different Widget types and call
render
on each of them, because Widget is not object-safe.So something like this:
is not possible, because self's type is not known at compile time. In my opinion it effectively disables polymorphism. Is there any other way I could iterate over widgets and draw them iteratively?
Beta Was this translation helpful? Give feedback.
All reactions