Remix.run Logo
iTokio 3 hours ago

I almost never use inheritance beside using some kind of interfaces/traits to declare a contract.

However, the only time where I’m missing code/data reuse through inheritance is with GUI. Some mostly flat hierarchies of widgets are really powerful ways to declare and compose UI components with shared behaviors.

In rust, the DX for GUI components is always lacking compared to web, C#. With maybe the exception of Slint which is really not Rust anymore.

Is there a way to have good DX for GUI components in Rust?

h4x0rr 7 minutes ago | parent | next [-]

Isn't composition (react style) better for GUIs anyways?

aabhay 2 hours ago | parent | prev [-]

If you want to get inspired by good component DX, try looking at Bevy, the game engine.

But essentially it comes down to traits, newtypes/enum variants, and macros.