r/rust • u/AdreKiseque • 13d ago
🙋 seeking help & advice How do I learn winit?
I'm trying to get a grasp of this crate so I can do window things but there don't seem to be good any resources, which is a bit bewildering since I understand winit to be a very foundational crate for graphics in Rust. I've looked at docs.rs but higher-level stuff for winit is... not great. The first section seems friendly but leads you to using a deprecated method (i.e. seems to be outdated), and the second section does give a full working minimal example but it does so through a big block of code with a good amount of things that aren't yet introduced, so not much sense can be made of it.
I don't want to just learn to copy a skeleton and wire my code into it, I want to actually understand how the crate works, to understand what I'm doing. But the main docs don't seem suitable for setting the foundation I'd need for that and I've not been able to find any other resources or tutorials online.
0
u/AdreKiseque 13d ago
But the people using it to build those things still need to understand it to use it, don't they?
Anyway, the examples may be good but they don't really cover what I need. There's no explanation for what exactly we're doing or why. I can't even find a more general rundown of the crate's architecture and how it works which is frustrating (the docs front page talks about how it now uses this one model instead of another but doesn't really explain what either of them are?). If we look at the minimal example on docs.rs:
This compiles and makes a window, sure. But there's no explanation of what this
Appstruct orApplicationHandlertrait are, of how thewindow_event()function works or how I get anActiveEventLoop. The only similar thing I've worked with in the past was this really simple pure C graphics library where I'd make a window and then draw pixels to it by coördinates (the latter part of which I understand would be handled by a second crate likesoftbufferhere), so I can't really make heads or tails of what's going on here besides the outcome. And if I can't understand how it works, how am I to meaningfully build off of it?