AppRunWindowExt

Trait AppRunWindowExt 

Source
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§

Source

fn run_window<F>(self, new_window: impl IntoFuture<IntoFuture = F>)
where F: Future<Output = WindowRoot> + Send + 'static,

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");
        }
    });
})

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<E: AppExtension> AppRunWindowExt for AppExtended<E>

Source§

fn run_window<F>(self, new_window: impl IntoFuture<IntoFuture = F>)
where F: Future<Output = WindowRoot> + Send + 'static,

Implementors§