Struct browser_window::application::Runtime
source · pub struct Runtime { /* private fields */ }
Expand description
The runtime to run the application with.
This runtime will run until all windows have been closed and the (async)
closure given to the run*
functions have ended.
Implementations§
source§impl Runtime
impl Runtime
sourcepub fn run<H>(&self, on_ready: H) -> i32where
H: FnOnce(ApplicationHandle),
pub fn run<H>(&self, on_ready: H) -> i32where
H: FnOnce(ApplicationHandle),
Run the main loop and executes the given closure on it.
§Arguments
on_ready
- This closure will be called when the runtime has initialized, and will provide the caller with an application handle.
§Reserved Codes
-1 is used as the return code for when the main thread panicked during a delegated closure.
sourcepub fn run_async<'a, C, F>(&'a self, func: C) -> i32
pub fn run_async<'a, C, F>(&'a self, func: C) -> i32
Runs the main loop and executes the given future within that loop.
This function exits when the future finishes or when exit
is called.
Keep in mind that calls to async functions or futures may not necessarily finish. Exiting the application causes the runtime to stop, and it doesn’t necessarily complete all waiting tasks.
§Reserved Codes
The same reserved codes apply as run
.
Auto Trait Implementations§
impl Freeze for Runtime
impl RefUnwindSafe for Runtime
impl !Send for Runtime
impl !Sync for Runtime
impl Unpin for Runtime
impl UnwindSafe for Runtime
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more