winit icon indicating copy to clipboard operation
winit copied to clipboard

Feedback on migration to trait-based design

Open madsmtm opened this issue 2 months ago • 18 comments

Thank you for your interest in expressing your feedback on Winit v0.30!

Background

Winit is moving towards a trait-based API for several reasons, see https://github.com/rust-windowing/winit/issues/3432 for details. This has quite a large impact on how you structure your code, and while the design is not yet optimal, and will need additional work, we feel confident that this is the right way forwards, so in v0.30, we've tried to provide a somewhat gentle update path.

Feedback

We're aware that the API is more verbose, that is to be expected when implementing an entire trait instead of letting the compiler figure out the type annotations of a closure, but we're interested in knowing what kinds of code is made harder or impossible with this new design? Were you using some pattern before that you can no longer do, or no longer easily do? Please state so in a comment on this issue!


In this release, we also changed how windows are created, but that is not strictly part of this issue - please submit a new issue if you're having trouble with that. Note that we're well aware that Option<Window> is a bit cumbersome, in the future, managing the state for windows and creating/destroying them at the right times will likely become easier to do, see https://github.com/rust-windowing/winit/issues/2903 for some of the progress on that.

madsmtm avatar Apr 12 '24 11:04 madsmtm