To initialize a winit
window and event loop in Rust, you can use the following code:
main.rs397 chars16 lines
This code creates a new EventLoop
and Window
instance, and then starts the event loop by calling the run
method.
The move
keyword is used to move ownership of the event loop and control flow into the closure provided to run
.
Within the closure, events can be handled and the control flow can be set to Wait
to keep the event loop running.
gistlibby LogSnag