[][src]Function vgtk::run

pub fn run<C: 'static + Component>() -> i32

Run an Application component until termination.

This is generally the function you'll call to get everything up and running. Note that you pass your top level component as a type argument, not a value argument. The framework will construct the component state automatically using Default::default() before launching the component.

You can call vgtk::quit() from inside the component or any subcomponent to signal the application to terminate normally. This is equivalent to calling Application::quit() on the Application object directly.

It's the equivalent of calling vgtk::start::<Component>() and then calling Application::run() on the returned Application object.

If the component doesn't have an Application as its top level object, this function will panic.

Examples

let return_code = vgtk::run::<MyComponent>();
std::process::exit(return_code);