Skip to main content

WindowBackend

Trait WindowBackend 

Source
pub trait WindowBackend: 'static {
    // Required method
    fn run(
        self: Box<Self>,
        app: App,
        options: WindowOptions,
        renderers: Vec<Box<dyn Renderer>>,
        a11y: Option<A11yBridgeFactory>,
    ) -> Result<(), WindowError>;
}
Expand description

A window backend: the OS window, the event loop, and the translation of platform events into the app’s messages.

Self::run takes the built app and drives it until the window closes: it opens the window from WindowOptions, attaches the first of renderers that binds to it, ticks the app on input and on the redraw requests in crate::window_backend::RedrawScheduler, and presents through Renderer. The launch dispatches through this trait once, for the whole run, so nothing per event goes through a vtable it would not otherwise.

Required Methods§

Source

fn run( self: Box<Self>, app: App, options: WindowOptions, renderers: Vec<Box<dyn Renderer>>, a11y: Option<A11yBridgeFactory>, ) -> Result<(), WindowError>

Run app in a window. Blocks until the window closes.

renderers are tried in order; one that fails to bind with RenderError::Init gives way to the next. a11y builds the accessibility bridge once the window exists, or is None for a run without one.

Implementors§