Struct async_winit::event_loop::EventLoop
source · pub struct EventLoop { /* private fields */ }
Expand description
Provides a way to retrieve events from the system and from the windows that were registered to the events loop.
The EventLoop
is a “context” for the GUI system. More specifically, it represents a connection
to the underlying GUI system. The EventLoop
is the main object that you will use to drive
the program. Most async
functions in async-winit
rely on the EventLoop
to be currently
running.
The EventLoop
itself is !Send
and !Sync
due to underlying platform restrictions. However,
EventLoopWindowTarget
and [
Window] are both not only
Sendand
Sync`, but also cheaply
clonable. This means that you can create a window on one thread, and then send it to another
thread to be used.
Implementations§
source§impl EventLoop
impl EventLoop
sourcepub fn window_target(&self) -> &EventLoopWindowTarget
pub fn window_target(&self) -> &EventLoopWindowTarget
Manually get a reference to the event loop’s window target.
sourcepub fn block_on(self, future: impl Future<Output = Infallible> + 'static) -> !
pub fn block_on(self, future: impl Future<Output = Infallible> + 'static) -> !
Block on a future forever.
Methods from Deref<Target = EventLoopWindowTarget>§
sourcepub fn set_exit_with_code(&self, code: i32)
pub fn set_exit_with_code(&self, code: i32)
Request that we exit as soon as possible with the given exit code.
sourcepub async fn exit_with_code(&self, code: i32) -> !
pub async fn exit_with_code(&self, code: i32) -> !
Exit the program with the given exit code.
sourcepub async fn primary_monitor(&self) -> Option<MonitorHandle>
pub async fn primary_monitor(&self) -> Option<MonitorHandle>
Get the primary monitor.
sourcepub async fn available_monitors(&self) -> impl Iterator<Item = MonitorHandle>
pub async fn available_monitors(&self) -> impl Iterator<Item = MonitorHandle>
Get the available monitors.
sourcepub async fn set_device_event_filter(&self, filter: DeviceEventFilter)
pub async fn set_device_event_filter(&self, filter: DeviceEventFilter)
Set the device event filter.
Trait Implementations§
source§impl EventLoopExtRunReturn for EventLoop
impl EventLoopExtRunReturn for EventLoop
source§fn block_on_return<F>(&mut self, fut: F) -> ReturnOrFinish<i32, F::Output>where
F: Future,
fn block_on_return<F>(&mut self, fut: F) -> ReturnOrFinish<i32, F::Output>where F: Future,
winit
event loop. Read more