pub trait AppRunWindowExt {
// Required method
fn run_window<F>(self, new_window: impl IntoFuture<IntoFuture = F>)
where F: Future<Output = WindowRoot> + Send + 'static;
}
Expand description
Extension trait, adds run_window
to AppExtended
.
Required Methods§
sourcefn run_window<F>(self, new_window: impl IntoFuture<IntoFuture = F>)
fn run_window<F>(self, new_window: impl IntoFuture<IntoFuture = F>)
Runs the application event loop and requests a new window.
The window opens after the future returns it. The WINDOW
context for the new window is already available in the new_window
future.
This method only returns when the app has exited.
§Examples
APP.defaults().run_window(async {
println!("starting app with window {:?}", WINDOW.id());
Window! {
title = "Window 1";
child = Text!("Window 1");
}
})
Which is a shortcut for:
APP.defaults().run(async {
WINDOWS.open(async {
println!("starting app with window {:?}", WINDOW.id());
Window! {
title = "Window 1";
child = Text!("Window 1");
}
});
})
Object Safety§
This trait is not object safe.