Skip to main content

invoke_from_active_event_loop

Function invoke_from_active_event_loop 

Source
pub fn invoke_from_active_event_loop(
    func: impl FnOnce(&ActiveEventLoop) + Send + 'static,
) -> Result<(), EventLoopError>
Available on crate feature unstable-winit-030 only.
Expand description

Schedules a callback to be invoked in the winit event loop, and passes winit’s ActiveEventLoop to it.

This is similar to slint::invoke_from_event_loop, but the callback also receives the ActiveEventLoop, which winit only exposes while the event loop is running. Use it to call winit APIs that need it, for example to create custom windows.

This function can be called from any thread. It returns an error if the winit backend hasn’t been installed yet, or if the event loop has terminated.