Why does SimpleComponent
take in &Self::Root
, but SimpleAsyncComponent
takes in Self::Root
?
#560
Replies: 2 comments
-
I think this is because passing |
Beta Was this translation helpful? Give feedback.
-
I'd definitely prefer that, at least from the perspective of a new user trying to figure out what was going wrong. I know that GTK widgets are reference counted (afaik), so I wouldn't think there'd be much overhead (or at least not enough to be noticeable, especially compared to the time used in other parts of an application like rendering the UI itself). I haven't done any bench testing on that stuff, but in terms of ergonomics while switching between the two I definitely like both simply taking |
Beta Was this translation helpful? Give feedback.
-
I was migrating some components from using
SimpleComponent
to usingSimpleAsyncComponent
, and was greeted with this pretty confusing compiler error (at least until I found the solution):Changing
root: &Self::Root
toroot: Self::Root
fixed the issue, but this wasn't apparent until I manually checked the trait definitions for both.The page in the book talking about async components made me believe that I wouldn't have to think about it:
If there's some internal reason that
root
requiresSelf::Root
instead of&Self::Root
I think it'd be important to note, as a spent a hot minute trying to figure out what went wrong while swapping out the trait being used.Beta Was this translation helpful? Give feedback.
All reactions