Warning
This post was published 55 days ago. The information described in this article may have changed.
I'm working on a library in which I have a bunch of Widget
types (Label, Button, Switch, VStack, List, etc), and I'm currently storing Widgets
in SlotMaps, keyed by WidgetId
. My widget slot-maps are currently part of root Window
, so I can find a widget with a Window
+WidgetId
pair, which in other languages might be just a Widget
object pointer.
My question is, should I pass the Window
around everywhere, or should I move my widget slot-maps to a static mut
container, so that I only pass around WidgetIds
? I thought static muts
where "bad", but passing around the Window
also seems awkward. Maybe it's just that I need to get used to it, because it's different from other languages.
[edit to clarify: widgets vs widget types]
7 posts - 3 participants
🏷️ rust_feed