Function run_app_on_event_loop

Source
pub fn run_app_on_event_loop<A: ApplicationHandler + 'static>(
    event_loop: EventLoop<()>,
    app: &mut A,
    control_flow: ControlFlow,
) -> Result<(), EventLoopError>
Expand description

Sets [ControlFlow] and runs the handler on an existing event loop.

The call blocks until winit exits. On Linux it installs the Ctrl+C wake-up bridge and treats ExitFailure(1) as a normal platform teardown; every other event-loop result is preserved.

§Errors

Returns any non-normalized winit event-loop failure.

§Examples

use winit::{application::ApplicationHandler, event_loop::{ControlFlow, EventLoop}};
fn run<A: ApplicationHandler + 'static>(loop_: EventLoop<()>, app: &mut A) {
    ailloli_ui_winit::run_app_on_event_loop(loop_, app, ControlFlow::Wait).unwrap();
}