pub fn run<H, B>(config: ShellConfig, build: B) -> Result<(), ShellError>Expand description
Open a window, bring up wgpu, build the app, and run the event loop until the window closes.
build is called once the window and the GPU exist — the device scale,
input profile and surface size are already in place, which is what a widget
tree wants to see while it is being built. It returns the App and the
ShellHost that carries the app’s own per-frame plumbing; a host with
nothing to add is crate::NoHost.
use agg_gui_shell::{run, NoHost, ShellConfig};
run(ShellConfig::new("My App"), move |_init| Ok((app, NoHost)))§Ordering
- Restore and sanitise the saved window size, then refine it against the
real monitor once the window exists (winit 0.30 only exposes monitors
through a live
Window). - Create the window hidden, finish wgpu setup, build the app, and paint the first real frame before showing it — otherwise the user sees an unstyled OS-default background and a black border around the not-yet-configured surface.
- Install the agg-gui host waker only after the window and GPU came up,
and clear it on every exit path (
HostWakerGuard).