[−][src]Module browser_window::application
This module contains runtime and application related handles.
Browser Window needs to be initialized, and also run its own runtime.
Once that is set up and running, all windows can be constructed and played around with.
To do this, you use Application::initialize
.
Then you have an Application
instance, from which you can obtain a new Runtime
instance.
Running it will grant you access to an application handle which you can manage the application with, and from which you can create all your windows with.
Example #1
Here is an example to show how you can construct your application:
use browser_window::application::*; fn main() { let application = Application::initialize(); let runtime = application.start(); runtime.run_async(|app| async move { // Do something ... }); }
Example #2
If you want to run another kind of runtime, like (tokio)[https://tokio.rs/] for example, its still possible to use Browser Window in conjunction with it. Here is an example:
use browser_window::application::*; use tokio; async fn alternative_main( app: ApplicationHandleThreaded ) { // Do something... } fn main() { let application = Application::initialize(); let tokio_runtime = tokio::runtime::Runtime::new().unwrap(); let bw_runtime = application.start(); runtime.run(|_app| { let app: ApplicationHandleThreaded = _app.into(); tokio_runtime.spawn( alternative_main( app ) ); }); }
Structs
Application | Use this to initialize and start your application with. |
ApplicationHandle | A thread-unsafe application handle. Often provided by for Browser Window. |
ApplicationHandleThreaded | A thread-safe application handle. This handle also allows you to dispatch code to be executed on the GUI thread from any other thread. |
Runtime | The runtime to run the application with. |
Type Definitions
ApplicationDelegateFuture | The future that dispatches a closure onto the GUI thread |